Skip to content

feat(codex): route bound-conversation approvals through OpenClaw gateway#4

Draft
SYU8384 wants to merge 1 commit into
mainfrom
feat/codex-plan-controls-approvals
Draft

feat(codex): route bound-conversation approvals through OpenClaw gateway#4
SYU8384 wants to merge 1 commit into
mainfrom
feat/codex-plan-controls-approvals

Conversation

@SYU8384

@SYU8384 SYU8384 commented Jun 12, 2026

Copy link
Copy Markdown
Owner

Summary

Replaces the auto-decline behavior in the native Codex conversation binding with real OpenClaw plugin approval routing for:

  • item/commandExecution/requestApproval
  • item/fileChange/requestApproval
  • item/permissions/requestApproval

Previously, bound Codex conversations would decline any interactive approval and tell the user to fall back to the Codex harness or /acp spawn codex. Now these requests are routed through the existing plugin.approval.request / plugin.approval.waitDecision gateway tools, so users can approve/deny from their configured OpenClaw channel.

Companion PR: #3 — native app-server plan and chat controls (foundation, plan mode, think defaults, live progress, chat plan approval controls, user-input chat controls, sequential question rendering, freeform answer dispatch, progress reply delivery).

Changes

  • extensions/codex/src/app-server/plugin-approval-roundtrip.ts

    • Introduced PluginApprovalRunContext, a minimal subset of EmbeddedRunAttemptParams needed for approval routing.
    • Narrowed requestPluginApproval to accept PluginApprovalRunContext so callers with only bound-conversation context can reuse it.
    • Added routeCodexBoundApproval helper that maps Codex approval request methods to gateway approval requests and maps the resulting allow-once / allow-always / deny / unavailable decisions back to the Codex wire shapes.
  • extensions/codex/src/conversation-binding.ts

    • Built a PluginApprovalRunContext from the inbound claim event and session config.
    • Replaced the auto-decline blocks for command, file-change, and permissions approvals with calls to routeCodexBoundApproval.
    • Kept the catch-all requestApproval fallback as a conservative decline for unknown approval methods.
  • extensions/codex/src/app-server/plugin-approval-roundtrip.test.ts

    • New unit tests covering requestPluginApproval, waitForPluginApprovalDecision, approvalRequestExplicitlyUnavailable, and routeCodexBoundApproval for command, file-change, and permissions approvals.

Verification

  • pnpm tsgo:extensions passes.
  • pnpm test extensions/codex/src/conversation-binding.test.ts passes (20/20).
  • pnpm test extensions/codex/src/app-server/plugin-approval-roundtrip.test.ts passes (15/15).
  • pnpm build passes.

Not tested

No live Crabbox/Telegram roundtrip was run for this draft; focused unit tests and typecheck/build prove the routing and mapping surface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant