A provider event subscription can end without settling its running run #19127
What happened#
On 2026-10-13 a delegated Codex child remained marked running/Compacting for 6 h 41 m. Native compaction finished in 146.4 seconds and the native turn subsequently completed. T3 did not persist the run's terminal. Later steering failed with "provider turn is not active"; restarting the app cancelled the stale run.
Diagnosis#
The incident establishes divergent native and T3 state. The exact initiating fault is not proven: the retained server traces begin after the divergence, and do not distinguish an ended subscriber from a blocked ingestion write or routing failure.
A deterministic hole exists in current upstream main (8ac4b97dae6bff7258fa5091a908116902fbd635): RunExecutionService.ts returns when the subscription drains with no root turn.terminal. Its detached consumer closes while the durable run remains running. The existing guarded ingestion-failure finalization only executes when an error is raised. This branch is also present in the incident build.
Expected: an unexpectedly exhausted subscription must finalize the still-owned running attempt as failed, with a visible stream failure. A stopped or superseded attempt must remain unchanged. Intentional server shutdown must leave settlement to shutdown recovery.
Steps to reproduce#
In the real RunExecutionService test harness, start an owned running attempt with a finite subscription containing running run-owned subagent/node/item events, then end it without a root terminal. Await the subscription's close Deferred and inspect the final event batch. Unpatched main writes no run terminal; the assertion expecting run:failed fails. No provider hang, live database write, timing sleep, or app restart is needed for this reproduction.
This reproduces the clean-stream-end defect, not the original incident's complete interleaving.
Version#
Incident: 0.0.46-nightly.20261012.25, commit 48026a7d6e18ebfb3c3c891cb18d34a4e1911d81. Source hole rechecked on upstream main 8ac4b97dae6bff7258fa5091a908116902fbd635.
Environment#
Windows desktop app/local server; delegated Codex child; native Codex CLI 0.162.1. Offline reproduction: Node 24.21.0.
Evidence#
Compact, redacted summaries of preserved native/provider logs and durable projections (UTC, 2026-10-13):
10:59:21.488 T3 compaction item running
11:01:47.929 native item_completed ContextCompaction
13:00:11.686 native turn/completed status=completed
13:30:11.725 T3 thread/unsubscribe (30 minutes after native completion)
15:53:48 later steer rejected: provider turn is not active
17:40:23.735 app restart cancels stale T3 run and compaction item
Real-service regression before fix:
expected ['run:failed', 'pull-requests-refreshed']; received []
The incident investigation checked 425 retained native notification frames against the incident schemas, with zero decode failures. Idle unload timing supports the session manager receiving native completion; it does not prove the run consumer's exact failure. No secrets, home paths, conversation content, or native/thread identifiers are included here.
Related issues#
PR #14856 handles event-persistence failure/retry; its clean null-terminal return remains. PR #16749, linked to #15993, handles orphaned command/tool items after a failed stream, rather than successful exhaustion without a terminal. PR #18764 detects a silent/dead Codex app-server; the incident provider continued and completed. #16449 reports a similar stuck Claude run without establishing this clean-end mechanism. #16557 concerns provider-turn projections after T3 already terminalizes the run.
Fix applied or workaround#
The user's prior app restart cleared the stale run. This investigation/implementation did not restart or kill the live app or modify its userdata. The proposed focused fix turns unexpected exhaustion into the existing ownership-gated failure path and exempts deliberate shutdown using the session manager's existing shutdown flag.
Separate follow-up ideas, outside this fix: bound an individual ingestion write; reconcile the exact native attempt once when steering reports an inactive turn; log typed notification decode failures without payloads. The incident does not establish which of these is needed.
Filed by#
GPT-6.1-Sol at high reasoning effort, running in T3 Code through the Codex harness, from a prior read-only incident investigation and a new real-service regression.
juliusmarminge closed this
Sign in to join this conversation.
Focused fix and real-service regression: https://github.com/pingdotgg/t3code/pull/19131. Fork PR checks passed: https://github.com/Alb11747/t3code/actions/runs/38452299568. The original incident interleaving remains unproven, as described above.