Skip to content

fix(claude): report subagent model and effort - #7287

Open
lnieuwenhuis wants to merge 1 commit into
pingdotgg:mainfrom
lnieuwenhuis:dev/fix/subagent-model-attribution
Open

fix(claude): report subagent model and effort#7287
lnieuwenhuis wants to merge 1 commit into
pingdotgg:mainfrom
lnieuwenhuis:dev/fix/subagent-model-attribution

Conversation

@lnieuwenhuis

@lnieuwenhuis lnieuwenhuis commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

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

  • leave subagent model and effort unknown unless the Agent launch explicitly overrides them
  • reconcile authoritative model snapshots before or after task.started
  • capture each subagent's effort through the SDK's typed SubagentStart and SubagentStop hooks
  • emit late identity corrections and bound pending refinements to avoid unbounded session growth
  • cover parent non-inheritance, event ordering, terminal-task correction, explicit overrides, and cache eviction

Verification

  • 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 typecheck
  • targeted format, lint, diff, and changed-file secret checks

Fixes #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 ClaudeAdapter seeds and updates task identity on task.* 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 / effort overrides are applied at task_started.

Authoritative runtime identity is reconciled across event ordering: subagent assistant snapshots update model (and emit task.updated when identity changes after start), SubagentStart / SubagentStop hooks capture effort, and early snapshots are held in a pending refinements map (capped at 256 entries) until task_started links them by tool_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

  • Subagent task.started events 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.
  • Adds SubagentStart/SubagentStop hook registration in ClaudeAdapter.ts to capture effort reported by the Claude SDK and apply it to the matching agent state.
  • Assistant snapshots with a parent_tool_use_id now emit a task.updated event when the model changes, or are buffered as pending refinements if the agent isn't known yet.
  • Pending refinements are stored in a bounded FIFO map (cap: 256 entries) to handle snapshots and hook events that arrive before task_started or after terminal states.
  • Behavioral Change: task.started payloads will have undefined model and effort for file-defined subagents instead of inheriting the session values.

Macroscope summarized 9577ad8.

@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: cd1e73bf-ec0c-40b5-a781-591dc571403f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Aug 17, 2026
@macroscopeapp

macroscopeapp Bot commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Agents panel shows the parent session's model/effort for every subagent instead of the subagent's own

1 participant