Repository navigation
feat(onboarding): alert when a newcomer types and nothing answers (W4 item 2) - #954
Conversation
Every onboarding defect found on 2026-08-14 was found by a human deciding to read production transcripts. The fixes were real; the detection was a person choosing to look. This is the part that does not require anyone to choose. A cron asks one question every five minutes: did someone who signed up recently say something in a room that could have answered, and did nothing answer? An episode is one (user, pod) run of silence, not one message — a person typing four times into a dead room is one failure. Calibrated against production rather than guessed (pod-architect, 2026-08-15): - 15 minutes, wall-clock, derived from the queue's own constants. The event requeue is 10 minutes, so anything under ~12 fires inside a legitimate retry; pending rows are deleted at 30, past which the evidence is gone along with the answer. Observed replies agree independently: every genuine one in 21 days landed inside 107 seconds, and the next cluster was 10+ hours. - Not idle-gated. That would key on lastActive, which over-counts because V2PodChat polls every 60s and an abandoned tab reads as presence. - The pod must hold an ACTIVE AgentInstallation, not just an agent member — a member without one 403s on post, so it was never going to answer either. Same predicate the posting path uses. - Only a bot author counts as a reply. A human answering is a different outcome and is recorded as one (human-rescued) rather than folded in. - The AgentEvent state is snapshotted at fire time. It has to be: pending rows are GC-ed at 30 minutes and we fire at 15, so this is the only window in which "never enqueued" (a producer bug) can be told from "enqueued, never acked" (a runtime bug). Afterwards both look like an empty queue. Delivery is split from detection because they fail differently and only one is allowed to be quiet. With no ONBOARDING_ALERT_EMAIL configured the service says so loudly on every pass that had something to report, instead of computing correctly and returning success — three of the eight defects found on 08-14 were that exact shape, and an alerting service is the worst place to add a fourth. Also drops the planned lastLogin field. It does not exist, but the instrument it was meant to provide already does: User.lastActive is written on every authenticated request at a 15-minute throttle and is live in production (DAU 9, WAU 24). With a 7-day JWT, a login timestamp would sample an engaged daily user at weekly granularity — misleading rather than merely redundant. Confirmed by ux-lead and pod-architect. HUMAN_FILTER/BOT_FILTER move out of routes/admin/analytics.ts into services/userClassification.ts so the alert and the funnel share one definition instead of two copies of a subtle rule. Verified by running the real service against production data read-only (episode model stubbed in require.cache, zero writes): 54 messages scanned, 16 raw hits collapsing to 10 episodes with 6 absorbed — matching an independently written probe. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01XeUH4HVDsDHYPsHJthXjB8
|
| arm | write path | handle | snapshot | diagnosis |
|---|---|---|---|---|
| control | socket sendMessage |
@commonly-bot |
total:1, {acked:1}, targets:[commonly-bot/default], noneEnqueued:false |
acked-but-no-reply |
| treatment | POST /api/pg/messages/:podId |
@commonly-bot |
total:0, {}, noneEnqueued:true |
never-enqueued |
Same pod, same handle, two minutes apart. The only variable is the write path.
The first attempt was invalid and is worth recording. I ran it with @commonly-summarizer — which is the installation's displayName; the resolvable handle is the username @commonly-bot. Both arms came back empty, and the negative arm looked like a clean confirmation of the route bug. It was not: the control was broken, not the route. Re-running control-first with the resolvable handle is what made the result mean anything.
So the snapshot separates the two classes on live data, which was the open question.
Also confirmed as a real defect, separately
POST /api/pg/messages/:podId writes the row, returns 200, renders in the pod, and never calls enqueueMentions. Only four write paths do: server.ts:711, postController:295, messageController:280, agentsRuntime:1836.
@pod-architect established the consequence is larger than dropped mentions: enqueueWakeOnMessage is called from inside enqueueMentions (agentMentionService:1032, :1343), so in My Workspace — where Scout runs wakeOnMessage: true and is meant to answer every message — a message written over that route is invisible to Scout entirely. Verified at source.
That is not fixed here and wants its own PR. This one only makes it detectable.
…lly ran
sprint-review found the diagnosis had a conflated bucket. "The event was
acked and no reply came" is at least three different faults:
- the runtime declined at its daily cap. nativeRuntimeService returns
status:'succeeded' at :634, BEFORE AgentRun.create at :695, so the event
acks with no run row.
- another agent won the claim and this seat stood down.
- it genuinely ran and produced nothing.
The first two never started; the third started and stayed silent. Opposite
investigations, one label. Counting AgentRuns in the episode window splits
them: `acked-never-ran` vs `ran-but-silent`.
Worth doing now rather than later because ADR-022 D5 makes at-cap MORE
common, so the bucket would have grown less accurate over time — the alert
would increasingly report a correctly-declining runtime as a broken one.
The run count does not separate at-cap from claim-lost; both have zero runs.
pod-architect established `message_claims.claimed_by` is the discriminator
there, and that it changes attribution rather than just the label — if the
claim was lost, the seat that stood down is not the failure and the alert
should name the claim holder instead. Deliberately left out of scope and
documented on the field.
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XeUH4HVDsDHYPsHJthXjB8
Caught during live verification of #954, minutes after it deployed: the first real pass produced no output at all. The cron logged only when it found something, so "ran, everything is fine" and "is dead" were indistinguishable from outside. That is the pod-summarizer failure — a cron failing every six hours for a month while every component reported success — reproduced inside the service written to catch it. An empty result from an unobservable detector is not evidence of a healthy funnel. Three changes, all about making absence readable: - a heartbeat written every pass to SystemSetting `onboardingSilence.lastScan`, whatever the pass found - one log line per pass, unconditionally. 288/day against this log volume is free, and it is what makes the thing greppable in `kubectl logs` - `GET /api/admin/analytics/silence` returns `lastScanAt` and `staleScan`, so a reader can tell "nothing is broken" from "nothing is watching" The heartbeat is best-effort and never suppresses an alert: a Mongo failure while writing it must not turn a real stranded user into silence. Tested. Claude-Session: https://claude.ai/code/session_01XeUH4HVDsDHYPsHJthXjB8 Co-authored-by: Claude Opus 5 <[email protected]>
#956) `user-fbd3` signed up on 2026-08-15, installed a BYO agent 77 seconds later, never ran it, never typed a word, and left. The seat's install intro (#943) told them the truth at minute zero — "nothing is running me yet" — and then nothing ever followed up. That is the modal onboarding failure and it is the one the silence alert (#954) is blind to by construction, because it fires on someone speaking and these people never speak. Fifteen minutes after a runtime token is issued and still unused, the seat says so in the room where it was installed, addressed to the installer by name, and hands over the exact command. Built to ux-lead's spec, with three corrections from the fleet: - **The episode key is max(createdAt) across BOTH token stores** — the same union deriveAgentState uses for liveness. Key off one store while triggering off the union and a reissue on the other path never resets the episode, so "a reissue earns one more nudge" silently stops firing (pod-architect). Exported as one helper so the reactive responder does not recompute it (sprint-impl). - **The two token stores are not symmetric.** User.agentRuntimeTokens carries expiresAt; AgentInstallation.runtimeTokens does not (verified in both schemas). So a token episode ends differently depending on which store minted it. Recorded as `tokenSource` rather than left to be discovered. - **The confirmation is not time-bounded, and is compound** (ux-lead): flat for the past because a first-connection timestamp is a fact, derived at post time for the present because that is an inference. "Connected (first seen 09:00 UTC). It isn't running right now — restart it with ..." That also dissolves the case I thought was invisible: lastUsedAt leaving null is a permanent transition, so a wrapper that connects and stops between passes is still seen, it just gets a different present tense. The episode is claimed before the post, not after: a losing race then costs one nudge rather than delivering two, and a second message in someone's room cannot be taken back. i18n is deliberately deferred, with the seam left visible. The spec asked for en + zh-CN from day one; there is no mechanism — language lives in frontend localStorage, never reaches the backend, there is no User.language and no server-side i18n layer at all, and #943 shipped English-only for the same audience. ux-lead's ruling: ship en now, because the load-bearing content is the fixCommand and that is language-neutral, so an English nudge beats silence. The composers take a `locale` they currently ignore so the layer, when it lands, changes only them. Filed separately: persist the language SWITCHER choice as User.language — the choice the user made, not the browser's guess — which retro-covers #943 and the digest too. One derivation throughout: deriveAgentState decides connected-ness, the 15 minutes is only a patience window on top of its verdict. Claude-Session: https://claude.ai/code/session_01XeUH4HVDsDHYPsHJthXjB8 Co-authored-by: Claude Opus 5 <[email protected]>
Closes W4 item 2. The instrument, not another fix.
Why
Every onboarding defect found on 2026-08-14 was found by a human deciding to read production transcripts. The fixes were real; the detection was a person choosing to look.
pod-summarizerfailed every six hours for a month and nobody noticed. This is the part that does not require anyone to choose.A cron asks one question every five minutes: did someone who signed up recently say something in a room that could have answered, and did nothing answer?
An episode is one
(user, pod)run of silence, not one message — someone typing four times into a dead room is one failure, not four.Calibration
Threshold and semantics were calibrated against production by @pod-architect rather than guessed:
AGENT_EVENT_REQUEUE_DELIVERED_MINUTESis 10, so under ~12 fires inside a legitimate retry;AGENT_EVENT_STALE_PENDING_MINUTESis 30, past which the evidence is deleted along with the answerlastActive, which over-counts:V2PodChat.tsx:279polls every 60s, so an abandoned tab reads as presence. It would also make the rate incomparable across cohorts, killing the alert's second jobAgentInstallationhuman-rescuedrather than folded inThe observed data agrees independently: across 21 days, every genuine reply landed inside 107 seconds (5s, 15s, 40s, 48s, 73s, 103s, 107s) and the next cluster was 10+ hours. Nothing lands in between.
The event snapshot is not optional
AgentEventpending rows are deleted at 30 minutes; we fire at 15. That gap is the only window in which two failures that look identical afterwards can be told apart:never-enqueued→ a producer bug (the write path skippedenqueueMentions)enqueued-never-answered→ a runtime bugThey need opposite fixes. Captured at fire time or the alert reports that something is wrong with no way left to say what.
Delivery refuses to be silently inert
Detection and delivery are separate services because they fail differently and only one is allowed to be quiet. With no
ONBOARDING_ALERT_EMAILset, the service says so loudly on every pass that had something to report rather than computing correctly and returning success. Three of the eight defects found on 08-14 were that exact shape; an alerting service is the worst possible place to add a fourth. A machine-readable[onboarding-silence] ALERT …line is always emitted regardless of email config.GET /api/admin/analytics/silenceis the pull half — an alert you can only receive is one you cannot go back and check, and it makes "did the fix work" answerable without re-reading transcripts by hand.lastLoginis deliberately not builtW4 item 2 was written as "
lastLogin+ alert".lastLogindoes not exist — but the instrument it was meant to provide already does.User.lastActiveis written on every authenticated request at a 15-minute throttle (middleware/auth.ts:14) and is live in production: DAU 9, WAU 24, returnedD1 5, which would be structural zeros if it were frozen.With a 7-day JWT, a login timestamp samples an engaged daily user at weekly granularity — misleading rather than merely redundant. Dropping it was confirmed by @ux-lead and @pod-architect. The real caveat runs the other way:
lastActiveover-counts, and that is now documented where it is read.Verification
HUMAN_FILTER/BOT_FILTERmoved intoservices/userClassification.ts(one definition, not two copies of a subtle rule)tsc:checkclean — baseline-compared againstmainby stash, identical outputrequire.cache; zero writes): 54 messages scanned, 1 skipped for having no agent, 16 raw hits collapsing to 10 episodes with 6 absorbed — matching an independently written probe. The collapse rule is doing real work.Not in scope
This does not nudge the user — that is W4 item 3 (@ux-lead's stalled-connect spec), which fires on install state and speaks to the user. They are complementary: that one catches a seat whose token was never used before anybody types; this one catches a Scout that breaks tonight, and knows nothing about tokens.
🤖 Generated with Claude Code
https://claude.ai/code/session_01XeUH4HVDsDHYPsHJthXjB8