fix(lifecycle): bound OpenCode server lifecycle cleanup - #119
Merged
Merged
Conversation
- Track owned server processes and reconcile stale lifecycle records - Fail closed when process identity probes are unknown - Share shutdown budgets across coordinator and managed processes - Add comprehensive process lifecycle and server startup tests
- Give home-tui a hermetic proposeBranchName default so no test reaches the real namer and boots an opencode serve child - Stop servers a test still owns at the end of the run, while the owner is alive, and drop their records
- Sync the opencode-server-lifecycle delta into a new main spec under openspec/specs/ (8 requirements, 26 scenarios). - Mark tasks 1.2, 2.4, 2.5, and 6.4 complete with recorded verification. - Strengthen the Linux identity test to assert birth, uid, and executable from a live process, and cover the reboot case. - Add scripts/identity-smoke.ts, runnable from a compiled binary, proving the platform identity probe loads outside the test runtime. - Refresh the coverage badge. Linux-only execution is unverified on this macOS host; those suites run on ubuntu CI.
Inakitajes
added a commit
that referenced
this pull request
Sep 15, 2026
The capability spec was synced in #119; this only moves the completed change into openspec/changes/archive/2026-09-15-fix-opencode-server-lifecycle/. All 25 tasks are complete.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Ships the OpenSpec change
fix-opencode-server-lifecycle: Convoy now owns each managedopencode servechild from spawn to confirmed exit, so abandoned servers stop accumulating while deliberately independent lifetimes stay untouched.Why
Convoy had code-confirmed paths that could leave its OpenCode servers running after their owner was gone — a forced
process.exitduring abort, and signal handlers retired before final release — while the close primitive only submitted a signal without waiting for or verifying termination. A finished run's terminal hold could also outlive the controller meant to dismiss it. Operators reported accumulating memory-heavyopencode serveprocesses.What
src/managed-server.ts,src/process-stop.ts): one owned child per managed server with an awaitable, idempotent stop — SIGTERM grace, SIGKILL escalation, and an observed outcome. Confirmed disappearance counts as stopped; a submitted signal never counts as success.src/process-identity.ts,src/process-records.ts): PID plus kernel birth identity, UID, and executable role, in private versioned records under~/.convoy/processes/published before readiness. Unknown or low-resolution identity is never a kill target.src/runner.ts,src/coordinate.ts): one owner scope spanning boot → execution → terminal hold → release, reserving the last 3s of the existing 15s ceiling for server stop. Repeated abort/deadline force-stops owned servers before exiting instead of skipping cleanup.src/control-server.ts,src/control-progress.ts): a completed run's finish hold resolves on valid/byeor heartbeat-lease expiry, then runs normal cleanup.pkill-style scans.src/propose-service.ts).Planning artifacts live in
openspec/changes/fix-opencode-server-lifecycle/.Known limits
Verification
bun run typecheck— cleanbun test— 3388 pass, 0 fail (158 files)openspec validate fix-opencode-server-lifecycle --strict— valid