Skip to content

fix(server): fail V2 runs when provider sessions cannot open - #12790

Merged
juliusmarminge merged 2 commits into
pingdotgg:t3code/codex-turn-mappingfrom
pekth:fix/v2-session-open-terminal-state
Sep 21, 2026
Merged

juliusmarminge merged 2 commits into
pingdotgg:t3code/codex-turn-mappingfrom
pekth:fix/v2-session-open-terminal-state

Conversation

@pekth

@pekth pekth commented Sep 20, 2026 •

Copy link
Copy Markdown

A provider session that rejects during V2 startup leaves the run in starting, so a delegated task continues to report running after the effect worker exhausts its retries. This occurred with a Grok ACP protocol startup failure in preview 0.0.43-preview.20260919.1974.

Persist a failed run, attempt, root node, and error item when session opening returns a typed failure. The existing current-attempt/status guard prevents stale failures from overwriting interruption; database write failures remain retryable. Pure interruption propagates unchanged.

This is a T3 Code lifecycle bug, not a Fleet configuration bug. The failing regression invokes ProviderTurnStartService directly. A rejected providerSessions.open exits before startRootRun and, on the original code, leaves the durable run in starting. No Fleet code or hook participates in that path.

Validation: the new regression failed against the original code, then all 9 focused ProviderTurnStartService tests passed. The existing SQL stale-start guard test passed. Server typecheck, scoped lint/type diagnostics, formatting, and diff checks passed. The running preview was not replaced, so this does not claim a successful Grok session on an installed candidate.

Targets the V2 branch tracked by #2829. The change handles session opening before startRootRun.

Models: GPT-5.6 Sol for implementation and independent review; GPT-6 Astra for controller verification. Harness: Codex through T3 Code preview.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Sep 20, 2026
@macroscopeapp

macroscopeapp Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 89bddb3

Macroscope's review found this PR approvable — This is a localized V2 startup bug fix that terminalizes runs when provider sessions fail to open, while preserving interruption, stale-run, retry, and successful-start behavior. The production change is self-contained and accompanied by targeted regression tests, with no schema, default, deployment, or static-analysis configuration impact.

You can add or adjust custom eligibility rules. Learn more.

@juliusmarminge
juliusmarminge force-pushed the t3code/codex-turn-mapping branch 2 times, most recently from a1f8051 to 0337dd6 Compare September 21, 2026 05:40
@pekth
pekth force-pushed the fix/v2-session-open-terminal-state branch from 89bddb3 to 639946b Compare September 21, 2026 13:26
pekth and others added 2 commits September 21, 2026 13:39
The session-open failure path duplicated the turn-item, run, attempt and
node event assembly already used by the sign-out and empty-compaction
path. Extract settleRunBeforeStart and use it in both; payloads are
unchanged, including startedAt staying null when the provider never
opened and the trailing provider-thread update on the account path.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@juliusmarminge

Copy link
Copy Markdown
Member

Rebased onto t3code/codex-turn-mapping at 9d6feae1ff. The commit applied cleanly with no conflicts.

One follow-up commit on top (f780c2a84b): the new session-open failure branch rebuilt the same signal turn item, run.updated, run-attempt.updated and node.updated events (and the same writeIfRunCurrent guard) that the earlier sign-out / empty-compaction branch in ProviderTurnStartService.start already assembles. Pulled that into one local helper, settleRunBeforeStart, and call it from both places. Behavior is unchanged: the account path still stamps startedAt and appends its provider-thread.updated, and the session-open path still leaves startedAt null and emits no provider-thread event, which is what your regression asserts.

Verified in apps/server: vp test run src/orchestration-v2/ProviderTurnStartService.test.ts (9 passed, including the existing sign-out completed/failed cases and your new session-open case) and vpr typecheck (clean).

Nothing else changed.

Rebased and touched up by a maintainer's agent; a human will re-review.

@juliusmarminge
juliusmarminge force-pushed the fix/v2-session-open-terminal-state branch from 639946b to f780c2a Compare September 21, 2026 20:45
@github-actions github-actions Bot added size:L 100-499 changed lines (additions + deletions). and removed size:M 30-99 changed lines (additions + deletions). labels Sep 21, 2026
@juliusmarminge
juliusmarminge merged commit dcaf479 into pingdotgg:t3code/codex-turn-mapping Sep 21, 2026
19 of 20 checks passed
saphid pushed a commit to saphid/t3code that referenced this pull request Sep 22, 2026
The Fork Nightly Orchestrator v2 Test gate has failed on the upstream
SelectionRestart integration test since upstream pingdotgg#12790 changed how
provider session open failures settle a run. Add the fork-side fixture
alignment patch (f2f8d2d) to the replay stack so the nightly can
build on the current upstream head.
github-actions Bot added a commit to saphid/t3code that referenced this pull request Sep 22, 2026
pingdotgg#12790 settles a V2 run as failed when the provider session cannot open.
The selection restart fixture simulated a transient replacement-open
failure and expected the restart to retry it, which no longer happens,
so the integration test died waiting for attempt 2 to complete.

Drop the simulated failure injection and pin the restart lifecycle on
its own: superseded first attempt, completed replacement attempt, no
hard-interrupt items, and a freshly allocated replacement session.
github-actions Bot added a commit to saphid/t3code that referenced this pull request Sep 22, 2026
pingdotgg#12790 settles a V2 run as failed when the provider session cannot open.
The selection restart fixture simulated a transient replacement-open
failure and expected the restart to retry it, which no longer happens,
so the integration test died waiting for attempt 2 to complete.

Drop the simulated failure injection and pin the restart lifecycle on
its own: superseded first attempt, completed replacement attempt, no
hard-interrupt items, and a freshly allocated replacement session.
github-actions Bot added a commit to saphid/t3code that referenced this pull request Sep 23, 2026
pingdotgg#12790 settles a V2 run as failed when the provider session cannot open.
The selection restart fixture simulated a transient replacement-open
failure and expected the restart to retry it, which no longer happens,
so the integration test died waiting for attempt 2 to complete.

Drop the simulated failure injection and pin the restart lifecycle on
its own: superseded first attempt, completed replacement attempt, no
hard-interrupt items, and a freshly allocated replacement session.
juliusmarminge added a commit that referenced this pull request Sep 23, 2026
Co-authored-by: Julius Marminge <51714798+juliusmarminge@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
juliusmarminge added a commit that referenced this pull request Sep 23, 2026
Co-authored-by: Julius Marminge <51714798+juliusmarminge@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
juliusmarminge added a commit that referenced this pull request Sep 23, 2026
Co-authored-by: Julius Marminge <51714798+juliusmarminge@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
juliusmarminge added a commit that referenced this pull request Sep 23, 2026
Co-authored-by: Julius Marminge <51714798+juliusmarminge@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
juliusmarminge added a commit that referenced this pull request Sep 23, 2026
Co-authored-by: Julius Marminge <51714798+juliusmarminge@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
juliusmarminge added a commit that referenced this pull request Sep 23, 2026
Co-authored-by: Julius Marminge <51714798+juliusmarminge@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
juliusmarminge added a commit that referenced this pull request Sep 24, 2026
Co-authored-by: Julius Marminge <51714798+juliusmarminge@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
juliusmarminge added a commit that referenced this pull request Sep 24, 2026
Co-authored-by: Julius Marminge <51714798+juliusmarminge@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
juliusmarminge added a commit that referenced this pull request Sep 24, 2026
Co-authored-by: Julius Marminge <51714798+juliusmarminge@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
juliusmarminge added a commit that referenced this pull request Sep 25, 2026
Co-authored-by: Julius Marminge <51714798+juliusmarminge@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants