Repository navigation
fix(discover): report Windows sessions instead of always zero - #3438
make0uthill wants to merge 1 commit into
Conversation
On Windows `rtk discover` and `rtk session` reported 0 commands even for projects with a long transcript history. Two independent causes, both in the Claude transcript provider: 1. `encode_project_path` left the drive-letter colon intact, producing `D:-Code-...` while Claude Code writes `D--Code-...` on disk. `:` is not a legal character in a Windows directory name, so the slug it creates cannot contain one. Every lookup missed. 2. The tool_use scan matched only `"Bash"` blocks. On Windows the agent issues most commands through the `PowerShell` tool, so the bulk of the transcript was skipped even once the directory was found. `test_encode_project_path_windows` asserted the buggy slug, so it is updated to the value that actually appears on disk. Verified against a real transcript directory: after the fix `rtk discover` reports 278 commands across 10 sessions for a project that previously reported 0.
|
|
|
#2952 (merged 2026-08-13) added ':' to SANITIZED_CHARS and updated the Windows encode test, which covers the drive-letter part of this PR. What develop still lacks is counting Claude PowerShell tool_use blocks as shell commands in ClaudeProvider (src/discover/provider.rs still matches only "Bash"). As written, the new match does not take effect, because the line pre-filter a few lines above only admits lines containing "Bash" or "tool_result", so an assistant line that carries only a PowerShell tool_use never reaches it; that pre-filter needs widening too. Could you rebase onto current develop and narrow the PR to the PowerShell part, with that fix and a test for a PowerShell-only line? It conflicts with develop in provider.rs. Thanks for this. |
Summary
On Windows,
rtk discoverandrtk sessionreport 0 commands even for projects with a long transcript history. Two independent causes in the Claude transcript provider, both fixed here:encode_project_pathleft the drive-letter colon intact, producingD:-Code-...while Claude Code writesD--Code-...on disk.:is not a legal character in a Windows directory name, so the slug it creates cannot contain one — every lookup missed.tool_usescan matched only"Bash"blocks. On Windows the agent issues most commands through thePowerShelltool, so the bulk of the transcript was skipped even once the directory was found.test_encode_project_path_windowsasserted the buggy slug (C:-Users-foo-bar), so it is updated to the value that actually appears on disk.Test plan
cargo fmt --all && cargo clippy --all-targets && cargo test— 2554 passed, 0 failedrtk discoverwent from0 sessionsto278 commands across 10 sessions, with the reported rewrites matching what the hook actually does.Targets
developas required.