Repository navigation
feat: add default_swarm_mode config and remove the swarm mode enter reminder - #5352
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
commit: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ee4400252f
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| "@moonshot-ai/kimi-code": minor | ||
| --- | ||
|
|
||
| Add the `default_swarm_mode` config option: new sessions start in swarm mode by default. Unlike `default_plan_mode`, it also applies in non-interactive mode (`kimi -p`). |
There was a problem hiding this comment.
Add product release notes for removed swarm guidance
For CLI and desktop swarm users, the product changesets only announce the new default-mode setting, while this same diff removes the enter reminder and its workflow guidance. The only changeset that mentions this loss targets @moonshot-ai/agent-core-v2, so the CLI and desktop release notes will not tell affected users that the model behavior changed; add separate product changesets for @moonshot-ai/kimi-code and kimi-code-app that state the guidance removal.
AGENTS.md reference: AGENTS.md:L171-L171
Useful? React with 👍 / 👎.
| @@ -0,0 +1,5 @@ | |||
| --- | |||
| "@moonshot-ai/node-sdk": minor | |||
There was a problem hiding this comment.
Target the actual SDK package in the changeset
The workspace at packages/node-sdk/package.json is named @moonshot-ai/kimi-code-sdk, and a repo-wide search finds no package named @moonshot-ai/node-sdk. This frontmatter therefore cannot associate the change with the modified SDK during release planning; replace it with the actual workspace package name so the SDK is versioned and receives the changelog entry.
Useful? React with 👍 / 👎.
| :model-value="configBool(config.defaultSwarmMode)" | ||
| :label="t('settings.defaultSwarmMode')" | ||
| @update:model-value="toggleConfigBoolean('defaultSwarmMode')" |
There was a problem hiding this comment.
Apply the configured default to the desktop draft mode
When a desktop or web user enables this setting with no active session, the composer still reads draftModes.swarmMode, which is initialized to false; createDraftSession only persists a truthy draft value, and DaemonKimiWebApi.createSession has no swarmMode input. The server consequently starts the first turn in swarm mode from the new global default while the pre-session UI shows it as off, and even toggling on and back off cannot express a per-session override. Hydrate the draft from the config and send the final explicit boolean when creating the session.
Useful? React with 👍 / 👎.
| @@ -0,0 +1,5 @@ | |||
| --- | |||
| "@moonshot-ai/agent-core-v2": patch | |||
There was a problem hiding this comment.
Version the removed state contract as breaking
Removing swarmReminderDelivered from the generated AgentStateSnapshot contract breaks consumers that compile against or inspect that state key, but this entry requests only a patch bump and the companion agent-core entry raises the effective release only to minor. Either retain a compatibility representation or obtain the required approval and release this contract removal as a major change.
AGENTS.md reference: AGENTS.md:L90-L90
Useful? React with 👍 / 👎.
🦋 Changeset detectedLatest commit: d8545f3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 11 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
…eminder (#5352) * feat: add default_swarm_mode config to start new sessions in swarm mode * refactor(agent-core-v2): remove the swarm mode enter reminder * chore: address changeset review findings
…eminder (#5352) * feat: add default_swarm_mode config to start new sessions in swarm mode * refactor(agent-core-v2): remove the swarm mode enter reminder * chore: address changeset review findings
Requirement or Bug
Users who want every session to run with swarm mode have to turn it on manually (
/swarmor the composer toggle) in each new session — there is no config counterpart todefault_plan_mode. Separately, turning swarm mode on injects a long enter reminder into the conversation every time, which is pure noise for anyone who keeps swarm on by default. This PR addsdefault_swarm_mode(mirroringdefault_plan_modeacross every config surface) and removes the swarm enter reminder entirely.Bug Reproduction Steps
N/A (feature PR).
Root Cause
N/A (feature PR).
Code Changes
Two themes, one commit each. The branch is rebased onto the
release/2026-11-25tip.1.
default_swarm_modeconfig (feat commit). A new top-level boolean config (defaultfalse), registered next to the existing[swarm]section inpackages/agent-core-v2/src/features/swarm/configSection.ts. The single enforcement point is session creation insessionLifecycleService.create(): when the config istrue, the main agent enters swarm mode with themanualtrigger (the only persistent trigger —taskauto-exits at turn end,toolis rejected). This one choke point covers TUI,kimi -p, ACP, and SDK session creation. The config is then mirrored across every surfacedefault_plan_modealready occupies: node-sdk (KimiConfigSchema/ patch schema / TOML writer / v2 config domains), the KAP host config API (GET/POST /api/v1/config, schema docs regenerated viapnpm qa:refresh schema,HOST_CONTRACTdigest re-pinned withapiLevelunchanged since the field is additive-optional), app-core daemon wire/mappers/client/types, a desktop Settings toggle with en/zh copy, TUI lazy appState hydration, the regenerated config manifest, and the bilingual config docs. Unlikedefault_plan_mode, the default is applied in non-interactive mode (kimi -p) — a deliberate product decision: it makes swarms available in print/ACP sessions, gated behind the explicit opt-in config.2. Swarm enter reminder removal (refactor commit).
SwarmInjection,enter-reminder.md, and theswarmReminderDeliveredreplayable state (plus its tests and checkpoint exemption) are deleted; state/wire manifests regenerated. Old sessions replay safely: state is rebuilt by folding events (theSwarmModeEnter/Exitevent classes stay), and previously recordedswarm_modeinjection messages remain in history as plain context — pinned by the reworked testreplays sessions that recorded a legacy enter reminder as plain history.Two enabling fixes surfaced during the work:
ContextAppendMessage(durable) was only ever registered as a side effect of the removed fold ("fold = register"), so deleting the fold silently droppedcontext.append_messagefrom the wire manifest. It is now registered explicitly at its declaration, matching the existingmirrorAgentRun.tspattern; runtime behavior is unchanged.check:duplicationflagged the response-vs-patch schema self-clones inrest-config.tsand node-sdkschema.tsonce the new field shifted their fingerprints. Fixed in code by extracting the shared field sets (configFieldsSchema+.extend(),sessionModeFieldsspread) — validation behavior is identical and the contract digest did not move.Behavior Changes and Affected Users
default_swarm_mode = truemanualtrigger), includingkimi -pand ACP sessionsfalsekeeps current behaviorfalse/swarm, composer toggle)AgentSwarmtool descriptionswarmReminderDeliveredreplayable stateGET/POST /api/v1/config)default_swarm_modefieldapiLevelstays 1)kimi -p/ ACPdefault_swarm_mode = trueTest coverage per row: TUI startup hydration cases extended (
defaultSwarmMode→swarmModein appState, both cold start and session-less login); newdefaultSwarmMode config sectionregistration test in core config tests; legacy-replay test for old sessions; kap-serverapiSurface(re-pinned digest) and config round-trip tests; manualkimi -pend-to-end with a tempKIMI_CODE_HOMEverifiedswarm_mode.enter(trigger: manual) in the session wire with no reminder injection.Deleted tests (all covered the intentionally removed injection behavior):
delivers enter guidance at the first step…,delivers enter guidance only once…,keeps history on exit and delivers once for each new activation,keeps enter guidance when a later context message…,does not duplicate the enter guidance on resume…,delivers once after replay when a new activation is still pending, and theswarm context reconciliationend-to-end case. Continuing coverage: mode transitions, telemetry, wire persistence, tool-trigger rejection, batch guarding tests are untouched, and the legacy-replay test pins the compat story for histories written by older versions.Checklist
/approve). — internal task, no issuegen-changesetsskill, or this PR needs no changeset. — 6 changesets includedgen-docsskill, or this PR needs no doc update. —config-files.md(en/zh) updated in this PR