fix(contracts): retain Claude rollback source sessions#21598

open1
main
claude-10/rollback-schema
opened4d agobyJJulius Marminge
View on GitHubTwo-way sync enabledPR last imported 15h ago

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

Some checks failed

Added 1 commit

  • fix(contracts): retain Claude rollback source sessions1d2159e
Synced from GitHub

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.

Synced from GitHub

Thread transfer impact

āœ… Thread transfer remains within every enforced ceiling.

ProviderMetricMain baselineThis PRImpactPR ceiling
CodexTotal thread wire5.0 KiB5.0 KiB0 B (0.0%)6.8 KiBāœ…
CodexThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiBāœ…
CodexLive turn WebSocket wire1.2 KiB1.2 KiB0 B (0.0%)2.0 KiBāœ…
CodexLive turn WebSocket decoded20.9 KiB20.9 KiB0 B (0.0%)29.3 KiBāœ…
CodexLive turn messages220 (0.0%)8āœ…
ClaudeTotal thread wire5.0 KiB5.0 KiB+7 B (+0.1%)6.8 KiBāœ…
ClaudeThread snapshot wire3.8 KiB3.8 KiB0 B (0.0%)4.9 KiBāœ…
ClaudeLive turn WebSocket wire1.2 KiB1.2 KiB+7 B (+0.6%)2.0 KiBāœ…
ClaudeLive turn WebSocket decoded21.2 KiB21.2 KiB0 B (0.0%)29.3 KiBāœ…
ClaudeLive turn messages220 (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.

Synced from GitHub

Review in Change Stack →

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 OrchestrationV2ProviderThreadNativeMetadata schema adds an optional claudeRollbackSessionIds mapping 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.ts
The provider thread metadata schema adds the optional claudeRollbackSessionIds mapping. 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 nameStatusExplanation
Title checkPassedThe title clearly and concisely describes the main schema change: retaining Claude rollback source sessions.
Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
Description checkPassedThe 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.