fix(claude): report subagent model and effort - #7287
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 |
ApprovabilityVerdict: Needs human review This PR changes runtime event attribution behavior for subagents by adding new SDK hook integrations and modifying how model/effort are sourced. The changes affect telemetry emission logic in a core adapter, and the author is a first-time contributor to this file. You can customize Macroscope's approvability policy. Learn more. |
Problem
Claude file-defined subagents were seeded with the parent session's model and effort. The Agents panel therefore showed the parent settings for every subagent, and authoritative model snapshots that arrived late never reached the client.
Fix
task.startedSubagentStartandSubagentStophooksVerification
pnpm exec vp test run apps/server/src/provider/Layers/ClaudeAdapter.test.ts(74 passed)pnpm exec vp test run packages/client-runtime/src/state/subagentRuntime.test.ts(48 passed)pnpm exec vp run --filter t3 typecheckFixes #7281
Model: GPT-5.6 Sol
Harness: Codex in T3 Code
Note
Medium Risk
Touches Claude task event mapping and SDK hooks; behavior changes what clients see for subagent identity but is scoped to observability/UI linkage rather than auth or persistence.
Overview
Fixes incorrect subagent model/effort in the Agents panel by changing how
ClaudeAdapterseeds and updates task identity ontask.*runtime events.Subagents no longer default to the parent session’s model or effort when the Agent launch omits them (file-defined agents resolve their own settings). Only explicit Agent tool
model/effortoverrides are applied attask_started.Authoritative runtime identity is reconciled across event ordering: subagent assistant snapshots update model (and emit
task.updatedwhen identity changes after start),SubagentStart/SubagentStophooks capture effort, and early snapshots are held in a pending refinements map (capped at 256 entries) untiltask_startedlinks them bytool_use_id/task_id.Tests cover non-inheritance, pre-start snapshots, post-completion corrections, explicit overrides, and cache eviction.
Reviewed by Cursor Bugbot for commit 9577ad8. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Fix subagent model and effort reporting in Claude task events
task.startedevents no longer inherit the parent session's model/effort by default; model and effort are now set only from explicit Agent tool overrides or pending refinements captured from SDK hooks and assistant snapshots.SubagentStart/SubagentStophook registration inClaudeAdapter.tsto capture effort reported by the Claude SDK and apply it to the matching agent state.parent_tool_use_idnow emit atask.updatedevent when the model changes, or are buffered as pending refinements if the agent isn't known yet.task_startedor after terminal states.task.startedpayloads will haveundefinedmodel and effort for file-defined subagents instead of inheriting the session values.Macroscope summarized 9577ad8.