Problem
When workDir is changed (e.g., from /tmp/hotplex/workspace to /tmp/hotplex/workspace/hotplex-worker), messaging platform sessions (Feishu DM, Slack DM/thread) reuse the same session ID because DerivePlatformSessionKey does not include workDir in its UUIDv5 hash input.
This causes Claude Code CLI to fail with:
Error: Session ID <id> is already in use.
The gateway correctly terminates the old session and creates a new one with the same ID, but the CLI's local session files (under ~/.claude/projects/<old-workdir>/) still exist, causing a conflict.
Root Cause
DeriveSessionKey (WebSocket/web) already includes workDir in the hash
DerivePlatformSessionKey (Feishu/Slack) does not include workDir
NewBridge replaces empty workDir with DefaultWorkerWorkDir, so the same conversation always maps to the same session ID regardless of actual working directory
Fix
Add WorkDir field to PlatformContext and include it in the DerivePlatformSessionKey UUIDv5 hash. This ensures different working directories produce different session IDs for the same conversation context.
Impact
- Same DM/thread on different
workDir → different session IDs (no collision)
- Same DM/thread on same
workDir → same session ID (deterministic, as before)
- Empty
WorkDir is excluded from hash (backward-compatible for direct callers)
Problem
When
workDiris changed (e.g., from/tmp/hotplex/workspaceto/tmp/hotplex/workspace/hotplex-worker), messaging platform sessions (Feishu DM, Slack DM/thread) reuse the same session ID becauseDerivePlatformSessionKeydoes not includeworkDirin its UUIDv5 hash input.This causes Claude Code CLI to fail with:
The gateway correctly terminates the old session and creates a new one with the same ID, but the CLI's local session files (under
~/.claude/projects/<old-workdir>/) still exist, causing a conflict.Root Cause
DeriveSessionKey(WebSocket/web) already includesworkDirin the hashDerivePlatformSessionKey(Feishu/Slack) does not includeworkDirNewBridgereplaces emptyworkDirwithDefaultWorkerWorkDir, so the same conversation always maps to the same session ID regardless of actual working directoryFix
Add
WorkDirfield toPlatformContextand include it in theDerivePlatformSessionKeyUUIDv5 hash. This ensures different working directories produce different session IDs for the same conversation context.Impact
workDir→ different session IDs (no collision)workDir→ same session ID (deterministic, as before)WorkDiris excluded from hash (backward-compatible for direct callers)