Skip to content

fix(heartbeat): deliver Android notification wakes when heartbeat.every is 0m - #166522

Merged
vincentkoc merged 2 commits into
openclaw:mainfrom
jayzhou2309:fix/notification-event-wake-admission
Oct 7, 2026
Merged

vincentkoc merged 2 commits into
openclaw:mainfrom
jayzhou2309:fix/notification-event-wake-admission

Conversation

@jayzhou2309

@jayzhou2309 jayzhou2309 commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Closes #166508

What Problem This Solves

Fixes: Android notification events queue for the agent but never start a turn when heartbeat.every is "0m".

User Impact

User impact: with recurring heartbeats turned off, a posted or removed Android notification now wakes its target session once, as the heartbeat docs already promise for targeted event wakes. No recurring schedule is created.

Why This Change Was Made

The notifications.changed node handler requests its wake as notifications-event with intent event and reason notifications-event. isTargetedUnscheduledWake admitted notifications-event only in the immediate + "wake" shape that system.event and cron notifications use, so both the scheduler and the run-once gate dropped the node wake as disabled. The policy now admits that one exact producer shape, still requiring a session target. Every other source keeps its rule, and the busy, spacing, and flood guards apply as before.

Out of scope: the isolation and consumer questions in the issue. A separate point the review raised: this shape is not payload-flagged, so an effectively empty heartbeat scratch can still skip the turn as empty-heartbeat-file, the same as at any cadence today.

Evidence

  • New case in src/infra/heartbeat-runner.scheduler.test.ts (targeted unscheduled wake dispatch) sends the producer's exact request with every: "0m". On upstream/main it fails (runOnce called 0 times). With the fix it passes, 32/32 in the file.
  • Test cost: the regression is one more row in an existing it.each table, not a new file. The case itself takes 1 to 14 ms. pnpm test src/infra/heartbeat-runner.scheduler.test.ts runs all 32 cases in 3.69 s Vitest duration, 5.7 s wall on a warm cache. A cold run filtered to the new case (-t "runs one targeted notifications-event wake with disabled cadence") took 18.6 s wall, almost all of it transform.
  • Touched area: 53 test files (src/infra/heartbeat*, session-event-wake*, server-node-events*, system-event-routing, cron script-wake and failure-alert), 611/611 pass. oxlint and oxfmt --check are clean on the changed files, and pnpm tsgo:core passes.
  • Real behavior proof below: a real Gateway process, a paired node connection sending notifications.changed, and a local mock model, run on base and head.

Real behavior proof

Setup. Each run starts the real Gateway from the checkout with node scripts/run-node.mjs gateway run --port <port> --verbose (the same launcher as pnpm openclaw, which rebuilds dist from the checked-out source first). It uses a fresh OPENCLAW_STATE_DIR and OPENCLAW_SKIP_CHANNELS=1. The config sets agents.defaults.heartbeat.every: "0m", token auth, a non-empty HEARTBEAT.md, and agents.defaults.model.primary: "mock/mock-model", a custom openai-completions provider that points at a local HTTP server. That server answers HEARTBEAT_OK and logs every /v1/chat/completions call, so each logged call is a real agent turn that reached the model.

A tsx script outside Vitest pairs a device as an Android node through the device and node pairing store, connects to the Gateway over WebSocket with the repo's acquireGatewayTestClient helper from test/helpers/gateway-client.ts, which wraps GatewayClient (role: "node", platform: "android"), and sends node.event with event: "notifications.changed" and a posted notification payload. No sessionKey is in the payload, so the handler targets the main session, the same fallback the handler uses for any node that omits it. The script then waits 25 s.

Afterwards the script runs the real CLI openclaw system event --text "Operator probe" --mode now --session-key agent:main:main against the same Gateway. That wake shape is already admitted on base, so it works as a queue probe: any notification still queued shows up in that turn's prompt.

What is stubbed: the model is a local mock server, the node is a script on that client helper instead of the Android app, and pairing is approved directly in the store instead of through the approval prompt. The Gateway process, WebSocket auth, node.event dispatch, server-node-events, the system event queue, the heartbeat wake scheduler, runHeartbeatOnce, and the agent turn are all real and unmodified.

Command, from the checkout: <scratch>/run-proof.sh base with a282f8002a3 checked out, then <scratch>/run-proof.sh head on 1c59a01ea76. Build output is filtered and node ids are shortened.

Base a282f8002a3: the node event is accepted, then nothing runs for 25 s. The notification only reaches the model when the operator probe forces a wake, which shows it sat in the queue the whole time.

== base: a282f8002a3 fix(codex): prevent raw visualization directives in chat (#165728) ==
== heartbeat.every=0m
[node-client] paired android node 90197f0fd645
2026-10-07T16:55:23.736+08:00 [gateway] ready
[node-client] connected to gateway as role=node platform=android
[node-client] node.event notifications.changed -> {"ok":true}
== mock model calls after the notification window: 0
== queue probe: openclaw system event --mode now (an already-admitted wake shape) ==
{
  "ok": true
}
== mock model provider log ==
[mock-model] listening on 127.0.0.1:20583
[mock-model] chat.completions call #1 model=mock-model prompt contains: Notification posted (node=90197f0fd645... key=0|com.example.chat|42|proof package=com.example.chat): Alice - Lunch at 1? + Operator probe
== mock model total calls: 1
== gateway log (node connect, node.event, heartbeat, session turns) ==
2026-10-07T16:55:23.737+08:00 [heartbeat] disabled
2026-10-07T16:55:28.415+08:00 [ws] ← connect client=node-host clientDisplayName=proof android node version=1.0.0 mode=node clientId=node-host platform=android auth=token
2026-10-07T16:55:28.486+08:00 [ws] ⇄ res ✓ node.event 63ms bytes=92 id=2:46b1ca07-e…5d3e
2026-10-07T16:55:55.240+08:00 [ws] ← connect client=cli version=2026.9.8 mode=cli clientId=cli platform=macos auth=token
2026-10-07T16:55:55.560+08:00 [diagnostic] message received: channel=unknown chatId=heartbeat messageId=unknown sessionId=unknown sessionKey=agent:main:main source=dispatchInboundMessage
2026-10-07T16:55:57.199+08:00 [diagnostic] session turn created: runId=72801327-4acc-49d8-bb8a-cd326e3c4c41 sessionId=0c60a2ea-acd7-4102-8e6e-016637068de4 sessionKey=agent:main:main agentId=main channel=unknown trigger=heartbeat
2026-10-07T16:55:58.104+08:00 [diagnostic] message processed: channel=unknown chatId=heartbeat messageId=unknown sessionId=unknown sessionKey=agent:main:main outcome=completed duration=2543ms

Head 1c59a01ea76: one heartbeat turn starts about 270 ms after node.event returns, and its prompt carries the notification. The probe turn that follows no longer contains it, so the notification was consumed exactly once.

== head: 1c59a01ea76 fix(heartbeat): deliver node notification wakes with disabled cadence ==
== heartbeat.every=0m
[node-client] paired android node 4d01932fb8d6
2026-10-07T16:57:08.556+08:00 [gateway] ready
[node-client] connected to gateway as role=node platform=android
[node-client] node.event notifications.changed -> {"ok":true}
== mock model calls after the notification window: 1
== queue probe: openclaw system event --mode now (an already-admitted wake shape) ==
{
  "ok": true
}
== mock model provider log ==
[mock-model] listening on 127.0.0.1:29593
[mock-model] chat.completions call #1 model=mock-model prompt contains: Notification posted (node=4d01932fb8d6... key=0|com.example.chat|42|proof package=com.example.chat): Alice - Lunch at 1?
[mock-model] chat.completions call #2 model=mock-model prompt contains: <no notification text in prompt> + Operator probe
== mock model total calls: 2
== gateway log (node connect, node.event, heartbeat, session turns) ==
2026-10-07T16:57:08.557+08:00 [heartbeat] disabled
2026-10-07T16:57:13.067+08:00 [ws] ← connect client=node-host clientDisplayName=proof android node version=1.0.0 mode=node clientId=node-host platform=android auth=token
2026-10-07T16:57:13.155+08:00 [ws] ⇄ res ✓ node.event 82ms bytes=92 id=2:be3d2fc7-2…d585
2026-10-07T16:57:13.424+08:00 [diagnostic] message received: channel=unknown chatId=heartbeat messageId=unknown sessionId=unknown sessionKey=agent:main:main source=dispatchInboundMessage
2026-10-07T16:57:15.326+08:00 [diagnostic] session turn created: runId=20581dce-df30-456d-8c50-fab7bdf2c89d sessionId=650b3693-d70c-4bfb-b477-d53f4eadb6a8 sessionKey=agent:main:main agentId=main channel=unknown trigger=heartbeat
2026-10-07T16:57:16.747+08:00 [ws] → event heartbeat seq=per-client clients=1 dropIfSlow=true
2026-10-07T16:57:16.748+08:00 [diagnostic] message processed: channel=unknown chatId=heartbeat messageId=unknown sessionId=unknown sessionKey=agent:main:main outcome=completed duration=3324ms
2026-10-07T16:57:39.989+08:00 [ws] ← connect client=cli version=2026.9.8 mode=cli clientId=cli platform=macos auth=token
2026-10-07T16:57:40.270+08:00 [diagnostic] message received: channel=unknown chatId=heartbeat messageId=unknown sessionId=unknown sessionKey=agent:main:main source=dispatchInboundMessage
2026-10-07T16:57:40.411+08:00 [diagnostic] session turn created: runId=4db2cd43-7c35-44b6-b785-dd17952287ee sessionId=650b3693-d70c-4bfb-b477-d53f4eadb6a8 sessionKey=agent:main:main agentId=main channel=unknown trigger=heartbeat
2026-10-07T16:57:40.610+08:00 [diagnostic] message processed: channel=unknown chatId=heartbeat messageId=unknown sessionId=650b3693-d70c-4bfb-b477-d53f4eadb6a8 sessionKey=agent:main:main outcome=completed duration=340ms
Proof scripts

run-proof.sh

#!/bin/bash
# Usage: run-proof.sh <label>   (run from the openclaw checkout)
set -u
label=$1
here=$(cd "$(dirname "$0")" && pwd)
state="$here/state-$label"; rm -rf "$state"; mkdir -p "$state"
gw_port=$((20000 + RANDOM % 20000)); model_port=$((gw_port + 1))
export OPENCLAW_STATE_DIR=$state OPENCLAW_SKIP_CHANNELS=1 PROOF_GATEWAY_TOKEN=proof-token
unset OPENCLAW_GATEWAY_TOKEN OPENCLAW_CONFIG_PATH OPENCLAW_PROFILE
mkdir -p "$state/workspace"
printf '# Heartbeat\n\nCheck pending notification events and reply HEARTBEAT_OK if nothing needs the user.\n' > "$state/workspace/HEARTBEAT.md"
cat > "$state/openclaw.json" <<JSON
{
  "gateway": { "mode": "local", "bind": "loopback", "port": $gw_port, "auth": { "mode": "token", "token": "proof-token" } },
  "agents": { "defaults": {
    "workspace": "$state/workspace",
    "model": { "primary": "mock/mock-model" },
    "heartbeat": { "every": "0m" }
  } },
  "models": { "mode": "merge", "providers": { "mock": {
    "baseUrl": "http://127.0.0.1:$model_port/v1", "apiKey": "sk-mock", "api": "openai-completions",
    "request": { "allowPrivateNetwork": true },
    "models": [ { "id": "mock-model", "name": "Mock", "reasoning": false, "input": ["text"],
      "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 }, "contextWindow": 32000, "maxTokens": 1024 } ]
  } } }
}
JSON
echo "== $label: $(git log -1 --format='%h %s') =="
echo "== heartbeat.every=$(node -e 'console.log(require(process.argv[1]).agents.defaults.heartbeat.every)' "$state/openclaw.json")"
node "$here/mock-provider.mjs" "$model_port" > "$state/mock.log" 2>&1 & mock_pid=$!
node --import ./scripts/tsx.mjs "$here/node-client.mts" pair
node scripts/run-node.mjs gateway run --port "$gw_port" --verbose > "$state/gateway.log" 2>&1 & gw_pid=$!
for i in $(seq 1 180); do grep -q "\[gateway\] ready" "$state/gateway.log" 2>/dev/null && break; sleep 1; done
grep -m1 "\[gateway\] ready" "$state/gateway.log"
PROOF_OBSERVE_MS=${PROOF_OBSERVE_MS:-25000} node --import ./scripts/tsx.mjs "$here/node-client.mts" send "$gw_port"
echo "== mock model calls after the notification window: $(grep -c 'chat.completions call' "$state/mock.log")"
echo "== queue probe: openclaw system event --mode now (an already-admitted wake shape) =="
node scripts/run-node.mjs system event --text "Operator probe" --mode now --session-key agent:main:main --port "$gw_port" --token proof-token --json 2>&1 | grep -v "^\[" | tail -3
sleep 15
kill $gw_pid 2>/dev/null; wait $gw_pid 2>/dev/null; kill $mock_pid 2>/dev/null; wait $mock_pid 2>/dev/null
echo "== mock model provider log =="; cat "$state/mock.log"
echo "== mock model total calls: $(grep -c 'chat.completions call' "$state/mock.log")"
echo "== gateway log (node connect, node.event, heartbeat, session turns) =="
grep -E "\[heartbeat\]|← connect|res .* node\.event|event heartbeat|message received|session turn created|message processed|notification" "$state/gateway.log" | sed -e "s#$HOME#~#g" -e "s#$here#<scratch>#g" | head -40
cp "$state/gateway.log" "$here/gateway-$label.log"

node-client.mts

import path from "node:path";

const repo = process.cwd();
const src = (p: string) => path.join(repo, "src", p);
const [mode, gatewayPort] = process.argv.slice(2);

const { loadOrCreateDeviceIdentity, publicKeyRawBase64UrlFromPem } = await import(src("infra/device-identity.ts"));
const identity = loadOrCreateDeviceIdentity({
  path: path.join(process.env.OPENCLAW_STATE_DIR!, "proof-android-node.sqlite"),
});

if (mode === "pair") {
  const { requestDevicePairing } = await import(src("infra/device-pairing.ts"));
  const { approveDevicePairing } = await import(src("infra/device-pairing-approval.ts"));
  const { requestNodePairing, approveNodePairing } = await import(src("infra/device-pairing-node.ts"));
  const device = await requestDevicePairing({
    deviceId: identity.deviceId,
    publicKey: publicKeyRawBase64UrlFromPem(identity.publicKeyPem),
    role: "node",
    scopes: [],
    clientId: "node-host",
    clientMode: "node",
    platform: "android",
    deviceFamily: "Android",
  });
  await approveDevicePairing(device.request.requestId, { callerScopes: [] });
  const node = await requestNodePairing({ nodeId: identity.deviceId, platform: "android", deviceFamily: "Android", commands: [] });
  await approveNodePairing(node.request.requestId, { callerScopes: ["operator.pairing", "operator.write", "operator.admin"] });
  console.log(`[node-client] paired android node ${identity.deviceId.slice(0, 12)}`);
  process.exit(0);
}

const { acquireGatewayTestClient } = await import(path.join(repo, "test/helpers/gateway-client.ts"));
const client = await acquireGatewayTestClient(
  {
    url: `ws://127.0.0.1:${gatewayPort}`,
    token: process.env.PROOF_GATEWAY_TOKEN,
    clientName: "node-host",
    clientDisplayName: "proof android node",
    clientVersion: "1.0.0",
    platform: "android",
    deviceFamily: "Android",
    mode: "node",
    role: "node",
    scopes: [],
    commands: [],
    deviceIdentity: identity,
  },
  { timeoutMs: 15_000, timeoutMessage: "gateway connect timeout", closeMessage: "gateway closed during connect" },
);
console.log(`[node-client] connected to gateway as role=node platform=android`);
const payload = { change: "posted", key: "0|com.example.chat|42|proof", packageName: "com.example.chat", title: "Alice", text: "Lunch at 1?" };
const result = await client.request("node.event", { event: "notifications.changed", payload });
console.log(`[node-client] node.event notifications.changed -> ${JSON.stringify(result)}`);
await new Promise((r) => setTimeout(r, Number(process.env.PROOF_OBSERVE_MS ?? 20_000)));
await client.stopAndWait({ timeoutMs: 2_000 });
process.exit(0);

mock-provider.mjs

import http from "node:http";

const port = Number(process.argv[2]);
let calls = 0;
http
  .createServer((req, res) => {
    let body = "";
    req.on("data", (c) => (body += c));
    req.on("end", () => {
      if (req.method !== "POST" || !req.url.endsWith("/chat/completions")) {
        console.log(`[mock-model] ${req.method} ${req.url} -> 404`);
        res.writeHead(404).end();
        return;
      }
      calls += 1;
      const parsed = JSON.parse(body || "{}");
      const text = JSON.stringify(parsed.messages ?? []);
      const note = text.match(/Notification posted \([^)]*\)[^"\\]*/)?.[0] ?? "<no notification text in prompt>";
      const probe = text.includes("Operator probe") ? " + Operator probe" : "";
      console.log(`[mock-model] chat.completions call #${calls} model=${parsed.model} prompt contains: ${note}${probe}`);
      const reply = "HEARTBEAT_OK";
      if (parsed.stream) {
        res.writeHead(200, { "content-type": "text/event-stream" });
        const base = { id: "mock-1", object: "chat.completion.chunk", created: 0, model: parsed.model };
        res.write(`data: ${JSON.stringify({ ...base, choices: [{ index: 0, delta: { role: "assistant", content: reply }, finish_reason: null }] })}\n\n`);
        res.write(`data: ${JSON.stringify({ ...base, choices: [{ index: 0, delta: {}, finish_reason: "stop" }], usage: { prompt_tokens: 1, completion_tokens: 1, total_tokens: 2 } })}\n\n`);
        res.end("data: [DONE]\n\n");
      } else {
        res.writeHead(200, { "content-type": "application/json" });
        res.end(JSON.stringify({ id: "mock-1", object: "chat.completion", created: 0, model: parsed.model, choices: [{ index: 0, message: { role: "assistant", content: reply }, finish_reason: "stop" }], usage: { prompt_tokens: 1, completion_tokens: 1, total_tokens: 2 } }));
      }
    });
  })
  .listen(port, "127.0.0.1", () => console.log(`[mock-model] listening on 127.0.0.1:${port}`));

AI disclosure: this PR was written by an AI agent (Claude Code). It traced the issue from source, wrote the failing test first and the fix on top, and ran pnpm test on the files above, oxlint, oxfmt --check, and pnpm tsgo:core. It also ran the real Gateway proof above on base and head. A second model reviewed the diff.

🤖 Written and posted by an AI agent (Claude Code) on behalf of @jayzhou2309.

jayzhou2309 and others added 2 commits October 7, 2026 16:17
The node notifications.changed handler requests its wake as
notifications-event/event/notifications-event, but the unscheduled-wake
policy only admitted the immediate/"wake" shape used by system events and
cron. With heartbeat.every "0m" both admission gates rejected the wake.

Closes openclaw#166508

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@clawsweeper

clawsweeper Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 7, 2026
@clawsweeper

clawsweeper Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 7, 2026, 5:06 AM ET / 09:06 UTC (Revision 2).

ClawSweeper review

What this changes

The PR allows targeted Android notification events to start an agent turn when recurring heartbeats are disabled and adds a scheduler regression case.

Merge readiness

✅ Ready for maintainer review

This PR remains useful: current main and the latest release still reject the notification producer's wake shape. The added Gateway trace resolves the previous behavior-proof gap, and no blocking patch defect was found.

Priority: P2
Reviewed head: 1c59a01ea763ecfebe1cc5482cf89da5604ef713

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused shared-policy repair with a meaningful regression and sufficient before/after production-boundary evidence.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): Matched-source terminal logs exercise the changed shared admission owner through a real authenticated Gateway node.event request: with 0m cadence, head starts an agent turn containing the notification, while base leaves it queued until a manual probe. The scripted node and local model endpoint do not bypass the changed production boundary. This resolves the prior proof request; no stored-data contract changes require migration evidence.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): Matched-source terminal logs exercise the changed shared admission owner through a real authenticated Gateway node.event request: with 0m cadence, head starts an agent turn containing the notification, while base leaves it queued until a manual probe. The scripted node and local model endpoint do not bypass the changed production boundary. This resolves the prior proof request; no stored-data contract changes require migration evidence.
Evidence reviewed 11 items Pinned introduced change: The merge-base-to-head patch adds the exact notifications-event/event/notifications-event shape while retaining a session target and the existing immediate/wake shape. The verified test-merge comparison contains the same policy change.
Actual notification producer: After enqueueing a valid posted or removed notification, the node handler requests source notifications-event, intent event, reason notifications-event, and the resolved agent/session target.
Still necessary on current main: Fetched main still groups notifications-event with manual and restart-sentinel, accepting only immediate intent and reason wake. It therefore rejects the native notification producer's event shape.
Findings None None.
Security None None.

How this fits together

Android nodes send notification events to the Gateway, which queues them for a session and requests a heartbeat wake. Shared heartbeat admission decides whether that wake can reach agent execution without enabling a recurring schedule.

flowchart TD
  A[Android notification event] --> B[Gateway node event handler]
  B --> C[Session event queue]
  B --> D[Targeted wake admission]
  E[Heartbeat configuration] --> D
  D --> F[Scheduler and busy guards]
  C --> G[Agent turn]
  F --> G
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +5, Tests +7. Total +12 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 6 1 +5
Tests 1 7 0 +7
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 13 1 +12

Review metrics

None.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #166508
Summary: This PR is the candidate repair for the linked issue's wake-admission mismatch; its separate isolation and delivery questions remain outside the patch.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Keep one shared admission policy that accepts the native notification producer's exact targeted shape while preserving existing scheduling and execution guards.

Do we have a high-confidence way to reproduce the issue?

Yes: current-main source clearly rejects the notification handler's event-shaped request with 0m cadence, and the contributor supplies a matching before/after Gateway trace. This reviewer did not execute a reproduction.

Is this the best way to solve the issue?

Yes: extending the existing shared predicate repairs both admission gates without changing producer semantics or adding another execution path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against efcb55c85364.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. Matched-source terminal logs exercise the changed shared admission owner through a real authenticated Gateway node.event request: with 0m cadence, head starts an agent turn containing the notification, while base leaves it queued until a manual probe. The scripted node and local model endpoint do not bypass the changed production boundary. This resolves the prior proof request; no stored-data contract changes require migration evidence.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): Matched-source terminal logs exercise the changed shared admission owner through a real authenticated Gateway node.event request: with 0m cadence, head starts an agent turn containing the notification, while base leaves it queued until a manual probe. The scripted node and local model endpoint do not bypass the changed production boundary. This resolves the prior proof request; no stored-data contract changes require migration evidence.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This repairs a bounded notification-processing failure when recurring heartbeat cadence is disabled.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): Matched-source terminal logs exercise the changed shared admission owner through a real authenticated Gateway node.event request: with 0m cadence, head starts an agent turn containing the notification, while base leaves it queued until a manual probe. The scripted node and local model endpoint do not bypass the changed production boundary. This resolves the prior proof request; no stored-data contract changes require migration evidence.
  • proof: sufficient: Contributor real behavior proof is sufficient. Matched-source terminal logs exercise the changed shared admission owner through a real authenticated Gateway node.event request: with 0m cadence, head starts an agent turn containing the notification, while base leaves it queued until a manual probe. The scripted node and local model endpoint do not bypass the changed production boundary. This resolves the prior proof request; no stored-data contract changes require migration evidence.

Evidence

What I checked:

  • Pinned introduced change: The merge-base-to-head patch adds the exact notifications-event/event/notifications-event shape while retaining a session target and the existing immediate/wake shape. The verified test-merge comparison contains the same policy change. (src/infra/heartbeat-wake-policy.ts:76, 1c59a01ea763)
  • Actual notification producer: After enqueueing a valid posted or removed notification, the node handler requests source notifications-event, intent event, reason notifications-event, and the resolved agent/session target. (src/gateway/server-node-events.ts:872, 1c59a01ea763)
  • Still necessary on current main: Fetched main still groups notifications-event with manual and restart-sentinel, accepting only immediate intent and reason wake. It therefore rejects the native notification producer's event shape. (src/infra/heartbeat-wake-policy.ts:76, efcb55c85364)
  • Latest release remains affected: The policy in v2026.9.8 contains the same immediate/wake-only notification admission rule; this repair is not present in the supplied latest release. (src/infra/heartbeat-wake-policy.ts:76, fc23bc864e45)
  • Existing documented contract: Heartbeat documentation says 0m disables recurring cadence while targeted event wakes remain available, retain rate limits, and do not create a recurring schedule. Public docs: docs/gateway/heartbeat.md. (docs/gateway/heartbeat.md:25, 1c59a01ea763)
  • Shared guards remain authoritative: Both scheduler admission and execution admission consume the shared predicate. Configured-agent and global-disable checks remain, and notification event intent continues through existing spacing, flood, and busy guards. (src/infra/heartbeat-runner-execution.ts:150, 1c59a01ea763)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • R0gner: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-07T08:29:30.937Z sha 1c59a01 :: needs real behavior proof before merge. :: none

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 7, 2026
@vincentkoc vincentkoc self-assigned this Oct 7, 2026
@vincentkoc
vincentkoc merged commit de38a04 into openclaw:main Oct 7, 2026
139 checks passed
@vincentkoc

Copy link
Copy Markdown
Member

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 8, 2026
…ry is 0m (openclaw#166522)

* test(heartbeat): cover node notification wakes with disabled cadence

* fix(heartbeat): deliver node notification wakes with disabled cadence

The node notifications.changed handler requests its wake as
notifications-event/event/notifications-event, but the unscheduled-wake
policy only admitted the immediate/"wake" shape used by system events and
cron. With heartbeat.every "0m" both admission gates rejected the wake.

Closes openclaw#166508

Co-authored-by: Jay Zhou <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Android notification event wake rejected with heartbeat.every=0m

2 participants