Repository navigation
fix(slack): visible spawn completion opens a thread under a top-level request - #187965
Conversation
|
🦞👀 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 keeps visible-spawn completions top-level for top-level Slack requests while preserving genuine threads. Example: A top-level Slack request starts a visible session with replyToMode set to off.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR: current main still captures Slack’s synthetic reply anchor as a visible-spawn completion thread, and this focused repair has no actionable findings. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherSlack supplies conversation facts to agent tools; visible spawn records the requester origin, and the completion pipeline uses it to deliver the child’s result. flowchart LR
A[Slack request] --> B[Threading tool context]
B --> C[Visible session spawn]
C --> D[Requester origin]
D --> E[Child completion]
E --> F[Slack message delivery]
Technical reviewBest possible solution: Use the shared requester-origin rule to discard synthetic off-mode Slack anchors while preserving the admitted destination and genuine thread. Do we have a high-confidence way to reproduce the issue? Current-main source establishes the synthetic-anchor capture path, and the supplied Gateway wire traces demonstrate matching before/after behavior; this read-only review ran no reproduction. Is this the best way to solve the issue? The patch fixes the incorrect completion-origin producer, shares the established delayed-send rule, and preserves the separate binding selector’s intentional routing contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against c390d2b28729. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +17, Tests -5, Docs 0. Total +12 across 6 files. Added test files: 0. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes: No label 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 29, 2026, 8:50 PM ET / October 30, 2026, 00:50 UTC (Revision 2). |
Built Gateway / real Slack SDK differentialFrozen main: The defect direction is: a top-level request's visible-spawn completion is incorrectly threaded on main; the candidate keeps it top-level. A request inside a genuine thread must remain threaded. Both refs were installed/built in secretless Node24.22.1 Docker. The normal bundled Slack plugin received actual HMAC-signed HTTP message events and used real Bolt5.1.0/Web API8.2.0 clients against a local Slack-compatible HTTP service recording every request. A deterministic local provider drove the real agent runtime through advertised {"id":"sessions_spawn","args":{"task":"WORK187965-TOP-1","visible":true,"context":"isolated","model":"fixture/worker"}}Actual accepted receipt from the candidate: {"status":"accepted","childSessionKey":"agent:main:dashboard:10631f49-3df6-40bb-b88a-4dd0a5638777","runId":"7a7975dd-eb7b-404f-b962-74dded04b7dd","mode":"run","expectsCompletionMessage":true}No normalized tool context, requester origin, registry or delivery callback was mocked or seeded. The provider answers label utility requests normally and holds the actual child task response. After observing the parent's real Slack acknowledgement, the driver admits another message in a different conversation and waits for its acknowledgement, then releases the child result. The real completion event returns to the parent runtime, which emits the final reply. This ensures the measured delivery is the delayed completion, not the initial acknowledgement. Actual
|
| Scenario | Main | Candidate |
|---|---|---|
| Top-level visible spawn, run1 | thread_ts=1793320794.000100 (request's own ts) |
thread_ts omitted |
| Top-level visible spawn, run2 | thread_ts=1793320813.000100 (request's own ts) |
thread_ts omitted |
| Genuine-thread visible spawn | thread_ts=1793320825.000050 (real root) |
thread_ts=1793320879.000050 (real root) |
#187065 delayed sessions_send control |
thread_ts omitted |
thread_ts omitted |
Representative actual wire params:
main: {"channel":"C0111111111","text":"FINAL187965-TOP-1","thread_ts":"1793320794.000100","unfurl_links":"false"}
candidate: {"channel":"C0111111111","text":"FINAL187965-TOP-1","unfurl_links":"false"}
The two top-level candidate requests had source timestamps 1793320853.000100 and 1793320866.000100; neither was sent as a thread root. Both main and candidate acknowledgements for the representative top-level case were already top-level.
The genuine-thread control seeds a real root event first, then admits the request with a distinct message ts and explicit thread_ts; thread-history responses contain only that root/replies. Its completion stays on that real root on both refs.
For the #187065 control, sessions_send starts work in a real pre-created worker session with timeoutSeconds:0; another DM then changes the requester's latest inbound context before the worker finishes. Its completion remains top-level and retains the original recipient on both refs: the raw Slack POST targets U0111111111, with the local Slack-compatible API returning the original D0111111111 receipt, not the later conversation.
Lifecycle, limits and captures
Eight successful fresh-profile Gateway scenarios: main/candidate × (two top-level runs, one genuine-thread control, one delayed-send control). Every Gateway received SIGTERM, was awaited to actual exit, and exited code:0, signal:null; no product process was force-killed. Exact CLI config/state/agent SQLite paths were printed first, all task-owned. No personal Slack account, real Slack UI or real model claim.
Valid capture directories under proofs/187965/:
main-top-1-1793320794960 candidate-top-1-1793320853104
main-top-2-1793320813143 candidate-top-2-1793320866828
main-thread-1-1793320825841 candidate-thread-1-1793320879244
main-send-1-1793320839041 candidate-send-1-1793320892858
Each holds actual SDK/ingress/causal-order wire captures, full provider requests, Gateway logs, resolved paths, result and exit receipts. prove.mjs/run-proof.sh are the harness. Two excluded preparation attempts are documented in invalid-attempts.txt: a missing driver timer import, then a provider fixture that ignored the current runtime completion-event envelope. Neither is counted as a product verdict.
Focused regressions and simplification
106 tests passed across the visible-spawn, spawn-tool and sessions-send admission files. The retained consolidated Slack origin assertion fails on main because the registered requester origin leaks the synthetic threadId; the sender-restricted policy control still passes.
Folded the standalone new regression into existing policy/receipt coverage, retaining current-target precedence, stale-thread exclusion, requester ownership and inherited allow/deny assertions. Removed redundant exact creation/default-field assertions already covered by the broader spawn tests. Tests +17/-22 (net−5); production +26/-9, docs +1/-1. Contributor commits retained. The existing sessions_send rule now has one shared requester-origin owner; no new public option, schema, stored format or SDK contract.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Landed in d2d663a. Thanks @masatohoshino. Slack visible spawn completions now post where the request was made. |
… 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)
Closes #187964
What Problem This Solves
A visible
sessions_spawnstarted from a top-level Slack request captures that message's reply anchor as a thread root. With defaultreplyToMode: "off", its delayed completion then appears in a new thread instead of next to the acknowledgement in the conversation timeline.User Impact
Top-level requests keep their visible work-session completions top-level. Requests inside genuine Slack threads keep those threads. No configuration change is needed.
Fix
Share the existing #187065
sessions_sendrequester-delivery rule at the requester-origin owner and apply it when visible spawn captures its completion origin. Only an off-mode Slack synthetic anchor equal to the current message ID is discarded; current-destination precedence and genuine threads are retained. The addedreplyToModemember is an internal host construction option, not a model-facing or public configuration field.The existing delayed-send behavior is preserved.
cron,ask_userandsession_statusdelivery context is outside this change. The Slack threads documentation names both affected completion paths.Evidence
Built Gateway, real Slack SDKs and actual delayed completion POSTs:
aacb5e162cf1d5414c5a716bfefc2502ed75ce56, twice: a top-level visible spawn's finalchat.postMessagecarries the request's own ts asthread_ts.thread_tsand retains the original channel.sessions_sendcontrol stays top-level and retains the original recipient after a later inbound DM on both refs.Final head
e6fbbf95f0661f126fa8d792e78397c7c4a5603dis test-only after the proven contributor build, with identical production. Contributor commits retained. Production +26/-9, tests +17/-22 (net−5), docs +1/-1. The regression is folded into existing policy/receipt coverage while preserving admitted requester, sender and completion-owner policy assertions; redundant exact default creation fields are covered by the broader spawn tests.Merge Danger
Two-way door: no schema or configuration migration. Reverting restores old route capture for new visible spawns; admitted origins remain ordinary existing metadata. Blast radius is Slack visible-spawn completion placement and the shared requester-thread rule; genuine-thread and delayed-send controls cover the adjacent paths.