Repository navigation
Description
v2.3.0 (Windows): process daemon's kill-on-close Job Object silently kills detached child processes (Start-Process) when the owning command/session lifecycle ends
Environment
- opencode 2.3.0 (npm
@opencode/cli), Windows 10 Pro build 19045, shell host powershell.exe 5.1 / pwsh 7 - Version boundary confirmed: 2.2.7 spawned local commands directly; 2.3.0 delegates them to the process daemon (also independently reported in shell: Store PowerShell fails with 0xC0070005 in Windows pipe mode #63892)
Summary
Since v2.3.0, every local shell command runs inside a Windows Job Object created with JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE and no breakaway flags. Any child the command spawns — including "detached" processes created via PowerShell Start-Process — inherits job membership and is kernel-killed (TerminateJobObject) when the job is closed/terminated.
This breaks a common agent workflow: starting long-lived dev servers/services from a shell command and expecting them to outlive the command/session. It worked on ≤2.2.x (old spawner only used taskkill /T /F on explicit kill) and silently broke in 2.3.0.
Source evidence (v2.3.0)
packages/process-daemon/src/service/pipe/windows.rs:
Job::new()→CreateJobObjectW+SetInformationJobObject(JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE)create_process()→PROC_THREAD_ATTRIBUTE_JOB_LIST, comment: "with no breakaway flags" (neitherBREAKAWAY_OKnorSILENT_BREAKAWAY_OKis set)terminate()→TerminateJobObject(job, 1)— kills the whole treereap()→ "Closing the job alone kills anything still in it."
PR #62978 also states the behavior change explicitly: leftover background processes of a command are "SIGKILLed when the command is evicted or removed (today they survive)" — eviction triggers include the 25-command cap, the 7-day sweep, and opencode service restart / stop ("still stop everything").
Local verification
On 2.3.0 / Windows:
- Agent shell command runs
Start-Process ping -n 600 127.0.0.1 -WindowStyle Hidden -PassThru→ PID survives after the command exits ✓ IsProcessInJob(pid, NULL)via kernel32 → TRUE for both foreground- and background-command-spawned processes (they are inside a job)- Same check for a process created via WMI
Win32_Process.Create→ parent isWmiPrvSE.exe, outside the daemon's command chain (documented by MS: "Child processes created using Win32_Process.Create are not associated with the [caller's] job")
Real-world incident
Agent started 7 Spring Boot services via a test-runner script (Start-Process -WindowStyle Hidden, stdout/stderr redirected). All 7 were killed at the same second the Playwright run finished and the owning session went idle — no crash dumps (hs_err), no WER events, no graceful shutdown logs, business logs normal up to the last line. Happened twice in one evening; each death coincided with a session/host lifecycle boundary (opencode service restart, script end + session idle transition).
Expected vs actual
- Expected: a process detached via
Start-Processsurvives command completion and session/host recycling (≤2.2.x behavior) - Actual: it stays in the kill-on-close job and dies silently whenever the owning command is evicted/removed or the service restarts
Workarounds found
- Spawn via WMI:
Invoke-CimMethod -ClassName Win32_Process -MethodName Create -Arguments @{ CommandLine = '...' }(escapes the job chain; note: no env inheritance, no built-in stdout redirect — wrap withcmd /c "... > out.log 2>&1") - Scheduled tasks (
schtasks) or NSSM/WinSW services - Avoid
opencode service restart/stopwhile agent-started services are running - Downgrade to 2.2.7
There is no config flag to disable the daemon or its job semantics (checked OPENCODE_* env vars and config schema).
Suggestion
Either allow breakaway (JOB_OBJECT_LIMIT_BREAKAWAY_OK + spawn detached children with CREATE_BREAKAWAY_FROM_JOB), or provide an opt-out (per-command flag or global setting) so agents can start long-lived processes that survive the session — this was a documented, relied-upon pattern on ≤2.2.x.
Activity
opencodejr commentedon Nov 17, 2026
Thanks for the thorough write-up and the source analysis.
I think this is a duplicate of #64177. That issue reports the same 2.3.0 regression: processes a finished shell command leaves running are killed later, when the daemon evicts or removes that command. It was reported on Linux; your report is the Windows Job Object side of it.
The fix for it, #64266, covers Windows too. After a command exits successfully, the daemon now turns off kill-on-close and releases the job, so processes started with
Start-Processshould keep running after eviction or removal. One caveat: if the command exits with a non-zero code, the job is still terminated right away. A test-runner script that fails (for example, a failing Playwright run) would therefore still take the services it started with it. If you still need a way for long-lived processes to survive that case, please mention it on #64177.Related issues, ordered by likelihood:
I'm closing this issue now as a duplicate of #64177. Please add any further details there, especially if this still happens once you're on a build that includes #64266. Replying here will reopen this issue.