Skip to content

Fix/cron announce no reply - #65016

Merged
obviyus merged 1 commit into
openclaw:mainfrom
BKF-Gitty:fix/cron-announce-no-reply
Apr 16, 2026
Merged

obviyus merged 1 commit into
openclaw:mainfrom
BKF-Gitty:fix/cron-announce-no-reply

Conversation

@BKF-Gitty

Copy link
Copy Markdown
Contributor

Summary

  • Problem: Cron announce delivery only suppresses NO_REPLY when it is the exact/entire response (isSilentReplyText). When the agent prepends summary text before NO_REPLY, the full response is delivered to the target channel.
  • Why it matters: 14/15 observed production cron deliveries over 8 days contained NO_REPLY but were delivered anyway. Every user with announce-mode crons using NO_REPLY suppression hits this.
  • What changed: Ported the leading/embedded NO_REPLY token stripping from the auto-reply path (normalize-reply.ts, PR fix(auto-reply): strip leading NO_REPLY tokens to prevent silent-reply leak #63068) into the cron announce delivery path. Three locations: deliverViaDirect() and finalizeTextDelivery() in delivery-dispatch.ts, and runSubagentAnnounceFlow() in subagent-announce.ts.
  • What did NOT change (scope boundary): Existing isSilentReplyText exact-match checks are preserved. No changes to the auto-reply path, token definitions, or cron scheduling logic. No new functions — only imports of existing helpers.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

Root Cause (if applicable)

  • Root cause: PR fix(auto-reply): strip leading NO_REPLY tokens to prevent silent-reply leak #63068 added startsWithSilentToken / stripLeadingSilentToken / stripSilentToken to the auto-reply path but the cron announce delivery path was not updated. It still uses only isSilentReplyText (exact match).
  • Missing detection / guardrail: No test covering NO_REPLY mixed with other text in cron announce delivery.
  • Contributing context (if known): Agents naturally summarize findings before appending NO_REPLY, making the exact-match check insufficient in practice.

Regression Test Plan (if applicable)

  • Coverage level that should have caught this:
    • Unit test
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
  • Target test or file: src/cron/isolated-agent/delivery-dispatch.test.ts
  • Scenario the test should lock in: Agent response "All items processed.\n\nNO_REPLY" → delivery suppressed (not delivered to channel)
  • Why this is the smallest reliable guardrail: Unit test on the delivery filter pipeline catches the exact gap without needing a running gateway
  • Existing test that already covers this (if any): None for this path. Auto-reply path has coverage in normalize-reply.test.ts.
  • If no new test is added, why not: No node_modules installed locally to run the test suite. Happy to add a test if maintainers prefer — the pattern exists in normalize-reply.test.ts.

User-visible / Behavior Changes

Cron announce deliveries containing NO_REPLY mixed with other text will now be stripped or suppressed, matching the behavior of the direct-reply path. Users who previously received false deliveries with NO_REPLY embedded in the text will no longer receive them.

Diagram (if applicable)

Before:
[agent responds "Summary text\n\nNO_REPLY"] -> [isSilentReplyText: no match] -> [delivered to channel]

After:
[agent responds "Summary text\n\nNO_REPLY"] -> [stripSilentToken removes NO_REPLY] -> [text has content] -> [stripped text delivered]
[agent responds "NO_REPLY rest of text"] -> [stripLeadingSilentToken] -> [text has content] -> [stripped text delivered]
[agent responds "All done\n\nNO_REPLY"] -> [stripSilentToken] -> [only "All done" remains] -> [stripped text delivered]
[agent responds "NO_REPLY"] -> [isSilentReplyText: exact match] -> [suppressed, not delivered]

Security Impact (required)

  • New permissions/capabilities? No
  • Secrets/tokens handling changed? No
  • New/changed network calls? No
  • Command/tool execution surface changed? No
  • Data access scope changed? No

Repro + Verification

Environment

  • OS: macOS 15.4
  • Runtime/container: Node 22 / npm global
  • Model/provider: anthropic/claude-opus-4
  • Integration/channel (if any): Discord announce delivery
  • Relevant config (redacted): Isolated cron with --announce --channel discord --to "channel:xxx"

Steps

  1. openclaw cron add --name "Test" --cron "*/5 * * * *" --session isolated --message "Check X. If nothing actionable, reply NO_REPLY" --announce --channel discord --to "channel:xxx"
  2. Agent responds with summary text followed by NO_REPLY
  3. Observe delivery behavior

Expected

  • Delivery suppressed when normalized response resolves to NO_REPLY

Actual

  • Full response including summary text delivered to channel

Evidence

  • Trace/log snippets

15 cron deliveries over 8 days from production instance, 14 contained NO_REPLY in the response text but were delivered to Discord/WhatsApp. Pattern: agent writes summary, appends NO_REPLY. Delivery system did not recognize it as suppression because isSilentReplyText only matches exact/whole-string.

Human Verification (required)

  • Verified scenarios: Confirmed isSilentReplyText is the only check in delivery-dispatch.ts and subagent-announce.ts. Confirmed startsWithSilentToken / stripLeadingSilentToken / stripSilentToken exist in src/auto-reply/tokens.ts and are not imported in the cron path. Verified the diff applies the same pattern as normalize-reply.ts.
  • Edge cases checked: Empty text after stripping routes to finishSilentReplyDelivery(). Payloads with content after stripping are preserved. Existing exact-match checks are not altered.
  • What you did not verify: Could not run type checker or test suite — no node_modules installed locally. Did not verify against a running gateway.

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

Compatibility / Migration

  • Backward compatible? Yes
  • Config/env changes? No
  • Migration needed? No

Risks and Mitigations

  • Risk: Stripping NO_REPLY from mixed-content responses could remove the token but still deliver text the user intended to suppress entirely.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation agents Agent runtime and tooling size: S labels Apr 11, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8e57cfa281

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@greptile-apps

greptile-apps Bot commented Apr 11, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes the production bug where cron announce deliveries containing NO_REPLY mixed with other text (e.g. `"All items processed.

NO_REPLY") were not suppressed because the cron path only used an exact-match check (isSilentReplyText). The fix ports startsWithSilentToken/stripLeadingSilentToken/stripSilentTokenintodeliverViaDirect(), finalizeTextDelivery(), and runSubagentAnnounceFlow(), and the previous review concern about the .filter()dropping media-only payloads has been addressed by switching tohasReplyPayloadContent`.

Confidence Score: 5/5

Safe to merge; core delivery logic is correct for all described cases and prior P0/P1 concerns have been resolved.

All remaining findings are P2: a minor state-sync inconsistency between synthesizedText and deliveryPayloads after stripping (delivery itself is unaffected), and a behavioral asymmetry vs the normalize-reply.ts single-strip pattern. Neither blocks correctness.

src/cron/isolated-agent/delivery-dispatch.ts — review the synthesizedText/deliveryPayloads state-sync issue after the strip loop in finalizeTextDelivery()

Prompt To Fix All With AI
This is a comment left during a code review.
Path: src/cron/isolated-agent/delivery-dispatch.ts
Line: 694-700

Comment:
**`synthesizedText` stripped but `deliveryPayloads` not updated**

After the while-loop trims `synthesizedText` (e.g. `"Summary"` from `"Summary\n\nNO_REPLY"`), `deliveryPayloads` still holds the original unstripped text (set via lines 644–647 or 655–656 in the subagent/descendant branches). `deliverViaDirect()` then re-strips from `deliveryPayloads`, so the *delivery* is correct, but the `DispatchCronDeliveryState` returned to callers ends up with inconsistent `synthesizedText` (stripped) vs `deliveryPayloads` (unstripped). Any caller that inspects `deliveryPayloads` for logging, replay, or audit purposes would see the raw unstripped text. Keeping them in sync here avoids the drift.

Alternatively, simply update `deliveryPayloads = [{ text: synthesizedText }]` after the strip loop completes, similar to the assignment pattern already used in the subagent-followup branches above.

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: src/cron/isolated-agent/delivery-dispatch.ts
Line: 459-461

Comment:
**While-loop is more aggressive than the `normalize-reply.ts` single-call pattern**

`normalize-reply.ts` calls `stripSilentToken` exactly once, so `"Summary NO_REPLY NO_REPLY"` would survive as `"Summary NO_REPLY"` through the auto-reply path. The while-loop here (and in `stripAndClassifyReply`) fully strips all trailing tokens, which is actually *more* correct, but it creates a behavioral asymmetry between the cron and direct-reply paths. The PR description says it "mirrors normalize-reply.ts logic", but the while loop is a divergence. It's worth either aligning `normalize-reply.ts` to also loop, or documenting the intentional difference so a future reviewer doesn't "simplify" one path to match the other and accidentally introduce a regression.

How can I resolve this? If you propose a fix, please make it concise.

Reviews (2): Last reviewed commit: "Merge branch 'main' into fix/cron-announ..." | Re-trigger Greptile

Comment thread src/agents/subagent-announce.ts Resolved
Comment thread docs/automation/cron-jobs.md Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a130f80945

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/agents/subagent-announce.ts Resolved

@obviyus obviyus left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is close, but one regression on current head blocks merge.

src/agents/subagent-announce.ts:400 now treats an empty reply after NO_REPLY stripping as an early silent return when there is no non-silent fallback. That changes existing behavior outside the cron NO_REPLY bug: subagent completions that previously announced (no output) now disappear entirely.

This is a real behavior change, not just a comment/test mismatch. Existing coverage expects the (no output) completion announcement path, so this needs to be preserved while still stripping mixed-content NO_REPLY tokens.

Once that is fixed, the main cron-path change looks reasonable.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cb46e7f4c2

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/agents/subagent-announce.ts Resolved
@openclaw-barnacle openclaw-barnacle Bot removed the docs Improvements or additions to documentation label Apr 12, 2026
@BKF-Gitty
BKF-Gitty requested a review from obviyus April 12, 2026 19:11
@BKF-Gitty

Copy link
Copy Markdown
Contributor Author

@greptileai review again

@BKF-Gitty

Copy link
Copy Markdown
Contributor Author

CI failures are in doctor-config-flow.test.ts and doctor-legacy-config.migrations.test.ts — unrelated to this PR. These tests fail on assertions about config migration return types ({ mode: 'partial' } vs true), not in any file this PR touches. Happy to rebase once these are resolved on main.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d8d9da97e0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a64fdd4b07

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 818b063355

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

To use Codex here, create an environment for this repo.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bbf904d06c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@openclaw-barnacle openclaw-barnacle Bot added the cli CLI command changes label Apr 15, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b22a4a4315

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: de9e2eb274

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@openclaw-barnacle openclaw-barnacle Bot added size: M channel: whatsapp-web Channel integration: whatsapp-web scripts Repository scripts extensions: qa-lab and removed size: S cli CLI command changes labels Apr 16, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d88d630a74

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 679caae1c3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@obviyus obviyus self-assigned this Apr 16, 2026
xudaiyanzi pushed a commit to xudaiyanzi/openclaw that referenced this pull request Apr 17, 2026
kvnkho pushed a commit to kvnkho/openclaw that referenced this pull request Apr 17, 2026
Mquarmoc pushed a commit to Mquarmoc/openclaw that referenced this pull request Apr 20, 2026
lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
globalcaos pushed a commit to globalcaos/tinkerclaw that referenced this pull request May 13, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
vixco pushed a commit to vixco/openclaw that referenced this pull request Aug 16, 2026
Heetisk pushed a commit to Heetisk/openclaw that referenced this pull request Sep 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: (cron): announce delivery ignores NO_REPLY when agent prepends other text

2 participants