From dc01916f1c48ff2565f7576ff1445a1a739122bf Mon Sep 17 00:00:00 2001 From: Gabriel De Andrade Date: Thu, 29 Oct 2026 14:12:47 -0400 Subject: [PATCH 1/4] fix(server): background agent asks go to delegate_task, not a background Agent Claude Code's Agent description says agents run in the background by default, and Sonnet 5.5 followed it over T3's run_in_background:false whenever a user asked for an agent in the background. A separate sentence now names that case: a background agent is a delegate_task, never a background Agent. Grows the Claude and Codex instructions by 39 bytes each. Co-Authored-By: Claude Opus 5.5 --- apps/server/src/provider/agentContextBudget.json | 4 ++-- .../provider-core/src/server/orchestrationInstructions.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/server/src/provider/agentContextBudget.json b/apps/server/src/provider/agentContextBudget.json index 1711e148d4ca4..b38572d87f735 100644 --- a/apps/server/src/provider/agentContextBudget.json +++ b/apps/server/src/provider/agentContextBudget.json @@ -1,5 +1,5 @@ { - "claudeSystemAppendBytes": 5135, - "codexAdditionalContextBytes": 6865, + "claudeSystemAppendBytes": 5174, + "codexAdditionalContextBytes": 6904, "mcpToolListJsonBytes": 46007 } diff --git a/packages/provider-core/src/server/orchestrationInstructions.ts b/packages/provider-core/src/server/orchestrationInstructions.ts index 428aec2513d32..41b9f93a9e54f 100644 --- a/packages/provider-core/src/server/orchestrationInstructions.ts +++ b/packages/provider-core/src/server/orchestrationInstructions.ts @@ -6,7 +6,7 @@ export const T3_CODE_ORCHESTRATION_SECTIONS: ReadonlyArray = [ Ordinary coding tasks need no T3 tools. -- Subagents: use your native tool when the child uses your provider, a model it offers, and no settings beyond yours, and it finishes in this turn (Claude \`Agent\` always with \`run_in_background:false\`; Codex \`spawn_agent\`, then wait). Use \`delegate_task\` for another provider's model, user-asked settings, a separate checkout (\`isolation:"worktree"\`), background work, or \`delegate_task\` by name. A native type running another provider's model counts too. Workflow only when asked. +- Subagents: use your native tool when the child uses your provider, a model it offers, and no settings beyond yours, and it finishes in this turn (Claude \`Agent\` with \`run_in_background:false\`; Codex \`spawn_agent\`, then wait). Use \`delegate_task\` for another provider's model, user-asked settings, a separate checkout (\`isolation:"worktree"\`), or \`delegate_task\` by name. A native type running another provider's model counts too. Background agent: \`delegate_task\`, never a background \`Agent\`. Workflow only when asked. - Call \`orchestrator_capabilities\` once per thread, before the first \`delegate_task\`. Again only after an error or a user-named provider change. Settings go in \`target.options\`. Provider or model unavailable: say so. Never switch unasked, or fall back to native tools, Workflow, or CLIs. Never make a child's checkout in the shell or in \`task\`. - Every new delegate review or re-check is a new \`delegate_task\` (brief, findings, objections), never a \`t3_thread_send\`. Fix small review findings yourself; start no delegate for them. When told to proceed without a delegate, or to run fewer, \`task_cancel\` the extras. Start no replacement. - Follow a running delegate's \`next\`. Do not poll it (\`task_status\`, \`sleep\`, watchers, Monitor, ScheduleWakeup). Stop a delegate run you replace or no longer need with \`task_cancel\`, never \`t3_thread_interrupt\` on a \`childThreadId\`. From 5156344fde8cb3d24b2ee9719f6e43f0eeaabe94 Mon Sep 17 00:00:00 2001 From: Gabriel De Andrade Date: Fri, 30 Oct 2026 16:18:02 -0400 Subject: [PATCH 2/4] fix(server): keep the background-agent rule inside the current context budget Trim the subagent bullet so the new sentence costs no bytes: drop "or `delegate_task` by name", tighten "a model it offers, no settings beyond yours, and finishes in this turn", "on another provider's model", and "only if asked". agentContextBudget.json is back to main's values. Co-Authored-By: Claude Opus 5.5 --- apps/server/src/provider/agentContextBudget.json | 4 ++-- .../provider-core/src/server/orchestrationInstructions.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/server/src/provider/agentContextBudget.json b/apps/server/src/provider/agentContextBudget.json index b38572d87f735..1711e148d4ca4 100644 --- a/apps/server/src/provider/agentContextBudget.json +++ b/apps/server/src/provider/agentContextBudget.json @@ -1,5 +1,5 @@ { - "claudeSystemAppendBytes": 5174, - "codexAdditionalContextBytes": 6904, + "claudeSystemAppendBytes": 5135, + "codexAdditionalContextBytes": 6865, "mcpToolListJsonBytes": 46007 } diff --git a/packages/provider-core/src/server/orchestrationInstructions.ts b/packages/provider-core/src/server/orchestrationInstructions.ts index 41b9f93a9e54f..3f290a2fbfa90 100644 --- a/packages/provider-core/src/server/orchestrationInstructions.ts +++ b/packages/provider-core/src/server/orchestrationInstructions.ts @@ -6,7 +6,7 @@ export const T3_CODE_ORCHESTRATION_SECTIONS: ReadonlyArray = [ Ordinary coding tasks need no T3 tools. -- Subagents: use your native tool when the child uses your provider, a model it offers, and no settings beyond yours, and it finishes in this turn (Claude \`Agent\` with \`run_in_background:false\`; Codex \`spawn_agent\`, then wait). Use \`delegate_task\` for another provider's model, user-asked settings, a separate checkout (\`isolation:"worktree"\`), or \`delegate_task\` by name. A native type running another provider's model counts too. Background agent: \`delegate_task\`, never a background \`Agent\`. Workflow only when asked. +- Subagents: use your native tool when the child uses your provider, a model it offers, no settings beyond yours, and finishes in this turn (Claude \`Agent\` with \`run_in_background:false\`; Codex \`spawn_agent\`, then wait). Use \`delegate_task\` for another provider's model, user-asked settings, or a separate checkout (\`isolation:"worktree"\`). A native type on another provider's model counts too. Background agent: \`delegate_task\`, never a background \`Agent\`. Workflow only if asked. - Call \`orchestrator_capabilities\` once per thread, before the first \`delegate_task\`. Again only after an error or a user-named provider change. Settings go in \`target.options\`. Provider or model unavailable: say so. Never switch unasked, or fall back to native tools, Workflow, or CLIs. Never make a child's checkout in the shell or in \`task\`. - Every new delegate review or re-check is a new \`delegate_task\` (brief, findings, objections), never a \`t3_thread_send\`. Fix small review findings yourself; start no delegate for them. When told to proceed without a delegate, or to run fewer, \`task_cancel\` the extras. Start no replacement. - Follow a running delegate's \`next\`. Do not poll it (\`task_status\`, \`sleep\`, watchers, Monitor, ScheduleWakeup). Stop a delegate run you replace or no longer need with \`task_cancel\`, never \`t3_thread_interrupt\` on a \`childThreadId\`. From e9ec9df44677e419654b1f7be21b2e844990a2a5 Mon Sep 17 00:00:00 2001 From: Gabriel De Andrade Date: Fri, 30 Oct 2026 17:05:18 -0400 Subject: [PATCH 3/4] test(server): pin the trimmed subagent wording and the background-agent rule Co-Authored-By: Claude Opus 5.5 --- apps/server/src/provider/CodexDeveloperInstructions.test.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/server/src/provider/CodexDeveloperInstructions.test.ts b/apps/server/src/provider/CodexDeveloperInstructions.test.ts index 87473e8da2f11..e8939f2368ada 100644 --- a/apps/server/src/provider/CodexDeveloperInstructions.test.ts +++ b/apps/server/src/provider/CodexDeveloperInstructions.test.ts @@ -65,7 +65,10 @@ describe("Codex orchestration context", () => { NodeAssert.ok(orchestration.includes("use your native tool when the child uses your provider")); NodeAssert.ok(orchestration.includes("`run_in_background:false`")); - NodeAssert.ok(orchestration.includes("A native type running another provider's model")); + NodeAssert.ok(orchestration.includes("A native type on another provider's model")); + NodeAssert.ok( + orchestration.includes("Background agent: `delegate_task`, never a background `Agent`."), + ); NodeAssert.ok( orchestration.includes("Every new delegate review or re-check is a new `delegate_task`"), ); From b305e57a09eaad572e0f6bd0a48b7251370696f7 Mon Sep 17 00:00:00 2001 From: Gabriel De Andrade Date: Fri, 30 Oct 2026 17:08:49 -0400 Subject: [PATCH 4/4] fix(server): keep honoring a user who names delegate_task The zero-byte trim dropped "or `delegate_task` by name", which no eval covers. Keep it and drop "and it finishes in this turn" instead: the new background-agent sentence already sends anything that outlives the turn to delegate_task. Still exactly main's byte count. Co-Authored-By: Claude Opus 5.5 --- packages/provider-core/src/server/orchestrationInstructions.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/provider-core/src/server/orchestrationInstructions.ts b/packages/provider-core/src/server/orchestrationInstructions.ts index 3f290a2fbfa90..3ee7b17af013d 100644 --- a/packages/provider-core/src/server/orchestrationInstructions.ts +++ b/packages/provider-core/src/server/orchestrationInstructions.ts @@ -6,7 +6,7 @@ export const T3_CODE_ORCHESTRATION_SECTIONS: ReadonlyArray = [ Ordinary coding tasks need no T3 tools. -- Subagents: use your native tool when the child uses your provider, a model it offers, no settings beyond yours, and finishes in this turn (Claude \`Agent\` with \`run_in_background:false\`; Codex \`spawn_agent\`, then wait). Use \`delegate_task\` for another provider's model, user-asked settings, or a separate checkout (\`isolation:"worktree"\`). A native type on another provider's model counts too. Background agent: \`delegate_task\`, never a background \`Agent\`. Workflow only if asked. +- Subagents: use your native tool when the child uses your provider, a model it offers, and no settings beyond yours (Claude \`Agent\`, \`run_in_background:false\`; Codex \`spawn_agent\`, then wait). Use \`delegate_task\` for another provider's model, user-asked settings, a separate checkout (\`isolation:"worktree"\`), or \`delegate_task\` by name. A native type on another provider's model counts too. Background agent: \`delegate_task\`, never a background \`Agent\`. Workflow only when asked. - Call \`orchestrator_capabilities\` once per thread, before the first \`delegate_task\`. Again only after an error or a user-named provider change. Settings go in \`target.options\`. Provider or model unavailable: say so. Never switch unasked, or fall back to native tools, Workflow, or CLIs. Never make a child's checkout in the shell or in \`task\`. - Every new delegate review or re-check is a new \`delegate_task\` (brief, findings, objections), never a \`t3_thread_send\`. Fix small review findings yourself; start no delegate for them. When told to proceed without a delegate, or to run fewer, \`task_cancel\` the extras. Start no replacement. - Follow a running delegate's \`next\`. Do not poll it (\`task_status\`, \`sleep\`, watchers, Monitor, ScheduleWakeup). Stop a delegate run you replace or no longer need with \`task_cancel\`, never \`t3_thread_interrupt\` on a \`childThreadId\`.