Skip to content

Codex thread shows idle (no spinner) while actively running commands #1646

Open

Description

@benegessarit

bb version: 0.38.0 (macOS, Darwin 25.4.0)
Provider: codex · model gpt-5.6-sol · reasoning max · permission mode auto
Thread: thr_c3thbxs7sp (task-plugin thread, personal workspace env_evew84hhic, local machine)
Date observed: 2026-08-14, ~22:11–22:19 PDT (epoch ms receipts below)

Summary

A long-running Codex thread emitted turn/completed, and bb flipped the thread to idle — but the Codex session immediately continued working (reasoning, commandExecution, fileChange, agent messages). bb never registered a new turn/started for the continuation, so for ~4.4 minutes the thread executed dozens of commands while bb thread list --json reported status: idle, runtime.displayStatus: idle, and every activity counter at 0. The app sidebar faithfully rendered that state: no spinner, no unread dot. The user watched commands executing live in a thread the UI said was idle.

It happened twice within 10 minutes in the same thread:

  1. 22:11:19 → 22:13:59 — turn/completed, work resumes 12 s later (including a contextCompaction item), turn/started finally arrives 2.5 min late, mid-work.
  2. 22:14:36 → 22:19:02 — turn/completed, work resumes 12 s later, no turn/started ever arrives. The closing turn/completed at 22:19:02 has no matching turn/started (invariant violation).

Impact

  • The sidebar spinner and unread dot are the user's only signal of which agents are working. During these windows both are absent, so a running thread is indistinguishable from a finished one. (The unread dot from the phantom 22:14:36 turn-end was cleared when the user opened the thread at 22:15:51; the continuing work raised no new attention until 22:19:02.)
  • Worse than cosmetic: bb thread wait <id> defaults to --status idle, so any orchestration waiting on this thread would have returned ~4.4 minutes early, while the agent was still mutating the workspace.
  • The window is not small in practice: this thread's user prompt at 22:01:39 ("continue") legitimately spanned multiple provider turns; long Codex tasks with auto-compaction seem to hit this boundary routinely.

Timeline (from bb thread log thr_c3thbxs7sp --json)

One user message in this whole period — client/turn/requested at 22:01:39 (seq 361650). Everything after is provider-side continuation of that one request.

22:01:39  seq 361650  client/turn/requested   ("continue" — last user input)
22:01:42  seq 361654  turn/started
22:08:12  seq 363087  turn/started            (provider-initiated; no client request — mapping works here)
22:11:19  seq 364598  turn/completed          ‚Üí thread idle
  22:11:31–22:13:59   32 item/started while idle: reasoning, agentMessage,
                      fileChange, contextCompaction (22:11:51, seq 364689),
                      commandExecution `pwd && bb status && git status …` (22:12:58)
22:13:59  seq 365342  turn/started            (arrives 2.5 min into the already-running work)
22:14:36  seq 366019  turn/completed  {"status":"completed"}   ‚Üí thread idle
  22:14:48–22:19:02   1,781 events while idle, including 78 item/started:
                      reasoning, agentMessage, fileChange, imageView, and
                      commandExecutions — sqlite3, shasum, `npm test`,
                      `rtk npm run typecheck`, `node --check …`, bb CLI calls
22:19:02  seq 368025  turn/completed  {"status":"completed"}   ‚Üê NO matching turn/started

Epoch receipts: turn/completed seq 366019 at 1786770876511; final turn/completed seq 368025 at ~1786771142900; user lastReadAt 1786770951974 (22:15:51).

Independent confirmation the daemon believed idle mid-work

At ~22:17:30 PDT — squarely inside the second gap, while the event log shows commands executing — a live probe returned:

$ bb thread list --json   # thr_c3thbxs7sp
status: idle
runtime.displayStatus: idle
hasPendingInteraction: false
activity: { activeBackgroundAgentCount: 0, activeBackgroundCommandCount: 0, ... }
latestAttentionAt: 22:14:36   lastReadAt: 22:15:51

So this is daemon-side state, not a rendering issue — the app drew exactly what the daemon reported. Two other Codex threads (thr_uagitutd23, thr_uxwqqjpgug) were active with spinners at the same moment, so ordinary turn tracking works; the bug is specific to these provider-initiated continuation boundaries.

Possibly relevant

  • The idle-gap event stream contains 709 hook/started + 709 hook/completed codex notifications surfacing as provider/unhandled (this codex config runs many hooks). The late turn/started at 22:13:59 (seq 365342) arrived interleaved among hook/started/hook/completed events in the same millisecond ‚Äî if the adapter derives turn boundaries near hook traffic, that interleaving may be involved.
  • The first gap contains a contextCompaction item (seq 364689) ‚Äî the continuations look like Codex's auto-compaction/auto-continue behavior inside one logical user turn.

Repro sketch

  1. Spawn a Codex thread (reasoning high/max) on a long task so context auto-compaction occurs mid-task; let it run unattended.
  2. Poll bb thread list --json (or watch the sidebar) around the compaction window.
  3. Observe status: idle while bb thread log <id> shows item/started commandExecution events continuing after the last turn/completed; observe a later turn/completed with no matching turn/started.

Suggested fix directions

  • Treat provider item activity (item/started, deltas) on an idle thread as evidence of an active turn: synthesize turn/started (or flip displayStatus) when items stream with no open turn.
  • Map whatever Codex notification accompanies post-compaction auto-continuation to turn/started (the adapter clearly can register provider-initiated starts ‚Äî 22:08:12 and 22:13:59 did).
  • Add an invariant check/telemetry: turn/completed with no open turn = adapter bug; would have caught both instances here.
  • Consider making bb thread wait --status idle resistant to this (e.g., require N seconds of event-stream quiescence, not just status).

Re-derive everything on this machine

bb thread log thr_c3thbxs7sp --json --limit 1000000   # full event stream (≈277k events)
# turn lifecycle only:
... | python3 -c "…filter types turn/*, client/turn/requested…"

(Reported by David Beyer; investigation transcript available on request.)

Activity

  1. added theissue type on Aug 17, 2026
  2. added
    providers
    provider-codex
    on Aug 18, 2026
  3. SawyerHood commented on Aug 18, 2026

    @SawyerHood
    Collaborator

    Reproduction & root-cause report: https://get-bb.github.io/reports/issues/1646.html

    • Verdict: REPRODUCED · root-cause confidence: high
    • Root cause (short): Server (and daemon) derive thread activity solely from root turn/started + turn/completed; root work (item/started etc.) that a provider streams afterwards under an already-started turn id passes the stored-turn/started guard and is persisted, but never flips the thread back to active — and since Agent providers as a first-class plugin surface (provider bridge protocol) #1640 the daemon grammar silently drops the provider's second turn/completed for that turn.
    • Linked PR review: Reactivate threads when a provider resumes work on a completed turn #1697 → REQUEST CHANGES — Relies on a second turn/completed for the same turn to settle the reactivated thread, but on current main (since Agent providers as a first-class plugin surface (provider bridge protocol) #1640) the daemon's ThreadEventGrammar drops that duplicate completion (turn/settles-once) silently — verified live on pr-1697 merged onto 16ceb3a: thread reactivates (spinner returns)
    • Proposed fix: Server: on a root item/started for a completed turn (idle thread, no stop since that turn's request, no newer root turn started) apply run.started, and settle back to idle when the reopened work itself settles (last open root item on that turn completes) rather than depending on a duplicate turn/completed. Daemon: let ThreadEventGrammar accept a re-completion of a turn that root work reopened (move it back to startedTurnIds) and log grammar drops at warn level instead of discarding onStderr; reopen RuntimeTurnState's active turn on such work so thread/stop sends turn/interrupt instead of relea…
    • Caveats: The provider-side trigger (why Codex emits root work under a turn id it already completed) is unverified: real Codex 0.147.0 on a trivial prompt showed no such continuation, and Codex main source runs Stop hooks and mid-turn compaction before TurnComplete while mailbox continuations open new turn ids; reporter's Codex version/hooks and raw event log would settle it. Bug reproduced end to end using…

    The report has copy-paste repro steps, screenshots where the bug is visual, code permalinks at 16ceb3a54, and repro artifacts. It was independently re-run by a second agent (see its Verification section).

    AGENT GENERATED: by Claude Opus 5

  4. added
    confirmed-repro
    on Aug 18, 2026
  5. added 2 commits that reference this issue on Aug 21, 2026
    13e96c4
    80e17f8
  6. self-assigned this
    on Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

confirmed-reproprovider-codexproviders

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions