Skip to content

fix: shell-escape generator-produced suggestion replacements#13917

Open
nickeddy wants to merge 1 commit into
warpdotdev:masterfrom
nickeddy:nickeddy/escape-generator-replacements
Open

fix: shell-escape generator-produced suggestion replacements#13917
nickeddy wants to merge 1 commit into
warpdotdev:masterfrom
nickeddy:nickeddy/escape-generator-replacements

Conversation

@nickeddy

@nickeddy nickeddy commented Jul 17, 2026

Copy link
Copy Markdown

Supersedes #11796, which was auto-closed when my fork was deleted (GitHub permanently closes a fork's PRs on fork deletion and they can't be reopened against a new fork). I didn't mean to close that - thought things were in a merged state. This is the same commit, rebased onto current master.

Suggestions produced by Generator::script (Rust generators registered via the command-signatures crate) and by v2 script generators flowed through From<...::Suggestion> for Suggestion impls that copied the raw value into replacement with no shell-escaping. Once the upstream command-signatures fix for git add <tab> lands, this gap becomes user-visible: selecting a suggestion for a path containing spaces inserts an unescaped string into the buffer, so the shell parses it as multiple tokens (git add new file test.csv instead of git add new\ file\ test.csv).

Apply ShellFamily::escape after the From conversion in both the legacy (engine/argument/legacy.rs) and v2 (engine/argument/v2.rs) generator pipelines so generator-backed suggestions match the escaping behavior the path completer (engine/path.rs) already provides for filesystem-backed completions.

Closes #11072

Refs #11072, warpdotdev/command-signatures#271.

Description

Linked Issue

  • The linked issue is labeled ready-to-spec or ready-to-implement.
  • Where appropriate, screenshots or a short video of the implementation are included below (especially for user-visible or UI changes).

Testing

  • I have manually tested my changes locally with ./script/run

Screenshots / Videos

Current behavior:
Screenshot from 2026-07-17 15-12-08

After fixes:
Screenshot from 2026-07-17 15-11-29

Agent Mode

  • Warp Agent Mode - This PR was created via Warp's AI Agent Mode

BUG-FIX: shell-escape generator-produced suggestion replacements

Suggestions produced by `Generator::script` (Rust generators registered
via the command-signatures crate) and by v2 script generators flowed
through `From<...::Suggestion> for Suggestion` impls that copied the
raw value into `replacement` with no shell-escaping. Once the upstream
command-signatures fix for `git add <tab>` lands, this gap becomes
user-visible: selecting a suggestion for a path containing spaces
inserts an unescaped string into the buffer, so the shell parses it as
multiple tokens (`git add new file test.csv` instead of
`git add new\ file\ test.csv`).

Apply `ShellFamily::escape` after the `From` conversion in both the
legacy (`engine/argument/legacy.rs`) and v2 (`engine/argument/v2.rs`)
generator pipelines so generator-backed suggestions match the escaping
behavior the path completer (`engine/path.rs`) already provides for
filesystem-backed completions.

Includes a failing-then-passing unit test for the legacy code path. A
parallel v2 test is deferred because it would require introducing
shared test infrastructure (TEST_GENERATOR_3 + JS callback wiring).

Refs warpdotdev#11072, warpdotdev/command-signatures#271.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@cla-bot cla-bot Bot added the cla-signed label Jul 17, 2026
@oz-for-oss

oz-for-oss Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

@nickeddy

Every PR must be linked to a same-repo issue before Oz can review it.

Next step: open or find a same-repo issue describing this change, then link it to this PR by adding Closes #123 to the PR description (or using the "Development" sidebar on GitHub). A maintainer will mark the issue ready-to-implement when it is ready. Once it is marked, comment /oz-review to re-trigger review.

See the contribution guidelines for the full readiness model.

Powered by Oz

@github-actions github-actions Bot added the external-contributor Indicates that a PR has been opened by someone outside the Warp team. label Jul 17, 2026

@oz-for-oss oz-for-oss Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@nickeddy

Every PR must be linked to a same-repo issue before Oz can review it.

Next step: open or find a same-repo issue describing this change, then link it to this PR by adding Closes #123 to the PR description (or using the "Development" sidebar on GitHub). A maintainer will mark the issue ready-to-implement when it is ready. Once it is marked, comment /oz-review to re-trigger review.

See the contribution guidelines for the full readiness model.

Powered by Oz

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

Labels

cla-signed external-contributor Indicates that a PR has been opened by someone outside the Warp team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Generator-produced suggestions are not shell-escaped before insertion

1 participant