Repository navigation
Preserve live Claude nested agent parentage - #305
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6b6955a82c
ℹ️ 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 (@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 (@codex) address that feedback".
| #[serde(default)] | ||
| deferred_insert: Option<SpanRow>, |
There was a problem hiding this comment.
Preserve deferred spans' turn ownership across recovery
If the daemon restarts after a nested SubagentStart but before its SubagentStop, restoring this deferred SpanRow loses its turn_span_id, because that field is marked #[serde(skip)] in translate/mod.rs. The row has not yet passed through TurnLineage, so its metadata does not contain the ownership either. When the deferred insert is eventually emitted, TurnLineage cannot stamp metadata.turn_span_id, leaving the subagent out of turn-filtered aggregations even though its descendants retain their ownership. Persist the owner separately or restore it from agent_origins before emitting the deferred row.
Useful? React with 👍 / 👎.
6b6955a to
dfe65a8
Compare
Live Claude Code traces can show a nested agent beside the agent that launched it, hiding who delegated the work. This keeps nested work under its originating agent, including concurrent launches.
Fixes #299
Verified before and after with a real Claude Code 2.1.326 nested-agent run using the debug sink. The regression covers concurrent launches and interrupted sessions. When a launch is ambiguous, the child span is held until native ancestry is available or the session ends; missing ancestry falls back to the turn. Delivery to Braintrust has not been verified. The locked all-features daemon suite and Clippy passed.