Skip to content

Commit 9a12353

Browse files
juansuaya17claude
andcommitted
fix(server): Claude subagents no longer show the parent's effort
When a Claude subagent ran on the parent's model, its child thread copied the parent's whole model selection, effort included. A subagent's effort comes from its agent definition or Agent call, which the SDK does not report, so an agent defined with `effort: xhigh` was labelled with the parent's `high`. The child selection now drops the effort option. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 83a82a4 commit 9a12353

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

‎apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7812,6 +7812,9 @@ describe("ClaudeAdapterV2 background wake turns", () => {
78127812
);
78137813
const child = harness.events.find((event) => event.type === "app_thread.created");
78147814
assert.equal(child?.appThread.modelSelection?.model, initialModel ?? parentModel);
7815+
assert.isUndefined(
7816+
child?.appThread.modelSelection?.options?.find((option) => option.id === "effort"),
7817+
);
78157818
}).pipe(Effect.provide(Layer.merge(IdAllocator.layer, NodeServices.layer))),
78167819
),
78177820
);

‎apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,17 @@ import {
136136
export const CLAUDE_PROVIDER = ProviderDriverKind.make("claudeAgent");
137137
export const CLAUDE_AGENT_SDK_QUERY_PROTOCOL = "claude-agent-sdk.query" as const;
138138

139+
// A subagent's effort comes from its agent definition or Agent call, which the
140+
// SDK does not report, so the parent's effort would mislabel it.
141+
function withoutEffort(modelSelection: ModelSelection): ModelSelection {
142+
const options = modelSelection.options?.filter((option) => option.id !== "effort");
143+
return {
144+
instanceId: modelSelection.instanceId,
145+
model: modelSelection.model,
146+
...(options === undefined || options.length === 0 ? {} : { options }),
147+
};
148+
}
149+
139150
function claudeContextWindow(modelSelection: ModelSelection): number | null {
140151
return (
141152
resolveClaudeCatalogContextWindowTokens(BUNDLED_CLAUDE_MODEL_CATALOG, modelSelection) ?? null
@@ -4314,7 +4325,7 @@ export function makeClaudeAdapterV2(
43144325
modelSelection:
43154326
task.model && task.model !== input.context.input.modelSelection.model
43164327
? { instanceId: input.context.input.modelSelection.instanceId, model: task.model }
4317-
: input.context.input.modelSelection,
4328+
: withoutEffort(input.context.input.modelSelection),
43184329
title: subagentThreadTitle({
43194330
parentTitle: input.context.input.appThread.title,
43204331
prompt: task.prompt,

0 commit comments

Comments
 (0)