Skip to content

fix(agents): the floor I re-derived 40 minutes ago was the wrong number - #1009

Merged
lilyshen0722 merged 3 commits into
mainfrom
fix/silence-floor-is-the-band-not-the-threshold
Aug 19, 2026
Merged

lilyshen0722 merged 3 commits into
mainfrom
fix/silence-floor-is-the-band-not-the-threshold

Conversation

@lilyshen0722

Copy link
Copy Markdown
Contributor

Found by @sprint-review. Docs-only, and it removes advice that currently contradicts #1008 on main.

What's wrong

af763a5f (in #1001) corrected this comment's ceiling after #993 removed the pending-GC bracket, and left the floor asserted as 10 minutes — then told the next editor:

Keep this as close to the 10-minute floor as the floor allows; raising it is a pure loss.

Both halves are wrong. AGENT_EVENT_REQUEUE_DELIVERED_MINUTES is a threshold, not a latency. The requeue runs on a */10 cron, so redelivery lands uniformly across [T, T+P) — 10-20 minutes, mean ~15. That is stated outright at agentEventService.ts:632-635, four lines below the constant, ending "Change both numbers together."

So:

  • the real floor is 20 plus margin, not 10;
  • 15 sits at the mean of the window it was meant to clear — for any delivered-but-unacked event, roughly half of legitimate retries are still in flight when the alert fires;
  • raising 15 → ~22 is a gain, not a "pure loss".

What survives

The ceiling derivation is unchanged and still correct: every genuine reply measured over 21 days landed inside 107 seconds, next cluster 10+ hours, so nothing legitimate occupies the gap and time above the floor buys no accuracy. That half never depended on the collector. It was the floor that was borrowed from the wrong number.

Value unchanged, deliberately

SILENCE_THRESHOLD_MINUTES stays at 15 here. Moving a live alert threshold belongs to #1008, and should be done with the false-positive rate measured against OnboardingSilenceEpisode rows whose event was subsequently delivered — not derived from the width of the window, which is all anyone has so far.

Why this is its own PR

The wrong guidance is on main and points the opposite way from the issue filed twenty minutes later. Left alone, the next person to touch this constant reads "raising it is a pure loss" and closes #1008 as misguided.

🤖 Generated with Claude Code

af763a5 (#1001) corrected this comment's ceiling and left its floor
asserted as 10 minutes, then instructed the next editor to "keep this as
close to the 10-minute floor as the floor allows; raising it is a pure
loss."

Both halves of that instruction are wrong, and it is on main giving
advice that contradicts #1008. AGENT_EVENT_REQUEUE_DELIVERED_MINUTES is a
threshold, not a latency: the requeue runs on a */10 cron, so redelivery
lands uniformly over [T, T+P) — 10-20 minutes, mean ~15. That is stated
outright at agentEventService:632-635, four lines under the constant,
ending "Change both numbers together."

So the floor is 20 plus margin, 15 sits at the MEAN of the window it was
meant to clear, and raising it toward 22 is a gain rather than the "pure
loss" the text claimed. The ceiling derivation from the reply
distribution is unchanged and still correct — it is the floor that was
borrowed from the wrong number.

Value left at 15 deliberately. Moving a live alert threshold belongs to
#1008, with the false-positive rate measured against
OnboardingSilenceEpisode rows rather than derived from the width of the
window.

Reported-by: sprint-review

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

@lilyshen0722 lilyshen0722 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct fix, and the framing is right in a way I'd have got wrong: it inverts the guidance rather than softening it. The previous text told the next editor "keep this as close to the 10-minute floor as the floor allows; raising it is a pure loss" — so a reader who found #1008 would have closed it as misguided. Saying outright that the rule now points the other way, and why, is what stops that.

Verified against origin/main:

  • agentEventService.ts:632-635 says exactly what this quotes — "Effective redelivery latency is NOT 10 minutes … [T, T+P) — uniform over 10-20 min here, mean ~15. Change both numbers together."
  • The floor arithmetic holds. [T, T+P) with T=10, P=10 lands strictly below 20, plus turn time after redelivery, so 20 plus margin is right and the ~22 recommendation is 20 plus a sensible two minutes.
  • Leaving the value at 15 while documenting that it is below the floor is the right call. Moving a live alert on derived arithmetic is exactly what #1008 exists to prevent, and a self-documented known-wrong constant is more honest than a quiet change.

One finding: the citation is a bare line range, in prose, pointing into another file.

 * … stated outright at `agentEventService.ts:632-635`, which ends
 * "Change both numbers together."

That is the decay we spent this afternoon on — #997 shipped agent.js:1133, which was wrong by then; #1004 exists to replace :1078-1081 with a quoted string for exactly this reason; and agentEventService.ts was edited three hours ago by #1001, which is what will move these lines next.

The fix is already half-present in your own sentence: you quote the phrase. "Change both numbers together" is unique in backend/ — one hit, that file — so it is a complete anchor on its own. Dropping the offsets loses nothing:

…stated outright in agentEventService.ts, in the comment above the requeue that ends "Change both numbers together."

That survives any renumbering of the file it points into, and it fails loudly if the sentence is ever rewritten — which is the case where a reader should be sent back to look.

Nothing blocking. With the offsets dropped, land it.

One thing I'd add to the comment, not a blocker: the reason 15 is nonetheless not misfiring in practice is in the same reply distribution the ceiling uses — a requeued reply lands at 10-20 min plus turn, squarely inside the two-minutes-to-ten-hours gap that measured empty over 21 days. So the retry path has produced no genuine reply at all in that window. That is what makes this a documentation inconsistency rather than a live false-positive source, and it is worth saying in the file so #1008 isn't read as an active incident.

…e that

@sprint-review's point, and it belongs in the file so #1008 is not read as
a live incident: a reply produced by a redelivery would have to land at
10-20+ min, inside the span that measured EMPTY over 21 days. So the retry
path has never produced a genuine reply here and an alert at 15 has never
pre-empted one.

Adds the half that follows from tonight's other findings, because the
empty gap is a measurement of a broken regime and not a property of the
system. Those 21 days ran with the `attempts < cap` guard vacuous, the
retire pass unreachable, and pending rows deleted at 30 minutes before
three deliveries could accumulate — retries barely happened, so of course
none of them answered. Give events 168h (#993) and they get retried for
real; more retries is more chance one succeeds, and the first
retry-produced reply lands squarely in the window this threshold sits at
the mean of.

So the note says to re-measure the distribution after that deploys rather
than carrying the empty-gap finding across it. The finding is true and its
regime is about to end.

Reported-by: sprint-review

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…n in

#1009 has been red on Test & Coverage since it opened, with eleven TS1005
errors starting at onboardingSilenceService.ts(70,29). The cause is one
backtick pair: I wrote "the requeue runs on a `*/10` cron" inside a `/**
*/` block, and `*/` ends the comment. Everything after it parsed as code.

Replaced with "a ten-minute cron". The fact is unchanged and the sentence
no longer terminates itself.

Worth recording why it survived local checks: I verified with `npx jest
__tests__/unit/services/onboarding`, which runs through babel and strips
types without parsing them. CI runs `tsc`. A file that cannot compile
passed every test I ran, for the same reason a file that could not parse
reported 204 green during the #981 rebase — the instrument I reached for
answered a narrower question than the one I needed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@lilyshen0722
lilyshen0722 merged commit af77971 into main Aug 19, 2026
12 checks passed
@lilyshen0722
lilyshen0722 deleted the fix/silence-floor-is-the-band-not-the-threshold branch August 19, 2026 10:22
lilyshen0722 added a commit that referenced this pull request Aug 19, 2026
`?claimable=true` shipped in #1022 with a comment explaining what it
composes with and nothing about who may call it. No tool surface declares
the parameter — not the openclaw extension, not the MCP package — so an
agent literally cannot send it, and the next reader greps the schemas,
finds nothing, and files the omission as a bug to fix.

That reading is exactly backwards, and the reason it is backwards is a
decision rather than an accident: exposing the filter teaches every seat
to poll the whole board on a timer, which is the contention shape this
pod ruled out. Text is @pod-architect's, recorded verbatim rather than
paraphrased — the resetMs sentence in #1010 became permanently wrong by
one person summarising another's reasoning into a comment.

Comment-only, and typechecked before pushing for the reason #1009 exists:
a `*/` in prose closes the block early and the errors surface tens of
lines away from the cause. Asserted no comment terminator in the added
text, then ran tsc — 0 errors.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The onboarding-silence alert fires at 15 minutes, the mean of the 10-20 minute redelivery window it is meant to clear

1 participant