Repository navigation
Track kimi background subagents and keep the stall sweep off them (#175) - #1572
Conversation
kimi >= 0.24.2 keeps `kimi -p` alive while Agent(run_in_background) tasks run (default "steer" print policy) but stream-json emits no completion event. Kimi Agent calls now become subagent rows: foreground rows settle on their tool result, background rows stay running until the CLI exits (done on exit 0, failed on a crash; stop already fails them). checkStalls skips threads with running subagents, so the "may be hung, Stop" notice no longer baits users into killing the run and losing the results. Closes #175 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis 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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 082efd37a0
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (thread.stalledAt) continue; | ||
| // Background subagents run silently in the parent CLI (kimi -p stays | ||
| // alive for them, #175); "may be hung, Stop" would kill their results. | ||
| if (hasRunningSubagent(thread.id)) continue; |
There was a problem hiding this comment.
Limit the stall exemption to live background agents
After a crash or force-quit during a subagent, recoverInterruptedRuns marks the thread failed but leaves its persisted subagents rows as running, and startRun does not clear them. When that thread is run again, this unconditional check therefore suppresses stall detection for every subsequent turn even though the recorded subagent has no live process and can never settle. Settle stale rows during recovery or require this exemption to correspond to a currently active background agent.
Useful? React with 👍 / 👎.
Closes #175.
What kimi actually does (read from the installed 0.39.1 CLI source)
kimi -pdefaults to the steer print policy (applyPrintBackgroundPolicy). After the main turn, the process stays alive whileAgent(run_in_background=true)tasks are pending. Each completion steers a new main turn on the same stream-json output. Stream-json never emits a completion or notification event. It only emits assistant, tool and tool-result lines, and progress text goes to stderr. Process exit is the only settle signal.Root cause of "killed at settle"
While background agents run, the stream is silent. After 10 minutes
checkStallsposted "No output from the kimi CLI… may be hung. Stop and retry". Stopping killed the agents and lost their results.Changes
electron/kimi.js:Agenttool calls carrysubagent: { description, agentType, background }, parsed from the args before truncation.electron/runner-provider-kimi.js: each Agent call becomes a subagent row in the Agents panel.electron/runner-watchdogs.js:checkStallsskips threads with a running subagent. This applies to all providers.background-agentscenario (ack, silence, steered text, exit), covering rows, stall exemption, settle at exit, and stop → failed.Limits
AgentSwarmlaunches are not tracked.🤖 Generated with Claude Code