Repository navigation
Open
Labels
effort/lLarge: multi-day or open-ended; expect staged check-inskind/featureNew feature or capability requestpriority/highImportant and time-sensitive
Description
Phase 2 — shared primary + session sweep + grants (global reads, CAS conflicts, supported auth)
- Parent issue: Design: fleet kv — namespaced key-value store (local + global), blob offload to content-addressed R2 #10359 (items 2/4/5: central store, sweep survival, five-agent workload).
- Parent design: reviewed decision record (§1 hybrid central D014, §4 sweep, §5 CAS, §6 five-agent topology D008, §9 auth D011). Stable decision IDs: D003, D004, D005, D006, D007, D008, D011, D014 (D002 reversed/superseded — do not implement row-scopes-only).
- Prerequisite: design PR docs(fleet): settle namespaced KV storage, sweep and blob design (#10359) #13294 must merge before this phase starts. Depends on: Phase 1 Build: fleet kv phase 1 — local verbs, scoped SQLite and backup #13314 (local verbs + full-identity overlay + durable outbox); its implementation PR must be merged before Phase 2 implementation begins.
- Scope: shared Turso primary over the queue-style libSQL HTTP pipeline at configurable
FLEET_KV_URL(no hardcoded or fake deployed hostname); proposed migrations/handler paths (no code in this issue):pkgs/fleet/crates/fleet-kv/migrations/forkv_namespaces,kv_heads,kv_versions,kv_conflicts,idem_receipts,kv_grants, and pipeline handlers beside the existing queue HTTP handlers. Central key derivation per write/read: from the explicitly selected scope — the sharedscope_idof the namespace for authorized agents, or the privatescope_idof the owning(user, context)— resolved viakv_namespaces+kv_grants; no implicit extra fallback scope exists. - Scope: shared Turso primary over the queue-style libSQL HTTP pipeline; central key
(scope_id, registry_id, namespace, key)with one shared scope per shared namespace (shared-scope tombstones affect all shared readers; private scopes separate);kv_namespaceswith designation-onlyglobal_flag;kv_grantswith explicit-grant group DBs under fail-closed admission/provisioning policy (no default per-session proliferation; group DBs inline-only — no blob refs, ceiling checked before any group-DB write, blob-needing group writes refuse withblob_requires_shared_primary);--globalnow serves central (authoritative bypass); local-first reads (ordinary cache ≤ 1 s; miss/expiry refreshes or typedunavailable/stale,--allow-staleopt-in with age; overlay reads immediate offline) with local-override + mergedlist; durable sweep keyed(owner_user_id, context_id, session_id)via outbox + per-key CAS (≤ 5 attempts, jittered exp backoff capped at 1 s), receipts keyed(authenticated_writer, host_incarnation_UUID, outbox_UUID)+ immutable fingerprint; tombstones sweep through CAS; five-agent rule (single-writer-per-key CAS; KV CAS is not a queue lease — no leases/expiry/steal); 15-minute archive checkpoint TARGET (unbounded loss when offline/unarchived; archive carries inline payloads only up to the effective threshold — no Phase 3 upload here). Auth: RP/agent JWT or route-scoped service token to the trusted endpoint; secrets-broker fetch path is not request auth; per-user Turso data-plane tokens refused (data_plane_credential_refused). v1 operational integration ships here: migrations, credential wiring, grant-policy implementation, backup/restore runbook, health probes.
Acceptance
--global get/setround-trips against central; plaingetmerges local + central with stated origin marks and never silently hides the shadowed row;--globalbypasses the 1 s cache.- Sweep: session dirty set merges idempotently (re-run safe; retransmit with same key+fingerprint returns the stored result); two sessions racing one key produce one winner + one typed
conflict {expected, actual}with both versions retrievable — never silent last-writer-wins, never Turso Sync last-push-wins; rebase after conflict is a new intent/new id, never silent overwrite. CAS-before-ack order: receipt written atomically with CAS, ack after; crash between CAS and ack replays the recorded result, never a spurious new conflict. - Archive carries inline payloads only (≤ effective threshold) via the archive owner command
fleet kv backup(equivalentlyfleet kv sync --archivemode) plus the 15-minute online-checkpoint-target sweeper; over-threshold local-working bytes are reportedprotection_unavailable_needs_phase3, never uploaded — no blob upload exists before Phase 3. Over-ceiling bytes addressed to central before Phase 3 land typedpending_needs_phase3(queued intent, not a row), never silently buffered inline. Crash before ack re-sweeps fully. - Grants: a group DB exists iff a
kv_grantsrow authorizes it; unknown group/namespace refuses fail-closed; with no grant, everything lands on the shared primary. No per-session DB is provisioned by default. Group DBs accept inline bytes only: over-ceiling bytes addressed to a group scope refuse withblob_requires_shared_primary(shared-primary placement required, no auto-move), so no unrestricted write bypasses the ceiling. - Data-plane credential presented to the endpoint is refused with the typed rule, not an incidental signature failure; central access reuses the hosted RP/agent JWT or route-scoped service token path only.
- Load probe (REQUIRED, correctness-only fixture — not a latency/perf promise, and no billing claim): five writers × ~1–10 keys/min on a ~10k-key namespace all converge;
listpolling observes at most the documented 1 s staleness. - Done check from repository root:
cargo test --manifest-path pkgs/fleet/Cargo.toml -p fleet-kv centralruns the proposedcentral_*model/property/integration suite with a nonzero test count. It must include the five-agent fixture, scope isolation, clear-versus-sweep, same-ID/different-body refusal, duplicate delivery, archive restore, and expired-cache refusal. Also runcargo test --manifest-path pkgs/fleet/Cargo.toml -p fleet-kvto preserve Phase 1 behavior. A zero-match filter is failure, not evidence.
Oracles
- Property: CAS linearity — concurrent same-key writers serialize; the central head always equals one writer's full intent, never a blend; losers get typed conflicts. (PBT over concurrent CAS attempts.)
- Property: sweep idempotence — sweeping the same outbox twice changes central once. (PBT over duplicate deliveries.)
- Property: tombstone sweep convergence — delete-vs-write races resolve to a retrievable conflict or a tombstoned head, never resurrection-by-replay.
- Model: central head machine (version, parent_version, writer) against a sequential CAS oracle; sweep as an outbox-draining refinement of it.
{
"direct_parent": null,
"links": [],
"lineage": {
"design": null,
"roadmap_item": null,
"priority": null
},
"pm_meta": 1,
"provenance": {
"queue_id": null,
"scheduled_start": null,
"picked_up_at": null,
"work_started_at": null,
"created_at": "2026-11-23T13:22:18Z",
"session_id": "ses_e5df79277fdffep9u8FJIv4AqN",
"lane": null,
"host": "amd",
"worktree": "/home/user/.local/share/opencode/worktree/7c7733/lane-any-n-12892-fleet-kv-design",
"model": null,
"lane_start_issues": [],
"workspace_ref": {
"kind": "worktree",
"id": "/home/user/.local/share/opencode/worktree/7c7733/lane-any-n-12892-fleet-kv-design",
"repo": "developing-today/code",
"branch": "lane-any-n/12892-fleet-kv-design",
"sha": "5ac3ddcec60017b05b655b8fe665b06c61369ec3"
},
"auth_subject": "oc-code-06",
"stamped_by": "fleet 0.1.0 (native)"
}
}Related program: #10359
Metadata
Metadata
Assignees
Labels
effort/lLarge: multi-day or open-ended; expect staged check-inskind/featureNew feature or capability requestpriority/highImportant and time-sensitive
Activity
developing-today commentedon Nov 23, 2026
CODE-4858
dezren39 commentedon Nov 23, 2026
Filed by lane any-n under #10359, design task 21123 / parent 20571. Same-pass pilot coverage: repo-health-code-pilot task 21317 (queued); do not implement before design PR #13294 and the phase prerequisites are merged. This run publishes design/build handoffs only.
docs(fleet-kv): delivery update — phase issues, chain, signoff
dezren39 commentedon Nov 23, 2026
Triage verdict (task 21317, lane oc-code-02): valid build handoff, not yet implementable.
dezren39 commentedon Nov 23, 2026
Triage verdict (lane code-g, queue task 21320, 2026-11-23): valid phased build handoff under #10359 with concrete acceptance + oracles. NOT startable now: gate design PR #13294 is OPEN/unmerged, and phase-1 prerequisite #13314 is OPEN. Per the issue's own prerequisite clause, phase-2 implementation must wait for both. Parking the queue task with a ready-condition on #13294 merge; re-validate #13314's implementation PR at resume before any code work. No code changes made.
Merge pull request #13294 from developing-today/lane-any-n/12892-flee…
dezren39 commentedon Nov 23, 2026
Triage refresh (queue task 21320, lane agent-next-22-local, 2026-11-23): valid Phase 2 build handoff; still not startable.
This updates the earlier triage note that said design PR #13294 was open; the design gate has cleared, but Phase 1 has not.
dezren39 commentedon Nov 23, 2026
Related program: #10359. This phase delivers one of the three implementation stages from the accepted fleet-kv design.
dezren39 commentedon Nov 23, 2026
Triage refresh (queue task 21320, lane xaltha, 2026-11-23 ~14:30 UTC): valid Phase 2 build handoff; still not startable.
dezren39 commentedon Nov 24, 2026
Triage refresh (queue task 21320, lane code-h, 2026-11-24): valid Phase 2 build handoff; still not startable.
dezren39 commentedon Nov 24, 2026
Triage refresh (queue task 21320, lane code-i, 2026-11-24): valid Phase 2 build handoff; still not startable. Re-verified fresh: #13316 OPEN, design #13294 MERGED, Phase 1 #13314 OPEN. Only PRs referencing #13314 are #13362 (merged first slice) and #13294 (design) — no new Phase-1 implementation has merged. Phase 1 remainder from the #13314 record still stands. No code touched. Parked until #13314 closes; then revalidate #13316/#13314/#13294 before building.
dezren39 commentedon Nov 24, 2026
Triage 2026-11-24Z: #13316 OPEN (kind/feature, effort/l). Stated dependency verified: phase 1 #13314 OPEN (unimplemented); design PR #13294 MERGED (design settled, no design gap). Task 21320 blocked on #13314 with dep recheck; no code touched. Unblocks when #13314 closes.