Heuristic:23blocks OS Ai maestro Fail Forward Retry
| Knowledge Sources | |
|---|---|
| Domains | Agent_Messaging, Delivery, Reliability |
| Last Updated | 2026-10-26 18:00 GMT |
Overview
Keep trying delivery routes in order until one proves arrival — a duplicate notification is cheaper than a lost message, so unconfirmed sends never stop the chain.
Description
The wake chain runs delivery adapters in sequence (pane push, streaming, channel, inbox poll). Each adapter returns a status: `confirmed` (proven arrival), `sent` (accepted but unproven), `deferred` (queued for later), or `failed`. Only `confirmed` stops the chain. `sent`, `deferred`, and `failed` all continue to the next adapter.
This is a fail-forward strategy: rather than retrying a failed route, move to the next one. The inbox write already happened (disk persistence is the source of truth), so a deferred wake is a delay, not a loss. If no route confirms, the wake enters the idle-gated wake queue with exponential backoff `[0, 30s, 120s, 600s]` for up to 4 attempts. After that, the queue stops — a notification that has failed four times is not going to start working, and the message is safe on disk.
A queued wake is reported as `deferred`, never `sent` — unproven states stay distinguishable from proven ones. The queue TTL is 16 minutes (1 minute beyond the 15-minute hook status TTL, so a stuck "active" report expires first).
Usage
Use this heuristic when:
- Multiple delivery routes exist and only one needs to succeed
- "Sent" and "received" are different guarantees (disk write ≠ agent saw it)
- A duplicate nudge is acceptable but a lost message is not
The Insight (Rule of Thumb)
- Action: Run adapters in order. Stop only on `confirmed`. Continue on `sent`, `deferred`, `failed`.
- Value: Retry backoff: `[0, 30_000, 120_000, 600_000]` ms. Max attempts: 4. Queue TTL: 16 min. Max per-agent queue: 20.
- Trade-off: May deliver duplicate notifications (a confirmed route followed by a retry from the queue). This is intentional — a duplicate is cheaper than a lost message.
- Compatibility: Only the pane route needs the idle queue. Streaming and channel routes hand off to their own runtimes that drain safely at a turn boundary.
Reasoning
The cost asymmetry drives this: a duplicate notification produces a mild "already seen" response from the agent; a lost notification means the agent never acts on the message. Given that the inbox write (source of truth) already succeeded, the wake chain's job is purely to get the agent's attention — and that is idempotent.
The backoff schedule `[0, 30s, 120s, 600s]` is non-linear: the first retry is immediate (the failure may have been a transient busy state), then grows. The 16-minute TTL is deliberately 1 minute beyond the 15-minute hook status TTL: a wake is deferred because the hook says "active," and if that report is stuck (agent killed), it only expires after 15 minutes. Dropping the wake at 10 minutes (an earlier bug, B011) meant it was dropped 5 minutes before the blocking status could clear.