Repository navigation
Description
Summary
When executing opencode run "<message>" inside a Git repository (Linux, OpenCode v1.19.0), the process hangs indefinitely immediately following:
message="project copy refresh started" projectID=...
The prompt is never dispatched to the LLM agent (message=process is never scheduled), and the CLI never exits or makes forward progress.
Inspection reveals that the OpenCode process is stuck in kernel futex_wait_queue, leaving a zombie process [git] <defunct> under its process tree.
Environment
- OpenCode Version: 1.19.0 (Linux x86_64 ELF binary compiled with Bun)
- OS: Linux 6.6.137+
- Command Executed:
opencode run "hi" --pure --print-logs --log-level DEBUG
Root Cause & Decompiled Trace
-
Reproduction & Comparison:
- In a non-git directory or fresh empty directory where
projectID=global,ProjectCopy.refreshexecutes in 1ms:The session immediately proceeds and MiniMax-M3 responds within seconds.message="project copy refresh started" projectID=global message="project copy refresh done" projectID=global updated=[] removed=[] - Inside an existing Git repository with tracked worktrees or registered projects,
opencode.db(project_directorytable) contains the repository root withstrategy = NULL.
- In a non-git directory or fresh empty directory where
-
Trigger Path in OpenCode (
packages/core/src/project/copy.ts©-strategies.ts):- During Location Services initialization,
ProjectCopy.refreshfilters for directories wherestrategy === undefined:J = Y.filter((V) => V.strategy === void 0 && V.exists).map((V) => V.directory)
- For each directory, it invokes registered strategies (
GitWorktree.list):ProjectCopy.GitWorktree.list -> Git.worktree.list(repo)
Git.worktree.listinvokes:viagit worktree list --porcelain
AppProcess(v1.make("git", ["worktree", "list", "--porcelain"], { cwd, extendEnv: true, stdin: "ignore" })).
- During Location Services initialization,
-
Process Hang & Defunct Child:
Checking the process tree during the freeze:steven 480021 0.6 1.9 ... opencode run hi --pure --print-logs --log-level DEBUG steven 480158 480021 0 ... [git] <defunct>/proc/480021/wchanreveals:futex_wait_queueThe
gitchild process finished execution immediately, but in Bun'snode:child_processwrapper / stream handler, the parent process did not reap the child or resolve the promise waiting for'close'/ stream EOF.Because
Git.worktree.listhangs indefinitely,ProjectCopy.refreshnever resolves, Location Services boot never finishes, and the user prompt dispatch loop (message=process) is never scheduled.
Related Issues
- Follows up on observations in core: project-copy refresh can report a 48-second no-op #37793 (
core: project-copy refresh can report a 48-second no-op), whereProjectCopy.refreshwas observed stalling the server. In this environment on Linux CLI mode, it hangs indefinitely rather than recovering.
Suggested Fixes
- Subprocess Timeout: Add a strict timeout (e.g. 5–10s) to
Git.worktree.listand allAppProcessinvocations so that a stalling child process or unhandled close event does not permanently deadlock the CLI boot sequence. - Proper Child Process Reaping: Ensure Bun's child process handler correctly listens for
exit/closeand callswaitpid/ drains stdout pipes even whendetached: trueor stdin is"ignore". - Non-blocking Refresh: Run
ProjectCopy.refreshout-of-band without gating interactive CLI message execution if no worktree copies are actively requested.
Activity
opencode-agent commentedon Oct 13, 2026
Thanks for the detailed trace, @Steven0917.
This is about OpenCode 1.19.0, which is v1. Development has moved to OpenCode 2.x, and v1 now only gets fixes for critical bugs, so this is unlikely to be fixed in v1.
The code path you traced (
ProjectCopy.refresh→GitWorktree.list) no longer exists in v2: project copies and the copy-strategy registry were replaced by a separate worktree service. Please try upgrading to v2 (opencode upgrade --major, notes: https://anoma.ly/notes/opencode-2-0) and see whetheropencode runstill hangs.The same v1 hang (zombie
gitchild, log stopping atproject copy refresh started) was reported before:gitchild never reapedproject copy refresh startedon any git projectgitchild during project-copy refresh hangs TUI sessionsIf it also happens on v2, or you think this is critical in v1, please reply here with your
opencode --versionand the log output, and we'll take another look.opencode-agent commentedon Oct 14, 2026
Closing this as not planned. It was reported against OpenCode 1.19.0 (v1), which only gets critical fixes, and we haven't heard back about whether it also happens on v2. In v2 the
ProjectCopy/GitWorktree.liststartup path has been replaced by a separate worktree service.If
opencode runstill hangs after upgrading (opencode upgrade --major), please open a new issue with your 2.xopencode --versionand the--print-logsoutput. Thanks again for the detailed trace.