Repository navigation
fix(agents): keep top-level Slack requests' sessions_send completions top-level - #187065
Conversation
Slack exposes the triggering top-level message ts as currentThreadTs (a reply anchor), and sessions_send captured it as the requester thread, so a delayed completion created a new thread under a top-level request even with replyToMode off. Resolve the requester route through resolveSpawnRequesterConversationTarget, which keeps the session's own destination paired with its own thread. Fixes openclaw#186914
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis PR prevents delayed sessions_send completions from turning top-level Slack requests into threads when replyToMode is off. Example: A top-level Slack request at timestamp 1793210000.000100 delegates work with replyToMode off.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current Slack completion-placement bug and resolves the previous destination-precedence finding; no actionable defects remain in the reviewed diff, while exact-head CI is still pending. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherSlack supplies current-turn routing metadata to hosted conversation tools, which capture the requester destination for the delayed sessions_send reply flow and eventual Slack delivery. flowchart LR
A[Slack inbound message] --> B[Slack threading context]
B --> C[Hosted conversation tools]
C --> D[sessions_send worker]
D --> E[Requester completion turn]
E --> F[Slack SDK delivery]
Technical reviewBest possible solution: Keep the existing requester-route capture and omit only Slack’s synthetic off-mode reply anchor from the delayed completion thread. Do we have a high-confidence way to reproduce the issue? Current-main source shows the anchor-to-thread promotion, consistent with the official-release report and supplied paired Gateway/SDK captures; this read-only review ran no target code. Is this the best way to solve the issue? The condition is the smallest complete repair at the existing capture owner and preserves both admitted-current precedence and Slack’s intentional reply-anchor behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d821a7fd1dc8. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +7, Tests +8, Docs +2. Total +17 across 3 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed October 28, 2026, 8:29 PM ET / October 29, 2026, 00:29 UTC (Revision 2). |
Observed Slack SDK delivery capturesMain The model discovers and describes sessions_send through shipped Tool Search, then dispatches it with timeoutSeconds=0. The real worker agent request is held until the requester has acknowledged and a later inbound message from another DM has also been processed on the same main session. After release, the requester completion uses message(action=send, message=FINAL...) with no target, threadId, replyTo or topLevel override. The oracle is the thread_ts actually submitted by the real Slack SDK. Identifiers and endpoint/state paths are redacted consistently. base-top-1{
"sdkUserAgents": [
"@slack:socket-mode/3.1.0 @slack:bolt/5.1.0 @slack:web-api/8.2.0 openclaw-gateway/24.22.1"
],
"signedIngress": {
"status": 200,
"channel": "<original-DM>",
"messageTs": "<request-ts>"
},
"laterModelRetainsOriginalUserRequest": true,
"events": [
{
"event": "signed-ingress",
"msSinceIngress": 0,
"httpStatus": 200,
"target": "<original-DM>"
},
{
"event": "worker-model-held",
"msSinceIngress": 2005
},
{
"event": "initial-ack-observed",
"msSinceIngress": 2131
},
{
"event": "signed-ingress",
"msSinceIngress": 2136,
"httpStatus": 200,
"target": "<later-DM>"
},
{
"event": "later-inbound-ack-observed",
"msSinceIngress": 2383
},
{
"event": "worker-model-released",
"msSinceIngress": 2383
}
],
"slackApiRequests": [
{
"method": "chat.postMessage",
"msSinceIngress": 1774,
"apiRequest": {
"channel": "<original-DM>",
"text": "ACK187065-TOP-1"
},
"apiResponseChannel": "<original-DM>"
},
{
"method": "chat.postMessage",
"msSinceIngress": 2298,
"apiRequest": {
"channel": "<later-DM>",
"text": "LATER_ACK187065-TOP-1"
},
"apiResponseChannel": "<later-DM>"
},
{
"method": "chat.postMessage",
"msSinceIngress": 2655,
"apiRequest": {
"channel": "<original-DM>",
"text": "FINAL187065-TOP-1",
"thread_ts": "<request-ts>"
},
"apiResponseChannel": "<original-DM>"
}
],
"finalThreadFieldPresent": true,
"finalResolvedConversation": "<original-DM>",
"workerReleasedAfterLaterAck": true,
"gatewayExit": {
"code": 0,
"signal": null
}
}base-top-2{
"sdkUserAgents": [
"@slack:socket-mode/3.1.0 @slack:bolt/5.1.0 @slack:web-api/8.2.0 openclaw-gateway/24.22.1"
],
"signedIngress": {
"status": 200,
"channel": "<original-DM>",
"messageTs": "<request-ts>"
},
"laterModelRetainsOriginalUserRequest": true,
"events": [
{
"event": "signed-ingress",
"msSinceIngress": 0,
"httpStatus": 200,
"target": "<original-DM>"
},
{
"event": "worker-model-held",
"msSinceIngress": 1989
},
{
"event": "initial-ack-observed",
"msSinceIngress": 2196
},
{
"event": "signed-ingress",
"msSinceIngress": 2202,
"httpStatus": 200,
"target": "<later-DM>"
},
{
"event": "later-inbound-ack-observed",
"msSinceIngress": 2560
},
{
"event": "worker-model-released",
"msSinceIngress": 2560
}
],
"slackApiRequests": [
{
"method": "chat.postMessage",
"msSinceIngress": 1751,
"apiRequest": {
"channel": "<original-DM>",
"text": "ACK187065-TOP-2"
},
"apiResponseChannel": "<original-DM>"
},
{
"method": "chat.postMessage",
"msSinceIngress": 2378,
"apiRequest": {
"channel": "<later-DM>",
"text": "LATER_ACK187065-TOP-2"
},
"apiResponseChannel": "<later-DM>"
},
{
"method": "chat.postMessage",
"msSinceIngress": 2797,
"apiRequest": {
"channel": "<original-DM>",
"text": "FINAL187065-TOP-2",
"thread_ts": "<request-ts>"
},
"apiResponseChannel": "<original-DM>"
}
],
"finalThreadFieldPresent": true,
"finalResolvedConversation": "<original-DM>",
"workerReleasedAfterLaterAck": true,
"gatewayExit": {
"code": 0,
"signal": null
}
}candidate-top-1{
"sdkUserAgents": [
"@slack:socket-mode/3.1.0 @slack:bolt/5.1.0 @slack:web-api/8.2.0 openclaw-gateway/24.22.1"
],
"signedIngress": {
"status": 200,
"channel": "<original-DM>",
"messageTs": "<request-ts>"
},
"laterModelRetainsOriginalUserRequest": true,
"events": [
{
"event": "signed-ingress",
"msSinceIngress": 0,
"httpStatus": 200,
"target": "<original-DM>"
},
{
"event": "worker-model-held",
"msSinceIngress": 1994
},
{
"event": "initial-ack-observed",
"msSinceIngress": 2214
},
{
"event": "signed-ingress",
"msSinceIngress": 2222,
"httpStatus": 200,
"target": "<later-DM>"
},
{
"event": "later-inbound-ack-observed",
"msSinceIngress": 2620
},
{
"event": "worker-model-released",
"msSinceIngress": 2620
}
],
"slackApiRequests": [
{
"method": "chat.postMessage",
"msSinceIngress": 1761,
"apiRequest": {
"channel": "<original-DM>",
"text": "ACK187065-TOP-1"
},
"apiResponseChannel": "<original-DM>"
},
{
"method": "chat.postMessage",
"msSinceIngress": 2413,
"apiRequest": {
"channel": "<later-DM>",
"text": "LATER_ACK187065-TOP-1"
},
"apiResponseChannel": "<later-DM>"
},
{
"method": "chat.postMessage",
"msSinceIngress": 2888,
"apiRequest": {
"channel": "<original-user>",
"text": "FINAL187065-TOP-1"
},
"apiResponseChannel": "<original-DM>"
}
],
"finalThreadFieldPresent": false,
"finalResolvedConversation": "<original-DM>",
"workerReleasedAfterLaterAck": true,
"gatewayExit": {
"code": 0,
"signal": null
}
}candidate-top-2{
"sdkUserAgents": [
"@slack:socket-mode/3.1.0 @slack:bolt/5.1.0 @slack:web-api/8.2.0 openclaw-gateway/24.22.1"
],
"signedIngress": {
"status": 200,
"channel": "<original-DM>",
"messageTs": "<request-ts>"
},
"laterModelRetainsOriginalUserRequest": true,
"events": [
{
"event": "signed-ingress",
"msSinceIngress": 0,
"httpStatus": 200,
"target": "<original-DM>"
},
{
"event": "worker-model-held",
"msSinceIngress": 2011
},
{
"event": "initial-ack-observed",
"msSinceIngress": 2168
},
{
"event": "signed-ingress",
"msSinceIngress": 2175,
"httpStatus": 200,
"target": "<later-DM>"
},
{
"event": "later-inbound-ack-observed",
"msSinceIngress": 2543
},
{
"event": "worker-model-released",
"msSinceIngress": 2544
}
],
"slackApiRequests": [
{
"method": "chat.postMessage",
"msSinceIngress": 1770,
"apiRequest": {
"channel": "<original-DM>",
"text": "ACK187065-TOP-2"
},
"apiResponseChannel": "<original-DM>"
},
{
"method": "chat.postMessage",
"msSinceIngress": 2351,
"apiRequest": {
"channel": "<later-DM>",
"text": "LATER_ACK187065-TOP-2"
},
"apiResponseChannel": "<later-DM>"
},
{
"method": "chat.postMessage",
"msSinceIngress": 2778,
"apiRequest": {
"channel": "<original-user>",
"text": "FINAL187065-TOP-2"
},
"apiResponseChannel": "<original-DM>"
}
],
"finalThreadFieldPresent": false,
"finalResolvedConversation": "<original-DM>",
"workerReleasedAfterLaterAck": true,
"gatewayExit": {
"code": 0,
"signal": null
}
}base-thread-1{
"sdkUserAgents": [
"@slack:socket-mode/3.1.0 @slack:bolt/5.1.0 @slack:web-api/8.2.0 openclaw-gateway/24.22.1"
],
"signedIngress": {
"status": 200,
"channel": "<original-DM>",
"messageTs": "<request-ts>",
"thread_ts": "<thread-root>"
},
"laterModelRetainsOriginalUserRequest": true,
"events": [
{
"event": "signed-ingress",
"msSinceIngress": 0,
"httpStatus": 200,
"target": "<original-DM>"
},
{
"event": "worker-model-held",
"msSinceIngress": 2022
},
{
"event": "initial-ack-observed",
"msSinceIngress": 2162
},
{
"event": "signed-ingress",
"msSinceIngress": 2168,
"httpStatus": 200,
"target": "<later-DM>"
},
{
"event": "later-inbound-ack-observed",
"msSinceIngress": 2512
},
{
"event": "worker-model-released",
"msSinceIngress": 2512
}
],
"slackApiRequests": [
{
"method": "chat.postMessage",
"msSinceIngress": 1787,
"apiRequest": {
"channel": "<original-DM>",
"text": "ACK187065-THREAD-1",
"thread_ts": "<thread-root>"
},
"apiResponseChannel": "<original-DM>"
},
{
"method": "chat.postMessage",
"msSinceIngress": 2343,
"apiRequest": {
"channel": "<later-DM>",
"text": "LATER_ACK187065-THREAD-1"
},
"apiResponseChannel": "<later-DM>"
},
{
"method": "chat.postMessage",
"msSinceIngress": 2763,
"apiRequest": {
"channel": "<original-DM>",
"text": "FINAL187065-THREAD-1",
"thread_ts": "<thread-root>"
},
"apiResponseChannel": "<original-DM>"
}
],
"finalThreadFieldPresent": true,
"finalResolvedConversation": "<original-DM>",
"workerReleasedAfterLaterAck": true,
"gatewayExit": {
"code": 0,
"signal": null
}
}candidate-thread-1{
"sdkUserAgents": [
"@slack:socket-mode/3.1.0 @slack:bolt/5.1.0 @slack:web-api/8.2.0 openclaw-gateway/24.22.1"
],
"signedIngress": {
"status": 200,
"channel": "<original-DM>",
"messageTs": "<request-ts>",
"thread_ts": "<thread-root>"
},
"laterModelRetainsOriginalUserRequest": true,
"events": [
{
"event": "signed-ingress",
"msSinceIngress": 0,
"httpStatus": 200,
"target": "<original-DM>"
},
{
"event": "worker-model-held",
"msSinceIngress": 2050
},
{
"event": "initial-ack-observed",
"msSinceIngress": 2127
},
{
"event": "signed-ingress",
"msSinceIngress": 2132,
"httpStatus": 200,
"target": "<later-DM>"
},
{
"event": "later-inbound-ack-observed",
"msSinceIngress": 2454
},
{
"event": "worker-model-released",
"msSinceIngress": 2455
}
],
"slackApiRequests": [
{
"method": "chat.postMessage",
"msSinceIngress": 1789,
"apiRequest": {
"channel": "<original-DM>",
"text": "ACK187065-THREAD-1",
"thread_ts": "<thread-root>"
},
"apiResponseChannel": "<original-DM>"
},
{
"method": "chat.postMessage",
"msSinceIngress": 2324,
"apiRequest": {
"channel": "<later-DM>",
"text": "LATER_ACK187065-THREAD-1"
},
"apiResponseChannel": "<later-DM>"
},
{
"method": "chat.postMessage",
"msSinceIngress": 2695,
"apiRequest": {
"channel": "<original-DM>",
"text": "FINAL187065-THREAD-1",
"thread_ts": "<thread-root>"
},
"apiResponseChannel": "<original-DM>"
}
],
"finalThreadFieldPresent": true,
"finalResolvedConversation": "<original-DM>",
"workerReleasedAfterLaterAck": true,
"gatewayExit": {
"code": 0,
"signal": null
}
}Focused production-composition checks: 23 tests pass across conversation tools and sessions_send admission. The existing admitted-current-over-stale-fallback case still passes unchanged (original-recipient/thread 42 wins over stale-recipient/thread 99 after later inbound metadata changes). The new top-level Slack route case uses the actual reply flow rather than spying on factory arguments; it fails on main (1 failed, 17 skipped). Numeric-thread coverage remains in the legacy-DM case. Test count delta zero. Formatting passes. The repair retains sessions_send current-target/current-thread precedence, and removes only an off-mode Slack reply anchor equal to the current message ID. It does not reuse the spawn route resolver or change public SDK/config fields. Producer source SHA-256 |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Thanks @obviyus. I reran the live Slack rig (real Gateway, Slack HTTP mode with signed Events API, Web API stand-in via
I dropped my local follow-up because yours supersedes it. |
|
Maintainer override: Both red jobs reproduce identically on frozen main, and all four failing files are byte-identical between main and this head:
|
… top-level (#187065) fix(slack): don't thread a delayed sessions_send completion under a top-level request When a sessions_send completion arrived later for a request that was made at the top level of a Slack channel, delivery used the request's own timestamp as thread_ts, so the reply opened a new thread instead of posting at the top level. A top-level request's completion is now posted without thread_ts. Requests made inside a thread keep their thread root, and the existing admitted-current routing precedence is unchanged. Evidence: built Gateway with the bundled Slack plugin and real Slack SDKs against local Slack-compatible services. On main the delayed completion was posted with the top-level request timestamp as thread_ts (twice); with this change it was posted at the top level (twice). Real-thread controls keep the thread root on both refs, and completions for later DM turns stay in the original conversation. Details: openclaw/openclaw#187065 (comment). Thanks @wr-web. Co-authored-by: Ayaan Zaidi <[email protected]>
… top-level (openclaw#187065) fix(slack): don't thread a delayed sessions_send completion under a top-level request When a sessions_send completion arrived later for a request that was made at the top level of a Slack channel, delivery used the request's own timestamp as thread_ts, so the reply opened a new thread instead of posting at the top level. A top-level request's completion is now posted without thread_ts. Requests made inside a thread keep their thread root, and the existing admitted-current routing precedence is unchanged. Evidence: built Gateway with the bundled Slack plugin and real Slack SDKs against local Slack-compatible services. On main the delayed completion was posted with the top-level request timestamp as thread_ts (twice); with this change it was posted at the top level (twice). Real-thread controls keep the thread root on both refs, and completions for later DM turns stay in the original conversation. Details: openclaw#187065 (comment). Thanks @wr-web. Co-authored-by: Ayaan Zaidi <[email protected]>
… request (#187965) fix(slack): post visible spawn completions at the top level for top-level requests A visible spawn started from a top-level Slack message posted its completion as a thread reply under that message, instead of at the top level where the request was. The completion now uses the same rule delayed sessions_send completions use since #187065 (moved into a shared helper): a top-level request's completion is posted at the top level, and requests made inside a thread keep their thread. Evidence: built Gateway with the bundled Slack plugin against a signed HTTP fixture. On main the top-level visible-spawn completion was threaded (twice); with this change it was posted at the top level (twice). Genuine-thread requests stay threaded, and delayed sessions_send completions stay top level with the original recipient after later inbound activity. Details: #187965 (comment). Thanks @masatohoshino. Co-authored-by: Ayaan Zaidi <[email protected]>
… request (openclaw#187965) fix(slack): post visible spawn completions at the top level for top-level requests A visible spawn started from a top-level Slack message posted its completion as a thread reply under that message, instead of at the top level where the request was. The completion now uses the same rule delayed sessions_send completions use since openclaw#187065 (moved into a shared helper): a top-level request's completion is posted at the top level, and requests made inside a thread keep their thread. Evidence: built Gateway with the bundled Slack plugin against a signed HTTP fixture. On main the top-level visible-spawn completion was threaded (twice); with this change it was posted at the top level (twice). Genuine-thread requests stay threaded, and delayed sessions_send completions stay top level with the original recipient after later inbound activity. Details: openclaw#187965 (comment). Thanks @masatohoshino. Co-authored-by: Ayaan Zaidi <[email protected]>
… request (openclaw#187965) fix(slack): post visible spawn completions at the top level for top-level requests A visible spawn started from a top-level Slack message posted its completion as a thread reply under that message, instead of at the top level where the request was. The completion now uses the same rule delayed sessions_send completions use since openclaw#187065 (moved into a shared helper): a top-level request's completion is posted at the top level, and requests made inside a thread keep their thread. Evidence: built Gateway with the bundled Slack plugin against a signed HTTP fixture. On main the top-level visible-spawn completion was threaded (twice); with this change it was posted at the top level (twice). Genuine-thread requests stay threaded, and delayed sessions_send completions stay top level with the original recipient after later inbound activity. Details: openclaw#187965 (comment). Thanks @masatohoshino. Co-authored-by: Ayaan Zaidi <[email protected]> (cherry picked from commit d2d663a) Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 5ab84cee9136fcfef263f30a2b9262ea35558a4a)

What Problem This Solves
With Slack
replyToMode: "off", a delayedsessions_sendcompletion promotes the triggering top-level message timestamp intothread_ts, creating an unsolicited thread.Keep
sessions_send's existing admitted-current destination and thread precedence. Do not adopt the spawn route resolver: its fallback-first pairing can choose staleagentTo/agentThreadIdinstead of the admitted current route. Remove only Slack's off-mode synthetic reply anchor when it equals the current inbound message ID. Genuine threads and non-Slack routing retain the existing path. No SDK/config fields or authority rules change.Evidence
Inspectable signed ingress, delayed completion
chat.postMessagerequests, SDK versions and threaded/admission controls.Built main
bf6bdd6c5fedb5e23f7bc206d26c625adbdec1aband candidate19a51e9d4de3d5b317edd67ca0b55d01c86481c2runtime artifacts in secretless Node 24.22.1. The shipped Gateway loads its bundled Slack plugin and actual Slack Bolt 5.1.0 / Web API 8.2.0 SDKs against local Slack-compatible HTTP services. Signed Events API requests enter the real HTTP adapter. A deterministic local Chat Completions fixture exercises shipped Tool Search discovery/description and dispatches the realsessions_send; a real worker agent run is held until the requester acknowledges and another DM turn has replied on the same main session. The completion callsmessagewithout a destination or thread override.thread_tsequal to the original top-level message timestamp.thread_ts; the result stays in the original conversation, not the later DM.This is native SDK API-placement proof against local services, not a real Slack workspace, UI screenshot or real-model claim. The captures distinguish the raw user-ID DM target from the API-resolved DM channel instead of treating those representations as different recipients.
Simplification: production +8/-1 lines (9 gross), no new helper or runtime import. The contributor's two factory-spy cases are removed in favor of the existing composed admission regression; the contributor commit is preserved. The Slack threading page documents the corrected completion placement.
Merge risk
Two-way door: no migration or persisted-state change; reverting restores the prior route capture. Blast radius is delayed
sessions_sendrequester completion placement for off-mode top-level Slack messages. The admitted destination and genuine-thread precedence remain protected by the existing regression and transport controls.