Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/core/src/hivemind.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
37 changes: 37 additions & 0 deletions packages/core/test/hivemind.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
Loading