fix: handle CR in agent yes/no prompts#215
Open
arsis-dev wants to merge 1 commit into
Open
Conversation
336f9d0 to
fb79802
Compare
fb79802 to
43caaef
Compare
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.
Summary
ds4-agentnow treats carriage return as a valid line terminator in its yes/no prompts.This fixes an interactive exit path where a terminal can send
\rafter replying to:With the old line-buffered parser, that response could remain visually stuck as
y^Minstead of being accepted cleanly.Root cause
The prompt helper parsed complete newline-delimited lines with
fgets(). Some terminal paths can deliver carriage return for Enter in this restored-terminal prompt path.Upstream now also uses the same prompt helper for timed approval prompts, so the fix keeps that timeout behavior while switching the answer parser to read one byte at a time.
Change
agent_prompt_yes_no_ex()now:\nor\ras the end of the response;Validation
Current branch after rebase onto
origin/main(ad0209f):Results:
git diff --check origin/main..HEAD: passed.make ds4-agent: passed.make ds4_test: passed../ds4_test --server: passed.Earlier, before this rebase, the same fix was also validated with a full
make testfrom a normal macOS Terminal on Apple M5 Max / Metal backend. The Codex execution context used for this rebase cannot access a Metal device directly, so the current post-rebase verification uses the non-Metal server regression check.