Skip to content

feat(fleet-queue): filing-time state re-check reads the packet stamp (#12966) - #12991

Merged
dezren39 merged 1 commit into
mainfrom
lane-he/12966-filing-recheck
Nov 23, 2026
Merged

dezren39 merged 1 commit into
mainfrom
lane-he/12966-filing-recheck

Conversation

@dezren39

@dezren39 dezren39 commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

What

Implements item 1 of #12966 — the filing-time state re-check (proposal step 5 of #10626).

Packet generators stamp payload.issue.state_checked_at (pm-stack dispatch packet.ts, console work.ts), but nothing read the stamp: a packet filed from a stale snapshot rode the queue until the claim-time staleness check (#10626, PR #11799) caught it — if a claim ever came.

  • staleness.rs: filing_stamp reads the stamp; stamp_needs_recheck is the pure age gate (bound FILING_RECHECK_AFTER = 1h, the proposal's small bound); filing_verdict gates the existing claim-time verdict on the stamp — fresh stamp trusted with zero lookups, missing/unparsable stamp fails open exactly as before. filing_recheck is the broker-side wrapper mirroring stale_pick (same kill flags, same probe/cache). retire_stale gains a via parameter; the claim path passes its existing claim_staleness_check unchanged.
  • claim.rs (verb_enqueue): after the INSERT, a landed filing verdict retires the fresh row in place — same already_done result evidence and staleness_autocomplete event the claim path writes, with via: enqueue_staleness_check, so the criterion-6 measurement counts filing interceptions too. Dedupe-hit and work-identity-collision returns are untouched (nothing was filed).

Evidence

  • cargo test -p fleet-queue --features queue-broker staleness — 15 passed / 0 failed, including 4 new tests whose oracle is this slice: stamp source; the age gate (15 min trusted, 3h re-checked, garbage/future fail open); the filing verdict (old stamp + landed before filing = tier 1; fresh stamp = probe never called; no stamp = probe never called; old stamp + still open = files live); and a source-order test pinning the re-check after the enqueue INSERT.
  • Full fleet-queue suite: 520 ok / 0 failed at last read, with one unrelated pre-existing sqlite-replica generated-sequences proptest still running long under load (not in this change's blast radius; the staleness, work-identity, and claim-path modules all completed green).
  • cargo fmt --check clean on all three touched files (other files' pre-existing drift untouched).

Merge danger

Two-way door. Blast radius: enqueue of issue-linked packets with a >1h-old stamp gains one bounded, cached GitHub probe (the same probe/cache/backoff the claim path already uses) and a possible immediate retirement. Everything else — fresh stamps, unstamped packets, by-id claims, transfers, handoffs — is byte-for-byte the old behavior. FLEET_STALENESS_CHECK=0 disables both halves.

Refs #12966 — item 2 there (the criterion-6 seven-day measurement, due ~2026-11-29) keeps the issue open.


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

…12966)

Proposal step 5 of #10626: the generators (pm-stack dispatch and
console) stamp payload.issue.state_checked_at when they snapshot an
issue, but nothing read the stamp — a packet filed from a stale
snapshot rode the queue until the claim-time staleness check caught
it.

Enqueue now re-verifies a packet whose stamp is older than
FILING_RECHECK_AFTER (1h): filing_verdict gates the claim-time
verdict on the stamp age, and a landed verdict retires the fresh row
in place with the same already_done evidence and
staleness_autocomplete event the claim path writes (via
enqueue_staleness_check). A fresh stamp is trusted — no lookup runs;
a missing or unparsable stamp files exactly as before, and the
claim-time check stays the net. retire_stale gains the via as a
parameter; the claim path passes its existing value unchanged.

Oracle: the staleness module tests — stamp source, the age gate
(fresh trusted, old re-checked, garbage/future fail open), the
filing verdict (old stamp + landed = tier 1; fresh/missing stamp =
no lookup at all), and a source-order test pinning the re-check
after the enqueue INSERT. Full fleet-queue suite green up to an
unrelated long-running sqlite-replica proptest (520 ok, 0 failed
at last read).

Refs #12966 (item 1 of 2; the criterion-6 measurement is not due
until ~2026-11-29 and stays open there). Does not close #12966.
@coderabbitai

coderabbitai Bot commented Nov 23, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 11 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

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: 6ac33d82-c531-4a64-82fe-0e99c0bfcfa0
Commits

Reviewing files that changed from the base of the PR and between a08915d and 82176bf.

Files selected for processing: 3

  • pkgs/fleet/crates/fleet-queue/src/turso_queue/claim.rs
  • pkgs/fleet/crates/fleet-queue/src/turso_queue/lifecycle.rs
  • pkgs/fleet/crates/fleet-queue/src/turso_queue/staleness.rs
  • 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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T06:35:09.097533Z 82176bf PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@dezren39
dezren39 merged commit fe850a8 into main Nov 23, 2026
2 checks passed
@dezren39
dezren39 deleted the lane-he/12966-filing-recheck branch November 23, 2026 06:34
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