Skip to content

auto-reply: suppress reasoning-prefixed NO_REPLY - #80930

Merged
steipete merged 8 commits into
openclaw:mainfrom
zuoanCo:main
May 27, 2026
Merged

steipete merged 8 commits into
openclaw:mainfrom
zuoanCo:main

Conversation

@zuoanCo

@zuoanCo zuoanCo commented May 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #66701 by treating reasoning-prefixed NO_REPLY outputs as silent replies instead of letting leaked reasoning text reach group chats.

Changes

  • Detect think/reasoning-prefixed payloads that end in NO_REPLY in the shared silent reply payload classifier.
  • Preserve the existing guard that keeps substantive replies visible when they merely contain a trailing NO_REPLY token.
  • Add regression coverage for token detection and reply normalization.

Real behavior proof

  • Behavior or issue addressed: Fixes NO_REPLY detection fails when model prepends reasoning/think blocks #66701. When an agent final reply starts with leaked reasoning text and ends in the silent NO_REPLY token, OpenClaw should suppress that payload before channel/outbound delivery instead of sending the reasoning text to a group chat.
  • Real environment tested: Local OpenClaw checkout at 74c5d26863b082ff4cd4be42b69d657443a875f4 on Windows, using Node v24.14.0 from the Codex bundled runtime and pnpm 11.1.0; exercised the production createReplyDispatcher final-reply outbound delivery seam with surface: "telegram", conversationType: "group", and a real deliver callback wired as the outbound send boundary.
  • Exact steps or command run after this patch:
$env:PATH='C:\Users\15944\AppData\Local\OpenAI\Codex\bin;' + $env:PATH; pnpm exec tsx -e "import { createReplyDispatcher } from './src/auto-reply/reply/reply-dispatcher.ts'; void (async () => { const deliveries=[]; const skipped=[]; const dispatcher=createReplyDispatcher({ silentReplyContext: { surface: 'telegram', conversationType: 'group', sessionKey: 'agent:main:telegram:group:proof' }, deliver: async (payload, info) => { deliveries.push({ kind: info.kind, text: payload.text ?? '', mediaUrl: payload.mediaUrl ?? null }); }, onSkip: (payload, info) => skipped.push({ kind: info.kind, reason: info.reason, originalText: payload.text }) }); const leaked=['think','Cav is talking about a follow-up conversation.','I will stay quiet here.NO_REPLY'].join('\n'); const leakQueued=dispatcher.sendFinalReply({ text: leaked }); const visibleQueued=dispatcher.sendFinalReply({ text: 'visible outbound sanity check' }); dispatcher.markComplete(); await dispatcher.waitForIdle(); console.log(JSON.stringify({ outboundSetup: 'createReplyDispatcher final reply delivery seam with telegram group silentReplyContext', leakQueued, visibleQueued, queuedCounts: dispatcher.getQueuedCounts(), failedCounts: dispatcher.getFailedCounts(), skipped, deliveries }, null, 2)); })();"
  • Evidence after fix (screenshot, recording, terminal capture, console output, redacted runtime log, linked artifact, or copied live output): Copied terminal output from the outbound delivery seam proof above:
{
  "outboundSetup": "createReplyDispatcher final reply delivery seam with telegram group silentReplyContext",
  "leakQueued": false,
  "visibleQueued": true,
  "queuedCounts": {
    "tool": 0,
    "block": 0,
    "final": 1
  },
  "failedCounts": {
    "tool": 0,
    "block": 0,
    "final": 0
  },
  "skipped": [
    {
      "kind": "final",
      "reason": "silent",
      "originalText": "think\nCav is talking about a follow-up conversation.\nI will stay quiet here.NO_REPLY"
    }
  ],
  "deliveries": [
    {
      "kind": "final",
      "text": "visible outbound sanity check",
      "mediaUrl": null
    }
  ]
}
  • Observed result after fix: The reasoning-prefixed NO_REPLY final reply was skipped with reason silent, was not queued, and did not reach deliveries; the visible sanity-check reply used the same dispatcher and did reach the outbound deliver seam. That proves the leak payload is stopped before channel delivery.
  • What was not tested: No live credentialed Telegram/Discord send was performed. This PR intentionally keeps the policy boundary narrow to NO_REPLY detection fails when model prepends reasoning/think blocks #66701's reasoning-prefixed silent-final leak class; broader non-reasoning leak classes and provider policy changes remain out of scope for maintainer follow-up.

Verification

  • pnpm test src/auto-reply/tokens.test.ts src/auto-reply/reply/reply-utils.test.ts src/infra/outbound/payloads.test.ts -- --reporter=verbose on 2026-05-12 with Node v24.14.0: 3 target files, 129 tests passed across the unit-fast and auto-reply Vitest shards.
  • pnpm check:changed
  • pnpm check via a temporary no-space Windows drive mapping
  • git diff --check

Notes:

  • pnpm build currently fails on Windows because the bootstrap guard looks for .js outputs while this build emitted .mjs files.
  • pnpm test:unit:fast has existing Windows path/EPERM failures unrelated to this change.

@openclaw-barnacle openclaw-barnacle Bot added size: S triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 12, 2026
@clawsweeper

clawsweeper Bot commented May 12, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed May 27, 2026, 1:04 AM ET / 05:04 UTC.

Summary
Review failed before ClawSweeper could summarize the requested change.

PR surface: Source +52, Tests +36. Total +88 across 3 files.

Reproducibility: unclear. The review failed before ClawSweeper could establish a reproduction path.

Review metrics: none identified.

Merge readiness
Overall: 🌊 off-meta tidepool
Proof: 🌊 off-meta tidepool
Patch quality: 🌊 off-meta tidepool
Result: rating does not apply to this item.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Risk before merge

  • No close action taken because the review did not complete.

Maintainer options:

  1. Decide the mitigation before merge
    Retry the Codex review after fixing the execution failure.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge
Review did not complete, so no work-lane recommendation was made.

Review details

Best possible solution:

Retry the Codex review after fixing the execution failure.

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

Unclear. The review failed before ClawSweeper could establish a reproduction path.

Is this the best way to solve the issue?

Unclear. Retry the review first so ClawSweeper can evaluate the actual issue and fix direction.

AGENTS.md: unclear because the file could not be read completely.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 44c1cc8285c8.

Label changes

Label changes:

  • add rating: 🌊 off-meta tidepool: Overall readiness is 🌊 off-meta tidepool; proof is 🌊 off-meta tidepool and patch quality is 🌊 off-meta tidepool.

Label justifications:

  • rating: 🌊 off-meta tidepool: Overall readiness is 🌊 off-meta tidepool; proof is 🌊 off-meta tidepool and patch quality is 🌊 off-meta tidepool.
Evidence reviewed

PR surface:

Source +52, Tests +36. Total +88 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 53 1 +52
Tests 2 36 0 +36
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 89 1 +88

What I checked:

  • failure reason: timeout.
  • codex failure detail: Codex review failed for this PR: spawnSync codex ETIMEDOUT.

Likely related people:

  • unknown: Codex failed before it could trace repository history. (role: review did not complete; confidence: low)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.

@openclaw-barnacle openclaw-barnacle Bot added proof: supplied External PR includes structured after-fix real behavior proof. and removed triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 12, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 12, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 12, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. mantis: telegram-visible-proof Mantis should capture Telegram visible proof. labels May 12, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 12, 2026
@clawsweeper clawsweeper Bot removed the mantis: telegram-visible-proof Mantis should capture Telegram visible proof. label May 12, 2026
@zuoanCo

zuoanCo commented May 12, 2026

Copy link
Copy Markdown
Contributor Author

@steipete please

@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label May 27, 2026
@clawsweeper clawsweeper Bot added the rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. label May 27, 2026
@clawsweeper

clawsweeper Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

🥚 Incubating: this PR egg is tucked into the review nest.

Hatch command

Comment @clawsweeper hatch when this PR is hatchable.

Hatchability rules:

  • Merged PRs are hatchable.
  • Open PRs are hatchable when they are status: 👀 ready for maintainer look, status: 🚀 automerge armed, or labeled clawsweeper:automerge.
  • Closed unmerged PRs are hatchable only when one of those hatchable labels is still present in the durable record.
What is this egg doing here?
  • Eggs appear after the PR passes real-behavior proof. It is here for vibes, not verdicts: it does not change labels, ratings, merge decisions, or automation.
  • The shell reacts to review momentum: open follow-up work warms it up, re-review makes it wobble, and a clean final review lets it hatch.
  • Hatchability usually comes from sufficient real-behavior proof, no blocking P0/P1/P2 findings, no security attention needed, and clean correctness. A merged PR is already final, so merge makes the egg hatchable independently.
  • The hatch is seeded from this repository and PR number, so the same PR keeps the same creature; the reviewed head SHA can only change safe visual details.
  • Rarity is just collectible sparkle: 🥚 common, 🌱 uncommon, 💎 rare, ✨ glimmer, and 🌈 legendary.

@martingarramon martingarramon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Three-tier guard is sound — tagged strip-then-isSilentReplyText, open-tag fallback, plain-prefix fallback. escapeRegExp is already imported. Tests cover the reported cases.

Minor asymmetry: the plain-prefix path uses hasFinalSilentToken directly rather than the strip-then-isSilentReplyText pattern the tagged path uses — so think\n<substantive text>\nNO_REPLY silences while the tagged equivalent correctly delivers. Contradictory model output in practice, but worth a comment or additional test to document the behavior difference.

Proof gate: ClawSweeper needs pnpm vitest run src/auto-reply output in the PR body to clear.

@steipete steipete self-assigned this May 27, 2026
@steipete

Copy link
Copy Markdown
Contributor

Verification for head a014eb0d91740eef6e17c77607f98e6e3db2059c:

Behavior addressed: reasoning-prefixed NO_REPLY final payloads are suppressed before outbound delivery when the post-reasoning content is token-only, explicit assistant silence narration, or a narrow placeholder-only reasoning payload. Substantive replies that merely end with NO_REPLY stay deliverable.

Real environment tested: local macOS checkout plus Blacksmith Testbox through Crabbox on Linux.

Exact steps or command run after this patch:

node scripts/run-vitest.mjs src/auto-reply/tokens.test.ts src/auto-reply/reply/reply-utils.test.ts src/infra/outbound/payloads.test.ts
.agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main
node scripts/crabbox-wrapper.mjs run --provider blacksmith-testbox --blacksmith-org openclaw --blacksmith-workflow .github/workflows/ci-check-testbox.yml --blacksmith-job check --blacksmith-ref main --idle-timeout 90m --ttl 240m --timing-json --shell -- "set -euo pipefail; echo CRABBOX_PHASE:focused-vitest; node scripts/run-vitest.mjs src/auto-reply/tokens.test.ts src/auto-reply/reply/reply-utils.test.ts src/infra/outbound/payloads.test.ts; echo CRABBOX_PHASE:changed-check; corepack pnpm check:changed"

Evidence after fix:

Observed result after fix: targeted leaked reasoning payloads are skipped as silent; explicit negative tests keep substantive NO_REPLY suffix replies deliverable.

What was not tested: no live Telegram/Discord send with credentials; this proof exercises the shared final-reply and outbound payload delivery seams plus changed core checks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

proof: supplied External PR includes structured after-fix real behavior proof. rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. size: S stale Marked as stale due to inactivity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NO_REPLY detection fails when model prepends reasoning/think blocks

3 participants