Skip to content

fleet-queue: verb routing through the client replica + sync_up broker adapter (#16874) - #16912

Merged
dezren39 merged 1 commit into
mainfrom
felix/16874-replica-verb-routing
Nov 29, 2026
Merged

dezren39 merged 1 commit into
mainfrom
felix/16874-replica-verb-routing

Conversation

@developing-today-fleet

@developing-today-fleet developing-today-fleet Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Refs #16874 — items 1–3 (the serving half of the #8583 client replica). Item 4 (the deployed-environment drill) remains open on #16874 and is #8583's last acceptance item, so this PR does not close the issue.

Design decisions (production claim selection; population/refresh semantics and cadence; sync adapter reconciliation semantics) are recorded on #16874 per FDR-0013: #16874 (comment)

What lands

1. Verb routing through the replica. On a store-down outcome (transport failure or an ok:false envelope — the new non-exiting transport::call_routed), claim / heartbeat / checkpoint give the local replica its chance to serve before the #6741 fallback switch:

  • claim serves the shapes the replica can honor from a coordination-only snapshot: an unscoped pick in the production order, or a single --task by-id claim (the dispatch path). Batch, --bind, --handoff, --from-session, --manual-override, --filter, --pool, --remaining-budget-minutes, and queue-scoped picks keep the fallback switch untouched — serving them from the snapshot would silently drop broker-side predicates.
  • heartbeat / checkpoint serve against the local lease; a foreign (worker, lane) gets the not-held refusal (exit 5, the require_row code) as a machine-readable envelope.
  • Replica-served outputs carry the honest mode line via the new mode_report::legs_store_down_replica (db-degraded / local-replica); the fallback switch keeps reporting github-markers, the route it actually hands work to. mode_report's leg-honesty docs are updated to match.

2. Snapshot population trigger. An unscoped, unfiltered full list refreshes the replica snapshot from the rows it already fetched (refresh_client_snapshot) — no verb gains a broker round trip, and a scoped/filtered listing never replaces the snapshot with a partial view.

3. sync_up broker adapter. Reconciliation against the real broker, written against a narrow seam (BrokerClaims: row read + claim-by-id) so it is unit-testable with a fake broker; the production seam uses the plain transport. The cloud view is one scoped rich /list read per locally held task id; unheld claims replay through claim-by-id (/claim with task_id); refusals are resolved by one re-read. Double-claims are reported and never replayed over; a claim that did not survive is reported in lost_claims, never hidden. The report surfaces as replica_sync on the first broker-served claim/heartbeat/checkpoint that reconciles anything, best-effort (a sync failure never fails the verb). SqliteReplica gains an additive local_claims() accessor (its sync_up now uses it too) so the adapter can enumerate the claims it reconciles.

Tests

New tests name their oracles: production pick order + honest mode line on a replica-served claim; by-id exactness and the held-task no-claim; the unservable-shape pass table (Decision 1); heartbeat/checkpoint against the local lease incl. the foreign-lane refusal; the adapter's replay-with-zero-lost, double-claim-never-replayed-over, already-honored-without-replay, and refusal→lost / race→double-claim resolutions; local_claims enumeration. Verification: fleet-command dispatch of the fleet-queue test suite against this branch (run id recorded on #16874 when dispatched).

Left unmerged for Felix.

{
  "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-29T17:39:32Z",
    "session_id": null,
    "lane": null,
    "host": "htch-runtime",
    "worktree": "/home/hatch",
    "model": null,
    "lane_start_issues": [],
    "workspace_ref": {
      "kind": "worktree",
      "id": "/home/hatch",
      "repo": "developing-today/code",
      "branch": "main",
      "sha": "010b47d1c4cecdcd1b7d6ea260b7c9b0a61fb89e"
    },
    "auth_subject": "felix",
    "stamped_by": "fleet 0.1.0 (native)"
  }
}

Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…ica (#16874)

Items 1-3 of #16874 (the #8583 follow-on), decisions recorded on
the issue per FDR-0013:

- Verb routing: on a store-down outcome (transport failure or an
  ok:false envelope, via the new transport::call_routed), claim,
  heartbeat, and checkpoint get their chance to serve through
  the client replica before the #6741 fallback switch. Claim
  serves the shapes the replica can honor (unscoped pick in
  production order; single by-id claim); batch/bind/transfer/
  handoff/filter/pool/budget shapes and queue-scoped picks keep
  the switch. Replica-served outputs carry the honest mode line
  (db-degraded / local-replica) via the new
  mode_report::legs_store_down_replica.
- Snapshot population trigger: an unscoped, unfiltered full
  list refreshes the client replica's snapshot from the rows it
  already fetched - no verb gains a broker round trip.
- sync_up broker adapter: the cloud view is built from the
  broker (scoped rich /list read per locally held task id),
  unheld claims replay through claim-by-id, and the
  ReconcileReport is surfaced as replica_sync on the first
  broker-served claim/heartbeat/checkpoint that reconciles
  anything. Double-claims are reported, never replayed over;
  refused replays are resolved by one re-read and reported lost
  when no holder exists. SqliteReplica gains local_claims() so
  the adapter can enumerate the claims it reconciles.

Item 4 (the deployed drill) is #8583's last acceptance item and
is not in this slice.
@coderabbitai

coderabbitai Bot commented Nov 29, 2026

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c681b364-893a-4b1f-a9c8-f13099b9aa14

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@dezren39

Copy link
Copy Markdown
Member

Agent note · lane 1137-B (alpha DRIVE landings, 2026-11-29) — merging under standing authority.

Verification (firsthand, this lane): full diff read (+~890/-~60, 8 files) against the PR purpose and #16874 items 1–3 — non-exiting transport::call_routed + broker_down; claim/heartbeat/checkpoint give the local replica its chance on a store-down outcome before the #6741 fallback switch, with the Decision-1 servable-shape table (batch/bind/handoff/from-session/manual-override/filter/pool/budget/queue-scoped picks pass through untouched); foreign-lane heartbeat/checkpoint gets the not-held refusal at exit 5; snapshot refresh only on an unscoped, unfiltered full list (a partial view never replaces the snapshot); sync_up broker adapter over the narrow BrokerClaims seam — double-claims reported and never replayed over, refusals resolved by one re-read, lost claims surfaced, never hidden; SqliteReplica::local_claims() is an additive accessor (the inline query in sync_up now reuses it, no behaviour change). Tests in the diff name their oracles and cover every behaviour the body claims (production pick order + honest db-degraded/local-replica mode line, by-id exactness, pass table, already-honored-without-replay, refusal→lost / race→double-claim). Mode-report docs updated to stay honest (replica leg up only on outputs a verb actually served that way). Claim-scan: PR comments = CodeRabbit skip only, no reviews, no live sibling claim. Fresh pre-merge reads agree: OPEN, non-draft, CLEAN/MERGEABLE, API mergeable=true / mergeable_state=clean, head unchanged at 4058ba4. CI is not a gate (Drew's rule). Refs #16874 — the issue stays open for item 4 (the deployed-environment drill), as the body states.

@dezren39
dezren39 merged commit 6092788 into main Nov 29, 2026
2 checks passed
@dezren39
dezren39 deleted the felix/16874-replica-verb-routing branch November 29, 2026 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant