Skip to content

[codex] support request_user_input app-server events#874

Open
AaronZ345 wants to merge 1 commit into
chenhg5:mainfrom
AaronZ345:codex/request-user-input
Open

[codex] support request_user_input app-server events#874
AaronZ345 wants to merge 1 commit into
chenhg5:mainfrom
AaronZ345:codex/request-user-input

Conversation

@AaronZ345
Copy link
Copy Markdown
Contributor

Summary

  • Handle Codex app-server item/tool/requestUserInput server requests.
  • Convert Codex question payloads into the existing core AskUserQuestion permission flow.
  • Return user answers using Codex's expected answers[question_id].answers response shape.
  • Add regression tests for the Codex adapter and the shared rich-card / legacy-text AskUserQuestion rendering path.

Why

Codex app-server exposes a user-input request method, but cc-connect currently treats it as an unknown server request. This lets Codex ask interactive questions through the same platform UI path already used by AskUserQuestion, without changing Claude Code behavior.

Validation

Passed:

  • go test ./agent/codex -run 'TestAppServerSession_HandleRequestUserInput' -count=1
  • go test ./core -run 'TestProcessInteractiveEvents_AskUserQuestionFromAgent|TestSendAskQuestionPrompt|TestHandlePendingPermission_AskUserQuestion|TestResolveAskQuestionAnswer|TestBuildAskQuestionResponse' -count=1
  • go test ./agent/claudecode -run 'TestParseUserQuestions|TestSummarizeInput_AskUserQuestion' -count=1
  • go test ./agent/codex -count=1
  • go test ./agent/claudecode -count=1
  • go test ./platform/feishu -count=1
  • git diff --check

Also ran go test ./... -count=1; local full-suite did not pass for issues outside this PR's scope:

  • cmd/cc-connect and web setup fail because web/dist is not generated locally.
  • Existing full-suite-only failures appeared in core path expectation tests under macOS /private/var, daemon launchd status, and one Codex runtime-config timing test. The Codex timing test passes when run directly with the new Codex tests.

@AaronZ345 AaronZ345 marked this pull request as ready for review May 6, 2026 17:14
Copy link
Copy Markdown
Owner

@chenhg5 chenhg5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

APPROVED — clean integration of Codex request_user_input into the existing AskUserQuestion flow.

Review Summary

Solid implementation: routes the new item/tool/requestUserInput server request type through the same EventPermissionRequest + pendingApprovals channel pipeline already used for other Codex approval flows. No new abstractions needed — the existing card/text rendering path just works.


appServerRequestUserInputQuestions() — correct mapping; trims whitespace, skips empty questions, maps options faithfully.

handleRequestUserInput() — mirrors handlePermissionsApproval pattern correctly: registers channel, emits event, waits in goroutine, cleans up, writes JSON-RPC response.

5-minute timeout with ctx.Done() fallback — both deny correctly. No goroutine leak.

appServerRequestUserInputAnswerValues() handles string / []string / []any / map / struct — the recursive case for nested map is clever and handles Codex's own response shape.

appServerRequestUserInputResponseFromResult() — only populates answers on "allow"; empty map on deny is the right behaviour.

Test coverage: emit event, answer delivery, timeout, deny path all covered. Plus core-level AskUserQuestion rendering tests.

CI all green. LGTM.

@AaronZ345 AaronZ345 force-pushed the codex/request-user-input branch from 07b5ec8 to bda816a Compare May 8, 2026 07:25
@AaronZ345 AaronZ345 force-pushed the codex/request-user-input branch from bda816a to b764816 Compare May 8, 2026 15:02
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.

2 participants