fix(server): recover opted-in threads after machine restarts - #9803
Merged
maria-rcks merged 4 commits intoSep 4, 2026
Merged
Conversation
Contributor
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This PR adds a cross-cutting, durable provider-session recovery workflow for crashes and machine restarts, including new startup reconciliation and provider lifecycle state transitions. It also moves the opt-in to environment-scoped server settings, so the breadth of runtime and settings behavior warrants human review. You can add or adjust custom eligibility rules. Learn more. |
4 tasks
patroza
pushed a commit
to patroza/t3code
that referenced
this pull request
Sep 4, 2026
Recover opted-in threads after machine restarts (pingdotgg#9803). Keep fork interactionMode and graceful-stop continuation markers beside the per-environment restart opt-in.
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.
The existing continuation setting now covers normal close/reopen, server crashes, and machine reboots once T3 starts again. It remains off by default and is stored per environment, so existing client-local opt-ins must be enabled once on each environment.
Recovery requires matching unfinished thread/provider state and saved provider resume state; preparation persists intent before clearing the old turn, and send failures clear it without blindly retrying the provider. Superseded recovery markers cannot replay an older turn. Prepared recovery survives provider reconnection without replaying work that finished after update marking.
Verified with 207 focused tests plus the added bulk-read failure regression (24 recovery tests), server/web typechecks, targeted lint (existing settings-panel warnings), and a production web build. In the real client, a Codex thread resumed and finished after SIGKILL/relaunch and another resumed after clean SIGTERM/relaunch; a completed thread stayed idle. The opt-in persisted across server restart and browser reload, and the settings row was checked in dark/light desktop and narrow web layouts. The OS itself and Electron's native quit UI were not restarted.
Browser recordings were captured on the remote desktop, but this environment cannot retrieve those files for inspection/upload; video evidence remains unavailable.
Two independent
gpt-6-astrareviewers at xhigh recommend merging after the recovery fixes.Implemented with
gpt-5.6-solin the Codex harness.Note
Recover opted-in provider threads after server restarts
continueThreadsAfterServerUpdatefromClientSettingsSchematoServerSettingsSchema(defaultfalse), making the preference per-environment rather than per-client.ServerSettingsPatchcan now modify it.ProviderService.runStopAllrecords the active turn ascontinueAfterServerUpdatefor running bindings when the server setting is enabled;stopSessionand new turns clear both continuation markers.reconcileProviderSessionsscans persisted bindings for prepared continuations, recovers eligible interrupted sessions when projection, binding, active turn, and resume cursor all match, and settles invalid or mismatched sessions instead.useEnvironmentSettingsin ServerUpdateAction.tsx.continueThreadsAfterServerUpdateremoved fromClientSettingsSchemaandClientSettingsPatchSchemain settings.ts; previously enabled client-side preferences are no longer read and must be re-enabled per environment.Macroscope summarized da3d799.