# fix\(contracts\): retain Claude rollback source sessions · PR \#21598 · pingdotgg/t3code

[View on GitCafe](https://git.cafe/pingdotgg/t3code/pull/21598)

Repository: [pingdotgg/t3code](https://git.cafe/pingdotgg/t3code)

Visibility: public

State: open

Source repository: pingdotgg/t3code

Source branch: claude-10/rollback-schema

Target branch: main

Head commit: 1d2159ea19141ef30dee87a255e1fccce991bdcf

[Discussion and reviews](https://git.cafe/pingdotgg/t3code/pull/21598)

[Commits](https://git.cafe/pingdotgg/t3code/pull/21598/commits?format=markdown)

[Files changed](https://git.cafe/pingdotgg/t3code/pull/21598/diffs?format=markdown)

## Description

---

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](https://github.com/pingdotgg/t3code/pull/21599).

Rebuilt from @elmarbeckmann's [#17430](https://github.com/pingdotgg/t3code/pull/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](https://github.com/pingdotgg/t3code/actions/runs/39226882155).

