diff --git a/src/__tests__/path-utils-909.test.ts b/src/__tests__/path-utils-909.test.ts index 323ad5e4b..80d6224d2 100644 --- a/src/__tests__/path-utils-909.test.ts +++ b/src/__tests__/path-utils-909.test.ts @@ -21,4 +21,9 @@ describe('Issue #909: computeProjectHash cross-platform normalization', () => { it('returns fallback for empty input', () => { expect(computeProjectHash('')).toBe('-'); }); + + it('replaces dots in segments to match Claude Code slug (Issue #3286)', () => { + expect(computeProjectHash('/home/me/.claude/repo')).toBe('-home-me--claude-repo'); + expect(computeProjectHash('/Users/x/Documents/aegis/.claude/worktrees/foo')).toBe('-Users-x-Documents-aegis--claude-worktrees-foo'); + }); }); diff --git a/src/monitor.ts b/src/monitor.ts index 7a0bb892f..84ac8f26e 100644 --- a/src/monitor.ts +++ b/src/monitor.ts @@ -627,8 +627,11 @@ export class SessionMonitor { const result = await this.sessions.readMessagesForMonitor(session.id); const prevStatus = this.lastStatus.get(session.id); - // Forward messages only when watcher is NOT active (fallback polling path) - if (!this.jsonlWatcher && result.messages.length > 0) { + // Forward messages only when watcher is NOT active for THIS session (#3286). + // Checking the watcher instance alone misses the discovery poll where the + // fallback just set jsonlPath but the watcher hasn't started yet — entries + // read here would otherwise be dropped before the watcher subscribes. + if (!this.jsonlWatcher?.isWatching(session.id) && result.messages.length > 0) { this.rateLimitedSessions.delete(session.id); for (const msg of result.messages) { await this.forwardMessage(session, msg); diff --git a/src/path-utils.ts b/src/path-utils.ts index 8cf2a4853..2d36515e7 100644 --- a/src/path-utils.ts +++ b/src/path-utils.ts @@ -15,7 +15,7 @@ export function computeProjectHash(workDir: string): string { const segments = withLowerDrive .split('/') .filter(Boolean) - .map((segment) => segment.replace(/:/g, '').replace(/\s+/g, '-')); + .map((segment) => segment.replace(/:/g, '').replace(/\s+/g, '-').replace(/\./g, '-')); if (segments.length === 0) return '-'; return `-${segments.join('-')}`;