fix(server): do not block command readiness on recovery turns - #313
Merged
Conversation
Split restart recovery into a durable claim phase (before orphan settle) and a parked startSession/sendTurn continuation (after activation), with provider timeouts. Exempt oauth/environment bootstrap paths from the global readiness gate so Discord and health probes stay available when a hung agent would otherwise stall the whole HTTP surface.
patroza
marked this pull request as ready for review
August 4, 2026 13:17
patroza
added a commit
that referenced
this pull request
Aug 4, 2026
Split restart recovery into a durable claim phase (before orphan settle) and a parked startSession/sendTurn continuation (after activation), with provider timeouts. Exempt oauth/environment bootstrap paths from the global readiness gate so Discord and health probes stay available when a hung agent would otherwise stall the whole HTTP surface. Co-authored-by: T3 Code PR Stack <41898282+github-actions[bot]@users.noreply.github.com>
patroza
added a commit
that referenced
this pull request
Aug 4, 2026
Split restart recovery into a durable claim phase (before orphan settle) and a parked startSession/sendTurn continuation (after activation), with provider timeouts. Exempt oauth/environment bootstrap paths from the global readiness gate so Discord and health probes stay available when a hung agent would otherwise stall the whole HTTP surface. Co-authored-by: T3 Code PR Stack <41898282+github-actions[bot]@users.noreply.github.com>
patroza
added a commit
that referenced
this pull request
Aug 5, 2026
Split restart recovery into a durable claim phase (before orphan settle) and a parked startSession/sendTurn continuation (after activation), with provider timeouts. Exempt oauth/environment bootstrap paths from the global readiness gate so Discord and health probes stay available when a hung agent would otherwise stall the whole HTTP surface. Co-authored-by: T3 Code PR Stack <41898282+github-actions[bot]@users.noreply.github.com>
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.
Summary
reconcileStartup→startSession+sendTurn) ran insideProviderCommandReactor.start(), which is on the critical path before orphan settle and beforesignalCommandReady. That ordering exists so (1) recovery can claim/resume before orphan audit clears “running” zombies, and (2) clients do not race half-started provider state. The cost: a hung agent on recovery made all HTTP (including Discord/oauth/token) wait forever.restartRecoverymarker, demote binding tostopped, settle projection as interrupted. Orphan audit will not wipe recovery intent.ServerActivation):startSession+ recoverysendTurnrun after activation / readiness boundary, each with a 45s timeout. Hung agents fail closed with recovery-failed state instead of pinning boot./oauth/token,/.well-known/t3/environment, and connect health paths skip the global command-readiness middleware so Discord/bootstrap stay up even if other startup work is slow.Risks if we had only “moved recovery later”
activeTurnId/ kills mid-start processdrainstill awaitsstartupReconciliationDoneafter continuationsTest plan
vp test run apps/server/src/orchestration/Layers/ProviderCommandReactor.test.tsserver.test.ts