Skip to content

fix(claudecode): replace dots in project key encoding#852

Closed
KuaaMU wants to merge 1 commit into
chenhg5:mainfrom
KuaaMU:fix/dot-in-project-key
Closed

fix(claudecode): replace dots in project key encoding#852
KuaaMU wants to merge 1 commit into
chenhg5:mainfrom
KuaaMU:fix/dot-in-project-key

Conversation

@KuaaMU
Copy link
Copy Markdown
Contributor

@KuaaMU KuaaMU commented May 5, 2026

Fixes #842

Environment

  • cc-connect version: v1.3.2 (19406df)
  • OS: macOS Darwin 25.3.0 (arm64)
  • Agent: Claude Code 2.1.91
  • Platform: any (bug is in core encoding logic)

Root Cause

encodeClaudeProjectKey in agent/claudecode/claudecode.go replaces /, :, _, , ~ with - but does not replace . (dot).

Claude Code 2.1.91 does replace dots in its project key encoding. This means any workspace path containing a dot (e.g. /Users/yinglong.li/projects/myapp) produces a different key than what Claude Code writes to disk, causing findProjectDir to fail and /list to return 0 sessions.

Reproduction

  1. Use a macOS account with a dot in the username (e.g. yinglong.li)
  2. Start cc-connect with Claude Code agent
  3. Run /list in the messaging platform
  4. Expected: shows active sessions. Actual: returns 0 sessions.

Fix

Added . to the replacement set in encodeClaudeProjectKey, matching Claude Code 2.1.91 behavior.

Tests

go test ./agent/claudecode/ -run TestEncodeClaudeProjectKey -v

Added two new test cases:

  • path with dots in username: /home/john.doe/projects/myapp-home-john-doe-projects-myapp
  • path with multiple dots: /home/j.doe/src/my.app-home-j-doe-src-my-app

All 14 tests pass (12 existing + 2 new).

Fixes #842

encodeClaudeProjectKey was not replacing '.' with '-', causing a mismatch with Claude Code 2.1.91 which does replace dots. This meant /list would return 0 sessions for any username or path containing a dot (e.g. /home/john.doe/projects).
@chenhg5
Copy link
Copy Markdown
Owner

chenhg5 commented May 6, 2026

Thanks for the fix! This PR addresses the same issue as #820, which was submitted by @Re-TinyLin and has already been reviewed and approved. To avoid duplicate history in main, I'll defer to #820 for the merge. Closing in favor of #820.

@KuaaMU KuaaMU closed this by deleting the head repository May 10, 2026
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.

encodeClaudeProjectKey missing dot (.) replacement — /list returns 0 sessions

2 participants