Skip to content

design: move agent append streams (agent.events, agent.quota_records) from Supabase to Turso staging #5690

Open

Description

@dezren39

Design scope only — no data moves in this issue's first pass.

What moves

  • From: Supabase (muse-dev2) agent.events (158,802 live rows, 65.5 MB) and agent.quota_records (8,163 live rows, 3.9 MB)
  • To: Turso, staging tier (per §4 of the design doc), partitioned by day/work unit

Why

Both are append-only ledgers: in the stats window since 2026-10-29, agent.events shows 159,546 inserts / 0 updates / 3 deletes and quota_records is insert-only periodic plan/quota snapshots with a jsonb payload. The Scaler-era revision (§7 Phase A, §9.2) names exactly this shape — high-write append ledgers — as Turso staging-tier natives. Neither needs cross-row transactions or FK integrity.

Design doc: §9 of doc/2026-11-04T21-27-34Z_design_atlas_scaler_revision/ (PR #5667, addendum PR #5689).

Risks

  • agent.events is the heaviest-read table in the project (54M cumulative index scans since 2026-10-29) — its consumers are NOT yet audited; a blind move breaks whatever reads it (queue observability is the suspected reader).
  • Writers are live fleet systems (queue-broker path); dual-write cutover must not lose or reorder events.
  • quota_records.payload is jsonb — Turso side needs a JSON-column convention consistent with the staging schema versioning rule (§4.1).

Sketch of steps

  1. Consumer audit: enumerate every reader/writer of both tables (code search + pg_stat_statements).
  2. Define the staging-tier tables under the versioned staging schema; decide retention (events are a ledger — propose a rolling window with cold export).
  3. Dual-write from the producers, backfill, compare counts/checksums per day partition.
  4. Flip readers, observe one full fleet cycle, then stop the Postgres writes; keep the Postgres tables read-only for one retention window before any drop decision (separate approval).

Links: design doc PR #5667 · addendum PR #5689 · tracking dezren39/hatch-personal#21

Activity

  1. added
    queue/queuedHas a queued task in the Supabase agent queue
    task/triageQueue packet kind: verify, reproduce, and route this item
    on Nov 5, 2026
  2. dezren39 commented on Nov 5, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · handed off

  3. dezren39 commented on Nov 5, 2026

    @dezren39
    MemberAuthor

    Task 10126 (lane code-s) claimed and assigned to the opencode execution lane. Handed off to the opencode claimant — the bound session drives this task to its terminal state. Parked by this lane per the handoff protocol.

  4. added
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    status/parkedDeliberately paused with a recorded resume condition
    work/assignedQueue worker lifecycle state
    and removed
    queue/queuedHas a queued task in the Supabase agent queue
    on Nov 5, 2026
  5. dezren39 commented on Nov 5, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · handed off

  6. dezren39 commented on Nov 5, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · handed off

  7. added
    queue/claimedQueue worker lifecycle state
    and removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    on Nov 5, 2026
  8. 186 remaining items

  9. dezren39 commented on Nov 8, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · handed off

  10. developing-today commented on Nov 8, 2026

    @developing-today
    Contributor

    🤖 Agent note · handed off

  11. dezren39 commented on Nov 8, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · handed off

  12. removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    work/assignedQueue worker lifecycle state
    on Nov 8, 2026
  13. dezren39 commented on Nov 8, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · triaged (terminal)

    • Agent: queue worker (repo-worker-code), OpenChamber scheduled lane c8b9355e-319a-4640-8096-7ad19480d151
    • Session / ID: task 10126 · OpenCode session ses_e5e43533e9fffeelOYYBeNDjQo
    • Found via: atomic repo-queue claim

    Terminal outcome: triaged. The substantive triage verdict already posted on this issue at 2026-11-08T09:56Z stands — this note records the terminal state and re-verifies it fresh rather than re-triage from scratch (resume-don't-restart).

    Fresh re-verification (2026-11-08 19:41Z):

    • The verdict's design + build record is on main: doc/fleet/agent-events-turso.md.
    • The Turso sink is live and growing: events in fleet-queue held 61,755 rows, oldest 2026-11-07T05:07:08Z, newest 2026-11-08T19:40:51Z — 30,359 rows at the 09:54Z verdict, so ~31k rows appended in ~10h. The sink is running in production.
    • What remains is unchanged and gated: C4 (historical export at a watermark) needs a green PG window or a verified backup restore, and the PG-side decommission decisions are Drew's call after C4 verifies (doc §"What remains gated on PG recovery").

    Why no new packet and no user/escalated: the remaining gate is infrastructure availability (PG recovery) plus a decision already recorded in the design doc — neither is a fresh Drew escalation, and no queue task can advance either. Filing a triage or fix packet would duplicate work already built and running.

    Labels: all status/*, queue/*, work/* labels removed; task/triage (issue type) retained.

  14. dezren39 commented on Nov 9, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

  15. dezren39 commented on Nov 9, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done (already satisfied)

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

Metadata

Metadata

Assignees

Labels

task/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