Repository navigation
fix(codex): defer report-mode plugin approvals - #87805
Conversation
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: fix(codex): defer report-mode plugin approvals This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: faf8ee1785
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ).finally(() => { | ||
| if (pendingPreToolUseApprovals.get(pendingApprovalKey) === pendingApproval) { | ||
| pendingPreToolUseApprovals.delete(pendingApprovalKey); | ||
| } |
There was a problem hiding this comment.
Preserve deferred denial outcomes for retries
When a deferred PreToolUse plugin approval resolves, this finally removes the only stored outcome. A later Codex app-server approval request for the same toolUseId still matches the recorded native invocation, but resolveNativeHookRelayDeferredToolApproval() then returns undefined; approval-bridge.ts treats that as handled: true/no-decision and falls through to the generic Codex approval route. In retry or duplicate-request scenarios after a plugin denial, that lets the user approve the command through Codex despite the plugin policy having denied it. Cache the resolved approval/denial for the relay/tool-use lifetime, or make a missing deferred outcome fail closed for an observed native invocation.
Useful? React with 👍 / 👎.
Summary
PreToolUseplugin approval requirements into the real app-server approval request instead of failing closed in the native hook process.Supersedes #86978. Thanks @clawSean for the original docs clarification that exposed this missing runtime path.
Verification
node scripts/run-vitest.mjs src/agents/agent-tools.before-tool-call.embedded-mode.test.tsnode scripts/run-vitest.mjs src/agents/harness/native-hook-relay.test.tsnode scripts/run-vitest.mjs extensions/codex/src/app-server/approval-bridge.test.tspnpm plugin-sdk:api:checkpnpm tsgo:corepnpm tsgo:extensionsgit diff --checkpnpm docs:list/Users/steipete/Projects/agent-scripts/skills/autoreview/scripts/autoreview --mode branch --base origin/main --prompt-file /tmp/codex-report-mode-review-notes.mdReal behavior proof
Behavior addressed: Codex app-server report-mode
PreToolUsehooks that returnrequireApprovalnow defer to the matching Codex app-server approval request and open a real OpenClaw plugin approval prompt.Real environment tested: Local OpenClaw checkout on Node/Vitest with Codex app-server bridge and native hook relay unit coverage.
Exact steps or command run after this patch:
node scripts/run-vitest.mjs src/agents/harness/native-hook-relay.test.ts;node scripts/run-vitest.mjs extensions/codex/src/app-server/approval-bridge.test.ts;pnpm tsgo:core;pnpm tsgo:extensions.Evidence after fix: Focused tests cover deferred report-mode approval storage, duplicate app-server request sharing, app-server approval consumption, and plugin
allow-alwaysstaying scoped to one Codex request.Observed result after fix: All focused tests and type/API checks passed locally.
What was not tested: A live Codex app-server run with a human clicking the approval UI was not exercised locally.