fix(orchestration): Preserve Claude subagent attribution after settle - #5388
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Effect Service Conventions review: one convention issue found in the newly added test module's service imports. Everything else in the changed Effect code (subpath namespace imports, layer construction, dependency acquisition via yield* Service, error modeling) matches the conventions.
Posted via Macroscope — Effect Service Conventions
ApprovabilityVerdict: Needs human review Diff is too large for automated approval analysis. A human reviewer should evaluate this PR. You can customize Macroscope's approvability policy. Learn more. |
38aefa4 to
f1d3119
Compare
f1d3119 to
7370ca6
Compare
7370ca6 to
1a18bba
Compare
There was a problem hiding this comment.
Reviewed the changed Effect service code against the service conventions. One import-shape issue in the new server test; everything else (namespace imports from effect/* subpaths, Context.Service shapes, error modelling, and dependency acquisition in the touched orchestration/adapter code) looks consistent with the conventions.
Posted via Macroscope — Effect Service Conventions
1a18bba to
f80ad36
Compare
f80ad36 to
38e7184
Compare
38e7184 to
49162a7
Compare
49162a7 to
fe0878f
Compare
fe0878f to
8e4dc09
Compare
8e4dc09 to
905b5a1
Compare
e24b59c to
4213ac5
Compare
905b5a1 to
48f545d
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 48f545d. Configure here.
48f545d to
f223029
Compare
25de21d to
0af2a6e
Compare
f223029 to
2fbb7aa
Compare
2fbb7aa to
a593d5c
Compare
Port pingdotgg#5388 claude-postsettle-attribution so multi-result messages only skip failed-wake tool rows instead of dropping the whole active-path frame.

Summary
and fresh buffered continuations.
threads without changing ordinary root assistant text.
generic Claude prompt, preserve other providers' requested detail, and hide
automatic provider entries from queue controls.
Problem and Fix
task_notification.summarywas used as the provider-owned Claude continuation input and could render as raw child text labelled as another agent's message. A shared override would also erase Codex background-command context.Background task completed., while preserving provider-specific continuation detail for Codex. Omit provider-owned automatic entries from visible queue controls.task_started.tool_use_idby arrival order.task_startedregisters their alias. A structuredagentIdcan also appear in ordinary root tool output.agentIddata.Defensive Fixes
failIfCurrent, where a live-buffer rescan pulled the sibling into the failed cohort.running.tool_use_result, then incorrectly apply that shared structured result when one buffered block replayed.Validation
client-runtime set passed 189 tests with 1 skipped.
vp check: passed all 2,690 files.vp run typecheck: passed all 15 packages.passed the exact packaged Grok post-settlement subagent, Claude
post-settlement subagent, and Codex background-command wake scenarios. Claude
projected one generic provider-owned root input while keeping raw child
output on the child; Grok and Codex retained their provider-specific
behavior.
agentIdcollision. Theregression was fixed and covered. Fresh Grok 4.5 high-reasoning source and deliberate-integration reviews
returned SHIP after verifying teardown ordering, exactly-once terminals,
semaphore safety, independent batched-result lineage, and fail-closed pending-launch overflow.
Note
High Risk
Large refactor of Claude orchestration around turn settlement and continuation; missed attribution or generation checks could drop or mis-route subagent output silently.
Overview
Fixes Claude SDK child frames arriving after a root turn settles leaking narration, tools, and results into the parent thread when continuation turns no longer have launch-turn tool maps.
ClaudeAdapterV2now tracks subagent identity, launch/resume aliases, bounded pre-registration buffers, and terminal deduplication in native-thread-scoped session state (with an SDK message semaphore). Attributed frames route to child threads; unknown lineage is buffered or dropped fail-closed instead of becoming root output. Continuation wakes usePROVIDER_CONTINUATION_MESSAGE_TEXT(Background task completed.) so rawtask_notificationsummaries are not shown as another agent’s root message, while provider-specific detail is preserved for other adapters (e.g. Codex).Related hardening covers ambiguous multi-launch inference, failed continuation drain cohorts, session teardown of still-running children, split multi-result SDK frames, and pending launch queue overflow. The web queue UI omits provider-owned automatic completion deliveries (e.g.
delegatedCompletion/ matching continuation text).Reviewed by Cursor Bugbot for commit a593d5c. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Preserve Claude subagent attribution and route approvals correctly after turn settlement
ClaudeAdapterV2to be scoped per native thread rather than per turn, preventing attribution loss after settlement.parent_tool_use_id, replaying them once thetaskId↔toolUseIdalias is established.callbackOptions.agentID; denies approvals that cannot be resolved rather than proceeding incorrectly."Background task completed."continuation messages from the visible thread queue inderiveThreadQueueWorkflowState.Macroscope summarized a593d5c.