feat(input-classifier): restore nld_heuristic_v2 (stricter shell detection) - #82
Merged
Conversation
…ction) Warp ships two shell-vs-natural-language heuristics selected by cargo feature, and its TUI (`warp_tui`) enables `nld_heuristic_v2`. The fork had deleted the v2 branches outright and hardcoded v1, so the fork's TUI used the older, looser heuristic — a silent divergence from Warp's TUI. Restore the decoupled model in `is_likely_shell_command`: - `use_nld_heuristic_v2 = cfg!(feature = "nld_heuristic_v2")`; - v2 drops `check_if_token_has_shell_syntax` voting and pins the command threshold to 1 (every token must be a recognized command), so v2 is stricter and sends more ambiguous input to the agent. Feature wiring mirrors Warp: `input_classifier` gains `nld_heuristic_v1` (default, the historical behavior) + `nld_heuristic_v2`; the `app` crate's `tui` feature turns v2 on (as Warp's `warp_tui` does), so the fork's TUI now matches Warp while the GUI stays on v1. v2 wins when both are set. Tests: the fork's v1-asserting shell-command tests become the oracle's paired `_for_nld_heuristic_v1` / `_for_nld_heuristic_v2` variants, with the three scenarios where v2 disagrees (shell-syntax voting, below-threshold described- token majority, log-path prompt) asserting the opposite under v2. input_classifier default 9/0; `--features nld_heuristic_v2` 8/0; `warp` (gui,tui) builds clean. Part of #2 / the #11 feature-parity ledger (NLD heuristic feature flags). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012gDYSHa4oDvQbfungWwG1h
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Part of #2 / #11 (NLD heuristic feature flags).
Warp selects its shell-vs-natural-language heuristic by cargo feature and its TUI (
warp_tui) enables v2. The fork had deleted the v2 branches and hardcoded v1, so the fork's TUI used the older/looser heuristic — a silent divergence.Restored the decoupled model in
is_likely_shell_command:check_if_token_has_shell_syntaxvoting and pins the command threshold to 1 (every token must be a recognized command) → stricter; more ambiguous input goes to the agent.Feature wiring mirrors Warp:
input_classifiergainsnld_heuristic_v1(default) +nld_heuristic_v2; the app'stuifeature enables v2 (as Warp'swarp_tuidoes). Fork TUI now matches Warp; GUI stays on v1; v2 wins when both are set.Tests: the fork's v1-asserting tests become the oracle's paired
_for_nld_heuristic_v1/_for_nld_heuristic_v2variants; the 3 scenarios where v2 disagrees assert the opposite under v2. input_classifier default 9/0,--features nld_heuristic_v28/0;warp(gui,tui) builds clean.🤖 Generated with Claude Code