openclaw - ✅(Solved) Fix [Bug]: native Codex app-server does not surface app approval/input prompts, and Codex Apps GitHub writes fail as "user rejected MCP tool call" [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#68784Fetched 2026-04-19 15:07:33
View on GitHub
Comments
1
Participants
2
Timeline
2
Reactions
0
Author
Timeline (top)
commented ×1cross-referenced ×1

In a native Codex app-server session, Codex Apps GitHub reads worked, but GitHub write actions failed almost immediately as user rejected MCP tool call even though no approval/input prompt was shown.

Root Cause

Impact and severity

Affected: native Codex app-server sessions using Codex Apps connectors, at least the GitHub connector
Severity: medium to high, because connector reads work but connector writes fail
Frequency: observed every time in the affected session for _add_issue_labels
Consequence: Codex Apps GitHub mutations fail even though the session can still read from GitHub and later perform writes through plain gh

Fix Action

Fixed

PR fix notes

PR #68807: fix(codex): bridge MCP tool approval elicitations

Description (problem / solution / changelog)

Summary

  • Problem: native Codex app-server sessions let MCP tool approval elicitations fall through to the fail-closed client fallback, which surfaced Codex Apps GitHub writes as immediate user rejected MCP tool call failures.
  • Why it matters: Codex Apps connector writes could not reach the existing OpenClaw approval UX even though plugin approvals, Control UI handling, and chat /approve flows already existed.
  • What changed: targeted mcpServer/elicitation/request handling now bridges _meta.codex_approval_kind = "mcp_tool_call" through plugin.approval.request / plugin.approval.waitDecision, clamps approval payload lengths to gateway schema limits, and adds focused regression coverage.
  • What did NOT change (scope boundary): generic item/tool/requestUserInput, non-approval elicitations, connector auth, and GitHub permission behavior all remain unchanged and fail closed outside this targeted MCP approval path.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #68784
  • Related #68721
  • This PR fixes a bug or regression

Root Cause (if applicable)

  • Root cause: extensions/codex/src/app-server/run-attempt.ts only bridged native approval request families and item/tool/call, so MCP tool approvals arriving on mcpServer/elicitation/request fell through to client.ts's default { action: "decline" } fallback.
  • Missing detection / guardrail: there was no targeted bridge for _meta.codex_approval_kind = "mcp_tool_call", and no regression test proving the native Codex bridge had to intercept that request family before fallback.
  • Contributing context (if known): the Codex app-server protocol carries MCP tool approvals on the elicitation path rather than on the older approval request methods.

Regression Test Plan (if applicable)

  • Coverage level that should have caught this:
    • Unit test
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
  • Target test or file:
    • extensions/codex/src/app-server/elicitation-bridge.test.ts
    • extensions/codex/src/app-server/run-attempt.test.ts
    • extensions/codex/src/app-server/client.test.ts
  • Scenario the test should lock in: an MCP tool approval elicitation tagged with _meta.codex_approval_kind = "mcp_tool_call" routes through plugin approval request/wait, unsupported generic prompts still fail closed, and long approval payloads are clamped before gateway validation.
  • Why this is the smallest reliable guardrail: the bug lives at the native Codex bridge boundary, so the tightest durable coverage is one bridge-level test plus one run-attempt routing test.
  • Existing test that already covers this (if any): none before this PR.
  • If no new test is added, why not: N/A.

User-visible / Behavior Changes

  • Native Codex app-server sessions can now surface MCP tool approval prompts for Codex Apps writes through the existing OpenClaw approval flow instead of immediately declining them as fake user rejections.
  • Unsupported generic item/tool/requestUserInput and non-approval elicitation flows still fail closed exactly as before.

Diagram (if applicable)

Before:
Codex Apps MCP write -> mcpServer/elicitation/request -> client fallback decline -> "user rejected MCP tool call"

After:
Codex Apps MCP write -> mcpServer/elicitation/request -> native elicitation bridge
-> plugin.approval.request / waitDecision -> existing approval UX -> accept/decline response

Security Impact (required)

  • New permissions/capabilities? No
  • Secrets/tokens handling changed? No
  • New/changed network calls? No
  • Command/tool execution surface changed? Yes
  • Data access scope changed? No
  • If any Yes, explain risk + mitigation: this changes how an existing MCP tool approval request is routed, not what the tool can access. The bridge is gated to _meta.codex_approval_kind = "mcp_tool_call", leaves unsupported flows fail-closed, and clamps payloads to existing gateway validation limits.

Repro + Verification

Environment

  • OS: NixOS
  • Runtime/container: local OpenClaw repo checkout, native Codex app-server path
  • Model/provider: codex/gpt-5.4
  • Integration/channel (if any): Codex Apps GitHub connector via native app-server
  • Relevant config (redacted): native Codex app-server enabled; existing plugin approval flow available

Steps

  1. Start a native Codex app-server session with Codex Apps available.
  2. Trigger a GitHub connector mutation that asks for MCP tool approval.
  3. Observe the request path returned by the native bridge.

Expected

  • The approval prompt routes into the existing plugin approval flow and returns an accept/decline response instead of auto-declining.

Actual

  • Before this patch, the request fell through to the client fallback and returned an immediate decline, which surfaced as user rejected MCP tool call.

Evidence

Attach at least one:

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

What you personally verified (not just CI), and how:

  • Verified scenarios:
    • focused Codex app-server tests for approval bridge, elicitation bridge, run-attempt routing, and client fallback behavior
    • payload-length clamp so long elicitation prompts still pass gateway validation
  • Edge cases checked:
    • unavailable approval route declines cleanly
    • non-approval elicitation requests stay unhandled
    • generic item/tool/requestUserInput still fails closed
  • What you did not verify:
    • a live end-to-end GitHub connector mutation through the Control UI or chat approval surface

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.

Compatibility / Migration

  • Backward compatible? Yes
  • Config/env changes? No
  • Migration needed? No
  • If yes, exact upgrade steps:

Risks and Mitigations

  • Risk: the approval-content synthesis may miss a future schema shape for MCP tool approvals.
    • Mitigation: the bridge is narrowly gated to _meta.codex_approval_kind = "mcp_tool_call", only accepts form-mode object schemas, and fails closed when required fields cannot be satisfied.
  • Risk: rich approval prompts could exceed gateway schema limits and get rejected before reaching the approval UX.
    • Mitigation: the shared plugin approval helper now clamps title and description lengths before calling plugin.approval.request, with regression coverage.

AI Assistance

  • Investigation, implementation, and test authoring were done with Codex.
  • Human verification was limited to focused local test execution and code inspection in this checkout.

Tests

  • pnpm exec vitest run extensions/codex/src/app-server/approval-bridge.test.ts extensions/codex/src/app-server/elicitation-bridge.test.ts extensions/codex/src/app-server/run-attempt.test.ts extensions/codex/src/app-server/client.test.ts

Changed files

  • extensions/codex/src/app-server/approval-bridge.ts (modified, +15/-96)
  • extensions/codex/src/app-server/client.test.ts (modified, +22/-1)
  • extensions/codex/src/app-server/elicitation-bridge.test.ts (added, +284/-0)
  • extensions/codex/src/app-server/elicitation-bridge.ts (added, +345/-0)
  • extensions/codex/src/app-server/plugin-approval-roundtrip.ts (added, +106/-0)
  • extensions/codex/src/app-server/run-attempt.test.ts (modified, +78/-0)
  • extensions/codex/src/app-server/run-attempt.ts (modified, +10/-0)
RAW_BUFFERClick to expand / collapse

TL;DR: in a native Codex app-server session, Codex Apps GitHub reads worked, but GitHub write actions failed almost immediately as user rejected MCP tool call even though no approval/input prompt was shown.

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

In a native Codex app-server session, Codex Apps GitHub reads worked, but GitHub write actions failed almost immediately as user rejected MCP tool call even though no approval/input prompt was shown.

Steps to reproduce

  1. Start a native Codex app-server session through OpenClaw using codex/gpt-5.4.
  2. Use the built-in GitHub app connector for read-only calls. In the observed session, issue/PR reads succeeded.
  3. Trigger a GitHub app write action. In the observed session this was mcp__codex_apps__github._add_issue_labels.
  4. Observe that the write call fails almost immediately with user rejected MCP tool call.
  5. In the same session, run direct gh write commands. In the observed session, later gh issue edit/comment/close writes succeeded.

Expected behavior

If a Codex app connector needs approval or follow-up input for a write, OpenClaw should surface that interaction through its normal approval/input UX instead of failing immediately.

Actual behavior

GitHub app write calls failed in about 50-200ms with user rejected MCP tool call, and no approval or follow-up input prompt was shown. In the same session, later direct gh writes succeeded.

OpenClaw version

2026.4.15 (041266a)

Operating system

NixOS

Install method

local OpenClaw gateway / native Codex app-server path

Model

codex/gpt-5.4

Provider / routing chain

openclaw -> native codex app-server -> codex/gpt-5.4

Additional provider/model setup details

The affected session was a native Codex app-server session, not the older external openclaw-codex-app-server plugin path.

Logs, screenshots, and evidence

Session log: ~/.codex/sessions/2026/04/18/rollout-2026-04-18T14-53-24-019da295-93df-79b2-ad17-acebdb502561.jsonl

Observed in that log:

  • GitHub app write calls _add_issue_labels: lines 398-408
  • Responses user rejected MCP tool call: lines 410-420
  • Retry with same result: lines 424-426
  • Later direct gh write commands: lines 333-345
  • Later verification reads confirming those writes: lines 377-378

Relevant local code paths checked during investigation:

  • extensions/codex/src/app-server/client.ts
  • extensions/codex/src/app-server/run-attempt.ts

Notable behavior from the native fallback in client.ts:

  • item/tool/requestUserInput returns empty answers: {}
  • mcpServer/elicitation/request returns action: "decline"

Impact and severity

Affected: native Codex app-server sessions using Codex Apps connectors, at least the GitHub connector
Severity: medium to high, because connector reads work but connector writes fail
Frequency: observed every time in the affected session for _add_issue_labels
Consequence: Codex Apps GitHub mutations fail even though the session can still read from GitHub and later perform writes through plain gh

Additional information

Related but not the same:

  • #58161 tracks MCP elicitation support in the embedded Pi MCP client
  • #68721 changes the default native app-server approval policy to on-request

This report is about the native Codex app-server path specifically. The observed failure looks like a missing approval/input bridge for app-side follow-up prompts, not a GitHub auth failure and not a general write-permission failure.

extent analysis

TL;DR

The most likely fix is to modify the native Codex app-server session to properly handle approval/input prompts for GitHub write actions, potentially by updating the client.ts and run-attempt.ts files.

Guidance

  • Investigate the item/tool/requestUserInput function in client.ts to ensure it correctly handles user input for GitHub write actions, as it currently returns an empty answers: {} object.
  • Review the mcpServer/elicitation/request function to understand why it returns action: "decline" for GitHub write actions, and consider updating the approval policy to on-request as mentioned in #68721.
  • Verify that the gh write commands are successful because they do not rely on the Codex Apps connector, and use this as a reference point to troubleshoot the connector-specific issue.
  • Check the session log file ~/.codex/sessions/2026/04/18/rollout-2026-04-18T14-53-24-019da295-93df-79b2-ad17-acebdb502561.jsonl for any additional error messages or clues that may indicate the root cause of the issue.

Example

No code snippet is provided as the issue is more related to the overall architecture and approval flow rather than a specific code block.

Notes

The issue seems to be specific to the native Codex app-server path and the GitHub connector, and may not be related to general write-permission failures or GitHub auth issues. The fact that direct gh write commands are successful suggests that the issue is connector-specific.

Recommendation

Apply a workaround by modifying the approval policy to on-request as mentioned in #68721, and investigate further to implement a proper approval/input bridge for app-side follow-up prompts. This may involve updating the client.ts and run-attempt.ts files to correctly handle user input for GitHub write actions.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

If a Codex app connector needs approval or follow-up input for a write, OpenClaw should surface that interaction through its normal approval/input UX instead of failing immediately.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING