openclaw - ✅(Solved) Fix Add threadId support to /hooks/agent endpoint [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#69856Fetched 2026-04-22 07:47:22
View on GitHub
Comments
1
Participants
2
Timeline
3
Reactions
0
Timeline (top)
commented ×1cross-referenced ×1referenced ×1

The /hooks/agent HTTP endpoint does not support a threadId parameter in the request payload. This means hook-dispatched tasks always reply at the channel top level, with no way to target a specific Slack thread.

Root Cause

The /hooks/agent HTTP endpoint does not support a threadId parameter in the request payload. This means hook-dispatched tasks always reply at the channel top level, with no way to target a specific Slack thread.

Fix Action

Fix / Workaround

The /hooks/agent HTTP endpoint does not support a threadId parameter in the request payload. This means hook-dispatched tasks always reply at the channel top level, with no way to target a specific Slack thread.

Multi-agent coordination: a coordinator agent dispatches tasks to sibling agents via /hooks/agent. When the conversation is happening in a Slack thread, dispatched agents should reply in that same thread — not at the top level.

PR fix notes

PR #69859: feat: add threadId support to /hooks/agent endpoint

Description (problem / solution / changelog)

Summary

Add threadId support to the /hooks/agent HTTP endpoint to enable threaded replies (e.g., Slack threads) for multi-agent coordination.

Changes

  • Add threadId field to HookAgentPayload type
  • Extract threadId from normalizeAgentPayload function
  • Add threadId to CronAgentTurnPayloadFields
  • Pass threadId in dispatchAgentHook to cron job payload
  • Add threadId to CronDeliveryPlan type
  • Include threadId in resolveCronDeliveryPlan result
  • Update resolveDeliveryTarget to accept threadId parameter
  • Pass threadId from deliveryPlan to resolveDeliveryTarget

Use Case

Multi-agent coordination: a coordinator agent dispatches tasks to sibling agents via /hooks/agent. When the conversation is happening in a Slack thread, dispatched agents should reply in that same thread — not at the top level.

Example

{
  "message": "Hello there!",
  "name": "MyAgent",
  "threadId": "1234567890.123456"
}

Testing

The implementation follows the existing pattern for other delivery fields and integrates with the existing thread ID handling in the delivery system.

Resolves #69856

Changed files

  • src/cron/delivery.ts (modified, +4/-0)
  • src/cron/isolated-agent/delivery-target.ts (modified, +2/-0)
  • src/cron/isolated-agent/model-selection.ts (modified, +7/-3)
  • src/cron/isolated-agent/run.ts (modified, +1/-0)
  • src/cron/types.ts (modified, +2/-0)
  • src/gateway/hooks.ts (modified, +6/-0)
  • src/gateway/server/hooks.ts (modified, +1/-0)
  • src/media/web-media.ts.backup (added, +425/-0)

Code Example

threadId: normalizeOptionalString(request.threadId)
RAW_BUFFERClick to expand / collapse

Summary

The /hooks/agent HTTP endpoint does not support a threadId parameter in the request payload. This means hook-dispatched tasks always reply at the channel top level, with no way to target a specific Slack thread.

Use Case

Multi-agent coordination: a coordinator agent dispatches tasks to sibling agents via /hooks/agent. When the conversation is happening in a Slack thread, dispatched agents should reply in that same thread — not at the top level.

Current Behavior

The hook payload parser (normalizeAgentPayload) only extracts: message, name, agentId, channel, to, deliver, wakeMode, model, thinking, timeoutSeconds, sessionKey, idempotencyKey.

Passing "threadId": "<slack_thread_ts>" in the POST body is silently ignored.

Expected Behavior

/hooks/agent should accept an optional threadId field in the JSON body. When present, the agent's response should be delivered as a threaded reply under the specified Slack message timestamp.

The internal delivery system already supports threadId (it's used in resolveAgentDeliveryPlan and explicitThreadId handling in the server implementation) — the hook endpoint just doesn't parse it from the inbound payload.

Suggested Fix

In the hook payload normalization (around normalizeAgentPayload), add:

threadId: normalizeOptionalString(request.threadId)

And pass it through to resolveAgentDeliveryPlan where explicitThreadId is already handled.

Environment

  • OpenClaw version: 2026.4.15
  • Channel: Slack (socket mode)

extent analysis

TL;DR

The /hooks/agent endpoint can be fixed by adding support for the threadId parameter in the request payload normalization.

Guidance

  • Modify the normalizeAgentPayload function to extract the threadId from the request payload by adding threadId: normalizeOptionalString(request.threadId).
  • Pass the extracted threadId to resolveAgentDeliveryPlan to enable threaded replies.
  • Verify that the threadId is correctly passed through to resolveAgentDeliveryPlan and that the agent's response is delivered as a threaded reply under the specified Slack message timestamp.
  • Test the updated endpoint with a sample request containing the threadId parameter to ensure it works as expected.

Example

// Modified normalizeAgentPayload function
function normalizeAgentPayload(request) {
  return {
    // ... existing properties ...
    threadId: normalizeOptionalString(request.threadId)
  };
}

Notes

This fix assumes that the internal delivery system already supports threadId and that the resolveAgentDeliveryPlan function is correctly handling explicitThreadId. If this is not the case, additional modifications may be necessary.

Recommendation

Apply the suggested fix by modifying the normalizeAgentPayload function to support the threadId parameter, as this will enable the desired threaded reply behavior.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix Add threadId support to /hooks/agent endpoint [1 pull requests, 1 comments, 2 participants]