fix(sessions_send): derive delivery channel from resolved session entry#94409
fix(sessions_send): derive delivery channel from resolved session entry#94409Pandah97 wants to merge 3 commits into
Conversation
sessions_send hardcodes INTERNAL_MESSAGE_CHANNEL ("webchat") as the
delivery channel for inter-session messages. Load the target session
entry and derive the channel from it instead, so cross-session agent
messages preserve the original session's delivery channel context.
Closes openclaw#93255
|
Codex review: needs real behavior proof before merge. Reviewed July 3, 2026, 2:52 AM ET / 06:52 UTC. Summary PR surface: Source +7, Tests +70. Total +77 across 2 files. Reproducibility: yes. at source level: current main and Review metrics: 2 noteworthy metrics.
Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Mantis proof suggestion Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the narrow tool-layer fix after redacted production, Gateway/qa-channel, or Telegram proof shows an explicit external target session receives the Do we have a high-confidence way to reproduce the issue? Yes at source level: current main and Is this the best way to solve the issue? Yes for the narrow bug: reusing AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 88f13cab6299. Label changesLabel justifications:
Evidence reviewedPR surface: Source +7, Tests +70. Total +77 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Closing to trigger fresh CI re-run for checks-node-core-tooling-docker |
…tion Derive the nested gateway channel from normalized session delivery context instead of reading only the top-level channel field. This ensures sessions with the routable channel in route, deliveryContext, or lastChannel resolve correctly, matching the same pattern already proven in the announce path. Ref. openclaw#94409
|
@clawsweeper re-review Changes made:
|
|
🦞🧹 I asked ClawSweeper to review this item again. |
…ion channel resolution Covers five scenarios: top-level channel, deliveryContext.channel with stale webchat, lastChannel with empty channel, route metadata channel, and no-routable-channel fallback to webchat. Ref. openclaw#94409
|
@clawsweeper re-review Changes made (round 2):
|
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review |
Summary
sessions_sendtool hardcodesINTERNAL_MESSAGE_CHANNEL("webchat") as the delivery channel for inter-session agent messages. When the target session was created on a different channel (e.g., Slack, Discord, Telegram), the message is tagged with the wrong channel, causing downstream routing and display issues.Fix: Load the target session entry and derive the delivery channel from its
channelfield. Fall back toINTERNAL_MESSAGE_CHANNELwhen no channel is set.Changes
src/agents/tools/sessions-send-tool.ts:593-596Real behavior proof (required for external PRs)
Behavior addressed: sessions_send tool now derives the delivery channel from the target session entry's channel field instead of hardcoding "webchat", so inter-session messages carry correct channel metadata for the destination session.
Real setup tested: Linux x64 (kernel 4.19.112), Node.js v24.13.1, OpenClaw commit ad884dc.
Exact steps or command run after this patch:
After-fix evidence:
Observed result after the fix: Sessions with explicit channel (slack, discord, telegram) now resolve to the correct channel instead of always returning "webchat". Sessions without a channel field, empty/whitespace channel, or null/undefined entry correctly fall back to
INTERNAL_MESSAGE_CHANNEL("webchat"). All 35 existing tests pass.What was not tested: Full end-to-end A2A message delivery through real Slack/Discord/Telegram gateways — only the channel derivation logic was verified against the production source.
Test results
All existing sessions tool tests pass. The change is backward-compatible: when no channel is found on the target session entry,
INTERNAL_MESSAGE_CHANNELis used as before.Risk checklist
Did user-visible behavior change? (
Yes)Did config, environment, or migration behavior change? (
No)Did security, auth, secrets, network, or tool execution behavior change? (
No)What is the highest-risk area?
channelfield: the fallback toINTERNAL_MESSAGE_CHANNELpreserves existing behaviorHow is that risk mitigated?
targetSessionEntry?.channel?.trim() || INTERNAL_MESSAGE_CHANNEL— if channel is unset, empty, or whitespace-only, the old default appliesCurrent review state
What is the next action?
What is still waiting on author, maintainer, CI, or external proof?
Closes #93255