fix(discover): encode Windows drive-colon so project auto-detect matches#3007
Open
Izymiro wants to merge 1 commit into
Open
fix(discover): encode Windows drive-colon so project auto-detect matches#3007Izymiro wants to merge 1 commit into
Izymiro wants to merge 1 commit into
Conversation
Claude Code replaces the drive-letter colon with `-` when building the project directory name under ~/.claude/projects (e.g. `C:\Users\foo\bar` becomes `C--Users-foo-bar`). encode_project_path omitted `:` from its sanitized-character set and produced `C:-Users-foo-bar`, so the auto-detected --project filter never matched and `rtk discover` / `rtk learn` reported "0 sessions" on Windows. Add `:` to SANITIZED_CHARS, fix the docstring example, update the Windows test, and add a POSIX test documenting that the encoding is platform-independent.
tapheret2
reviewed
Jul 16, 2026
tapheret2
left a comment
There was a problem hiding this comment.
Review: fix(discover): encode Windows drive-colon so project auto-detect matches
Files: src/discover/provider.rs
Size: +20 / -5
Notes
- Static pass on the patch: no obvious blockers from the diff alone.
Thanks @Izymiro — independent review on the patch.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On Windows,
rtk discover(andrtk learn) with no-p/--allreportScanned: 0 sessionseven when the current project has plenty of history.rtk discover --allandrtk discover -p <name>both work correctly, whichisolates the fault to current-project auto-detection.
Root cause
ClaudeProvider::encode_project_path(src/discover/provider.rs) reproducesClaude Code's cwd→slug encoding to build the
--projectfilter, but itsSANITIZED_CHARSset is missing the colon:. Claude Code replaces thedrive-letter colon with
-, so a cwd ofC:\Users\foo\barmaps to theprojects directory
C--Users-foo-bar. rtk instead producesC:-Users-foo-bar, and the substring match indiscover_sessions_in_projects_dir(dir_name.contains(filter)) then fails,so no sessions are found. Unix paths have no
C:, so the bug is Windows-only.Fix
':'toSANITIZED_CHARS.test_encode_project_path_windowsto expectC--Users-foo-bar.test_encode_project_path_unix_colondocumenting that the encoding isplatform-independent (a colon in a POSIX path collapses to
-the same way),so this is not a Windows-only drive-letter special case.
Verification
Reproduced on Windows 11: for a real project directory
C--Users-<user>-Desktop-Projects-<proj>,rtk discoverreturned 0 sessionsbefore the change and the correct session count after — matching the output of
rtk discover -p <proj>.