codex: let the agent ask the user a question - #12
Merged
Merged
Conversation
item/tool/requestUserInput is codex's analogue of AskUserQuestion. It was answered with -32601, so codex could not ask anything. The shape comes from ToolRequestUserInputParams in the generated schema, not from a probe. Two differences from claude decide the code. codex keys each answer by a question id rather than by position, so the id rides out on the question and back on the reply; claude has only the deny-message channel and ignores that field. And a codex question may offer no options, or be marked secret. The picker chooses between options and cannot take typed input, so those are left out of the answer map, which codex reads as unanswered. Every path to the pane now goes through codexEngine.ask, which owns the two rules that hang a turn when one is missed: the wait runs off the reader goroutine, and one request holds the pane at a time. askUser duplicated both, and a third request kind was free to duplicate them again or forget them.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
item/tool/requestUserInputis codex's analogue of claude'sAskUserQuestion.It was answered with
-32601, so codex could not ask the user anything — thepicker existed but nothing on that backend could reach it.
The request and response shapes come from
ToolRequestUserInputParams/ToolRequestUserInputResponsein the app-server generated schema (codex-cli0.153.4), not from a probe. The method name and its params type were both
confirmed against
ServerRequest.json.What the two backends do differently
the id rides out on
askQuestion.IDand back onapprovalReply.answers.claude has only the deny-message channel and ignores that field.
isSecret. The pickerchooses between options and cannot take typed input, so those questions are
left out of the answer map — which is how codex reads "unanswered", the same
as a dismissed question. A line says why, because a question that never
appears reads as a bug in the pane rather than a limit of it.
isOtheris narrowed away for the same reason, matching what the pickeralready does with claude's questions.
isBlockingis deliberately unread:answering is correct either way, and it is not answering that stops a turn.
One refactor
Every path to the approval pane now goes through
codexEngine.ask. It owns thetwo rules that hang a turn when one is missed — the wait runs off the reader
goroutine, and one request holds the pane at a time.
askUserhad both inline,so a third request kind was free to duplicate them or forget them.
Tests
Five new tests. Three were confirmed discriminating by actually reverting the
code they cover:
TestCodexQuestionRoundTriptimes out with noanswer on the wire, which is what a hung turn looks like;
answers:from the reply →TestAnsweringSendsBothFormsOfTheAnswerfails with
{"answers":{}};TestCodexQuestionIsAskedEvenInBuildModefails.go build,go vetand the full suite are green.Not verified: this has not been driven against the live codex CLI. Getting
a real agent to ask a question on demand needs a turn, and plan item 1.7 (a
human at a terminal) is still open.