Skip to content

fix(coding-agent): guard pasted shell prompts from python#4681

Open
roboomp wants to merge 1 commit into
mainfrom
farm/f1201b98/syntax-paste-python-exec
Open

fix(coding-agent): guard pasted shell prompts from python#4681
roboomp wants to merge 1 commit into
mainfrom
farm/f1201b98/syntax-paste-python-exec

Conversation

@roboomp

@roboomp roboomp commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Repro

A pasted terminal transcript beginning with a shell prompt, e.g. $ cd ~/project && sudo ./build-and-push.sh o5.7 2>&1 | tail -4 followed by OMP status-line chrome, was submitted through the direct Python shortcut path. The focused regression command bun test packages/coding-agent/test/input-controller-python-prefix.test.ts failed before the fix because handlePythonCommand was called once for the pasted transcript.

Cause

packages/coding-agent/src/modes/controllers/input-controller.ts treated 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 to cd ... and sent to handlePythonCommand, producing Python SyntaxError output instead of a normal prompt.

Fix

  • Added shell-prompt transcript detection before the single-$ Python shortcut route.
  • Kept $$ ... and ordinary $ print(1) Python shortcuts working.
  • Added regression coverage in packages/coding-agent/test/input-controller-python-prefix.test.ts for the reporter’s $ cd ... plus OMP status-line paste shape.
  • Added an Unreleased changelog entry for packages/coding-agent.

Verification

Reproduced with bun test packages/coding-agent/test/input-controller-python-prefix.test.ts before the parser guard: 3 pass, 1 fail, with handlePythonCommand called for the pasted transcript. After the fix, bun test packages/coding-agent/test/input-controller-python-prefix.test.ts passes: 4 pass, 0 fail, 12 assertions. gh_push_branch completed the pre-publish gate and pushed farm/f1201b98/syntax-paste-python-exec. Fixes #4678

- Detected copied shell-prompt transcripts before the Python shortcut router.
- Forwarded OMP terminal chrome pastes through normal prompt submission.
- Added regression coverage for the #4678 transcript shape.

Fixes #4678
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@github-actions github-actions Bot added the vouched Passed the vouch gate label Jul 6, 2026
@roboomp

roboomp commented Jul 6, 2026

Copy link
Copy Markdown
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

vouched Passed the vouch gate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Syntax Exception causes Python Execution locally

1 participant