diff --git a/test/main/services/team/TeamAgentLaunchMatrix.safe-e2e.test.ts b/test/main/services/team/TeamAgentLaunchMatrix.safe-e2e.test.ts index 6f6259a5..f5ea6146 100644 --- a/test/main/services/team/TeamAgentLaunchMatrix.safe-e2e.test.ts +++ b/test/main/services/team/TeamAgentLaunchMatrix.safe-e2e.test.ts @@ -2124,7 +2124,7 @@ describe('Team agent launch matrix safe e2e', () => { }, }, }); - }); + }, 120_000); it('stopAllTeams stops in-flight mixed OpenCode secondary lanes for multiple teams', async () => { const firstTeamName = 'mixed-opencode-stop-all-inflight-multi-a-safe-e2e'; @@ -3702,6 +3702,11 @@ describe('Team agent launch matrix safe e2e', () => { (svc as any).readProcessRssBytesByPid = async () => new Map([[sharedHostPid, 183.9 * 1024 * 1024]]); + await waitForCondition(async () => { + const snapshot = await svc.getTeamAgentRuntimeSnapshot(teamName); + return snapshot.members.bob?.alive === true; + }); + const runtimeSnapshot = await svc.getTeamAgentRuntimeSnapshot(teamName); expect(runtimeSnapshot.members.bob).toMatchObject({ @@ -16259,15 +16264,15 @@ class RejectingBlockingOpenCodeRuntimeAdapter extends FakeOpenCodeRuntimeAdapter } } -async function waitForCondition(assertion: () => boolean): Promise { +async function waitForCondition(assertion: () => boolean | Promise): Promise { const startedAt = Date.now(); while (Date.now() - startedAt < 5_000) { - if (assertion()) { + if (await assertion()) { return; } await new Promise((resolve) => setTimeout(resolve, 10)); } - expect(assertion()).toBe(true); + expect(await assertion()).toBe(true); } async function removeTempDirWithRetries(dir: string): Promise {