core-agent-ide/codex-rs/state/src
jif-oai 87bbfc50a1
feat: prevent double backfill (#11377)
## Summary

Add a DB-backed lease to prevent duplicate `.sqlite` backfill workers
from running concurrently.

### What changed
- Added StateRuntime::try_claim_backfill(lease_seconds) that atomically
claims backfill only when:
  - backfill is not complete, and
  - no fresh running worker currently owns it.
- Updated backfill_sessions to use the claim API and exit early when
another worker already holds the lease.
- Added runtime tests covering:
  - singleton claim behavior,
  - stale lease takeover,
  - claim blocked after complete.
- Set backfill lease to 900s in production and 1s in tests.

### Why

This avoids duplicate backfill work and reduces backfill status churn
under concurrent startup, while preserving
current best-effort fallback behavior.
2026-02-11 00:24:20 +00:00
..
bin Migrate state DB path helpers to versioned filename (#10623) 2026-02-04 14:31:12 +00:00
model feat: mem v2 - PR5 (#11372) 2026-02-10 23:22:55 +00:00
runtime feat: mem v2 - PR6 (consolidation) (#11374) 2026-02-11 00:02:57 +00:00
extract.rs Leverage state DB metadata for thread summaries (#10621) 2026-02-05 16:39:11 +00:00
lib.rs feat: mem v2 - PR5 (#11372) 2026-02-10 23:22:55 +00:00
log_db.rs feat: add log retention and delete them after 90 days (#10151) 2026-01-29 16:55:01 +01:00
migrations.rs feat: sqlite 1 (#10004) 2026-01-28 15:29:14 +01:00
paths.rs feat: sqlite 1 (#10004) 2026-01-28 15:29:14 +01:00
runtime.rs feat: prevent double backfill (#11377) 2026-02-11 00:24:20 +00:00