Skip to content

fix: let agents ignore phone notifications without falling back to a paid model - #200741

Merged
obviyus merged 3 commits into
openclaw:mainfrom
vaibhav375:fix/200710-notification-no-reply
Nov 17, 2026
Merged

obviyus merged 3 commits into
openclaw:mainfrom
vaibhav375:fix/200710-notification-no-reply

Conversation

@vaibhav375

@vaibhav375 vaibhav375 commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Root cause: src/gateway/server-node-events-notifications.ts:128 admits phone notifications through enqueueSessionEventForHost without the producer's replyExpectation: "optional", so in a WebChat session the internal_system turn resolves as result-required (src/agents/reply-completion.ts:116-122) and the CLI runner rejects an authored NO_REPLY as empty_response, which starts model fallback.

Fixes #200710

Thanks @dawidkulpa for the report with exact before/after counts, and @vaibhav375 for the fix.

What Problem This Solves

Since 2026.11.5, when an agent decides a forwarded phone notification needs no answer and replies NO_REPLY, the turn fails with "CLI backend returned an empty response." and OpenClaw retries it on the fallback model. With a subscription CLI backend and an API-billed fallback, every ignored notification becomes a paid request and an "Unable to finish this reply" card in WebChat.

User Impact

User impact: agents can ignore phone notifications again. A NO_REPLY answer ends the turn silently, with no error card and no fallback model call. Notifications the agent does answer still get their reply.

Why This Change Was Made

#180106 (e897d98) moved notifications from heartbeat wakes, which allowed silence, onto ordinary host session events, without carrying over that permission. The notification producer now passes replyExpectation: "optional", the same producer-owned waiver cron notifications and session-state notices already pass. Input provenance alone still grants no silence, so other internal_system turns keep their result requirement.

The branch keeps the contributor's fix commit. The in-process Gateway test and the docs note are folded into one assertion in the existing notification routing case, which fails on main and passes here.

Evidence

Isolated source Gateway (ocx src), loopback, throwaway state. The agent's primary and fallback models are a scripted local CLI backend that logs every call. A WebChat client sends chat.send to agent:main:main, then a paired openclaw-android node sends notifications.changed for a promo (model answers NO_REPLY) and for a bank alert (model answers with text, the control).

main 93d84036cc7d
  promo-1: model calls=2  primary -> NO_REPLY, fallback -> "fallback answer for promo-1"
  cli terminal failure: provider=scripted-cli model=primary ... error=CLI backend returned an empty response.
  model fallback decision: decision=candidate_failed ... reason=empty_response next=scripted-cli/fallback
  urgent-1 (control): model calls=1, reply delivered
this PR
  promo-1: model calls=1  primary -> NO_REPLY; no assistant message, 0 empty_response lines, 0 fallback decisions
  urgent-1 (control): model calls=1, reply delivered

Regression test: src/gateway/server-node-events.test.ts passes 52/52 here; on main the two notification routing cases fail on the missing replyExpectation: "optional".

Contributor live run with the real claude-cli backend (redacted; Gateway lines in IST, client lines in UTC)
### AFTER (this PR)
[2026-11-17T20:59:06.734Z] phone -> node.event notifications.changed {"change":"posted","key":"proof-1794949146731","packageName":"com.example.shop","title":"Weekend sale","text":"20% off everything this weekend"}
[2026-11-17T20:59:29.741Z] gateway accepted node.event: {"ok":true}
[claude stream] text_delta "text":"NO_REPLY"
2026-11-18T02:29:53.981+05:30 [agent/cli-backend] cli turn: provider=claude-cli model=claude-haiku-4-5 durationMs=9600 outBytes=8 outHash=b07800ad4773
[2026-11-17T20:59:05.295Z] webchat watching for 150s
[2026-11-17T20:59:33.317Z] webchat sees agent {"sessionKey":"agent:main:main","state":"start","stream":"lifecycle"}
[2026-11-17T20:59:45.663Z] webchat sees agent {"sessionKey":"agent:main:main","state":"starting_model","stream":"run_status"}
[2026-11-17T20:59:52.985Z] webchat sees agent {"sessionKey":"agent:main:main","stream":"thinking"}
[2026-11-17T20:59:55.153Z] webchat sees agent {"sessionKey":"agent:main:main","state":"model","stream":"lifecycle"}
[2026-11-17T20:59:55.162Z] webchat sees agent {"sessionKey":"agent:main:main","state":"end","stream":"lifecycle"}
[2026-11-17T20:59:55.165Z] webchat sees chat {"sessionKey":"agent:main:main","state":"final"}

### BEFORE (main)
[2026-11-17T21:20:11.996Z] phone -> node.event notifications.changed {"change":"posted","key":"proof-1794950411995","packageName":"com.example.shop","title":"Weekend sale","text":"20% off everything this weekend"}
[2026-11-17T21:20:21.484Z] gateway accepted node.event: {"ok":true}
2026-11-18T02:50:33.766+05:30 [agent/cli-backend] cli live session start: provider=claude-cli model=claude-haiku-4-5 activeSessions=1
[claude stream] text_delta "text":"NO_REPLY"
2026-11-18T02:50:42.818+05:30 [agent/cli-backend] cli turn: provider=claude-cli model=claude-haiku-4-5 durationMs=9391 outBytes=8 outHash=b07800ad4773
2026-11-18T02:50:42.845+05:30 [agent/cli-backend] cli empty response diagnostics: backend=claude-cli reason=exit exitCode=0 exitSignal=null durationMs=9158 stdoutBytes=19295 stdoutHash=01933c6de95a stderrBytes=0 stderrHash=e3b0c44298fc useResume=false
2026-11-18T02:50:42.854+05:30 [agent/cli-backend] cli terminal failure: provider=claude-cli model=claude-haiku-4-5 durationMs=19303 runId=<id> error=CLI backend returned an empty response.
2026-11-18T02:50:44.443+05:30 [model-fallback/decision] model fallback decision: decision=candidate_failed requested=anthropic/claude-haiku-4-5 candidate=anthropic/claude-haiku-4-5 reason=empty_response next=openai/gpt-5.4
2026-11-18T02:51:02.161+05:30 [model-fallback/decision] model fallback decision: decision=candidate_failed requested=anthropic/claude-haiku-4-5 candidate=openai/gpt-5.4 reason=model_not_found next=none
2026-11-18T02:51:02.198+05:30 Embedded agent failed before reply: All models failed (2): anthropic/claude-haiku-4-5: CLI backend returned an empty response. (empty_response) | openai/gpt-5.4: Unknown model: openai/gpt-5.4. GPT-5.4 has retired from the ChatGPT-account Codex route. Run `openclaw doctor --fix` to replace it with gp
2026-11-18T02:51:03.236+05:30 [gateway] notification event not delivered node=<node-id>: failed
[2026-11-17T21:20:06.510Z] webchat watching for 150s
[2026-11-17T21:20:23.374Z] webchat sees agent {"sessionKey":"agent:main:main","state":"start","stream":"lifecycle"}
[2026-11-17T21:20:33.822Z] webchat sees agent {"sessionKey":"agent:main:main","state":"starting_model","stream":"run_status"}
[2026-11-17T21:20:42.640Z] webchat sees agent {"sessionKey":"agent:main:main","stream":"thinking"}
[2026-11-17T21:20:44.529Z] webchat sees agent {"sessionKey":"agent:main:main","state":"model","stream":"lifecycle"}
[2026-11-17T21:20:44.533Z] webchat sees agent {"sessionKey":"agent:main:main","state":"fallback_step","stream":"lifecycle"}
[2026-11-17T21:21:02.019Z] webchat sees agent {"sessionKey":"agent:main:main","state":"preparing_workspace","stream":"run_status"}
[2026-11-17T21:21:02.275Z] webchat sees agent {"sessionKey":"agent:main:main","state":"preparing_context","stream":"run_status"}
[2026-11-17T21:21:02.275Z] webchat sees agent {"sessionKey":"agent:main:main","state":"model","stream":"lifecycle"}
[2026-11-17T21:21:02.277Z] webchat sees agent {"sessionKey":"agent:main:main","state":"fallback_step","stream":"lifecycle"}
[2026-11-17T21:21:02.295Z] webchat sees agent {"sessionKey":"agent:main:main","state":"error","stream":"lifecycle"}
[2026-11-17T21:21:03.162Z] webchat sees chat {"sessionKey":"agent:main:main","state":"error","error":"All models failed (2): anthropic/claude-haiku-4-5: CLI backend returned an empty response. (empty_response) | openai/gpt-5.4: Unknown model: openai/gpt-5.4. GPT-5.4 has retired from the ChatGPT-account Codex route. Run `openclaw doctor --fi..."}

Node IDs, run IDs and local paths are redacted. All traffic is on 127.0.0.1. The extra claude-haiku-5-5 CLI turn after each run is OpenClaw's utility session recap, not a retry.

Merge danger: two-way door. One field on one producer, no stored state or contract change; a revert restores the 2026.11.5 behavior. Blast radius: forwarded device notifications only.

Since 2026.11.5, notifications are ordinary host session events. In a
WebChat session they resolve as result-required, so an agent that
answers NO_REPLY to a notification fails as empty_response and the turn
falls back to the next model. With a CLI backend and an API-billed
fallback, every ignored notification became a paid request and an
error card.

The notification producer now passes replyExpectation "optional" to
enqueueSessionEventForHost, the same producer-owned waiver the cron
repair turn uses. Input provenance still grants no silence.

Closes openclaw#200710
@clawsweeper

clawsweeper Bot commented Nov 17, 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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: android App: android gateway Gateway runtime size: XS labels Nov 17, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 17, 2026
@clawsweeper

clawsweeper Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Allows forwarded phone notifications to complete silently without triggering model fallback.

Example: A paired Android node forwards a com.example.shop sale notification into a WebChat session using claude-cli.

  • Before: The agent's NO_REPLY becomes empty_response and triggers the configured fallback model.
  • After: NO_REPLY completes silently without fallback or a WebChat error card.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A useful, minimal repair with sufficient runtime evidence and no blocking findings; the added mock assertion has limited regression value and exact-head CI remains incomplete.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (logs): Supplied redacted logs exercise notifications.changed through paired-node WebSocket ingress, an isolated Gateway, a real Claude CLI agent, and WebChat observation: NO_REPLY fails and attempts fallback before the fix, then completes silently afterward; the production fix is unchanged since that proof, and a separate scripted-CLI run preserves a visible notification reply.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Ignored phone notifications can cause paid fallback requests and false WebChat error cards.
Reason: The official-release report and runtime logs establish concrete user harm, and the repair reuses the existing producer-owned silence contract.

Regression provenance

Possible regression — probable (failure trace; reviewed change). No predecessor PR is attributed.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR provides a minimal repair for a current notification-completion bug, with no blocking correctness or security findings.

Priority: P1
Reviewed head: d707d590c73a5546c06a3b917ff34a12f1322823

Before merge

None.

Findings

None.

Tests

  • Low-value test src/gateway/server-node-events.test.ts: Remove the added mocked handoff-argument assertion while retaining the existing routing checks: it echoes the new optional field without exercising silent completion or fallback.
Agent review details

How this fits together

The Gateway converts paired-device notifications into ordinary session events; host-owned reply options determine whether agent completion may be silent.

flowchart LR
  A[Paired Android node] --> B[Gateway notification handler]
  B --> C[Host session event]
  C --> D[Reply admission]
  D --> E[CLI agent completion]
  E --> F[Silent completion or visible reply]
Loading

Technical review

Best possible solution:

Keep the notification producer's explicit silence waiver while preserving shared completion enforcement for other internal work.

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

The reporter supplies an official-release reproduction and before/after counts, the contributor supplies real Gateway failure and recovery logs, and current-main source retains the responsible missing option; this review executed no target code.

Is this the best way to solve the issue?

This is the smallest production repair: the existing producer selects an existing host-owned option, without weakening shared reply requirements or introducing another policy owner.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Notification admission through ordinary session events keeps the original intent (e897d98: Retire heartbeat scheduling entry points while retaining session-controller admission, settlement, and captured notification destinations.)
  • Notification routing regression keeps the original intent (e897d98: Update notification routing coverage for ordinary host session-event admission.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

PR surface

Source +2, Tests +5. Total +7 across 2 files. Added test files: 0.

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

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #200710
Summary: This PR repairs the device-notification failure tracked by the linked issue; the earlier cron repair concerns a distinct producer using the same established contract.

Members:

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

Labels

Label changes:

No label changes.

Label justifications:

  • P1: An affected released workflow repeatedly turns deliberate silence into unnecessary fallback requests, potential API charges, and WebChat errors.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (3 earlier review cycles)
  • reviewed 2026-11-17T18:51:42.234Z sha 8636d97 :: needs real behavior proof before merge. :: none
  • reviewed 2026-11-17T20:19:29.085Z sha 1f29b8c :: needs real behavior proof before merge. :: none
  • reviewed 2026-11-17T21:28:17.277Z sha 1f29b8c :: needs maintainer review before merge. :: none

Reviewed November 17, 2026, 6:19 PM ET / 23:19 UTC (Revision 4).

…turn

Replace the handoff-argument assertion with a regression that pairs a
node over WebSocket, posts a notifications.changed event into a WebChat
session, and runs the turn through real session-event admission, reply
dispatch and CLI completion with only the external CLI process stubbed.

Without the producer fix the turn fails with "CLI backend returned an
empty response." (a FailoverError, which starts model fallback). With
it, the authored NO_REPLY settles silently and the CLI runs once.

Related: openclaw#200710
@vaibhav375

Copy link
Copy Markdown
Contributor Author

Replaced the mock-argument assertion with a Gateway-level regression (server.node-notification-silence.test.ts): a paired node posts notifications.changed over WebSocket into a WebChat session and the turn runs through real admission, reply dispatch and CLI completion. It fails on main with the reported empty_response FailoverError and passes with the fix (silent, one CLI call, no fallback). Evidence in the PR body is updated.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@vaibhav375

Copy link
Copy Markdown
Contributor Author

Added live runtime proof to the PR body: two isolated Gateways (main and this branch) running anthropic/claude-haiku-4-5 through the real claude-cli backend, with a paired node over WebSocket posting notifications.changed into a WebChat main session. On main, Claude's NO_REPLY is recorded as empty_response, the fallback decision moves to the next model, and WebChat gets an error state. With this PR, the same reply settles final with no failure, fallback or error. A redacted log excerpt is in the Evidence section.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@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: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Nov 17, 2026
- The Gateway-level CLI test and the docs note are replaced by one assertion that notification admission passes replyExpectation optional; it fails on main.
@obviyus

obviyus commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@openclaw-barnacle openclaw-barnacle Bot removed docs Improvements or additions to documentation app: android App: android labels Nov 17, 2026
@clawsweeper

clawsweeper Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@obviyus

obviyus commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@obviyus
obviyus merged commit c97a173 into openclaw:main Nov 17, 2026
130 of 133 checks passed
@obviyus

obviyus commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator

Thanks @vaibhav375 for the fix and @dawidkulpa for the report. This is merged in c97a173: phone notifications delivered to a WebChat session allow a silent answer again, so an authored NO_REPLY no longer fails as an empty response and no longer falls back to the paid model. Notifications that need a reply still get one.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 18, 2026
…paid model (openclaw#200741)

Root cause: src/gateway/server-node-events-notifications.ts:128 admits phone notifications through `enqueueSessionEventForHost` without the producer's `replyExpectation: "optional"`, so in a WebChat session the `internal_system` turn resolves as result-required (src/agents/reply-completion.ts:116-122) and the CLI runner rejects an authored `NO_REPLY` as `empty_response`, which starts model fallback.

Fixes openclaw#200710

Thanks @dawidkulpa for the report with exact before/after counts, and @vaibhav375 for the fix.

## What Problem This Solves

Since 2026.11.5, when an agent decides a forwarded phone notification needs no answer and replies `NO_REPLY`, the turn fails with "CLI backend returned an empty response." and OpenClaw retries it on the fallback model. With a subscription CLI backend and an API-billed fallback, every ignored notification becomes a paid request and an "Unable to finish this reply" card in WebChat.

## User Impact

User impact: agents can ignore phone notifications again. A `NO_REPLY` answer ends the turn silently, with no error card and no fallback model call. Notifications the agent does answer still get their reply.

## Why This Change Was Made

openclaw#180106 (a67f6bd) moved notifications from heartbeat wakes, which allowed silence, onto ordinary host session events, without carrying over that permission. The notification producer now passes `replyExpectation: "optional"`, the same producer-owned waiver cron notifications and session-state notices already pass. Input provenance alone still grants no silence, so other `internal_system` turns keep their result requirement.

The branch keeps the contributor's fix commit. The in-process Gateway test and the docs note are folded into one assertion in the existing notification routing case, which fails on `main` and passes here.

## Evidence

Isolated source Gateway (`ocx src`), loopback, throwaway state. The agent's primary and fallback models are a scripted local CLI backend that logs every call. A WebChat client sends `chat.send` to `agent:main:main`, then a paired `openclaw-android` node sends `notifications.changed` for a promo (model answers `NO_REPLY`) and for a bank alert (model answers with text, the control).

```
main 7bd8ea3
  promo-1: model calls=2  primary -> NO_REPLY, fallback -> "fallback answer for promo-1"
  cli terminal failure: provider=scripted-cli model=primary ... error=CLI backend returned an empty response.
  model fallback decision: decision=candidate_failed ... reason=empty_response next=scripted-cli/fallback
  urgent-1 (control): model calls=1, reply delivered
this PR
  promo-1: model calls=1  primary -> NO_REPLY; no assistant message, 0 empty_response lines, 0 fallback decisions
  urgent-1 (control): model calls=1, reply delivered
```

Regression test: `src/gateway/server-node-events.test.ts` passes 52/52 here; on `main` the two notification routing cases fail on the missing `replyExpectation: "optional"`.

<details>
<summary>Contributor live run with the real claude-cli backend (redacted; Gateway lines in IST, client lines in UTC)</summary>

```
### AFTER (this PR)
[2026-11-17T20:59:06.734Z] phone -> node.event notifications.changed {"change":"posted","key":"proof-1794949146731","packageName":"com.example.shop","title":"Weekend sale","text":"20% off everything this weekend"}
[2026-11-17T20:59:29.741Z] gateway accepted node.event: {"ok":true}
[claude stream] text_delta "text":"NO_REPLY"
2026-11-18T02:29:53.981+05:30 [agent/cli-backend] cli turn: provider=claude-cli model=claude-haiku-4-5 durationMs=9600 outBytes=8 outHash=b07800ad4773
[2026-11-17T20:59:05.295Z] webchat watching for 150s
[2026-11-17T20:59:33.317Z] webchat sees agent {"sessionKey":"agent:main:main","state":"start","stream":"lifecycle"}
[2026-11-17T20:59:45.663Z] webchat sees agent {"sessionKey":"agent:main:main","state":"starting_model","stream":"run_status"}
[2026-11-17T20:59:52.985Z] webchat sees agent {"sessionKey":"agent:main:main","stream":"thinking"}
[2026-11-17T20:59:55.153Z] webchat sees agent {"sessionKey":"agent:main:main","state":"model","stream":"lifecycle"}
[2026-11-17T20:59:55.162Z] webchat sees agent {"sessionKey":"agent:main:main","state":"end","stream":"lifecycle"}
[2026-11-17T20:59:55.165Z] webchat sees chat {"sessionKey":"agent:main:main","state":"final"}

### BEFORE (main)
[2026-11-17T21:20:11.996Z] phone -> node.event notifications.changed {"change":"posted","key":"proof-1794950411995","packageName":"com.example.shop","title":"Weekend sale","text":"20% off everything this weekend"}
[2026-11-17T21:20:21.484Z] gateway accepted node.event: {"ok":true}
2026-11-18T02:50:33.766+05:30 [agent/cli-backend] cli live session start: provider=claude-cli model=claude-haiku-4-5 activeSessions=1
[claude stream] text_delta "text":"NO_REPLY"
2026-11-18T02:50:42.818+05:30 [agent/cli-backend] cli turn: provider=claude-cli model=claude-haiku-4-5 durationMs=9391 outBytes=8 outHash=b07800ad4773
2026-11-18T02:50:42.845+05:30 [agent/cli-backend] cli empty response diagnostics: backend=claude-cli reason=exit exitCode=0 exitSignal=null durationMs=9158 stdoutBytes=19295 stdoutHash=01933c6de95a stderrBytes=0 stderrHash=e3b0c44298fc useResume=false
2026-11-18T02:50:42.854+05:30 [agent/cli-backend] cli terminal failure: provider=claude-cli model=claude-haiku-4-5 durationMs=19303 runId=<id> error=CLI backend returned an empty response.
2026-11-18T02:50:44.443+05:30 [model-fallback/decision] model fallback decision: decision=candidate_failed requested=anthropic/claude-haiku-4-5 candidate=anthropic/claude-haiku-4-5 reason=empty_response next=openai/gpt-5.4
2026-11-18T02:51:02.161+05:30 [model-fallback/decision] model fallback decision: decision=candidate_failed requested=anthropic/claude-haiku-4-5 candidate=openai/gpt-5.4 reason=model_not_found next=none
2026-11-18T02:51:02.198+05:30 Embedded agent failed before reply: All models failed (2): anthropic/claude-haiku-4-5: CLI backend returned an empty response. (empty_response) | openai/gpt-5.4: Unknown model: openai/gpt-5.4. GPT-5.4 has retired from the ChatGPT-account Codex route. Run `openclaw doctor --fix` to replace it with gp
2026-11-18T02:51:03.236+05:30 [gateway] notification event not delivered node=<node-id>: failed
[2026-11-17T21:20:06.510Z] webchat watching for 150s
[2026-11-17T21:20:23.374Z] webchat sees agent {"sessionKey":"agent:main:main","state":"start","stream":"lifecycle"}
[2026-11-17T21:20:33.822Z] webchat sees agent {"sessionKey":"agent:main:main","state":"starting_model","stream":"run_status"}
[2026-11-17T21:20:42.640Z] webchat sees agent {"sessionKey":"agent:main:main","stream":"thinking"}
[2026-11-17T21:20:44.529Z] webchat sees agent {"sessionKey":"agent:main:main","state":"model","stream":"lifecycle"}
[2026-11-17T21:20:44.533Z] webchat sees agent {"sessionKey":"agent:main:main","state":"fallback_step","stream":"lifecycle"}
[2026-11-17T21:21:02.019Z] webchat sees agent {"sessionKey":"agent:main:main","state":"preparing_workspace","stream":"run_status"}
[2026-11-17T21:21:02.275Z] webchat sees agent {"sessionKey":"agent:main:main","state":"preparing_context","stream":"run_status"}
[2026-11-17T21:21:02.275Z] webchat sees agent {"sessionKey":"agent:main:main","state":"model","stream":"lifecycle"}
[2026-11-17T21:21:02.277Z] webchat sees agent {"sessionKey":"agent:main:main","state":"fallback_step","stream":"lifecycle"}
[2026-11-17T21:21:02.295Z] webchat sees agent {"sessionKey":"agent:main:main","state":"error","stream":"lifecycle"}
[2026-11-17T21:21:03.162Z] webchat sees chat {"sessionKey":"agent:main:main","state":"error","error":"All models failed (2): anthropic/claude-haiku-4-5: CLI backend returned an empty response. (empty_response) | openai/gpt-5.4: Unknown model: openai/gpt-5.4. GPT-5.4 has retired from the ChatGPT-account Codex route. Run `openclaw doctor --fi..."}
```

Node IDs, run IDs and local paths are redacted. All traffic is on 127.0.0.1. The extra `claude-haiku-5-5` CLI turn after each run is OpenClaw's utility session recap, not a retry.

</details>

Merge danger: two-way door. One field on one producer, no stored state or contract change; a revert restores the 2026.11.5 behavior. Blast radius: forwarded device notifications only.

Co-authored-by: Ayaan Zaidi <[email protected]>
RomneyDa added a commit that referenced this pull request Nov 18, 2026
Minimal release2026.11.6 prerequisite for #200741, adapted from
ac12958 (#192211). Carry the producer's
optional expectation through ordinary host session-event admission and reply
preparation. No cron notification producers or scheduler behavior are changed.

This release branch's public SDK adapter copies options, so explicitly remove
the new host-only field there as well; public provenance grants no waiver.
The regression runs real admission and CLI completion with synthetic external
I/O, preserves required and visible replies, and checks the public boundary.
Allocate 112 net test lines for these distinct runtime/SDK contracts.

Co-authored-by: Ayaan Zaidi <[email protected]>
Co-authored-by: vincentkoc <[email protected]>
Co-authored-by: RomneyDa <[email protected]>
RomneyDa added a commit that referenced this pull request Nov 18, 2026
…paid model (#200741)

Adapted from c97a173 onto release2026.11.6.
The notification producer passes replyExpectation: optional through the
host-only plumbing adapted from ac12958
(#192211). Ordinary internal events and forged public provenance retain their
required-result policy. Allocate five net test lines for the producer regression.

Preserve the original source author/date and contributor credit. The isolated
notification regression fails twice on the base and passes 52/52 with the fix.
Real admission-to-CLI completion and SDK boundary regressions pass; no live
provider or paired phone was used for this backport proof.

Co-authored-by: Ayaan Zaidi <[email protected]>
Co-authored-by: vincentkoc <[email protected]>
Co-authored-by: RomneyDa <[email protected]>
RomneyDa added a commit that referenced this pull request Nov 19, 2026
…paid model (#200741)

Root cause: src/gateway/server-node-events-notifications.ts:128 admits phone notifications through `enqueueSessionEventForHost` without the producer's `replyExpectation: "optional"`, so in a WebChat session the `internal_system` turn resolves as result-required (src/agents/reply-completion.ts:116-122) and the CLI runner rejects an authored `NO_REPLY` as `empty_response`, which starts model fallback.

Fixes #200710

Thanks @dawidkulpa for the report with exact before/after counts, and @vaibhav375 for the fix.

## What Problem This Solves

Since 2026.11.5, when an agent decides a forwarded phone notification needs no answer and replies `NO_REPLY`, the turn fails with "CLI backend returned an empty response." and OpenClaw retries it on the fallback model. With a subscription CLI backend and an API-billed fallback, every ignored notification becomes a paid request and an "Unable to finish this reply" card in WebChat.

## User Impact

User impact: agents can ignore phone notifications again. A `NO_REPLY` answer ends the turn silently, with no error card and no fallback model call. Notifications the agent does answer still get their reply.

## Why This Change Was Made

#180106 (e897d98) moved notifications from heartbeat wakes, which allowed silence, onto ordinary host session events, without carrying over that permission. The notification producer now passes `replyExpectation: "optional"`, the same producer-owned waiver cron notifications and session-state notices already pass. Input provenance alone still grants no silence, so other `internal_system` turns keep their result requirement.

The branch keeps the contributor's fix commit. The in-process Gateway test and the docs note are folded into one assertion in the existing notification routing case, which fails on `main` and passes here.

## Evidence

Isolated source Gateway (`ocx src`), loopback, throwaway state. The agent's primary and fallback models are a scripted local CLI backend that logs every call. A WebChat client sends `chat.send` to `agent:main:main`, then a paired `openclaw-android` node sends `notifications.changed` for a promo (model answers `NO_REPLY`) and for a bank alert (model answers with text, the control).

```
main 93d8403
  promo-1: model calls=2  primary -> NO_REPLY, fallback -> "fallback answer for promo-1"
  cli terminal failure: provider=scripted-cli model=primary ... error=CLI backend returned an empty response.
  model fallback decision: decision=candidate_failed ... reason=empty_response next=scripted-cli/fallback
  urgent-1 (control): model calls=1, reply delivered
this PR
  promo-1: model calls=1  primary -> NO_REPLY; no assistant message, 0 empty_response lines, 0 fallback decisions
  urgent-1 (control): model calls=1, reply delivered
```

Regression test: `src/gateway/server-node-events.test.ts` passes 52/52 here; on `main` the two notification routing cases fail on the missing `replyExpectation: "optional"`.

<details>
<summary>Contributor live run with the real claude-cli backend (redacted; Gateway lines in IST, client lines in UTC)</summary>

```
### AFTER (this PR)
[2026-11-17T20:59:06.734Z] phone -> node.event notifications.changed {"change":"posted","key":"proof-1794949146731","packageName":"com.example.shop","title":"Weekend sale","text":"20% off everything this weekend"}
[2026-11-17T20:59:29.741Z] gateway accepted node.event: {"ok":true}
[claude stream] text_delta "text":"NO_REPLY"
2026-11-18T02:29:53.981+05:30 [agent/cli-backend] cli turn: provider=claude-cli model=claude-haiku-4-5 durationMs=9600 outBytes=8 outHash=b07800ad4773
[2026-11-17T20:59:05.295Z] webchat watching for 150s
[2026-11-17T20:59:33.317Z] webchat sees agent {"sessionKey":"agent:main:main","state":"start","stream":"lifecycle"}
[2026-11-17T20:59:45.663Z] webchat sees agent {"sessionKey":"agent:main:main","state":"starting_model","stream":"run_status"}
[2026-11-17T20:59:52.985Z] webchat sees agent {"sessionKey":"agent:main:main","stream":"thinking"}
[2026-11-17T20:59:55.153Z] webchat sees agent {"sessionKey":"agent:main:main","state":"model","stream":"lifecycle"}
[2026-11-17T20:59:55.162Z] webchat sees agent {"sessionKey":"agent:main:main","state":"end","stream":"lifecycle"}
[2026-11-17T20:59:55.165Z] webchat sees chat {"sessionKey":"agent:main:main","state":"final"}

### BEFORE (main)
[2026-11-17T21:20:11.996Z] phone -> node.event notifications.changed {"change":"posted","key":"proof-1794950411995","packageName":"com.example.shop","title":"Weekend sale","text":"20% off everything this weekend"}
[2026-11-17T21:20:21.484Z] gateway accepted node.event: {"ok":true}
2026-11-18T02:50:33.766+05:30 [agent/cli-backend] cli live session start: provider=claude-cli model=claude-haiku-4-5 activeSessions=1
[claude stream] text_delta "text":"NO_REPLY"
2026-11-18T02:50:42.818+05:30 [agent/cli-backend] cli turn: provider=claude-cli model=claude-haiku-4-5 durationMs=9391 outBytes=8 outHash=b07800ad4773
2026-11-18T02:50:42.845+05:30 [agent/cli-backend] cli empty response diagnostics: backend=claude-cli reason=exit exitCode=0 exitSignal=null durationMs=9158 stdoutBytes=19295 stdoutHash=01933c6de95a stderrBytes=0 stderrHash=e3b0c44298fc useResume=false
2026-11-18T02:50:42.854+05:30 [agent/cli-backend] cli terminal failure: provider=claude-cli model=claude-haiku-4-5 durationMs=19303 runId=<id> error=CLI backend returned an empty response.
2026-11-18T02:50:44.443+05:30 [model-fallback/decision] model fallback decision: decision=candidate_failed requested=anthropic/claude-haiku-4-5 candidate=anthropic/claude-haiku-4-5 reason=empty_response next=openai/gpt-5.4
2026-11-18T02:51:02.161+05:30 [model-fallback/decision] model fallback decision: decision=candidate_failed requested=anthropic/claude-haiku-4-5 candidate=openai/gpt-5.4 reason=model_not_found next=none
2026-11-18T02:51:02.198+05:30 Embedded agent failed before reply: All models failed (2): anthropic/claude-haiku-4-5: CLI backend returned an empty response. (empty_response) | openai/gpt-5.4: Unknown model: openai/gpt-5.4. GPT-5.4 has retired from the ChatGPT-account Codex route. Run `openclaw doctor --fix` to replace it with gp
2026-11-18T02:51:03.236+05:30 [gateway] notification event not delivered node=<node-id>: failed
[2026-11-17T21:20:06.510Z] webchat watching for 150s
[2026-11-17T21:20:23.374Z] webchat sees agent {"sessionKey":"agent:main:main","state":"start","stream":"lifecycle"}
[2026-11-17T21:20:33.822Z] webchat sees agent {"sessionKey":"agent:main:main","state":"starting_model","stream":"run_status"}
[2026-11-17T21:20:42.640Z] webchat sees agent {"sessionKey":"agent:main:main","stream":"thinking"}
[2026-11-17T21:20:44.529Z] webchat sees agent {"sessionKey":"agent:main:main","state":"model","stream":"lifecycle"}
[2026-11-17T21:20:44.533Z] webchat sees agent {"sessionKey":"agent:main:main","state":"fallback_step","stream":"lifecycle"}
[2026-11-17T21:21:02.019Z] webchat sees agent {"sessionKey":"agent:main:main","state":"preparing_workspace","stream":"run_status"}
[2026-11-17T21:21:02.275Z] webchat sees agent {"sessionKey":"agent:main:main","state":"preparing_context","stream":"run_status"}
[2026-11-17T21:21:02.275Z] webchat sees agent {"sessionKey":"agent:main:main","state":"model","stream":"lifecycle"}
[2026-11-17T21:21:02.277Z] webchat sees agent {"sessionKey":"agent:main:main","state":"fallback_step","stream":"lifecycle"}
[2026-11-17T21:21:02.295Z] webchat sees agent {"sessionKey":"agent:main:main","state":"error","stream":"lifecycle"}
[2026-11-17T21:21:03.162Z] webchat sees chat {"sessionKey":"agent:main:main","state":"error","error":"All models failed (2): anthropic/claude-haiku-4-5: CLI backend returned an empty response. (empty_response) | openai/gpt-5.4: Unknown model: openai/gpt-5.4. GPT-5.4 has retired from the ChatGPT-account Codex route. Run `openclaw doctor --fi..."}
```

Node IDs, run IDs and local paths are redacted. All traffic is on 127.0.0.1. The extra `claude-haiku-5-5` CLI turn after each run is OpenClaw's utility session recap, not a retry.

</details>

Merge danger: two-way door. One field on one producer, no stored state or contract change; a revert restores the 2026.11.5 behavior. Blast radius: forwarded device notifications only.

Co-authored-by: Ayaan Zaidi <[email protected]>
(cherry picked from commit c97a173)

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 063675762f70a26ae5f39b5bbcd093e7431a66e9)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime P1 High-priority user-facing bug, regression, or broken workflow. 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]: 2026.11.5: authored NO_REPLY on device session events in a WebChat session fails as empty_response and falls back to the paid model

2 participants