Skip to content

Agent stalls during long thinking blocks and plan→build mode transitions #25094

Closed

Description

@zj247647898

Description

During an extended interactive coding session (red-blue adversarial review with large file writes ~300 lines), two distinct stalls occurred where the agent appeared frozen with no user-visible output:

Stall 1: plan → build mode transition

  • The session was in plan (read-only) mode reviewing a 353-line markdown file
  • User prompted to continue → system transitioned from plan → build mode
  • Agent entered an internal reasoning block (<thinking>) but output zero visible content for an extended period
  • The TUI showed no indication that processing was ongoing — appeared completely frozen
  • User had to prompt "??????" twice to get a response

Stall 2: Long thinking block with no streaming

  • Agent was verifying claims against source code (multiple parallel tool calls)
  • After tool results returned, agent entered a long reasoning block synthesizing ~9 complex findings
  • Again, zero visible output — TUI appeared hung
  • User eventually got a response after the thinking block completed

Environment

  • OS: Linux
  • Shell: bash
  • Model: deepseek-v4-pro (via API, thinking mode enabled)
  • TUI mode: terminal CLI

Likely causes

  1. Thinking blocks produce no streaming output — When the model enters an extended <thinking> phase (30+ seconds), the TUI shows no progress indicator, spinner, or "thinking…" message. Users cannot distinguish between "model is thinking" and "process is hung."

  2. Mode transitions may drop the render loop — The plan → build transition involved a system reminder injection mid-response, which appeared to coincide with the stall.

  3. Related to existing issues: This may overlap with:

Suggested fix

  • Show a visible "thinking…" indicator during reasoning blocks longer than 5 seconds
  • Add a recovery timeout — if no streaming tokens for >60 seconds, surface a warning to user
  • Ensure mode transitions (plan↔build) don't interrupt the render loop

Session details

  • Task: Blue team defense responding to red team prompt audit (9 vulnerabilities, 2 rounds, ~600 lines of analysis)
  • Files created: docs/blue-team-prompt-round1.md (~280 lines), docs/blue-team-prompt-round2.md (~350 lines)
  • Total tool calls: ~20 across both rounds
  • Both stalls occurred at synthesis/thinking phases, not during tool execution

Activity

  1. added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Apr 30, 2026
  2. github-actions commented on Apr 30, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    If this is distinct (e.g., specifically triggered by thinking blocks or plan→build mode transitions rather than tool-call loops), please clarify the differences so this can be tracked separately.

  3. zj247647898 commented on Apr 30, 2026

    @zj247647898
    Author

    Thanks for the quick triage. This is distinct from the referenced issues in a few ways:

    Distinction from #13841: #13841 describes a stall after tool calls complete (tool-call loop hang). This issue is about stalls before tool calls start — specifically during the model's internal <thinking> reasoning phase. In both stalls, tool calls had already completed and the model was synthesizing output. The spinner was not animating at all (TUI appeared frozen, not just the spinner marker spinning).

    Distinction from #18723: #18723 is about the UI freezing generally. This issue specifically identifies the trigger: mode transitions (plan → build with system reminder injection) and extended thinking blocks (30+ seconds) without any streaming output reaching the TUI.

    Specific triggers observed in the session:

    1. plan → build transition coinciding with a mid-response system reminder — the mode switch interrupted what would normally be a streaming continuation
    2. Extended reasoning synthesis (~9 source code findings) where the model produced a long <thinking> block with zero output tokens reaching the TUI for 30+ seconds

    To reproduce: Use deepseek-v4-pro (or any model with thinking/reasoning enabled) on a complex multi-file task. Trigger a plan→build transition by asking to continue after a long plan-mode analysis. The stall occurs between tool call result delivery and the next user-visible output.

  4. removed
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on May 3, 2026
  5. skywalker-35 commented on May 9, 2026

    @skywalker-35

    Can confirm this on Windows 11 + Windows Terminal, deepseek-v4-pro, v1.14.30.

    Both stall patterns reproducible:

    1. plan→build transitions — TUI goes completely silent, no indicator, have to spam input to verify it's alive
    2. Long thinking blocks — after tool results return, agent enters extended reasoning with zero streaming output. Impossible to distinguish "model is thinking" from "process is hung"

    The suggested fix (thinking indicator + 60s timeout warning) would dramatically improve the experience. Even a simple spinner or elapsed-time counter during silent reasoning would help.

  6. PierrunoYT commented on May 12, 2026

    @PierrunoYT

    I'm experiencing the same issue on Windows (PowerShell). Claude Sonnet 4.6 with medium thinking enabled is essentially unusable in OpenCode — the model gets stuck planning in the thinking trace and never executes the actual tool calls.

  7. simonklee commented on Jun 24, 2026

    @simonklee
    Member

    Thanks for the report. I can not reproduce this on the current dev revision (OpenCode 1.17.9).

    We tested an existing session after each of these changes:

    • Build to Plan
    • Default variant to another variant
    • One model to another model

    In every case, Enter submitted the text successfully using the newly selected agent/model/variant.

    OpenCode 1.15.10 also silently ignored prompt submission errors while clearing the input. Newer versions display a Failed to send prompt error instead, so the original behavior may have been a rejected request rather than Enter being swallowed.

    Could you retest with OpenCode 1.17.9 or newer and re-open if issue still persists?

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

Metadata

Metadata

Assignees

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