Skip to content

fix(slack): keep edited and deleted messages in their original threads - #128768

Merged
steipete merged 2 commits into
mainfrom
codex/slack-threaded-event-routing-20260824
Aug 24, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/slack-threaded-event-routing-20260824

Conversation

@steipete

Copy link
Copy Markdown
Contributor
Additional instructions

MUST: Keep Allow edits from maintainers enabled for this PR so maintainers
can help update the branch when needed.

What Problem This Solves

Fixes an issue where users editing or deleting messages inside Slack threads would have those changes queued for the parent conversation instead of the actual thread. Another thread could consume the event first, while the intended conversation never learned that its message had changed.

Why This Change Was Made

Slack includes the parent thread timestamp on the nested current or previous message. Preserve that existing provider fact through Slack's private subtype and system-event owners, reuse the existing genuine-reply classifier, and hand it to the existing thread-aware session router only after unchanged channel authorization. Ordinary direct-message threads and top-level thread roots retain their existing parent sessions; reactions, pins, public APIs, and security policy are unchanged. The repair also removes obsolete subtype-registry indirection and requires a net 13 production lines.

User Impact

Slack users can edit or delete messages in public channels, private channels, group direct messages, and Enterprise workspaces without leaking those updates into another thread or losing them from the correct conversation. Existing ordinary direct-message behavior, sender allowlists, and unthreaded messages continue to work unchanged.

Evidence

  • Checked-in regression tests drive the actual registered Slack listener through unchanged authorization, the real thread-aware resolver, and the real system-event queue: 11 failures before the fix; all 17 scenarios pass afterward.
  • Cases include changed and deleted messages across channels, private channels, authorized group DMs, and Enterprise workspaces; ordinary DMs, genuine thread roots, parent-user replies, previous-message fallback, and denied senders are preserved.
  • Full focused owner and sibling proof: 206 tests passing across message events, subtype handling, reactions, pins, membership events, interactions, session routing, and thread classification.
  • Independent verification: 84 additional focused tests passing, plus eight real event-to-queue scenarios passing across channel, private-channel, group-DM, and ordinary-DM edits/deletions.
  • Production and test type checks report zero Slack diagnostics; targeted typed lint, formatting, and full committed-branch review are clean.

@clawsweeper

clawsweeper Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added channel: slack Channel integration: slack size: S maintainer Maintainer-authored PR labels Aug 24, 2026
@steipete
steipete marked this pull request as ready for review August 24, 2026 14:52
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 24, 2026
@clawsweeper

clawsweeper Bot commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 24, 2026, 4:31 PM ET / 20:31 UTC.

ClawSweeper review

What this changes

Routes Slack message edit and delete events for genuine non-DM thread replies to the existing thread session instead of the parent session.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

Keep open. The patch is a clean producer-side repair with no blocking code finding: it preserves the nested Slack thread fact through unchanged authorization into the existing thread-aware session router. Exact-head CI is still incomplete with failed compact lanes, and this maintainer-authored, protected-label PR needs the normal maintainer merge decision.

Priority: P1
Reviewed head: 847a4b674381f06e4ff1390f9b917e954c028cfe

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is a focused owner-boundary repair with meaningful regression coverage; merge readiness awaits exact-head CI.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body nevertheless describes focused registered-listener and routing-harness coverage.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body nevertheless describes focused registered-listener and routing-harness coverage.
Evidence reviewed 7 items Current-main failure path: Current main authorizes subtype events but supplies only channel metadata to the system-event context, so the thread-aware router cannot select a thread session.
Producer-side repair: The branch extracts a genuine nested thread timestamp through the canonical Slack thread classifier and passes it only after the existing authorization call.
Existing routing owner: The existing system-event resolver already turns a supplied thread timestamp into a thread session key, including its runtime-binding and enterprise branches.
Findings None None.
Security None None.

Live Verification

Command: pnpm openclaw --help

Result: PASS (completed)

pnpm openclaw --help
runner@runnervm76f27:/tmp/clawsweeper-live-proof-128768-F5fk18/target$ pnpm openclaw --help
$ node scripts/run-node.mjs --help
pnpm openclaw --help
[openclaw] Building TypeScript (dist is stale: missing_build_stamp - build stamp missing).
[openclaw] Building bundled plugin assets.
[canvas] build: node scripts/bundle-a2ui.mjs
[log] ‹DIR›/a2ui.bundle.js  chunk │ size: 399.96 kB
[log] ‹DIR›/a2ui-v0.9.bundle.js  chunk │ size: 615.66 kB
[log]
[success] rolldown v1.2.0 Finished in 105.95 ms
[diffs] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts curated
[diffs-language-pack] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts full
[discord] build: node --import tsx ../../scripts/build-discord-activity-sdk.mts
[tsdown-build] invocation 1/2 finished in 0.7s
node_modules/playwright-core/lib/coreBundle.js (65821:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65821:29 ]
       │
 65821 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/playwright-core/lib/coreBundle.js (65828:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65828:29 ]
       │
 65828 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2343:30) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2343:31 ]
      │
 2343 │           ASM_CONSTS[start] = eval(func);
      │                               ──┬─
      │                                 ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2366:32) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2366:33 ]
      │
 2366 │           moduleExports[name] = eval(func);
      │                                 ──┬─
      │                                   ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

[tsdown-build] invocation 2/2 finished in 13.9s
[plugin-control-plane-loads] verified 35 built modules with native require and checked doctor closures
runtime-postbuild: 11 phases completed in 4294ms (slowest: built plugin control-plane loads 3507ms)

OpenClaw 2026.8.1 (847a4b6) — All your chats, one OpenClaw.

Usage: openclaw [options] [command]

Options:
  --container ‹name›   Run the CLI inside a running Podman/Docker container named ‹name› (default: env OPENCLAW_CONTAINER)
  --dev                Dev profile: isolate state under ~/.openclaw-dev, default gateway port 19001, and shift derived ports (browser/canvas)
  -h, --help           Display help for command
  --log-level ‹level›  Global log level override for file + console
… output truncated …

Assertions:

  • PASS expect_output: OpenClaw

How this fits together

Slack subtype listeners authorize an incoming event, derive its session route, and enqueue a system event for the agent conversation. Thread timestamps must reach that router so message updates stay associated with the original Slack thread.

flowchart LR
A[Slack edit or delete] --> B[Subtype listener]
B --> C[Sender and channel authorization]
C --> D[Thread context classifier]
D --> E[Thread-aware session router]
E --> F[Queued conversation event]
Loading

Before merge

  • Resolve merge risk (P1) - Exact-head CI is incomplete and includes failed compact lanes; do not merge until the PR head has a completed green required-check result.
  • Resolve merge risk (P1) - The patch changes message-to-session routing; focused coverage is strong, but the reviewer could not inspect the upstream Slack event contract or obtain a live Slack trace because network and dependency-source access were unavailable.
  • Resolve merge risk (P1) - Production code grows by net 13 lines for the canonical classifier and auth-preserving propagation; no net-neutral absorption was evident without duplicating the established thread semantics.
  • Complete next step (P2) - No mechanical repair is identified; complete exact-head CI and let maintainers make the merge decision for this protected maintainer PR.
Agent review details

Security

None.

PR surface

Source +13, Tests +146, Other 0. Total +159 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 4 28 15 +13
Tests 2 150 4 +146
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 1 1 0
Total 7 179 20 +159

Review metrics

Metric Value Why it matters
Production versus test LOC production +28/-15 (net +13); tests +150/-4; 1 baseline line changed The positive production delta is confined to threading metadata propagation and is offset by substantial owner-boundary regression coverage.

Merge-risk options

Maintainer options:

  1. Complete exact-head verification (recommended)
    Let the failed and in-progress checks reach a green result on this head while retaining the covered channel, group-DM, and enterprise routing cases.

Technical review

Best possible solution:

Keep the single subtype-to-thread-fact path and existing router; retain the net +13 lines because canonical classification has no smaller owner-boundary home, then merge only after exact-head CI is green.

Do we have a high-confidence way to reproduce the issue?

Yes—source-reproducible: current main invokes the route owner without a thread timestamp, while that owner produces a distinct thread session when it receives one. No live Slack execution was performed in this read-only review.

Is this the best way to solve the issue?

Yes. Deriving the provider thread fact at the subtype owner and handing it through unchanged authorization to the existing resolver is narrower and safer than adding a downstream routing workaround.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 2a39c50227ce.

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P1: A Slack edit or deletion can be routed to the wrong active conversation, suppressing the intended thread update.
  • merge-risk: 🚨 message-delivery: Merging changes the session destination of received Slack edit and deletion events.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body nevertheless describes focused registered-listener and routing-harness coverage.

Evidence

What I checked:

Likely related people:

  • steipete: Authored the two branch commits and is the leading contributor in local history for the listener, router, and threading files. (role: recent Slack routing contributor; confidence: high; commits: 847a4b674381, ba5b7c738174; files: extensions/slack/src/monitor/events/messages.ts, extensions/slack/src/monitor/system-event-session.ts, extensions/slack/src/threading.ts)
  • WhatsSkiLL: Current-main blame places the subtype system-event call that omits thread metadata in this history snapshot. (role: existing subtype-route contributor; confidence: medium; commits: fb576e3518df; files: extensions/slack/src/monitor/events/messages.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Obtain a completed green exact-head CI result before merge.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-08-24T14:58:06.735Z sha ba5b7c7 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-24T15:41:04.473Z sha ba5b7c7 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 24, 2026
@steipete
steipete merged commit 97e7327 into main Aug 24, 2026
267 of 271 checks passed
@steipete
steipete deleted the codex/slack-threaded-event-routing-20260824 branch August 24, 2026 21:00
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 25, 2026
openclaw#128768)

* fix(slack): route threaded edits and deletes to their sessions

* fix(slack): tighten threaded-event assertion baseline
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: slack Channel integration: slack maintainer Maintainer-authored PR merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant