Repository navigation
Open
Description
Summary
The opencode serve --service process was silently killed and restarted 4 times within ~45 seconds (plus once more later in the session), each restart landing 6–9 seconds after a git worktree add spawned by the worktree_create tool or by a server-side shell. In-flight tool calls return "Tool execution interrupted", no error is logged at the death boundary, and after reboot the worktree registry is stale (worktrees exist on disk but are invisible to worktree_list, causing duplicate suffixed worktrees on retry).
Environment
- opencode version: v2.1.0
- OS: Windows_NT 10.0.26300 (win32 x64)
- Terminal: TERM_PROGRAM=herdr, TERM=xterm-256color, COLORTERM=truecolor (herdr wrapper;
service.jsonpresent in config — service is supervised/restarted externally) - Shell: PowerShell 7 (
pwsh) for tool execution; COMSPEC=cmd.exe - Install/channel: latest (update notice 2.1.0 → 2.1.4 was present, but every restarted run stayed on 2.1.0 — not an auto-update)
- Active plugins: none found (opencode.jsonc has no plugin entries; no
.opencode/plugin/)
Reproduction
- Run
opencode serve --serviceagainst a large git checkout (thousands of files) with an active session. - From a session, call
worktree_createthree times concurrently (Promise.all) for three new worktree names. - Observe: the tool returns
{"error":"aborted","message":"Tool execution interrupted: execute"}, followed within seconds by the harness message "The server restarted while you were working." The log shows the old run's lines stop abruptly (last line: watcher churn) with no ERROR/FATAL/panic, then a new run logscli starting ... args=["serve","--service"]~6 s later, answering 503 for ~1 s while booting. - Repeat (a retry batch, then a single
worktree_create): same pattern — 4/4 attempts correlated with restarts. A plain server-side shellgit worktree addalso coincided with a restart once; other shell worktree commands did not — so it is intermittent, not deterministic. - After each reboot,
worktree_listdoes NOT show the worktrees that exist on disk (git worktree list shows them, detached). Retrying the create yieldsname-2,name-3duplicates because the tool's registry didn't know the directory already existed.
Expected Behavior
worktree_create returns its result; repo worktree operations never restart the service; after any restart the worktree registry matches git worktree list.
Actual Behavior
- Restarts at 2026-10-25T07:19:23.8, 07:19:38.3, 07:19:56.3 UTC (run IDs
cf73ddba→3b02fac7→f01e259d→4d312f54; the killed run had ~3.67 days uptime) plus one more during a later shellgit worktree addchain. - Deaths are silent: no log line above INFO at any boundary; the log simply stops, and a supervisor externally relaunches the same version.
- All
git worktree addprocesses DID complete server-side — only the tool responses were lost. Callers saw "aborted" for work that had succeeded. - Registry desync persisted after reboot → duplicate worktrees, lost responses, at-risk background subagents.
Additional Context
- Log file:
~/.local/share/opencode/log/opencode.log; searchrun=cf73ddba,run=3b02fac7,run=f01e259d,run=4d312f54around 07:19:17–07:20:02 for the full sequence (cli startinglines mark each reboot). - The recurring WARN flood
failed to list MCP resource templates server=zotero-mcp ... Method not foundappears on every boot and seems unrelated (present during healthy periods too). - Frequency: 4 in ~45 s, then stable for the remainder of a multi-hour session (heavy test suites and shell git ops ran fine). Two earlier single
worktree_createcalls completed without incident, so triggering is intermittent. - Impact: interrupted orchestration, lost tool responses, potential orphaned background subagent sessions, duplicate worktree dirs.
- Workaround adopted: after any worktree operation, reconcile with
git worktree listandcheckout -B; avoid concurrentworktree_create; treat "aborted" worktree creates as possibly-succeeded before retrying. - Hostnames/usernames/repo paths redacted; no secrets included.
Metadata
Metadata
Assignees
Labels
No labels
Activity
opencode-agent commentedon Oct 25, 2026
Thanks for the detailed report and the run IDs.
I couldn't trigger the restart on Linux. I ran v2.1.0 against a git repo with 20,000 files and made three worktree-create calls at the same time, twice. Each finished in about 0.4 s, and the service's
/api/infohealth endpoint always answered within a few milliseconds. The service never went unresponsive, so nothing killed it. The restart you saw probably depends on Windows: how longgit worktree add, file watching or snapshotting take on a large checkout there. A maintainer with a Windows setup will need to look at it.I could see the stale worktree list in isolation. If a worktree exists in git but OpenCode never recorded it (as happens when the service is killed partway through a create), it doesn't appear in the worktree list after a restart, and creating the same name again gives
name-2. Calling the worktree refresh endpoint (POST /api/worktree/refreshwith yourprojectID) syncs the list withgit worktree listagain, which may be easier than your manual workaround.These would help whoever picks this up:
git worktree addtakes there when run by hand.Background service is unresponsiveor a restart reason around 07:19 UTC.Related issues, most likely first: