[Bug] vis reports legacy tool-triggered swarm sessions as active
Maintainers usually reply within 1 day
@louisss1016 is already working on this.
Since Oct 26, 2026.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 85/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
- Domain
- developer-experience
Research direction
The fix is in apps/vis/server/src/lib/context-projector.ts: do not set swarm active when rec.trigger === 'tool'. Add a legacy tool-trigger test and a user-triggered enter test in apps/vis/server/test/lib/context-projector.test.ts. Run those tests and vis typecheck; done when vis matches engine replay for unmatched tool-triggered enter records.
Written by the indexing model from the issue text.
Description
Problem
The engine replay and foldWireRecordFacts now ignore a legacy unmatched swarm_mode.enter record whose trigger is tool, so an interrupted session written by an older version resumes with swarm mode off. The visual debugger has an independent projection path: apps/vis/server/src/lib/context-projector.ts still handles every swarm_mode.enter as swarm = { active: true, trigger: rec.trigger }, and ContextTab renders that state as a swarm mode pill.
The same persisted session can therefore be reported as swarm-off by the engine and transcript history, but swarm-on by vis until a later exit record appears.
Reproduction
- Open vis for an older wire containing
swarm_mode.enterwithtrigger: 'tool'and no matchingswarm_mode.exit. - Open the Context tab.
- Observe that
projectContext(...).swarm.activeistrueand the UI showsswarm mode, while engine replay andfoldWireRecordFactsleave swarm mode off.
Expected: vis mirrors the engine and transcript behavior for this legacy record. Actual: only vis reports swarm mode as active.
Affected population and severity
This affects vis users inspecting sessions written by versions that allowed model-started swarms, specifically wires with an unmatched tool-triggered enter record. It does not change engine execution or the released CLI behavior, but it can mislead debugging by showing a mode that is not actually active.
Suggested fix and tests
- In
apps/vis/server/src/lib/context-projector.ts, do not activate swarm forswarm_mode.enterwhenrec.trigger === 'tool'; preserve the existing behavior for manual/task triggers and exit records. - Extend
apps/vis/server/test/lib/context-projector.test.tsbesidetracks swarm mode enter/exitwith a legacy tool-trigger case that remains inactive, plus coverage that a subsequent user-triggered enter still activates swarm mode. - Run the vis server context-projector tests and vis typecheck.
Why this is separate from #4387
https://github.com/MoonshotAI/kimi-code/pull/4387 only back-syncs the already-released 2.3.2 hotfix. The vis projector and its test are unchanged between that PR's base and HEAD. Adding a new vis behavior fix to the back-sync would make main diverge from the released hotfix and expand its scope, so it is tracked here for a separate fix and release decision instead.
ticket: #813895
- Dominant language
- TypeScript
- Stars
- 8k
- Forks
- 1.3k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 130
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from MoonshotAI/kimi-code
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
MoonshotAI/kimi-code#4398 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
MoonshotAI/kimi-code#4392 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
MoonshotAI/kimi-code#4381 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
MoonshotAI/kimi-code#4369 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
MoonshotAI/kimi-code#4368 ·
Maintainers usually reply within 1 day
All issues in MoonshotAI/kimi-code
Similar issues
-
category::task code priority::normal
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
e0ipso/strikethroo#145 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 85/100
cocos/cocos-docs#3333 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
RevenueCat/react-native-purchases#2079 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
RevenueCat/purchases-hybrid-common#2039 ·
Maintainers usually reply within 1 day
-
agent-reported area/react bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day