Skip to content

[Bug]: Answering an async question after a queued message runs hides the answer from the timeline #15873

Open

Description

@MatthewFeroz

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/web

Steps to reproduce

  1. Start a turn where the agent asks an async question, such as a Codex ask_user-style question whose responseCapability is { type: "message" }. The run keeps working after it asks.
  2. While that run (run N) is still going, queue a follow-up message. It becomes run N+1.
  3. Let run N finish. The queued run N+1 starts and completes.
  4. Now answer the question from step 1. The server dispatches the answer as a user message async-answer:<requestId>, which starts run N+2.

Expected behavior

The answer shows up in the timeline where the conversation continues, right before run N+2's reply, the same way any message you send does.

Actual behavior

The answer never appears at the bottom of the thread. Run N+2's reply follows run N+1 with no user message in between, so it looks like the input was lost. The answer only shows up on run N's question card, which is above the queued message and usually scrolled out of view.

In the screenshot, I answered "For Pi doesnt pi just work with a chatgpt subscription now" after the queued message ran. Nothing appears between "Tell me once it's saved…" and "I'll check Pi's current ChatGPT login support…", which is the reply to that answer.

Nothing is lost on the server. The message is persisted and the agent receives it. This is only a timeline rendering problem.

Cause

apps/web/src/session-logic.ts (around line 591) builds foldedAnswerMessageIds from every user_input_request that has a questionAnswer, then drops the matching async-answer:* user messages from the timeline. The fold assumes the answer arrives while the asking run is still active, so the card and the agent's response sit next to each other. A late answer starts a new run, but it's still drawn on the old run's card. Anything that runs in between, such as a queued message, pushes the answer out of order and out of view.

Projection data from the affected thread:

Ordinal Run Item
8000070 8 user_input_request, with questionAnswer.answers containing the user's reply
9000001 9 queued user message
10000001 10 user_message async-answer:…, hidden by the fold

Suggested fix

Only fold an async-answer:* message into its question card when the message is in the same run as the question. When it's in a later run, render it as a normal user message at its own position. The incremental path's check around session-logic.ts:893 needs to match.

Impact

Major degradation or frequent failure

Version or commit

main @ de09c75

Environment

macOS, T3 Code desktop, Codex (gpt-6.1-sol)

Screenshots, recordings, or supporting files

Answer missing from the timeline after a queued message

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions