-
-
Notifications
You must be signed in to change notification settings - Fork 79.1k
[Bug]: hooks.mappings[].agentId and sessionKey silently ignored for action="wake" #64556
Copy link
Copy link
Open
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.ClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.Session, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Summary
For webhook mappings configured with
action: "wake", theagentIdandsessionKeyfields inhooks.mappings[*]are accepted by the config schema but silently ignored at dispatch time. Every wake-mode hook ends up enqueued into the defaultmainagent's heartbeat session, regardless of the configured target.This is silent — the gateway accepts the request, returns
200 {"ok":true,"mode":"now"}, and the user has no indication that the routing was disregarded.Reproduction
openclaw.jsontargeting a non-default agent:agent:integrations:hook:examplequeue,integrationsagent woken.System (untrusted): […]line in theagent:main:mainheartbeat session of themainagent. Theintegrationsagent never wakes; itshook:examplesession never receives anything.Root cause
dispatchWakeHookin the gateway hooks request handler hard-codes the target sessionKey to whateverresolveMainSessionKeyFromConfig()returns, ignoringvalue.sessionKey(and by extensionagentId):For comparison,
dispatchAgentHook(used whenaction: "agent") does respectvalue.sessionKeyand the configuredagentIdbecause it builds an isolated cron job with explicit delivery — see~line 26050in the same file.Why this matters
hooks.mappings[*]acceptsagentIdandsessionKey(per the type definitions inplugin-sdk/src/config/types.gateway.d.ts), so users reasonably expect them to take effect for anyaction.mainagent. Users debugging "why doesn't my dedicated agent see the events" find a 200 OK at the gateway, no log entries, and events that appear in a completely different agent's session — making this very hard to diagnose.wake.Suggested fix
Either:
(a) Honor the configured
sessionKey(andagentId, via session-key resolution) indispatchWakeHook, falling back to the main session key only when none is provided:(b) If routing wake hooks to non-default agents is not intended, remove
agentId/sessionKeyfrom the schema foraction: "wake"mappings and surface a config-time warning when they're set, so users aren't misled.Either path is better than the current state where the config and runtime disagree silently.
Environment
2026.4.9dist/server.impl-*.jsand is platform-independent.