Skip to content

A10 (P0): Stop just after the agent asked hides the question and leaves the Chat waiting for nothing #257

Open

Description

@SitgesRun

Monkey test 2026-11-15, finding A10 (P0). A fix was merged in #255 and withdrawn before the release by #256. Parked until after the release.

Symptom

  1. A turn runs (window mt1115-win, turn turn_3bdf2aa1…_173); a second message is queued behind it.
  2. The person presses Stop.
  3. The Chat shows only "Finished thinking". The agent's question ("The drawing tool rejects señora-müller-coach… May I … recreate the character … under a tool-compatible ID?") is not shown.
  4. The status bar says "1 waiting for you".
  5. Send/Enter seem to do nothing. Only Reload Window shows the question, and the queued message is then gone.

Root cause (pine-dev gateway log + Studio log; the clocks agree within 15 ms)

UTC what
10:13:51.420 GET agent/turns/…_173 returns after 9375 ms (under the 10 s long poll): Pine ended the turn needs_input
10:13:52.354 the person's Stop, 0.93 s later. The Studio records a turn's end only after the grace, the event drain and the collection, so it still records running, and cancelTurn sends a cancel
10:13:53.294 POST agent/cancel 202. The turn is needs_input, so Pine's CancelTurn closes the question (broker.go cancelQuestion, which appends a terminal result "question canceled")
10:13:53.887 the follower records needs_input from the read it took before the cancel (composeTurnEnding)
  1. Two writers, and the stale one wins. The follower records the ending from an earlier read, and nothing records what the Stop's cancel did. The Studio says "waiting for you"; Pine has nothing waiting.
  2. The question is never shown (Code-OSS, by design). A cancelled request drops all later progress (chatServiceImpl.ts progressCallback, token.isCancellationRequested), and the extension API cannot push new history into an open session. Reload re-provides it.
  3. Send "does nothing" (inferred, not observed).
    • After a cancelled request, Code-OSS keeps the queue and does not run it (shouldProcessPending = … && !token.isCancellationRequested).
    • A plain Send with a queued request awaits "You already have pending requests: Keep / Remove". It is a native macOS sheet (window.dialogStyle: native), which the CDP-driven monkey test neither saw nor answered.
  4. The queue is lost on Reload (Code-OSS): Code-OSS (upstream): a contributed session's queued messages are dropped on Reload Window #253.

Plan after the release: one writer, as Claude Agent SDK and codex-rs do it

Precedents:

  • codex-rs: an interrupt and a turn's end are decided at one point, and the turn's own path emits its one terminal event (TurnAborted / TurnComplete, core/src/tasks/mod.rs).
  • codex-rs app-server: sets the status once, from that event.
  • Claude Agent SDK: the interrupted turn's result arrives in the ordered stream (interrupt(), SDKControlInterruptResponse).

Sketch, no sequence compare:

  • Stop only sends the cancel. It records nothing.
  • The follower is the one writer of a turn's ending, from Pine's ordered events. Pine's log carries every terminal transition of a turn:
    • the run's terminal result;
    • then, if a cancel closes the question, a second terminal result "question canceled" (broker.go cancelQuestion).
  • Following does not end at needs_input. It ends when the question is answered (the next turn) or a later terminal result for the turn arrives. As codex-rs treats a turn waiting for approval, the question is part of the turn until settled.
  • What it needs:
    • PineEvent for result keeps the terminal state and reason (today sdkPort.ts maps only the summary text);
    • the follower keeps the event stream open past the grace while a question waits;
    • followPineTurn follows a Chat recorded needs_input;
    • tendIdle stays where the follower writes.
  • Open questions:
    • How a long-waiting question's stream is held across reconnects and reloads (the existing reconnect loop and the start's resume).
    • Whether Stop on a recorded question (it closes it, Pine's contract) is wanted, or is a no-op as codex-rs app-server's "no active turn to interrupt".

Workaround until then

Related

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