fix(agent-core-v2): remove duplicate launch-time subagent.spawned - #3134
Merged
sailist merged 1 commit intoAug 20, 2026
Merged
Conversation
|
commit: |
7723qqq
pushed a commit
to 7723qqq/kimi-code
that referenced
this pull request
Aug 20, 2026
…onshotAI#3134) (cherry picked from commit 3b69765)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issue
No linked issue — the problem was found while investigating an internal report of subagent task rows stuck in the "running" state.
Problem
Every Agent-tool subagent emits
subagent.spawnedtwice: once insidelaunch()right after the agent scope is created (without a task id), and once afterregisterTasksucceeds (carrying the task id). The launch-time emission had been deliberately removed by #3005 and was accidentally reintroduced by the model-as-container refactor #3103.Downstream effects of the duplicate:
AgentTranscriptProjector.onSubagentSpawned) create a second task row keyed by the agent id;subagent.started/completed/failedfold only into the task-id-keyed row, so the agent-id-keyed row staysrunningforever after the subagent has finished.subagent_createdtelemetry event is double-counted.What changed
packages/agent-core-v2/src/agent/tools/agent/agentTool.ts: removed the launch-timeemitAgentRunSpawnedcall (and therunInBackgroundlocal that only fed it), restoring the fix(agent-core-v2): emit subagent.spawned after task registration #3005 semantics —subagent.spawnedis emitted exactly once, after task registration, carrying the task id, followed bysubagent.started.packages/agent-core-v2/test/tool/tool.test.ts: added a regression test asserting the Agent tool emitssubagent.spawnedexactly once and that the event carries the registered task id.Checklist
/approve).gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.