fix: subagent windows not opening — two cascading bugs

1. handleInit crash: commit cdc822d removed Map initializations for
   teammateTerminals, teammatePanesByName, teams, teamTasks, teammateMap
   from the constructor but left cleanup code that iterates them.
   cleanupAllFloatingWindows() crashed on "not iterable", preventing
   ALL frontend data (sessions, subagents) from loading.

2. claudeSessionId null on recovered sessions: only set inside
   startInteractive(), never in constructor or persisted. After server
   restart, recovered sessions had null claudeSessionId, so the
   hasMatchingTab check always failed → no subagent windows.

Fixes:
- Re-add all 5 missing Map initializations in app.js constructor
- Set _claudeSessionId = this.id in Session constructor (Claudeman
  always passes --session-id to Claude, so they always match)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
arkon
2026-02-13 05:07:51 +01:00
co-authored by Claude Opus 4.6
parent 82a0da035c
commit 7d2519cacb
14 changed files with 168 additions and 83 deletions
+1 -1
View File
@@ -23,7 +23,7 @@ class MockSession extends EventEmitter {
this.writeBuffer.push(data);
}
writeViaScreen(data: string): boolean {
async writeViaScreen(data: string): Promise<boolean> {
this.writeBuffer.push(data);
return true;
}
+1 -1
View File
@@ -107,7 +107,7 @@ export class MockSession extends EventEmitter {
}
/** Write via screen (used by respawn controller) */
writeViaScreen(data: string): boolean {
async writeViaScreen(data: string): Promise<boolean> {
this.writeBuffer.push(data);
return true;
}
+6 -6
View File
@@ -120,17 +120,17 @@ describe('TmuxManager (unit)', () => {
});
});
it('should return true for registered session (no-op in test mode)', () => {
expect(manager.sendInput('test-id', '/clear\r')).toBe(true);
it('should return true for registered session (no-op in test mode)', async () => {
expect(await manager.sendInput('test-id', '/clear\r')).toBe(true);
});
it('should return false for unknown session', () => {
expect(manager.sendInput('nonexistent', 'hello\r')).toBe(false);
it('should return false for unknown session', async () => {
expect(await manager.sendInput('nonexistent', 'hello\r')).toBe(false);
});
it('should not call any tmux commands in test mode', () => {
it('should not call any tmux commands in test mode', async () => {
mockedExecSync.mockClear();
manager.sendInput('test-id', 'hello\r');
await manager.sendInput('test-id', 'hello\r');
const sendKeyCalls = mockedExecSync.mock.calls.filter(
([cmd]) => typeof cmd === 'string' && cmd.includes('send-keys')
);