Skip to content

Fix command detection false positives in line_starts_with_command#14

Merged
insign merged 1 commit into
mainfrom
fix-command-detection-false-positives-8853274874295937706
May 13, 2026
Merged

Fix command detection false positives in line_starts_with_command#14
insign merged 1 commit into
mainfrom
fix-command-detection-false-positives-8853274874295937706

Conversation

@insign
Copy link
Copy Markdown
Contributor

@insign insign commented May 7, 2026

Fixes a critical bug where line_starts_with_command incorrectly identified sentences starting with words that partially match a command (such as "catapult" or ".gitignore") as shell commands.

This was fixed by performing exact comparisons for standard commands, allowing - suffixes (like apt-get matching apt), and strictly matching specific path prefixes (./, /, ~). This ensures natural language inputs or answers starting with words similar to commands are safely handled without unintended command injections. Tests were added to ensure behavior is correct.


PR created automatically by Jules for task 8853274874295937706 started by @insign

…arts_with_command` to perform exact matching instead of prefix checking when scanning responses for valid commands. This ensures that normal words beginning with command names (e.g., \"catapult\", \".gitignore\") are not incorrectly parsed and executed as commands, significantly improving the accuracy and reliability of the auto-execute logic.

Co-authored-by: insign <1113045+insign@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

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: 94b06d0f5d

ℹ️ 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 thread src/providers/mod.rs
if cmd == "./" || cmd == "/" || cmd == "~" {
first_word.starts_with(cmd)
} else {
first_word == cmd || first_word.starts_with(&format!("{cmd}-"))
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Accept dotted command variants when matching starters

The new matcher only treats exact names or cmd-... as valid (first_word == cmd || first_word.starts_with("{cmd}-")), which regresses common versioned binaries that use dots, e.g. python3.11, php8.3, or node20.11. Before this change those were recognized via prefix matching; now line_starts_with_command returns false, so flatten_command_if_safe stops flattening otherwise valid multi-line command responses in these environments.

Useful? React with 👍 / 👎.

@insign insign merged commit 0f70bf2 into main May 13, 2026
8 of 9 checks passed
@insign insign deleted the fix-command-detection-false-positives-8853274874295937706 branch May 13, 2026 07:39
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.

1 participant