Repository navigation
Description
Before submitting
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area
apps/server
Steps to reproduce
- Linux, T3 as the systemd user service (
t3 __service-launcher), with an OpenCode 2 thread active, so T3 has started its ownopencode serve. - A stop where
t3 servedoesn't finish its shutdown within the service launcher's 5 s grace and gets SIGKILLed. On our host that is every stop: with "Continue threads after server update" on and a ~25 GB database (about 9,300 threads),prepareForShutdownalone can take over 4 s. systemctl --user stop t3code(or a restart).
Expected behavior
When t3 serve dies, its OpenCode server goes with it, and the unit stops in a few seconds, as it did up to 0.1.14-nightly.20261127.5319.
Actual behavior
The OpenCode server keeps running after t3 serve is gone. It stays a child of t3 __process-launcher, so that process stays too, and the unit waits for systemd's stop timeout. OpenCode runs in its own t3code-opencode-*.scope, outside the unit's cgroup, so systemd's final SIGKILL doesn't reach it either.
- 0.1.14-nightly.20261127.5359, 2026-11-29. Stop at 05:03:18 UTC. systemd hit
State 'stop-sigterm' timed outafter 90 s and SIGKILLed the service launcher (main process) and the process launcher at 05:04:48. The OpenCode server got no signal from T3. Its first SIGTERM came at 05:04:48.46, from our own cleanup script. - 0.1.14-nightly.20261128.5413, 2026-11-30. Stop at 05:01:30.33 UTC. The OpenCode server was still running at 05:01:36.43, when our script stopped it. The unit stopped 0.9 s later. There was no timeout only because of our script.
- 0.1.14-nightly.20261127.5319, 2026-11-28, before the change. The stop took 5.6 s.
t3 servedidn't finish its shutdown either (no "shutdown reconciliation completed" line), but no OpenCode server was left behind.
Cause, from the code:
- Up to 5319,
apps/server/src/process/processLauncherWorker.tsSIGKILLed every child's process group and exited when the server's IPC channel closed (process.on("disconnect", …)). - refactor(server): launch commands through Effect 4.1.6's proxy process #44095 (0a63dfe, first in 5359) replaced it with Effect's
NodeChildProcessProxy. That only installs no-opSIGINT/SIGTERMhandlers and has nodisconnecthandler. So whent3 serveis SIGKILLed, nothing stops the processes it launched. - At shutdown, the OpenCode server is stopped only by its own scope finalizer (
terminateChildinOpenCodeRuntime.startServerAttempt). The provider layers close after the startup finalizer, which runsprepareForShutdown,providerSessions.shutdownandreconcile("shutdown"). The service launcher SIGKILLst3 serveafterTERMINATE_GRACE_MS = 5_000, so that finalizer never runs. - The unit's main process is the service launcher, and it stayed up until systemd's SIGKILL. The process launcher inherits
t3 serve's stdout and stderr, which are socket pairs the service launcher reads, so that is likely what keeps it waiting.
The same holds on 0.1.14-nightly.20261130.5465 and main 46f558a.
Impact
Major degradation or frequent failure
Version or commit
0.1.14-nightly.20261127.5359 and 0.1.14-nightly.20261128.5413. Last good: 0.1.14-nightly.20261127.5319.
Environment
NixOS x86_64, systemd 262, T3 as the user service (TimeoutStopSec 90 s, KillMode=mixed), OpenCode 2.4.2 started by T3 in its agent scope. T3 runs with local preloads that patch provider behaviour. None of them touches shutdown, the launchers or process spawning.
Logs or stack traces
# 2026-11-29, 5359 (journalctl --user -u t3code, local time UTC+2)
07:03:18.185 Stopping T3 Code server...
07:04:48.215 t3code.service: State 'stop-sigterm' timed out. Killing.
07:04:48.215 t3code.service: Killing process 1628650 (node-MainThread) with signal SIGKILL. # t3 __service-launcher
07:04:48.215 t3code.service: Killing process 1628838 (node-MainThread) with signal SIGKILL. # t3 __process-launcher
07:04:48.228 t3code.service: Failed with result 'timeout'.
# same stop, server trace (span end times, UTC)
05:03:22.991 ProviderRuntimeRecoveryService.prepareForShutdown 4230 ms (getRecoveryThreadIds 4229 ms)
05:03:23.129 last span written
# 2026-11-30, 5413
07:01:30.328 Stopping T3 Code server...
07:01:30.893 t3 serve log: Relay client stopped (last line)
07:01:36.434 our script: OpenCode server outlived the T3 server that started it, SIGTERM
07:01:37.319 Stopped T3 Code server.Workaround
A wrapper script around the restart runs systemctl stop in the background. Once t3 serve is gone, it stops the OpenCode servers left under t3 __process-launcher, and the launchers then exit on their own.
Model: Claude Opus 5.5. Harness: OpenCode in T3 Code.
Activity