Skip to content

revert: remove default_swarm_mode config and restore swarm enter reminder - #5409

Merged
sailist merged 1 commit into
release/2026-11-25from
refact-456-11-25-revert-default-swarm-release-11-25
Nov 25, 2026
Merged

sailist merged 1 commit into
release/2026-11-25from
refact-456-11-25-revert-default-swarm-release-11-25

Conversation

@sailist

@sailist sailist commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Requirement or Bug

应发版要求,从 release/2026-11-25 撤回 #5352(2b1b095f3bbf),不在本次发版中引入 default_swarm_mode 配置,并恢复进入 swarm 模式时的提醒。main 分支不包含 #5352,本次只回滚 release 分支。

Bug Reproduction Steps

N/A(回滚尚未发布到 npm 的特性提交)。

Root Cause

N/A(回滚提交)。

Code Changes

已 rebase 到 release/2026-11-25 最新 tip(3ee3e4a7,ci: release packages (#5349))之上,对 2b1b095f3bbf(#5352)做反向回滚:

  • 移除 default_swarm_mode 配置定义、会话创建时默认进入 swarm 模式的逻辑,以及 TUI 启动、Desktop 设置页、app-core daemon 映射、node-sdk 配置读写和 kap-server /config 接口中的对应字段。
  • 恢复 enter-reminder.md 与 swarm 注入/操作逻辑,进入 swarm 模式时重新注入提醒。
  • 保留 feat: add default_swarm_mode config and remove the swarm mode enter reminder #5352 顺带在 packages/node-sdk/src/config/schema.ts 和 packages/kap-server/src/protocol/rest-config.ts 中提取的公共配置字段结构(仅移除其中的 swarm 字段),避免把重复代码带回分支导致 check:duplication 失败。
  • 更新 packages/kap-server/test/apiSurface.test.ts 的 HOST_CONTRACT digest,匹配移除 default_swarm_mode 后的契约。

关于版本与 CHANGELOG:3ee3e4a7 已将 #5352 的 7 个 changeset 消费进 2.8.0 的各包 CHANGELOG.md(npm 当前最新仍为 2.7.3,2.8.0 尚未发布)。若合入本 PR 后直接重发 2.8.0,需同步删掉各包 CHANGELOG.md 2.8.0 小节里的 #5352 条目;若改发 2.8.1,则需补一条 patch changeset。请发版维护者确认采用哪种方式。

 createSession / startup
-  if config.defaultSwarmMode === true: enter swarm mode (manual)
 swarm mode entered
+  inject enter-reminder.md

Behavior Changes and Affected Users

Behavior Before After Who relies on the old behavior Escape hatch
default_swarm_mode 配置项 config.toml、GET/POST /api/v1/config、SDK、Desktop 设置页支持 default_swarm_mode,开启后新会话默认进入 swarm 模式 配置项及对应 UI 开关、协议字段全部移除,新会话默认不进入 swarm 模式 在 release/2026-11-25 canary 构建上配置过 default_swarm_mode = true 的用户 在会话中手动执行 /swarm 或使用输入框开关
进入 swarm 模式的提醒注入 #5352 移除了 enter-reminder.md,开启 swarm 模式不再注入提醒 恢复 enter-reminder.md 及注入逻辑,进入 swarm 模式时按原逻辑注入提醒 swarm 模式下的主 agent 无(恢复既有行为)

受影响模块与验证情况:

  • agent-core-v2(swarm 配置、会话生命周期、提示词注入)、node-sdk、kap-server、app-core、app-i18n、Desktop 设置页、TUI 启动逻辑。
  • 本地 pnpm lint 与 check:duplication 通过;按要求未运行单元测试与类型检查。

Checklist

@changeset-bot

changeset-bot Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 05a6cb5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-25T10:14:42.442227Z 05a6cb5 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4957865848

ℹ️ 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".

.on(SwarmModeExit, () => false)
.on(ContextAppendMessage, (s, e) => isActiveSwarmReminder(e.message) || s)
.on(ContextSpliced, (s, e) => {
if (e.deleteCount !== 0) return s;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Re-arm the reminder after history deletion

When compaction, context clearing, or replaceHistory removes the injected swarm reminder, the resulting ContextSpliced has a nonzero deleteCount, so this branch preserves swarmReminderDeliveredKey as true. The reminder service deliberately invokes providers again after compaction, but SwarmInjection.reminder() then returns undefined because it still considers the reminder delivered, leaving an active swarm without its workflow instructions. Recompute or clear the delivered state when the splice removes the reminder; the generic reminder tests already establish that reminders swallowed by compaction must be re-injected.

AGENTS.md reference: AGENTS.md:L116-L116

Useful? React with 👍 / 👎.

"packages/agent-core-v2/test/features/skill/activateSkill.test.ts": 16,
"packages/agent-core-v2/test/features/skill/catalog/skill-tool-manager.test.ts": 19,
"packages/agent-core-v2/test/features/skill/skill.test.ts": 2,
"packages/agent-core-v2/test/features/swarm/swarm.test.ts": 3,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Replace the legacy model doubles instead of raising the baseline

This raises the ratchet specifically to permit the three new ctx.mockNextResponse(...) calls in the restored swarm reconciliation test. scripts/checks/test-doubles.mjs classifies those calls as legacy engine doubles and requires new cases to use the shared scripted testkit so model steps and strict verification remain consistent; increasing the baseline makes lint accept the new debt instead of enforcing that migration. Rewrite this test with the prescribed testkit fixture and leave the baseline unchanged.

AGENTS.md reference: AGENTS.md:L163-L163

Useful? React with 👍 / 👎.


private reminder(): ContextInjectionResult<SwarmModeInjectionDisclosure> | undefined {
const trigger = this.options.getTrigger();
if (trigger === null || trigger === 'tool' || this.options.isReminderDelivered()) return undefined;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Neutralize the reminder when swarm mode exits

After /swarm off or the automatic exit of a one-shot /swarm <task>, getTrigger() becomes null, so this provider emits nothing while the previously injected user message remains in every later model request. That message still says the agent is in swarm mode and directs it to call AgentSwarm, even though the tool now rejects the call because the mode is off; the slash command itself is not sent to the model as a counter-instruction. Emit an inactive/exit reminder or remove the active reminder when exiting, as the Plan and Tower mode injectors do.

AGENTS.md reference: AGENTS.md:L200-L202

Useful? React with 👍 / 👎.

…nder

Reverts 2b1b095 (#5352). Keeps the shared config schema field extraction in node-sdk and kap-server without the swarm keys.
@sailist
sailist force-pushed the refact-456-11-25-revert-default-swarm-release-11-25 branch from 4957865 to 05a6cb5 Compare November 25, 2026 10:12
@pkg-pr-new

pkg-pr-new Bot commented Nov 25, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@05a6cb5
npx https://pkg.pr.new/@moonshot-ai/kimi-code@05a6cb5

commit: 05a6cb5

@sailist
sailist merged commit 75a378d into release/2026-11-25 Nov 25, 2026
23 of 24 checks passed
@sailist
sailist deleted the refact-456-11-25-revert-default-swarm-release-11-25 branch November 25, 2026 10:17
@liruifengv liruifengv mentioned this pull request Nov 25, 2026
6 tasks done
kimi-agent-bot pushed a commit that referenced this pull request Nov 25, 2026
…nder (#5409)

Reverts 2b1b095 (#5352). Keeps the shared config schema field extraction in node-sdk and kap-server without the swarm keys.
kimi-agent-bot pushed a commit that referenced this pull request Nov 25, 2026
…nder (#5409)

Reverts 2b1b095 (#5352). Keeps the shared config schema field extraction in node-sdk and kap-server without the swarm keys.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant