Analytics drops late subagent activity after parent turn has already terminated
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 125k
- Forks
- 19.4k
- PR merge metrics
- PR metrics pending
Description
Affected version
Windows Codex Desktop OpenAI.Codex 26.901.5280.0, bundled codex-cli 0.153.4.
Summary
In a completed multi-agent session, a child subagent finished after the parent turn that spawned/waited on it had already terminated on a usage limit. The child's FINAL_ANSWER was delivered while the parent thread had started a new turn.
Codex accepted the inter-agent communication and continued normally, but codex_analytics::reducer emitted:
dropping sub-agent activity tool count update: missing turn state
with the old terminated parent turn id.
This appears to lose the collaboration/subagent tool-count analytics for a valid late child completion.
Observed ordering
- Parent thread has turn A running with a subagent.
- Turn A terminates (in this reproduction because of a usage-limit error).
- Parent thread starts turn B.
- The child finishes and sends
FINAL_ANSWERback to the parent path. - Codex logs receipt of
InterAgentCommunicationfrom the child during turn B. - The analytics reducer immediately warns that it is dropping the sub-agent activity tool-count update because turn A's state is missing.
- Turn B continues and completes normally.
The warning in this reproduction referenced turn A, not the currently running turn B.
Impact
I did not observe an execution failure from this warning. The impact appears limited to analytics correctness: a legitimate late subagent activity/tool-count update is discarded after the originating parent turn has already been evicted from reducer state.
Current source
The current default branch still contains this explicit warning-and-return path in codex-rs/analytics/src/reducer.rs:
tracing::warn!(
thread_id = %notification.thread_id,
turn_id = %notification.turn_id,
"dropping sub-agent activity tool count update: missing turn state"
);
return;
So this does not appear specific to the installed 0.153.4 binary.
Expected behavior
Late subagent activity that is still valid and delivered to the parent thread should either:
- retain enough terminal turn metadata to attribute the collaboration tool count to its originating turn, or
- be attributed through a defined late-event path without silently losing the count.
At minimum, the reducer should have regression coverage for a subagent activity notification arriving after the originating parent turn has completed/failed but while the parent thread remains active.
Additional notes
- The child result itself was delivered successfully; this report is specifically about analytics reduction.
- I searched for the exact warning text in open/closed issues and found no matching report.
- No private prompt, repository content, credentials, or user data is included here.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in codex-rs/analytics/src/reducer.rs at the warning-and-return path for a missing turn state, then trace how InterAgentCommunication activity updates are associated with parent turns. Add regression coverage for a late notification after the originating turn completes or fails while the parent thread remains active, and verify the valid subagent tool count is no longer silently dropped.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- analytics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100