Repository navigation
feat(threads): switch providers with conversation history - #1446
Merged
nixuuu merged 2 commits intoNov 28, 2026
Merged
Conversation
nixuuu
marked this pull request as ready for review
November 28, 2026 19:27
nixuuu
added a commit
that referenced
this pull request
Nov 29, 2026
#1457) ## Change The rewind admission fixture creates fixed Claude and Codex adapters in one Effect scope. When rewinding Claude to a new binding, the host unloads Codex through `useRuntime`. That acquisition previously reached the real configuration reconciler, which could close the shared scope while the first post-rewind Claude turn was starting. Pause acquisition at `useRuntime` so starts, rewinds and cross-provider unloads all use the fixed fixture runtimes. The test still exercises both real adapter paths and checks cancellation, redelivery, persisted receipts, and the next turn on the replacement binding. ## Verification - Holding Codex cleanup until the third Claude query opened reproduced the CI failure before the post-rewind turn emitted `turnStarted`. The same ordering passed three times with this change. - Ran both provider cases ten times each with `check:tmp`. All 20 passed and cleaned up. - Worker typecheck and edited-file lint passed locally. Related: #1446
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Admits a provider selection and its message in the same durable operation. After the source journal is durable and the target session is prepared, the new provider receives the visible thread history. The gateway can resume after a quota failure without calling the exhausted model. Each admitted turn retains its execution identity for history, usage and historical operations.
The history reader checks the owner, thread, fork point and rewind visibility on every page. The transfer excludes private reasoning and secret-delivery content. Unfinished actions keep their status. Longer conversations have scoped, searchable pages.
Verified with a real gateway, Postgres and worker using Codex, Claude and Grok through CLIProxyAPI. Both Codex and Grok changed profiles and retrieved the two random facts established earlier in the same conversation. A separate real-CLI test injected HTTP 429 only after a file append. Claude read the existing receipt, the ledger had one entry and the source received zero additional requests. Deterministic integration tests cover retries, reconnect, older workers, preparation failure and queue ordering. The upstream Codex secret-rotation regression also passed. Full verification runs in CI.
Historical operations use the session that ran each turn. Fork, rewind and Undo preserve that provenance. A transfer moves the active session, and a return to a historical provider can recover its context from the transcript. Native goals retain their objective and accumulated usage. The destination receives the remaining budget when its evaluator supports it.
The PostgreSQL 17 upgrade test preserves legacy turns. Targeted tests cover an older worker reconnecting during Undo, historical forks, file-checkpoint compatibility and cleanup of more than one provider profile. Antigravity prompt delivery was verified against its ACP fixture. A live Antigravity binary was unavailable.
A two-home test moved a switched Codex session between different local aliases of the shared profile. Codex resumed on the destination. Claude recovered the original home's decision after a further provider change. Another test verifies a late source usage adjustment while a Codex goal is running on the new account.