Skip to content

HAPI remote Codex session cancels Playwright MCP tool calls because no user-input handler is registered #287

@lwc-alex

Description

@lwc-alex

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

  1. Start HAPI runner
  2. Start a Codex session through HAPI remote mode
  3. Ensure Playwright MCP is configured in Codex
  4. Ask Codex: Use playwright to visit google
  5. 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`

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions