rtk discover overcounts shell-wrapper parser fallbacks as top unhandled commands
#1,459 opened on 2026年4月22日
Repository metrics
- Stars
- (48,085 stars)
- PR merge metrics
- (平均マージ 11d 1h) (30d で 45 merged PRs)
説明
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:
- #1406 (
Top unhandled commands from rtk discover) - #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