-
Notifications
You must be signed in to change notification settings - Fork 5.4k
fix(web): pending user-input Submit bypasses normal-send guards #9319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ImBIOS
wants to merge
3
commits into
pingdotgg:main
Choose a base branch
from
ImBIOS:fix/web-pending-submit-swallowed-by-send-guards
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| /** | ||
| * Strip terminal escape sequences from captured CLI stdout. | ||
| * | ||
| * OpenCode's CLI (and potentially other provider CLIs) can emit OSC title | ||
| * sequences (`ESC ]0;<title> BEL` / `ESC \`) and ANSI CSI color codes directly | ||
| * to stdout, even when stdout is a pipe. When T3 Code captures that output | ||
| * via `ChildProcessSpawner`, those bytes pollute structured parsing — e.g. | ||
| * `opencode agent list` becomes `\x1b]0;t3code: ready\x07build (primary)` | ||
| * instead of `build (primary)`, causing the agent inventory to store a | ||
| * polluted id that later fails with `Agent not found`. | ||
| * | ||
| * This is defensive for any provider CLI; the regexes are intentionally | ||
| * permissive and also handle Ghostty/Zsh title integrations that can leak | ||
| * through `shell: true` spawns. | ||
| */ | ||
| const OSC_RE = /\x1b\].*?(?:\x07|\x1b\\)/g; | ||
| const CSI_RE = /\x1b\[[0-9;?]*[ -/]*[@-~]/g; | ||
| const CHARSET_RE = /\x1b[()][A-Za-z0-9]/g; | ||
| const SINGLE_ESC_RE = /\x1b[@-Z\\-_]/g; | ||
|
|
||
| export function stripTerminalEscapes(input: string): string { | ||
| if (!input || input.indexOf("\x1b") === -1) { | ||
| return input; | ||
| } | ||
| return input | ||
| .replace(OSC_RE, "") | ||
| .replace(CSI_RE, "") | ||
| .replace(CHARSET_RE, "") | ||
| .replace(SINGLE_ESC_RE, ""); | ||
| } | ||
|
|
||
| /** | ||
| * Strip escapes and also trim the result. Useful for single-value fields | ||
| * like agent/variant names that should never contain control bytes. | ||
| */ | ||
| export function sanitizeTerminalValue(input: string): string { | ||
| return stripTerminalEscapes(input).trim(); | ||
| } | ||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟠 High
src/stripTerminalEscapes.ts:17stripTerminalEscapesleaves standard escape content in captured output, so affected agent headers and skills JSON remain corrupted and parsing fails.CHARSET_REdoes not consumeESC */ESC +/ESC -/ESC ./ESC /designations,CSI_REdoes not match colon-delimited parameters such as\x1b[38:2::255:0:0m, andSINGLE_ESC_REremoves only the DCS/PM/APC introducer and terminator while leaving payloads such aspayload. Extend charset and CSI matching, and consume DCS/PM/APC strings through theirESC \terminator before applying single-escape cleanup.🤖 Copy this AI Prompt to have your agent fix this: