fix(server): Claude threads no longer get ACP and Codex tool instructions #16482
main fromrefs/pull/16482/head·opened View on GitHubProblem#
Claude and other non-ACP providers receive orchestration text containing an ACP-only terminal fallback and a Codex-specific tool-discovery example. Those instructions do not match their harnesses.
Change#
Keep common orchestration guidance provider-neutral. Append the ACP fallback only to MCP-enabled ACP prompts, and give Codex its code-mode discovery hint in a separate small additional-context entry. Preserve Codex's numbered sections and 4000-byte per-entry limit.
Scope and approval#
Fixes #16465. Preserves @Gigioxx's original contribution in #16482 with main snapshot 44a7cb1 integrated and contributor history retained. Claude, Cursor, OpenCode and Pi receive the common text; ACP and Codex receive their applicable additions. No client, permission or runtime tool behavior changes.
Verification#
At d2b235d, compared with 44a7cb1:
- Three touched test cases remain from the original five: real Claude query options exclude the ACP/Codex hints; MCP-enabled ACP prompt keeps its fallback; Codex context keeps its hint without the ACP fallback.
- The instruction/Codex test files pass all 30 cases, and the filtered Claude injection case passes. Server/provider-core typechecks and scoped lint/format checks pass. The full Claude adapter suite was not run.
- Restoring pre-fix production text makes Claude/Codex exclusion cases fail. Removing the provider-specific additions makes ACP/Codex inclusion cases fail. Production files were restored after each probe.
- Fresh independent full Opus 5.5 and GPT-6.1 Sol reviews approve the cumulative change. Optional wording-placement suggestions do not affect routing or instruction delivery.
These tests inspect actual provider prompt-construction outputs. No live model session was run, and no claim is made about model recall or adherence. There is no UI change requiring browser/device proof.
Tests and implementation: Claude Opus 5.5 and Claude Fable 5.1 through T3 Code. Independent review: Claude Opus 5.5 and GPT-6.1 Sol, standard service tiers.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
Approvability#
Verdict: Needs Human Approval
Macroscope's review found this PR requires human approval — This focused fix changes the default instructions delivered to existing Claude, ACP, and Codex sessions, including adding ACP fallback guidance and Codex tool discovery behavior. The scope is small and tested, but the default runtime behavior change warrants human review.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).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:
ca893528-37f6-4f33-bf1f-3a629d2f8a82
📥 Commits
-
Reviewing files that changed from the base of the PR and between 5cf9b5096a313bb125935ef37a08ca16a6c44c16 and 2205f9c9648dec0d630d47bf3165de4fa516f985.
📒 Files selected for processing: 4
-
apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.tsapps/server/src/provider/CodexDeveloperInstructions.test.tsapps/server/src/provider/CodexDeveloperInstructions.tspackages/provider-core/src/server/orchestrationInstructions.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
-
📝 Walkthrough
-
Shared orchestration instructions now add launch-retry, visual-output, and T3 tool-discovery guidance. ACP fallback guidance is separate and appears in ACP prompts when T3 MCP tools are available. Codex context adds guidance to check for T3 capabilities.
Changes: Orchestration guidance
Layer / File(s) Summary Shared guidance and ACP composition
packages/provider-core/src/server/orchestrationInstructions.ts,packages/provider-core/src/server/orchestrationInstructions.test.ts,apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.tsShared instructions add launch-retry, visual-output, and T3 tool-discovery guidance. They omit ACP-specific identifiers. ACP fallback guidance is included in ACP prompts when T3 MCP tools are available. Tests check shared, ACP, and Claude prompt contents. Codex capability guidance
apps/server/src/provider/CodexDeveloperInstructions.ts,apps/server/src/provider/CodexDeveloperInstructions.test.tsCodex context adds guidance to check orchestrator capabilities before reporting that T3 tools are absent. A test checks for the Codex capability tool and the absence of ACP fallback guidance. Priority: ➖ Normal
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix · Severity of issue fixed: Low
Suggested reviewers:
juliusmarminge
Merge Risk: ⚪ Minimal · up to
2205f-
No concrete material behavior failure is established by the reviewed changes. The PR appears ready for normal merge checks.
Security architecture risk: ⚪ Minimal · up to
2205f-
The change limits integration-specific guidance to the integrations that need it. It does not expand access to tools, credentials, or data, and existing availability controls remain unchanged.
Retained concerns No architecture-level concerns identified.
Security review details
-
Security Blast Radius
- inferred — The change affects guidance delivered to provider sessions, not the set of callable tools or their implementation. ACP retains its prior fallback advice and availability condition; Codex retains its prior capability-discovery advice. Removing those literals from common guidance does not establish a new attacker-controlled route to delegation or terminal execution.
Trust Boundaries and Controls
- observed — The new Codex discovery entry contains static application-owned text. The caller continues to label text supplied by MCP applications as untrusted context rather than developer instructions; the new entry does not promote that external text into a higher-trust instruction channel.
-
Pre-merge checks:
4-
Check name Status Explanation Linked Issues check Issue [ #16465] requires Claude Code threads to omit the ACP fallback and the invalidmcp__t3_code__delegate_taskexample. The shared orchestration instructions now omit ACP-specific identifiers and …Out of Scope Changes check The ACP fallback relocation preserves ACP-specific behavior. The Codex code-mode guidance preserves Codex-specific tool discovery. The shared lazy-attach guidance and focused tests support provider-sp… Title check The title clearly identifies the main fix: removing ACP and Codex-specific instructions from Claude threads. It is concise and uses a conventional commit format. Description check The description includes the Problem, Change, Scope and approval, and Verification sections. It explains the affected providers, linked issue and prior work, focused test results, limitations, and val… Full details: Linked Issues check
-
Explanation
Issue [
#16465] requires Claude Code threads to omit the ACP fallback and the invalidmcp__t3_code__delegate_taskexample. The shared orchestration instructions now omit ACP-specific identifiers and the invalid tool prefix. The ACP fallback is added int3AcpPromptWithInstructions, and the Claude test verifies that the Claude system prompt excludesacp-mcp-callandmcp__t3_code__.
Full details: Out of Scope Changes check
-
Explanation
The ACP fallback relocation preserves ACP-specific behavior. The Codex code-mode guidance preserves Codex-specific tool discovery. The shared lazy-attach guidance and focused tests support provider-specific instruction separation for [
#16465]. No unrelated change appears in the reported whole-PR changes.
Full details: Description check
-
Explanation
The description includes the Problem, Change, Scope and approval, and Verification sections. It explains the affected providers, linked issue and prior work, focused test results, limitations, and validation details.
-
✨ Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
-
juliusmarminge added labelsmacroscope-review
coderabbitai[bot](GitHub profile, opens in a new tab) approved these changes
juliusmarminge assignedjuliusmarminge
Taking over this one. I’ll reduce the tests to the useful coverage, update the implementation against current main, and verify it before publishing the changes.
juliusmarminge added labelstakeover
juliusmarminge added labelspr:in-progress
Taking over this one
Thanks @Gigioxx for identifying and fixing the provider-specific instruction leak. Continued in #24576 on origin because main changed the same instruction sections. Compared your full scoped diff against the replacement: ACP fallback and Codex discovery guidance are retained in their applicable builders; Claude exclusions and ACP retention are covered by current adapter tests. Unrelated paragraph reordering was omitted. Your contribution and original description are credited and preserved in the replacement, with paired rendered instruction evidence and independent reviews.
juliusmarminge closed this
juliusmarminge removed labelspr:in-progress
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed