Skip to content

feat(input-classifier): restore nld_heuristic_v2 (stricter shell detection) - #82

Merged
jwp2987 merged 1 commit into
mainfrom
feat/nld-heuristic-v2
Aug 5, 2026
Merged

feat(input-classifier): restore nld_heuristic_v2 (stricter shell detection)#82
jwp2987 merged 1 commit into
mainfrom
feat/nld-heuristic-v2

Conversation

@jwp2987

@jwp2987 jwp2987 commented Aug 5, 2026

Copy link
Copy Markdown
Owner

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:

  • v2 drops check_if_token_has_shell_syntax voting 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_classifier gains nld_heuristic_v1 (default) + nld_heuristic_v2; the app's tui feature enables v2 (as Warp's warp_tui does). 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_v2 variants; the 3 scenarios where v2 disagrees assert the opposite under v2. input_classifier default 9/0, --features nld_heuristic_v2 8/0; warp (gui,tui) builds clean.

⚠️ Behavioral change: the TUI's shell-vs-agent classification is now stricter (matches Warp).

🤖 Generated with Claude Code

…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
@jwp2987
jwp2987 merged commit 6256290 into main Aug 5, 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.

1 participant