Repository navigation
Conversation
…tuses settledTurnStateForSessionStatus and checkpointStatusToTurnState had no default branch, so a session or checkpoint status the client release does not know about (newer server) fell off the switch and returned undefined, silently corrupting latestTurn.state in violation of its declared type. - settledTurnStateForSessionStatus: default returns null, so unknown future statuses keep a running turn unsettled; only known-terminal statuses may settle a turn. - checkpointStatusToTurnState: default returns "completed", since the turn is known done at every call site (matches the existing "missing" precedent). Tests: added two forward-compat cases (unknown session status keeps the turn running; unknown checkpoint status settles it completed). Verified red on base (2 failed, "expected undefined to be 'running'/'completed'") and green with the fix (52/52). --- Authored with AI assistance (Muse, Meta's Muse Spark) under the contributor's direction.
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a narrowly scoped forward-compatibility fix in an existing reducer, preserving known behavior while preventing invalid turn states for unknown statuses. Both fallback paths are covered by focused tests, with no schema, deployment, security, or product-default changes. Notes:
You can add or adjust custom eligibility rules. Learn more. |
|
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 configurationConfiguration used: Repository: pingdotgg/t3code/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review. 📝 WalkthroughWalkthroughThe reducer defines fallback behavior for unrecognized session and checkpoint statuses. Tests verify that an unknown session status preserves a running turn and an unknown checkpoint status completes it. ChangesStatus fallback handling
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to The status fallbacks have no identified merge-blocking issue; the PR is mergeable after normal checks. Architecture SummaryArchitecture risk: 🔵 Low · up to The change affects 1 system. Changed systems: Architecture concerns Review detailsSystems and components
Before / after behavior
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Dismissing prior approval to re-evaluate 4e5cd62
|
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 threadReducer.ts, which the V2 merge removed. The shared client now consumes V2 snapshots and projections. 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. |
What Changed
Added explicit
defaultbranches to the two status-mapping switches inpackages/client-runtime/src/state/threadReducer.ts:settledTurnStateForSessionStatus: unknown future session statuses returnnull— a running turn stays unsettled; only known-terminal statuses may settle a turn.checkpointStatusToTurnState: unknown future checkpoint statuses return"completed"— the turn is known done at every call site, matching the existing"missing"precedent.Why
Without a
default, a session or checkpoint status the client release doesn't know about (newer server) fell off the switch and returnedundefined, silently corruptinglatestTurn.statein violation of its declared type. This is the client-side forward-compat counterpart to the server's capability-gated event streams.Validation
expected undefined to be 'running'/'completed'), green with the fix (52/52 inpackages/client-runtime/src/state/threadReducer.test.ts).Checklist
Authored with AI assistance (Muse, Meta's Muse Spark) under the contributor's direction.
Summary by CodeRabbit