Skip to content

fix(server): Claude threads no longer get ACP and Codex tool instructions - #16482

Open
Gigioxx wants to merge 1 commit into
pingdotgg:mainfrom
Gigioxx:t3code/provider-scoped-orchestration-instructions
Open

Gigioxx wants to merge 1 commit into
pingdotgg:mainfrom
Gigioxx:t3code/provider-scoped-orchestration-instructions

Conversation

@Gigioxx

@Gigioxx Gigioxx commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Claude Code threads got two pieces of T3's orchestration prompt that only apply to other agents. Every provider receives the same T3_CODE_ORCHESTRATION_INSTRUCTIONS, and it carried the ACP terminal fallback (T3_ACP_MCP_NODE, acp-mcp-call), a Codex code-mode example, and the sample name mcp__t3_code__delegate_task. Claude names these tools mcp__t3-code__…, so the example was wrong there, and the ACP paragraph cost about 166 tokens in every Claude thread. Cursor, OpenCode, Pi and Codex got the ACP paragraph too. Fixes #16465.

The shared text is now provider-neutral. Each provider-specific part goes only to the path that uses it:

  • The ACP fallback is added in t3AcpPromptWithInstructions. AcpAdapterV2 is the only place that sets T3_ACP_MCP_NODE, and Grok, Antigravity, Devin and registry agents all build their prompt there.
  • The Codex code-mode hint is added in buildCodexAdditionalContext.
  • The lazy-attach guidance ("make one bounded direct attempt") stays shared, now under its own ### Finding T3 tools heading at the end. The ACP and Codex additions then read as part of that section, not as part of "Showing visuals".

Proof:

  • Reproduced on main by building Claude's real query options with the t3-code MCP server attached. systemPrompt.append contained ACP fallback, T3_ACP_MCP_NODE and mcp__t3_code__. With this change, it contains none of them.
  • New assertions cover the shared text, ACP with and without MCP, Codex's context, and Claude's systemPrompt.append. Against main's instruction files, 3 of them fail (for example expected '<runtime_info>…' to not include 'acp-mcp-call'). With this change, all pass.
vp test run src/provider/T3OrchestrationInstructions.test.ts src/provider/CodexDeveloperInstructions.test.ts src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts
  Test Files  3 passed (3)   Tests  159 passed (159)
vp lint / vp fmt --check <touched files>   clean

vp run --filter t3 typecheck reports 10 errors, all in src/process/externalLauncher.test.ts, which this PR does not touch. That break is on main and #16436 fixes it. The touched files have no errors. Not checked: a live Claude or ACP session quoting its prompt.

Model: Claude Opus 5.5 (1M) with Codex GPT-6-Astra (medium). Harness: Claude Code in T3 Code.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Oct 6, 2026
@macroscopeapp

macroscopeapp Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 94b834a

Macroscope's review found this PR approvable — This is a focused prompt-routing bug fix that keeps shared instructions provider-neutral and places ACP and Codex guidance only on their intended paths. Its runtime impact is limited to model instructions, with targeted tests covering both inclusion and exclusion behavior.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Path: .coderabbit.config.ts
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a33a71ac-8616-48eb-b52a-195a63053863
📥 Commits

Reviewing files that changed from the base of the PR and between 9bd1d80 and 94b834a.

📒 Files selected for processing (5)
  • apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts
  • apps/server/src/provider/CodexDeveloperInstructions.test.ts
  • apps/server/src/provider/CodexDeveloperInstructions.ts
  • apps/server/src/provider/T3OrchestrationInstructions.test.ts
  • apps/server/src/provider/T3OrchestrationInstructions.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

Shared orchestration instructions now separate ACP fallback guidance from general guidance. ACP prompts include fallback guidance when T3 MCP tools are available. Codex context adds a T3 capability-call instruction, and tests check which tool identifiers appear in these prompts.

Changes

Orchestration guidance

Layer / File(s) Summary
Shared guidance and ACP composition
apps/server/src/provider/T3OrchestrationInstructions.ts, apps/server/src/provider/T3OrchestrationInstructions.test.ts, apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts
Shared instructions add bounded polling and retry guidance and remove ACP-specific tool identifiers. ACP fallback guidance is included when T3 MCP tools are available. Tests check ACP identifier inclusion in ACP prompts and exclusion from shared guidance and Claude system prompt text.
Codex capability guidance
apps/server/src/provider/CodexDeveloperInstructions.ts, apps/server/src/provider/CodexDeveloperInstructions.test.ts
Codex context adds guidance to call the T3 orchestration capabilities tool when T3 tools are not listed. A test checks for that tool and verifies that acp-mcp-call is absent.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: juliusmarminge

Merge Risk: ⚪ Minimal · up to 94b83

Claude and ACP receive appropriately scoped instructions, while Codex receives guidance to look up T3 capabilities. The inspected registration supports that lookup, with no established user-facing failure blocking merge.

Security Architecture Review

Security architecture risk: ⚪ Minimal · up to 94b83

The change confines capability guidance to the appropriate integrations without granting new permissions or weakening access checks. No material security risk was found in the compared changes.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The change narrows exposure of ACP terminal instructions to the ACP integration while preserving existing invocation routes there and in Codex. The changed builders issue no credentials and introduce no new cross-provider authority; sensitive delegation remains associated with the caller's thread and active provider run.

Trust Boundaries and Controls

  • observed — Delegation authorization is enforced at the service rather than by instruction text. It requires orchestration capability, a thread caller, and an active run owned by the credential's provider instance. Requested child runtime and interaction modes cannot exceed the parent's modes. These controls are unchanged by the PR.

Resilience and Maintainability Implications

  • observed — Added assertions check provider-specific instruction separation: shared and Claude text exclude ACP/Codex-specific identifiers, MCP-enabled ACP text includes its fallback, MCP-disabled ACP text excludes it, and Codex context includes its capability hint without the ACP fallback. These are content checks, not executed proof of external tool availability.
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed #16465 requires Claude Code to receive applicable orchestration guidance without the ACP terminal fallback or the invalid `mcp__t3_code__delegate_…
Out of Scope Changes check ✅ Passed The ACP fallback relocation and Codex code-mode hint keep provider-specific guidance in the paths that use it. The shared lazy-attach guidance remains applicable across providers. These changes suppor…
Title check ✅ Passed The title clearly describes the main change: Claude threads no longer receive ACP and Codex instructions. It is concise and uses a conventional commit format.
Description check ✅ Passed The description explains the problem and change, references issue #16465, and gives targeted test and lint results, plus the typecheck limitation. It does not state explicit maintainer approval or exp…
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

This branch has not been deployed

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

Labels

size:S 10-29 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.

[Bug]: Claude Code threads get T3 instructions meant for other agents

1 participant