Skip to content

server: model step hangs with no timeout, session stays busy until interrupted #53747

Open

Description

@vedprakash2302

Summary

A session's model step can stall indefinitely: the provider stream stops producing anything, but the step never times out, errors or retries. The session stays busy with no progress until it's interrupted by hand. Anything left running unattended stops silently, and a parent session waiting on a stalled subagent waits forever.

Environment

  • opencode version: 2.0.23
  • OS: Linux x86_64
  • Terminal: not relevant; sessions run under opencode serve and are driven through the HTTP API
  • Shell: not relevant
  • Install/channel: latest
  • Active plugins: none
  • Provider and model where it happened: github-copilot with claude-opus-5.5 (variant high)

Reproduction

It's intermittent, but frequent under steady load:

  1. Run opencode serve and start a session on the provider and model above.
  2. Give it a long task that delegates to background subagents (the subagent tool with background: true), each making many tool calls.
  3. Leave it running unattended for an hour or more.

Expected Behavior

A step whose stream produces nothing for a configurable time gets retried, or fails with an error that the session and its parent can see, the same way provider errors already surface. A parent waiting on a subagent learns that the subagent failed.

Actual Behavior

  • The last assistant message stays open: time.completed is unset, and the last part is a reasoning or text part, or a tool part still marked running or streaming although its command finished long before.
  • No new step starts, and nothing more is logged for the session.
  • It stays that way until POST /api/session/:id/interrupt, which records {"type":"aborted","message":"Step interrupted"}. A follow-up prompt then continues normally.
  • Over three days of use: 34 interrupted steps across 18 sessions. Ten had stalled for 20 minutes or more, five for over an hour, and the longest for almost four hours.
  • A stalled background subagent leaves its parent session waiting indefinitely.

Additional Context

  • Possibly related. On the same provider and model, a few steps failed outright with Session.StepFailedError: Provider blocked the response (reasoning_extraction). Those surface as errors, so they're less harmful than the silent stalls.
  • After a server restart. Sessions that had been mid-step kept showing tool parts as running. They didn't resume, and they couldn't be told apart from live work through the API.
  • Workaround. An external script polls GET /api/session and GET /api/session/:id/message?limit=1. When a step has made no progress for 25 minutes, it calls /interrupt and then /prompt with a short "continue" message. This works, but it shouldn't be needed.
  • Suggestion. Add a per-step inactivity timeout, measured from the last stream event and configurable globally and per provider, that retries once and then fails the step visibly. On startup, mark steps left open by a previous server process as interrupted.

Activity

  1. github-actions commented on Oct 7, 2026

    @github-actions
    Contributor

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

    • #51291: provider stream disappears and leaves a tool call permanently running without a timeout or reaper.
    • #53083: provider stream dies mid-run, leaving an API-driven session hung with no error.
    • #48675: zero-chunk provider stream stalls without timeout, retry, or surfaced failure.
    • #46461: a stalled subagent has no timeout and can leave its parent waiting indefinitely.
  2. opencode-agent commented on Oct 7, 2026

    @opencode-agent
    Contributor

    Thanks for the detailed report. I can reproduce a step that never ends on 2.0.23, using a simulated provider since I don't have a Copilot account.

    What I tried:

    • Fully silent stream: a local OpenAI-compatible server sends one text delta and then nothing. The step fails with Timed out waiting for response data once chunkTimeout passes (5 minutes by default) and is retried. Silent streams are already bounded.
    • Stream kept alive with SSE comments: after the delta, the server sends only : keepalive comment lines. The step never times out, even with chunkTimeout: 15000. After 2 minutes the session was still running, the last assistant message was still open (no time.completed), nothing more was logged, and there was no retry. POST /api/session/:id/interrupt recorded the interruption and the session went idle, which matches what you describe.

    So the chunk timeout currently treats SSE keepalive comments as progress (also reported in #43519). I haven't confirmed that the github-copilot endpoint sends keepalives during your stalls. I also haven't tested the other parts of your report yet: tool parts left running, the parent not hearing about a stalled subagent, and steps left open after a restart.

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