fix(server): preserve instructions around Claude skill chips #13299
main fromrefs/pull/13299/head·opened View on GitHubWhat Changed#
Keep the complete user instruction in the text block before a mid-prompt Claude skill invocation, with known skill mentions rewritten inline as slash names. Keep the final native invocation and its arguments, and retain the single command block for chip-first prompts.
Why#
you will $implement fixes previously reached Claude's native expansion as you will followed by /implement fixes. The resulting model request contained an orphaned prefix and the expanded skill, but no intact sentence. Preserving you will /implement fixes in the earlier block keeps the instruction intact while the last block still loads the skill.
Fixes #13256.
Validation#
- 152 tests passed across ClaudeSkillDispatch.test.ts and ClaudeAdapter.test.ts, including instruction preservation and image/command ordering.
- Targeted lint and formatting passed; server package typecheck passed (Effect suggestions only);
git diff --checkpassed. - Reproduced the failure on main at
f5ef0ddb90a8c36584e181b1913e7b8a5df30ffcusing Claude Code CLI 2.1.280 on Windows with Node 24.13.1. A local fake Messages API captured the native post-expansion request. The baseline lost the sentence; the patch preserved it and expanded the skill. - Patched native captures passed for mid-sentence input, multiple paragraphs, an Ultrathink prefix, negation, multiple skill mentions, and chip-first invocation. Only the final skill expanded in the multiple-mention capture.
The fixture used temporary configuration and no real model inference. These results establish request serialization and native expansion, not subsequent model interpretation or tool execution. No live T3 UI or mobile session was tested. Full instructions repeat the arguments already supplied to the native invocation; no additional native invocation is introduced.
Checklist#
- This PR is small and focused
- I explained what changed and why
- I included before/after screenshots for any UI changes (not applicable: server request construction)
- I included a video for animation/interaction changes (not applicable: serialized request capture)
AI assistance: OpenAI Codex; harness: Codex agent runtime (specific integration/version not exposed); host/interface: T3 Code; model: gpt-6-astra (GPT-6 Astra); reasoning/effort: medium; contribution: investigation, implementation, regression tests, automated native and repository checks, and drafting. Model, effort, and host are user-confirmed; the specific harness integration and version remain unverified. Human involvement: selected the issue, authorized implementation, and confirmed the attribution details during review of this draft; no manual testing or code review claimed.
Summary by CodeRabbit#
- Bug Fixes
- Preserved the full request when dispatching a skill mention, including preceding instructions, multiline text, and text around images.
- Earlier skill mentions are retained as slash commands in the request, while the final mention is dispatched separately.
- 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: Approved at
24a3654Macroscope's review found this PR approvable — This is a focused Claude server bug fix that preserves complete user instructions while retaining native skill expansion. The production change is localized to prompt construction and is covered by targeted dispatch and adapter tests, with no schema, deployment, default, or static-analysis changes.
Notes:
- Diff unchanged. Approvability was decided on eligibility alone.
Navigate logical layers of code changes, visualize relationships, and explore their blast radius.
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml
Review profile: CHILL
Plan: Advanced
Run ID:
d196e259-9314-4ab9-8636-908ae6ebf16f📥 Commits
Reviewing files that changed from the base of the PR and between f5ef0ddb90a8c36584e181b1913e7b8a5df30ffc and 24a365431db80c72bc176dfbb6314947d7f97adb.
📒 Files selected for processing (4)
apps/server/src/provider/Drivers/ClaudeSkillDispatch.test.tsapps/server/src/provider/Drivers/ClaudeSkillDispatch.tsapps/server/src/provider/Layers/ClaudeAdapter.test.tsapps/server/src/provider/Layers/ClaudeAdapter.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
📝 Walkthrough
Walkthrough#
Claude skill dispatch now keeps the full prompt, with skill mentions rewritten as slash commands, in the leading text. It sends the final skill mention as command text. Adapter tests verify the resulting content blocks, including prompts with image attachments.
Changes#
Claude skill dispatch
Layer / File(s) Summary Rewrite the complete prompt
apps/server/src/provider/Drivers/ClaudeSkillDispatch.ts,apps/server/src/provider/Drivers/ClaudeSkillDispatch.test.tsplanClaudeSkillDispatchrewrites skill mentions in the complete prompt and keeps the final mention as command text. Unit tests cover prefixes, multiple mentions, trailing mentions, multiline text, and anUltrathink:prefix.Preserve prompt text in adapter blocks
apps/server/src/provider/Layers/ClaudeAdapter.ts,apps/server/src/provider/Layers/ClaudeAdapter.test.tsAdapter tests expect the leading content block to retain the prompt prefix with the rewritten slash command, including when an image attachment is present. The adapter comment describes this behavior. Estimated code review effort: 2 (Simple) | ~10 minutes
Suggested reviewers:
t3dotggMerge Risk: ⚪ Minimal · up to
24a36The prompt-preservation change is ready to merge after normal checks; no actionable regression was found.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation Title check ✅ Passed The title clearly and concisely describes the main change: preserving instructions around Claude skill chips. Description check ✅ Passed The description explains what changed, why it changed, validation performed, issue linkage, scope, and checklist status. It also identifies UI and interaction items as not applicable. Linked Issues check ✅ Passed The changes satisfy #13256.planClaudeSkillDispatchnow keeps the complete request inleadingTextand rewrites earlier skill mentions as inline/namecommands. It keeps the final invocation and …Out of Scope Changes check ✅ Passed The source change, comments, and updated tests directly support the Claude skill-dispatch fix in #13256. The changes do not add unrelated behavior or unrelated files.Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 4 files. ✨ Finishing Touches
🧪 Generate unit tests (beta)
- Create a new PR
Comment `@coderabbitai help` to get the list of available commands.juliusmarminge added labelsmacroscope-review
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
Thanks for working on this. We merged the orchestrator V2 rewrite in #2829, and we are closing this PR as part of that transition.
This change touches ClaudeAdapter.ts, which the V2 merge removed. Claude execution now runs through ClaudeAdapterV2.
Sorry for the extra work this creates. If the change is still needed on V2, please rebuild it on current main, verify it there, and open a new PR linking back here. We're closing the current implementation without assuming the underlying request is resolved.
juliusmarminge closed this
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed