Repository navigation
fix(gateway): show a queued input's start refusal in chat - #205408
Conversation
A queued input (including /followup) refused by admission before its turn starts now takes the existing withheld outcome, with the cause-table sentence as its notice, so the person sees why in the chat instead of only in the Gateway log. Role agent, channel access, workflow permission and session tool-policy refusals now read from the cause table. 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
verdict.json: {"pass":true,"checks":[{"id":"R.running-turn-finishes","pass":true},{"id":"Q.queued-input-refused-visibly","pass":true},{"id":"Q.refusal-sentence-in-transcript","pass":true},{"id":"S.stop-cancels","pass":true}],"elapsedMs":56181} |
|
Maintainer override: every red on head
|
|
Landed in 1bf2147.
|
|
Codex review: needs maintainer review before merge. What this changesThis PR shows queued-start refusal reasons in chat and consolidates related refusal wording in the existing cause table. Example: Bob queues
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this PR addresses a current-main refusal-visibility bug through existing outcome owners, and no introduced correctness or security defect was found. Reviewed head: Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe follow-up runner admits queued requests, executes allowed turns, and sends terminal outcomes to transcript and source-delivery owners. flowchart TD
A[Queued input] --> B[Start admission]
B --> C[Allowed turn]
B --> D[Operator refusal]
D --> E[Existing withheld outcome]
E --> F[Session transcript notice]
E --> G[Gateway source completion]
Technical reviewBest possible solution: Land the existing withheld-outcome repair through the recorded inherited-CI exception, with channel delivery handled by its separate follow-up. Do we have a high-confidence way to reproduce the issue? Current-main source shows that a pre-admission OperatorRefusalError misses withheld notice recording; the PR extends the real chat-dispatch regression and reports it failing on base and passing on head. Is this the best way to solve the issue? The patch restores visible refusal settlement through existing owners, keeps authorization checks intact, and avoids unnecessary schema or delivery machinery. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against a143512578cf. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +25, Tests +21. Total +46 across 19 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 25, 2026, 10:59 AM ET / 15:59 UTC. |
…05408) ## Problem A queued input (including `/followup`) that admission refused at start was visible only in the Gateway log. In chat the person saw only the generic pending-input line "This message was blocked by a policy and did not run." The cause sentence from openclaw#205337 (`OperatorRefusalError`, e.g. "I did not run your queued request. Your role on this Gateway does not allow it. Ask a Gateway admin to …") did not reach them. Cause: `followup-runner.ts` treats a start refusal as a plain retry→consumed failure, so the existing "withheld" outcome (visible transcript notice plus source delivery) never runs for it. Some refusal texts also still sat outside the cause table (follow-ups listed in openclaw#205337). ## Fix - `src/auto-reply/reply/followup-runner.ts`: an `OperatorRefusalError` thrown before the turn is admitted (`!admittedTurn`) now takes the existing withheld branch, like a retired cron delivery. The notice is the refusal's own sentence (no `withheld:` prefix). That branch already records a visible `run-failed-before-reply` transcript notice and hands the failed completion to the source owner (Gateway chat records it in the run's chat). A refusal after the turn starts does not match, so a running turn never gets a false "I did not run". - Cause table (`src/gateway/operator-refusal.ts`) gets three rows. These sites now use it: - role agent refusal (`operator-role-policy.ts`, `agent-not-in-role`) - channel access notice (`agent-runner-error-handler.ts`, `channel-access-ended`) - workflow-permission failure (`github-publication-failure.ts`, `role-denies`; the nextAction keeps "not a token scope failure, saved changes intact") - session tool-policy refusals (`session-resource-tool-policy.ts`, `session-access-authority.ts`, `tool-policy-denies`) ### Decision: no new pending-input column The brief allowed one new nullable field on `session_pending_inputs` to carry the cause id. I did not add it. The existing withheld path already puts the sentence in the chat, so the schema change is avoidable (schema changes only when unavoidable; no new state). A column would have needed a PostgreSQL schema bump, a protocol field and about 20 files of threading. Consulted Fable 5.2; same pick. Trade-off: the pending-input line stays generic ("blocked by a policy"). The sentence shows as its own notice right after it. Old rows: unchanged, because nothing is stored. ### Known gap: channel messages Channel-originated queued inputs get the transcript notice (seen in the session in Control UI). They do not get a channel message. Channel inbound followups register no `onQueuedFollowupReplyBatch` source delivery, and a refused input has no admitted turn to deliver through. Sending one needs a new delivery path for unadmitted input, which this PR does not add. Tracked in openclaw#205417. Production `src`: net +25 lines (three cause rows, the refusal condition and notice selection; long free-text strings removed). ## User impact A member whose role was lowered while their `/followup` waited sees in the chat: "I did not run your queued request. Your role on this Gateway does not allow it. Ask a Gateway admin to do it, or to add the permission to your role." Before, they saw only "This message was blocked by a policy and did not run." ## Evidence - `src/gateway/server-methods/chat-send-direct-followup.test.ts` "refuses a queued /followup … and says why in chat": real chat dispatch, queued `/followup`, requester demoted before start. It asserts the sentence in the transcript notice. It fails on base (followup-runner reverted) and passes on head. - Updated wording tests for the moved texts; `operator-refusal.test.ts` covers the new causes through the tool adapter. - E2E (isolated Gateway, real model) on `17bb2763cffa`: R, Q (with the new sentence assertion) and S pass; openclaw#205408 (comment) Co-authored-by: Ayaan Zaidi <[email protected]>
…used (#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 #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 #205408 transcript test): 15 files, run locally. - E2E: see comments. Co-authored-by: Ayaan Zaidi <[email protected]>
…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 (including
/followup) that admission refused at start was visible only in the Gateway log. In chat the person saw only the generic pending-input line "This message was blocked by a policy and did not run." The cause sentence from #205337 (OperatorRefusalError, e.g. "I did not run your queued request. Your role on this Gateway does not allow it. Ask a Gateway admin to …") did not reach them. Cause:followup-runner.tstreats a start refusal as a plain retry→consumed failure, so the existing "withheld" outcome (visible transcript notice plus source delivery) never runs for it.Some refusal texts also still sat outside the cause table (follow-ups listed in #205337).
Fix
src/auto-reply/reply/followup-runner.ts: anOperatorRefusalErrorthrown before the turn is admitted (!admittedTurn) now takes the existing withheld branch, like a retired cron delivery. The notice is the refusal's own sentence (nowithheld:prefix). That branch already records a visiblerun-failed-before-replytranscript notice and hands the failed completion to the source owner (Gateway chat records it in the run's chat). A refusal after the turn starts does not match, so a running turn never gets a false "I did not run".src/gateway/operator-refusal.ts) gets three rows. These sites now use it:operator-role-policy.ts,agent-not-in-role)agent-runner-error-handler.ts,channel-access-ended)github-publication-failure.ts,role-denies; the nextAction keeps "not a token scope failure, saved changes intact")session-resource-tool-policy.ts,session-access-authority.ts,tool-policy-denies)Decision: no new pending-input column
The brief allowed one new nullable field on
session_pending_inputsto carry the cause id. I did not add it. The existing withheld path already puts the sentence in the chat, so the schema change is avoidable (schema changes only when unavoidable; no new state). A column would have needed a PostgreSQL schema bump, a protocol field and about 20 files of threading. Consulted Fable 5.2; same pick. Trade-off: the pending-input line stays generic ("blocked by a policy"). The sentence shows as its own notice right after it. Old rows: unchanged, because nothing is stored.Known gap: channel messages
Channel-originated queued inputs get the transcript notice (seen in the session in Control UI). They do not get a channel message. Channel inbound followups register no
onQueuedFollowupReplyBatchsource delivery, and a refused input has no admitted turn to deliver through. Sending one needs a new delivery path for unadmitted input, which this PR does not add. Tracked in #205417.Production
src: net +25 lines (three cause rows, the refusal condition and notice selection; long free-text strings removed).User impact
A member whose role was lowered while their
/followupwaited sees in the chat: "I did not run your queued request. Your role on this Gateway does not allow it. Ask a Gateway admin to do it, or to add the permission to your role." Before, they saw only "This message was blocked by a policy and did not run."Evidence
src/gateway/server-methods/chat-send-direct-followup.test.ts"refuses a queued /followup … and says why in chat": real chat dispatch, queued/followup, requester demoted before start. It asserts the sentence in the transcript notice. It fails on base (followup-runner reverted) and passes on head.operator-refusal.test.tscovers the new causes through the tool adapter.17bb2763cffa: R, Q (with the new sentence assertion) and S pass; fix(gateway): show a queued input's start refusal in chat #205408 (comment)