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: sudo RTK_DISABLED=$VAR … is not detected as a bypass when sudo is a transparent prefix #4412
With hooks.transparent_prefixes = ["sudo", "sudo -E"], rtk discover counts sudo RTK_DISABLED=1 docker ps and RTK_DISABLED=1 sudo docker ps as bypasses (#3808), but not the same lines with an expanded value:
sudo RTK_DISABLED=$CI docker ps not counted
RTK_DISABLED=$CI sudo docker ps not counted
RTK_DISABLED=$CI docker ps counted (the ENV_PREFIX path handles it)
rtk rewrite "sudo docker ps" rewrites under that config, so dropping the assignment would recover the savings.
Cause
strip_disabled_prefix_for_analytics (src/discover/registry.rs) walks raw lexer::tokenize tokens, which split one shell word at $: RTK_DISABLED=$CI is two tokens, RTK_DISABLED= and $CI. The walk treats $CI as the command word, finds it unsupported, and falls back to strip_disabled_prefix, which does not peel sudo. Walking coalesced words (lexer::coalesce_words, as without_rtk_disabled in src/discover/mod.rs does) would keep the assignment whole.
A missed count, not a wrong one: develop does not count these lines either.
discover undercounts RTK_DISABLED bypasses with expanded env var values (e.g. $CI) alongside sudo because the analytics stripper tokenizes raw lexer tokens instead of coalesced words
This looks like a simple fix that could be auto-resolved. Repo maintainers can use /wshm fix to attempt it.
📁 Relevant files
src/discover/registry.rs
src/discover/mod.rs
Suggested Actions
Switch strip_disabled_prefix_for_analytics to walk lexer::coalesce_words like without_rtk_disabled does
Add regression tests for sudo RTK_DISABLED=$VAR cmd and RTK_DISABLED=$VAR sudo cmd
Activity
rtk-wshm-sync-bot commentedon Oct 3, 2026
🔍 Automated Triage
bugmediumSummary
discover undercounts RTK_DISABLED bypasses with expanded env var values (e.g. $CI) alongside sudo because the analytics stripper tokenizes raw lexer tokens instead of coalesced words
📁 Relevant files
src/discover/registry.rssrc/discover/mod.rsSuggested Actions
sudo RTK_DISABLED=$VAR cmdandRTK_DISABLED=$VAR sudo cmdsudoprefix, so rtk's filtering, SQLite writes and tee writes execute with root privileges the original command did not require for them #3412/PR fix(rewrite): stop rewriting sudo commands (pass them through) #2810/fix(rewrite): never rewrite sudo-prefixed commands #3569Triaged automatically by wshm · This is an automated analysis, not a human review.