Repository navigation
Conversation
Notification posted/removed events from paired nodes started one agent turn each. Queue them as system events only; the next real turn in the target session drains them. Adds a burst regression test and a source guard that fails if the handler regains a turn-starting call.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs changes before merge. What this changesThis PR queues Android notification events as passive session context instead of starting an agent turn for each event. Example: A paired Android phone posts notification notif-1 from com.example.chat.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness⛔ Needs changes before merge - 1 item remains Keep open: this maintainer-authored PR addresses notification-triggered model runs still present on main, but its added tests exceed the enforced test-line budget. Priority: P1 Before merge
Findings
Tests
Agent review detailsHow this fits togetherAndroid nodes send notifications.changed events to the Gateway, which resolves the session owner and queues notification text for prompt preparation. flowchart LR
A[Android notification] --> B[Gateway node event]
B --> C[Session and connection checks]
C --> D[Session system event queue]
D --> E[Next ordinary turn]
E --> F[Model prompt]
Technical reviewBest possible solution: Keep the focused producer-side handoff removal, retain concise behavioral coverage using existing session owners, and reconcile the remaining justified test growth. Do we have a high-confidence way to reproduce the issue? Current-main source directly queues and admits each accepted notification as a session-event turn, consistent with the author’s affected-Gateway report; no target code was executed during this review. Is this the best way to solve the issue? Removing turn admission at the notification producer addresses the stated cause while preserving routing and immediate currentness checks, without adding another scheduler or configuration option. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against c9caa4c75ca2. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
PR surfaceSource -30, Tests +54, Docs +2. Total +26 across 5 files. Added test files: 1. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 10, 2026, 10:02 PM ET / November 11, 2026, 03:02 UTC. |
Summary
High Level TLDR
Every phone notification forwarded by a paired Android node (
notifications.changed, posted or removed) started its own full agent turn. With notification forwarding on, a phone with normal traffic turns into a steady stream of model runs (and every per-turn plugin, such as memory extraction, runs too), billed to whatever model the target session uses. This makes device notifications passive again: they are queued as system events for the target session and the next real turn sees them. A notification never starts a turn on its own.Change
src/gateway/server-node-events-notifications.ts: queue the notification withenqueueSystemEventEntryand return. Removed theenqueueSessionEventForHosthandoff and its receipt consumption from this handler.server-node-events-notifications.guard.test.ts) fails if the handler references any turn-starting API again.docs/platforms/android.md: states that forwarded notifications are passive context.Scope: only
notifications.changed. Other node events (exec completion, voice transcripts, agent requests) are unchanged.Root Cause
#180106 (commit e897d98) changed this handler from "queue the event and request a batched heartbeat" to "queue the event and call
enqueueSessionEventForHost" for each event.enqueueSessionEventForHostadmits a session-event turn, so each posted or removed notification became one agent run in the target session (the system agent's main session by default). The commit ships in v2026.11.5-beta.1 and beta.2. It is not in v2026.11.3 stable.RCA proof, from a live Gateway on v2026.11.5-beta with an Android node forwarding notifications (identifiers redacted):
Notification posted (node=<redacted> key=<redacted> ...)/Notification removed (...)lines. There was no user message in them.enqueueSessionEventForHoston every event.Real behavior proof
pnpm vitest run src/gateway/server-node-events.test.ts src/gateway/server-node-events-notifications.guard.test.ts src/gateway/server-node-events.system-event-owner.test.ts src/gateway/server-node-events.session-events.test.tsgives 4 files and 71 tests passing.origin/mainhandler restored: 5 failed. These were the source guard, the 100-event burst, the passive-queue test, and both routing tests (each one sees a turn handoff).before_agent_replyhook drops notification-only turns. After it went in, there were 0 notification turns in the main session over the next window. That proves which turns were involved. It is not proof of this patch on a device.What was not tested
Verification
pnpm vitest runon the 4 files above: 71/71 passing. 5 fail on the old handler.pnpm check:changed: format, typecheck core and core tests, lint, import cycles, and boundary guards all ok. The dead export scan fails on existing exports in files this PR does not touch (for exampleextensions/knowledge/src/tool-results.tsandsrc/plugins/types.ts). None of the flagged exports come from this change.