Repository navigation
fix(push): a coordinator's quiet wake no longer pushes to the phone - #599
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
NoahHendrickson
left a comment
There was a problem hiding this comment.
Review of head 05030e5723dfcdc81835c9af51bf2f383e92b1b5 (base 5acf7f1c12). Verdict: changes requested, not approved.
The change is small and the file stays under 1k lines (887 → 927). But the new check sits in the wrong place in the alert pipeline, and that causes a real regression.
1. Blocker: this rule only makes sense for completions, but it runs on every alert, so it can silence a child's approval.
alertUnlessSilent handles every notification: needs-approval, needs-input, failed and completed. isQuietCoordinatorWake never looks at which kind it is; it only reads the coordinator's latestRunId. A delegate_task child's approval (and a userOnly question) reaches the coordinator's row through subagentAwaitsUser, and DelegatedTaskQuestionReactor doesn't wake the parent for approvals at all. In that case the coordinator's latest run is still whatever ran last. Concrete case:
- The coordinator delegates A and B. A finishes, the coordinator wakes, replies "Nothing to report.", and the run completes. The completion push is dropped (that's intended).
- B then hits an approval.
observeListedThread(parent)sends an awaiting-approval notification withlatestRunId= A's quiet wake run. isQuietCoordinatorWakereturns true, so the approval push is dropped. The owner never hears that B is blocked.
This is the exact case the catch block's comment warns about ("a missed approval costs more than an extra notification"). The fix also cleans up the design: this is a reason to silence a completion, so make it one. Gate it on notification.completion, or better, keep it on the same path as silentCompletionReason: a held completion's silencers, with the async transcript read only for completions. Add a test that sends a non-completion notification for a coordinator whose latest run is a quiet wake and expects it to push.
2. "This is the run the desktop already hides" isn't true. This is a second, hand-built definition of the same rule, and it already disagrees with the first.
quietBotWakeRunIds(…, "coordinator") in apps/web/src/custom/bots/quietBotWakes.ts always shows a run that started a thread (fork-thread-launch with callStatus === "started"). This check doesn't, so a wake that launched a thread and replied "Nothing to report." is shown on desktop but silenced on the phone. The two also identify a completion notice in different ways: desktop uses outcome === "completed" plus "not a question message id", push uses outcome === "completed" alone. They agree today only because the question reactor happens to use "updated". Two copies of one policy will keep drifting. Ideally, put one predicate over raw turn items in packages/shared (next to isForkBotQuietReply and isForkCoordinatorThread) and have both sides use it. At minimum, add the started-thread rule here and change the doc comment so it doesn't claim the two are the same.
3. TurnItemSummary is turning into a loose copy of the contract.
This PR adds five more optional fields (createdBy?, text?, streaming?, source?: { kind: string }, outcome?: string) to a hand-written mirror of OrchestrationV2TurnItem, which is then cast in with as. That's why the new code needs ?., ?? "" and ?? "user", and why item.type === "notification" doesn't narrow anything. Picking the needed fields from the contracts union (Extract<OrchestrationV2TurnItem, { type: "notification" }> and so on) would make those fallbacks go away and would catch the next rename at compile time, not with a push that's silently wrong.
Smaller point: passing the coordinator flag through AlertRun (with a doc comment explaining the server's report column) is reasonable. If #1 moves the check onto the completion path, the flag is still the right input there.
I didn't run the tests: this review worktree has no node_modules. Findings 1 and 2 come from reading observeListedThread, subagentAwaitsUser, DelegatedTaskQuestionReactor and quietBotWakeRunIds.
NoahHendrickson
left a comment
There was a problem hiding this comment.
Code review of 05030e5723dfcdc81835c9af51bf2f383e92b1b5 (/code-review high). I checked every finding against the source.
2 important, 1 nit.
- Important:
isQuietCoordinatorWakealso runs on approval alerts and can drop them (inline atno3yPush.mts:660). - Important: a quiet wake that started a thread is silenced here, but the desktop timeline shows it (inline at
no3yPush.mts:374). - Nit (outside the diff):
apps/web/src/components/ThreadNotificationCoordinator.tsx:336. The desktop/web system notification gate treats a completion as quiet only for bot threads (isBotThread(state.raw) && isQuietBotCompletion(...)). After this PR, a coordinator's quiet wake stays off the phone but still raises a desktop "Completed" notification. Either apply the same coordinator rule there or say in the PR that only the phone is covered. CLAUDE.md, "Hit every surface".
🤖 Signed: Claude Opus 5.5 (claude-opus-5-5) via Claude Code
The quiet-wake check now runs only for completions, so a subagent's approval that alerts with the coordinator's quiet latest run still pushes. A wake that launched a thread is news, as on the desktop. Turn items are typed from the contract's wire shape. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Status after a42afa9:
|
A coordinator's phone got an "Agent finished" push every time a finished child woke it and it replied "Nothing to report." #585 silences a bot's quiet wake by reading the report on its shell. The server builds that report only for bot-tagged threads (
ProjectionStore.ts,fork_bot_report_json), so a coordinator'slatestVisibleMessageis always null and that check never applied. Sprints are bots and were already silent.Fix (
apps/mobile/fork/push-service/no3yPush.mtsonly): before it sends,alertUnlessSilentalready fetches the thread's bounded snapshot.transcriptSilentReasonnow holds both transcript checks: the existing automation one and a new quiet-coordinator one. The new check runs only for completions. It drops the push when all of these hold for the latest run:isForkCoordinatorThread);outcome: "completed");t3_thread_launchcall;isForkBotQuietReply).Turn items are typed from the contract's wire shape (
OrchestrationV2TurnItem.Encoded).What still pushes:
subagentAwaitsUser).Phone only. A coordinator's quiet wake can still raise a desktop or web system notification (
ThreadNotificationCoordinator.tsx). That is a follow-up, as is sharing one predicate with the desktop'squietBotWakeRunIds.Tests: in
no3yPush.test.ts. The tracker hands a coordinator's completion on withcoordinator: true. The check passes only a finished child's quiet wake. Question, mixed, failed, owner-started, thread-launching and still-streaming wakes keep pushing, as do non-coordinator threads and a subagent approval after a quiet wake. That last test fails without the completion gate.Takes effect once the main checkout pulls
customand the push login item restarts.Reviewed with sol-loop: 2 rounds with GPT-6.1 Sol (
gpt-6.1-sol) on high. Sol verdict: approved🤖 Signed: Claude Opus 5.5 (
claude-opus-5-5) via Claude Code🤖 Reviewer: GPT-6.1 Sol (
gpt-6.1-sol, high) via Codex, sol-loop review (2 rounds, no changes requested)🤖 Generated with Claude Code