fix(contracts): retain Claude rollback source sessions#21598
Claude forks rewrite message UUIDs. After recovering a compacted thread, earlier checkpoints still refer to messages in the original session, and that correspondence must survive a server restart.
Add an optional claudeRollbackSessionIds record to provider-thread native metadata. The dependent adapter layer records only retained turns whose source differs from the active session. Existing data needs no migration; this layer changes no runtime behavior.
Stack companion: #21599.
Rebuilt from @elmarbeckmann's #17430. The schema is separated from the adapter so the persistence boundary can be reviewed independently.
Verification: the integrated stack passes 310 focused adapter/rollback-service tests, server typecheck, scoped lint and formatting. The regression cases encode/decode the provider thread and recreate the runtime before continuing and rolling back again. Two independent review rounds covered both layers; the second found no substantive defects.
This is a nonvisual schema change; screenshots do not apply. The dependent layer documents CLI and packaging proof. macOS, Windows, iOS, Android and Electron desktop builds were not verified on this head. Unmerged; maintainer review remains.
Implemented with gpt-6.1-sol through Codex in T3 Code; tests by gpt-6-astra, reviews by claude-opus-5-5 and gpt-6-sol.
Current CI gate: the unchanged WorkflowOpeningBlock.browser.test.tsx highlighting wait failed twice across three CI attempts (the other attempt lost its Vitest browser connection). All other run CI jobs and bot correctness/approvability checks pass. No further reruns or unrelated frontend edits were made; this layer is not ready until web CI passes. CI run.
Checks
- SuccessfulCodeRabbitGitHub
Review completed
- SuccessfulNative fingerprint diffGitHub
- FailedCheckGitHub
- SuccessfulTest Server 3GitHub
- SuccessfulTest Server 5GitHub
- SuccessfulTest Server 1GitHub
- SuccessfulLintGitHub
- SuccessfulTest Server 2GitHub
- Skipped
- SuccessfulBuild and TypecheckGitHub
- SuccessfulTestGitHub
- SuccessfulTest Server 6GitHub
- SuccessfulTest Server 7GitHub
- SuccessfulTest Server 8GitHub
- SuccessfulRelease SmokeGitHub
- SuccessfulTest Server 4GitHub
- SkippedRustGitHub
- SuccessfulChangesGitHub
- FailedTest WebGitHub
- SuccessfulNative fingerprint diffGitHub
- SkippedBuild preview JS bundleGitHub
- Skipped
- SkippedDeploy web previewGitHub
- Successful
- SkippedEAS PreviewGitHub
- Successful
- SuccessfulLabel PR 21598GitHub
- Skipped
- SuccessfulLabel PR sizeGitHub
- SuccessfulPrepare PR size configGitHub
- SuccessfulCollect PR targetsGitHub
- SkippedEAS PreviewGitHub
- CancelledNative fingerprint diffGitHub
- SuccessfulPOST to CursorGitHub
Added 1 commit
- fix(contracts): retain Claude rollback source sessions1d2159e
Approvability
Verdict: Approved at 1d2159e
Macroscope's review found this PR approvable ā This PR adds one optional, backward-compatible field to provider-thread metadata so Claude rollback session mappings can be persisted. Existing callers and stored data remain unchanged, with no defaults, static-analysis suppressions, or production behavior changes in this diff.
You can add or adjust custom eligibility rules. Learn more.
Thread transfer impact
ā Thread transfer remains within every enforced ceiling.
| Provider | Metric | Main baseline | This PR | Impact | PR ceiling | |
|---|---|---|---|---|---|---|
| Codex | Total thread wire | 5.0 KiB | 5.0 KiB | 0 B (0.0%) | 6.8 KiB | ā |
| Codex | Thread snapshot wire | 3.8 KiB | 3.8 KiB | 0 B (0.0%) | 4.9 KiB | ā |
| Codex | Live turn WebSocket wire | 1.2 KiB | 1.2 KiB | 0 B (0.0%) | 2.0 KiB | ā |
| Codex | Live turn WebSocket decoded | 20.9 KiB | 20.9 KiB | 0 B (0.0%) | 29.3 KiB | ā |
| Codex | Live turn messages | 2 | 2 | 0 (0.0%) | 8 | ā |
| Claude | Total thread wire | 5.0 KiB | 5.0 KiB | +7 B (+0.1%) | 6.8 KiB | ā |
| Claude | Thread snapshot wire | 3.8 KiB | 3.8 KiB | 0 B (0.0%) | 4.9 KiB | ā |
| Claude | Live turn WebSocket wire | 1.2 KiB | 1.2 KiB | +7 B (+0.6%) | 2.0 KiB | ā |
| Claude | Live turn WebSocket decoded | 21.2 KiB | 21.2 KiB | 0 B (0.0%) | 29.3 KiB | ā |
| Claude | Live turn messages | 2 | 2 | 0 (0.0%) | 8 | ā |
Baseline: 1451e7c Ā· PR result: 1d2159e Ā· Source CI: failure
Scenario and decoded snapshot size
10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
- Codex decoded thread snapshot: 108.5 KiB
- Claude decoded thread snapshot: 108.8 KiB
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.
No actionable comments were generated in the recent review. š
ā¹ļø Recent review info
āļø Run configuration
- Configuration used: Path: .coderabbit.config.ts
- Review profile: CHILL
- Plan: Team
- Run ID:
8860655d-8e82-49f2-a94e-e6dc2d7f5270
š„ Commits
Reviewing files that changed from the base of the PR and between 1451e7cb23034d29774338608368a15d8845df36 and 1d2159ea19141ef30dee87a255e1fccce991bdcf.
š Files selected for processing: 1
packages/contracts/src/orchestrationV2.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
š Walkthrough
The
OrchestrationV2ProviderThreadNativeMetadataschema adds an optionalclaudeRollbackSessionIdsmapping from provider turn IDs to trimmed, non-empty session ID strings.Changes: Claude rollback session metadata
Layer / File(s) Summary Add rollback session metadata
packages/contracts/src/orchestrationV2.tsThe provider thread metadata schema adds the optional claudeRollbackSessionIdsmapping. Its comment describes its use with Claude forks.Priority: ā¬ļø Low
Estimated code review effort: 1 (Trivial) | ~5 minutes
Change: Bug fix
Suggested reviewers:
maria-rcks
Merge Risk: āŖ Minimal Ā· up to 1d215
No actionable merge-blocking risk is established for this schema-only change.
Pre-merge checks: Passed 4
Check name Status Explanation Title check Passed The title clearly and concisely describes the main schema change: retaining Claude rollback source sessions. Linked Issues check Passed Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request. Description check Passed The description covers the problem, change, verification results, scope, related pull requests, platform limitations, and current CI status. It does not use the required section headings and does not ⦠Full details: Description check
Explanation
The description covers the problem, change, verification results, scope, related pull requests, platform limitations, and current CI status. It does not use the required section headings and does not provide explicit maintainer approval or explain the approval exemption, but the content is mostly complete.
⨠Finishing Touches: š” 1
-
š ļø Fix failing CI checks: š”
- Commit to this branch
- Create a new PR
š Generate docstrings
- Commit to this branch
- Create a new PR
š§Ŗ Generate unit tests (beta)
- Commit to this branch
- Create a new PR
- Autofix Ā· Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.