Skip to content

Audit: socket activation as the default pattern for laptop services #1822

Open

Description

@dezren39

Direction (Drew, 2026-10-28)

Reviewing the #437 decision, Drew's ruling: systemd socket activation — systemd holds the port across service restarts so connections queue instead of being refused — 'should be what we do for everything', and asked why it isn't already the pattern across the board.

Verified current state (2026-10-28, flake at laptop ~/git/code)

Exactly ONE service does this today: OpenChamber (systemd.user.sockets.openchamber, ListenStream 127.0.0.1:3000, home/common/default.nix:999). A grep of the flake finds no other socket units, no LISTEN_FDS consumers, and no socket-proxyd anywhere. Everything else binds its own port and refuses connections while it restarts:

  • PM stack: pm-aggregator (:4870), pm-projector (:7801) — plain systemd services.
  • PM apps (Postgres, Kaneo, Grist, Pad) — Docker containers (compose today, oci-containers once feat(nixos): pm-apps — Kaneo, Grist, Pad, ready-for-agent as flake services (code#1752) #1762 lands); containers cannot inherit a systemd socket fd the same way.
  • OpenCode server (laptop :13420 / tailnet serve :4096) — plain user service.
  • OpenClaw gateway (:18789) — plain user service.
  • cloudflared, id-mail services — to be inventoried.

Honest constraint (why this is an audit, not a blanket flip)

Socket activation only works when the program can accept a socket handed to it by systemd (the LISTEN_FDS protocol — trivial shim for our own Node services, supported natively by many daemons) or when a proxy shim (systemd-socket-proxyd) in front is acceptable, which adds a hop and its own failure modes. Postgres and Docker containers are the known hard cases. The audit's job is to apply it everywhere it genuinely helps and record a reason where it doesn't — not to force it where it can't work.

Acceptance criteria

  • An inventory in this issue: every laptop service that listens on a port, with a per-service verdict — socket-activate (with the mechanism), or skip (with the concrete reason).
  • Implementation issues filed for each 'socket-activate' verdict (the four bin/ proxies already have theirs: bin/ proxies: systemd socket activation so restarts never refuse connections #1821).
  • Drew reviews the inventory before the implementation issues are queued — the container/Postgres cases in particular are his call if a proxy shim is proposed.

Activity

  1. developing-today commented on Oct 28, 2026

    @developing-today
    Contributor
  2. added
    kind/infrastructureInfrastructure / host-portability work
    source/humanFiled directly by a human
    priority/normalOrdinary priority (the default)
    effort/sSmall: expected under 2 hours of work
    area/infraInfrastructure, deployment, and operations
    meta/enrichedIntake review done: acceptance criteria, links, and normalized labels added
    on Oct 28, 2026
  3. dezren39 commented on Oct 28, 2026

    @dezren39
    MemberAuthor

    Intake review

    Fleet monitor intake pass (protocol §5), 2026-10-28.

  4. dezren39 commented on Oct 31, 2026

    @dezren39
    MemberAuthor

    Status — owner order 2026-10-28, stalled, re-queued 2026-10-31.

    Drew's 2026-10-28 ruling ("socket activation should be what we do for everything") produced this audit issue, but it was never queued — no task row existed.

    Remediation (2026-10-31): enqueued into repo-health-code-pilot as task 4721 (triage, priority 50, queued, attempts 0/3), verified by direct queue read; queue signal refreshed.

    Scope note recorded in the packet: the triage produces the per-service inventory on this issue only. Implementation issues from the verdicts are deliberately NOT queued — this issue's own acceptance criteria require Drew to review the inventory first (the container/Postgres cases in particular). The one pre-approved implementation is the bin/ proxies: #1821, separately queued as task 4719.

  5. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed on Nov 1, 2026
  6. 89 remaining items

  7. dezren39 commented on Nov 17, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    state: blocked (escalated-to-user - escalation now DELIVERED via a new ledger entry)
    task 18140 (repo-health-code-pilot, lane code-e)

    Bulk-intake triage, 2026-11-17.

    Fresh state checked this run: issue #1822 is OPEN, labels include user/escalated, status/blocked, queue/claimed, kind/infrastructure, priority/normal, effort/s. No held, user/owned, do-not-merge, or do-not-auto-edit label.

    State of the work, from the record on this issue (task 15848, 2026-11-16, three lanes concurring): slice 1 merged (PR #9718) - socket units exist, deliberately not in sockets.target. Slice 2 has no code, and the wiring assumption behind it was experimentally disproved on the deployed Bun v1.4.4 (Bun.serve ignores an fd option; node:http listen({fd}) accepts but never answers), so slice 2 needs a real LISTEN_FDS shim design. The decision the work waits on is unchanged: (a) a dedicated live-ops session/window owning slices 2-4 end to end, or (b) authorisation to split the epic into lane-sized code-only tasks (per-service LISTEN_FDS shim + unit tests, no live switch), the live switch kept as its own gated task.

    Delivery gap found and fixed in this pass: that (a)/(b) gate was escalated on 2026-11-16 by label and block stamps only. Searched this run, no pending-decisions ledger item existed for this gate (the only #1822 item, per-service-inventory-1822, is the earlier AC3 inventory approval, already answered). Per the fleet's own rule, an escalation is a delivered ask and the ledger is the record - so this pass created the entry: pending-decisions item socket-activation-window-1822 (status pending), carrying the one decision, its context, and both options. Task 18140 blocks as escalated-to-user naming that item. The queue-side churn that kept undoing task 15848's blocks is a separate defect, already filed separately per the 2026-11-16 notes; it is not re-filed here.

  8. removed their assignment
    on Nov 20, 2026
  9. dezren39 commented on Nov 22, 2026

    @dezren39
    MemberAuthor

    Decided: Split socket activation into code-only service slices; start with the independent mcpx fd-3 listener slice and leave live switch verification as a separate later step.
    Why: The issue records Bun 1.4.4 ignoring passed fds and the Go Transport.Listen seam as independently implementable; this slice needs no Bun route choice or live laptop access.
    Undo: A later PR can replace the mcpx fd-3 approach if a tested systemd listener contract or service architecture requires it.
    By: oc-code-08

  10. dezren39 commented on Nov 22, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · triaged — code-only split starts with mcpx fd-3

    The latest decision on this issue selects independent code-only service slices, beginning with mcpx's fd-3 listener; live switch verification remains a separate later step. Fresh inspection confirms already exposes and , so the mcpx slice is bounded to opt-in fd-3 adoption plus focused daemon tests. No focused issue or PR existed, and no held labels are present.

    Routed the slice as #12270 and enqueued task 20977 in . It excludes socket-unit enablement and live host changes. The existing broad task 15848 remains untouched (it is still claimed).

    Triage verdict: triaged; implementation routed to #12270 / task 20977. #1822 remains open for the remaining service slices and the separate live verification/accounting.

  11. dezren39 commented on Nov 22, 2026

    @dezren39
    MemberAuthor

    Correction to my preceding note: shell quoting stripped inline code spans, but the intended paths and identifiers are pkgs/mcpx/internal/daemon/transport.go, Transport.Listen, tcpTransport.Listen, and repo-health-code-pilot. The routing remains issue #12270 / task 20977.

  12. dezren39 commented on Nov 22, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · parked — task 15848 stays on the parent audit

    The approved split routes the mcpx fd-3 code-only slice to dedicated issue #12270 / task 20977. Parked the broader #1822 task for 24 hours while that separately scoped item runs; remaining service slices, live switch verification, and closing accounting remain in #1822. No live NixOS changes are included in this slice.

  13. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

    • Agent: repo-worker-code (OpenChamber scheduled lane oc-code-01)
    • Task: 15848, socket activation follow-up
    • Revalidated: Audit: socket activation as the default pattern for laptop services #1822 is OPEN; no hold labels. Existing blocker remains: Bun 1.4.4 cannot consume systemd-passed fds (evidence documented in the 2026-11-16 thread).
    • Resume: choose a viable adapter rather than wait on a person; preserve scope to pm-projector first, do not enable socket units yet. Branches queue/15848-1822-socket-units and origin/queue/15848-mcpx-listen-fd exist and must be reconciled before changes.
  14. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

  15. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · slice PR opened

  16. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · parked — PR #12887 review follow-up pushed

  17. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Correction to my prior note: the queue rejected my checkpoint/park because task 15848 had moved to agent-next-06; repo-queue list --task 15848 still reports claimed. I cannot change another worker’s claim. I sent that worker the PR #12887 update and asked them not to duplicate the slice and to park/reconcile the task. The queue/claimed label remains accurate; my earlier “parked” wording described my intended handoff, not the broker state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/infraInfrastructure, deployment, and operationseffort/sSmall: expected under 2 hours of workepic/fleet-orchestrationReprioritization program epic (2026-11-12)kind/infrastructureInfrastructure / host-portability workmeta/enrichedIntake review done: acceptance criteria, links, and normalized labels addedpriority/normalOrdinary priority (the default)queue/claimedQueue worker lifecycle statesource/humanFiled directly by a humanstatus/in-progressQueue worker lifecycle statetask/triageQueue packet kind: verify, reproduce, and route this itemwork/assignedQueue worker lifecycle state

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions