Repository navigation
fix(slack): route DM thread replies to main session instead of thread-scoped session - #82418
Conversation
|
Codex review: needs real behavior proof before merge. Summary Reproducibility: yes. at source level: current main maps direct-message thread replies to threadTs and current tests assert thread-suffixed DM session keys. I did not establish a live Slack workspace reproduction in this read-only review. Real behavior proof Next step before merge Security Review findings
Review detailsBest possible solution: Land the narrow DM-thread routing fix after documenting the DM exception and adding redacted live Slack proof or an explicit maintainer proof override, while keeping Assistant App dispatch work in the linked follow-up. Do we have a high-confidence way to reproduce the issue? Yes at source level: current main maps direct-message thread replies to threadTs and current tests assert thread-suffixed DM session keys. I did not establish a live Slack workspace reproduction in this read-only review. Is this the best way to solve the issue? No, not in the current PR form: the route change is narrow and preserves runtime bindings, but the public docs must be updated and real Slack behavior proof or an explicit maintainer override is still needed. Full review comments:
Overall correctness: patch is incorrect Acceptance criteria:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 605a2c87ae80. |
|
Re: Real behavior proof gate — this is a pure routing-logic fix in |
50b2778 to
f4e0f46
Compare
f4e0f46 to
d10ebe8
Compare
…-scoped session DM thread replies (user replies inside a thread under a bot message in a DM) were routed to a thread-specific session key instead of the user's main DM session. This caused the agent to never receive the inbound on the expected session, making the bot appear unresponsive. The root cause was in prepare-routing.ts: canonicalThreadId for isDirectMessage was set to threadTs when isThreadReply was true, creating a session key like agent:main:slack:direct:u3:thread:<ts>. DM threads are a UI affordance — not a session boundary — so all DM messages should route to the main DM session regardless of thread_ts. Also adds a diagnostic logVerbose warning when assistant_app_thread message_changed events fail sender resolution (Case 2 of openclaw#82390), which was previously completely silent. Fixes openclaw#82390
d10ebe8 to
899f30a
Compare
|
Maintainer fixups pushed after rebase on Verification:
Result: Slack DM thread replies use the direct/main DM session, while |
…-scoped session (openclaw#82418) * fix(slack): route DM thread replies to main session instead of thread-scoped session DM thread replies (user replies inside a thread under a bot message in a DM) were routed to a thread-specific session key instead of the user's main DM session. This caused the agent to never receive the inbound on the expected session, making the bot appear unresponsive. The root cause was in prepare-routing.ts: canonicalThreadId for isDirectMessage was set to threadTs when isThreadReply was true, creating a session key like agent:main:slack:direct:u3:thread:<ts>. DM threads are a UI affordance — not a session boundary — so all DM messages should route to the main DM session regardless of thread_ts. Also adds a diagnostic logVerbose warning when assistant_app_thread message_changed events fail sender resolution (Case 2 of openclaw#82390), which was previously completely silent. Fixes openclaw#82390 * chore(slack): polish DM thread routing PR * test(slack): update DM thread routing contract * test(slack): flatten non-main DM thread expectations * fix(slack): preserve bound DM thread routes * test(slack): align DM thread session fixtures * fix(slack): keep flattened DM thread metadata scoped * fix(slack): preserve DM thread delivery routes --------- Co-authored-by: Peter Steinberger <[email protected]>
…-scoped session (openclaw#82418) * fix(slack): route DM thread replies to main session instead of thread-scoped session DM thread replies (user replies inside a thread under a bot message in a DM) were routed to a thread-specific session key instead of the user's main DM session. This caused the agent to never receive the inbound on the expected session, making the bot appear unresponsive. The root cause was in prepare-routing.ts: canonicalThreadId for isDirectMessage was set to threadTs when isThreadReply was true, creating a session key like agent:main:slack:direct:u3:thread:<ts>. DM threads are a UI affordance — not a session boundary — so all DM messages should route to the main DM session regardless of thread_ts. Also adds a diagnostic logVerbose warning when assistant_app_thread message_changed events fail sender resolution (Case 2 of openclaw#82390), which was previously completely silent. Fixes openclaw#82390 * chore(slack): polish DM thread routing PR * test(slack): update DM thread routing contract * test(slack): flatten non-main DM thread expectations * fix(slack): preserve bound DM thread routes * test(slack): align DM thread session fixtures * fix(slack): keep flattened DM thread metadata scoped * fix(slack): preserve DM thread delivery routes --------- Co-authored-by: Peter Steinberger <[email protected]>
…-scoped session (openclaw#82418) * fix(slack): route DM thread replies to main session instead of thread-scoped session DM thread replies (user replies inside a thread under a bot message in a DM) were routed to a thread-specific session key instead of the user's main DM session. This caused the agent to never receive the inbound on the expected session, making the bot appear unresponsive. The root cause was in prepare-routing.ts: canonicalThreadId for isDirectMessage was set to threadTs when isThreadReply was true, creating a session key like agent:main:slack:direct:u3:thread:<ts>. DM threads are a UI affordance — not a session boundary — so all DM messages should route to the main DM session regardless of thread_ts. Also adds a diagnostic logVerbose warning when assistant_app_thread message_changed events fail sender resolution (Case 2 of openclaw#82390), which was previously completely silent. Fixes openclaw#82390 * chore(slack): polish DM thread routing PR * test(slack): update DM thread routing contract * test(slack): flatten non-main DM thread expectations * fix(slack): preserve bound DM thread routes * test(slack): align DM thread session fixtures * fix(slack): keep flattened DM thread metadata scoped * fix(slack): preserve DM thread delivery routes --------- Co-authored-by: Peter Steinberger <[email protected]>
…-scoped session (openclaw#82418) * fix(slack): route DM thread replies to main session instead of thread-scoped session DM thread replies (user replies inside a thread under a bot message in a DM) were routed to a thread-specific session key instead of the user's main DM session. This caused the agent to never receive the inbound on the expected session, making the bot appear unresponsive. The root cause was in prepare-routing.ts: canonicalThreadId for isDirectMessage was set to threadTs when isThreadReply was true, creating a session key like agent:main:slack:direct:u3:thread:<ts>. DM threads are a UI affordance — not a session boundary — so all DM messages should route to the main DM session regardless of thread_ts. Also adds a diagnostic logVerbose warning when assistant_app_thread message_changed events fail sender resolution (Case 2 of openclaw#82390), which was previously completely silent. Fixes openclaw#82390 * chore(slack): polish DM thread routing PR * test(slack): update DM thread routing contract * test(slack): flatten non-main DM thread expectations * fix(slack): preserve bound DM thread routes * test(slack): align DM thread session fixtures * fix(slack): keep flattened DM thread metadata scoped * fix(slack): preserve DM thread delivery routes --------- Co-authored-by: Peter Steinberger <[email protected]>
Summary
:thread:<thread_ts>sessions.ReplyToId/TransportThreadId, last-route metadata, routed replies, ACP delivery, queued follow-ups, and Slack tool context.message_changeddispatch. Refs [Bug] Slack DM inbound silently dropped for thread replies + assistant_app_thread message_changed events #82390.Verification
Behavior addressed: Slack DM thread replies no longer route to thread-scoped sessions by default; explicit runtime DM thread bindings remain honored; routed/ACP/tool/follow-up deliveries keep the Slack UI thread target.
Real environment tested: local OpenClaw source checkout with Slack routing, prepare, dispatch, session, routed reply, ACP delivery, follow-up, and tool-context tests after rebasing onto
origin/main.Exact steps or command run after this patch:
git rebase origin/maingit diff --check/Users/steipete/Projects/agent-scripts/skills/codex-review/scripts/codex-review --parallel-tests 'pnpm test extensions/slack/src/threading-tool-context.test.ts && pnpm test src/auto-reply/reply/dispatch-from-config.test.ts -t "Slack DM TransportThreadId|thread-scoped session key|cleared route thread" && pnpm test src/auto-reply/reply/dispatch-acp-delivery.test.ts -t "Slack DM TransportThreadId|mirrors routed ACP replies" && pnpm test src/auto-reply/reply/get-reply-run.media-only.test.ts -t "transport thread metadata" && pnpm test src/auto-reply/reply/session.test.ts -t "transport thread routing" && pnpm test extensions/slack/src/monitor/message-handler/dispatch.preview-fallback.test.ts -t "transport thread metadata|non-main DM last-route|main-scope DM last-route" && pnpm test extensions/slack/src/monitor/message-handler/prepare.test.ts -t "DM thread replies|parent_user_id replies|open DMs|preserves Slack thread history"'pnpm test extensions/slack/src/threading-tool-context.test.ts && pnpm test src/auto-reply/reply/dispatch-from-config.test.ts -t "Slack DM TransportThreadId|thread-scoped session key|cleared route thread" && pnpm test src/auto-reply/reply/dispatch-acp-delivery.test.ts -t "Slack DM TransportThreadId|mirrors routed ACP replies" && pnpm test src/auto-reply/reply/get-reply-run.media-only.test.ts -t "transport thread metadata" && pnpm test src/auto-reply/reply/session.test.ts -t "transport thread routing" && pnpm test extensions/slack/src/monitor/message-handler/dispatch.preview-fallback.test.ts -t "transport thread metadata|non-main DM last-route|main-scope DM last-route" && pnpm test extensions/slack/src/monitor/message-handler/prepare.test.ts -t "DM thread replies|parent_user_id replies|open DMs|preserves Slack thread history"Evidence after fix: codex-review reported no actionable findings; the focused rebased proof passed 16 Slack tool-context tests, 3 dispatch-from-config routing tests, 2 ACP delivery tests, 1 follow-up delivery test, 1 session routing test, 3 Slack dispatch tests, and 5 Slack prepare tests.
Observed result after fix: unbound Slack DM thread replies route to the direct/main DM session without
MessageThreadIdor a:thread:session suffix;TransportThreadId/ReplyToIdpreserve Slack UI thread delivery; explicit runtime bindings still route to the bound session; legacy thread-session store entries do not suppress Slack thread history.What was not tested: live Slack DM roundtrip; full assistant
message_changeddispatch recovery. A broad reviewer-triggeredprepare.test.tsrun still hits unrelated existing media-history assertions around skipped no-mention images.