Skip to content

fix(discover): report Windows sessions instead of always zero - #3438

Open
make0uthill wants to merge 1 commit into
rtk-ai:developfrom
make0uthill:fix/windows-discover-finds-nothing
Open

make0uthill wants to merge 1 commit into
rtk-ai:developfrom
make0uthill:fix/windows-discover-finds-nothing

Conversation

@make0uthill

Copy link
Copy Markdown

Summary

On Windows, rtk discover and rtk session report 0 commands even for projects with a long transcript history. Two independent causes in the Claude transcript provider, both fixed here:

  • 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.
  • 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 (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 failed
  • Manual testing: on a real project directory rtk discover went from 0 sessions to 278 commands across 10 sessions, with the reported rewrites matching what the hook actually does.

Targets develop as required.

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.
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@KuSh

KuSh commented Sep 27, 2026

Copy link
Copy Markdown
Collaborator

#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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants