Repository navigation
fix(auto-reply): tell a channel sender why their queued input was refused - #205751
Conversation
…used A channel-originated queued input (including /followup) refused by admission before its turn started recorded the cause sentence only in the session transcript. The followup runner now routes that sentence once to the origin channel through routeReply, honoring the session send policy and skipping passive room events. Fixes #205417 Co-authored-by: obviyus <[email protected]>
Read the live config and session entry for the refusal notice, and log a failed send. Co-authored-by: obviyus <[email protected]>
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
E2E on exact head [{"id":"R.running-turn-finishes","pass":true,"detail":{"state":"final","toolEnds":3,"toolEndsAfterRevoke":3}},{"id":"Q.queued-input-refused-visibly","pass":true,"detail":{"accepted":true,"providerRequestsWithQueuedMarker":0,"visibleRefusalInTranscript":true}},{"id":"Q.refusal-sentence-in-transcript","pass":true,"detail":{"sentenceInTranscript":true}},{"id":"S.stop-cancels","pass":true,"detail":{"abort":{"ok":true,"aborted":true,"runIds":["57304d34-12f2-4af2-b252-f6ce7520f691"]},"state":"aborted","requestsWithStopMarker":1}}]Local review round 2 on Unit proof: |
|
Landed as 9137b6e. A channel-originated queued input refused by admission before it starts now gets the cause sentence in that channel (sent through |
|
Live Discord verification (discord-e2e skill, leased QA bot pair): inconclusive, recorded as a gap.
The delivery path is covered by the unit cell at the owning boundary ( |
…used (openclaw#205751) ## Problem A queued input from a channel (Discord, Telegram, ...), including `/followup`, that admission refused before its turn started gave the sender nothing in that channel. Since openclaw#205408 the cause sentence (for example "I did not run your saved work. …") is written to the session transcript, so Control UI shows it, but the channel stayed silent. Channel inbound follow-ups register no source delivery (`queuedFollowupReplyDisposition`), and a refused input has no admitted turn, so neither existing send path ran. ## Fix `src/auto-reply/reply/followup-runner.ts`, withheld branch: - The refusal (`OperatorRefusalError` before admission) is found once in `catch` and kept. This replaces the `withheldNotice` helper, which searched the error graph a second time. - When the input has no source delivery owner and its origin is a routable channel, the runner sends the refusal sentence once to the origin through `routeReply`. This is the same outbound owner that queued follow-up replies use, with the same origin fields from the queued row: channel, to, account, thread. It uses `mirror: false` because the transcript notice is already recorded. - It honors the session send policy (`resolveSendPolicy`, including a `/send off` session override) and does not send for passive room events. Both checks match how normal follow-up replies are gated. - A Gateway chat source (`queuedFollowupReplyDisposition: deliver`) keeps its existing path, so a Control UI message gets no second copy. No new column, no schema or protocol change, and no new delivery manager. openclaw#205417 also asked whether the pending-input row should store the cause. It does not need to: the sentence reaches the channel from memory at the moment of refusal. Production `src`: +76/−28 (**net positive**). The cause was missing code: no send path existed for an unadmitted input. The only removable code was the `withheldNotice` duplication, which is gone. The rest is the routing call, the send-policy (read from the live config and session entry, like admission) and room-event gates that normal replies already apply, and a log line when the send fails. ## User impact Say a Discord or Telegram sender queues a message, and before it starts the sender loses access (for example, they are removed from `commands.ownerAllowFrom`, or their role is lowered). The same channel now shows the sentence that explains why it did not run. Before, the sender saw nothing. ## Evidence - `src/auto-reply/reply/followup-runner.test.ts` "tells a channel sender why their queued input was refused before it started": an admission refusal on a Telegram-originated queued input. With send policy `allow`, it is routed once to the origin with the cause sentence (fails on base `cb5ec7a5bab0`, passes on head). With `deny`, nothing is sent. The transcript notice is the same sentence in both cases. - Importers of `followup-runner.ts`, plus `chat-send-direct-followup.test.ts` (the openclaw#205408 transcript test): 15 files, run locally. - E2E: see comments. Co-authored-by: Ayaan Zaidi <[email protected]>
Problem
A queued input from a channel (Discord, Telegram, ...), including
/followup, that admission refused before its turn started gave the sender nothing in that channel. Since #205408 the cause sentence (for example "I did not run your saved work. …") is written to the session transcript, so Control UI shows it, but the channel stayed silent. Channel inbound follow-ups register no source delivery (queuedFollowupReplyDisposition), and a refused input has no admitted turn, so neither existing send path ran.Fix
src/auto-reply/reply/followup-runner.ts, withheld branch:OperatorRefusalErrorbefore admission) is found once incatchand kept. This replaces thewithheldNoticehelper, which searched the error graph a second time.routeReply. This is the same outbound owner that queued follow-up replies use, with the same origin fields from the queued row: channel, to, account, thread. It usesmirror: falsebecause the transcript notice is already recorded.resolveSendPolicy, including a/send offsession override) and does not send for passive room events. Both checks match how normal follow-up replies are gated.queuedFollowupReplyDisposition: deliver) keeps its existing path, so a Control UI message gets no second copy.No new column, no schema or protocol change, and no new delivery manager. #205417 also asked whether the pending-input row should store the cause. It does not need to: the sentence reaches the channel from memory at the moment of refusal.
Production
src: +76/−28 (net positive). The cause was missing code: no send path existed for an unadmitted input. The only removable code was thewithheldNoticeduplication, which is gone. The rest is the routing call, the send-policy (read from the live config and session entry, like admission) and room-event gates that normal replies already apply, and a log line when the send fails.User impact
Say a Discord or Telegram sender queues a message, and before it starts the sender loses access (for example, they are removed from
commands.ownerAllowFrom, or their role is lowered). The same channel now shows the sentence that explains why it did not run. Before, the sender saw nothing.Evidence
src/auto-reply/reply/followup-runner.test.ts"tells a channel sender why their queued input was refused before it started": an admission refusal on a Telegram-originated queued input. With send policyallow, it is routed once to the origin with the cause sentence (fails on basee4517b0ef2f4, passes on head). Withdeny, nothing is sent. The transcript notice is the same sentence in both cases.followup-runner.ts, pluschat-send-direct-followup.test.ts(the fix(gateway): show a queued input's start refusal in chat #205408 transcript test): 15 files, run locally.