anomalyco / anomalyco/opencode

Tool execution aborted/terminated — opencode closes chat without waiting for LLM response

Open
#38,819 2 comments 0 reactions 1 assignee View on GitHub

@jlongster is already working on this.

Since Jul 25, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

Environment:

  • OpenCode v1.18.5 (native binary)
  • Provider: LM Studio (@ai-sdk/openai-compatible)
  • Model: agents-a1-apex (also reproduced with qwen3.6-35b-a3b)
  • OS: Windows

Description: During tool execution with local models, opencode closes the chat session without waiting for the LLM to respond. The assistant message is created but never completed — the user sees "Tool execution aborted/terminated" with UnknownError: terminated. Manual "Continue" or starting a new session is required.

Concrete example from production (session ses_12b1b8c0effeS5yD1QNJsmy6IW, project Ritm):

Event | Time -- | -- User sent message "проведи проверку готовности к выполнению плана" | 2026-07-25 07:17:12 Assistant starts responding (LM Studio, agents-a1-apex, build agent) | 2026-07-25 07:17:12 Error: UnknownError / "terminated" — 0 tokens used | 2026-07-25 07:22:48

Duration before abort: ~335 seconds (5.6 min). The assistant message was created but never produced any output — the LLM call was terminated before it could respond.

Root cause (from source code analysis):

  • llm.ts — AbortController created inside Stream.scopedctrl.abort() fires when the stream scope closes
  • processor.ts — cleanup() waits only 250ms for pending tools, then marks them as "Tool execution aborted"
  • The fix (PR #34952 by @Mte90) was to emit turn.idle only when both active and ctrl are undefined

Fix status: PR #34952 was closed on Jul 22, 2026 without merge — the author deleted his branch, no reviews received, commits are inaccessible. No release up to v1.18.5 includes the fix.

Plugins

No response

OpenCode version

v1.18.5

Steps to reproduce

Reproduction:

Run opencode with LM Studio and any local model
Give a task requiring tool calls
After 2–3 tool executions, the agent does not receive the LLM response
opencode closes the chat with "Tool execution aborted/terminated"
Only workaround: click "Continue" manually or restart the session
Expected behavior: Tool execution should complete without interruption when using local models. The chat must remain open and wait for the LLM response.

Screenshot and/or share link
Image
Operating System

OS: Windows

Terminal

OpenCode v1.18.5 (native binary)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.