Repository navigation
Conversation
…is-not-a-missing-approval # Conflicts: # scripts/plugin-sdk-surface-report.mts # src/auto-reply/reply/commands-approve.ts # src/gateway/server-methods/approval.ts
…is-not-a-missing-approval # Conflicts: # extensions/slack/src/monitor/events/interactions.block-actions.ts
…is-not-a-missing-approval # Conflicts: # packages/gateway-protocol/src/gateway-error-details.ts # scripts/plugin-sdk-surface-report.mts # src/gateway/server-methods/approval-record-lookup.ts
…is-not-a-missing-approval # Conflicts: # src/auto-reply/reply/commands-approve.test.ts # src/auto-reply/reply/commands-approve.ts
|
🦞👀 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. |
|
Codex review: blocked before merge. What this changesThe PR distinguishes an approval refusal from a missing request, preserving chat approval controls for an authorized approver. Example: A reviewer refused by the Gateway taps a Telegram approval button.
Review scores
ProductKind: Bug fix · Worth it: Needs a maintainer decision · Fix scope: Complete Merge readiness⛔ Blocked before merge - 4 items remain This PR retains a useful fix that current main does not provide. The review found one narrow, patch-caused test failure; no closure condition applies. Priority: P2 Decision needed
Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe Gateway stores approval requests and checks whether a chat reviewer may decide them. Channel plugins use its answer to show feedback and retain or retire buttons, cards, polls, and reaction bindings. flowchart LR
A[Chat approval control] --> B[Channel reviewer identity]
B --> C[Gateway approval lookup]
C --> D{Current reviewer authority}
D -->|Refused| E[Keep control available]
D -->|Authorized| F[Record canonical decision]
C -->|Missing| G[Retire control]
Technical reviewBest possible solution: Keep refusal classification in the Gateway and shared SDK, with channels retaining controls until an actual terminal or missing result. Do we have a high-confidence way to reproduce the issue? Yes: stale channel approver configuration against current Gateway configuration reaches the not-found branch and retires controls. Source and contributor A/B traces establish the path; this read-only review did not execute it. Is this the best way to solve the issue? Yes: distinguishing refusal at its Gateway owner and sharing classification avoids competing channel policies while preserving authorization checks. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 2bf85a4b1d74. Merge-risk optionsMaintainer options:
Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +214, Tests +607, Docs 0, Other +1. Total +822 across 35 files. Added test files: 3. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 HistoryReview history (5 earlier review cycles)
Reviewed October 9, 2026, 8:12 AM ET / 12:12 UTC (Revision 6). |
…is-not-a-missing-approval # Conflicts: # extensions/slack/src/monitor/events/interactions.block-actions.ts
|
Heads up: the Telegram Test Server proof needs the Convex-leased QA credentials, which I don't have access to. Could a maintainer run it, or send me a temporary broker secret privately? The same refused-then-approved flow on real Telegram is already in the Evidence section. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
…is-not-a-missing-approval # Conflicts: # extensions/googlechat/src/approval-card-click.test.ts # extensions/msteams/src/approval-card-submit.ts # scripts/plugin-sdk-surface-report.mts # src/auto-reply/reply/commands-approve.ts
|
This pull request has been automatically marked as stale due to inactivity. |
|
Closing due to inactivity. |
What Problem This Solves
Fixes: when the Gateway refuses a reviewer on a native approval control, the channel is told the approval does not exist. The reviewer is told it is no longer pending, and most channels also retire the control, leaving a listed approver nothing to press.
User Impact
A reviewer the channel does not list is now told so, and the control stays usable for an approver who is listed.
/approvenow answers a refused sender with the same sentence instead of "unknown or expired approval id", including when one kind refuses and the others have no such approval.channels.googlechat/channels.msteamschanges, so there the kept control matters only within one channel lifetime.The situation is narrow. It needs the channel's local approver check and the Gateway's live configuration to disagree, for example between an approver edit and the channel reload.
An approval bound to another channel account still answers not-found to a reviewer that account lists. A reviewer the Gateway refuses can now tell a known id from an unknown one on
approval.resolve(see known limits).Why This Change Was Made
approval.resolveand the legacyexec/plugin.approval.resolveanswered a custody refusal with the sameINVALID_REQUEST/APPROVAL_NOT_FOUNDthey use for a missing record, and every consumer acted on "gone". The refusal is now the existingFORBIDDENcode with detail codeAPPROVAL_AUTHORITY_REQUIRED. Classifiers match both, becauseFORBIDDENalone also means a missing operator scope.plugin-sdk/error-runtimegains three additive exports, each used by at least two bundled channels:isApprovalAuthorityErrorandAPPROVAL_AUTHORITY_REQUIRED_TEXT(one classifier and one sentence instead of each channel guessing) andresolveFirstApprovalKind(below).settleresult is unchanged: a refusal is simply not a missing approval, so it takes the existing path for any other failure (release the claim, keep the binding, rethrow). Google Chat and Teams catch the refusal aroundsettleand log it instead of retiring the card. No existing SDK type changes. What does change for a plugin outside this repo is the Gateway's answer: a refused reviewer used to come back as not-found, which retired its control; it now arrives the way a Gateway outage already does, as a rejectedsettleorresolveApprovalOverGatewaycall, andisApprovalAuthorityErrortells the two apart.resolveFirstApprovalKind: the four places that walk approval kinds (/approve, which since fix(approvals): let OpenClaw change approvals complete in chat #157947 also tries OpenClaw changes after exec and plugin; the Gateway resolver; Slack and Telegram legacy buttons) each had their own loop that used not-found as "try the other kind". A channel that authorizes only one kind answers the other with a refusal, so the walk has to continue past a refusal too, and when every kind fails that way the walk ends with the refusal, not not-found. The four loops now share this one walker.GatewayErrorDetailCodes, notErrorCodes, so the generated Swift/Kotlin protocol is unchanged. It is also not added to theGatewayErrorDetailsSchemaunion, which feeds native codegen; native apps never send a reviewer, so they never receive this refusal.Known limits, left as they are on
main:approval.resolvelooks up the record before custody refuses, so to a caller that can see the approval, an unknown id answers not-found and a known one answersFORBIDDEN. I kept that order so custody judges the record's own kind, not the kind the caller claims. The legacy methods refuse before the lookup, as before.UNAVAILABLEfrom the approval owner, unchanged here./approverechecks it and before the Gateway checks custody, the refusal reads "needs an approver listed for this channel", which names the wrong setting for that case (onmainit reads "approval not found"). Non-owners are turned away before the Gateway, and an owner removed earlier is told their authority changed, both as onmain./approve, on an account with exec approvals off, answers "exec approvals are not enabled" in place of a plugin refusal; both as onmain.Evidence
Live A/B against real Gateways (base =
mainate693324ad36, head = this branch atb939f542cb5, identical config, a fresh state dir and port per arm, no channel credentials; the later merge ofmainat88816f79b42changes nothing this run exercises). A real two-phase exec approval is bound to a Google Chat account that listsusers/123.users/999resolves through the shippedresolveApprovalOverGateway, and the card is the shared, unmodifiedcreateNativeApprovalControlRegistry().settle:This drives the shared
settlethat Google Chat and Teams cards use; the handlers' own catch around it is covered by unit tests. Not recorded live: the Discord and Slack refusal text, and control survival on the other card and reaction channels. Those are covered by the channel tests below.Live Telegram, refused tap then listed approver (production Telegram with a throwaway bot and a real user tapping on a phone; base =
mainat488ce1e590dvs the branch at8ad146f44de, each against its own isolated real Gateway; the approval code this run exercises, the Telegram callback approval runtime, the resolver and the Gateway's custody and resolve handlers, has not changed since in any way that affects the result, thoughmainhas since changed how the Gateway schedules channel reloads, so the 302 s below may differ on a rerun). The message and its inline keyboard are sent through the Bot API with callback data from the shippedbuildTelegramApprovalCallbackData; every tap is fed to the shippedcreateTelegramCallbackApprovalRuntime, whose Telegram actions call the real Bot API and whose resolver is the shippedresolveApprovalOverGateway. The one injected fact is the drift that makes a Gateway refusal reachable: the handler's own config lists the user as an exec approver while the Gateway's live config does not. After the first tap the harness adds the user to the Gateway'schannels.telegram.execApprovals.approvers; the Gateway defers that channel reload while the approval is pending and applies it after 302 s, then the user taps the same message again.Tests: apart from the shared
settletest, each of these fails when its one branch is removed (checked by deleting each branch in turn):approval.channel-custody-response.test.ts(new) pins refusal vs. wrong-account not-found on bothapproval.resolveand the legacyexec.approval.resolve.approval-errors.test.ts, includingFORBIDDENwithout the detail code staying unclassified, and a refusal outranking not-found in either order. The resolver's plugin fallback and/approveeach have a refusal-then-not-found case.settleis unchanged;approval-native-controls.test.tsnow pins the existing path a refusal takes (rethrow, keep the control, release the claim so the next tap settles) next to a missing approval retiring it; the reaction runtime answersdeniedwithout clearing or replaying (approval-reaction-runtime.test.ts).settle, keep the card and let the next tap decide it (approval-card-click.test.ts,approval-card-submit.test.ts); Telegram typed and legacy callbacks keep the keyboard without a retry (legacy in both kind orders), and a missing approval still gets the terminal receipt (bot-handlers.callback-router-controls.test.ts, new); Matrix keeps the reaction anchor; iMessage keeps the poll binding; Discord classifies and words the refusal; Slack's answer is pinned at its own module (approval-resolve-failure.test.ts, new).Not tested at the channel level: Slack's typed handler reaches the tested answer module through one call that no entry-point test drives with a refusal, and Slack's legacy walk only passes its two kinds to the shared walker (its message cleanup, moved out of the loop, is untested as before) (Slack's interaction test file is over its line cap, so a case there would need a harness split first).
Changed tests, one file at a time with a single worker (
OPENCLAW_VITEST_MAX_WORKERS=1, wall time including Vitest startup, this head):extensions/discord/src/monitor/exec-approvals.test.tsextensions/googlechat/src/approval-card-click.test.tsextensions/imessage/src/approval-polls.test.tsextensions/matrix/src/matrix/monitor/reaction-events.test.tsextensions/msteams/src/approval-card-submit.test.tsextensions/slack/src/monitor/events/approval-resolve-failure.test.tsextensions/telegram/src/bot-handlers.callback-router-controls.test.tssrc/auto-reply/reply/commands-approve.test.tssrc/gateway/server-methods/approval.channel-custody-response.test.tssrc/infra/approval-errors.test.tssrc/infra/approval-gateway-resolver.test.tssrc/plugin-sdk/approval-native-controls.test.tssrc/plugin-sdk/approval-reaction-runtime.test.tsChecks: on this head every
check-changed --base origin/mainlane passes exceptmax-lines suppression ratchet, which fails the same way onmainitself at88816f79b42(it flagsextensions/openrouter/index.test.ts, which this PR does not touch; #158964 dropped that file from the baseline while its suppression stayed).check-changedstops at that failure, so the lanes after it (core and extension source and test types, scripts types, lint, format, assertion-safety ratchet, SDK surface budget, dead-export scan and the guards) were run one by one with the same commands, all passing.pnpm protocol:checkexits 0 with no generated diff.