Repository navigation
Conversation
Greptile SummaryThis PR fixes a bug where cron agents that append NO_REPLY" Confidence Score: 5/5Safe to merge — the fix is correct, minimal, and targeted to the reported leak path. Both delivery code paths now correctly suppress trailing NO_REPLY tokens, and two regression tests confirm the fix. The only finding is a P2 style note about a redundant guard that has no impact on correctness. No files require special attention. Prompt To Fix All With AIThis is a comment left during a code review.
Path: src/cron/isolated-agent/delivery-dispatch.ts
Line: 437-444
Comment:
**Redundant `isSilentReplyText` guard in filter**
The `isSilentReplyText` check on line 439 is not needed — the `stripSilentToken` comparison immediately below already handles the exact-match case. For `"NO_REPLY"`, `stripSilentToken` yields `""`, so `"" !== "NO_REPLY".trim()` evaluates to `false` and the payload is filtered out just the same. The early return saves one regex call but adds a branch that duplicates intent already expressed by the comparison.
```suggestion
const payloadsForDelivery = rawPayloads.filter((p) => {
const text = p.text ?? "";
const stripped = stripSilentToken(text, SILENT_REPLY_TOKEN);
return stripped === text.trim();
});
```
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "fix(cron): suppress trailing NO_REPLY in..." | Re-trigger Greptile |
| const payloadsForDelivery = rawPayloads.filter((p) => { | ||
| const text = p.text ?? ""; | ||
| if (isSilentReplyText(text, SILENT_REPLY_TOKEN)) { | ||
| return false; | ||
| } | ||
| const stripped = stripSilentToken(text, SILENT_REPLY_TOKEN); | ||
| return stripped === text.trim(); | ||
| }); |
There was a problem hiding this comment.
Redundant
isSilentReplyText guard in filter
The isSilentReplyText check on line 439 is not needed — the stripSilentToken comparison immediately below already handles the exact-match case. For "NO_REPLY", stripSilentToken yields "", so "" !== "NO_REPLY".trim() evaluates to false and the payload is filtered out just the same. The early return saves one regex call but adds a branch that duplicates intent already expressed by the comparison.
| const payloadsForDelivery = rawPayloads.filter((p) => { | |
| const text = p.text ?? ""; | |
| if (isSilentReplyText(text, SILENT_REPLY_TOKEN)) { | |
| return false; | |
| } | |
| const stripped = stripSilentToken(text, SILENT_REPLY_TOKEN); | |
| return stripped === text.trim(); | |
| }); | |
| const payloadsForDelivery = rawPayloads.filter((p) => { | |
| const text = p.text ?? ""; | |
| const stripped = stripSilentToken(text, SILENT_REPLY_TOKEN); | |
| return stripped === text.trim(); | |
| }); |
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/cron/isolated-agent/delivery-dispatch.ts
Line: 437-444
Comment:
**Redundant `isSilentReplyText` guard in filter**
The `isSilentReplyText` check on line 439 is not needed — the `stripSilentToken` comparison immediately below already handles the exact-match case. For `"NO_REPLY"`, `stripSilentToken` yields `""`, so `"" !== "NO_REPLY".trim()` evaluates to `false` and the payload is filtered out just the same. The early return saves one regex call but adds a branch that duplicates intent already expressed by the comparison.
```suggestion
const payloadsForDelivery = rawPayloads.filter((p) => {
const text = p.text ?? "";
const stripped = stripSilentToken(text, SILENT_REPLY_TOKEN);
return stripped === text.trim();
});
```
How can I resolve this? If you propose a fix, please make it concise.6298132 to
16a9441
Compare
neo1027144-creator
left a comment
There was a problem hiding this comment.
Re: redundant isSilentReplyText guard — good catch, I initially removed it but discovered that stripSilentToken uses getSilentTrailingRegex which is case-sensitive (no i flag), while isSilentReplyText uses getSilentExactRegex which has the i flag. Without the guard, mixed-case variants like No_Reply slip through. Kept isSilentReplyText as the case-insensitive exact-match layer and added a comment explaining the distinction.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 16a944132a
ℹ️ 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".
| const stripped = stripSilentToken(text, SILENT_REPLY_TOKEN); | ||
| return stripped === text.trim(); |
There was a problem hiding this comment.
Make trailing NO_REPLY suppression case-insensitive
The new trailing-token guard relies on stripSilentToken, which currently matches NO_REPLY case-sensitively, so mixed-case variants like "All done\n\nNo_Reply" are still delivered in this direct-delivery branch (and the matching text-delivery branch later in the file). That leaves a real leak path for the same sentinel behavior this change is trying to block, especially since exact-token suppression is already case-insensitive.
Useful? React with 👍 / 👎.
16a9441 to
7090734
Compare
neo1027144-creator
left a comment
There was a problem hiding this comment.
Addressed: trailing NO_REPLY suppression is now case-insensitive — text is uppercased before calling stripSilentToken since SILENT_REPLY_TOKEN is already uppercase. Added a test for mixed-case trailing No_Reply after summary text (37/37 passing).
The cron announce delivery path only checked isSilentReplyText() which requires the entire payload to be exactly NO_REPLY. When the agent prepends summary text before the token (e.g. 'All 3 items processed. \n\nNO_REPLY'), the exact match fails and the full response leaks to the target channel. Use stripSilentToken() to detect a trailing NO_REPLY token in both deliverViaDirect (structured/direct path) and finalizeTextDelivery (text-only path). When the stripped result differs from the original, the payload carried a trailing NO_REPLY and delivery is suppressed. The existing isSilentReplyText() guard is kept for case-insensitive exact matches (e.g. 'No_Reply') since stripSilentToken uses a case-sensitive regex. Fixes openclaw#64976
7090734 to
b7f1996
Compare
|
Merged via squash.
Thanks @neo1027144-creator! |
…ssisted] (openclaw#65004) Merged via squash. Prepared head SHA: b7f1996 Co-authored-by: neo1027144-creator <[email protected]> Co-authored-by: jalehman <[email protected]> Reviewed-by: @jalehman
…ssisted] (openclaw#65004) Merged via squash. Prepared head SHA: b7f1996 Co-authored-by: neo1027144-creator <[email protected]> Co-authored-by: jalehman <[email protected]> Reviewed-by: @jalehman
…ssisted] (openclaw#65004) Merged via squash. Prepared head SHA: b7f1996 Co-authored-by: neo1027144-creator <[email protected]> Co-authored-by: jalehman <[email protected]> Reviewed-by: @jalehman
…ssisted] (openclaw#65004) Merged via squash. Prepared head SHA: b7f1996 Co-authored-by: neo1027144-creator <[email protected]> Co-authored-by: jalehman <[email protected]> Reviewed-by: @jalehman
…ssisted] (openclaw#65004) Merged via squash. Prepared head SHA: b7f1996 Co-authored-by: neo1027144-creator <[email protected]> Co-authored-by: jalehman <[email protected]> Reviewed-by: @jalehman
…ssisted] (openclaw#65004) Merged via squash. Prepared head SHA: b7f1996 Co-authored-by: neo1027144-creator <[email protected]> Co-authored-by: jalehman <[email protected]> Reviewed-by: @jalehman
…ssisted] (openclaw#65004) Merged via squash. Prepared head SHA: b7f1996 Co-authored-by: neo1027144-creator <[email protected]> Co-authored-by: jalehman <[email protected]> Reviewed-by: @jalehman
…ssisted] (openclaw#65004) Merged via squash. Prepared head SHA: b7f1996 Co-authored-by: neo1027144-creator <[email protected]> Co-authored-by: jalehman <[email protected]> Reviewed-by: @jalehman
…ssisted] (openclaw#65004) Merged via squash. Prepared head SHA: b7f1996 Co-authored-by: neo1027144-creator <[email protected]> Co-authored-by: jalehman <[email protected]> Reviewed-by: @jalehman
Problem
Cron announce delivery sends the full agent response to the target channel when it contains NO_REPLY mixed with other text. The NO_REPLY suppression only works when it is the entire response.
Agents in cron/isolated sessions often emit analysis or summary text before appending NO_REPLY:
The delivery path in delivery-dispatch.ts uses isSilentReplyText() which requires an exact match (^\sNO_REPLY\s$), so this mixed text passes through and leaks to the user.
Root Cause
stripSilentToken() from okens.ts already handles trailing NO_REPLY removal, but was not called in the cron announce delivery path (delivery-dispatch.ts).
Fix
Use stripSilentToken() to detect trailing NO_REPLY tokens in both delivery code paths:
When the stripped result differs from the original, the payload carried a trailing NO_REPLY and delivery is suppressed via the existing inishSilentReplyDelivery() path.
Testing
Added 2 regression tests to delivery-dispatch.double-announce.test.ts:
All 36 existing tests continue to pass (no regressions).
Fixes #64976