Skip to content

fix: keep ambient room events silent - #126527

Merged
obviyus merged 1 commit into
mainfrom
t3code/restore-ambient-room-silence
Aug 20, 2026
Merged

obviyus merged 1 commit into
mainfrom
t3code/restore-ambient-room-silence

Conversation

@obviyus

@obviyus obviyus commented Aug 20, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Fixes an issue where ambient Telegram group messages configured as room_event could trigger a forced visible-answer retry after the model deliberately stayed silent.

Why This Change Was Made

Auto-reply classified the turn and allowed silence, but did not carry the matching terminal-reply expectation into the embedded runner. The runner therefore inferred that every user-triggered run required a visible reply. This change records that fact at the auto-reply producer, carries it through queued runs, and shares one directed-turn predicate with visible fallback policy.

Undirected room_event turns now declare an optional terminal reply even when generic group silence is configured as disallow. Direct messages, mentions, commands, and ordinary user requests remain reply-required. The generic incomplete-turn recovery and Telegram adapter are unchanged.

Provenance: behavior introduced by #118305 (97034f3d953b); later refactors only moved the policy.

User Impact

Ambient Telegram mode can observe group chatter without speaking unless the model explicitly sends a message. Genuine mentions and commands still recover from empty or reasoning-only provider completions with a visible-answer retry.

Evidence

  • Regression test failed before the fix: ambient room_event with silentReply.group=disallow produced allowEmptyAssistantReplyAsSilent=false and no terminal expectation.
  • Focused suites: 584 tests passed across auto-reply preparation, dispatch fallback, queue handling, embedded parameter propagation, and terminal recovery.
  • pnpm tsgo: passed.
  • pnpm check:test-types: passed.
  • Targeted Oxlint, Oxfmt, and git diff --check: passed.
  • Independent Claude design consultation agreed with the producer-owned contract and flagged the heartbeat default, now covered by regression assertion.
  • Production LOC: +41/-18, net +23. Tests: +18/-2, net +16. Production growth is the typed queue/run contract needed to carry the producer-owned completion fact; duplicated directed-turn policy was removed.

Exact-head Telegram userbot proof at 623af24b9b84dc77bd8f69646d74323b7aa97003, with messages.groupChat.unmentionedInbound=room_event, silentReply.group=disallow, and a deterministic reasoning-only first provider completion:

  • Ambient command: run-mock-sut-user-e2e.mjs --text 'OPENCLAW_E2E_AMBIENT_SILENCE' --record <events> --output <summary>.
    Sent Bot API message 48876. Provider requests: 1. Recorded SUT totals: no messages. Gateway log: no visible-answer continuation.
  • Directed command: run-mock-sut-user-e2e.mjs --text '@<sut> OPENCLAW_E2E_DIRECTED_RECOVERY' --record <events> --output <summary>.
    Sent Bot API message 48877. Provider requests: 2. Gateway recorded the reasoning-only visible-answer continuation. Telegram recorded one SUT message, Bot API 48878, at 3187 ms with OPENCLAW_E2E_DIRECTED_RECOVERY.
  • Userbot doctor: ok=true; both runner scratch directories removed after exit.
  • Exact-head local ClawSweeper after live proof: PASS; patch correct, zero findings, security cleared, no maintainer decision, zero Rank-up moves.

@clawsweeper

clawsweeper Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Aug 20, 2026
@clawsweeper clawsweeper Bot added mantis: telegram-visible-proof Mantis should capture Telegram visible proof. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P1 High-priority user-facing bug, regression, or broken workflow. 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. labels Aug 20, 2026
@clawsweeper

clawsweeper Bot commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 19, 2026, 11:41 PM ET / August 20, 2026, 03:41 UTC.

ClawSweeper review

What this changes

The PR keeps ambient Telegram room events silent after an empty model completion while preserving visible recovery for directed messages and commands.

Regression provenance

Possible regression — probable (reviewed change; known regression link). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

No blocking correctness finding: the patch carries the producer-owned ambient reply expectation through the queue to the terminal-recovery owner. This maintainer-labeled, P1 delivery change should stay open for exact-current-base merge verification.

Priority: P1
Reviewed head: 623af24b9b84dc77bd8f69646d74323b7aa97003

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is coherent and has useful real behavior evidence, with current-base verification remaining before merge.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The PR body supplies exact-head after-fix Telegram userbot output for both silent ambient and recovered directed cases.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body supplies exact-head after-fix Telegram userbot output for both silent ambient and recovered directed cases.
Evidence reviewed 7 items Producer-owned expectation: Ambient room events become reply-optional, while directed/default turns remain reply-required.
Queue and runner propagation: The prepared expectation is copied into the queued run, included in the queue key, and forwarded to embedded-run parameters.
Terminal consumer contract: The embedded runner treats an optional terminal expectation as no visible reply owed, while required turns retain continuation/recovery.
Findings None None.
Security None None.

Live Verification

Command: pnpm openclaw --help

Result: PASS (completed)

pnpm openclaw --help
runner@runnervm76f27:/tmp/clawsweeper-live-proof-126527-DKQe64/target$ pnpm openclaw --help
$ node scripts/run-node.mjs --help
[openclaw] Building TypeScript (dist is stale: missing_build_stamp - build stamp missing).
[openclaw] Building bundled plugin assets.
pnpm openclaw --help
[canvas] build: node scripts/bundle-a2ui.mjs
[log] ‹DIR›/a2ui.bundle.js  chunk │ size: 399.96 kB
[log] ‹DIR›/a2ui-v0.9.bundle.js  chunk │ size: 615.66 kB
[log]
[success] rolldown v1.2.0 Finished in 59.35 ms
[diffs] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts curated
[diffs-language-pack] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts full
[discord] build: node --import tsx ../../scripts/build-discord-activity-sdk.mts
[tsdown-build] invocation 1/2 finished in 0.4s
node_modules/playwright-core/lib/coreBundle.js (65821:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65821:29 ]
       │
 65821 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/playwright-core/lib/coreBundle.js (65828:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65828:29 ]
       │
 65828 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2343:30) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2343:31 ]
      │
 2343 │           ASM_CONSTS[start] = eval(func);
      │                               ──┬─
      │                                 ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2366:32) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2366:33 ]
      │
 2366 │           moduleExports[name] = eval(func);
      │                                 ──┬─
      │                                   ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

[tsdown-build] invocation 2/2 finished in 8.6s
[plugin-control-plane-loads] verified 35 built modules with native require and checked doctor closures
runtime-postbuild: 10 phases completed in 3693ms (slowest: built plugin control-plane loads 1895ms)

OpenClaw 2026.8.1 (623af24) — All your chats, one OpenClaw.

Usage: openclaw [options] [command]

Options:
  --container ‹name›   Run the CLI inside a running Podman/Docker container named ‹name› (default: env OPENCLAW_CONTAINER)
  --dev                Dev profile: isolate state under ~/.openclaw-dev, default gateway port 19001, and shift derived ports (browser/canvas)
  -h, --help           Display help for command
  --log-level ‹level›  Global log level override for file + console (
… output truncated …

Assertions:

  • PASS expect_output: Usage: openclaw

How this fits together

Telegram events enter auto-reply classification, which prepares a queued embedded agent run; terminal recovery then decides whether an empty completion owes a visible response. This patch preserves that reply expectation across the queue boundary.

flowchart LR
A[Telegram inbound event] --> B[Auto-reply classification]
B --> C[Reply expectation]
C --> D[Queued embedded run]
D --> E[Terminal recovery]
E --> F[Ambient event stays silent]
E --> G[Directed turn retries visibly]
Loading

Before merge

  • Resolve merge risk (P2) - This changes Telegram fallback delivery: an incorrect ambient-versus-directed classification could suppress a user-visible recovery.
  • Resolve merge risk (P1) - The branch is behind current main, and the grafted checkout could not construct the exact three-way merge result.
  • Resolve merge risk (P1) - Production code grows by net 23 lines for a bug fix; the added typed queue propagation is warranted only because the terminal consumer needs the producer-owned expectation.
  • Complete next step (P2) - The protected maintainer label and delivery-sensitive rebase check require maintainer handling; no mechanical repair is identified.
Agent review details

Security

None.

PR surface

Source +23, Tests +16. Total +39 across 9 files.

View PR surface stats
Area Files Added Removed Net
Source 7 41 18 +23
Tests 2 18 2 +16
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 9 59 20 +39

Review metrics

Metric Value Why it matters
Production versus test LOC production +41/-18 (net +23); tests +18/-2 (net +16) The production growth carries one terminal-policy fact through the queue and removes duplicated directed-turn policy.

Mantis proof suggestion

A Telegram Desktop before/after trace would directly show that ambient chatter stays silent while a directed mention still gets recovery. A maintainer can ask Mantis to capture proof by posting this exact PR comment:

@openclaw-mantis telegram desktop proof: verify an ambient room event stays silent while a directed mention recovers with one visible reply.

Merge-risk options

Maintainer options:

  1. Rebase and reverify delivery (recommended)
    Rebase onto current main, rerun the focused terminal and auto-reply tests, and repeat the redacted ambient-versus-directed Telegram trace before merge.
  2. Accept the current proof
    Merge with the documented exact-head userbot evidence while accepting that the reviewer could not reconstruct the current-base merge locally.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Rebase onto current main; rerun focused terminal and auto-reply tests plus the redacted ambient-versus-directed Telegram trace.

Technical review

Best possible solution:

Keep one reply-expectation fact owned by auto-reply preparation, preserve it through all queued execution paths, and validate the rebased head with the ambient-silence and directed-recovery trace.

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

Yes, from source and supplied exact-head proof: send an undirected room event with group silence disallowed and force a reasoning-only completion, then compare it with a directed mention. Independent current-main execution was unavailable because this checkout lacks its main merge base.

Is this the best way to solve the issue?

Yes: the terminal runner already owns optional-versus-required recovery, so recording that fact at auto-reply preparation and carrying it through queueing is the narrowest coherent repair.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 916eef4e9960.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body supplies exact-head after-fix Telegram userbot output for both silent ambient and recovered directed cases.

Label justifications:

  • P1: An ambient Telegram group event can otherwise trigger an unwanted visible recovery message.
  • merge-risk: 🚨 message-delivery: The patch changes the condition that permits or suppresses Telegram empty-response fallback delivery.
  • 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 (live_output): The PR body supplies exact-head after-fix Telegram userbot output for both silent ambient and recovered directed cases.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body supplies exact-head after-fix Telegram userbot output for both silent ambient and recovered directed cases.
  • mantis: telegram-visible-proof: Mantis should capture Telegram visible proof. The patch changes whether a Telegram room event visibly receives a recovery reply.

Evidence

What I checked:

Likely related people:

  • obviyus: Authored this branch and the earlier directed-turn fallback antecedent 8eaa4d6. (role: directed-turn policy contributor; confidence: high; commits: 623af24b9b84, 8eaa4d6d703e; files: src/auto-reply/reply/source-reply-delivery-mode.ts, src/auto-reply/reply/get-reply-run-context.ts)
  • steipete: Authored the merged directed empty-reply recovery change that this patch narrows for ambient room events. (role: earlier recovery-boundary contributor; confidence: high; commits: 97034f3d953b; files: src/agents/embedded-agent-runner/run/terminal-resolution.ts, extensions/telegram/src/bot-message-dispatch.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Rebase onto current main and repeat the focused ambient-versus-directed validation.

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-08-20T03:27:41.716Z sha 623af24 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Aug 20, 2026
@obviyus

obviyus commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator Author

Landing review:

  • Accepting the message-delivery risk: exact-head Telegram proof covers ambient silence and directed recovery; focused regression coverage preserves mentions, commands, ordinary requests, and heartbeat behavior.
  • Skipping the optional rebase/current-base replay rank-up move. The branch is mergeable without conflicts, exact-head CI is green, and the fast-lane drift policy does not rebase solely because main advanced.
  • Accepting production net +23: this is the typed producer-to-queue-to-runner completion-policy contract; the duplicate directed-turn predicate was removed.
  • Maintainer handling complete; no unresolved review threads.

@obviyus
obviyus merged commit ade0fb2 into main Aug 20, 2026
246 checks passed
@obviyus
obviyus deleted the t3code/restore-ambient-room-silence branch August 20, 2026 03:56
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 20, 2026
Restore intentional silence for undirected room events while retaining visible-answer recovery for mentions, commands, and ordinary requests.

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

Labels

maintainer Maintainer-authored PR mantis: telegram-visible-proof Mantis should capture Telegram visible proof. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. 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: S 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.

1 participant