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
rtk session and rtk discover can disagree on RTK adoption for the same transcript #3684
Found by `/code-review max` while iterating on #3206.
`src/analytics/session_cmd.rs::count_rtk_commands` counts any `Classification::Supported` command as adopted RTK usage without checking whether the hook was actually installed or consulting the `hook_decisions` measured log — unlike `discover::run()`'s `hook_coverage`/`estimate_hook_coverage`, added by #3206, which now correctly answers "was this actually routed through RTK" using ground truth where available and a hook-installed-aware estimate otherwise.
Concretely: on a machine/project where RTK's hook was never installed, every `git status`, `grep -n foo`, etc. in a transcript was never actually rewritten — but `rtk session` still counts each one as "RTK" and reports a high adoption percentage, directly contradicting what `rtk discover` reports for the identical transcript data (which correctly shows them as missed savings).
A prior fixup (5b6ed49, per the review) only addressed the separate `rtk proxy`-counted-as-covered gap in this same function, not the hook-installed/measured-coverage gap.
Likely fix: have `count_rtk_commands` reuse the same coverage-determination logic `discover::run()` uses (or a shared extraction of it), rather than a separate simpler heuristic. Scoped as its own issue since it's a different command's counting logic, not part of #3206's stated scope (the `hook_decisions`-logging feature itself).
rtk session's count_rtk_commands treats all Classification::Supported commands as RTK-adopted without checking hook-installed status or hook_decisions log, causing it to disagree with rtk discover's more accurate coverage estimate for the same transcript; should reuse discover::run()'s hook_coverage/estimate_hook_coverage logic.
📁 Relevant files
src/analytics/session_cmd.rs
src/discover.rs
Triaged automatically by wshm · This is an automated analysis, not a human review.
Independent reproduction of this, with a clean natural experiment — the machine had rtk installed today, so every historical session is guaranteed to contain zero rtk-prefixed commands.
rtk session reported, for a transcript recorded two days before rtk existed on this machine:
Session Date Cmds RTK Adoption
d12edfdc Yesterday 1674 588 35%
Ground truth from the same transcript file:
Bash tool_use entries: 969 (reported: 1674)
Of those, commands starting with rtk: 0 (reported: 588)
rtk's own history.db spans only today, 84 rows at the time of check; the Homebrew install receipt confirms the install happened today.
rtk discover on the same history says Already using RTK: 2 commands (0.0%), contradicting the 25% average rtk session prints.
So this is reproducible without any subtle state: with the hook installed for a matter of hours, rtk session still attributes ~35% adoption to sessions that predate the install — consistent with the count_rtk_commands / Classification::Supported diagnosis in the issue body.
Minor separate nit spotted alongside it: the Date column labeled that session "Yesterday" while the transcript file's mtime was two days earlier, so the day-bucketing looks off by one as well (possibly a UTC/local boundary issue — this machine runs UTC+8).
Activity
pszymkowiak commentedon Aug 23, 2026
🔍 Automated Triage
bugmediumSummary
rtk session's count_rtk_commands treats all Classification::Supported commands as RTK-adopted without checking hook-installed status or hook_decisions log, causing it to disagree with rtk discover's more accurate coverage estimate for the same transcript; should reuse discover::run()'s hook_coverage/estimate_hook_coverage logic.
📁 Relevant files
src/analytics/session_cmd.rssrc/discover.rsTriaged automatically by wshm · This is an automated analysis, not a human review.
NashCC1550 commentedon Aug 29, 2026
Independent reproduction of this, with a clean natural experiment — the machine had rtk installed today, so every historical session is guaranteed to contain zero rtk-prefixed commands.
rtk sessionreported, for a transcript recorded two days before rtk existed on this machine:Ground truth from the same transcript file:
tool_useentries: 969 (reported: 1674)rtk: 0 (reported: 588)history.dbspans only today, 84 rows at the time of check; the Homebrew install receipt confirms the install happened today.rtk discoveron the same history saysAlready using RTK: 2 commands (0.0%), contradicting the 25% averagertk sessionprints.So this is reproducible without any subtle state: with the hook installed for a matter of hours,
rtk sessionstill attributes ~35% adoption to sessions that predate the install — consistent with thecount_rtk_commands/Classification::Supporteddiagnosis in the issue body.Minor separate nit spotted alongside it: the
Datecolumn labeled that session "Yesterday" while the transcript file's mtime was two days earlier, so the day-bucketing looks off by one as well (possibly a UTC/local boundary issue — this machine runs UTC+8).