Skip to content

CLI: resume paints a permanent Working footer when the thread is Idle #43952

Done

Description

@nathantimothym-coder

What version of Codex CLI is running?

codex-cli 0.153.4

What subscription do you have?

Pro

Which model were you using?

GPT-5.6-Sol

What platform is your computer?

Darwin 25.6.0 arm64 arm

What terminal emulator and version are you using (if applicable)?

tmux

Codex doctor report

{
    "note": "Full report omitted because it contains organization-
    specific paths, MCP names, and endpoint-security metadata.",
    "codexVersion": "0.153.4",
    "platform": "macos-aarch64",
    "installMethod": "Homebrew",
    "authMode": "chatgpt",
    "model": "gpt-5.6-sol",
    "modelProvider": "openai",
    "terminal": "iTerm2 3.6.11 with tmux 3.6a",
    "latestVersion": "0.153.4"
  }

What issue are you seeing?

When the TUI resumes an existing app-server thread, it can display
“Working (… • esc to interrupt)” indefinitely even though the
authoritative thread status is Idle and no turn is running.

Escape does not clear it because it sends a real turn/interrupt
request, but there is no active turn to interrupt. If a genuine turn
begins later, Escape interrupts that real turn while the stale Working
footer remains.

This is a TUI rendering-state bug rather than a hung model request.

What steps can reproduce the bug?

  1. Begin a Codex turn.
  2. End the app-server uncleanly while the turn is active, leaving a
    persisted task_started without a subsequent task_complete,
    turn_aborted, or other terminal event.
  3. Restart the app-server.
  4. Attach the TUI using:
    codex --remote ws://127.0.0.1: resume
  5. Confirm that the resumed thread is Idle and has no active turn.
  6. Observe that the TUI nevertheless displays a permanent Working
    footer.
  7. Press Escape. The footer remains because no live turn exists to
    complete or interrupt.

This lifecycle signature was verified in the affected rollout.

What is the expected behavior?

The TUI should use the resumed thread’s current ThreadStatus as the
authority for its activity indicator.

A historical InProgress turn should restore the Working footer only
when the live thread is Active. If the thread is Idle, the TUI should
render idle.

Additional information

During typed turn replay,
replay_thread_turns
unconditionally calls on_task_started() for every historical
TurnStatus::InProgress:

if matches!(status, TurnStatus::InProgress) {
    // ...
    self.on_task_started();
}

However,
AppServerStartedThread
does not carry the live ThreadStatus, and
started_thread_from_resume_response
copies response.thread.turns into the TUI bootstrap state while discarding
response.thread.status.

That lets a stale historical InProgress turn activate the local Working
widget even when the authoritative resumed thread is Idle. Since no live turn
exists, no later turn-completed event is guaranteed to clear the widget.

This looks like the same invariant addressed by #11852 / #12420 ("replayed
history must not force live active state") reappearing through the newer typed
turn replay path.

Suggested fix and regression cases

Carry the live ThreadStatus through the resumed-thread bootstrap and only
restore task-running UI from historical InProgress when the live thread is
actually Active. Also reconcile a live transition to Idle by clearing stale
task-running UI when no active turn remains.

Suggested tests:

  1. ThreadStatus::Idle + historical TurnStatus::InProgress => no Working
    widget.
  2. ThreadStatus::Active + historical TurnStatus::InProgress => Working
    widget is restored.
  3. A legitimately active resumed thread receives
    ThreadStatusChanged(Idle) => Working widget clears.
  4. Resume an idle thread, then receive a real live turn/started => Working
    widget appears normally.

#40563 is useful corroboration but a different layer: it documents the
producer-side persistence contradiction where history remains inProgress
while thread/resume reports an idle, input-capable runtime. This comment is
about the consumer-side TUI behavior when it receives that contradiction.

Activity

  1. added
    bug
    on Sep 9, 2026
  2. added
    CLI
    TUI
    app-server
    on Sep 9, 2026
  3. argszero commented on Sep 9, 2026

    @argszero

    Confirmed your analysis is still accurate on current origin/main (the code has not drifted from the referenced refs). This is a real consumer-side TUI state bug, and the fix shape you describe is the right one. Verified today against origin/main (HEAD dafb6781ee):

    1. replay_thread_turns still unconditionally restores task-running UI. codex-rs/tui/src/chatwidget/replay.rs, in the matches!(status, TurnStatus::InProgress) arm, still does self.on_task_started() with no guard on the live thread's status:

    if matches!(status, TurnStatus::InProgress) {
        if delegated {
            self.remember_realtime_delegated_reasoning_turn(&turn_id);
        }
        self.warning_display_state.startup_complete = true;
        self.turn_lifecycle.last_turn_id = Some(turn_id.clone());
        self.last_non_retry_error = None;
        self.on_task_started();
    }

    2. AppServerStartedThread carries no ThreadStatus. codex-rs/tui/src/app_server_session.rs:

    pub(crate) struct AppServerStartedThread {
        pub(crate) session: ThreadSessionState,
        pub(crate) turns: Vec<Turn>,
        pub(crate) blocks_direct_input: bool,
        pub(crate) task_tools_available: bool,
    }

    3. started_thread_from_resume_response discards response.thread.status. It copies turns: response.thread.turns and drops the status that ThreadResumeResponse.thread already carries:

    Ok(AppServerStartedThread {
        session,
        turns: response.thread.turns,
        blocks_direct_input,
        task_tools_available: false,
    })

    So when a resumed thread is authoritatively Idle but its persisted history ends in a historical TurnStatus::InProgress (the stale task_started / no-terminal-event signature you describe), the replay seeds the Working widget and nothing downstream clears it, because no live turn will ever emit a terminal event.

    Fix design — I agree with your shape. Carry response.thread.status into AppServerStartedThread, and in replay_thread_turns gate the on_task_started() restore on the live thread being Active, and reconcile a live ThreadStatusChanged(Idle) by clearing the stale task-running UI. ThreadResumeResponse.thread already exposes .status, so this is a plumbing change (thread a ThreadStatus field through the bootstrap) plus a render guard + the idle-reconciliation path — self-contained and low-risk.

    Your four suggested regression cases map cleanly onto the existing turn_lifecycle/replay test harness. This is a good candidate for a focused PR. If you'd like a hand, I'm happy to take a pass at the implementation — otherwise I'll leave the design endorsement here. (For context, #40563 is indeed the same producer-side invariant and corroborates the consumer-side fix being additive, not overlapping.)

  4. nathantimothym-coder commented on Sep 9, 2026

    @nathantimothym-coder
    Author

    I'm happy to take a pass at the implementation

    Go for it!

  5. etraut-openai commented on Nov 27, 2026

    @etraut-openai
    Contributor

    Thanks for the bug report. This will be addressed in an upcoming release.

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

Metadata

Metadata

Assignees

Labels

CLITUIapp-serverbug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions