Repository navigation
fix(slack): restore replyToMode regression from extension migration - #61835
Conversation
Greptile SummaryThis PR restores the pre-migration behavior from #23839 by removing the
Confidence Score: 4/5The implementation fix is directionally correct, but a CI-breaking test regression in monitor.test.ts was missed. One P1 finding: the monitor.test.ts 'stays in incoming threads' test will fail for replyToMode='off' cases after this change, since the fallback that test implicitly depended on was removed without updating the test. This is a current test failure, not a speculative concern. extensions/slack/src/monitor.test.ts (lines 62–74) needs isThreadReply: true added to the genuine-thread test cases. Prompt To Fix All With AIThis is a comment left during a code review.
Path: extensions/slack/src/monitor/replies.ts
Line: 144
Comment:
**Untested regression in `monitor.test.ts` for `replyToMode="off"`**
The PR only ran `replies.test.ts` (7/7), but `extensions/slack/src/monitor.test.ts` lines 62–74 has a test "stays in incoming threads for all replyToMode values" that calls `resolveSlackThreadTs` without `isThreadReply` for all modes, including `"off"`. With the old fallback, `effectiveMode` was forced to `"all"` via `Boolean(incomingThreadTs)`, so `createReplyReferencePlanner` returned `threadTs`. After this change, `effectiveMode = "off"`, which causes `createReplyReferencePlanner` to immediately return `undefined` (see `src/auto-reply/reply/reply-reference.ts:36–37`). The test will fail for the `"off"` mode cases.
The fix belongs in `monitor.test.ts` — pass `isThreadReply: true` for genuine-thread scenarios (matching how `dispatch.ts` actually calls this function) rather than relying on the now-removed implicit fallback.
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "fix(slack): remove backward-compat fallb..." | Re-trigger Greptile |
| // Only force threading for genuine user thread replies. Slack auto-populates | ||
| // thread_ts on top-level messages; respect the configured replyToMode there. | ||
| // See: openclaw/openclaw#23839 | ||
| const effectiveMode = params.isThreadReply ? "all" : params.replyToMode; |
There was a problem hiding this comment.
Untested regression in
monitor.test.ts for replyToMode="off"
The PR only ran replies.test.ts (7/7), but extensions/slack/src/monitor.test.ts lines 62–74 has a test "stays in incoming threads for all replyToMode values" that calls resolveSlackThreadTs without isThreadReply for all modes, including "off". With the old fallback, effectiveMode was forced to "all" via Boolean(incomingThreadTs), so createReplyReferencePlanner returned threadTs. After this change, effectiveMode = "off", which causes createReplyReferencePlanner to immediately return undefined (see src/auto-reply/reply/reply-reference.ts:36–37). The test will fail for the "off" mode cases.
The fix belongs in monitor.test.ts — pass isThreadReply: true for genuine-thread scenarios (matching how dispatch.ts actually calls this function) rather than relying on the now-removed implicit fallback.
Prompt To Fix With AI
This is a comment left during a code review.
Path: extensions/slack/src/monitor/replies.ts
Line: 144
Comment:
**Untested regression in `monitor.test.ts` for `replyToMode="off"`**
The PR only ran `replies.test.ts` (7/7), but `extensions/slack/src/monitor.test.ts` lines 62–74 has a test "stays in incoming threads for all replyToMode values" that calls `resolveSlackThreadTs` without `isThreadReply` for all modes, including `"off"`. With the old fallback, `effectiveMode` was forced to `"all"` via `Boolean(incomingThreadTs)`, so `createReplyReferencePlanner` returned `threadTs`. After this change, `effectiveMode = "off"`, which causes `createReplyReferencePlanner` to immediately return `undefined` (see `src/auto-reply/reply/reply-reference.ts:36–37`). The test will fail for the `"off"` mode cases.
The fix belongs in `monitor.test.ts` — pass `isThreadReply: true` for genuine-thread scenarios (matching how `dispatch.ts` actually calls this function) rather than relying on the now-removed implicit fallback.
How can I resolve this? If you propose a fix, please make it concise.There was a problem hiding this comment.
Good catch — fixed in 51a1a88. The monitor.test.ts test was relying on the implicit incomingThreadTs fallback instead of explicitly passing isThreadReply: true for genuine-thread scenarios.
Updated the test to match how dispatch.ts actually calls this function.
All 55 related tests pass.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0352490be7
ℹ️ 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".
| // Only force threading for genuine user thread replies. Slack auto-populates | ||
| // thread_ts on top-level messages; respect the configured replyToMode there. | ||
| // See: openclaw/openclaw#23839 | ||
| const effectiveMode = params.isThreadReply ? "all" : params.replyToMode; |
There was a problem hiding this comment.
Keep thread replies threaded when classification is absent
isThreadReply is still optional in this planner path, but this change now treats undefined as a top-level message and falls back to replyToMode directly. In the common case where incomingThreadTs is present but callers do not pass isThreadReply, replyToMode: "off" will return undefined and post to the channel instead of the existing thread. That is a behavior regression for resolveSlackThreadTs/resolveSlackStreamingThreadHint callers that rely on incomingThreadTs alone (including existing in-repo call patterns/tests that omit isThreadReply).
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Thanks for flagging. I verified that all current production callers (dispatch.ts) already pass isThreadReply explicitly, so the fallback was effectively dead code that only masked the regression.
Updated the test in monitor.test.ts that was implicitly depending on this fallback (51a1a88448).
Making isThreadReply required (non-optional) in the planner signature could be a good follow-up to prevent this class of issue entirely — happy to do that if maintainers prefer.
51a1a88 to
93b075d
Compare
93b075d to
ad933e3
Compare
|
Landed in Fixup on top of
Thanks @kaonash. |
|
Landed via temp rebase onto
Thanks @kaonash! |
Summary
createSlackReplyReferencePlannerthat overrodeisThreadReplywithBoolean(incomingThreadTs), causingreplyToModeto be ignored when Slack auto-populatesthread_tson top-level messages.71c2c59c6c) which was regressed during the Slack extension migration.monitor.test.tsto passisThreadReply: truefor genuine-thread test scenarios instead of relying on the removed fallback.How the regression happened
71c2c59c6c(fix(slack): enforce replyToMode for auto-thread_ts and inline reply tags #23839, Feb 22) — FixedreplyToModebeing ignored when Slack auto-populatesthread_tson top-level messages. The fix was simple:f8171ffcdc(Config UI: tag filters and complete schema help/labels coverage #23796, Feb 22, same day) — An unrelated PR ("Config UI: tag filters and complete schema help/labels coverage") added a fallback forisThreadReplyinresolveSlackThreadTsto unblock tests. This didn't directly conflict with fix(slack): enforce replyToMode for auto-thread_ts and inline reply tags #23839, but introduced a pattern of falling back toincomingThreadTswhenisThreadReplywas not provided.8746362f5e(refactor: move Slack channel implementation to extensions/ #45621, Mar 14) — Slack code was migrated toextensions/slack/. During the migration, a backward-compatibility fallback was added insidecreateSlackReplyReferencePlanneritself:This was likely intended as a safety measure for callers that might not pass
isThreadReply, but it effectively reverted the fix(slack): enforce replyToMode for auto-thread_ts and inline reply tags #23839 fix — any message withincomingThreadTs(including Slack's auto-populated top-levelthread_ts) would be forced into threading regardless of the configuredreplyToMode.Root cause: #23839 and #23796 merged on the same day without conflicting, and the fallback pattern from #23796 carried forward into the extension migration, where it was generalized into the planner function itself, negating the original fix.
Problem
Since Slack auto-populates
thread_tson top-level messages in some cases (e.g. Agents & AI Apps feature), the fallback incorrectly forcedeffectiveMode = "all"even when the caller explicitly passedisThreadReply: false. This made the configuredreplyToModesetting be ignored.All current callers (
dispatch.ts) already passisThreadReplyexplicitly, so the fallback is unnecessary.Fix
Test plan
pnpm test extensions/slack/src/monitor/replies.test.ts— 7/7 passedpnpm test extensions/slack/src/monitor.test.ts— all passed (updated genuine-thread test to passisThreadReply: true)pnpm test extensions/slack/src/threading.test.ts extensions/slack/src/monitor.tool-result.test.ts— 55/55 passedreplyToMode: "off"or"first", send top-level channel message with auto-createdthread_ts→ bot should respect configured modereplyToModeFixes regression of #23839.
Related: #5470, #16080
🤖 Generated with Claude Code