Skip to content
Source
Sign inSign up
pingdotgg/t3code

Interrupt timeouts report a terminal status for work that may still be running #16844

ClosedAdamulek123(GitHub profile, opens in a new tab) opened this issue 1 comment

Problem

Three adapters settle a turn as terminal even when the native run may still be alive, after a fixed timeout. The turn is reported finished or interrupted while the provider process is still working, and the app stops ingesting from it.

  • CursorAdapterV2.ts:2458-2469 — context.run.cancel is issued at 2457, then after Deferred.await(context.completed).pipe(Effect.timeoutOption("10 seconds")) the adapter calls finalizeTurn. Nothing verifies the native agent actually stopped.
  • ClaudeAdapterV2.ts:7330-7351 — the same 10s bound, then finalizeActiveTurn, plus Deferred.succeed(existing.closed, undefined). That Deferred.succeed races the real stream's own Effect.ensuring(Deferred.succeed(closed, undefined)) at 7096, so the adapter's own exit path can observe a closed query that is still streaming.
  • CodexAdapterV2.ts:1827-1838 awaitActiveTurn — a 1000-iteration Effect.yieldNow spin that returns undefined on exhaustion. Every caller then either drops the delta (2933, 3841, 4213) or calls toProtocolError (4476, 4539, 4600, 4865), which the app-server reads as a denial.

Why this is a design question, not a bug

Should a 10-second bound be allowed to lie about terminal state at all? Two defensible answers:

  1. Yes — a stuck provider must not hold the thread open forever, so time-box it and report honestly that we gave up.
  2. No — report interrupted/unknown rather than a terminal success, and keep a watchdog that escalates.

Option 1 is what the code does today. The problem is that it reports a terminal success-shaped status for work that may not have finished, and the user cannot tell the difference from a real completion.

Impact

#15197 is the user-visible symptom: a V2 Claude run stays "running" forever after the CLI reports result/success. #15542 is adjacent but a different cause (a failed commit that loses supervision, rather than a timeout that lies on purpose).

The 10s bound pattern was introduced by v1 PR #7349, which was closed unmerged.

Environment

Found by static audit of the merged orchestrator-v2 work (#2829). Re-verified present at main. #15778 already deferred the related "maintainer lifecycle decision" for approval survival and interrupt, so the routing is established.

Deliberately not filed as a PR: these are five files and four providers with genuinely different risk profiles, and the fix depends on the answer to the question above.

  1. Thanks for the audit, @Adamulek123. I checked each point against current main (30cc788975). The premise doesn't hold, so I'm closing this.

    • Cursor and Claude timeouts don't report success. After the 10-second wait, both adapters finalize the turn as interrupted, not as a success:

      • Cursor: CursorAdapterV2.ts:2464-2476 logs cursor-interrupt-timeout, then calls finalizeTurn({ context, status: "interrupted" }).
      • Claude: ClaudeAdapterV2.ts:7697-7719 logs claude-query-interrupt-timeout and drops the query context. It then calls finalizeActiveTurn({ status: "interrupted" }).

      interrupted is option 2 from your list: an honest "we stopped waiting", which the timeline shows as a stopped turn, not a completed one.

    • Codex awaitActiveTurn isn't an interrupt timeout. At CodexAdapterV2.ts:2041-2052 it only waits a few scheduler ticks for Codex's turn/started to register before routing an event that arrived first. It never settles a turn.

    • #15197 is a different cause. A Claude run that stays running after the CLI reports success lost its terminal event when it was saved. It wasn't a timeout. That's tracked in #15197 itself, with #14856 as the fix in progress.

    If you hit a turn that is shown as completed while its provider is still working, please open a new issue with the thread's provider event log (~/.t3/userdata/logs/provider/) or server.trace.ndjson around it, and we'll take it from there.

  2. juliusmarminge closed this

Sign in to join this conversation.