diff --git a/packages/agent-core-v2/src/features/tower/towerService.ts b/packages/agent-core-v2/src/features/tower/towerService.ts index adac70d75..3687e5c59 100644 --- a/packages/agent-core-v2/src/features/tower/towerService.ts +++ b/packages/agent-core-v2/src/features/tower/towerService.ts @@ -486,7 +486,7 @@ export class AgentTowerService extends Disposable implements IAgentTowerService } return; } - void this.exit('foreign-reconcile'); + await this.exit('foreign-reconcile'); } private async resolveTowerOwner(): Promise { diff --git a/packages/agent-core-v2/src/human/test/utils/watch.test.ts b/packages/agent-core-v2/src/human/test/utils/watch.test.ts index 392cc5f67..7956d60ca 100644 --- a/packages/agent-core-v2/src/human/test/utils/watch.test.ts +++ b/packages/agent-core-v2/src/human/test/utils/watch.test.ts @@ -296,10 +296,9 @@ describe('watch signal mode', () => { const file = join(root, 'a.txt'); await writeFile(file, 'v1'); - await wait(300); + await expect.poll(() => events.some((e) => e.path === file && e.action === 'created')).toBe(true); expect(events[0]).toEqual({ path: root, action: 'modified', kind: 'directory' }); - expect(events.some((e) => e.path === file && e.action === 'created')).toBe(true); } finally { await rm(root, { recursive: true, force: true }); } @@ -366,10 +365,9 @@ describe('watch signal mode', () => { const file = join(root, 'a.txt'); await writeFile(file, 'v1'); - await wait(300); + await expect.poll(() => events.some((e) => e.path === file && e.action === 'created')).toBe(true); expect(nativeCalls).toBe(0); - expect(events.some((e) => e.path === file && e.action === 'created')).toBe(true); } finally { await rm(root, { recursive: true, force: true }); } diff --git a/packages/agent-core-v2/test/features/tower/towerService.test.ts b/packages/agent-core-v2/test/features/tower/towerService.test.ts index 7174cec27..53e2d6fdd 100644 --- a/packages/agent-core-v2/test/features/tower/towerService.test.ts +++ b/packages/agent-core-v2/test/features/tower/towerService.test.ts @@ -986,6 +986,7 @@ describe('AgentTowerService', () => { ]); const ix2 = disposables.add(new TestInstantiationService()); + ix2.stub(ILogService, stubLog()); ix2.stub(IFileSystemStorageService, new InMemoryStorageService()); ix2.set(IAppendLogStore, new SyncDescriptor(AppendLogStore)); registerTestAgentWire(ix2, testWireScope('wire', 'tower-replay'), { @@ -1011,6 +1012,7 @@ describe('AgentTowerService', () => { ]; const ix2 = disposables.add(new TestInstantiationService()); + ix2.stub(ILogService, stubLog()); ix2.stub(IFileSystemStorageService, new InMemoryStorageService()); ix2.set(IAppendLogStore, new SyncDescriptor(AppendLogStore)); registerTestAgentWire(ix2, testWireScope('wire', 'tower-legacy'), { @@ -1722,6 +1724,7 @@ describe('AgentTowerService', () => { ]); const ix2 = disposables.add(new TestInstantiationService()); + ix2.stub(ILogService, stubLog()); ix2.stub(IFileSystemStorageService, new InMemoryStorageService()); ix2.set(IAppendLogStore, new SyncDescriptor(AppendLogStore)); ix2.set(IEventBus, new SyncDescriptor(EventBusService)); @@ -1824,6 +1827,7 @@ describe('AgentTowerService', () => { } const ix2 = disposables.add(new TestInstantiationService()); + ix2.stub(ILogService, stubLog()); ix2.stub(IFileSystemStorageService, new InMemoryStorageService()); ix2.set(IAppendLogStore, new SyncDescriptor(AppendLogStore)); ix2.set(IEventBus, new SyncDescriptor(EventBusService)); @@ -1891,6 +1895,7 @@ describe('AgentTowerService', () => { } const ix2 = disposables.add(new TestInstantiationService()); + ix2.stub(ILogService, stubLog()); ix2.stub(IFileSystemStorageService, new InMemoryStorageService()); ix2.set(IAppendLogStore, new SyncDescriptor(AppendLogStore)); ix2.set(IEventBus, new SyncDescriptor(EventBusService)); @@ -1965,6 +1970,7 @@ describe('AgentTowerService', () => { await new TowerStore(repo).init('session-original'); const ix2 = disposables.add(new TestInstantiationService()); + ix2.stub(ILogService, stubLog()); ix2.stub(IFileSystemStorageService, new InMemoryStorageService()); ix2.set(IAppendLogStore, new SyncDescriptor(AppendLogStore)); ix2.set(IEventBus, new SyncDescriptor(EventBusService)); @@ -2076,6 +2082,7 @@ describe('AgentTowerService', () => { }); const ix2 = disposables.add(new TestInstantiationService()); + ix2.stub(ILogService, stubLog()); ix2.stub(IFileSystemStorageService, new InMemoryStorageService()); ix2.set(IAppendLogStore, new SyncDescriptor(AppendLogStore)); ix2.set(IEventBus, new SyncDescriptor(EventBusService)); @@ -2268,6 +2275,7 @@ describe('AgentTowerService', () => { ix2.stub(IAgentToolExecutorService, stubToolExecutorEvents().executor); ix2.stub(IAgentToolApprovalService, { formatDenyMessage }); ix2.stub(ITelemetryService, { track2: () => {} }); + ix2.stub(ILogService, stubLog()); ix2.stub(IFlagService, stubFlag(() => false)); ix2.stub(ISessionManager, { get: (id: string) => (id === 'session-original' ? {} : undefined), @@ -2343,6 +2351,7 @@ describe('AgentTowerService', () => { } const ix2 = disposables.add(new TestInstantiationService()); + ix2.stub(ILogService, stubLog()); ix2.stub(IFileSystemStorageService, new InMemoryStorageService()); ix2.set(IAppendLogStore, new SyncDescriptor(AppendLogStore)); ix2.set(IEventBus, new SyncDescriptor(EventBusService)); @@ -2420,6 +2429,7 @@ describe('AgentTowerService', () => { } const ix2 = disposables.add(new TestInstantiationService()); + ix2.stub(ILogService, stubLog()); ix2.stub(IFileSystemStorageService, new InMemoryStorageService()); ix2.set(IAppendLogStore, new SyncDescriptor(AppendLogStore)); ix2.set(IEventBus, new SyncDescriptor(EventBusService)); @@ -2478,6 +2488,7 @@ describe('AgentTowerService', () => { it('restore does not touch the profile tool overlay while tower mode is inactive', async () => { const ix2 = disposables.add(new TestInstantiationService()); + ix2.stub(ILogService, stubLog()); ix2.stub(IFileSystemStorageService, new InMemoryStorageService()); ix2.set(IAppendLogStore, new SyncDescriptor(AppendLogStore)); ix2.set(IEventBus, new SyncDescriptor(EventBusService));