kimi-code/packages/node-sdk/src
Haozhe 5394feaabb
feat: hold print-mode turn until background subagents drain (#1371)
* feat: hold print-mode turn until background subagents drain

In `kimi -p` (print mode), when the main agent ends a turn while background
subagents (`kind === 'agent'`) are still running, hold the turn open and
idle-wait until they finish, flushing their completions into the turn so the
model can react before the run exits.

Previously, the main agent could end its turn after launching background
subagents; the print flow then drained them with their completion
notifications suppressed, so the main agent never saw the results and the run
exited with the work abandoned (e.g. no nomination). This was the root cause
of the swarm-alpha-mining eval failures.

The hold is gated on a new `drainAgentTasksOnStop` session option (set by the
print flow), only affects `kind === 'agent'` background tasks, and is bounded
by `background.printWaitCeilingS`. Backfill / fan-out is handled by
re-enumerating active tasks. Other background task kinds and non-print modes
are unaffected.
2026-07-04 18:44:44 +08:00
..
auth.ts feat(feedback): support attaching logs and codebase (#1120) 2026-06-26 16:15:08 +08:00
catalog.ts refactor!: overhaul thinking config and effort resolution (#1132) 2026-06-30 22:34:13 +08:00
config-rpc.ts feat(cli): add doctor command for config validation (#431) 2026-06-04 21:15:18 +08:00
events.ts feat: support plugin slash commands (#1204) 2026-06-30 19:38:01 +08:00
index.ts feat(agent-core): announce image compression and keep originals readable (#1304) 2026-07-02 19:07:56 +08:00
kimi-code-model-provider.ts feat(managed-kimi-code): route anthropic protocol via beta api (#1186) 2026-06-29 14:24:01 +08:00
kimi-harness.ts chore(telemetry): normalize telemetry property keys to snake_case (#1196) 2026-06-29 17:40:50 +08:00
oauth-error.ts fix: classify OAuth token refresh errors by cause (#838) 2026-06-17 18:34:42 +08:00
rpc.ts feat(cli): wait for background subagents before exiting kimi -p (#1347) 2026-07-03 16:56:16 +08:00
sdk-rpc-client.ts refactor(telemetry): merge duplicate session-start and goal events (#885) 2026-06-18 17:38:02 +08:00
session.ts feat(cli): wait for background subagents before exiting kimi -p (#1347) 2026-07-03 16:56:16 +08:00
types.ts feat: hold print-mode turn until background subagents drain (#1371) 2026-07-04 18:44:44 +08:00