fix: align path normalization with Claude Code to fix session sync#590
Merged
ex3ndr merged 1 commit intoslopus:mainfrom Feb 13, 2026
Merged
Conversation
Claude Code replaces all non-alphanumeric, non-hyphen characters with hyphens when creating project directories under ~/.claude/projects/. Happy's regex only covered 6 specific characters (\, /, ., :, space, _), causing session files to not be found for paths containing @, #, +, ~, parentheses, brackets, and other special characters. This was most commonly triggered by Google Drive paths (containing @) and directory names with spaces, causing the mobile app to show sessions with no messages. The fix replaces the restrictive allowlist regex with a broader pattern that matches Claude Code's behavior: replace anything that isn't a letter, digit, or hyphen. Closes slopus#563
4 tasks
Contributor
Author
|
Attribution note: The fix in this PR was originally authored by @codeananda in PR #566, submitted on Feb 10. I cherry-picked the commit for my fork and submitted this PR without realizing #566 already existed. Apologies for the duplicate — full credit belongs to @codeananda. |
Contributor
|
Thank you @HirokiKobayashi-R ! |
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.
Summary
[\\\\/\\.: _]with[^a-zA-Z0-9-]ingetProjectPath()to match Claude Code's actual path normalization behavior@,(),[],~,+,#,=&,,;,'!Problem
Claude Code replaces all non-alphanumeric, non-hyphen characters with hyphens when creating project directories under
~/.claude/projects/. Happy's regex only covered 6 specific characters (\,/,.,:, space,_), causing session files to not be found for paths containing@,#,+,~, parentheses, brackets, and other special characters.Most commonly triggered by:
@)The result was the mobile app showing sessions with no messages, because the path normalization mismatch meant session files couldn't be located.
Changes
packages/happy-cli/src/claude/utils/path.ts— 1 line regex changepackages/happy-cli/src/claude/utils/path.test.ts— 9 new test cases verifying parity with Claude Code's behaviorTest plan
/,.,:, space,_are a subset of the new pattern)Closes #563
Closes #579