Summary
When I run Codex directly on the host, Playwright MCP browser actions work and prompt for approval as expected.
When I run Codex through HAPI remote mode, the same Playwright MCP action fails immediately with:
user cancelled MCP tool call
From the HAPI logs, this appears to happen because HAPI does not register a handler for Codex’s MCP user-input request path.
Environment
- HAPI CLI: 0.16.1
- Codex CLI: 0.114.0
- OS: macOS
- Session started by HAPI runner
- HAPI launch mode:
hapi codex --hapi-starting-mode remote --started-by runner
Expected behavior
When Codex invokes a Playwright MCP tool that requires user confirmation/input, HAPI should surface the request to the client and return a valid response so the tool call can proceed.
Actual behavior
The Playwright MCP tool call is cancelled immediately and Codex reports:
user cancelled MCP tool call
No usable approval/input prompt is shown for that MCP request.
Key evidence
In the HAPI app log:
[13:41:35.610] ... activeFlags:["waitingOnUserInput"]
[13:41:35.612] [CodexAppServer] No user-input handler registered; cancelling request
[13:41:35.614] [CodexAppServer][stderr] failed to deserialize ToolRequestUserInputResponse: missing field `answers`
[13:41:35.617] ... playwright browser_navigate ... failed ... "user cancelled MCP tool call"
This strongly suggests the MCP tool needed a user-input response, but HAPI had no registered handler for that request type and returned an invalid or empty response.
Reproduction
- Start HAPI runner
- Start a Codex session through HAPI remote mode
- Ensure Playwright MCP is configured in Codex
- Ask Codex:
Use playwright to visit google
- Observe failure:
user cancelled MCP tool call
Additional observations
HAPI does appear to handle shell approval flows separately.
Later logs show successful approval handling for bash commands, e.g. waitingOnApproval / Permission approved for CodexBash.
So this seems specifically related to MCP user-input handling, not all approval handling.
Suspected cause
HAPI remote Codex integration supports command approval flow, but not the Codex MCP waitingOnUserInput flow required by some MCP tools like Playwright.
There may also be a payload mismatch in the response shape, since Codex logs:
missing field answers
Suggested fix areas
- Register a handler for Codex MCP user-input requests in remote mode
- Ensure the response matches the expected
ToolRequestUserInputResponse schema
- Verify Playwright MCP approval/input requests are bridged to the HAPI client correctly
- Check for compatibility issues between HAPI 0.16.1 and Codex 0.114.0
Relevant logs
HAPI runner log showed session launch:
[RUNNER RUN] Spawning session
[SPAWN HAPI CLI] Spawning: hapi codex --hapi-starting-mode remote --started-by runner
HAPI app log showed the failure:
[CodexAppServer] No user-input handler registered; cancelling request
failed to deserialize ToolRequestUserInputResponse: missing field `answers`
Summary
When I run Codex directly on the host, Playwright MCP browser actions work and prompt for approval as expected.
When I run Codex through HAPI remote mode, the same Playwright MCP action fails immediately with:
user cancelled MCP tool callFrom the HAPI logs, this appears to happen because HAPI does not register a handler for Codex’s MCP user-input request path.
Environment
Expected behavior
When Codex invokes a Playwright MCP tool that requires user confirmation/input, HAPI should surface the request to the client and return a valid response so the tool call can proceed.
Actual behavior
The Playwright MCP tool call is cancelled immediately and Codex reports:
user cancelled MCP tool callNo usable approval/input prompt is shown for that MCP request.
Key evidence
In the HAPI app log:
This strongly suggests the MCP tool needed a user-input response, but HAPI had no registered handler for that request type and returned an invalid or empty response.
Reproduction
Use playwright to visit googleuser cancelled MCP tool callAdditional observations
HAPI does appear to handle shell approval flows separately.
Later logs show successful approval handling for bash commands, e.g.
waitingOnApproval/Permission approved for CodexBash.So this seems specifically related to MCP user-input handling, not all approval handling.
Suspected cause
HAPI remote Codex integration supports command approval flow, but not the Codex MCP
waitingOnUserInputflow required by some MCP tools like Playwright.There may also be a payload mismatch in the response shape, since Codex logs:
missing field answersSuggested fix areas
ToolRequestUserInputResponseschemaRelevant logs
HAPI runner log showed session launch:
HAPI app log showed the failure: