GeezerVison is showing github.com — Quota recorder: record on sandbox, ship via fleet proxy, ingest at a laptop broker (retire the recycle-vanishing sandbox units) · Issue #5703 · developing-today/code
Quota recorder: record on sandbox, ship via fleet proxy, ingest at a laptop broker (retire the recycle-vanishing sandbox units) #5703DescriptionQuota recorder: move the Supabase write to the laptop (design + recommendation)
Current state (verified 2026-11-04)
- The sandbox quota recorder runs from systemd units installed by
~/tools/quota-recorder/ (its timer + service). Like every /etc/systemd/system unit, they vanish on every sandbox recycle and must be reinstalled — today that reinstall is a manual/cron-assisted step (the 2026-11-04 15:08 boot check found them missing again post-recycle and reinstalled them from ~/tools/quota-recorder/, after which ticks resumed with Supabase acks).
- The recorder writes usage snapshots to Supabase (muse-dev2) from the sandbox, which means the sandbox side holds/uses the Supabase write path directly.
- Recycles are frequent (six boots on 2026-11-04 alone), so "reinstall after recycle" is a recurring failure surface, and a missed reinstall = a silent gap in the quota record the burn plan depends on.
Proposal (Drew's question, 2026-11-04)
Split the recorder the same way the queue and secrets already work:
- Sandbox side: record-only. A small local writer appends quota observations to a local spool (JSONL under
~/tools/quota-recorder/ state or ~/.local/state/quota-recorder/). No Supabase credentials, no network write on the sandbox. Survives recycles by construction (the spool lives in /home/hatch, which persists).
- Ship via the fleet proxy. Batches move sandbox → laptop through the existing fleet session proxy, the same transport every other broker call uses.
- Laptop side: broker-owned ingest. A laptop endpoint (a
fleet serve role alongside queue-broker :4801 / secrets-broker :4800, or an ingest route on an existing broker) owns the Supabase connection and performs the insert — credentials live only on the laptop, exactly like the queue-broker holding the Supabase credentials for queue operations today.
- Ack + trim: the laptop acks batch ids; the sandbox trims its spool only on ack. A laptop-off window (e.g. 2026-11-04 evening, laptop powered down) becomes a growing local spool, not lost data — recording continues and ships when the laptop returns.
Evaluation vs. status quo
|
Status quo (sandbox units → Supabase direct) |
Proposed (spool → proxy → laptop broker) |
| Survives recycle |
No — units vanish; reinstall is a step that can be missed |
Yes — no unit needed for recording; shipper can be an init-ensure-style prelude check or a tiny timer reinstalled by the same mechanism as other fleet units |
| Credentials on sandbox |
Yes (Supabase write path) |
No — laptop-only, matching the queue/secrets pattern |
| Laptop off |
Recorder still writes (Supabase is remote) |
Recording continues to spool; ingest pauses; no loss |
| Failure visibility |
Missing ticks noticed by the boot check |
Spool depth + last-ack age are directly measurable; alert on spool age |
| New machinery |
— |
One laptop ingest endpoint + batch/ack protocol (small; mirrors trip-log ingest follow-on on #5343) |
Recommendation
Adopt the proposal. The deciding factors: the recycle-vanish reinstall already failed once today and will keep failing on the same cadence; the credential placement matches the fleet's established broker pattern; and the spool design converts the laptop-off case from data loss risk into mere delay. The one real cost — ingest pauses while the laptop is off — is acceptable because the quota data is consumed on planning timescales (the burn plan reads snapshots, and the gatherer already tolerates staleness by design: a stale read never idles a pool).
Acceptance / next steps
- Local spool writer on the sandbox replacing the direct-write recorder; format = the existing snapshot payload, one JSON object per line, batch id per ship.
- Laptop ingest endpoint with ack; idempotent on batch id (replays after a crash are expected).
- Shipper on the sandbox (fleet-proxy transport) with spool trim-on-ack and a last-ack watermark.
- Boot check updated: instead of "reinstall the units," it verifies spool freshness + last ack; a stale ack surfaces like today's missing-timer finding.
- Old sandbox units retired once the new path has produced a week of clean acks.
Related: #2072 (unified quota attribution/observability) covers the read/attribution side; this issue is only about the recorder write path and where the Supabase connection lives.
Acceptance criteria
- The quota recorder runs on the sandbox and ships records via the fleet proxy to ingestion at a laptop broker, per the design in this issue.
- The retired Supabase path is removed or explicitly disabled, with no silent dual-writing.
- Recorded quota data matches the previous recorder's output for the same inputs (parity spot-check recorded on the issue).
Activitydezren39 commented on Nov 5, 2026 Intake review
Related: part of the quota-pipeline batch filed 2026-11-04 23:12–23:18Z (see also #5704). Notes: this retires a Supabase dependency for quota records in favor of sandbox-record + fleet-proxy ship + laptop-broker ingest. Risk: dual-running or a silent gap during cutover would corrupt the quota history the dispatch gates read. Suggested approach: build the ship/ingest path behind the current recorder, parity-check outputs, then retire the old path in the same change.
Validation: filed within the last hour and reviewed against its own body this run; no merged PR resolves it (the work it describes has not been implemented). Acceptance criteria appended to the body; labels normalized by the fleet monitor.
🤖 Agent note · intake enrichment
- Agent: fleet monitor (repo-fleet-monitor)
- Session / ID: monitor run 2026-11-04 18:12 CST
- Found via: monitor reconciliation
- Task: Duty 2 intake enrichment (protocol §5)
dezren39 commented on Nov 5, 2026 🤖 Agent note · handed off
- Agent: queue worker lane D (repo-worker-code), job repo-queue-worker-shift-d
- Session / ID: task 10137
- Found via: queue claim (repo-health-code-pilot, lane code-d)
- Task: Triage issue Quota recorder: record on sandbox, ship via fleet proxy, ingest at a laptop broker (retire the recycle-vanishing sandbox units) #5703 — Quota recorder: record on sandbox, ship via fleet proxy, ingest at a laptop broker. Issue verified OPEN fresh 2026-11-05, no hard-stop labels.
- Expectation: execution lane is
opencode — the laptop claimant launches the bound opencode session for task 10137, which drives it to a terminal state under this queue's worker id.
- Links: task 10137 (queue); issue Quota recorder: record on sandbox, ship via fleet proxy, ingest at a laptop broker (retire the recycle-vanishing sandbox units) #5703
developing-today commented on Nov 8, 2026 🤖 Agent note · handed off
- Agent: fleet monitor (repo-fleet-monitor)
- Session / ID: task 10137; repo-fleet-monitor run 2026-11-08 06:12 CST
- Found via: monitor reconciliation (Duty 1 claim/label divergence auto-repair)
- Task: Claim evaporation repaired: task 10137 sits
queued unclaimed in repo-health-code-pilot (attempts 12, no live lease) while this issue carried queue/claimed + work/assigned + status/in-progress from an earlier claim whose run ended without a terminal verb. Labels reset to the truth: queue/queued + status/needs-triage. The task is queued and claimable; the next lane to claim it should checkpoint from the issue's existing notes and PRs, if any.
- Expectation: a queue lane claims task 10137 and triages/routes this issue per its packet.
- Links: Quota recorder: record on sandbox, ship via fleet proxy, ingest at a laptop broker (retire the recycle-vanishing sandbox units) #5703
dezren39 commented on Nov 9, 2026 🤖 Agent note · handed off
dezren39 commented on Nov 9, 2026 agent-note:v1 task 10137 lane code-t: picked up and handed off to opencode claimant (lane row 2913). Verified fresh: issue #5703 OPEN labels=['task/triage', 'status/parked', 'priority/normal', 'queue/parked', 'work/assigned', 'effort/l', 'meta/enriched', 'kind/enhancement']; ; no hard-stop labels. Next: claimant launches the bound opencode session. dezren39 commented on Nov 9, 2026 agent-note:v1 — task 10137, lane code-p, stage handed_off: execution lane assigned opencode (lane row 2913); handed off to the opencode claimant per runbook 1b. Fresh check: issue #5703 OPEN, no hard-stop labels. Next: claimant launches the bound opencode session for task 10137. dezren39 commented on Nov 9, 2026 Triage at current main 1e0860e43d (task 10137, 2026-11-09)
Verdict: superseded for the design as written. The failure modes that motivated this issue are already fixed, but by a different mechanism than the proposal — file-first spool + direct Turso sink + fleet secrets by name, landed 2026-11-06/07 — not by a laptop ingest broker. The one genuine residual (step 4's staleness signal) is split out to #8022. Closing with evidence; reopen if the broker hop specifically is still wanted (scoped delta at the bottom).
What this issue asked for, against what exists now
| # |
Design step |
State |
| 1 |
Local spool writer on the sandbox, existing snapshot payload, JSONL |
Done. tools/quota-recorder.py is file-first: every tick appends one JSON object to ~/workspace/goals/stewardship-commission-recurring-review-and-dispatch/hidden_files/visibility/quota-records-YYYY-MM.jsonl under home (survives recycle). DB is the secondary sink. |
| 2 |
Laptop ingest endpoint with ack, idempotent on batch id |
Superseded. No broker: the sink is agent_quota_records in Turso fleet-platform via the libsql HTTP pipeline, PK (source, id, ts), INSERT OR IGNORE — replay-safe without a batch-id handshake. |
| 3 |
Shipper with trim-on-ack and a last-ack watermark |
Done, better than proposed. Unsent is derived from the file alone (records newer than the last ack's through); each tick flushes all unsent records in the current and previous month, then appends turso-ack {through, count} or turso-error {error, pending}. No destructive trim; a laptop-off window is plain backlog. |
| 4 |
Boot check verifies spool freshness + last ack |
Half done → #8022. #6148 (closed 2026-11-05) added the init restore block (~/hatch/tools/init.sh ~L401-433) plus tools/quota-recorder/install.sh; a missing/stopped timer is now caught. Nothing yet notices an active timer that is not landing records. |
| 5 |
Retire the old sandbox units once a week of clean acks |
N/A by construction. The units are still how the recorder runs (that is fine — #5770 owns making them a proper deploy target); what was retired is the Supabase write path and its standing credential. |
Evidence
- Storage premise is gone.
agent.quota_records: Supabase → Turso, design: move agent append streams (agent.events, agent.quota_records) from Supabase to Turso staging #5690 Wave 3. PR gather-quota: cut quota_records sink from Supabase to Turso (Wave 3, #5690) #6655 (merged 2026-11-07) moved the PM gatherer sink and explicitly "pairs with the quota-recorder.py sink flip (same table, source muse-subscription)". The docstring of tools/quota-recorder.py records the cutover date (2026-11-06, "Drew's order"). There is exactly one DB sink; pre-cutover supabase-ack/supabase-error receipt lines are still parsed so old history stays valid — no dual-write.
- Credential placement goal is met without a broker hop. The Turso RW token is fetched by name (
turso.fleet-platform-rw-token) at flush time through fleet secrets get — secrets-broker first, i.e. the laptop broker is already in this path — and never stored. The sandbox holds no standing DB credential. That was the proposal's deciding argument for moving the write to the laptop.
- Recycle-vanish is fixed elsewhere. init: quota-recorder units have no restore block — lost on every sandbox recycle #6148 closed 2026-11-05 with the init restore block (verified present in
~/hatch/tools/init.sh today, plus install.sh in ~/tools/quota-recorder/). Migration M3: sandbox quota-recorder as first sandbox deploy target + generic unit restorer #5770 (open, parked) owns the deployment mechanism and says so explicitly: "this issue owns the deployment mechanism, Quota recorder: record on sandbox, ship via fleet proxy, ingest at a laptop broker (retire the recycle-vanishing sandbox units) #5703 owns the data path." The deployment doc (doc/2026-11-04_deployment-architecture-services-layer.md L6, L389) records the same split.
- No ingest broker exists in the repo, and none is needed for the goals.
fleet serve roles are queue-broker, secrets-broker, search (pkgs/fleet/crates/fleet-registry/src/registry.rs ~L231-246); there is no quota/ingest role, and no quota-recorder code in this repo at all (the implementation lives in the hatch tools repo, by design — the laptop copy is a mirror, see laptop hatch-tool copies drift from the sandbox primaries: quota-recorder FLEET path broken on laptop, hatch-dispatch-clone runtime-db-export is a stale partial copy #6830). Adding one would put the laptop in the write path and reintroduce the laptop-off pause the design's own table accepts as a cost and the Turso path avoids entirely.
- Failure visibility, measured today on the laptop mirror: the mirror's own run shows the fail-soft contract working — a broken FLEET path produced
"kind": "turso-error" ... "pending": 1 and the record stays in the file for retry (laptop hatch-tool copies drift from the sandbox primaries: quota-recorder FLEET path broken on laptop, hatch-dispatch-clone runtime-db-export is a stale partial copy #6830 covers the laptop-path defect itself; the sandbox is the live home).
Blockers and ordering (for the reopen case: if the broker hop is still wanted)
- Blocked by design: move agent append streams (agent.events, agent.quota_records) from Supabase to Turso staging #5690 — the quota_records store is still mid-migration (Turso staging tier, PG top-up/drop outstanding). A broker ingest endpoint would have to target whichever tier wins; building it now is churn.
- Ordered after Migration M3: sandbox quota-recorder as first sandbox deploy target + generic unit restorer #5770 — the sandbox unit/deploy path (generic unit restorer) is the delivery vehicle for any shipper timer; Quota recorder: record on sandbox, ship via fleet proxy, ingest at a laptop broker (retire the recycle-vanishing sandbox units) #5703's "shipper can be an init-ensure-style prelude check" presumes Migration M3: sandbox quota-recorder as first sandbox deploy target + generic unit restorer #5770's restorer.
- Ordered after laptop hatch-tool copies drift from the sandbox primaries: quota-recorder FLEET path broken on laptop, hatch-dispatch-clone runtime-db-export is a stale partial copy #6830 — laptop/sandbox clone drift and the broken laptop
FLEET resolution must be settled first, or the shipper inherits the same "which copy is live" defect.
- Residual now tracked in quota-recorder: alert on spool staleness / last-ack age (residual of #5703 step 4) #8022 (spool freshness / last-ack alert), which needs none of the above.
Anyone reopening: the scoped delta is one fleet serve role (ingest, ack protocol) + a sandbox shipper that ships the already-ack-watermarked spool and drops the direct Turso call; everything else in this issue is already in production.
Related: #5690 (Turso move), #5770 (deploy target), #6148 (unit restore, closed), #6830 (clone drift / laptop FLEET path), #1175 (read-side freshness), #8022 (this issue's residual), #2072 (read/attribution side).
🤖 Agent note · triaged and closed
dezren39 commented on Nov 9, 2026 Agent note - done (already_done / superseded). Agent: repo queue worker, lane code-h (repo-worker-code). Session: cron repo-queue-worker-shift-h run 2026-11-09 04:25 CST; task 14358. Found via: claimed task 14358 this shift (lane stamp code-h verified); execution-lane assignment returned opencode (lane row 5580), but fresh revalidation supersedes routing. Task: task 14358 for issue #5703 (small_fix). Fresh revalidation: issue #5703 CLOSED, stateReason COMPLETED, closed 2026-11-09T09:53:43Z by dezren39; triage comment 6737120606 on task 10137 found the design superseded (file-first spool + direct Turso sink landed 2026-11-06/07), residual split to issue #8022. No hard-stop labels present. Outcome: completing task 14358 as already_done; no PR, no branch. Links: task 14358, issue #5703, issue #8022.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|