Skip to content

fix(happy-coder): return raw Codex approval decisions#863

Open
0809android wants to merge 1 commit intoslopus:mainfrom
0809android:codex/fix-codex-approval-response
Open

fix(happy-coder): return raw Codex approval decisions#863
0809android wants to merge 1 commit intoslopus:mainfrom
0809android:codex/fix-codex-approval-response

Conversation

@0809android
Copy link

@0809android 0809android commented Mar 16, 2026

Summary

  • register the Codex approval handler on the raw elicitation/create method instead of setRequestHandler(ElicitRequestSchema, ...)
  • return the top-level { decision } shape that codex mcp-server expects
  • normalize approved_for_session to approved and reject unsupported / incomplete requests with abort
  • add coverage for raw handler registration and Codex decision normalization

Why

I was reproducing the Android permission flow issue from #229 with Codex sessions.

In practice, codex mcp-server currently expects a non-standard top-level approval response like:

{ "decision": "approved" }

Using the MCP SDK's standard elicitation handler path returns the SDK-shaped payload instead, which causes Codex to reject the approval response and the command stays stuck or ends up rejected after approval.

This patch keeps the existing Happy permission flow, but installs the Codex approval handler on the raw request map so the response shape matches what Codex actually consumes today.

Testing

  • PATH=/Users/kinocode/.nvm/versions/node/v22.19.0/bin:$PATH yarn install
  • PATH=/Users/kinocode/.nvm/versions/node/v22.19.0/bin:$PATH yarn workspace happy-coder build
  • PATH=/Users/kinocode/.nvm/versions/node/v22.19.0/bin:$PATH ./node_modules/.bin/vitest run packages/happy-cli/src/codex/__tests__/codexMcpClient.test.ts
  • Manual validation against codex mcp-server 0.106.0
    • SDK-standard { action, content } approval responses failed with missing field decision
    • raw { decision: "approved" } resumed the command successfully
    • raw { decision: "abort" } produced the expected rejected by user

@0809android 0809android force-pushed the codex/fix-codex-approval-response branch from 18cf95e to 685e3fd Compare March 16, 2026 14:30
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