fix(gateway): activate source-reply delivery for direct webchat turns (#96840)#97456
fix(gateway): activate source-reply delivery for direct webchat turns (#96840)#97456ly-wang19 wants to merge 1 commit into
Conversation
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close: the same WebChat targetless-send bug is already covered by a stronger open landing candidate, and this branch does not cover the direct WebChat automatic-mode path well enough to remain the preferred PR. Canonical path: Use #97167 as the landing candidate, then close the duplicate PRs and the linked bug after the selected fix merges. So I’m closing this here and keeping the remaining discussion on #97167. Review detailsBest possible solution: Use #97167 as the landing candidate, then close the duplicate PRs and the linked bug after the selected fix merges. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows direct internal WebChat runs can carry Is this the best way to solve the issue? No. This PR adjusts Gateway fallback mode selection, but the better fix is the existing sibling's message-tool-boundary defaulting with Control UI WebSocket proof. Security review: Security review cleared: The diff only changes Gateway tool-resolution logic and a focused test; it does not touch dependencies, workflows, credentials, permissions, lockfiles, or artifact execution paths. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against d17b970bb50d. |
|
ClawSweeper applied the proposed close for this PR.
|
What Problem This Solves
Fixes #96840.
A targetless
message(action="send")from a direct WebChat turn (Control UI chat tab / SwiftUI app) fails withAction send requires a target.even thoughdocs/web/webchat.mdstates:The root cause:
resolveGatewayScopedToolsonly activatessourceReplyDeliveryMode = "message_tool_only"for non-webchat room-event turns. Direct WebChat turns getsourceReplyDeliveryMode = undefined, soshouldUseInternalSourceReplySinkshort-circuits at its first guard clause andnormalizeMessageActionInputthrows the missing-target error.Why This Change Was Made
Extend the source-reply activation to also cover direct WebChat turns (any non-room-event WebChat inbound). The original webchat exclusion in the room-event branch stays in place so the existing "automatic source delivery" contract for WebChat room-event turns (regression test at
src/gateway/tool-resolution.test.ts) is preserved.The actual send-vs-skip decision still belongs to
shouldUseInternalSourceReplySink, which already knows how to gate onhasCurrentSourceReplyContextand external session routes — this PR only ensures the request reaches that gate for direct WebChat turns.User Impact
Targetless
message.sendcalls during an active WebChat run now project into the same chat (matching the documented contract) instead of failing with a missing-target error. Non-webchat room-event behavior is unchanged. WebChat room-event turns continue to use automatic delivery.Evidence
force-allows the message tool for direct webchat turns so targetless send projects to the same chat (#96840)— asserts the message tool is force-allowed with the source-reply description for aninboundEventKind: "user_request"WebChat session.keeps webchat room-event turns on automatic source deliveryregression test still passes — the room-event webchat exclusion is preserved.force-allows the message tool for room-event loopback turnstest still passes — non-webchat room-event behavior is unchanged.pnpm test src/gateway/tool-resolution.test.ts— 24/24 pass across 4 files.pnpm tsgo:core— clean.