Repository navigation
fix: stop paid ambient heartbeat retries during channel outages - #173003
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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs maintainer review before merge. What this changesThis PR skips model execution for unavailable-channel ambient heartbeat polls and backs off their readiness retries while preserving required work. Example: A heartbeat runs every 2 hours with WhatsApp disconnected and no queued events or tasks.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-directed fix addresses a current paid-retry defect, resolves both earlier findings, and introduces no new actionable defect identified in this review. Priority: P1 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe heartbeat runner resolves scheduled or triggered work and its destination, invokes ordinary reply execution, and returns an outcome to the shared wake queue, which owns retries. flowchart TD
A[Scheduled or triggered wake] --> B[Shared wake queue]
B --> C[Resolve payload and destination]
C --> D[Ambient readiness check]
D --> E[Model execution]
E --> F[Final delivery readiness]
F --> G[Channel delivery]
D --> B
F --> B
Technical reviewBest possible solution: Keep ambient outage retries model-free within the existing wake owner while preserving required payload execution and final delivery checks. Do we have a high-confidence way to reproduce the issue? Current-main execution, dispatch, wake retention, and scheduler bookkeeping establish the repeated paid-turn path; this read-only review executed no target code. Is this the best way to solve the issue? The fix addresses model invocation before unavailable delivery, reuses the existing readiness adapter and retry owner, and preserves the required-work distinction corrected after the earlier review. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 1fa52a027662. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +49, Tests +178, Docs +1. Total +228 across 7 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed October 15, 2026, 7:08 AM ET / 11:08 UTC (Revision 2). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…claw#173003) * fix: skip heartbeat model turns while delivery channels are unavailable * fix: preserve required heartbeat work during channel outages
Fixes #172988
What Problem This Solves
Fixes repeated paid ambient heartbeat turns every minute when the delivery channel stays disconnected.
User Impact
Ambient heartbeat polls with no required payload, scheduled task, or queued event check channel readiness before invoking the model. Unavailable-channel checks back off from one minute to the heartbeat interval, and the next retry runs normally after recovery.
Cron-carried tasks, queued event payloads (including events found on scheduled polls), and manual/triggered turns still execute their prompts during an outage. Only their final delivery is gated by readiness, and their existing one-minute delivery retry remains unchanged. Ready targets and heartbeats without a channel target retain their behavior.
Why This Change Was Made
The readiness adapter previously ran only after the model reply, while the wake queue retained
channel-not-readywith a fixed 60-second delay. A single execution-owned ambient-poll classification now controls the pre-model readiness check and eligibility for wake-owned exponential backoff. The existing final delivery check remains authoritative for required work and for channels that disconnect during a model turn.Coordinator product decision, as corrected in review: the cost-saving preflight and exponential backoff apply only to ambient polls without required work. A shared broadcast containing any required work keeps ordinary delivery retries; an ambient-only broadcast uses the shortest participating cadence. No configuration, schema, dependency, or public SDK changes.
Retry facts: preflight events/tasks define the current turn's owned payload; late arrivals retain their queue/wake ownership. Each retry resolves current config, session, delivery identity/account and paths through existing owners and retains the existing lifetime/store fences. The scheduled interval remains authoritative for its persisted occurrence; otherwise the current resolved interval supplies the cap. The per-attempt cap is disabled by any required participant. Preflight readiness never authorizes a later send: delivery checks it again.
ClawSweeper findings on
3e28aefe079daddressed:Production LOC exception: +85/-36 (net +49), funding the readiness preflight and wake-owned retry state while reusing the existing execution classification. Tests +183/-5; docs +2/-1. No unrelated code was removed to meet a LOC target.
Evidence
PR CI is the test gate under the maintainer proof policy. Exact-head CI run 38719948315 passed on
06772af215abc16d672ee3340e4373a0e0d58ea4: 43 successful jobs, no failures or reruns. Status was read live withOCTOPOOL_FRESH=1. This covers the selected Node test suites (including the required-payload and ambient regressions), production/test types, lint, docs, package boundaries, browser E2E, and baseline ratchets. The earlier green run on3e28aefe079dis prior-head evidence only.Regression coverage:
skips the model when WhatsApp is not linkedandchecks readiness before the model and recovers: %s: ambient polls make zero model calls while unavailable; recovery and no-target behavior are preserved.executes $kind work from $source before gating unavailable delivery: cron-carried tasks, queued events, scheduled polls with queued events, and manual turns execute their prompts before the final readiness check.backs off channel readiness to the heartbeat interval and resets after recovery: fake-timer ambient backoff, coalescing, transition logs, and reset.keeps the one-minute delivery retry for required %s work: fake-timer task/event retries retain the existing timing.Changed-file core-config
oxlint,oxfmt --check, andgit diff --checkpassed. Deslop completed. Fresh Codex P0–P2 branch autoreview:scoped-clean, no accepted/actionable findings. Review executed no project code or tests.Local tests, test wall-time measurement, typechecks, production negative controls, and live Gateway/Crabbox/Testbox proof were intentionally skipped per maintainer policy. PR CI supplies the test proof. No leases or Gateways were created.
ClawSweeper’s published needs-changes comment still references
3e28aefe079d; the P1/P3 corrections above are in the new head. No inline review finding targets the new head at handoff.