private guest survives the app closing — Restart=always resurrects it and the app-tied stop never reached systemd (ADR 0129 broken) #427
Labels
No labels
agent-blocked
agent-working
autopilot
bug
deferred
deploy-pending
enhancement
landing-pr
model-haiku
model-opus
model-sonnet
needs-design
needs-info
needs-triage
no-triage
out-of-scope
priority
ready-for-agent
ready-for-human
ready-for-session
rehearsal-183
snapshot-pending
standing-drive
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Matou/idss#427
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What happened
After closing the operator app at the end of a founding drive (2026-08-10, ~20:53), the private guest VM kept running — hours later the qemu process and its user unit were still active with no app anywhere. ADR 0129 rules the exact opposite: the VM-mode guest is app-tied — closing the app stops the guest, the helper stopping the unit when its stdin closes.
The journal shows what actually happened at app close:
disable --now) never reached systemd.Scheduled restart job, restart counter is at 1— the unit'sRestart=alwaysresurrected the guest one second later, and it has run ever since.What I expected
Closing the app closes the VM (ADR 0129's own words: quit, window close, or crash — no Electron choreography needed).
Steps to reproduce
systemctl --user is-active ourcloud-guest.service— active;pgrep qemu— the guest is still running (journal shows a restart rather than a stop).Additional context
Restart=alwaysverbatim from the agent's system-scope posture (where "a crashed guest is resurrected" is right — ADR 0056's unconditional survival). Under ADR 0129's app-tied scope it means any guest exit that doesn't come through an administrativesystemctl stopgets resurrected — the app-tied guarantee is structurally one race away from false. The user-scope unit likely wants no restart (or the stop path must always be the administrative one), while the agent's system scope keepsRestart=always.Triage:
bug,ready-for-agent.Verification: confirmed against the codebase, not just the report. ADR 0129 rules the user-scope private guest app-tied ("closing the app stops the guest", no autostart, no Electron choreography needed); ADR 0056 keeps the agent's system-scope guest on unconditional survival deliberately — these are two different scopes with two different intended lifecycles. The guest unit is rendered from one shared template: it already branches
WantedByby scope (default.targetvsmulti-user.target) but hardcodesRestart=alwaysunconditionally for both scopes — the ADR 0056 crash-recovery reasoning bled into the ADR 0129 app-tied scope with no carve-out. Separately, the helper's stop-on-app-close routine is wired only into the normal path after its blocking stdio read loop returns; there is no signal handling (SIGTERM/SIGINT) anywhere in the helper, so a real app close/crash/process-group teardown can skip the stop entirely and leave nothing logged — matching the issue's "no helper output in the launcher's captured logs". No.out-of-scope/entry and no GOTCHAS.md entry cover this failure mode; this is a new, previously unreported defect.Agent Brief
Category: bug
Summary: The private-path guest's user-scope systemd unit can resurrect itself after the operator app closes, breaking ADR 0129's app-tied guarantee, because it shares an unconditional restart policy with the agent's system-scope guest and because the helper's administrative stop only runs on one exit path.
Current behavior:
Closing the operator app is supposed to stop the private guest (ADR 0129). In practice: the guest's qemu process can exit without the helper's administrative stop (
disable --now) ever reaching systemd, and about a second later systemd'sRestart=alwaysresurrects the unit — it then runs indefinitely with no app attached, silently consuming resources on what's meant to be an app-scoped sandbox. This reproduces on a real founding drive: found a private-path community, let the guest come up, close the app, then checksystemctl --user is-activeandpgrep qemu— both show the guest still running.Desired behavior:
disable --now) should leave the unit stopped, full stop — matching ADR 0129's "closing the app stops the guest" with no exceptions carved out for crashes or unexpected exits.Key interfaces:
WantedBytarget) needs the restart policy added as a second scope-conditional axis, not a single shared constant.Acceptance criteria:
systemctl --user is-active ourcloud-guest.servicereports the unit stopped/inactive and stays that way (no restart-counter increment in the journal), even after waiting past several of the unit's restart intervals.pgrepfor the guest's qemu process finds nothing after the app-close settles.Restart=alwaysidentically for both).Out of scope:
Fixed and landed on
origin/main(commitsandcastle: #427 app-tied guest stops staying up).Two compounding defects, both closed:
unitFile(internal/vm/manager.go) renderedRestart=alwaysfor both scopes; it now branches on scope: user-scope guest rendersRestart=no(ADR 0129 app-tied — never self-resurrects), system-scope agent guest keepsRestart=always(ADR 0056, untouched). NewTestRestartPolicyDiffersByScopeasserts the two scopes render different policies;TestUserScope_DrivesUserSystemdamended to requireRestart=no;install_test.go's system-scopeRestart=alwaysstill passes.stopGuestOnSignal,app/helper/cmd/helper/guestlifecycle.go), so the administrative stop runs on every termination path a real app close/crash takes, not only a clean stdin drain.StopOnExitis idempotent across both paths viastopOnceand logs the stop's verdict once (ADR 0100 — the only durable evidence it ran).TestStopGuestOnSignal_StopsAndLogs+TestStopOnExit_IdempotentAcrossPaths.Hazard recorded as GOTCHAS #13; STATUS.md header + milestone log updated.
Out of scope, still open: why qemu exits cleanly at app-close before the resurrect fires — the report flags this as unexplained; the fix makes the guest's end state correct regardless (no resurrect + the stop always reaches systemd).
Verified:
go build ./...,go vet, andgo test ./internal/vm/... ./app/helper/... ./internal/install/...all green undernix develop .#go-ci(plus the pre-push gate).