You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
👴🏻 fix: Continue Saved Chats After Endpoint Retirement - #18861
A saved chat can become impossible to continue when its model spec moves to a different endpoint and the original endpoint is retired. Reopening the chat now resolves the saved spec against the effective server configuration, including specs hidden from the model menu. The next message continues in the same conversation.
How it works
The conversation detail endpoint returns the replacement target when the original endpoint is gone and the saved spec points to an available provider. It keeps the saved model if the replacement serves it and otherwise uses the spec default. Enforced specs use their configured model.
Sidebar navigation opens immediately when it has a compatible recovered target in cache. It fetches the detail before opening when it still needs a replacement. A transient refresh failure preserves the cached transcript and saved settings.
Type of change
Bug fix
Testing
Tested environments/configuration
Chromium, a mock provider, and disposable MongoDB. The browser regression creates a chat, simulates endpoint retirement, reopens the original URL, and verifies that a follow-up persists with the same conversation ID and parent message while retaining the original transcript.
Automated tests
Focused conversation detail, model-spec recovery, and sidebar navigation suites.
Playwright continuation regression and a matched before-and-after browser run.
TypeScript, static checks, and the Lighthouse conversation-load budget. The unused-dependency check was skipped locally because depcheck was unavailable.
Screenshots / recordings
Open the same saved conversation from the sidebar and submit the same follow-up after its original endpoint has been retired.
Before
The transcript opens, but the composer reports that it cannot load the model or agent. Pressing Enter leaves the follow-up in the composer.
before-retired-endpoint.mp4
After
The composer opens on the replacement provider. The follow-up sends and receives a reply below the original messages.
after-retired-endpoint.mp4
Risk / compatibility
Recovery requires a saved spec pointing to an available replacement. Opening a chat uses the existing response fields and requires no database migration. The first affected sidebar open waits for the detail request if it lacks a usable cached target. When recovery checks whether a different saved model is available, a dynamic model catalog can add a provider request. Recovery-specific latency was not measured.
Checklist
I reviewed my own changes
Relevant tests have been added or updated
Existing relevant tests pass
The change does not introduce new warnings or errors
User-facing or complex behavior is documented where necessary
Required dependency changes have been merged/published (N/A)
Comment "@codex review" or "@codex security review".
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
dustinhealy
changed the title
🔧 fix: Continue Saved Chats After Endpoint Retirement
👴🏻 fix: Continue Saved Chats After Endpoint Retirement
Nov 24, 2026
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
A pending refresh can overwrite newly committed agent or assistant IDs with stale values in conversation caches, causing subsequent navigation to select the wrong target.
This PR lets saved chats continue in the same conversation after their original endpoint is retired, using the saved model spec to resolve an available replacement provider.
Changes:
Resolves replacement targets from effective server configuration, including hidden specs, while preserving compatible saved models.
Updates sidebar navigation to use recovered cached targets or fetch details before opening, preserving cached history on transient failures.
Adds backend, navigation, and browser regression coverage.
File
Description
packages/api/src/conversations/target.ts
Resolves replacement endpoints and models for saved specs.
packages/api/src/conversations/target.spec.ts
Tests recovery eligibility and model selection.
packages/api/src/conversations/load.ts
Applies recovered targets to conversation detail responses.
packages/api/src/conversations/load.spec.ts
Tests history preservation when target resolution fails.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The refresh can overwrite usable recovered routing fields in both caches with a retired endpoint and obsolete agent ID, causing the next conversation open to restore a broken composer during the same outage.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Preserve cached routing when refresh returns an unavailable endpoint
When target resolution fails, createGetConversationHandler returns HTTP 200 with the original stored record, so this refresh overwrites a usable recovered target in both caches with the retired endpoint and obsolete agent ID. The next open can then restore the broken composer during the same outage. Preserve cached routing fields when a same-spec response has an unavailable endpoint and the cached endpoint is still available, while refreshing the non-routing data.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
A critical issue remains: transient catalog discovery failures can appear successful and overwrite the saved model and sidebar target with the spec default instead of preserving them.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Catalog failures can overwrite the saved model with the spec default
packages/api/src/conversations/target.ts:105
A transient catalog failure can silently replace the saved model with the spec default: the catalog loaders turn discovery failures into empty/default lists (packages/api/src/endpoints/config/models.ts:318–338 and defaults.ts:62–66). Recovery then appears successful, so a warm refresh can overwrite the cached model and sidebar target instead of preserving them. Use a failure-aware catalog read for recovery that propagates discovery failures to the handler, and select the spec default only when a successful catalog excludes the saved model.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Recovery can leave conversations on retired endpoints because model discovery omits stored user credentials and Retry does not rerun failed target resolution.
The gate opens only when the workflow, source selection, tooling verification, and every report job succeed. A report job fails on a failed test in its workspace's own Jest run, a tool error, a job timeout, or an incomplete mutation report, including a mutation shard that reaches its execution budget. A cancelled workflow keeps the gate closed. Scores are advisory. A change-risk file marked incomplete or unavailable, for example by a failed api/ source-alias suite, does not close the gate.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Target recovery can switch cold-loaded chats to an unrelated provider and repeatedly fail for user-provided proxy configurations despite valid stored connection details.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed to evaluate a cross-tab refresh and route-restoration edge case that can silently replace a retired endpoint and bypass saved-spec recovery and Retry.
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
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.
Summary
A saved chat can become impossible to continue when its model spec moves to a different endpoint and the original endpoint is retired. Reopening the chat now resolves the saved spec against the effective server configuration, including specs hidden from the model menu. The next message continues in the same conversation.
How it works
The conversation detail endpoint returns the replacement target when the original endpoint is gone and the saved spec points to an available provider. It keeps the saved model if the replacement serves it and otherwise uses the spec default. Enforced specs use their configured model.
Sidebar navigation opens immediately when it has a compatible recovered target in cache. It fetches the detail before opening when it still needs a replacement. A transient refresh failure preserves the cached transcript and saved settings.
Type of change
Testing
Tested environments/configuration
Chromium, a mock provider, and disposable MongoDB. The browser regression creates a chat, simulates endpoint retirement, reopens the original URL, and verifies that a follow-up persists with the same conversation ID and parent message while retaining the original transcript.
Automated tests
depcheckwas unavailable.Screenshots / recordings
Open the same saved conversation from the sidebar and submit the same follow-up after its original endpoint has been retired.
Before
The transcript opens, but the composer reports that it cannot load the model or agent. Pressing Enter leaves the follow-up in the composer.
before-retired-endpoint.mp4
After
The composer opens on the replacement provider. The follow-up sends and receives a reply below the original messages.
after-retired-endpoint.mp4
Risk / compatibility
Recovery requires a saved spec pointing to an available replacement. Opening a chat uses the existing response fields and requires no database migration. The first affected sidebar open waits for the detail request if it lacks a usable cached target. When recovery checks whether a different saved model is available, a dynamic model catalog can add a provider request. Recovery-specific latency was not measured.
Checklist