Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat(codex): support async questions #9512

Mergedt3dotgg(GitHub profile, opens in a new tab)merged 2 commits intomain fromrefs/pull/9512/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHub

Codex's new request_user_input_async tool sends questions in agentMessage notifications, not item/tool/requestUserInput requests. T3 dropped the question metadata and could not show an answer form.

Preserve that metadata and use the existing web, desktop, and mobile question panels. Answers go through the normal user-message path while Codex keeps working, or resume the session after it finishes. Pending questions survive reconnects and long runs. Duplicate replies are rejected.

The Codex handler and installed 0.153.0 schema confirm the format. The older blocking request path is unchanged.

Verification

  • 334 focused tests pass, including ongoing streaming, database reopen, duplicate replies, and retention after 500 later events.
  • Scoped server, protocol, web, and mobile typechecks pass.
  • Scoped lint passes with existing warnings in protocol schema tests.
  • Theo tested async questions in the shared local build and confirmed they work. The screenshot below shows a question while Codex continues working.

Screenshot

Async question shown while Codex continues working

Created with GPT-6 Astra (preview) in Codex.


Note

Medium Risk Touches orchestration command handling, turn-pause/streaming semantics, and activity retention; behavior is heavily tested but mistakes could break async replies or duplicate-answer guards.

Overview Adds end-to-end support for Codex async user questions (request_user_input_async): completed agentMessage items with delivery: "async" are mapped to user-input.requested events carrying responseMode: "message", so web, desktop, and mobile can show the existing question UI without blocking the turn.

Orchestration behavior changes for that mode: ingestion no longer pauses the turn on user-input.requested, assistant streaming can continue, and thread.user-input.respond resolves the request by appending user-input.resolved, sending a formatted user message, and starting/resuming a turn (with validation for incomplete answers and duplicate replies). The engine loads the latest request/resolution via new getUserInputActivity before deciding, so replies still work when command snapshots omit or cap activities; the projector retains unresolved message-mode requests past the usual 500-activity window.

Clients now keep questions with no options when custom answers are allowed (including free-text-only async prompts). Contracts and Codex protocol schemas gain responseMode and async questions/delivery fields on agentMessage items.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 44eae6a50342d4d9104703eb4bb8a499b862edb3. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Add async question support for Codex provider across adapter, orchestration, and schemas

  • CodexAdapter.mapToRuntimeEvents now emits user-input.requested events (with responseMode: "message") for completed async agent messages containing questions, instead of normal item lifecycle handling
  • ProviderRuntimeIngestion skips the pause-and-flush path for message-mode user-input.requested events so subsequent assistant text continues streaming in the same turn
  • decideOrchestrationCommand in decider.ts validates message-mode answers (non-empty, not duplicate, not already resolved), appends user-input.resolved, and starts a new user turn
  • ProjectionSnapshotQuery.getUserInputActivity in ProjectionSnapshotQuery.ts queries SQLite for the latest requested/resolved user-input activity by thread and request ID, so orchestration can resolve requests even after they fall outside the capped in-memory read model
  • retainThreadActivities in projector.ts preserves unresolved message-mode questions beyond the 500-activity window; resolved requests are dropped from the pending set
  • Schema generation in generate.ts augments agentMessage schemas with optional nullable delivery and questions fields
  • Web and mobile parsers in session-logic.ts and threadActivity.ts now retain optionless questions unless allowCustomAnswer is explicitly false
  • Risk: ProjectionSnapshotQueryShape now requires getUserInputActivity; all in-tree test doubles are updated but out-of-tree implementations of this interface must add the method. UserInputQuestionOption.description in providerRuntime.ts now accepts empty strings.
Macroscope summarized 44eae6a.
    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    2. Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

      Fix All in Cursor ❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the [Cursor dashboard](https://www.cursor.com/dashboard/bugbot). Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 375ba22cc0c10d38e751a596089a2599bd257369. Configure [here](https://www.cursor.com/dashboard/bugbot).
    3. 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.7 KiB13.7 KiB−2 B (−0.0%)15.1 KiB✅
      CodexThread snapshot wire7.0 KiB7.0 KiB−9 B (−0.1%)7.3 KiB✅
      CodexLive turn WebSocket wire6.7 KiB6.7 KiB+7 B (+0.1%)7.8 KiB✅
      CodexLive turn WebSocket decoded58.5 KiB58.5 KiB0 B (0.0%)66.4 KiB✅
      CodexLive turn messages10100 (0.0%)21✅
      ClaudeTotal thread wire13.4 KiB13.6 KiB+153 B (+1.1%)15.1 KiB✅
      ClaudeThread snapshot wire7.0 KiB7.0 KiB+3 B (+0.0%)7.3 KiB✅
      ClaudeLive turn WebSocket wire6.4 KiB6.6 KiB+150 B (+2.3%)7.8 KiB✅
      ClaudeLive turn WebSocket decoded57.0 KiB57.9 KiB+928 B (+1.6%)66.4 KiB✅
      ClaudeLive turn messages810+2 (+25.0%)21✅

      Baseline: e3723e0 · PR result: 44eae6a · 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.

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

      Approvability

      Verdict: Not approved

      Macroscope's review found this PR not approvable — This change adds a new Codex async-question workflow across protocol handling, orchestration, persistence, streaming, retention, and web/mobile clients. It also adds a static-analysis diagnostic suppression in a test file, while the runtime changes to active turns and durable pending-question state merit focused human review.

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

Sign in to join this conversation.