Repository navigation
Interrupted streamed apply_patch call leaves orphaned tool state and leaks internal preparation text #30653
Description
Description
While working in an interactive OpenCode TUI session, the assistant repeatedly got stuck while preparing an apply_patch call. The UI briefly leaked internal/tool-preparation text such as:
Need patch lines...~ Preparing patch...▣ Build · GPT-5.5
No actual tool execution followed. The session returned to idle / stopped progressing.
This happened during a Windows local script editing task involving PowerShell/VBS/CMD files under a path with spaces and non-ASCII characters:
C:\\Users\\<user>\\Desktop\\<local-project>\\
I checked the local OpenCode logs and database. The relevant entries show that OpenCode recorded an interrupted/orphaned apply_patch tool call before any patch input was received:
WARN ... service=session.prompt session.id=ses_17f16cb17fferKVQxLeeY3CXO3 messageID=msg_e904b15de001uKlUuk0BC1CoZK tool=apply_patch callID=call_l3e8ODy4J0Cer9xH7QSOGC22 loop exit with orphaned interrupted tool
WARN ... service=session.prompt session.id=ses_17f16cb17fferKVQxLeeY3CXO3 messageID=msg_e905063ea001iD6jKmLWAFBd0r tool=apply_patch callID=call_zZ7xhBdiIknyy835gw1xHP1v loop exit with orphaned interrupted tool
The corresponding part.data rows in opencode.db look like this:
{
"type": "tool",
"tool": "apply_patch",
"callID": "call_l3e8ODy4J0Cer9xH7QSOGC22",
"state": {
"status": "error",
"input": {},
"raw": "",
"error": "Tool execution aborted",
"metadata": { "interrupted": true }
}
}There were also upstream streaming errors around the same session:
AI_APICallError ... providerID=github-copilot modelID=gpt-5.5 ... cause.code=ECONNRESET ... url=https://api.githubcopilot.com/responses
ERROR ... stream error
ERROR ... error=The operation timed out
So this looks like a streamed tool call was interrupted before its arguments were complete, then OpenCode left an orphaned interrupted tool state and the TUI exposed internal preparation text instead of showing a clean error/retry state.
Related but not identical: #22222. That issue is about acpx/non-interactive mode on an older OpenCode version. This report is for the interactive TUI on Windows with OpenCode 1.15.13 and GitHub Copilot GPT-5.5, with concrete orphaned interrupted tool evidence.
One additional safety concern: earlier in the same work, the assistant mistakenly tried to use apply_patch to delete a large .wim file (~600 MB), which caused OpenCode to crash. It would be good if apply_patch refused large/binary files instead of trying to process them.
Plugins
Built-in GitHub Copilot provider/plugin. No MCP involved.
OpenCode version
1.15.13
Steps to reproduce
I do not have a minimal deterministic repro yet, but this happened multiple times in one real session.
Likely repro path:
- Start an interactive OpenCode TUI session on Windows.
- Use GitHub Copilot
gpt-5.5with thebuildagent. - Work on a local task that requires multi-file edits with
apply_patch. - Have the model generate a relatively large/multi-file patch.
- Interrupt the network stream, wait for a Copilot timeout, or otherwise trigger a stream interruption while the model is still producing the tool-call arguments.
- Observe that the UI may show internal preparation text and no tool actually runs.
- Check logs for
loop exit with orphaned interrupted tool. - Check
opencode.dbfor anapply_patchpart withinput:{},raw:"", andmetadata.interrupted:true.
Screenshot and/or share link
No screenshot/share link. The local logs and DB evidence above are from session ses_17f16cb17fferKVQxLeeY3CXO3.
Operating System
Windows 11 Insider / Windows NT 10.0.26200.0
Terminal
PowerShell 7 / Windows terminal environment
Activity
github-actions commentedon Jun 4, 2026
This issue might be a duplicate of existing issues. Please check:
lazyalex616 commentedon Jun 4, 2026
Thanks for the pointer. #19023 is definitely related, but I think this report adds a slightly different failure mode / symptom:
apply_patchtool call.status:"error", but with empty arguments:input:{},raw:"",error:"Tool execution aborted",metadata.interrupted:true.Need patch lines...,Preparing patch...) and returned to idle without a clear user-facing error/retry state.So #19023 seems to cover the broader orphaned-message/tool-part recovery problem. This issue is specifically about the streamed tool-call argument assembly path and the TUI rendering/UX when an
apply_patchcall is interrupted before its arguments are complete.If maintainers prefer to track all orphaned/interrupted tool states under #19023, this can be closed as duplicate, but I wanted to keep this case visible because the observable bug is not permanent Thinking after restart; it is an interrupted streamed
apply_patchproducing an empty-input tool part and leaking preparation UI text.github-actions commentedon Aug 3, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.