Skip to content

fix: extension command with quotes in cli#8150

Merged
DOsinga merged 6 commits intomainfrom
lifei/fix-extension-quotes-cli
Mar 27, 2026
Merged

fix: extension command with quotes in cli#8150
DOsinga merged 6 commits intomainfrom
lifei/fix-extension-quotes-cli

Conversation

@lifeizhou-ap
Copy link
Copy Markdown
Collaborator

Summary

Fix Issue #6487

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 80a0db6afb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +276 to +277
let mut parts: Vec<String> = shlex::split(extension_command)
.ok_or_else(|| anyhow::anyhow!("Invalid shell quoting in extension command"))?;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve literal backslashes when parsing extension commands

Using shlex::split here changes command semantics by applying POSIX escape rules, so unquoted backslashes are consumed. That breaks valid extension inputs like Windows executables (C:\tools\mcp.exe) or regex-style args (\d+) by turning them into C:toolsmcp.exe / d+, which then fails at runtime even though those strings previously worked with split_whitespace. Because this path parses --with-extension and /extension command text, the regression affects real user commands on Windows and any command needing literal backslashes.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, shlex does not work for window. i have created an util for that now

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 27, 2026

PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-03-27 12:55 UTC

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 107b93afb0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +1109 to +1110
let shell_parts = shlex::split(&command_str)
.ok_or_else(|| anyhow::anyhow!("Invalid shell quoting in command"))?;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve backslashes in configured stdio command parsing

Using shlex::split here changes the raw command text before it is persisted, so unquoted backslashes are treated as escapes and removed. In goose configure, this breaks valid inputs like Windows executables (C:\tools\mcp.exe) or args that rely on literal backslashes, causing the saved cmd/args to differ from what the user entered and fail at runtime when launching the extension.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: af35eb6e8c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +242 to +243
'"' if !in_single_quote => in_double_quote = !in_double_quote,
'\'' if !in_double_quote => in_single_quote = !in_single_quote,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve literal quote characters inside arguments

split_quoted flips quote state on every "/' character, even when the quote is meant to be literal content inside an unquoted token. That corrupts valid extension arguments like --json {"a":"b"} into {a:b} and can reject paths such as C:\Users\O'Connor\mcp.exe with Unmatched quote. This is a regression from the previous whitespace split behavior and affects all stdio extension entry points (--with-extension, /extension, and goose configure) that call parse_stdio_extension/split_quoted.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are the edge cases. we can address them if these issues are reported

@DOsinga DOsinga added this pull request to the merge queue Mar 27, 2026
Merged via the queue into main with commit 98bab02 Mar 27, 2026
24 checks passed
@DOsinga DOsinga deleted the lifei/fix-extension-quotes-cli branch March 27, 2026 12:51
michaelneale added a commit that referenced this pull request Mar 30, 2026
* origin/main: (63 commits)
  remove name from blog post (#8157)
  fix: use `overflow: clip` to not disrupt sticky ToC (#8158)
  chore(deps): bump path-to-regexp from 0.1.12 to 0.1.13 in /documentation (#8161)
  chore(deps): bump node-forge from 1.3.2 to 1.4.0 in /documentation (#8145)
  refactor: goose-acp-server -> goose binary for TUI (#8155)
  fix "View as Markdown" feature not working (#8160)
  feat(tui): UI improvements for messages, tool calls, text entry, etc (#8156)
  feat(desktop): add i18n infrastructure with react-intl (#8105)
  fix(tui): ordering of messages (#8144)
  fix: extension command with quotes in  cli (#8150)
  chore(aaif): Use Azure Artifact Signing for Windows (#8116)
  chore(aaif): Switch macOS code signing (#8076)
  Remove unused tool call json in logs (#8147)
  feat(tui): tab expand tool calls cleanly (#8136)
  fix: replace panics with user-friendly errors in CLI session builder (#7901)
  fix: read GOOSE_CONTEXT_LIMIT from config.yaml, not just env vars (#7900)
  fix: deliver truncation notice as separate content block (#7899)
  fix: use platform-appropriate commands in developer extension instructions (#7898)
  fix: replace any with proper SVG types in icon components (#7873)
  chore: remove debug console.log statements, stale comments, and dead code (#8142)
  ...
hydrosquall pushed a commit to hydrosquall/goose that referenced this pull request Mar 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants