You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
discover: split_command_chain's stop-at-pipe truncation blinds classification to everything after | #3683
Found by `/code-review max` while iterating on #3206 (pre-existing behavior, not introduced by that PR — it inherits the limitation, doesn't cause it — so flagged separately rather than folded in).
`discover::registry::split_command_chain` calls `lexer::split_on_operators(cmd, true)` with `stop_at_pipe=true`, which returns only the segment(s) before the first `|` — by design, per its own doc comment ("used by command rewriting — only the left side of a pipe gets rewritten"). `discover::run()`'s classification loop uses this same function to split transcript commands into parts for counting/classification, so a command like `cargo test | tail -50` becomes just `["cargo test"]` — the `| tail -50` half is silently dropped from the scan entirely (not counted in `total_commands`, not classified, invisible to every reporting bucket including the new hook-decision coverage estimate).
Separately, this also means `estimate_hook_coverage`'s registry-rewrite check can diverge from the real hook's own pipe-safety veto (`RewriteContext::PipelineFinal` in the real `rewrite_command` path) for the first segment too, since discover evaluates `"cargo test"` in isolation rather than the full `"cargo test | tail -50"` line the real hook sees — the real hook may correctly refuse to rewrite because of what follows the pipe, while discover's isolated-segment view has no way to know that.
Likely fix: discover's classification loop needs its own pipe-aware handling — either treat a piped command as a single opaque unit for counting purposes (matching what the real hook actually evaluates), or explicitly model the "rewrite only applies pre-pipe, but the whole line is one attestable unit" distinction the real hook already has. This touches how `rtk discover` counts/classifies commands generally, not just the hook_coverage estimate, so it's a bigger change than a coverage-estimate fixup.
discover::registry::split_command_chain truncates at the first pipe, so discover's classification loop silently drops everything after '|' from counting/classification and evaluates pre-pipe segments in isolation, diverging from the real hook's pipe-aware rewrite decision — needs pipe-aware handling in discover's counting logic, not just the hook_coverage estimate.
📁 Relevant files
src/discover/registry.rs
src/discover/mod.rs
Triaged automatically by wshm · This is an automated analysis, not a human review.
I’d like to work on this. I’ll update discovery’s chain splitting so each pipeline stays intact as one counting/classification unit while &&, ||, and ; still split independent clauses. I’ll add regressions for plain, mixed-chain, quoted, and |& pipelines, including the session counting path that shares this helper.
Activity
pszymkowiak commentedon Aug 23, 2026
🔍 Automated Triage
bugmediumSummary
discover::registry::split_command_chain truncates at the first pipe, so discover's classification loop silently drops everything after '|' from counting/classification and evaluates pre-pipe segments in isolation, diverging from the real hook's pipe-aware rewrite decision — needs pipe-aware handling in discover's counting logic, not just the hook_coverage estimate.
📁 Relevant files
src/discover/registry.rssrc/discover/mod.rsTriaged automatically by wshm · This is an automated analysis, not a human review.
k4its1t commentedon Aug 24, 2026
I’d like to work on this. I’ll update discovery’s chain splitting so each pipeline stays intact as one counting/classification unit while
&&,||, and;still split independent clauses. I’ll add regressions for plain, mixed-chain, quoted, and|&pipelines, including the session counting path that shares this helper.fix(discover): report every command, and say which are out of reach (#…
fix(discover): report every command, and say which are out of reach (#…
fix(discover): report every command, and say which are out of reach (#…
fix(discover): report every command, and say which are out of reach (#…