Repository navigation
fix(cli): the poller claims one event, because the fetch IS the claim - #1166
Conversation
TASK-051. A seat ran ~11.5 hours behind: every wake carried a stamp from
the previous evening, 260 events queued, 18% acked against 96-100% for
every peer.
`AgentEventService.list()` does not preview. It marks every candidate
`delivered` with `$inc: { attempts: 1 }` before returning. The run loop
then processes them SERIALLY, one full model turn each. So `limit: 10`
claimed ten and started one.
The nine it could not start were reclaimed out from under it. The backend
requeues `delivered` rows older than `requeueDeliveredMinutes` (10,
swept on `*/10`), and turns routinely outlast that — measured on this seat
over 11.5h: 115 spawns, median 128s, p90 669s, 13 over 600s, max 1153s.
Each sweep returned untouched siblings to `pending` at `attempts + 1`.
That is @sprint-review's otherwise-unexplained 12-at-1 / 9-at-2 split: a
re-claim, not a redelivery.
The part that makes it more than latency: `attempts >= 3` retires an event
to `failed`, terminal and invisible to `list()`. That cap exists to bound
POISON events — three deliveries, no ack, presumed undeliverable. Fed
claims no model ever saw, it drops mentions unread and says nothing.
`limit: 1` costs nothing. Capacity is one turn at a time regardless and the
poll interval is 5s; this only stops the loop claiming work it cannot begin.
Pinned as its own assertion rather than folded into the existing
`objectContaining`, because 10 read as a harmless batch size — which is
exactly why it survived. Probe: reverting to 10 fails that test alone.
Full CLI suite 334 passed.
Does not address the other half, which is not a bug: this pod produces
events ~3x faster than one serial seat retires them. Backlog needs an
operator decision, and per-seat queue depth is surfaced nowhere.
Co-Authored-By: Claude Opus 5 <[email protected]>
…package Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TdEJoXUmbHmW5TFk7hfkbK
|
Merging this does not reach a single seat. Verified independently after @sprint-review flagged it, from this machine: 119 commits behind main, 0 ahead. Every seat's The delivery chain is three steps, not two:
Step 2 is the one that gets skipped, because the branch name says it's self-maintaining and it isn't — 119 behind and 0 ahead means nothing is tracking anything. That's the repo's standing "verify at the consumer, not at the registry or the workflow" rule with a third indirection: not npm, not the deploy, but a git worktree behind a symlink. Until step 2 happens the over-claim keeps running, So the PR body's "what this does NOT fix" list needs a fourth item, and it's the first one: this does not deploy itself. |
@sprint-review gating #1215: `[^.\n]{0,40}?` reads as "stay inside one sentence" and silently also means "no model names", because every model we run is dotted. So the strings the possessive matcher exists to catch — You've reached your Haiku 4.5 limit you've hit your gpt-5.4-mini limit fell through to RUNTIME, which is the shortest backoff of the three rungs. A quota-blocked seat therefore got probed hardest, which is the exact failure this PR's own header narrates: `session limit` was one word away from `usage limit`, and this was one model name away. The paragraph above the regex already said the variable part is "a BILLING PERIOD or a MODEL NAME". The character class was excluding one of the two things the comment names. Enumeration failing three times is what motivated the shape match; the shape match then reintroduced the enumeration bug in its terminator. Fix is sprint-review's: `(?:[^.\n]|\.(?=\d))` admits a dot only ahead of a digit, so a version number passes and a sentence-ending period still stops the match. Rate-limit exclusion is untouched — QUOTA is tested first, so the negative lookahead stays load-bearing. Six tests, including the sentence-boundary case and a ladder-cost assertion (QUOTA opens the circuit at n=1; RUNTIME would retry in 5s). Probe: reverting the carve-out reddens exactly the four new cases, 27 others still green. Full spawn-retry suite 31 passed. Version 0.1.18 -> 0.1.19: main moved to 0.1.18 after #1166, so the branch's existing bump had gone stale and the `Source changed => version bumped` guard was red on identity rather than on omission. Co-Authored-By: Claude Opus 5 <[email protected]>
Sam asked for the 71-count line verbatim in the AX audit. Re-derived it rather than quoting it, and the re-derivation changed the entry: 169 now, and #1166 did not slow the rate. Daily shape rather than a before/after split on the fix cutover. The split gives 71/98 and reads as "worse after"; the 31-hour gap between them is the fleet being DOWN, spanning the restart. The honest reading is that the rate is unchanged, so over-claiming was never the dominant cause. What it is: `attempts` increments on CLAIM, and the requeue pass returns any `delivered` row older than 10 minutes to `pending` — so a long turn is reclaimed from the agent currently running it, three times, then retired. The threshold's own comment names a workload (3-5 min codex exec) that is not the workload it governs; #1166 measured this seat at p90 669s. Also the origin of this session's ~50-hour stale redeliveries: the requeue loop, seen from inside the agent. Co-Authored-By: Claude Opus 5 <[email protected]>
Sam asked for the 71-count line verbatim in the AX audit. Re-derived it rather than quoting it, and the re-derivation changed the entry: 169 now, and #1166 did not slow the rate. Daily shape rather than a before/after split on the fix cutover. The split gives 71/98 and reads as "worse after"; the 31-hour gap between them is the fleet being DOWN, spanning the restart. The honest reading is that the rate is unchanged, so over-claiming was never the dominant cause. What it is: `attempts` increments on CLAIM, and the requeue pass returns any `delivered` row older than 10 minutes to `pending` — so a long turn is reclaimed from the agent currently running it, three times, then retired. The threshold's own comment names a workload (3-5 min codex exec) that is not the workload it governs; #1166 measured this seat at p90 669s. Also the origin of this session's ~50-hour stale redeliveries: the requeue loop, seen from inside the agent. Co-Authored-By: Claude Opus 5 <[email protected]>
#1221) Sam asked for the 71-count line verbatim in the AX audit. Re-derived it rather than quoting it, and the re-derivation changed the entry: 169 now, and #1166 did not slow the rate. Daily shape rather than a before/after split on the fix cutover. The split gives 71/98 and reads as "worse after"; the 31-hour gap between them is the fleet being DOWN, spanning the restart. The honest reading is that the rate is unchanged, so over-claiming was never the dominant cause. What it is: `attempts` increments on CLAIM, and the requeue pass returns any `delivered` row older than 10 minutes to `pending` — so a long turn is reclaimed from the agent currently running it, three times, then retired. The threshold's own comment names a workload (3-5 min codex exec) that is not the workload it governs; #1166 measured this seat at p90 669s. Also the origin of this session's ~50-hour stale redeliveries: the requeue loop, seen from inside the agent. Co-authored-by: Claude Opus 5 <[email protected]>
TASK-051, root cause. A seat ran ~11.5 hours behind — every wake carried a stamp from the previous evening, 260 events queued, 18% acked against 96–100% for every peer (@sprint-review's measurement, 57638).
The bug
AgentEventService.list()does not hand back a preview. It marks every candidatedeliveredwith$inc: { attempts: 1 }before returning. The run loop then processes them serially, one full model turn each.So
limit: 10claimed ten and started one.The nine it couldn't start were reclaimed out from under it. The backend requeues
deliveredrows older thanrequeueDeliveredMinutes(default 10, swept on*/10), and turns routinely outlast that. Measured on this seat over 11.5h from its own log:Each sweep returned the untouched siblings to
pendingatattempts + 1. That is sprint-review's otherwise-unexplained 12 atattempts:1/ 9 atattempts:2— a re-claim, not a redelivery.Why it's more than latency
attempts >= attemptCap(default 3) retires an event tostatus: 'failed'— terminal, invisible tolist(). That cap exists to bound poison events: three deliveries, no ack, presumed undeliverable. Fed claims no model ever saw, it drops mentions unread, silently. Its own comment says it's there so a poison event can't "silently reproduce the exact Task #67 symptom — stuck, unretried, unsurfaced"; over-claiming turns the remedy into the disease.The fix
limit: 1. It costs nothing — capacity is one turn at a time regardless and the poll interval is 5s. It only stops the loop claiming work it has no way to begin.Pinned as its own assertion rather than folded into the existing
objectContaining, because10read as a harmless batch size, which is exactly why it survived review.Probe: reverting to
10fails that one test and nothing else. Full CLI suite: 334 passed, 24 suites.What this does NOT fix
The other half isn't a bug: this pod produces events ~3× faster than one serial seat retires them. The existing 260-event backlog needs an operator decision (clear, re-ack, or accept ~14h of drain), and per-seat queue depth is surfaced nowhere — 922 events are pending instance-wide, oldest 2026-08-18, and nothing alerts on any of it.
🤖 Generated with Claude Code