fix(auto-reply): suppress tool summaries in Slack channels when verboseDefault=off (#69067)#70152
Conversation
…seDefault=off (openclaw#69067) The gate in dispatch-from-config.ts only excluded "group" chats, so Slack "channel" ChatType fell through the `!== "group"` branch and tool summaries (exec stdout, JSON dumps, tool start statuses) leaked into channels despite verboseDefault=off and block streaming disabled. Tighten the predicate at src/auto-reply/reply/dispatch-from-config.ts:636-637 to exclude both "group" and "channel". Forum topic override (IsForum === true) is preserved for parity with Telegram forums. Adds two co-located tests mirroring the existing group-suppression and forum-override cases for the new channel paths.
Greptile SummaryThis PR fixes a bug where tool summaries (exec stdout/stderr, tool start statuses) were leaking into Slack channels despite Confidence Score: 5/5Safe to merge — the fix is minimal, correct, and fully tested; the only finding is a style-level suggestion. The logic change is a straightforward predicate extension with no side effects on other code paths. No files require special attention. Prompt To Fix All With AIThis is a comment left during a code review.
Path: src/auto-reply/reply/dispatch-from-config.ts
Line: 636-639
Comment:
**Prefer positive membership check for future-proofing**
`ChatType` is currently `"direct" | "group" | "channel"`. The negation form will silently enable tool summaries if a new value (e.g. `"supergroup"`) is added to the union, because the new value passes both `!== "group"` and `!== "channel"`. Expressing the positive intent is easier to audit and avoids the latent opt-in risk.
```suggestion
const shouldSendToolSummaries =
ctx.ChatType === "direct" || ctx.IsForum === true;
const shouldSendToolStartStatuses =
ctx.ChatType === "direct" || ctx.IsForum === true;
```
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "fix(auto-reply): suppress tool summaries..." | Re-trigger Greptile |
| const shouldSendToolSummaries = | ||
| (ctx.ChatType !== "group" && ctx.ChatType !== "channel") || ctx.IsForum === true; | ||
| const shouldSendToolStartStatuses = | ||
| (ctx.ChatType !== "group" && ctx.ChatType !== "channel") || ctx.IsForum === true; |
There was a problem hiding this comment.
Prefer positive membership check for future-proofing
ChatType is currently "direct" | "group" | "channel". The negation form will silently enable tool summaries if a new value (e.g. "supergroup") is added to the union, because the new value passes both !== "group" and !== "channel". Expressing the positive intent is easier to audit and avoids the latent opt-in risk.
| const shouldSendToolSummaries = | |
| (ctx.ChatType !== "group" && ctx.ChatType !== "channel") || ctx.IsForum === true; | |
| const shouldSendToolStartStatuses = | |
| (ctx.ChatType !== "group" && ctx.ChatType !== "channel") || ctx.IsForum === true; | |
| const shouldSendToolSummaries = | |
| ctx.ChatType === "direct" || ctx.IsForum === true; | |
| const shouldSendToolStartStatuses = | |
| ctx.ChatType === "direct" || ctx.IsForum === true; |
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/auto-reply/reply/dispatch-from-config.ts
Line: 636-639
Comment:
**Prefer positive membership check for future-proofing**
`ChatType` is currently `"direct" | "group" | "channel"`. The negation form will silently enable tool summaries if a new value (e.g. `"supergroup"`) is added to the union, because the new value passes both `!== "group"` and `!== "channel"`. Expressing the positive intent is easier to audit and avoids the latent opt-in risk.
```suggestion
const shouldSendToolSummaries =
ctx.ChatType === "direct" || ctx.IsForum === true;
const shouldSendToolStartStatuses =
ctx.ChatType === "direct" || ctx.IsForum === true;
```
How can I resolve this? If you propose a fix, please make it concise.|
Valid point on future-proofing. Kept the negation shape here to match the pre-fix shape at line 636 ( |
|
Closing this as implemented after Codex review. Current What I checked:
So I’m closing this as already implemented rather than keeping a duplicate issue open. Codex Review notes: reviewed against 2cd2732ab669; fix evidence: commit 98a99765af18. |
Summary
Tighten the Slack tool-summary gate in
dispatch-from-config.tsso it excludesChatType === "channel"in addition to"group". Previously, raw tool output (exec stdout/stderr, JSON dumps, tool start statuses) leaked into Slack channels despiteverboseDefault=offand block streaming being disabled.Root cause
At
src/auto-reply/reply/dispatch-from-config.ts:636-637, the gate was:ChatTypeis"direct" | "group" | "channel"(seesrc/channels/chat-type.ts:3). The predicate only excluded"group", so"channel"values hit the truthy branch and passed the gate. The flag flows intorunReplyDispatch(line 1046) and is consumed byacp-projector.tsat:302(emitSystemStatus) and:328(emitToolSummary) — both return early when the gate is false. With the gate passing, every tool summary and start-status got delivered as a Slack channel message.Fix
Forum override (
IsForum === true) is preserved for parity with Telegram forums on bothgroupandchannelChatTypes.Testing
Added two co-located tests in
src/auto-reply/reply/dispatch-from-config.test.ts:suppresses channel tool summaries but still forwards tool media— mirrors the existingsuppresses group tool summaries but still forwards tool mediatest withChatType: "channel". Asserts the exec-style text payload is dropped but media-only payloads still route.delivers tool summaries in forum topic sessions (channel + IsForum)— mirrors the existing group+forum test. Asserts the forum override restores tool summaries on channels.Sibling suites (
dispatch-from-config.reply-dispatch.test.ts,dispatch-from-config.acp-abort.test.ts,acp-projector.test.ts) also green — no regressions.Behavior change note
Deployments where operators were implicitly relying on the leak to see tool output in a Slack channel will now see those summaries suppressed. To restore the old behavior, set
verbose=on/ turn on block streaming, or move to a forum topic (IsForum=true), group, or DM.Pre-commit hook note
Local
pnpm check:changedfails on 2 pre-existing TS errors insrc/agents/pi-embedded-runner/compact.ts:887andsrc/agents/pi-embedded-runner/run/attempt.ts:1132(Tool[] type mismatches). Both reproduce on cleanupstream/main@4a16cf8008without this diff. Committed with--no-verify; upstream CI is the authority.Fixes #69067