Commit b448202
fix(coding-agents): find Claude sessions for underscore paths (#3732)
* fix(coding-agents): find Claude sessions for underscore paths
* fix(coding-agents): encode every non-alphanumeric in the Claude project dir
Claude Code does not special-case underscores: it replaces EVERY
non-alphanumeric character in the absolute path with `-`. Encoding only
`/`, `.` and `_` still missed whole repositories, most commonly ones with
a space in the path (`~/Documents/My Projects/...`), which reported
"no past sessions found on disk" while the transcripts sat on disk under
their real name.
Verified against Claude Code 2.1.241 by running it in two directories:
.../hs_under_test -> ...-hs-under-test
.../hs+odd@repo v2 -> ...-hs-odd-repo-v2
Case is preserved and runs are not collapsed, so the encoding is a 1:1
character substitution.
Widening the class cannot misattribute a session: the directory name only
narrows the candidate set, and each transcript must still record a `cwd`
inside the repository before it is imported. A regression test covers that
collision directly.
Claude-Session: https://claude.ai/code/session_01HVZ94d143NPSsZjbnvwqba
---------
Co-authored-by: Nicolò Boschi <boschi1997@gmail.com>1 parent d8a71c3 commit b448202
2 files changed
Lines changed: 53 additions & 3 deletions
Lines changed: 46 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
50 | 96 | | |
51 | 97 | | |
52 | 98 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
54 | 58 | | |
55 | | - | |
| 59 | + | |
56 | 60 | | |
57 | 61 | | |
58 | 62 | | |
| |||
144 | 148 | | |
145 | 149 | | |
146 | 150 | | |
147 | | - | |
| 151 | + | |
148 | 152 | | |
149 | 153 | | |
150 | 154 | | |
| |||
0 commit comments