fix(agents): surface real plugin approval rejection reason to agent#100337
Conversation
|
Codex review: needs changes before merge. Reviewed July 5, 2026, 3:27 PM ET / 19:27 UTC. Summary PR surface: Source +9, Tests +38. Total +47 across 2 files. Reproducibility: yes. by source inspection. Current Review metrics: none identified. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Use one phase-aware approval error classifier: request-phase Do we have a high-confidence way to reproduce the issue? Yes, by source inspection. Current Is this the best way to solve the issue? No. The PR is close, but the best fix must preserve request versus wait-decision phase so Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against f141408e7749. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +9, Tests +38. Total +47 across 2 files. View PR surface stats
Acceptance criteria:
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (5 earlier review cycles)
|
ed9b345 to
e4844b9
Compare
|
Source comparison for the #100212 cluster: I would not treat this branch as the best current fix yet. The runtime change is in the right catch block ( The stronger current lane is #100231 (with #100228 close behind) because it exercises both affected approval seams: Best-fix verdict: #100337 is a plausible source patch, but #100231 is the better merge candidate for #100212 unless this branch adds equivalent regression coverage. I did not find a source reason to prefer the source-only branch over the tested one. |
|
Maintainer verification for final rebased head
Known gap: this proves the real Gateway RPC and agent hook path, not a browser/plugin UI interaction. The structured rejection and unavailable paths are both covered at the production hook boundary. |
d2534cf to
cd0d64d
Compare
Distinguish gateway-rejection errors from transport failures in the plugin approval catch block. When the error is a GatewayClientRequestError (with a structured gatewayCode), the gateway is reachable and actively rejected the request — surface the real rejection reason. Otherwise keep the existing "gateway unavailable" message for genuine transport failures. Previously every approval gateway error was reported as "gateway unavailable", even when the gateway was healthy and returned a structured rejection like INVALID_REQUEST. This misdirected operators and agents toward connectivity debugging instead of the actual schema or policy violation. Fixes openclaw#100212
Co-authored-by: 唐梓夷0668001293 <tang.ziyi@xydigit.com>
|
Merged via squash.
|
What Problem This Solves
Fixes #100212: When the gateway rejects a plugin approval request (e.g. schema validation →
INVALID_REQUEST), the agent receives a hardcoded "Plugin approval required (gateway unavailable)" message. The gateway is actually healthy and actively rejected the request — the misleading message points debugging in the wrong direction.Real-world impact: This misled operators at Clawnify.com during a production incident where an overlong approval title (98 chars, cap is 80) caused every mutating tool call to fail. The agent, seeing "gateway unavailable," concluded the target app was broken — while the gateway was perfectly healthy.
Why This Change Was Made
The catch block around the
plugin.approval.requestgateway call insrc/agents/agent-tools.before-tool-call.tsreturned a fixed string regardless of error type. Now we distinguish:"Plugin approval request rejected: <real message>"— gateway is up, request was invalid"Plugin approval required (gateway unavailable)"— genuine transport failureUser Impact
Evidence
agent-tools.before-tool-call.ts:931-935verified as the single hardcoded-message sitepnpm test src/agents/agent-tools.before-tool-call.embedded-mode.test.ts— 15 tests passpnpm test src/agents/agent-tools.before-tool-call.e2e.test.ts— 58 tests passoxlintpasses on changed file🤖 Generated with Claude Code