Skip to content

Capture late Claude subagent model calls - #304

Merged
Stephen Belanger (Qard) merged 1 commit into
mainfrom
fix/claude-late-subagent-calls
Nov 20, 2026
Merged

Stephen Belanger (Qard) merged 1 commit into
mainfrom
fix/claude-late-subagent-calls

Conversation

@Qard

@Qard Stephen Belanger (Qard) commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Live Claude Code traces can omit a sub-agent’s final model call and its token usage. This captures calls written after the sub-agent stops, including when the daemon restarts before it observes them.

Fixes #300

Verified with a real Claude Code 2.1.326 background-agent session: the baseline trace contained one of two calls for each agent, while the updated trace contained both. Deterministic tests cover a late append, session end, restart and duplicate prevention. Verification used the debug sink; delivery to Braintrust has not been verified. The locked all-features daemon suite and Clippy passed.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 19, 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-19T19:11:09.873513Z ed26961 Draft marked ready
ℹ️ About Codex in GitHub

Your 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.

@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: ed26961972

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

Comment on lines +1572 to +1576
"TranscriptUpdate" if event.payload.get("agent_transcript_path").is_some() => {
if let (Some(agent_id), Some(path)) = (
string_field(&event.payload, "agent_id"),
string_field(&event.payload, "agent_transcript_path"),
) {

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 Preserve the internal-agent filter for transcript updates

When an internal Claude agent (such as prompt suggestions) appends transcript records after its unpaired, empty-type SubagentStop, remember_claude_transcripts now registers it for polling, and this branch emits its model calls unconditionally. This bypasses the deliberate filter in handle that ignores these stops, covered by claude_ignores_untracked_empty_type_subagent_stops. The resulting LLM spans include unwanted internal activity and reference a subagent parent that was never created. Retain eligibility information for accepted delegated agents and apply it to child transcript updates as well.

Useful? React with 👍 / 👎.

@Qard
Stephen Belanger (Qard) merged commit 7e7c867 into main Nov 20, 2026
29 checks passed
@Qard
Stephen Belanger (Qard) deleted the fix/claude-late-subagent-calls branch November 20, 2026 11:01
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.

Live Claude Code tracing sometimes loses a sub-agent's final model call

2 participants