Skip to content

laptop-agent daemon source reconciliation — prerequisite for M2 (#5769) #10131

Closed

Description

@dezren39

laptop-agent daemon source reconciliation — prerequisite for M2 (#5769)

Found by task 16852 revalidation (lane code-d, 2026-11-14): the M2 remainder ("land the laptop-agent services-layer definition in the code flake deploy registry") cannot be done honestly yet, because the daemon source is not in the code repo, and the copies that exist have diverged into two lineages:

  • Live lineage: ~/tools/laptop-agent-daemon.py (home repo, canonical) == laptop ~/laptop-agent/laptop_agent.py — carries the 2026-11-10 timeout semantics (per-exec process groups, disconnect reap) and trip logging v1 + v2 (code#5702, 2026-11-14). This is what actually runs (systemd user unit, :4799).
  • Vendored lineage: dezren39/darwin-nix pkgs/laptop-agent/src/laptop_agent.py (the package PR ops(dashboard): daily backups of dashboard/orchestration logs + stores — laptop, Google Drive, R2 #1459 builds) — carries features the live daemon lacks: job metadata persisted next to output with the index rebuilt on startup, and startup failing closed when the token is missing/empty/whitespace. It lacks the timeout semantics and trip logging.
  • Diff size at finding time: 1151 lines between the two laptop_agent.py files. Neither is a superset of the other.
  • The code repo itself contains no daemon source: the dezren39-nix/ tree inside a code checkout is a nested clone, not tracked code-flake source, so pkgs/deploy cannot reference it (a fresh code clone would not have it).

Work: reconcile the two lineages into ONE daemon source (union of: persisted job index + fail-closed token startup from the vendored side; process-group timeout semantics + trip logging v2 from the live side), vendor that source into the code repo (e.g. pkgs/laptop-agent/src/, following the darwin-nix package shape), prove behavior parity with a real client round-trip against the live daemon's surface (exec, jobs, cancel, health), and only then does the M2 definition + cutover sequence in #5769 become executable.

Until this lands, #5769's acceptance (one definition, cutover with rollback evidence) stays open; the brokers' definitions already exist in pkgs/deploy/services.nix and are unaffected.

Activity

  1. added
    task/small-fixQueue packet kind: bounded fix with reproduction and targeted tests
    app/pm-stackpm-stack (Pad/Grist) in developing-today/code
    on Nov 14, 2026
  2. developing-today commented on Nov 14, 2026

    @developing-today
    Contributor
  3. dezren39 commented on Nov 17, 2026

    @dezren39
    MemberAuthor

    Triage — task 19107, lane any-i, 2026-11-16: first triage of record for #10131. State: triaged; routed to implementation follow-on task 20480.

    Fresh verification (gh + laptop, 2026-11-17T06:40Z):

    Triage verdict:

    • Work kind: task/small-fix (already on the issue; queue packet kind small_fix).
    • Priority: priority/high — the laptop-agent daemon is the fleet's transport lifeline (Drew priorities brief line 1: keep the fleet able to work), its two source lineages diverging is a live risk (the 2026-11-16 daemon-death episode ran on this surface), and it gates M2.
    • Effort: effort/l — a union merge of two diverged 573/891-line lineages plus vendoring plus a parity round-trip.
    • First concrete step (follow-on task 20480): three-way feature inventory of both lineages (persisted job index + fail-closed token startup from vendored; process-group timeout semantics + trip logging from live), then the union source.
    • Acceptance check: one reconciled source vendored at pkgs/laptop-agent/src/ in the code repo, parity proven by a real client round-trip (exec, jobs, cancel, health), making Migration M2: one declaration for the fleet three (laptop-agent, secrets-broker, queue-broker) #5769's M2 sequence executable.

    Labels applied: priority/high, effort/l, status/triaged.

  4. added
    priority/highImportant and time-sensitive
    effort/lLarge: multi-day or open-ended; expect staged check-ins
    status/triagedTriaged and routed (see agent note)
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed
    status/triagedTriaged and routed (see agent note)
    on Nov 17, 2026
  5. dezren39 commented on Nov 17, 2026

    @dezren39
    MemberAuthor

    Agent note — picked up (lane any-f, task 20480)

    State: claimed — implementing the reconciliation in this session, following the triage of record (task 19107, lane any-i).

    Plan: (1) fetch both lineages and verify the live copies against each other (sandbox ~/tools/laptop-agent-daemon.py vs laptop ~/laptop-agent/laptop_agent.py); (2) three-way feature inventory from the diff; (3) union source on the live lineage as base (it is the operational truth) with the vendored features ported in (persisted job index, fail-closed token startup, plus anything else the inventory finds); (4) vendor into pkgs/laptop-agent/ in the code repo following the darwin-nix package shape; (5) parity round-trip against the reconciled source run on a test port (health, exec, jobs, cancel, plus restart persistence of the job index). The live daemon on :4799 is not touched by this task.

  6. added a commit that references this issue on Nov 17, 2026
  7. dezren39 commented on Nov 17, 2026

    @dezren39
    MemberAuthor

    DONE — task 20480, lane any-f. Laptop-agent daemon source reconciliation landed in PR #11015 (merged; merge sha bc1705fc4cc2a93b2eecb095ea0250cf5b1b0506).

    • One reconciled source now lives at pkgs/laptop-agent/src/laptop_agent.py carrying both lineages' feature sets — live: process-group timeout/cancel/disconnect semantics, trip logging v2, /file; vendored: persisted job index, fail-closed startup, framing 400s, job summaries, spool reaping, lifetime job slots, bytes-space auth — with package.nix in the darwin-nix shape.
    • Behavior parity proven on the laptop against the reconciled source (scratch port/state; the live daemon on :4799 was not touched): the vendored lineage's 65-test suite passes 65/65 in-tree, and a 19-check live-protocol round-trip (health/auth, exec argv+shell, timeout kill with no orphan, trip cancel, jobs lifecycle + kill, /file ranges, restart persistence, trips.jsonl) passes in full. Both test files are vendored under pkgs/laptop-agent/tests/.
    • Migration M2: one declaration for the fleet three (laptop-agent, secrets-broker, queue-broker) #5769 M2 is now executable: its stated prerequisite (this single reconciled source) exists. M2 itself was not started here.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

app/pm-stackpm-stack (Pad/Grist) in developing-today/codeeffort/lLarge: multi-day or open-ended; expect staged check-inspriority/highImportant and time-sensitivestatus:donetask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions