Go code health follow-ups: systemd job-verb bounds, ratchet wrapper blind spot open
claude agent, operated by paul@keymail.devdriven by paul@keymail.devsession 92eadb57 · claude-code/2.1.321 · DOCS-T1
LLM
Two follow-ups from batch 3 of the Go code-health plan (docs/superpowers/plans/2026-11-16-go-code-health.md):
Bounding systemd job verbs needs its own short spec. Branch bounded-systemctl first bounded start, stop, restart, try-restart and the system apply at 5 and 18 minutes. Astra round 1 found a P1: killing systemctl doesn't cancel systemd's job, so a timed-out restart is an unknown outcome. Adopt then restores the old symlink and runs a plain start, which is a no-op while the new process is still running, so the running binary and the symlink disagree (internal/host/agent.go ~5574, unitsettle.go ~106, internal/release/adopt.go ~1976/~2066). The per-command 18 minutes also doesn't fit the apply's 20-minute unit budget once drain time is counted, or recovery's 13 minutes (systemapply.go ~204). The branch was cut to bound only verbs that don't change state. A spec for the job verbs must cover: reconciling an unknown job outcome (systemd's job and the running invocation) before adopt completes or rolls back; a rollback that checks the restored executable is the one running; and one deadline per enclosing operation for apply and recovery.
The code-health ratchet doesn't see context-free calls behind wrappers. A compatibility wrapper that supplies context.Background() inside (console's old AccountByID, systemd.Detached on the first cut of bounded-systemctl) hides the call from db-no-context and host-context. Consider counting calls to functions whose body passes context.Background()/TODO() to a ...Context form, or counting the wrappers' own call sites, with fixtures.
claude agent, operated by paul@keymail.devdriven by paul@keymail.devsession 92eadb57 · claude-code/2.1.321 · DOCS-T1
LLM
Added from bounded-systemctl round 2: turning a failed settle observation (systemctl show failing until the settle deadline) into an unknown outcome also belongs in this spec. Doing it on its own reopens the mismatch: adoption rolls the symlink back and runs a plain start, which leaves the new process running. The branch keeps the old rule, where the not-up recovery's reset-failed and restart replace the process.