Repository navigation
Closed
Labels
app/pm-stackpm-stack (Pad/Grist) in developing-today/codepm-stack (Pad/Grist) in developing-today/codedesign/pm-notificationsDesign: pm-notifications - all issues of this effort carry itDesign: pm-notifications - all issues of this effort carry itkind/featureNew feature or capability requestNew feature or capability requestpriority/normalOrdinary priority (the default)Ordinary priority (the default)status:done
Description
Phase 1 — the stack speaks for itself (no platform move)
Design: pm-stack-notifications-design-2026-11-11.md (goal keep-the-four-repos-healthy, files/). Parent design context: #1254 (closed — PWA + push design), #3676 (closed — alert throat), #1226 (closed — needs-drew census), #8097 (queue/lane record where the 268-task audit landed).
What recon established (2026-11-11, wire-verified)
The push machinery from #1254/#3676 EXISTS and works: POST /api/alerts throat (Bearer intake) → Supabase alerts store → in-aggregator engine tick (60s) → Web Push (VAPID, src/push.ts, /sw.js). Drew's phone holds the one live subscription (Android Chrome / FCM, subscribed 2026-11-01; pushes delivered 2026-11-01 self-test and 2026-11-09 globalping criticals). Drew got no pushes on 2026-11-11 because of four specific gaps — this phase closes all four:
- His subscription predates the classes.
NOTIFICATION_CLASS_DEFAULTSturns needs-drew / quota-wall / quota-near-wall / stack-health / blocked-age ON for new rows, butclassEnabled()preserves old rows: for the 2026-11-01 subscription every class exceptincidentis effectively OFF. The candidates are derived every tick (buildNotificationCandidates) and filtered out for his only subscription. - Queue escalations never enter the stack. The aggregator's needs-drew census reads GitHub labels (
user/review,user/escalated) via the fleet feed. The 268 "waiting on Drew" tasks from the 2026-11-11 audit live in the fleet-queue Turso DB; the broker /repo-queueblock path has NO emission into the throat or the feed. - Nobody posts stack-down. The only incident source that has ever posted is
globalping-watch(public endpoints only). The board's own ~dozen 503 episodes on 2026-11-11 produced zero incidents — the aggregator cannot report itself, and no on-host sentinel watches it or its siblings. stack-healthis a class with no producer. Watchdog diagnoses exist (src/watchdog.ts, needs-orchestrator tier items) but nothing turns them into notification candidates/incidents.
Work
- Broker /
repo-queueblock-with-escalation path POSTs aneeds-drewevent to the throat (POST /api/alerts, intake token) at block time, carrying: ledger id, the question, the option list, issue links. The task row records the ledger id so an answer can unblock it mechanically. - Subscription class backfill: subscriptions created before a class existed get the reviewed defaults for that class (or a one-tap "apply reviewed defaults" on
/alerts/preferences). Drew's existing phone subscription must end with needs-drew + quota-wall + stack-health ON without re-subscribing. - Independent stack-health sentinel: a tiny systemd user unit (NOT inside the aggregator) probing loopback health of aggregator :4870, projector :7801, Kaneo :5173, dispatch :4879, OpenCode :13420, queue broker :4801 every ~30s, POSTing stack-health incidents to the throat on transitions. Honest limit: it cannot report the aggregator itself being dead to the throat — that case is Phase 2's dead-man's switch.
-
stack-healthcandidate producer in the aggregator from the watchdog diagnoses. - Answerable choices v1: a needs-drew push carries the question; ≤2 options ride as notification actions, more options deep-link to an answer page on the board listing every option as a tap target. Answer endpoint
POST /api/needs-drew/:ledgerId/answer(per-question token from the push payload, single-question scope) writes an answers outbox in aggregator state; the fleet-feed collector carries answers intofleet-feed.json; the dropped-thread catcher applies them topending-questions.json(status answered + answer text) and unblocks the originating queue task.
Acceptance (Drew's terms)
- Block a queue task as escalated-to-Drew → a push with the question and answer choices reaches Drew's phone in under a minute, no cron involved anywhere in the path.
- Tap an answer on the phone → the ledger shows the item answered and the blocked task unblocks, without Drew opening this chat.
- Kill the projector → a stack-health push arrives in under a minute.
- A sole-door pool hits a quota wall → a quota-wall push arrives in under a minute (proving the already-built candidate path end to end, live).
Metadata
Metadata
Assignees
Labels
app/pm-stackpm-stack (Pad/Grist) in developing-today/codepm-stack (Pad/Grist) in developing-today/codedesign/pm-notificationsDesign: pm-notifications - all issues of this effort carry itDesign: pm-notifications - all issues of this effort carry itkind/featureNew feature or capability requestNew feature or capability requestpriority/normalOrdinary priority (the default)Ordinary priority (the default)status:done
Activity
developing-today commentedon Nov 11, 2026
CODE-2558
dezren39 commentedon Nov 11, 2026
Phase 1 progress — step 1 (subscription class backfill): DONE, live.
Drew's existing phone subscription (id
cf18884d-214b-4402-95f1-3c3d1eb25aa6, created 2026-11-01) preserved in place; only itsclassesflags changed, via the aggregator's own Supabase path:{"incident": true}— every other class effectively OFF (the 2026-11-11 silence).{"incident": true, "needs-drew": true, "quota-wall": true, "quota-near-wall": true, "stack-health": true, "blocked-age": true}— the reviewedNOTIFICATION_CLASS_DEFAULTSfor every class the row didn't name; nothing the row named was altered.Read back twice: direct store query and the live
GET /api/push/subscriptionsprojection agree. No re-subscribe was needed. (His quiet-hours pref isenabled: false, so no class is time-gated for him.)dezren39 commentedon Nov 11, 2026
Phase 1 progress — catcher answer-application is live.
dropped-thread-catcher, hourly) now carries Step 2B — Apply needs-Drew push answers: on each run it reads theanswerssection of~/.local/state/pm-aggregator/fleet-feed.json, and for each new answer (deduped via a newappliedPushAnswersstate key): writes the ledger item answered in the same shape a chat answer uses (status: "answered", answer = chosen option label or free text,answered_at,via: "push"), unblocks the originating queue task found byprogress.needs_drew.ledger_idwith the auditedfleet queue unblockverb (reason names Drew's answer), and records the outcome. Fail-soft: an absentanswerssection is a no-op, so the step is safe before the feed producer lands. The run-log line gainedanswers applied <n>.Merge pull request #8597 from developing-today/queue/8568-notificatio…
dezren39 commentedon Nov 11, 2026
Fleet half of Phase 1 landed — PR #8598, merged as
ab15e73114a5c3234f7a18c20667cfb6e4d942ad.CLI half (live on CLI binary replacement):
repo-queue blockgains--ledger-id / --question / --context / --options-json / --links-json. Anescalated-to-userblock carrying ledger-id + question now (a) sendsneeds_drewin the/blockbody, (b) mergesneeds_drew: {ledger_id}into the progress object so the current broker stamps the ledger id onto the task row with no broker change, and (c) after the block lands, posts to the throat per the fixed contract (POST 127.0.0.1:4870/api/alerts,FLEET_ALERTS_URLoverride, sourcefleet-queue, keyneeds-drew:<ledgerId>, severitywarning). The intake token (pm-aggregator.alerts-intake-token— verified present in the secrets broker's name list) resolves by name in-process viafleet_secrets::Resolver::default_chain, the machinery behindfleet secrets get. Emission failure warns on stderr and still exits 0; stdout shape unchanged; escalated blocks without the flags are byte-for-byte the old behavior.Broker half (live only at the next broker binary replacement — the coordinated switch): the
/blockroute raises the same post fire-and-forget on a spawned thread after a successful escalated block with aneeds_drewpayload, token via the in-processDirectSecretssource, failures to stderr only. One wrinkle found on contact:dispatch()hands/blockto the Turso backend before the Postgres match arm whenQUEUE_BROKER_BACKEND=turso, so the hook was applied on both branches — a Postgres-arm-only hook would never have fired on a Turso-backed broker.Verification:
cargo test -p fleet-queue --all-features— 257 lib tests passed (7 newneeds_drewtests pin the exact throat body shape) + 2 broker_bin_args; default-features run 30 passed;cargo build --release -p fleetclean. No live block was performed (it would block a real task and push a phone).Staged, not deployed: release binary at
~/tools/staging/fleet-8568/fleet(sha2565735008dd51b85a11ee2412351e130dd416fab5155aca826b2ba691e683a0b90, 6,982,776 bytes).~/.local/bin/fleetuntouched, queue-broker not restarted — deployment is the coordinated switch's step, not this PR's.Contract notes: everything in the fixed wire contract held up.
answerUrlis returned frompost_needs_drewwhen the throat includes one (top-level or nested underalert); a successful raise without one returns an empty string rather than an error. The throat body'sbodyfield is context-when-present, else the blocker text, per the contract wording.dezren39 commentedon Nov 11, 2026
Aggregator half landed — PR #8597, merged ef02d88
Implemented the full aggregator side of Phase 1 against the fixed wire contract (intake extensions on
POST /api/alerts,POST /api/needs-drew/<ledgerId>/answer,GET /answer/<ledgerId>?t=<token>, feedanswers):src/needs-drew.ts(that file already held the pm-stack: one Needs-Drew queue of record — reconcile user/* labels with the aggregator Needs-you page #1226 label census, so the store was added as a new section rather than overwriting it): idempotent raise (token minted once viacrypto.randomUUID), first-answer-wins, open list < 7 days, atomic writes; configneedsDrewFile(PM_AGG_NEEDS_DREW_FILE).src/stack-health.tswithSENTINEL_SERVICE_IDS(aggregator, projector, kaneo, dispatch, opencode, queue-broker), previous-state return, configstackHealthFile.needsDrewresponse carries{ledgerId, answerUrl};stackHealth"up" closes the open incident viaAlertsStore.closeOpenIncidentByKey; both triggerrequestAlertTick()(new export, hooks the engine's guarded tick).needsDrewpayload field; sentinel-downservice:<id>candidates; health-derived candidate suppressed for sentinel-covered services with a sentinel record (full state map in the snapshot).PushPayload.answerset from the store token; payload URL becomes the token-carrying answer URL. Service worker — first 2 options become notification actions; an action tap POSTs the answer (token parsed from the answer URL into notification data) and closes.answers: [{ledgerId, optionId, freeText, answeredAt, via}].scripts/stack-sentinel.ts(30s loop) with the live-verified alive-sets: dispatch/404 = alive, queue-broker probed on its tailnet IP only (any HTTP response = alive; 401 expected), aggregator/boardwith a 15s timeout. First run baselines without posting unless a service is down; unposted transitions retry each round.Evidence
service:kaneoexactly once,health:kaneosuppressed,health:gristuntouched — PROOF OK. Store proof + sentinel dry run (against a dead mock throat, never the live one) pass: dispatch 404=up, queue-broker 401=up, projector 3s-timeout recorded down with post pending retry.Deploy read-backs (after the one permitted pm-aggregator restart)
GET /api/alerts.json→ 200.GET /api/push/subscriptions→ the subscription row carries all 6 classes (incident, needs-drew, quota-wall, quota-near-wall, stack-health, blocked-age).GET /sw.js→ contains the new answer-action handling.GET /answer/nonexistent?t=x→ 403.One contact note: during the sentinel dry run the projector probe timed out once at 3s while the verified fact is a 200 — probe flakiness under load, handled by design (recorded as a pending down post, retried next round).
dezren39 commentedon Nov 11, 2026
Phase 1 status: everything that can be live IS live; the broker's in-process half is staged for the coordinated switch (by design — the running broker binary is pre-fix and was not restarted).
Step 1 — subscription backfill (live). Drew's row
cf18884d-214b-4402-95f1-3c3d1eb25aa6:{"incident":true}→ all six classes true (incident, needs-drew, quota-wall, quota-near-wall, stack-health, blocked-age), row and endpoint preserved, quiet hours untouched (23:00–07:00 America/Chicago, enabled: false). Read back twice. (Earlier comment on this issue.)Step 2 — stack-health sentinel (live). Aggregator producer merged in PR #8597 (merge
ef02d881):POST /api/alertsacceptsstackHealthpayloads,service:<id>incidents, "up" closes the open incident (AlertsStore.closeOpenIncidentByKey). Independent sentinelscripts/stack-sentinel.tsruns as its own user unitpm-stack-sentinel.service(enabled, active, Restart=always), probing aggregator/projector/kaneo/dispatch/opencode/queue-broker every 30s and posting transitions only. Wire facts honored: the broker binds only its tailnet IP (any HTTP response = alive), dispatch's alive answer is 404, the aggregator board probe gets 15s. Baseline at 2026-11-11T07:41:49Z recorded all six services up and posted nothing;/api/alerts.jsonconfirms zeroservice:incidents. For sentinel-covered services the sentinel state is authoritative — the pre-existing health-derived candidates are suppressed for those ids (no double-reporting).Step 3 — needs-drew producer + answer path (live, except the broker half).
pm-aggregator.servicerestarted):needsDrewintake on the throat, question store (needs-drew.json, per-question token, first-answer-wins), breakthrough needs-drew candidates carrying the question + options, push payload answer enrichment, service-worker notification actions (first two options as tappable actions; other questions open the answer page),GET /answer/<ledgerId>?t=<token>page (403 without rendering the question on a bad token),POST /api/needs-drew/<ledgerId>/answer, and the fleet feed's newanswerssection.ab15e731):fleet queue blockwith--ledger-id/--question/--context/--options-json/--links-jsonon an escalated-to-user block stampsprogress.needs_drew.ledger_idand POSTs the question to the throat (token resolved in-process by name; failure = stderr warning, exit unchanged). Deployed live:~/.local/bin/fleetis now the staged build, sha2565735008dd51b85a11ee2412351e130dd416fab5155aca826b2ba691e683a0b90./blockhook raises the same event in-process. The running broker binary contains neither6a792f60noraba44429and was NOT restarted;~/.local/libexec/queue-coverage/fleetis untouched. It goes live when the switch deploys a current binary. Wrinkle found on contact: the broker hands/blockto the Turso backend before the Postgres arm, so the hook is wired on both branches.answersto the decisions ledger (answered,via: "push") and unblocks the originating task byneeds_drew.ledger_idwith the audited verb. Fail-soft while the section is absent; verified by cron read-back.Step 4 — the one live proof push. Sacrificial task 14917 (enqueued @90, claimed by id as
muse-8568-proof):needs-drew, objectRefneeds-drew:proof-8568-needs-drew, outcomesent, subscriptionIdcf18884d-…(the step-1 row).optionId: seen, 07:44:35Z, via api); a bad token was rejected first ("unknown question or bad token"); the answer surfaced infleet-feed.json'sanswerswithin ~2 minutes (collector cadence). Drew's own tap was not simulated.cancelled. The test incident was closed by hand through the aggregator's Supabase client; the missing auto-close is filed as needs-drew: close the alert incident when the question is answered #8605.Proof-run disclosure. While probing CLI usage, a bare
fleet queue claimclaimed real task 5865 under a default identity (the known trap, fourth firing). It was released within the minute with an explanatory reason and read backqueued@30 in Turso; no work was done on it.Design points that proved wrong on contact. (1) The design named
src/needs-drew.tsas a new file — it already existed (the #1226 census); the question store was appended as a delimited section instead. (2) The design assumed a 3s probe budget is safe — the projector probe flaked once at 3s under load during the sentinel dry run (handled: recorded down, post left pending for retry). (3) Answered needs-drew incidents do not auto-close (#8605). Everything else in the design's wire model held.Remaining for full Phase 1 close-out: the broker producer rides the coordinated switch; after it lands, one escalated block through a worker (not the CLI) re-proves the broker half.