GeezerVison is showing github.com — design: move agent mirror_* analytics (20 tables) from Supabase to Turso · Issue #5691 · developing-today/code
design: move agent mirror_* analytics (20 tables) from Supabase to Turso #5691DescriptionDesign scope only — no data moves in this issue's first pass.
What moves
- From: Supabase (
muse-dev2) — 20 agent.mirror_* tables (171,236 live rows, 136.9 MB): mirror_sessions, mirror_agent_agents, mirror_scheduler_jobs, mirror_scheduler_job_runs, mirror_goals_goals, mirror_goals_updates, the token/session/run/concurrency *_daily/*_hourly aggregates, mirror_top_daily, mirror_export_state, and peers
- To: Turso, core tier (internal sensitivity level per §4), topic = agent analytics
Why
This is the single largest block in the project and it is mirrored, derived analytics copied from Muse's local stores — rebuildable from source, aggregate-upsert shaped (e.g. mirror_token_usage_daily: 200,769 updates re-aggregating 27,191 rows in the window), with no FK or multi-writer transaction requirement. Under the §9 placement rule it never needed Postgres; it pays Postgres costs (size, vacuum, backup weight) for scan-shaped reads Turso serves natively.
Design doc: §9 of doc/2026-11-04T21-27-34Z_design_atlas_scaler_revision/ (PR #5667, addendum PR #5689).
Risks
- Open question (§9.4 Q1): is the mirror analytics/reporting (safe to move) or a backup of record? If backup, the Turso placement must keep the §7 nightly Drive cold-store export.
- The mirror writer (export pipeline keyed on
mirror_export_state watermarks) is a single producer whose Turso write path must respect the single-writer-per-DB rule — batch by export run, per §4's aggregator pattern.
- Aggregate tables are upsert-heavy, not append-only: the Turso design must use merge-on-export-run semantics, not naive row streaming.
Sketch of steps
- Confirm the mirror's purpose with Drew (§9.4 Q1) and inventory its readers (dashboards/reports).
- Design the Turso schema (one DB, internal tier; current-state tables + aggregate tables; export-run partitioning).
- Point the exporter at Turso in parallel (dual-publish), diff aggregate outputs against the Postgres mirror for several export cycles.
- Flip readers; stop the Postgres mirror writes; retain the Postgres copy read-only for one reporting cycle before any drop decision (separate approval). The 5 duplicate
mirror_history_* tables and 3 empty mirror shells are RETIRE class (§9.2) and are handled as cleanup, not migration.
Links: design doc PR #5667 · addendum PR #5689 · tracking dezren39/hatch-personal#21 Activitydezren39 commented on Nov 5, 2026 🤖 Agent note · handed off
dezren39 commented on Nov 5, 2026 🤖 Agent note · handed off
- Agent: queue worker (repo-worker-code), lane code-y
- Session / ID: task 10127
- Found via: queue claim
- Task: Triage of issue design: move agent mirror_* analytics (20 tables) from Supabase to Turso #5691 (design: move agent mirror_* analytics from Supabase to Turso) was claimed by lane code-y; the execution-lane assignment routed it to the opencode lane, so it is handed off — the laptop claimant (opencode-claimant) launches the bound opencode session that drives task 10127 to its terminal state.
- Expectation: claimant binds a session to task 10127; triage per the task packet.
- Links: task 10127 (queue repo-health-code-pilot)
developing-today commented on Nov 5, 2026 🤖 Agent note · handed off
- Agent: queue worker (repo-worker-code), lane code-o
- Session / ID: task 10127
- Found via: queue claim
- Task: Triage issue design: move agent mirror_* analytics (20 tables) from Supabase to Turso #5691 (design: move agent mirror_* analytics from Supabase to Turso) — assigned to the opencode execution lane again on re-claim (previously handed off at 2026-11-05T13:06Z, claimant had not launched before the park cycled); handed off to the laptop claimant, not worked by this lane. Issue verified OPEN this shift, no hard-stop labels.
- Expectation: claimant launches the bound opencode session for task 10127.
- Links: n/a
developing-today commented on Nov 5, 2026 🤖 Agent note · handed off / parked
- Agent: queue worker (
repo-worker-code), lane code-l
- Session / ID: queue task 10127
- Found via: atomic queue claim (lane code-l); execution-lane assignment returned
opencode, so per runbook §1b this task is handed off to the laptop opencode claimant — not worked directly by this lane.
- Task: triage design: move agent mirror_* analytics (20 tables) from Supabase to Turso #5691 — design: move agent mirror_* analytics (20 tables) from Supabase to Turso
- Revalidation (fresh, 2026-11-05T13:58:06Z, via developing.today GitHub App token): issue OPEN, no hard-stop labels (state/labels: OPEN task/triage,status/parked,queue/parked,work/assigned).
- Action: task 10127 parked as handed off; the claimant launches the bound opencode session to do the work.
dezren39 commented on Nov 5, 2026 🤖 Agent note · handed off
dezren39 commented on Nov 5, 2026 🤖 Agent note · handed off (again)
dezren39 commented on Nov 5, 2026 🤖 Agent note · handed off
dezren39 commented on Nov 14, 2026
Agent note — task 16843 blocked as escalated-to-user (lane any-c, 2026-11-14)
Why this lane did NOT execute the packet's head step: the packet (from task 15276's triage, 2026-11-08T08:54Z) says the exporter cron is "paused" and step 1 is to re-enable it. That premise is stale. The fleet record shows:
- 2026-11-07 (memory/2026-11-07.md): runtime-db-export "STAYS PAUSED; unpausing remains Drew's call".
- 2026-11-08 18:19 CST (memory/2026-11-08.md, TASK-LIST RULINGS): Drew ordered items 14–19 of the disabled-jobs list deleted — runtime-db-export among them — and the deletion was executed the same evening (cron.remove; definition archived to
workspace/cron.d/_archive/[email protected]). Verified this shift: the job is absent from the live scheduler (cron.update answers "schedule does not exist"); its tools and state survive intact at ~/tools/runtime-db-export/.
Recreating or unpausing that job from a lane would override Drew's own recorded order, so the decision comes back to Drew as the ledger item above: recreate the exporter (the archived body is byte-preserved and the repointed loader is proven), or retire #5691's remainder formally.
Parity re-verification (this shift, read-only, 2026-11-14):
- Postgres
agent.mirror_*: 229,390 rows across 28 tables; exporter state last runs 2026-11-06 12:48–23:08Z — Postgres writes already stopped (the write-stop step of the remainder has happened in fact).
- Turso
fleet-mirror agent_mirror_*: 219,166 rows across 21 tables; export state last runs 2026-11-06 12:23Z – 2026-11-07 04:07Z — the shadow is frozen at the migration copy.
- Per-table deltas are fully explained: Postgres ran a few more exporter cycles on 2026-11-06 evening than the Turso copy (e.g. agent_agents +1,593, token_usage_hourly +1,484, sessions +1,454), and the 7 absent Turso tables are the history/shell tables the migration deliberately did not copy (the loader creates them on first use). No unexplained divergence.
- Readers: no live code in the repo reads the Postgres
agent.mirror_* tables (only the exporter's retired *_pg loader references them) — the reader cutover is complete in effect; both mirrors have simply been frozen since 2026-11-06/07 while the runtime DB moved on.
Net state: the migration's data plane is consistent and stopped; what is missing is not fleet work but Drew's decision on whether the runtime DB export exists at all going forward. #5691 stays open; task 16843 is blocked escalated-to-user with the ledger item as the gate, so the Wave 1 gate on task 14736 reads honestly. dezren39 commented on Nov 16, 2026 Agent note - done (triage disposition executed). Agent: queue worker (repo-worker-code), lane code-a. Session/ID: task 16843. Found via: queue claim. The pending decision is answered: pending-decisions ledger item runtime-db-export-5691-recreate-or-retire, answered 2026-11-15 - Retire the exporter remainder formally. Executing that disposition: (1) The mirror stays a frozen 2026-11-06/07 snapshot - Turso muse-mirror holds the 20 agent_mirror tables (219,105 rows at copy, parity verified; re-verified read-only 2026-11-14 at 219,166 rows with all deltas explained, no live code reads the Postgres mirror tables, Postgres writes already stopped since 2026-11-06). (2) The runtime-db-export job stays deleted per Drew 2026-11-08 order; it is not recreated. (3) The Postgres agent.mirror tables (28, incl. history and shells) go to the #6581 cleanup gate - noted on #6581 in this pass; they are not dropped here. (4) Q1 was decided by Drew 2026-11-06: mirror is analytics + backup-of-record, satisfied by the frozen Turso copy plus cold-store record. Design delivered (PRs #5667/#5689), migration executed to the frozen snapshot, remainder retired by decision - this issue is complete and closes. Wave 1 task 14736 remains gated on issue #5692, which is still OPEN. dezren39 commented on Nov 16, 2026
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|