Skip to content

[Quality-543]Remove check_if_token_has_shell_syntax and pin threshold to 1 for nld_heuristic_v2#10846

Merged
evelyn-with-warp merged 8 commits into
masterfrom
evelyn/qualtiy-543-continued
May 15, 2026
Merged

[Quality-543]Remove check_if_token_has_shell_syntax and pin threshold to 1 for nld_heuristic_v2#10846
evelyn-with-warp merged 8 commits into
masterfrom
evelyn/qualtiy-543-continued

Conversation

@evelyn-with-warp
Copy link
Copy Markdown
Contributor

@evelyn-with-warp evelyn-with-warp commented May 13, 2026

Description

Implementation of improving heuristics: by allocating more traffic to nld new classifier;
This should resolve misfires as shell for file path or url

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

RUST_LOG=debug ./script/run --features nld_heuristic_v2
RUST_LOG=debug ./script/run --features nld_classifier_v2, nld_heuristic_v2

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

Screenshots / Videos

Test 543 misfire read this https://trilogy-eng.atlassian.net/browse/epmlive-17588

  • it should be true/shell in v1 and false/non-shell in v2
  • with nld_heuristic_v2 and nld_classifier_v2, we could see now classifier could classify this one to prompt
image image image image

Agent Mode

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

@cla-bot cla-bot Bot added the cla-signed label May 13, 2026
@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 13, 2026

@evelyn-with-warp

I'm starting a first review of this pull request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@evelyn-with-warp evelyn-with-warp changed the title [Quality-543]Renive check shell syntax logic [Quality-543]Remove check_if_token_has_shell_syntax May 13, 2026
Copy link
Copy Markdown
Contributor

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

Choose a reason for hiding this comment

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

Overview

This PR removes shell-syntax characters from the pre-classifier shell-command voting heuristic and adds focused unit coverage for one-off shell keywords, described-token voting, and URL/path natural-language prompts.

Concerns

  • No blocking concerns found in the changed lines.

Verdict

Found: 0 critical, 0 important, 0 suggestions

Approve

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Comment thread app/Cargo.toml
Comment on lines +664 to +665
nld_heuristic_v1 = ["input_classifier/nld_heuristic_v1"]
nld_heuristic_v2 = ["input_classifier/nld_heuristic_v2"]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why do we need new flags here? Can't we just bundle these changes under classifier v2?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

so we could decouple them, e,g, we could still launch nld_classifier_v2 without heuristic change

@evelyn-with-warp evelyn-with-warp marked this pull request as draft May 14, 2026 20:31
@evelyn-with-warp evelyn-with-warp requested a review from szgupta May 15, 2026 00:52
@evelyn-with-warp evelyn-with-warp marked this pull request as ready for review May 15, 2026 00:53
@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 15, 2026

@evelyn-with-warp

I'm starting a first review of this pull request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@evelyn-with-warp evelyn-with-warp changed the title [Quality-543]Remove check_if_token_has_shell_syntax [Quality-543]Remove check_if_token_has_shell_syntax and pin threshold to 1 for nld_heuristic_v2 May 15, 2026
Copy link
Copy Markdown
Contributor

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

Choose a reason for hiding this comment

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

Overview

This PR adds feature-gated v1/v2 shell-command heuristic behavior, wires the heuristic features into bundle scripts, and adds unit coverage for the classifier utility behavior.

Security

  • The new token-level debug logging records raw input tokens; command input can include credentials, private file paths, or URLs, so this should be removed or redacted before merge.

Concerns

  • See the inline security comment on the new debug log in crates/input_classifier/src/util.rs.

Verdict

Found: 0 critical, 1 important, 0 suggestions

Request changes

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Comment thread crates/input_classifier/src/util.rs Outdated
warp_completer.workspace = true

[dev-dependencies]
warp_features.workspace = true
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

do we need this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

we used warp_features::mark_initialized() in added unit tests

Comment on lines +58 to +59
/// nld_heuristic_v1: current prod, use check_if_token_has_shell_syntax and conditional threshold on input length
/// nld_heuristic_v2: rm check_if_token_has_shell_syntax and pin threshold to be 1 for all input
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: the comment here should start with describing what is_likely_shell_command does. This is more of a detail that should follow

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

sg; will clean up upon launch.

Comment thread crates/input_classifier/src/util.rs Outdated
Comment on lines +88 to +90
let check_if_token_has_shell_syntax_result = (!use_nld_heuristic_v2).then(|| {
natural_language_detection::check_if_token_has_shell_syntax(token.token.as_str())
});
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: let check_if_token_has_shell_syntax = !use_nld_heuristic_v2 && natural_language_detection::check_if_token_has_shell_syntax(token.token.as_str())

No need for an Option here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@evelyn-with-warp evelyn-with-warp merged commit 48ac96f into master May 15, 2026
26 checks passed
@evelyn-with-warp evelyn-with-warp deleted the evelyn/qualtiy-543-continued branch May 15, 2026 03:18
lawsmd pushed a commit to lawsmd/cortex that referenced this pull request May 22, 2026
… to 1 for nld_heuristic_v2 (warpdotdev#10846)

## Description
<!-- Please remember to add your design buddy onto the PR for review, if
it contains any UI changes! -->
Implementation of improving heuristics: by allocating more traffic to
nld new classifier;
This should resolve misfires as shell for file path or url 
## Linked Issue
<!--
Link the GitHub issue this PR addresses. Before opening this PR, please
confirm:
-->
- [ ] 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
<!--
How did you test this change? What automated tests did you add? If you
didn't add any new tests, what's your justification for not adding any?

Manual testing is required for changes that can be manually tested, and
almost all changes can be manually tested. If your change can be
manually tested, please include screenshots or a screen recording that
show it working end to end.

You can run the app locally using `./script/run` - see WARP.md for more
details on how to get set up.
-->
`RUST_LOG=debug ./script/run --features nld_heuristic_v2`
`RUST_LOG=debug ./script/run --features nld_classifier_v2,
nld_heuristic_v2`

- [x] I have manually tested my changes locally with `./script/run`

### Screenshots / Videos
<!-- Attach screenshots or a short video demonstrating the change, where
appropriate. Remove this section if it is not relevant to your PR. -->
Test 543 misfire `read this
https://trilogy-eng.atlassian.net/browse/epmlive-17588`
- it should be true/shell in v1 and false/non-shell in v2
- with `nld_heuristic_v2` and `nld_classifier_v2`, we could see now
classifier could classify this one to prompt
<img width="2169" height="336" alt="image"
src="https://github.com/user-attachments/assets/d6129bc0-dba6-4ecd-9aab-8f36c64f63c8"
/>

<img width="2158" height="543" alt="image"
src="https://github.com/user-attachments/assets/fc698d9d-9cea-4be1-874f-32f881c6fe02"
/>

<img width="1315" height="187" alt="image"
src="https://github.com/user-attachments/assets/ebc989de-f344-4ddb-82ae-a145f55766aa"
/>
<img width="2168" height="350" alt="image"
src="https://github.com/user-attachments/assets/578eccb0-949d-4a1c-a394-ef95711c7af0"
/>



## Agent Mode
- [ ] Warp Agent Mode - This PR was created via Warp's AI Agent Mode

<!--
## Changelog Entries for Stable

The entries below will be used when constructing a soft-copy of the
stable release changelog. Leave blank or remove the lines if no entry in
the stable changelog is needed. Entries should be on the same line,
without the `{{` `}}` brackets. You can use multiple lines, even of the
same type. The valid suffixes are:

- NEW-FEATURE: for new, relatively sizable features. Features listed
here will likely have docs / social media posts / marketing launches
associated with them, so use sparingly.
- IMPROVEMENT: for new functionality of existing features.
- BUG-FIX: for fixes related to known bugs or regressions.
- IMAGE: the image specified by the URL (hosted on GCP) will be added to
Dev & Preview releases. For Stable releases, see the pinned doc in the
#release Slack channel.
- OZ: Oz-related updates. Use `CHANGELOG-OZ`. At most 4 Oz updates are
shown in-app per release.
- NONE: Explicitly opt out of changelog inclusion. Use `CHANGELOG-NONE`
for PRs that should never appear in the changelog (e.g. refactors,
internal tooling, CI changes). This prevents the changelog agent from
inferring an entry.

CHANGELOG-NEW-FEATURE: {{text goes here...}}
CHANGELOG-IMPROVEMENT: {{text goes here...}}
CHANGELOG-BUG-FIX: {{text goes here...}}
CHANGELOG-BUG-FIX: {{more text goes here...}}
CHANGELOG-IMAGE: {{GCP-hosted URL goes here...}}
CHANGELOG-OZ: {{text goes here...}}
CHANGELOG-NONE
-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants