Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): dismiss native questions when their turn ends #9851

Mergedjuliusmarmingemerged 4 commits intomain fromrefs/pull/9851/headmerged by juliusmarminge View on GitHub

juliusmarmingecommented

Stopping a Codex turn can leave its two-question form pending even after the server receives an interrupted terminal notification. The session becomes ready, but clients still see the unanswered request and keep the composer blocked.

Ingestion now records an existing user-input.resolved activity for each still-open native callback request belonging to the terminal turn. Already answered requests, newer and child turns, and asynchronous message-mode questions are preserved. The lookup reuses the filtered user-input lifecycle query. No provider response, fabricated answer, schema, or client-specific behavior is added.

Fixes #7820.

Verification

  • Reproduced on b6f72681, committed September 5, 2026 at 00:36:28 UTC. The actual SQLite orchestration engine processed the interrupt command and terminal receipt, but the persisted shell still reported pending input.
  • An owned JSON-RPC subprocess exercised the real Codex runtime and adapter. Interrupt acknowledgment followed by an interrupted turn/completed notification produced no input-resolution event; normal answering did. No provider account or quota was used.
  • Before/after fixtures ran the actual web pending-question selector over the persisted projection. The stopped request now disappears. A delayed old-turn completion leaves the new-turn and message-mode requests pending.
  • 250 focused tests passed across server ingestion, web session logic and native activity parsing. New regression cases cover completed, interrupted, failed and aborted turns, duplicate terminal receipts, normal answers, newer turns, child turns and message-mode questions. A request already dismissed by a stale-response failure stays dismissed when a terminal resolution is recorded; the new code does not classify errors by prose or add a new error contract.
  • Server typecheck and targeted lint passed. No browser, WSL or native-device verification is claimed by these fixtures.

This is a server event-lifecycle repair with no visual component changes. The before/after evidence exercises the actual client selector against the persisted projection. The native Codex request handler can remain awaiting its deferred answer until session close; changing that protocol lifecycle is outside this repair.

Refreshed onto main ce4712d5, which includes the upstream Ubuntu HTTP-to-HTTPS mirror repair. All 250 focused tests, server typecheck, targeted lint and formatting passed again. All executed CI jobs, Bugbot and Effect Service Conventions pass at e2cd2dd8. Approvability and correctness checks skipped the unchanged patch; the approval applies to this head and no review threads remain open. The prior head's infrastructure failure is cleared by this successful new-head run. The prose-classification finding remains fixed. No independent workflow change or check bypass was made.

GPT 6 Astra via Codex in T3 Code.


Note

Medium Risk Changes orchestration turn-completion behavior for user-input lifecycle; incorrect filtering could dismiss live prompts or leave stale ones pending, but scope is limited to terminal turns and existing activity kinds.

Overview When a provider turn ends (completed, interrupted, failed, or aborted), provider runtime ingestion now clears native callback user-input prompts that would otherwise stay pending and block the composer.

On terminal turn handling, ingestion loads user-input lifecycle activities, finds open user-input.requested entries for that turn (excluding message-mode async questions), and dispatches user-input.resolved activities labeled “User input dismissed” for each. Already-answered requests, other turns, and message-mode prompts are left alone. ProjectionThreadActivityRepository is wired into the ingestion layer for this lookup.

Tests add readThreadShell / userInputEvent helpers and regression coverage for terminal states, duplicate terminal receipts, stale dismissals, and mixed pending scenarios.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit e2cd2dd8668e84da6c279b332338090a1e51b185. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).
    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    2. github-actions[bot](GitHub profile, opens in a new tab)commented

      Thread transfer impact

      ✅ Thread transfer remains within every enforced ceiling.

      ProviderMetricMain baselineThis PRImpactPR ceiling
      CodexTotal thread wire13.5 KiB13.5 KiB−11 B (−0.1%)15.1 KiB✅
      CodexThread snapshot wire7.0 KiB7.0 KiB−2 B (−0.0%)7.3 KiB✅
      CodexLive turn WebSocket wire6.5 KiB6.5 KiB−9 B (−0.1%)7.8 KiB✅
      CodexLive turn WebSocket decoded57.0 KiB57.0 KiB0 B (0.0%)66.4 KiB✅
      CodexLive turn messages880 (0.0%)21✅
      ClaudeTotal thread wire13.8 KiB13.5 KiB−226 B (−1.6%)15.1 KiB✅
      ClaudeThread snapshot wire7.0 KiB7.0 KiB+4 B (+0.1%)7.3 KiB✅
      ClaudeLive turn WebSocket wire6.7 KiB6.5 KiB−230 B (−3.3%)7.8 KiB✅
      ClaudeLive turn WebSocket decoded59.3 KiB57.8 KiB−1.5 KiB (−2.5%)66.4 KiB✅
      ClaudeLive turn messages108−2 (−20.0%)21✅

      Baseline: ce4712d · PR result: e2cd2dd · Source CI: success

      Scenario and decoded snapshot size

      10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

      • Codex decoded thread snapshot: 113.8 KiB
      • Claude decoded thread snapshot: 114.5 KiB

      Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Approved at 6208662

      Macroscope's review found this PR approvable — This is a narrow server lifecycle repair that dismisses only unresolved native questions belonging to a terminal turn, while preserving answered, newer, child-turn, and message-mode requests. The production change is small, uses existing persistence infrastructure, and is accompanied by focused regression coverage.

      No code changes detected at e2cd2dd. Prior analysis still applies.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. juliusmarminge reviewed

      Root merge judgment at e2cd2dd8: reviewed the complete two-file diff and receipt-backed before/after evidence. Exact-turn native callback cleanup uses the existing activity contract and preserves newer, child-turn and message-mode requests. The reported new prose classification was removed; the separately identified baseline code is unchanged here. Current-head CI and reviews pass with no unresolved thread. This narrow repair is within the authorized bug-fix scope. GPT 6 Astra via Codex in T3 Code.

    5. juliusmarminge merged thisd7fe47f

    6. juliusmarminge closed this

Sign in to join this conversation.