Skip to content

fix(auto-reply): tell a channel sender why their queued input was refused - #205751

Merged
obviyus merged 2 commits into
mainfrom
fix/oa2-queued-refusal-channel
Nov 26, 2026
Merged

obviyus merged 2 commits into
mainfrom
fix/oa2-queued-refusal-channel

Conversation

@obviyus

@obviyus obviyus commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

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:

  • 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. #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 e4517b0ef2f4, 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 fix(gateway): show a queued input's start refusal in chat #205408 transcript test): 15 files, run locally.
  • E2E: see comments.

obviyus and others added 2 commits November 26, 2026 09:48
…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]>
@clawsweeper

clawsweeper Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. impact:ux-friction User-facing flow adds avoidable confusion or support burden without fully blocking progress. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 26, 2026
@obviyus

obviyus commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator Author

E2E on exact head 0b37dafe574b (isolated Gateway, real model through relay): R (running turn finishes), Q (queued input refused visibly + cause sentence in transcript), S (Stop cancels) all pass.

[{"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 0b37dafe574b: complete, patch is correct, 0 findings (round 1 on 93b996bc7f95 had 2 P2s, both real and fixed in 0b37dafe574b: the send policy is read from the live config and session entry, and a failed send is logged).

Unit proof: followup-runner.test.ts "tells a channel sender why…" (send allow) fails on base e4517b0ef2f4 and passes on head.

@obviyus
obviyus merged commit 9137b6e into main Nov 26, 2026
135 of 136 checks passed
@obviyus
obviyus deleted the fix/oa2-queued-refusal-channel branch November 26, 2026 04:58
@obviyus

obviyus commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator Author

Landed as 9137b6e. A channel-originated queued input refused by admission before it starts now gets the cause sentence in that channel (sent through routeReply, under the current send policy), not only in the session transcript. Proof: unit cell red on base, green on head; one-admission E2E Q/R/S on the exact head; local review clean. Closes #205417.

@obviyus

obviyus commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator Author

Live Discord verification (discord-e2e skill, leased QA bot pair): inconclusive, recorded as a gap.

  • Readiness, warmup replies and queued ingress passed on both base e4517b0ef2f4 and head 0b37dafe574b.
  • The trigger (remove the sender from commands.ownerAllowFrom while its second message is queued) needs a channel reload. The reload defers publication until active Discord work drains (300 s drain timeout). On base, the held turn hit the LLM idle timeout before the reload. On head, the reload aborted the held turn. Neither side produced the queued owner-removed refusal, so no red/green claim is made from Discord.
  • Owned cleanup and lease release completed.

The delivery path is covered by the unit cell at the owning boundary (followup-runner.test.ts, red on base, green on head) and by the one-admission E2E Q/R/S on the exact head.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 27, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. impact:ux-friction User-facing flow adds avoidable confusion or support burden without fully blocking progress. P2 Normal backlog priority with limited blast radius. size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant