Repository navigation
fix: prevent chat send retries during identity lock contention - #158259
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 25, 2026, 2:51 PM ET / 18:51 UTC. ClawSweeper reviewWhat this changesThe branch returns cached process device identities before acquiring SQLite coordinators and adds a lock-contention regression test for chat goal request fingerprinting. Merge readiness✅ Ready for maintainer review The fix remains useful: current main still waits for the device-identity coordinator before checking a warm cache, and the proposed change follows the existing async loader’s cache-first contract. No actionable patch defect was found. The PR is also member-authored, so this cleanup review should not close it. Priority: P1 Review scores
Verification
How this fits togetherThe Gateway fingerprints goal-intent chat requests using its process device identity before admitting the goal. That identity comes from a process cache when warm and from coordinated SQLite storage when cold. flowchart LR
A[Goal intent chat send] --> B[Gateway request handler]
B --> C[Process identity cache]
C -->|Warm| D[Keyed request fingerprint]
C -->|Cold| E[Coordinated SQLite identity load]
E --> D
D --> F[Goal admission]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource 0, Tests +43. Total +43 across 2 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep warm synchronous identity reads on the existing process cache while preserving coordinated validation and creation for cache misses. Do we have a high-confidence way to reproduce the issue? Yes. Current main takes the coordinator before a warm cache read, and the PR supplies a lock-contention test plus reported pre-fix timeouts; this reviewer did not execute the test. Is this the best way to solve the issue? Yes. Moving the warm cache read ahead of coordination matches the established async contract while leaving cold identity creation with its existing owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 5caf34625c01. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash auto-merge.
|
Backport #157571: 0484d7a Adapted backport #150702: 6b5fb4b Backport #157958: 3802abe Backport #158259: 847863a Backport #156858: a5f1d09 Keep completion carriers within current-turn traversal and stop terminal transcript assertion retries. Preserve delegated restart provenance and owed completion custody; unknown provenance cannot inherit human evidence. Never let a queued, unstarted timeout end a different active turn. Reuse warm device identity and reacquire complete admission after observed rotation. Move the unchanged synchronous abort event into its existing lifecycle owner to satisfy the frozen line budget without weakening tests or guards. Source proof, recovery correction and owner-extraction checks are retained at their exact trees. Independent findings are resolved and composition preserves all 32 postimages; frozen ratchets and Madge pass. The two embedded-fallback attempt-count E2E cases remain unexecuted because canonical runtime preparation refused ownership; no guard was bypassed. Co-authored-by: Vincent Koc <[email protected]> Co-authored-by: Jason (Json) <[email protected]> Co-authored-by: RomneyDa <[email protected]> Co-authored-by: vyctorbrzezowski <[email protected]> Co-authored-by: steipete <[email protected]> Co-authored-by: jalehman <[email protected]>
What Problem This Solves
Fixes chat sends failing with a five-second device-identity lock timeout when another operation is using the state database, even though the gateway already has its identity cached.
User Impact
Warm chat sends no longer need a retry solely because request fingerprinting waits for that unnecessary lock. This is a backend fix; no UI, configuration, schema, migration, or identity-rotation behavior changes. It does not address separate cold-start or other database-contention failures.
Why This Change Was Made
The synchronous process-identity loader acquired the lifecycle and migration coordinators before checking its process cache. Return a cached identity first, matching the existing async loader. Cache misses still use the original coordinated creation and validation owner.
Evidence
chat.sendfailures after 5014 ms and 5007 ms withDeviceIdentityCoordinatorErrorcaused by state-lifecycle contention.finally, database/environment/temp cleanup; no skipped or removed coverage.node scripts/check-changed.mjs --base 573ff8e07088d0404cbc25b6891707326203686d --head 1ffcd5488beb29c29423dfcddbb63c56c117b8a6, exit 0); hosted checks remain required before landing.