Repository navigation
fix(delivery): renew stable producer leases - #118663
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 3, 2026, 3:10 PM ET / 19:10 UTC. ClawSweeper reviewWhat this changesThe PR renews the exact SQLite producer lease for reusable durable outbound sends during preparation and provider execution, and makes Gateway shutdown wait for active recovery before runtime teardown. Merge readinessThe prior shutdown-lifecycle blocker is resolved: the Gateway fences outbound recovery synchronously and now awaits the admitted recovery before tearing down plugin/channel runtime. The branch still addresses a real current-main duplicate-send race, so it remains necessary; this maintainer-authored, delivery-critical change needs normal maintainer acceptance of its deliberate shutdown-versus-delivery-safety tradeoff. Priority: P1 Review scores
Verification
How this fits togetherOpenClaw stores durable outbound intents in SQLite and the Gateway periodically recovers pending rows after failures or restarts. The producer lease determines whether a live sender or recovery owns an intent, and Gateway lifecycle code controls whether that recovery can still use channel and plugin runtime during shutdown. flowchart LR
A[Durable outbound intent] --> B[Exact producer lease]
B --> C[Channel preparation]
C --> D[Provider send]
B --> E[Gateway recovery loop]
D --> F[Durable outcome]
E --> F
E --> G[Gateway shutdown fence]
Decision needed
Why: The code correctly implements the documented conservative contract, but choosing between possible extended shutdown and the risk of duplicate or misclassified provider sends is an operator-facing lifecycle policy choice. Before merge
Agent review detailsSecurityNone. PR surfaceSource +321, Tests +948. Total +1269 across 22 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one renewable exact owner for stable delivery and one Gateway-owned recovery scheduler, then merge only if maintainers accept waiting for admitted recovery rather than tearing down its runtime mid-flight. Do we have a high-confidence way to reproduce the issue? Yes. Current main has a finite producer lease with no renewal path, while recovery treats an expired stable owner as eligible; the PR's focused tests exercise lease expiry during preparation and after provider dispatch. Is this the best way to solve the issue? Yes. Reusing the merged Gateway recovery scheduler while renewing only the exact SQLite owner is a more coherent fix than adding another expiry timer or relying on cancellation that providers cannot acknowledge universally. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against cd42cb770332. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
db71f9f to
830ae07
Compare
5f8b9c6 to
2ac8111
Compare
|
Resolved the ClawSweeper P1 on shutdown ownership. Decision: Gateway close must await actual outbound-recovery settlement before plugin/channel teardown. The five-second timer is now warning-only; it no longer reports quiescence or permits teardown while recovery remains live. The outer process shutdown watchdog remains the forced-exit boundary. Why not treat Exact-head proof:
Head: |
|
Merged via squash.
|
…-state-mutation * origin/main: (22 commits) fix(delivery): renew stable producer leases (#118663) test(mcp): isolate catalog size checks from wall-clock load (#118871) test(ui): add credentials primary QA proof (#118790) fix(slack): prevent stalled presence polling from hanging shutdown (#117478) test(security): cover gateway shared auth modes (#118834) fix(macos): show gateway auth failures in app status (#118841) test(tui): route PTY gateway scenarios through explicit models (#118802) test(qa): add session transcript primary coverage (#118820) fix(browser): protect private observation media and Canvas trust boundaries (#118775) fix(build): restore SDK packages and signed macOS app builds (#118833) test(qa): cover plugin authoring contracts (#118821) fix(parallels): keep provider keys out of POSIX job logs (#118840) improve: reduce redundant Code Mode test work (#118815) fix(models): report primary OpenRouter limits in scans (#110855) test: speed up setup inference fixtures (#118811) fix(auto-reply): enforce canonical reset authorization (#118580) docs(gateway): fix invalid heartbeat visibility examples (#118827) fix(plugins): unify HTTP route conflict handling (#118203) test(agents): use prepared auth fixtures (#118816) fix(lmstudio): resolve JIT embedding variants ...
* fix(delivery): renew stable producer leases * fix(delivery): keep recovery inside shutdown fence
Related: #118044
What Problem This Solves
Resolves a delivery race where a reusable stable outbound intent could outlive its producer claim while channel preparation or the provider send was still running. Recovery could then acquire the same intent and begin a second provider send before the first producer had a definitive result.
Why This Change Was Made
producer_claimed,send_attempt_started, and explicitunknown_after_sendrows fenced while the stable lease is live.This integrates with the single recovery owner landed in #118694. It deliberately removes the stacked branch's duplicate exact-expiry timer and
nextRecoveryAtcontract.No SQLite schema version, DDL, or migration is added.
requiresProducerClaimremains metadata in the existing queue entry JSON.User Impact
Long-running outbound sends no longer become eligible for concurrent recovery while their original producer still owns the attempt. This reduces duplicate real-world sends and keeps restart recovery conservative when the platform outcome is unknown.
Recovery may begin up to five seconds after an expired lease. That bounded delay is intentional: one lifecycle-owned scheduler is safer than competing interval and exact-expiry timers.
Shutdown now keeps plugin/channel runtime alive until any admitted recovery settles. Providers do not expose a universal acknowledged-cancellation contract, so a local timeout cannot safely prove that delivery work has stopped.
Evidence
unknown_after_sendretention, fresh-config retries, non-overlap, suspended admission, idempotent stop, startup-recovery join, and warning-only shutdown wait.git diff --checkpassed.oxfmtpassed.patch is correct, confidence 0.91).No
CHANGELOG.mdedit: release generation owns changelog entries for normal PRs.