@devries-cameron20 / t3code-1 / commits / 0ae495158e
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(server): Claude subagents keep their model after a usage-limit notice (#17097)

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

洁月星 committed Oct 19, 2026 at 04:12 UTC 0ae495158e10a0e1c39964110eeaeb88392fd702
2 files changed +18 -4
apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts
+15 -3
@@ -10075,7 +10075,14 @@ describe("ClaudeAdapterV2 background wake turns", () => {
10075 ),
10076 );
10077
10078 - it.effect.each(["requested", "observed-before", "observed-after", "inherit", "unknown"] as const)(
10078 + it.effect.each([
10079 + "requested",
10080 + "observed-before",
10081 + "observed-after",
10082 + "synthetic-after",
10083 + "inherit",
10084 + "unknown",
10085 + ] as const)(
10086 "records the subagent model from %s without inheriting the parent override",
10087 (source) =>
10088 Effect.scoped(
@@ -10084,7 +10091,10 @@ describe("ClaudeAdapterV2 background wake turns", () => {
10091 const now = yield* DateTime.now;
10092 const toolUseId = "toolu-subagent-model";
10093 const parentModel = "claude-opus-4-6";
10087 - const observedModel = "claude-haiku-4-5-20251001";
10094 + // Claude stamps its own error frames, such as a usage-limit notice, as
10095 + // "<synthetic>"; that is not the model the subagent runs on.
10096 + const observedModel =
10097 + source === "synthetic-after" ? "<synthetic>" : "claude-haiku-4-5-20251001";
10098 yield* harness.runtime.startTurn(
10099 makeClaudeTestTurnInput({
10100 threadId: harness.threadId,
@@ -10153,7 +10163,9 @@ describe("ClaudeAdapterV2 background wake turns", () => {
10163 session_id: WAKE_NATIVE_SESSION,
10164 }),
10165 );
10156 - if (source === "observed-after") yield* Queue.offer(harness.sdkMessages, observed);
10166 + if (source === "observed-after" || source === "synthetic-after") {
10167 + yield* Queue.offer(harness.sdkMessages, observed);
10168 + }
10169 yield* Queue.offer(
10170 harness.sdkMessages,
10171 makeResultFrame({
apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts
+3 -1
@@ -7307,8 +7307,10 @@ export const makeClaudeAdapterV2 = Effect.fn("makeClaudeAdapterV2")(function* (
7307 const parentToolUseId = message.parent_tool_use_id;
7308 const snapshotModel =
7309 typeof message.message.model === "string" ? message.message.model.trim() : "";
7310 + // Claude's own notices (a usage limit, an API error) carry
7311 + // "<synthetic>", which says nothing about the subagent's model.
7312 const model =
7311 - snapshotModel.length === 0
7313 + snapshotModel.length === 0 || snapshotModel === "<synthetic>"
7314 ? undefined
7315 : canonicalClaudeSubagentModel(subagentModelCatalog, snapshotModel);
7316 if (parentToolUseId !== null && model !== undefined) {