Skip to content

fix(cron): suppress isolated cron interim narration from announce delivery - #44224

Closed
Devdha wants to merge 1 commit into
openclaw:mainfrom
Devdha:fix/cron-no-reply-silent-guard
Closed

Devdha wants to merge 1 commit into
openclaw:mainfrom
Devdha:fix/cron-no-reply-silent-guard

Conversation

@Devdha

@Devdha Devdha commented Mar 12, 2026 •

Copy link
Copy Markdown

What

This PR hardens isolated cron announce delivery to prevent chatty no-data/status text from being sent to users.

Changes

  • Use isSilentReplyText(...) (instead of exact token equality) when checking silent responses in src/cron/isolated-agent/delivery-dispatch.ts.
  • Suppress delivery when synthesized text is classified as an interim cron message (isLikelyInterimCronMessage(...)) in finalizeTextDelivery.

Why

In Telegram + isolated cron workflows, runs that should be silent (NO_REPLY / no-data) can leak narration/status messages. This change adds a stronger guard in the delivery layer so those interim/no-data texts are not announced.

Related

Notes

  • This patch intentionally avoids locale-specific phrase matching changes.
  • I could not run local tests in this environment because the repo bootstrap/toolchain wasn't installed (pnpm ... vitest unavailable before install).

@greptile-apps

greptile-apps Bot commented Mar 12, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR hardens the isolated cron delivery path by (1) replacing a hand-rolled case-insensitive SILENT_REPLY_TOKEN comparison with the shared isSilentReplyText utility, and (2) adding a new isLikelyInterimCronMessage guard inside finalizeTextDelivery to suppress chatty interim/no-data narrations before they reach the outbound channel.

Key observations:

  • Logic concern – new guard may suppress subagent-resolved replies: The new isLikelyInterimCronMessage check (lines 403–414) applies to the current value of synthesizedText, which may have been updated to a real descendant reply (via completedDescendantReply or finalReply) earlier in the same function. The existing guard at lines 374–392 correctly scopes itself with synthesizedText.trim() === initialSynthesizedText so it only fires when no update was found. The new guard lacks this constraint, so a short (≤ 45 words) subagent reply that coincidentally contains an interim hint phrase (e.g. "working on it") would be silently dropped.
  • Behavioral change in silent-token matching: isSilentReplyText uses a case-sensitive regex (/^\s*NO_REPLY\s*$/), whereas the replaced .toUpperCase() comparison was case-insensitive. Mixed-case silent tokens (e.g. "no_reply") will no longer be caught at this check. The codebase itself is inconsistent on this point — subagent-followup.ts (line 98) still uses the case-insensitive form.
  • The deliveryAttempted = true assignment in the new block is consistent with the other suppression paths, correctly preventing a redundant enqueueSystemEvent fallback.

Confidence Score: 3/5

  • Safe to merge for the primary no-subagent use case, but carries a latent suppression risk for short subagent replies that contain interim-sounding phrases.
  • The intended fix (suppressing bare interim narrations in isolated cron runs without subagents) is sound. However, the new isLikelyInterimCronMessage check applies to synthesizedText that may have already been replaced by actual subagent output, which the parallel guard at lines 374–392 carefully avoids. Additionally, the switch to isSilentReplyText introduces a case-sensitivity narrowing that differs from other call sites in the codebase. Neither issue is catastrophic, but the suppression of legitimate subagent content is a real regression risk that depends on a heuristic phrase match.
  • src/cron/isolated-agent/delivery-dispatch.ts — specifically the new isLikelyInterimCronMessage block (lines 403–414) and whether it should be guarded by synthesizedText.trim() === initialSynthesizedText.

Comments Outside Diff (2)

  1. src/cron/isolated-agent/delivery-dispatch.ts, line 403-414 (link)

    New check may suppress legitimate subagent-resolved replies

    After the subagent-wait logic (lines 333–360), synthesizedText may have been updated to a real reply from a descendant (via completedDescendantReply or finalReply). If that reply happens to contain a phrase from INTERIM_CRON_HINTS and is ≤ 45 words, the new guard will suppress it — even though it is the product of actual subagent work, not an interim cron narration.

    The existing guard at lines 374–392 avoids this by requiring synthesizedText.trim() === initialSynthesizedText (i.e. the text was never updated). Without that same guard here, a subagent reply like "I've been working on it — revenue is up 5%." (14 words, contains "working on it") would be silently dropped.

    Consider adding the unchanged-text condition so the guard only fires when no subagent override was found:

    Alternatively, guarding on !hadDescendants would also be sufficient for the stated no-subagent scenario.

  2. src/cron/isolated-agent/delivery-dispatch.ts, line 393-401 (link)

    Silent-token check is now case-sensitive

    isSilentReplyText builds the regex without the i flag (/^\s*NO_REPLY\s*$/), so it only matches the exact uppercase token. The replaced expression used .toUpperCase() on both sides, making it case-insensitive. If an agent ever emits a mixed-case variant such as "no_reply" or "No_Reply", it will no longer be treated as silent here and will fall through to the isLikelyInterimCronMessage check (or further, to actual delivery).

    Note that readDescendantSubagentFallbackReply in subagent-followup.ts (line 98) still uses the case-insensitive .toUpperCase() comparison, so the two paths are now inconsistent.

    This is probably fine in practice because the cron agent is prompted to emit uppercase NO_REPLY, but it is worth confirming the case-insensitive behaviour is intentionally being dropped here.

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

Comment:
**New check may suppress legitimate subagent-resolved replies**

After the subagent-wait logic (lines 333–360), `synthesizedText` may have been updated to a real reply from a descendant (via `completedDescendantReply` or `finalReply`). If that reply happens to contain a phrase from `INTERIM_CRON_HINTS` _and_ is ≤ 45 words, the new guard will suppress it — even though it is the product of actual subagent work, not an interim cron narration.

The existing guard at lines 374–392 avoids this by requiring `synthesizedText.trim() === initialSynthesizedText` (i.e. the text was never updated). Without that same guard here, a subagent reply like `"I've been working on it — revenue is up 5%."` (14 words, contains `"working on it"`) would be silently dropped.

Consider adding the unchanged-text condition so the guard only fires when no subagent override was found:

```suggestion
    if (synthesizedText.trim() === initialSynthesizedText && isLikelyInterimCronMessage(synthesizedText)) {
```

Alternatively, guarding on `!hadDescendants` would also be sufficient for the stated no-subagent scenario.

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: 393-401

Comment:
**Silent-token check is now case-sensitive**

`isSilentReplyText` builds the regex without the `i` flag (`/^\s*NO_REPLY\s*$/`), so it only matches the exact uppercase token. The replaced expression used `.toUpperCase()` on both sides, making it case-insensitive. If an agent ever emits a mixed-case variant such as `"no_reply"` or `"No_Reply"`, it will no longer be treated as silent here and will fall through to the `isLikelyInterimCronMessage` check (or further, to actual delivery).

Note that `readDescendantSubagentFallbackReply` in `subagent-followup.ts` (line 98) still uses the case-insensitive `.toUpperCase()` comparison, so the two paths are now inconsistent.

This is probably fine in practice because the cron agent is prompted to emit uppercase `NO_REPLY`, but it is worth confirming the case-insensitive behaviour is intentionally being dropped here.

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

Last reviewed commit: cd84709

@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: 37d78433f1

ℹ️ 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".

@@ -390,7 +390,7 @@ export async function dispatchCronDelivery(
...params.telemetry,
});
}
if (synthesizedText.toUpperCase() === SILENT_REPLY_TOKEN.toUpperCase()) {
if (isSilentReplyText(synthesizedText, SILENT_REPLY_TOKEN)) {

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.

P1 Badge Keep silent-token detection case-insensitive

This change swaps a case-insensitive equality check for isSilentReplyText, which only matches the exact token casing; as a result, responses like no_reply/No_Reply now fall through and can be delivered to users instead of being suppressed. In this path synthesizedText comes directly from model output, so casing drift is enough to leak sentinel text and break the silent-no-data contract that this function previously enforced.

Useful? React with 👍 / 👎.


// If the final text still looks like an interim/status narration,
// suppress announce delivery instead of leaking chatty no-data updates.
if (isLikelyInterimCronMessage(synthesizedText)) {

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.

P1 Badge Restrict interim suppression to verified interim replies

The new unconditional isLikelyInterimCronMessage guard suppresses delivery even when no descendant follow-up is active, so any short final answer that includes one of these hint substrings (for example Korean summaries containing 결과 요약) is dropped. Because isLikelyInterimCronMessage is substring-based and allows up to 45 words, this can hide legitimate cron results and turn successful runs into silent runs unexpectedly.

Useful? React with 👍 / 👎.

@Devdha

Devdha commented Mar 12, 2026

Copy link
Copy Markdown
Author

Closing and reopening per reporter request to reset review flow.

@Devdha Devdha closed this Mar 12, 2026
@Devdha Devdha reopened this Mar 12, 2026
@Devdha

Devdha commented Mar 12, 2026

Copy link
Copy Markdown
Author

Superseded by new PR from a fresh branch as requested.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: cron isolated announce can leak NO_REPLY/status narration to Telegram

1 participant