fix(claude): preserve goal text containing a turn count #48232
main fromrefs/pull/48232/head·opened View on GitHubProblem#
On a Claude thread, bare /goal can truncate the objective and lower its displayed check count when the objective contains text like (1 turn). Later Stop hook feedback also stops matching the truncated objective.
Deterministic repro on origin/main (9a08ffb84084c441dcf4a2f595682a44632ecc89)
- In
ClaudeAdapterV2.test.ts, use thekeeps a goal active after a command turn with no model outputreplay. Seed an active objectivecheck (1 turn) before mergingwithchecks: 2, then send/goal. - Replay a root SDK assistant frame with model
<synthetic>and textGoal active: check (1 turn) before merging (2 turns), with and without\nLast check: Waiting for review (7 turns). Finish with the existing empty success result (result: "",numTurns: 0).
The live composer sends /goal through the server's turn-start flow to ClaudeAdapterV2. The SDK message handler calls trackClaudeGoal, and turn finalization re-emits that goal in provider_thread.updated. The ingestor persists the update, and the projection reads it from the active provider thread into the thread shell independently of timeline item limits.
- Observed:
{ objective: "check", status: "active", checks: 1 }. - Expected:
{ objective: "check (1 turn) before merging", status: "active", checks: 2 }.
Change#
Require the active-goal count to end the status text or be followed by a newline-delimited Last check: footer. The corrected provider-thread goal feeds the web and Electron objective and count, the mobile status accessibility label, and subsequent Claude Stop hook matching without any client or contract changes.
Scope#
Small fix for an obvious bug; no issue needed under CONTRIBUTING.md.
Verification#
vp test run apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts -t 'keeps a goal active after a command turn with no model output': both replay rows failed on base with the wrong objective and count; both passed with the fix.vp run check:changedexited 0 viacommit-checked.sh(539 tests passed across two files).- Before/after adapter runtime transcript, using the status format from Claude Code 2.1.321.
- Not shown: a live authenticated Claude session, a separate end-to-end Stop hook run, or screenshots of the web, desktop, and mobile clients.
Authored by GPT-6.2 Sol (Codex); reviewed by Gemini 4 Neon (Antigravity).
- 1
tanstack-source added labelsbug
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XS
Approvability#
Verdict: Approved at
4668ac7Macroscope's review found this PR approvable — This corrects Claude goal parsing so objectives containing turn counts remain intact, while allowing the existing last-check suffix. The change is confined to transcript interpretation and does not alter product defaults or diagnostic settings.
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.
Walkthrough
-
The Claude goal-status pattern now matches the full text and allows an optional
Last check:section. Tests cover status text with and without that footer.Changes: Goal-status matching
Layer / File(s) Summary Full-text matching and footer tests
apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts,apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.tsCLAUDE_GOAL_ACTIVEnow rejects unmatched trailing text and accepts an optional newline followed byLast check:content. Tests cover empty and populated footers.Estimated code review effort: 2 (Simple) | ~5 minutes
Change: Bug fix
Suggested reviewers:
juliusmarminge,diegoagdiaz
Merge Risk:
Minimal · up to4668a-
This fixes goal objectives containing a turn count being truncated. No actionable merge-blocking risk remains.
Pre-merge checks:
4-
Check name Status Explanation Title check The title "fix(claude): preserve goal text containing a turn count" names the main change: the Claude adapter's goal parsing keeps objective text such as "(1 turn)" intact. It matches the raw summary,… Description check The description follows the template's sections: Problem, Change, Scope, and Verification. The Problem section gives a reproduction, expected and observed behavior, and the affected code path. The Cha… Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Check skipped because no linked issues were found for this pull request. Full details: Title check
-
Explanation
The title "fix(claude): preserve goal text containing a turn count" names the main change: the Claude adapter's goal parsing keeps objective text such as "(1 turn)" intact. It matches the raw summary, which says CLAUDE_GOAL_ACTIVE now requires the full goal-status text to match, and the PR objectives, which describe the same fix. The title is specific and concise and follows the conventional commit format.
Full details: Description check
-
Explanation
The description follows the template's sections: Problem, Change, Scope, and Verification. The Problem section gives a reproduction, expected and observed behavior, and the affected code path. The Change section explains the regex fix and why no client changes are needed. Scope explains why no issue is linked. Verification lists the focused test command, the check:changed run, and a before/after transcript, and it states what was not checked. The description does not include a model and harness line in the form the template asks for, but it does name the author model in the closing line. This is a minor gap that does not block the check.
-
Finishing Touches
-
Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info-
Run configuration-
- Source mode: Auto
- Repository: pingdotgg/t3code
- Branch: main
- File: .coderabbit.config.ts
- Commit: 9a08ffb
- Layers: Repository TS config
- Review profile: CHILL
- Plan: Advanced
- Run ID:
aa431b57-3c02-4004-9535-9c78e472c366
Commits-
Reviewing files that changed from the base of the PR and between 9a08ffb84084c441dcf4a2f595682a44632ecc89 and 4668ac727e20aa9d01f943e8d56eddd24232c403.
Files selected for processing: 2-
apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.tsapps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.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.
-
-
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes