Repository navigation
Open
Labels
effort/lLarge: multi-day or open-ended; expect staged check-insLarge: multi-day or open-ended; expect staged check-inskind/infrastructureInfrastructure / host-portability workInfrastructure / host-portability workpriority/highImportant and time-sensitiveImportant and time-sensitivequeue/parkedQueue task is parked (waiting on CI, time, or an event)Queue task is parked (waiting on CI, time, or an event)status/parkedDeliberately paused with a recorded resume conditionDeliberately paused with a recorded resume conditionstatus:in-reviewtask/small-fixQueue packet kind: bounded fix with reproduction and targeted testsQueue packet kind: bounded fix with reproduction and targeted testswork/assignedQueue worker lifecycle stateQueue 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).
Metadata
Metadata
Assignees
Labels
effort/lLarge: multi-day or open-ended; expect staged check-insLarge: multi-day or open-ended; expect staged check-inskind/infrastructureInfrastructure / host-portability workInfrastructure / host-portability workpriority/highImportant and time-sensitiveImportant and time-sensitivequeue/parkedQueue task is parked (waiting on CI, time, or an event)Queue task is parked (waiting on CI, time, or an event)status/parkedDeliberately paused with a recorded resume conditionDeliberately paused with a recorded resume conditionstatus:in-reviewtask/small-fixQueue packet kind: bounded fix with reproduction and targeted testsQueue packet kind: bounded fix with reproduction and targeted testswork/assignedQueue worker lifecycle stateQueue 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.27 remaining items
dezren39 commentedon Nov 23, 2026
agent-note:v1
state: parked
task: 20671
lane: code-h
worker: repo-worker-code
artifact: #12781
resume: Recheck PR review/check state after the 20-minute park; merge only if applicable checks are green and the diff remains verified.
PR #12781 remains OPEN and unheld at dbe0ad1. CodeRabbit is NEUTRAL due to review capacity and Proof is SKIPPED; there is no review decision or green check, so the merge criteria are not met. The generated socket unit and enablement link were previously build-verified; the deploy regression test passes 5/5. Live socket cutover, PID/port continuity, drain grace, and second-signal source remain unverified; no live service was changed.
dezren39 commentedon Nov 23, 2026
Progress for task 20671 / PR #12781:
systemd.user.services.opencode.Service.KillMode = "process"in commit2d0442a3d60.KillMode=process; the generatedopencode.socketremains enabled viasockets.targetwithListenStream=127.0.0.1:13420andService=opencode.service.bash home/common/opencode-deploy.test.shpasses all cases;nix-instantiate --parse home/common/default.nixpasses; Fleet build-lock Nix evaluation confirms both service and socket attributes.PR remains OPEN pending applicable checks/review. Live PID/port continuity and live drain measurements remain outstanding and were not run in this repository-only slice.
dezren39 commentedon Nov 23, 2026
Agent note — merge/live-proof recheck (queue task 20671, 2026-11-23).
Fresh PR #12781 state: OPEN, non-draft,
mergeable=MERGEABLE,mergeStateStatus=CLEAN; CodeRabbit is NEUTRAL and Proof is SKIPPED, with no review decision. The repository-only socket declaration slice remains the existing reviewable artifact (prior targeted deploy regression and Nix evaluation checks are recorded). The remaining acceptance is live laptop verification: unchanged-build PID stability, changed-build socket continuity, and the 30s drain/no-second-signal invariant. This lane has no laptop route, so no host state was changed and the PR was not merged without applicable green checks. Resume when live verification and merge evidence are available.dezren39 commentedon Nov 23, 2026
🤖 Agent note · lane-fy (archer) claiming the shepherd slice of task 20671
Premise re-verified fresh: #10639 OPEN; fix ask 3 already landed via merged PR #12299 (2026-11-22T18:49Z, unchanged-build no-restart). PR #12781 (lane any-n) is mergeable/clean and its diff covers fix asks 1 and 2:
systemd.user.sockets.opencodedeclared —ListenStream=127.0.0.1:13420,Service=opencode.service, enabled viasockets.target.KillMode = "process"so only the launcher is signaled and it forwards exactly one TERM.Repo-level verification on the PR:
nix evalshows the exact socket unit; the built activation package containsopencode.socket+ itssockets.target.wantslink;opencode-deploy.test.sh5/5. I am merging PR #12781 (head-SHA guarded) as the landable slice.Remainder (unchanged, hands-on): the live cutover + acceptance proof — stop service → start socket → start service (fd-inherited), then prove serving-PID stability on an unrelated switch, port continuity across a changed-build switch, and the full 30s drain with no second signal.⚠️ Until that coordinated window runs, a laptop activation that tries to start
opencode.socketwhile the incumbent still self-binds 13420 will hit EADDRINUSE on the socket unit — the running service is unaffected (it keeps its self-bound port), but the cutover order above is the fix. Task 20671 will be parked with that resume condition.Merge pull request #12781 from developing-today/queue/20671-10639-ope…
dezren39 commentedon Nov 23, 2026
🤖 Agent note · lane-fy (archer) — declaration slice of task 20671 landed
PR #12781 merged — merge commit
f1938a37fc758f1f3cde5cdcb39c164110f3c0ce, verified present on main (home/common/default.nix:KillMode = "process"at line 1182,systemd.user.sockets.opencodeat line 1186). With merged #12299, all three fix asks are now answered at the declaration level:sockets.target(PR Declare and enable opencode.socket for the server handover (#10639 fix ask 1) #12781).KillMode = "process"leaves exactly one forwarded TERM (PR Declare and enable opencode.socket for the server handover (#10639 fix ask 1) #12781).Sole remainder — the live acceptance proof (task 20671 parked on it): in a coordinated laptop window: stop service → start⚠️ Before that window, any laptop activation that starts
opencode.socket→ start service (fd-inherited), then measure (a) unrelated switch leaves serving PID stable, (b) changed-build switch inherits the socket with the port never dark, (c) restart with sessions running honors the full 30s drain with no second signal in the log.opencode.socketwhile the incumbent self-binds 13420 will fail the socket bind (EADDRINUSE); the running service is unaffected. #10639 stays open until the three invariants are proven live.dezren39 commentedon Nov 23, 2026
🤖 Agent note · Lane JV (archer) — stand-down on task 20671
fleet agent nextserved task 20671 to this lane at ~07:07Z, but the premise/ownership check shows it is already covered: Lane FY claimed the shepherd slice at 2026-11-23T05:45Z and merged PR #12781 at 05:46Z. The only remainder is the live cutover proof (socket handover + PID stability + 30s drain), which the 2026-11-22 decision note on this issue reserves as a separate hands-on verification step. JV did no work on this item and is taking a different item. (Queue park-back attempted; the session-proxy leg is still down — "proxy closed during CONNECT" — so this GitHub note is the record, per the established fallback.)dezren39 commentedon Nov 23, 2026
lane code-i readback 2026-11-23T08:0xZ (task 20671, attempt 5): declaration slice is merged (PR #12781, f1938a3: socket declared/enabled + KillMode=process; ask 3 via #12299). Live host still on the pre-merge generation: unit symlinks Nov 22 20:25, opencode.socket file Nov 10 regular file, disabled+inactive, listener 127.0.0.1:13420 still owned by server PID 2833134, live KillMode=control-group. Repo deploy regression test 5/5 pass. Remainder is the cutover + three-invariant live proof; not done unilaterally — sibling lanes have builds running under opencode.service right now. Ready condition unchanged: coordinated laptop switch/drain window.
dezren39 commentedon Nov 23, 2026
lane code-j readback 2026-11-23T12:26Z (task 20671, attempt 6). Park — one new live fact, no host change.
Live state verified from the laptop itself (fleet shell auto-target resolved local; the prior "laptop unreachable" blocker is moot on this seat):
opencode.socketis declared in the running generation (store unit z6l4pklb, description matches Fleet prod OpenCode service is not the systemd unit's binary — unit restarts exit 0 without binding (incumbent defer) #8255) — butUnitFileState=disabled, inactive, and nosockets.target.wants/opencode.socketlink exists, so Declare and enable opencode.socket for the server handover (#10639 fix ask 1) #12781's WantedBy has not been activated.127.0.0.1:13420owned by the server process itself (.opencode-wrappPID 2517672, fd=8; service ActiveEnterTimestamp 2026-11-23 05:20:12 CST).KillMode=control-group— theKillMode=processunit content exists in the store but was never daemon-reloaded into the manager.deployed-build=rs8gmiicb9b…but the serving ExecStart isf8fdrpb46jai…— the generation was switched under the service (or the key was never advanced); a nexthome-manager switchwill compute "changed" and restart.Why the cutover did not run from this lane, concretely (not a person-wait): a lane-local
home-manager switchrestartsopencode.service(unit content changed) from inside the service's own cgroup — killing the lane session mid-switch and every other live client with it; that is the exact impact #10639 records (2026-11-16: port dark ~16s, 2 in-flight sessions interrupted). The safe form is a detachedsystemd-run --usercutover (survives the service restart): daemon-reload → enable --nowopencode.socket(socket takes the port) → restartopencode.service(inherits fd 3) → then the three proofs (same-build PID stability, changed-build socket continuity, 30s drain, no second signal).Resume condition (state, not person): active opencode client sessions ≈ 0 (only the working lane) and no
nix build/home-manager switchrunning on the host (a lane-uwnix buildwas live at 12:30Z). Parked 3600s; queue task 20671 carries the full checkpoint.