fix(coding-agent): guard pasted shell prompts from python#4681
Open
roboomp wants to merge 1 commit into
Open
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Collaborator
Author
|
No code change requested here. Codex review is blocked by account usage limits; a repo admin needs to enable or add review credits in the Codex cloud settings before that bot can review this PR. |
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.
Repro
A pasted terminal transcript beginning with a shell prompt, e.g.
$ cd ~/project && sudo ./build-and-push.sh o5.7 2>&1 | tail -4followed by OMP status-line chrome, was submitted through the direct Python shortcut path. The focused regression commandbun test packages/coding-agent/test/input-controller-python-prefix.test.tsfailed before the fix becausehandlePythonCommandwas called once for the pasted transcript.Cause
packages/coding-agent/src/modes/controllers/input-controller.tstreated any trimmed input beginning with$as a Python shortcut. That prefix collides with copied shell-prompt transcripts from terminals, so pasted UI text starting with$ cd ...was stripped tocd ...and sent tohandlePythonCommand, producing PythonSyntaxErroroutput instead of a normal prompt.Fix
$Python shortcut route.$$ ...and ordinary$ print(1)Python shortcuts working.packages/coding-agent/test/input-controller-python-prefix.test.tsfor the reporter’s$ cd ...plus OMP status-line paste shape.packages/coding-agent.Verification
Reproduced with
bun test packages/coding-agent/test/input-controller-python-prefix.test.tsbefore the parser guard: 3 pass, 1 fail, withhandlePythonCommandcalled for the pasted transcript. After the fix,bun test packages/coding-agent/test/input-controller-python-prefix.test.tspasses: 4 pass, 0 fail, 12 assertions.gh_push_branchcompleted the pre-publish gate and pushedfarm/f1201b98/syntax-paste-python-exec. Fixes #4678