You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Fleet unification slice 5: local coordination replica for database-down resilience #8583
Parent design: #8575 (one door, one home per fact — fleet tool state unification). Slice 5 of 7. Approved by Drew 2026-11-11: implement in full.
Work
Database-down resilience for coordination:
Run a Turso embedded replica of the coordination tables on the laptop, so claims, leases, and heartbeats continue against the local copy when the cloud database or the broker path is unreachable.
The fleet tool detects database failure itself and switches to the replica without lane involvement (contract from slice 3), reporting db-degraded mode.
On recovery, the replica syncs back up; any claims made locally are reconciled against the cloud store — a claim honored locally is honored globally, and double-claims across the partition are detected and reported, never silently merged.
Behind the replica, the existing GitHub-marker fallback mode remains the last resort.
Acceptance
A drill: database made unreachable mid-shift; lanes keep claiming and working against the replica; on restoration, sync completes with zero lost claims and any partition double-claims surfaced in a report.
The replica's data passes the wipe test by construction: it holds coordination only (per slice 1's classification).
Priority: priority/high - Priorities brief line 1 (keep the fleet itself able to work: a dead queue/broker path outranks feature work) and line 4 (Drew's named programs: the four repos healthy). This slice is part of Drew-approved (2026-11-11) fleet unification parent Design: one door, one home per fact — the fleet tool owns every route and every fallback #8575, the queue/broker resilience program.
First concrete step: Stand up a Turso embedded replica of the coordination tables on the laptop so claims, leases, and heartbeats continue against the local copy when the cloud database is unreachable.
Acceptance check: A drill: database made unreachable mid-shift; lanes keep claiming and working against the replica; on restoration, sync completes with zero lost claims and any partition double-claims surfaced in a report.
Fix packet: - Fix packet: task 14911 in repo-health-code-pilot (dedupe repo-health:v1:fix:developing-today/code:issue:8583, priority 20, kind small_fix, queued; signal refreshed).
Dependency gate declared on task 14911 (fleet queue dep-block, broker rechecks every 15 min, max TTL 3 days). Slice 5's own text names its two unlanded inputs: item 2 switches to the replica 'without lane involvement (contract from slice 3)' — slice 3 is #8581, itself dep-blocked today (task 14909) on slices 2 and 5 — and the acceptance holds the replica to 'coordination only (per slice 1's classification)' — slice 1 is #8579, the wipe-test schema audit, also OPEN and unlanded (verified fresh 2026-11-11: all seven #8575 slices open, no mirror/replica/contract code in the fleet tooling). The replica's table set is exactly what slice 1 classifies, and its failover surface is exactly what slice 3 declares; building either half against guesses would force rework across three slices. Note the interlock is circular by construction (#8581 lists this slice as an input too): the program order that unblocks everything is slice 1 first, then slices 2/3/5 against its classification. This task returns to the pool automatically when #8579 and #8581 close.
🤖 Agent note · picked up — queue task 21043 (packet #12538), lane lane-ap (archer)
Slice picked: the durable local replica. The packet's dependency order is #8581 contract → #8583 replica → #8584 backups. The contract half is settled on main (PR #12601 mode contract, PR #12638work::routing + CoordinationReplica, both verified — see #8581's slice record), and #8584's tooling landed today (PR #12685); its remainders are operator-session work. The next unfinished implementation slice is therefore this issue's replica, exactly the step every prior park on #8583/task 14911 named as the resume action ("after PR #12638 merges with compile/tests verified, implement the replica against the landed interface" — that condition is now met).
Scope of this slice (bounded): a CoordinationReplica implementation backed by a durable local SQLite store (SqliteReplica, rusqlite bundled — the same stack atlas-core already pins), in fleet-queue next to the contract, with the caller's clock supplied exactly as MemoryReplica takes it. Claim/heartbeat/checkpoint semantics and sync_up reconciliation (a local claim is applied to the cloud store on sync; a divergent cloud holder surfaces as a double-claim, never silently merged; zero lost claims) are checked against an explicit model oracle over generated operation sequences — the same MBT shape as the MemoryReplica proptest in work/routing.rs — plus a reopen test: a claim recorded before the store is closed is still held after it is reopened (the durability MemoryReplica cannot offer).
Not in this slice (named remainders, in order): (1) route the claim/lease/heartbeat verbs through route_for and emit mode_line on their outputs (#8581 remainder 1 — the adapter that would call this replica); (2) the live #8583 drill (cloud made unreachable mid-shift against the real Turso store, sync on restoration) — it needs the adapter in (1) and a live-store session; (3) Turso-native embedded-replica sync (libsql) if the SQLite store's reconciliation proves insufficient — the trait is the boundary either way.
PR #12692 merged (fc72fada01c6f7cbbd41abce6791a3fd79ff7007) — the durable local replica this issue was parked waiting for now exists on main: work::sqlite_replica::SqliteReplica in fleet-queue implements the CoordinationReplica interface settled by #12638, backed by a local SQLite store (rusqlite bundled, gated on the queue-broker feature alongside turso_queue). Claims, leases, and checkpoints persist in the store across restarts; the store holds coordination only, so the wipe test passes by construction. sync_up reconciles against an attached cloud store: a claim honored locally is applied to the cloud store (honored globally), a task the cloud view holds for a different (worker, lane) surfaces in double_claims and is never silently merged or applied, and lost_claims stays empty by construction. Semantics match MemoryReplica exactly — caller-supplied clock, (worker, lane) identity, injected cloud view consumed by the sync.
Verification (fleet-run, nix develop .#fleet, the AGENTS.md command cargo test --locked -p fleet-queue --lib --features client,queue-broker):
Failing-first: commit a463302 landed the oracle tests against a stub returning Unavailable — fleet-run 45077366316: 0 passed, 10 failed, every failure the stub error.
With the implementation (head d284da8): fleet-run 45077676146: 477 passed, 0 failed — all 10 new replica tests green, including the model-oracle proptest (sqlite_replica_matches_model_over_generated_sequences, the ModelReplica state machine from work/routing.rs as the named oracle, compared on every step of generated op sequences) and the reopen-durability test; the 139 turso_queue tests in the run confirm the feature-gated surface actually executed.
What of #8583's acceptance remains (issue stays open), in order:
Verb adapter — route the claim/lease/heartbeat verbs through route_for and emit mode_line on their outputs (Fleet unification slice 3: fleet verb contract v2 — routes and degraded modes in the tool #8581 remainder 1), so a verb actually lands on this replica when the database leg fails and the tool reports db-degraded itself, without lane involvement. Nothing calls SqliteReplica yet.
The live drill — the acceptance drill (database made unreachable mid-shift; lanes keep claiming against the replica; on restoration sync completes with zero lost claims and partition double-claims in a report) needs (1) plus a live-store session against the real Turso database; the drill harness in this slice reconciles against a file-backed cloud stand-in.
Turso-native embedded sync — if store-level reconciliation proves insufficient in the drill, implement sync via libsql's embedded replica behind the same trait; the trait is the boundary either way.
Broker redeploy: not needed — a new library module behind the existing feature; no broker-served behavior changed and nothing calls it yet.
PR #12706 merged (7817b4effccd584bd2c0aabbb101e5fbc2fe2af3). The adapter now routes the coordination verbs through route_for and emits mode_line on their outputs: claim (single/batch/guard outcomes), heartbeat, and checkpoint carry {verb, mode, route} on the cloud path, and the #6741 fallback switch envelope carries db-degraded / github-markers on the primary-store failure path — a verb now reports the route it actually used, itself, without lane involvement. Full record, verification (failing-first 3 passed / 2 failed against the stub; 480 passed / 0 failed on the laptop and independently in fleet-run 45081347079), and the client-side-only confirmation are on #8581: (see lane-av2's completion note there).
One boundary of this slice, stated plainly: nothing calls SqliteReplica from the client yet, and this slice did not change that — the client holds no local replica, so on a dead store the selected route is honestly github-markers, the route the fallback switch hands the work to. Serving verbs from the replica is the remaining adapter work and is a precondition of the live drill below.
What of this issue's acceptance remains (issue stays open), in order:
Client/broker replica wiring — decide where SqliteReplica is served from (client-held store vs broker-side) and wire the coordination verbs to land on it when the database leg fails, so the reported route becomes local-replica in fact.
The live drill — the acceptance drill (database made unreachable mid-shift; lanes keep claiming against the replica; on restoration sync completes with zero lost claims and partition double-claims in a report) needs (1) plus a live-store session against the real Turso database.
Turso-native embedded sync — only if store-level reconciliation proves insufficient in the drill; the trait is the boundary either way.
Broker redeploy: not needed for this slice — client-side only, confirmed on #8581's record.
Named blocker of record: the slice-3 contract from #8581 (fleet verb contract v2 / coordination-replica interface), which this slice's implementation waited on.
Evidence the gating contract landed, verified first-hand via gh GraphQL this sweep:
Action: queue/blocked removed, queue/queued added. #8581 remains open for its own remaining scope, but the contract this slice was blocked on is on main and this slice's core deliverables have landed; any remainders are this issue's own work.
Activity
developing-today commentedon Nov 11, 2026
CODE-2569
dezren39 commentedon Nov 11, 2026
🤖 Agent note · triaged
dezren39 commentedon Nov 11, 2026
agent-note:v1
state: blocked (dependency)
lane: code-c (task 14911)
issue: #8583
Dependency gate declared on task 14911 (fleet queue dep-block, broker rechecks every 15 min, max TTL 3 days). Slice 5's own text names its two unlanded inputs: item 2 switches to the replica 'without lane involvement (contract from slice 3)' — slice 3 is #8581, itself dep-blocked today (task 14909) on slices 2 and 5 — and the acceptance holds the replica to 'coordination only (per slice 1's classification)' — slice 1 is #8579, the wipe-test schema audit, also OPEN and unlanded (verified fresh 2026-11-11: all seven #8575 slices open, no mirror/replica/contract code in the fleet tooling). The replica's table set is exactly what slice 1 classifies, and its failover surface is exactly what slice 3 declares; building either half against guesses would force rework across three slices. Note the interlock is circular by construction (#8581 lists this slice as an input too): the program order that unblocks everything is slice 1 first, then slices 2/3/5 against its classification. This task returns to the pool automatically when #8579 and #8581 close.
150 remaining items
dezren39 commentedon Nov 22, 2026
🤖 Agent note · picked up — queue task 21043 (packet #12538), lane lane-ap (archer)
Slice picked: the durable local replica. The packet's dependency order is #8581 contract → #8583 replica → #8584 backups. The contract half is settled on main (PR #12601 mode contract, PR #12638
work::routing+CoordinationReplica, both verified — see #8581's slice record), and #8584's tooling landed today (PR #12685); its remainders are operator-session work. The next unfinished implementation slice is therefore this issue's replica, exactly the step every prior park on #8583/task 14911 named as the resume action ("after PR #12638 merges with compile/tests verified, implement the replica against the landed interface" — that condition is now met).Scope of this slice (bounded): a
CoordinationReplicaimplementation backed by a durable local SQLite store (SqliteReplica, rusqlite bundled — the same stack atlas-core already pins), infleet-queuenext to the contract, with the caller's clock supplied exactly asMemoryReplicatakes it. Claim/heartbeat/checkpoint semantics andsync_upreconciliation (a local claim is applied to the cloud store on sync; a divergent cloud holder surfaces as a double-claim, never silently merged; zero lost claims) are checked against an explicit model oracle over generated operation sequences — the same MBT shape as theMemoryReplicaproptest inwork/routing.rs— plus a reopen test: a claim recorded before the store is closed is still held after it is reopened (the durabilityMemoryReplicacannot offer).Not in this slice (named remainders, in order): (1) route the claim/lease/heartbeat verbs through
route_forand emitmode_lineon their outputs (#8581 remainder 1 — the adapter that would call this replica); (2) the live #8583 drill (cloud made unreachable mid-shift against the real Turso store, sync on restoration) — it needs the adapter in (1) and a live-store session; (3) Turso-native embedded-replica sync (libsql) if the SQLite store's reconciliation proves insufficient — the trait is the boundary either way.test(fleet-queue): #8583 sqlite replica oracle tests, implementation …
feat(fleet-queue): implement the #8583 SQLite coordination replica
feat(fleet-queue): durable SQLite coordination replica for #8583 (#12692
dezren39 commentedon Nov 22, 2026
🤖 Agent note · slice landed — queue task 21043 (packet #12538), lane lane-ap (archer)
PR #12692 merged (
fc72fada01c6f7cbbd41abce6791a3fd79ff7007) — the durable local replica this issue was parked waiting for now exists on main:work::sqlite_replica::SqliteReplicain fleet-queue implements theCoordinationReplicainterface settled by #12638, backed by a local SQLite store (rusqlite bundled, gated on thequeue-brokerfeature alongsideturso_queue). Claims, leases, and checkpoints persist in the store across restarts; the store holds coordination only, so the wipe test passes by construction.sync_upreconciles against an attached cloud store: a claim honored locally is applied to the cloud store (honored globally), a task the cloud view holds for a different (worker, lane) surfaces indouble_claimsand is never silently merged or applied, andlost_claimsstays empty by construction. Semantics matchMemoryReplicaexactly — caller-supplied clock, (worker, lane) identity, injected cloud view consumed by the sync.Verification (fleet-run,
nix develop .#fleet, the AGENTS.md commandcargo test --locked -p fleet-queue --lib --features client,queue-broker):a463302landed the oracle tests against a stub returningUnavailable— fleet-run 45077366316: 0 passed, 10 failed, every failure the stub error.d284da8): fleet-run 45077676146: 477 passed, 0 failed — all 10 new replica tests green, including the model-oracle proptest (sqlite_replica_matches_model_over_generated_sequences, theModelReplicastate machine fromwork/routing.rsas the named oracle, compared on every step of generated op sequences) and the reopen-durability test; the 139turso_queuetests in the run confirm the feature-gated surface actually executed.What of #8583's acceptance remains (issue stays open), in order:
route_forand emitmode_lineon their outputs (Fleet unification slice 3: fleet verb contract v2 — routes and degraded modes in the tool #8581 remainder 1), so a verb actually lands on this replica when the database leg fails and the tool reportsdb-degradeditself, without lane involvement. Nothing callsSqliteReplicayet.Broker redeploy: not needed — a new library module behind the existing feature; no broker-served behavior changed and nothing calls it yet.
feat(fleet-queue): route the coordination verbs through route_for and…
dezren39 commentedon Nov 22, 2026
🤖 Agent note · remainder 1 (verb adapter) landed — lane lane-av2 (archer)
PR #12706 merged (
7817b4effccd584bd2c0aabbb101e5fbc2fe2af3). The adapter now routes the coordination verbs throughroute_forand emitsmode_lineon their outputs: claim (single/batch/guard outcomes), heartbeat, and checkpoint carry{verb, mode, route}on the cloud path, and the #6741 fallback switch envelope carriesdb-degraded/github-markerson the primary-store failure path — a verb now reports the route it actually used, itself, without lane involvement. Full record, verification (failing-first 3 passed / 2 failed against the stub; 480 passed / 0 failed on the laptop and independently in fleet-run 45081347079), and the client-side-only confirmation are on #8581: (see lane-av2's completion note there).One boundary of this slice, stated plainly: nothing calls
SqliteReplicafrom the client yet, and this slice did not change that — the client holds no local replica, so on a dead store the selected route is honestlygithub-markers, the route the fallback switch hands the work to. Serving verbs from the replica is the remaining adapter work and is a precondition of the live drill below.What of this issue's acceptance remains (issue stays open), in order:
SqliteReplicais served from (client-held store vs broker-side) and wire the coordination verbs to land on it when the database leg fails, so the reported route becomeslocal-replicain fact.Broker redeploy: not needed for this slice — client-side only, confirmed on #8581's record.
dezren39 commentedon Nov 23, 2026
Block lifted — stale-block sweep, 2026-11-23 (Survey B, archer).
Named blocker of record: the slice-3 contract from #8581 (fleet verb contract v2 / coordination-replica interface), which this slice's implementation waited on.
Evidence the gating contract landed, verified first-hand via gh GraphQL this sweep:
CoordinationReplicainterface inwork::routing. This is the contract this issue's own 2026-11-22 claim note (lane lane-ap) recorded as settled on main.Action:
queue/blockedremoved,queue/queuedadded. #8581 remains open for its own remaining scope, but the contract this slice was blocked on is on main and this slice's core deliverables have landed; any remainders are this issue's own work.