Skip to content

fix(slack): restore replyToMode regression from extension migration - #61835

Merged
steipete merged 4 commits into
openclaw:mainfrom
kaonash:fix/slack-replyToMode-thread-regression
Apr 6, 2026
Merged

steipete merged 4 commits into
openclaw:mainfrom
kaonash:fix/slack-replyToMode-thread-regression

Conversation

@kaonash

@kaonash kaonash commented Apr 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Removes backward-compatibility fallback in createSlackReplyReferencePlanner that overrode isThreadReply with Boolean(incomingThreadTs), causing replyToMode to be ignored when Slack auto-populates thread_ts on top-level messages.
  • Restores the behavior from fix(slack): enforce replyToMode for auto-thread_ts and inline reply tags #23839 (commit 71c2c59c6c) which was regressed during the Slack extension migration.
  • Updates monitor.test.ts to pass isThreadReply: true for genuine-thread test scenarios instead of relying on the removed fallback.

How the regression happened

  1. 71c2c59c6c (fix(slack): enforce replyToMode for auto-thread_ts and inline reply tags #23839, Feb 22) — Fixed replyToMode being ignored when Slack auto-populates thread_ts on top-level messages. The fix was simple:

    const effectiveMode = params.isThreadReply ? "all" : params.replyToMode;
  2. 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 for isThreadReply in resolveSlackThreadTs to 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 to incomingThreadTs when isThreadReply was not provided.

  3. 8746362f5e (refactor: move Slack channel implementation to extensions/ #45621, Mar 14) — Slack code was migrated to extensions/slack/. During the migration, a backward-compatibility fallback was added inside createSlackReplyReferencePlanner itself:

    const effectiveIsThreadReply = params.isThreadReply ?? Boolean(params.incomingThreadTs);

    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 with incomingThreadTs (including Slack's auto-populated top-level thread_ts) would be forced into threading regardless of the configured replyToMode.

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_ts on top-level messages in some cases (e.g. Agents & AI Apps feature), the fallback incorrectly forced effectiveMode = "all" even when the caller explicitly passed isThreadReply: false. This made the configured replyToMode setting be ignored.

All current callers (dispatch.ts) already pass isThreadReply explicitly, so the fallback is unnecessary.

Fix

// Before (regressed)
const effectiveIsThreadReply = params.isThreadReply ?? Boolean(params.incomingThreadTs);
const effectiveMode = effectiveIsThreadReply ? "all" : params.replyToMode;

// After (restored)
const effectiveMode = params.isThreadReply ? "all" : params.replyToMode;

Test plan

  • pnpm test extensions/slack/src/monitor/replies.test.ts — 7/7 passed
  • pnpm test extensions/slack/src/monitor.test.ts — all passed (updated genuine-thread test to pass isThreadReply: true)
  • pnpm test extensions/slack/src/threading.test.ts extensions/slack/src/monitor.tool-result.test.ts — 55/55 passed
  • Manual: configure replyToMode: "off" or "first", send top-level channel message with auto-created thread_ts → bot should respect configured mode
  • Manual: send genuine thread reply → bot should still reply in thread regardless of replyToMode

Fixes regression of #23839.
Related: #5470, #16080

🤖 Generated with Claude Code

@openclaw-barnacle openclaw-barnacle Bot added channel: slack Channel integration: slack size: XS labels Apr 6, 2026
@greptile-apps

greptile-apps Bot commented Apr 6, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR restores the pre-migration behavior from #23839 by removing the ?? Boolean(params.incomingThreadTs) fallback in createSlackReplyReferencePlanner, which was causing replyToMode to be ignored when Slack auto-populates thread_ts on top-level messages. The implementation change itself is correct, but the scoped test run (replies.test.ts) missed a regression in monitor.test.ts.

  • P1: monitor.test.ts's "stays in incoming threads for all replyToMode values" test (lines 62–74) calls resolveSlackThreadTs without isThreadReply for all modes including "off". After this change, effectiveMode is set to "off", which causes createReplyReferencePlanner to return undefined (early exit at src/auto-reply/reply/reply-reference.ts:36-37) instead of threadTs, breaking that test case and causing CI failure.

Confidence Score: 4/5

The 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 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.

Reviews (1): Last reviewed commit: "fix(slack): remove backward-compat fallb..." | Re-trigger Greptile

Comment thread extensions/slack/src/monitor/replies.ts Outdated
// 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;

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 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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

@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: 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".

Comment thread extensions/slack/src/monitor/replies.ts Outdated
// 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;

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.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

@steipete
steipete force-pushed the fix/slack-replyToMode-thread-regression branch from 51a1a88 to 93b075d Compare April 6, 2026 13:33
@steipete
steipete force-pushed the fix/slack-replyToMode-thread-regression branch from 93b075d to ad933e3 Compare April 6, 2026 13:38
@steipete
steipete merged commit 3da7c86 into openclaw:main Apr 6, 2026
7 checks passed

steipete commented Apr 6, 2026

Copy link
Copy Markdown
Contributor

Landed in 3da7c8610fd75196ad3227f31975d4cfd984ad6d.

Fixup on top of ad933e398c3f4928e013e66a20d058ef8fc77826:

  • preserved fallback thread classification for older callers by treating incomingThreadTs !== messageTs as the implicit real-thread signal in extensions/slack/src/monitor/replies.ts
  • added regression coverage for genuine replies vs Slack auto-created top-level thread_ts in extensions/slack/src/monitor/replies.test.ts
  • added changelog note

Thanks @kaonash.

@steipete

steipete commented Apr 6, 2026

Copy link
Copy Markdown
Contributor

Landed via temp rebase onto main.

  • Gate: local pnpm check was blocked by unrelated latest-main type failures in extensions/xai, src/cli/*, and extensions/discord/src/proxy-request-client.ts; targeted local Slack Vitest runs timed out under the local runner, so final merge used GitHub's merge gate on the current PR head.
  • Source head: ad933e3
  • Merge commit: 3da7c86

Thanks @kaonash!

steipete added a commit to leoleedev/openclaw that referenced this pull request Apr 6, 2026
Mlightsnow pushed a commit to Mlightsnow/openclaw that referenced this pull request Apr 6, 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
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
vixco pushed a commit to vixco/openclaw that referenced this pull request Aug 16, 2026
globalcaos pushed a commit to globalcaos/tinkerclaw that referenced this pull request Sep 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: slack Channel integration: slack size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants