Skip to content

fix: slack keep resumed sends in thread#77620

Merged
bek91 merged 1 commit intomainfrom
feat/subagent-routing
May 5, 2026
Merged

fix: slack keep resumed sends in thread#77620
bek91 merged 1 commit intomainfrom
feat/subagent-routing

Conversation

@bek91
Copy link
Copy Markdown
Contributor

@bek91 bek91 commented May 5, 2026

Summary

  • carry agent thread context into the message tool so resumed Slack parent sends inherit the ambient thread when no explicit threadId is provided
  • default message-tool reply mode to same-conversation threading only when ambient thread context exists and no explicit reply mode was set
  • suppress successful ANNOUNCE_SKIP child completion rows while preserving failed or timed-out silent child outcomes

Root cause

Subagent completion resume paths preserved Slack thread metadata on the session, but the message tool was not receiving agentThreadId as a fallback current thread. Even when a thread id was present, missing replyToMode meant Slack auto-threading could stay inert. Separately, aggregated child completion findings converted successful ANNOUNCE_SKIP descendants into visible no-output completion content.

Behavior

This does not globally auto-thread all Slack sends. It restores ambient same-conversation thread context for message-tool sends when the agent session already has a thread context, matching the context sessions_spawn and resumed parent runs already carry. Explicit threadId and explicit reply-mode opt-outs still win.

Validation

  • pnpm check
  • pnpm check:test-types
  • pnpm exec vitest run src/agents/subagent-announce-output.test.ts src/agents/tools/message-tool.test.ts --testTimeout=120000
  • codex review --base origin/main

AI-assisted: yes

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S maintainer Maintainer-authored PR labels May 5, 2026
@clawsweeper
Copy link
Copy Markdown
Contributor

clawsweeper Bot commented May 5, 2026

Codex review: needs changes before merge.

Summary
The PR forwards ambient agent thread IDs into the message tool, defaults same-conversation threading when that context exists, and filters successful silent child completions with regression tests.

Reproducibility: yes. Source inspection gives a high-confidence path: current main preserves agent thread metadata outside the message tool, but Slack auto-threading only sees toolContext.currentThreadTs plus an enabled reply mode.

Next step before merge
A narrow automated follow-up can add the required changelog entry without changing runtime behavior; maintainers still own the final merge decision because the PR has the protected maintainer label.

Security
Cleared: The diff only changes agent message-routing logic and tests; no dependency, workflow, secret-handling, permission, or code-execution surface was added.

Review findings

  • [P3] Add the required changelog entry — src/agents/tools/message-tool.ts:708-710
Review details

Best possible solution:

Land the existing narrow routing and silent-completion filtering after adding a single-line changelog entry and completing maintainer review.

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

Yes. Source inspection gives a high-confidence path: current main preserves agent thread metadata outside the message tool, but Slack auto-threading only sees toolContext.currentThreadTs plus an enabled reply mode.

Is this the best way to solve the issue?

Mostly yes. Forwarding the existing thread context through the message-tool seam and preserving explicit reply-mode opt-outs is the narrow maintainable fix; the missing changelog entry is the merge-readiness gap.

Full review comments:

  • [P3] Add the required changelog entry — src/agents/tools/message-tool.ts:708-710
    This changes user-visible Slack resumed-send threading and subagent completion output, but the PR does not update CHANGELOG.md. OpenClaw policy requires a single-line changelog entry for user-facing fixes before merge.
    Confidence: 0.88

Overall correctness: patch is correct
Overall confidence: 0.84

Acceptance criteria:

  • git diff --check
  • pnpm test src/agents/subagent-announce-output.test.ts src/agents/tools/message-tool.test.ts --testTimeout=120000

What I checked:

  • Current main drops ambient agent thread context: createOpenClawTools forwards current Slack channel/thread fields to createMessageTool, but current main does not pass agentThreadId, so resumed session thread metadata cannot reach the message tool fallback path. (src/agents/openclaw-tools.ts:474, 978bc53e80cc)
  • Current main message tool only uses explicit currentThreadTs: The tool context is built from options.currentThreadTs and options.replyToMode; there is no fallback from the agent session thread id on current main. (src/agents/tools/message-tool.ts:834, 978bc53e80cc)
  • Slack auto-threading requires thread context and enabled reply mode: Slack's auto-thread resolver returns a thread only when current channel/thread context exists and reply mode permits all or single-use threading. (extensions/slack/src/action-threading.ts:15, 978bc53e80cc)
  • Current main renders every child completion row: buildChildCompletionFindings currently pushes every frozen child result into visible findings, so successful ANNOUNCE_SKIP or silent replies can become no-output child completion content. (src/agents/subagent-announce-output.ts:448, 978bc53e80cc)
  • PR diff adds the intended wiring and coverage: Provided PR context for head 9d5991f6826b5beacabf828e248b998ff5d6f18f shows agentThreadId forwarded into createMessageTool, computed fallback currentThreadTs/replyToMode, and new message-tool/subagent tests. (src/agents/tools/message-tool.ts:708, 9d5991f6826b)
  • Required changelog entry is still absent: The active Unreleased changelog has related Slack/subagent entries, but no entry for this resumed-send threading and silent child completion fix. (CHANGELOG.md:5, 978bc53e80cc)

Likely related people:

  • Josh Lehman: Local blame points the current message-tool, subagent completion, and Slack auto-threading code inspected here to commit 6dae3c273de6, which is the current wrapper behavior this PR adjusts. (role: introduced current behavior; confidence: medium; commits: 6dae3c273de6; files: src/agents/tools/message-tool.ts, src/agents/subagent-announce-output.ts, extensions/slack/src/action-threading.ts)
  • steipete: Provided ClawSweeper context identifies recent merged work around Slack thread-anchor behavior and subagent completion delivery, which are the two behavioral surfaces touched by this PR. (role: recent maintainer and adjacent owner; confidence: medium; commits: e40d7abda9ff, 42b7b2b9242a, bbef1c555791; files: extensions/slack/src/threading-tool-context.ts, extensions/slack/src/action-threading.ts, src/agents/subagent-announce-output.ts)

Remaining risk / open question:

  • The PR author's validation commands were not rerun under this read-only review.
  • A live Slack resumed-send scenario was not exercised; the reproduction and fix assessment are source-based.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 978bc53e80cc.

@bek91 bek91 force-pushed the feat/subagent-routing branch from b21537e to 9d5991f Compare May 5, 2026 01:32
@bek91 bek91 marked this pull request as ready for review May 5, 2026 02:30
@bek91 bek91 force-pushed the feat/subagent-routing branch from 9d5991f to f23486b Compare May 5, 2026 02:35
@bek91 bek91 merged commit 58c4f9e into main May 5, 2026
109 checks passed
@bek91 bek91 deleted the feat/subagent-routing branch May 5, 2026 02:39
@bek91 bek91 self-assigned this May 5, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
carry agent thread context into the message tool so resumed Slack parent sends inherit the ambient thread when no explicit threadId is provided
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant