Repository navigation
Open
Labels
area/infraInfrastructure, deployment, and operationseffort/lLarge: multi-day or open-ended; expect staged check-inskind/infrastructureInfrastructure / host-portability workpriority/normalOrdinary priority (the default)queue/parkedQueue task is parked (waiting on CI, time, or an event)status/parkedDeliberately paused with a recorded resume conditionstray-workStray work: not tied to a design or roadmap item (AUDIT-7 Lane 7)stray/needs-parentStray work with no appropriate parent/epic/design yet (AUDIT-7 Lane 7)task/small-fixQueue packet kind: bounded fix with reproduction and targeted testswork/assignedQueue worker lifecycle state
Description
Defect: OpenCode server handover is not in effect on the laptop — socket unit disabled, same-build switch darkened the port ~16s and cut the drain at 40ms
Drew's standing design: a server switch/restart passes the port and sessions over without dropping anything; a same-code switch needs no restart at all. Measured live during the 2026-11-16 agy 1.5.9 system switch (nixos-rebuild switch, SWITCH_EXIT=0, system generation 558 → 559):
Evidence (all 2026-11-16, UTC)
- The opencode build did not change in this switch:
2.0.30+5b65c2a, store pathbdkm7bd1gbx4i0cmk92zrzwc5x16ms00-opencode-2.0.30+5b65c2abefore and after. The service restarted anyway: pid 967757 → 3365330, new instance start 08:24:14Z. - A 2-second-interval probe of
http://127.0.0.1:13420/api/configacross the switch recorded the port refused from 08:23:58Z through 08:24:12Z, answering again at 08:24:14Z — ~16 seconds dark (479 healthy samples vs 8 refused in the run). - Server log, old instance:
08:23:57.964Z draining running sessions and requests sessions=["ses_e5e1c9ad3c3ffeWx7ITHH5v49w","ses_e5e1c8eefd0ffehalIMX1R225d"] requests=0 grace=30000— then 40ms later,08:23:58.004Z shutdown ended with sessions or requests still running; interrupting them. The announced 30s drain grace was not honored; something ended the drain almost immediately (the fork's drain ends early on a second termination signal — source of the second signal not yet identified). opencode.socket:ActiveState=inactive,UnitFileState=disabled; the 13420 listener is owned by the server process itself (ss: pid 3365330, fd 8). Socket activation is not in effect, which contradicts the 2026-11-11 follow-up on Shadow supervisor (pid 1059342, stale system profile) respawns prod OpenCode service within seconds of any stop — port version decided by rebind race #8261 recording socket activation as adopted after the 2026-11-10 cascade. Either the adoption regressed or it never landed in the deployed unit set.
Impact today: interruption, not loss
- Session store intact:
session_v2held 22,937 ids before the switch; after: 0 lost, 26 gained. - Both interrupted sessions were re-warmed by the new instance (
scheduled session warming08:24:19Z) and produced successful route attempts from 08:24:20Z; the conductor's 08:25Z sweep lists both as progressing with 0 errors. No job permanently failed. - But the guarantee Drew specified does not hold: the port went dark and in-flight turns were interrupted on a switch that changed nothing about the server.
Fix asks
- Enable
opencode.socketso the port survives process swaps (or establish why the Nov 11 adoption did not stick and close that gap). - Find and remove the second-signal source that cuts the drain; the 30s grace must be honored.
- Skip restarting the opencode service when the build/store path is unchanged across a switch.
Refs: #8261 (2026-11-10 cascade; adoption claim), #1822 (socket activation audit), #8255 (incumbent-defer cutover).
Acceptance criteria
- The opencode handover failure mode named in the title (socket unit disabled, same-build switch darkening the port and cutting drain) is fixed or explicitly dispositioned, with a live handover probe demonstrating the corrected behaviour recorded here.
- Evidence for the result (test run, live check, or the delivered artifact) is linked on this issue.
- Follow-on work, if any remains, is filed as its own issue and linked here.
Metadata
Metadata
Assignees
Labels
area/infraInfrastructure, deployment, and operationseffort/lLarge: multi-day or open-ended; expect staged check-inskind/infrastructureInfrastructure / host-portability workpriority/normalOrdinary priority (the default)queue/parkedQueue task is parked (waiting on CI, time, or an event)status/parkedDeliberately paused with a recorded resume conditionstray-workStray work: not tied to a design or roadmap item (AUDIT-7 Lane 7)stray/needs-parentStray work with no appropriate parent/epic/design yet (AUDIT-7 Lane 7)task/small-fixQueue packet kind: bounded fix with reproduction and targeted testswork/assignedQueue worker lifecycle state
Activity
developing-today commentedon Nov 16, 2026
CODE-3861
dezren39 commentedon Nov 16, 2026
Read-only comparison on
amd: neither generation 558 nor 559 declaresopencode.socketor itssockets.target.wantslink in the generated Home Manager unit set. The live socket is a regular file dating to Nov 10, with no enablement link; it was inactive and disabled at 08:42Z. The live service is a generation-managed symlink replaced at 08:23:57Z. Its generated unit differs between 558 and 559:ExecStartis unchanged, butExecStartPrepoints at a different store derivation. The journal independently shows systemd stopping and starting the service at that boundary. This is a concrete activation lead, not proof of who disabled the socket or sent the second termination signal. For the fix, prove three independent invariants: an unrelated switch (including a helper-only diff) leaves the serving PID stable; a changed build inherits the declared socket across cutover; and the drain respects its configured grace without an accidental second signal. Electrical TCP continuity and uninterrupted/resumable streams should be measured separately. No service or configuration changes made.dezren39 commentedon Nov 16, 2026
Findings: 2026-11-10 ~21:56–22:18Z prod OpenCode server window (left-on-the-ground half, reported 2026-11-16)
Scope: what stopped/started the prod server (127.0.0.1:13420) in the window, whether the handover procedure ran, whether sessions/jobs were dropped. The agy-switch subagent pulled the journal for this but filed no report; this comment closes that half. All four linked issues (#8255, #8261, #8257, #8264) are CLOSED, so findings go here as the open handover successor.
0. Journal verdict first: the journal no longer reaches 2026-11-10 — re-derivation from journal is impossible, no guessing done
journalctl --list-boots(system and--user): single boot9d27c8dd, first entry 2026-11-14T18:13:38-06:00. Nothing earlier exists on this machine id (6f220f57…; other/var/log/journal/*dirs are stale foreign machine-ids, newest mtime Mar 2026).journalctl --since 2026-11-10 --until 2026-11-11→No entries.journalctl --user-unit opencode.service --since 2026-11-01 --until 2026-11-12→No entries.~/.local/share/opencode/log/opencode.log(50M) starts 2026-11-15T21:02:47Z.opencode-local.db.route_attemptholds 23 rows, ~Nov 14+. Both postdate the window.~/.local/state/opencode/fastlane/state.json(activated_at 2026-11-10T20:57:44Z); (c) the main ledger~/.local/share/opencode/opencode.db.route_attempt— 722,101 rows spanning 2026-10-24→today, queried read-only today (all timestamps below recomputed 2026-11-16, window = unix ms 1794347760000–1794349080000).1. What stopped and started the server in-window (from the surviving contemporaneous record, not re-derived)
Per #8261's per-death table + cycle-stop comment (comment 6780837598), which cite the then-live user journal + server-log registration lines:
systemctl --user start opencode.service→ seat 3193272/3497ea2, held continuously 22:09:42Z, 22:13:42Z, 22:18:42Z, 22:19:49Z (~10 min, zero churn).ensure()+stop escalation winning a rebind race (the dominant stopper); (b) the switch lane's deliberate kills + manual unit start (the stopper/starter that ended it); (c) watchdog (one start). Two SIGKILL senders remain unattributed in the surviving record (rows 1 and 9 of the table — row 9 is post-window).2. Handover: not in effect — die-and-rebind was the mechanism that night
20-fastlane.conf+state.jsoncutover 20:57:44Z to 3497ea2 viaopencode service stop+ daemon contend/ensure — i.e. the seat was managed outside the unit even before the cascade.3. Sessions/jobs: attempt-level continuity 100%, in-flight rate collapsed mid-window, one in-memory job provably dropped
Recomputed today from
opencode.db.route_attempt(times UTC):con_1a1c…begun 22:17:50Z (inside this window) on seat 3193272 died with the churn (IntegrationAttemptNotFoundErrorfrom 22:24:16Z). In-memory server-side attempts did not survive seat changes. pm-dispatch sessions never advance after a prod OpenCode service restart — attempts freeze while service stays up #8257's 14-min freeze (20:51:07–21:05Z) is pre-window and distinct.Verdict
Journal re-derivation: impossible (journal + server log + local ledger all postdate the window; stated exactly, not guessed). From surviving contemporaneous record + today's ledger recomputation: the 21:56–22:18Z window covers the tail of the stale-client rebind cascade (stopped by contender displacement, 381s attempt gap from ~22:00:45Z) and its deliberate end (lane SIGKILLs + manual unit start, 198s gap ending 22:11:29Z, then a stable seat). No handover procedure ran — none existed yet; die-and-rebind ruled. Sessions: 95/95 continuity at the attempt level; in-flight jobs (in-memory OAuth attempt begun 22:17:50Z) were dropped. Session store itself was never at risk (server-side state, none deleted).
dezren39 commentedon Nov 16, 2026
Fleet-minder run580 evidence (2026-11-16 ~05:29–05:40 CST): the handover/self-heal gap bit again.
opencode serve --serviceprocess (current-system 2.0.30 build, outside the systemd unit) was listening on 13420, the auth file was regenerated, and sessions resumed: active count 16 at 05:39Z recheck, 27 by 05:40Z, all advancing, no question-blocked.Minder took no server action (report + file route per its charter). Related: #8729 (restart = dead server), #8777 (SIGTERM treated as clean, no self-heal).
dezren39 commentedon Nov 16, 2026
Fleet-minder run586 evidence (2026-11-16 ~13:03-13:11Z): opencode.service main process SIGKILLed repeatedly — 06:58:01 CST (20.2G mem peak), 07:02:10, 07:03:18 CST; the 07:03:19 restart exited cleanly after 22s leaving the unit inactive/dead, service-prod.json absent, port 13420 dark. Watchdog (code#7780) grace window started 07:05:42 CST and restarted the unit 07:07:43 CST (listening 07:08:13), but the server was refusing connections again by 13:10:40Z under extreme laptop load: load average ~9,846, 7,127 processes, of which ~6,122 are pool.test (5,534 defunct + 588 live) plus 333 go / 56 compile — a runaway Go test binary is exhausting the laptop and the OpenCode server is collateral. laptop-agent broker path also failing (HTTP 502 RemoteDisconnected x3); minder fell back to real SSH. Census ACTIVE was already 0 at 13:03:46Z; attention feed is carrying last-good entries. This exceeds the run580 transient pattern: kill loop + external resource exhaustion, fleet-stalling while it persists.
dezren39 commentedon Nov 16, 2026
Related evidence 2026-11-16 (pool lane): the standing server instance is being SIGKILLed on a ~25–35 min cycle today, consistent with the handover not draining — each kill is a hard cutover with a short dark window.
dezren39 commentedon Nov 16, 2026
Related evidence 2026-11-16 (later): the standing instance's quota path wedged while sessions stayed healthy.
opencode quota subcommand failed: Command failed: /run/current-system/sw/bin/opencode quota --json— the subcommand hung ~4 min per attempt (heartbeat durationMs 241601). quota-current.json froze at the 10:08 CST generation for ~1.5h.systemctl --user start opencode.service. On the fresh instanceopencode quota --jsoncompletes, and a manually started gather tick refreshed quota-current.json at 11:37 CST (Meta weekly then read 92%).dezren39 commentedon Nov 17, 2026
agent-note:v1
state: triaged
task: 19336 (repo-health-code-pilot, lane code-d)
issue: #10639 — opencode handover not in effect: socket unit disabled, same-build switch darkened port ~16s and cut drain at 40ms (2026-11-16)
Inline triage (issue was OPEN with no labels and no hard stops when claimed; fresh-verified 2026-11-17):
Disposition: task 19336 completes as triaged with follow-on task 20671 named. Issue #10639 stays OPEN for the fix.
dezren39 commentedon Nov 18, 2026
state: parked
task: 20671 (repo-health-code-pilot, lane oc-code-03)
issue: #10639 — opencode handover: socket unit, drain grace, no restart on unchanged build
Fresh check 2026-11-18: issue OPEN, priority/high, effort/l. Three fix asks span the darwin-nix unit declarations and the fork drain/signal handling, each needing a live-switch proof. Too large for an unattended lane.
Resume brief: implement the three asks in a dedicated session, with a live same-build switch proof per ask. Parked for that session; no packet filed here.
dezren39 commentedon Nov 18, 2026
🤖 Agent note — scheduled lane recheck; parked for dedicated live-switch work
dezren39; no open PR references it.52 remaining items
developing-today-fleet commentedon Nov 27, 2026
Lane 2107-H (charlie ADVANCE, 2026-11-26 21:07 CST) premise check: read issue + all 34 comments. Repo slices all merged (#12299 unchanged-build no-restart, #12781 socket + KillMode=process, #13678 deploy cutover helper); only the one-time live cutover + three live proofs remain (same-build PID stability, changed-build socket continuity, 30s drain with no second signal).
Quiet-window condition is FALSE at this run: sibling lanes are actively running through opencode.service right now (queue task 26056 checkpoint diagnosing 2026-11-27T03:06Z, task 23803 claimed 03:02Z, this work-loop run spawning lanes). A cutover now would terminate active sessions — the exact harm this issue exists to prevent. No host change, no repo edits by this lane.
Disposition: queue task 20671 PARKED by this lane (verified status=parked, parked 2026-11-27T03:20:12Z, not_before 2026-11-27T03:40:12Z; broker ready-condition recorded as external / quiet window). Full wake condition: no nix/home-manager builds running AND ~10min quiet window (no active OpenCode sessions, no established 127.0.0.1:13420 connections) AND executing session outside opencode.service cgroup; then detached cutover (stop service, start socket, start service) + the three live proofs.
developing-today-fleet commentedon Nov 27, 2026
Lane any-n, task 20671 — read-only preflight 2026-11-27 04:56 CST: live configuration has advanced: opencode.service is active, PID 2093774, KillMode=process; opencode.socket is active/enabled on 127.0.0.1:13420 and service reports TriggeredBy=opencode.socket. Laptop route is reachable; no build/deploy processes detected. There are 10 established server-side connections and this executor is inside opencode.service, so the existing quiet-window predicate is false. No host or source changes made. Parking on execution state, not owner approval. Still required: same-build serving-PID stability, changed-build socket continuity, and full 30-second drain without a second signal. Resume from a detached executor outside the service once the quiet-window predicate holds.
developing-today-fleet commentedon Nov 27, 2026
Lane oc-code-08, task 20671 — read-only probe 2026-11-27 ~07:45 CST, no host or source changes.
Live: opencode.socket active/enabled since Nov 26 16:16 CST, Listen 127.0.0.1:13420; opencode.service active MainPID 4064432 since 06:31:49 CST, KillMode=process, TriggeredBy=opencode.socket. Repo declarations on main unchanged (X-RestartIfChanged=false, KillMode=process, sockets.opencode). Quiet window false: 26 established port-13420 connections, executor inside opencode.service cgroup, sibling lanes active — no cutover, no live proofs attempted.
New second-signal evidence (journal, opencode.service, today):
Candidate mechanism for the second SIGTERM, from home/common/opencode-deploy.sh: on a build-change activation it runs 'systemctl --user stop opencode.service' (SIGTERM 1, drain starts), starts the socket, then immediately 'systemctl --user restart opencode.service' (SIGTERM 2 via the restart stop phase, with no grace wait in between). If that stop/restart back-to-back survives, the 30s drain can never hold on a deploy path. Suggested fix direction: wait for the drain (poll for MainPID exit up to the grace) between stop and restart, or collapse stop+restart into a single start-or-restart after the socket owns the port.
Still required: same-build PID stability, changed-build socket continuity, full 30s drain with no second signal — all need a quiet window with an executor outside opencode.service. Parking on execution state.
developing-today-fleet commentedon Nov 27, 2026
Lane oc-code-05, task 20671 — read-only probe 2026-11-27 ~12:05 CST, no host or source changes. Fresh second-signal occurrence same day, exact log lines:
received SIGTERM again during shutdown; exitingwith a child still pending (10.3s child 2200925 running: git ... diff-files --name-status), thenMain process exited, code=exited, status=1/FAILURE.Scheduled restart job, restart counter is at 18(Restart=on-failure); new MainPID 2204279. Unclean termination left dozens of processes in the cgroup (Found left-over process ... while starting unit)..opencode-wrappfd, not systemd-held); 98 established :13420 connections; executor inside opencode.service.Cutover + acceptance proofs not attempted: quiet-window false (98 conns, executor in-service). Repo slices #12299 #12781 #13678 already merged; no source edits needed. Resume: quiet window, executor outside opencode.service, then detached cutover + 3 acceptance proofs.
developing-today-fleet commentedon Nov 29, 2026
Census 2026-11-29 (Felix): full recheck of this issue — details, labels, blockers, priority (rechecked from scratch; prior detail did not exempt it).
STRENGTHS:
GAPS FOUND:
FIXES I APPLIED:
PICKUP NOTES (added by this census so the next agent can resolve this cold):
16s and cut drain at 40ms (2026-11-16)". Locate the owning code by searching the repo (/workspace/gh-shim-work/code) for the title's key terms (opencode handover not in effect socket unit disabled same-build switch darkened ); the issue body/comments are the spec of record.REMAINS: nothing — ready for pickup
developing-today-fleet commentedon Nov 29, 2026
Priority validation 2026-11-29 (Felix): priority/high → priority/normal — all repo slices are merged and live probes since 2026-11-26 show socket activation in effect (opencode.socket active/enabled, TriggeredBy present); the remainder is supervised switch-acceptance observation on the laptop — still a real drain risk to watch (2026-11-27 SIGTERM signal), so normal rather than low, but no longer time-sensitive lane work
developing-today-fleet commentedon Nov 29, 2026
Issue census — 2026-11-29
Wave-2 residual pass. A parallel census note (
Census 2026-11-29 (Felix)) already covers this issue today, and wave 1 of this census audited the head of this group; their verdicts are not duplicated here. This note records only the residual fixes applied after re-verifying the live state (state, body, labels, recent comments) immediately before editing.Residual gaps found: no
app/*/area/*label although the owning project is clear from the title/body; no acceptance-criteria section.Actions taken: labels added:
area/infra; appended## Acceptance criteria(original body text unchanged above it).Priority:
priority/normalretained — matches the work's urgency as evidenced on the issue; no band change in this pass.