diff --git a/packages/core/src/hivemind.ts b/packages/core/src/hivemind.ts index 5466431..7f13d13 100644 --- a/packages/core/src/hivemind.ts +++ b/packages/core/src/hivemind.ts @@ -734,7 +734,7 @@ function activeSessionCli(input: JsonRecord, branch: string, sessionKey: string) const branchAgent = deriveAgentName(branch); if (branchAgent !== 'agent') return branchAgent === 'claude' ? 'claude-code' : branchAgent; - return 'codex'; + return 'unknown'; } function agentFromIde(ide: string): string { diff --git a/packages/core/test/hivemind.test.ts b/packages/core/test/hivemind.test.ts index 0d8c626..f55ded7 100644 --- a/packages/core/test/hivemind.test.ts +++ b/packages/core/test/hivemind.test.ts @@ -12,6 +12,43 @@ afterEach(() => { }); describe('readHivemind', () => { + it('keeps cli unknown when no active-session identity signal is concrete', () => { + dir = mkdtempSync(join(tmpdir(), 'colony-hivemind-')); + const repoRoot = join(dir, 'repo'); + const activeSessionDir = join(repoRoot, '.omx', 'state', 'active-sessions'); + const now = new Date().toISOString(); + mkdirSync(activeSessionDir, { recursive: true }); + writeFileSync( + join(activeSessionDir, 'mcp-123.json'), + `${JSON.stringify( + { + schemaVersion: 1, + repoRoot, + branch: 'main', + taskName: 'MCP tool heartbeat', + agentName: 'unknown', + cliName: 'unknown', + sessionKey: 'mcp-123', + worktreePath: repoRoot, + startedAt: now, + lastHeartbeatAt: now, + state: 'working', + }, + null, + 2, + )}\n`, + 'utf8', + ); + + const snapshot = readHivemind({ repoRoot, now: Date.parse(now), includeStale: true }); + + expect(snapshot.sessions[0]).toMatchObject({ + branch: 'main', + agent: 'agent', + cli: 'unknown', + }); + }); + it('derives codex owner when active-session telemetry says unknown', () => { dir = mkdtempSync(join(tmpdir(), 'colony-hivemind-')); const repoRoot = join(dir, 'repo');