Skip to content

fix: route targetless WebChat message sends#97801

Closed
aditya-vithaldas wants to merge 1 commit into
openclaw:mainfrom
aditya-vithaldas:codex/fix-webchat-targetless-message-send
Closed

fix: route targetless WebChat message sends#97801
aditya-vithaldas wants to merge 1 commit into
openclaw:mainfrom
aditya-vithaldas:codex/fix-webchat-targetless-message-send

Conversation

@aditya-vithaldas

Copy link
Copy Markdown
Contributor

Closes #96840

What Problem This Solves

Fixes an issue where targetless message(action="send") calls from active WebChat runs could fail with "Action send requires a target" even though WebChat documents a current-run internal source-reply sink.

Why This Change Was Made

The internal source-reply sink now accepts targetless sends from WebChat only when the run has explicit automatic source-reply delivery, the current source provider is WebChat, no external session route is encoded, and the call has no explicit target. The existing message-tool-only sink behavior remains unchanged, omitted delivery mode still rejects, and non-WebChat automatic source contexts still require a target.

User Impact

WebChat-visible tools.message replies can be projected into the active WebChat conversation without asking the model for a reusable outbound target. Normal automatic final replies stay automatic, and external channels do not inherit WebChat as a fallback route.

Evidence

  • node scripts/run-vitest.mjs src/infra/outbound/message-action-runner.send-validation.test.ts src/infra/outbound/message-action-runner.core-send.test.ts src/auto-reply/reply/source-reply-delivery-mode.test.ts -- --reporter=dot — 3 files passed, 67 tests passed
  • pnpm exec oxfmt --check src/infra/outbound/internal-source-reply.ts src/infra/outbound/message-action-runner.send-validation.test.ts
  • git diff --check
  • .agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main --codex-bin .artifacts/codex-flex — clean, patch correct (0.84)

@clawsweeper

clawsweeper Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.

Close as superseded: this branch targets the right WebChat bug, but #97167 already owns the same fix at the message-tool construction boundary with stronger proof, while this diff can report a successful automatic send that the downstream WebChat projection path still drops.

Root-cause cluster
Relationship: superseded
Canonical: #97167
Summary: This PR, #97167, #96850, and #96840 all target the same WebChat targetless message-send root cause; the proof-positive sibling PR is the best canonical landing candidate.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Canonical path: Use #97167 as the canonical landing path for the linked WebChat bug, then close this branch as superseded.

So I’m closing this here and keeping the remaining discussion on #97167.

Review details

Best possible solution:

Use #97167 as the canonical landing path for the linked WebChat bug, then close this branch as superseded.

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

Yes, source inspection gives a high-confidence path: current main excludes WebChat from message_tool_only, the sink currently requires that mode, and targetless sends then reach normal target validation. I did not run a live WebChat session in this read-only review.

Is this the best way to solve the issue?

No. This branch changes the downstream sink guard, but the safer and more complete solution is to default internal WebChat message tools to the existing message_tool_only projection contract as done in #97167.

Security review:

Security review cleared: The diff only changes in-process outbound routing logic and a focused test; no dependency, workflow, credential, auth, package, or install surface changed.

AGENTS.md: found and applied where relevant.

What I checked:

  • Repository policy read: Root and scoped outbound/agent AGENTS.md review guidance was read and applied, including the requirement to inspect callers, callees, sibling source-reply paths, tests, docs, and related PRs before verdict. (AGENTS.md:21, 1052652a7168)
  • Current sink contract: Current main only classifies targetless source-reply sends as the private sink when sourceReplyDeliveryMode is message_tool_only, which is the existing projection contract this branch works around. (src/infra/outbound/internal-source-reply.ts:86, 1052652a7168)
  • Patch changes the mode boundary downstream: The PR diff adds an automatic WebChat branch inside shouldUseInternalSourceReplySink, so the outbound runner can return internal-source success without changing the mode consumed by downstream projection. (src/infra/outbound/internal-source-reply.ts:91, 96ab1daee78b)
  • Projection still filters automatic mode: buildEmbeddedRunPayloads only converts messagingToolSourceReplyPayloads into visible/mirrored reply payloads when sourceReplyDeliveryMode === "message_tool_only"; automatic mode falls back to an empty source-reply payload list. (src/agents/embedded-agent-runner/run/payloads.ts:606, 1052652a7168)
  • Message-tool payload extraction exists before projection: Completed internal-source message tool results are extracted into messagingToolSourceReplyPayloads, but that extracted payload is later ignored by the current projection guard when the mode remains automatic. (src/agents/embedded-agent-subscribe.handlers.tools.ts:1299, 1052652a7168)
  • WebChat product contract: The WebChat docs say a targetless message.send from an active WebChat run is projected into the same chat and mirrored to the transcript without making WebChat a reusable outbound channel. Public docs: docs/web/webchat.md. (docs/web/webchat.md:55, 1052652a7168)

Likely related people:

  • pashpashpash: Commit 78eb92e introduced the WebChat/TUI message-tool source-reply behavior across WebChat docs, message-tool code, outbound runner code, and embedded payload handling. (role: introduced behavior; confidence: medium; commits: 78eb92e62277; files: docs/web/webchat.md, src/agents/tools/message-tool.ts, src/infra/outbound/message-action-runner.ts)
  • joshavant: Commit 4620929 recently worked on source message-tool reply terminal and payload behavior in the embedded runner and subscribe handlers that determine whether source replies continue or suppress final text. (role: recent area contributor; confidence: medium; commits: 462092936a5c; files: src/agents/embedded-agent-runner/run/payloads.ts, src/agents/embedded-agent-runner/run/message-tool-terminal.ts, src/agents/embedded-agent-subscribe.handlers.tools.ts)
  • vincentkoc: Commit 0ea0807 recently maintained CLI/message delivery evidence and internal source-reply extraction paths, including internal-source-reply.ts and message-tool source-reply helpers. (role: recent area contributor; confidence: medium; commits: 0ea08076c3b5; files: src/infra/outbound/internal-source-reply.ts, src/agents/embedded-agent-message-tool-source-reply.ts, src/agents/embedded-agent-subscribe.tools.ts)

Codex review notes: model internal, reasoning high; reviewed against 1052652a7168.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 96ab1daee7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/infra/outbound/internal-source-reply.ts
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Jun 29, 2026
@clawsweeper

clawsweeper Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper applied the proposed close for this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Targetless message.send fails with 'Action send requires a target' in WebChat despite docs stating source-reply sink should handle it

1 participant