Skip to content

fix: align path normalization with Claude Code to fix session sync#590

Merged
ex3ndr merged 1 commit intoslopus:mainfrom
HirokiKobayashi-R:fix/path-normalization-563
Feb 13, 2026
Merged

fix: align path normalization with Claude Code to fix session sync#590
ex3ndr merged 1 commit intoslopus:mainfrom
HirokiKobayashi-R:fix/path-normalization-563

Conversation

@HirokiKobayashi-R
Copy link
Copy Markdown
Contributor

@HirokiKobayashi-R HirokiKobayashi-R commented Feb 13, 2026

Summary

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:

  • Google Drive paths (containing @)
  • Directory names with parentheses, brackets, or other special characters

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 change
  • packages/happy-cli/src/claude/utils/path.test.ts — 9 new test cases verifying parity with Claude Code's behavior

Test plan

  • All 9 new test cases pass, covering special characters that previously caused mismatches
  • Existing tests continue to pass (standard paths with /, ., :, space, _ are a subset of the new pattern)

Closes #563
Closes #579

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
@HirokiKobayashi-R
Copy link
Copy Markdown
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.

@codeananda
Copy link
Copy Markdown
Contributor

Thank you @HirokiKobayashi-R !

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

Labels

None yet

Projects

None yet

3 participants