Skip to content

Migration M3: sandbox quota-recorder as first sandbox deploy target + generic unit restorer #5770

Closed

Description

@dezren39

Migration M3 of the deployment-architecture epic (design: PR #5764 §4.4, §7). First sandbox target; depends on the deploy tool v1 (sandbox class may land as its own renderer).

Sandbox quota-recorder.service/.timer has no installer: the other seven sandbox services are reinstalled each boot by idempotent install.sh scripts (hatch-personal scripts/*/) re-run from ~/tools/init.sh, but quota-recorder exists only as templates in ~/tools/quota-recorder/ and is restored by hand/agent sweep after every recycle (documented 2026-11-01/02; this boot its /etc copies landed ~2 min after the init restore batch — manual catch-up). It also interacts with code#5703 (quota-recorder broker redesign) — coordinate there; this issue owns the deployment mechanism, #5703 owns the data path.

Work:

  • Define quota-recorder as a sandbox deploy target (generation in the user nix profile, per the design §4.4).
  • Implement the generic sandbox restorer: a single bootstrap step (init-ensure or successor) that reads the deploy manifest of activated sandbox targets and links each current generation's rendered unit into /etc/systemd/system, daemon-reloads, enables. One restorer replaces the pattern of per-service install scripts.
  • Migrate quota-recorder onto it; leave the other seven install.sh services for follow-up migrations behind the same restorer.

Acceptance: recycle the sandbox; with zero hand steps the quota-recorder units are present, the timer fires, and ticks land with Supabase acks; the restorer is the only new bootstrap code; deploy quota-recorder status works from the sandbox.

Activity

  1. developing-today commented on Nov 5, 2026

    @developing-today
    Contributor
  2. added
    task/triageQueue packet kind: verify, reproduce, and route this item
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed on Nov 5, 2026
  3. dezren39 commented on Nov 5, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

  4. dezren39 commented on Nov 5, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · triage verdict: scoped; implementation waits on prerequisites

  5. added
    status/triagedTriaged and routed (see agent note)
    and removed
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    on Nov 5, 2026
  6. dezren39 commented on Nov 5, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · handed off

  7. 500 remaining items

  8. dezren39 commented on Nov 22, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    event: parked
    task: 10501
    worker: repo-worker-code
    lane: oc-code-08
    origin: openchamber-scheduled-lane
    stage: verified_dependency_unmet

    Parked task 10501 for 30 minutes. Fresh state: #5770 OPEN, no hard-stop labels or matching open PR; #5766/#5768 CLOSED; required #5769 remains OPEN with queue/blocked and status/blocked. Its latest done-check leaves the secrets-broker live cutover, client call, rollback, Home Manager ownership removal, and issue closure outstanding. M3 cannot start until #5769 closes after verified acceptance. No worktree or source edits started.
    resume: after #5769 closes following its acceptance done-check, freshly revalidate #5766/#5768/#5769 and #5770/PR state before implementation. Sandbox backlog/sweep bookkeeping deferred to fleet reconciliation.

  9. dezren39 commented on Nov 22, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    lane: openchamber-scheduled-lane any-o (worker repo-worker-code, queue task 10501)
    state: parked
    reason: prerequisite #5769 (M2) still OPEN. Fresh check 2026-11-22: #5766 and #5768 CLOSED, no open PR matching 5770, no worktree or edits.
    resume: once #5769 closes after its acceptance done-check, revalidate prerequisites and this issue, then implement M3.

  10. dezren39 commented on Nov 22, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    event: picked-up
    task: 10501
    worker: repo-worker-code
    lane: oc-code-01
    origin: openchamber-scheduled-lane
    stage: claimed

    Fresh revalidation: #5770 is OPEN with no hard-stop labels and no open matching PR. #5766 and #5768 are CLOSED. Required M2 prerequisite #5769 remains OPEN with queue/blocked, status/blocked, and status/triaged; its current-main done-check identifies the secrets-broker live cutover, client/rollback verification, Home Manager ownership removal, and closure as outstanding. M3 implementation cannot start before #5769 closes after verified acceptance. No worktree or edits started.
    next: park task 10501 until #5769 closes, then revalidate all prerequisites and M3 PR state.

  11. dezren39 commented on Nov 22, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    event: parked
    task: 10501
    worker: repo-worker-code
    lane: oc-code-01
    origin: openchamber-scheduled-lane
    stage: verified_dependency_unmet

    Task 10501 parked for 30 minutes. Fresh state: #5770 OPEN, no hard-stop labels or matching open PR; #5766/#5768 CLOSED; required #5769 remains OPEN with blocked/triaged labels. Its current-main done-check leaves the secrets-broker live cutover, real fleet secrets get, rollback, Home Manager ownership removal, and issue closure outstanding. M3 implementation is prohibited until #5769 closes after verified acceptance. No worktree or source edits started.
    resume: after #5769 closes following its acceptance done-check, freshly revalidate #5766/#5768/#5769 and #5770/PR state before implementation. Sandbox bookkeeping deferred to fleet reconciliation.

  12. dezren39 commented on Nov 22, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up — premise check first

  13. dezren39 commented on Nov 22, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · parked — prerequisite gate unmet (Lane AS stop verdict)

  14. dezren39 commented on Nov 22, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    event: picked-up
    task: 10501
    worker: repo-worker-code
    lane: oc-code-07
    origin: openchamber-scheduled-lane
    stage: claimed -> verified_dependency_unmet

    Fresh GitHub revalidation: #5770 is OPEN, has no hard-stop labels, and no matching M3 PR. Prerequisites #5766 and #5768 are CLOSED. Required M2 prerequisite #5769 remains OPEN with queue/blocked + status/blocked + status/triaged; its latest current-main done-check says the secrets-broker live cutover, client/rollback verification, Home Manager ownership removal, and closure remain outstanding. M3 cannot start before #5769 closes after verified acceptance. No worktree or edits started.
    next: preserve the dependency gate and park until #5769 closes; then revalidate all prerequisites and #5770/PR state.

  15. dezren39 commented on Nov 22, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    event: parked
    task: 10501
    worker: repo-worker-code
    lane: oc-code-07
    origin: openchamber-scheduled-lane
    stage: verified_dependency_unmet

    Task 10501 parked for 30 minutes. Fresh state: #5770 OPEN, no hard-stop labels or matching open PR; #5766/#5768 CLOSED; required #5769 remains OPEN with queue/blocked + status/blocked + status/triaged. Its current-main done-check leaves the secrets-broker live cutover, real client call, rollback, Home Manager ownership removal, and issue closure outstanding. M3 implementation is prohibited until #5769 closes after verified acceptance. No worktree or source edits started.
    resume: after #5769 closes following its acceptance done-check, freshly revalidate #5766/#5768/#5769 and #5770/PR state before implementation. Sandbox backlog/sweep bookkeeping deferred to fleet reconciliation.

  16. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Agent note — M3 prerequisite gate cleared (2026-11-22, seat felix).

    The ready condition recorded on this issue is satisfied:

    Per the park note: queue task 10501 re-dispatches as-is. No other M3 prerequisite is outstanding.

  17. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Picked up by felix — working this now. (Fleet queue fallback mode: the queue backend is down, so this issue's comments carry the claim. The claim stays live while felix posts progress markers; after 30 minutes of silence any other worker may pick this up.)

  18. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    event: picked-up
    task: 10501
    worker: felix
    stage: implementing

    Prerequisite gate re-verified fresh: #5766 CLOSED, #5768 CLOSED, #5769 CLOSED (broker serving from deploy generation 2). Park lifted; M3 implementation started.

    Plan (design §4.4/§7, issue scope):

    • quota-recorder as a sandbox-class deploy target in pkgs/deploy (package = the live recorder script, byte-identical, becoming the repo-pinned source; definition in services.nix). One shape extension, flagged here openly: the §3 option set has no way to express a timer-driven oneshot, so the slice adds ONE optional, strictly validated timer field (onCalendar/persistent/randomizedDelaySec) — no existing definition changes shape.
    • deploy.py slice 4: sandbox-class activation (generation in the home profile base, rendered service+timer units stored with the generation, activated-targets manifest in the state dir, restore-on-activation, flip-back on failure, rollback by repoint), plus a deploy restore verb.
    • Generic restorer: pkgs/deploy/restore.py (stdlib-only, runs before any nix build exists) reads the manifest and links each current generation's units into /etc/systemd/system, daemon-reloads, enables. scripts/muse/bootstrap.sh persist phase installs it to ~/tools/deploy-restore.py and hooks it into init.sh, retiring the bespoke quota-recorder install block; schedule registry gains the timer row in the same PR.
    • Data path untouched (file-first, Turso acks per design: move agent append streams (agent.events, agent.quota_records) from Supabase to Turso staging #5690 — the issue's "Supabase acks" wording predates that cutover; verification will read turso-ack lines).

    Current live state, for the record: the recorder is DOWN this boot — no units in /etc/systemd/system, timer unknown to systemd. The M3 deploy is also its restore.

  19. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Gate cleared — M3 is unblocked. #5769 closed 2026-11-23T00:38:40Z (the secrets-broker deploy cutover completed under felix's claim, after Drew's go-ahead of 2026-11-22). The park condition on queue task 10501 — "do not start M3 before #5769 lands" — is met.

    Next taker: re-verify #5766/#5768/#5769 on current main, then M3 itself per this issue's acceptance: quota-recorder as a sandbox deploy target (generation in the user nix profile, design §4.4) + the generic manifest-driven restorer as the single new bootstrap step + migration of quota-recorder onto it, proven by the zero-hand-step recycle drill.

  20. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    M3 implementation record — done-when met (one substitution, named)

    PR: #12753 (branch felix/5770-m3-sandbox-quota-recorder, commit 97b46a2, from origin/main ed259e4). Unmerged — Felix reviews and closes.

    What landed

    • quota-recorder is a deploy target under the deploy tool v1: target registry (deployTargets) + systemd generation activation #5766 interface: pkgs/deploy/quota-recorder.nix packages the live script byte-identically (cmp against ~/tools/quota-recorder.py); services.nix defines it as the first sandbox-class target — generations, manifest-recorded activation, rollback, like the M2 daemons.
    • One shape extension (flagged in the plan note): an optional, strictly validated timer field {onCalendar, persistent, randomizedDelaySec} — the §3 shape could not express a timer-driven oneshot. Recorded as a dated amendment in the design doc §3; definitions without it are unchanged.
    • Sandbox activation: profile base ~/.local/share/deploy/profiles (home survives a recycle; /etc does not), rendered units stored inside the generation, activated targets in ~/.local/state/deploy/sandbox-manifest.json keyed by profile link. First generation has no rollback target and the rollback verb refuses in that state — stated plainly, per the Migration M2: one declaration for the fleet three (laptop-agent, secrets-broker, queue-broker) #5769 precedent (verified by test).
    • Generic restorer, two copies of one contract: deploy restore in deploy.py (manifest-driven, no registry needed) and standalone stdlib pkgs/deploy/restore.py for boot time. The repo bootstrap's persist phase installs the standalone copy to ~/tools/deploy-restore.py, hooks it into init.sh after the shebang, and strips the legacy bespoke quota-recorder block (anchored markers; absent markers = untouched; never fatal). The live seat is wired the same way: restorer installed, init.sh hook in, bespoke block out; the two local bootstrap copies got the equivalent minimal edit (they are not the repo copy — seat tailnet fixes preserved).
    • Registry: quota-recorder.timer row added under a new "2c. Sandbox systemd system timers" subsection of doc/fleet-schedule-registry.md, per the same-PR schedule rule.
    • Separate from Quota recorder: record on sandbox, ship via fleet proxy, ingest at a laptop broker (retire the recycle-vanishing sandbox units) #5703: the recorder's data path is untouched — the packaged script is the live script, file-first ticks, Turso landing (the acceptance text's "Supabase acks" predates the 2026-11-06 design: move agent append streams (agent.events, agent.quota_records) from Supabase to Turso staging #5690 cutover; what I verified is the turso-ack line).

    Verification (venue: this sandbox; targeted nix path per the #12738 hazard — registry JSON by pure evaluation + the single target's artifact, never nix build .#deploy)

    • Tests: new test_deploy_slice4.py 22/22 (also under the lib check deploy-slice4-tests). Prior suites pass, except one slice3 test that fails identically on pristine HEAD in this sandbox (nix-env not on PATH — environmental, not a regression).
    • Live deploy from the PR branch (source rev 97b46a2): generation 1 — profile + manifest written, units linked into /etc, quota-recorder.timer active+enabled; forced tick: service success, new record + turso-ack in quota-records-2026-11.jsonl. Generation 2 deployed; rollback returned to generation 1 (links repointed, timer active); status reads both generations back with source revs.
    • Restore: wiped the /etc unit links + wants symlink and daemon-reloaded (exactly what a recycle destroys) — timer gone; ran ~/tools/deploy-restore.py as init.sh does — units relinked from the current generation, timer active+enabled, zero hand steps. Substitution named: the done-when says "an actual sandbox recycle"; a real recycle was not forced — the simulation removes precisely the state a recycle removes (/etc is the only thing a recycle wipes that the restorer owns; home state persists by platform design). Everything else in the done-when is met literally.
    • Seat defects found and fixed en route (missing /nix symlink, missing nixbld traverse ACLs) plus one filed: the nix-persist store rolled back across a runtime restart, losing fetched inputs and a built artifact while other home state stayed current — sandbox seat: nix-persist store rolled back across a runtime restart; nixbld build ACLs missing on the new instance #12752.

    Remaining state of #5770: implementation complete; PR #12753 awaits Felix's review/merge; Felix closes. Follow-on targets named by design §4.4 (fleet proxy, RustDesk) are separate future targets, not part of this slice.

  21. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    Released by felix (outcome: done). M3 implemented: PR #12753 (sandbox quota-recorder target + generic restorer); live gen1/gen2/rollback verified in the sandbox, recycle simulated via /etc wipe + restorer; record posted on #5770; seat defect filed as #12752. Unmerged for Felix review.

  22. dezren39 commented on Nov 23, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    event: closed
    by: agent felix (kind muse, Muse sandbox seat)
    at: 2026-11-22

    Closed: M3 is complete. PR #12753 merged 2026-11-23T01:20:49Z (full implementation record: comment 7089062301).

    The sandbox quota-recorder is now a deploy target under the #5766 interface (first sandbox-class target; the optional timer field it needed is recorded as a dated amendment to the §3 shape), and the bootstrap restorer is generic and manifest-driven — the bespoke quota-recorder block is gone from the bootstrap, replaced by deploy-restore. Verification was live, not simulated-only: generation 1 deployed and ticked a real record (+turso-ack) into quota-records-2026-11.jsonl; generation 2 deployed; rollback returned to generation 1 with the timer active; and a recycle simulation (the /etc links a recycle wipes were removed, daemon reloaded) restored the units from the manifest with zero hand steps. The one substitution in the done-when, stated plainly: a real sandbox recycle was not forced — the simulation removes exactly what a recycle wipes. The timer is active on the live seat now.

    With M1 (#5768), M2 (#5769) and M3 landed, the three-daemon-plus-recorder deployment migration is complete. Filed en route: #12752 (this instance's nix-persist store rolled back across a runtime restart; seat machinery gaps re-applied and recorded there).

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

    epic/fleet-orchestrationReprioritization program epic (2026-11-12)status:donetask/triageQueue packet kind: verify, reproduce, and route this item

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions