Repository navigation
Description
Summary
rtk discover / unhandled-command reporting appears to overcount shell-wrapper activity as real missing commands when command telemetry falls back to parsed_cmd.type="unknown".
In practice, this surfaces high-volume pseudo-commands like:
$B goto$B screenshot$B responsive$B snapshot$B consoleeval "$(...)"[/if [python3 << 'PYEOF'rev-parse
These are not all independent end-user commands that RTK should necessarily support directly. Many are:
- wrapper-script internals,
- multi-line shell programs,
- shell builtins / syntax fragments, or
- commands already rewritten or orchestrated by higher-level tooling.
The result is a noisy OP UNHANDLED COMMANDS report that looks like actionable product gaps, but is often just parser fallback noise.
Concrete example
On April 22, 2026, one local session produced this top-unhandled summary:
| Command | Count |
|---|---|
$B goto |
62 |
# Check |
36 |
eval "$(.. |
36 |
$B screenshot |
25 |
[ |
21 |
# Test |
19 |
python3 << |
16 |
$B responsive |
13 |
$B snapshot |
12 |
'^RXRESUME_API_KEY=' |
12 |
gstack-update-check |
11 |
if [ |
9 |
null |
9 |
eval |
8 |
$B console |
7 |
rev-parse |
7 |
This strongly suggests the aggregation layer is counting parser fallbacks / shell fragments instead of meaningful top-level commands.
Evidence
I inspected local Codex session JSONL output and found cases where complex shell invocations are stored as parsed_cmd: [{"type":"unknown", ...}] even when the underlying command is clearly a wrapper script or structured shell program.
Representative examples from local session logs:
- multi-line shell wrapper using
git rev-parse,gstack-slug,find,tail, etc. recorded as oneparsed_cmd.type="unknown" omx explore --prompt ...recorded asparsed_cmd.type="unknown"
That means a downstream summarizer can easily misclassify wrapper-generated activity as “top unhandled commands”.
Expected
Unhandled-command reporting should focus on meaningful top-level commands that represent actual RTK support gaps.
It should avoid or down-rank:
- shell builtins / syntax fragments (
[,if [, heredoc markers) - wrapper-private env-var assignments / grep patterns
- comment lines / sentinels (
# Check,# Test) - higher-level orchestrator internals that should be attributed to their parent tool rather than counted as standalone missing commands
- giant multi-line shell programs that parser fallback marks as
unknown
Actual
These parser fallbacks are surfaced as if they were genuine missing commands, which creates a misleading “top unhandled commands” list.
Likely root cause
There seems to be a mismatch between:
- raw exec telemetry / parser fallback (
parsed_cmd.type="unknown"), and - the analytics layer that builds the unhandled-command summary.
If the analytics layer treats every unknown parse as a candidate missing command without filtering shell syntax / wrappers / orchestrator internals, false positives are inevitable.
Relation to existing issues
This feels adjacent to, but distinct from:
- Top unhandled commands from rtk discover #1406 (
Top unhandled commands from rtk discover) rtk discoverreports false-positive missed savings for hook-rewritten commands #1441 (rtk discoverreports false-positive missed savings for hook-rewritten commands)
Those issues focus on command coverage and pre-hook vs post-hook classification.
This issue is narrower: even before support classification, the parser/aggregation layer appears to emit low-quality “commands” that should never make it into the user-facing top-unhandled list.
Potential fixes
A few possible approaches:
- Filter obvious shell syntax / fragments before adding entries to unhandled summaries.
- Collapse wrapper internals under a parent command when the invocation is clearly generated by a wrapper/orchestrator.
- Treat
parsed_cmd.type="unknown"as low-confidence unless it resolves to a simple single command token. - Add heuristics for heredocs, comments, env assignments, and multi-line scripts so they do not become first-class “commands”.
- Show confidence or source kind in discover output (explicit command vs parser fallback vs wrapper-derived).
Why this matters
Without filtering, rtk discover can send users toward the wrong action:
- opening feature requests for shell syntax,
- assuming RTK misses commands it should not claim to support directly,
- or overlooking real product gaps hidden beneath wrapper-noise.
Environment
- Observed on: April 22, 2026
- Client context: Codex / OMX / gstack-heavy shell-wrapper workflows
- OS: macOS
- Repo involved in wrapper activity: mixed local automation + browse wrappers
Activity
pszymkowiak commentedon Apr 22, 2026
🔍 Automated Triage
bugmediumSummary
rtk discover's unhandled-command report includes shell syntax fragments, heredocs, wrapper internals, and parser fallbacks (parsed_cmd.type=unknown) as if they were genuine missing commands, producing a misleading top-unhandled list.
📁 Relevant files
src/discover/aggregator.rssrc/telemetry/parser.rssrc/discover/report.rsTriaged automatically by wshm · This is an automated analysis, not a human review.
aibeshkov commentedon Nov 3, 2026
Another case of the same overcount: wrapper scripts that already call rtk internally.
My agents use small wrappers instead of raw
gh/ssh/git push(they add a per-session token, an allowlist of subcommands, and run the real CLI outside the agent's sandbox). Each one ends withexec rtk gh "$@",exec rtk ssh ...orrtk git ....rtk gaincounts those calls, butrtk discoversees only the wrapper name and lists them under "TOP UNHANDLED COMMANDS":exec rtk gh "$@"exec rtk ssh ...rtk git ...That is 27,466 of 253,914 Bash commands, so the reported adoption is 45.2% while the real share is about 56% (rtk 1.1.0).
Possible fix: let users declare such wrappers (e.g.
[discover] rtk_wrappers = ["kgh", "kssh"]in config), or have rtk record the parent command name when it is invoked from a script, so discover can match the two.