Skip to content

The open-source app everyone uses to manage agents at work

fix(ci): make runner image tests deterministic (#12452)

Dotta8da49d6ea721
diff --git a/server/src/__tests__/issue-agent-mutation-ownership-routes.test.ts b/server/src/__tests__/issue-agent-mutation-ownership-routes.test.ts
index 4103989346..1db628e3f9 100644
--- a/server/src/__tests__/issue-agent-mutation-ownership-routes.test.ts
+++ b/server/src/__tests__/issue-agent-mutation-ownership-routes.test.ts
@@ -2369,9 +2369,12 @@ describe("agent issue mutation checkout ownership", () => {
// Base boundary denied AND tasks:assign denied: the watchdog grant lets the
// mutation past the ownership boundary, but the assignment guard must still bite.
mockAccessService.decide.mockImplementation(async (input: { action: string }) => ({
- allowed: input.action === "company_scope:read",
+ allowed: input.action === "company_scope:read" || input.action === "issue:read",
action: input.action,
- reason: input.action === "company_scope:read" ? "allow_explicit_grant" : "deny_policy_restricted",
+ reason:
+ input.action === "company_scope:read" || input.action === "issue:read"
+ ? "allow_explicit_grant"
+ : "deny_policy_restricted",
explanation:
input.action === "tasks:assign"
? "Target agent requires approval before task assignment."
@@ -2385,6 +2388,9 @@ describe("agent issue mutation checkout ownership", () => {
expect(res.status, JSON.stringify(res.body)).toBe(403);
expect(res.body.error).toContain("requires approval");
+ expect(mockAccessService.decide).toHaveBeenCalledWith(
+ expect.objectContaining({ action: "tasks:assign" }),
+ );
expect(mockIssueService.update).not.toHaveBeenCalled();
});
diff --git a/server/src/__tests__/workspace-runtime.test.ts b/server/src/__tests__/workspace-runtime.test.ts
index 577f0365d0..3693fccf95 100644
--- a/server/src/__tests__/workspace-runtime.test.ts
+++ b/server/src/__tests__/workspace-runtime.test.ts
@@ -8238,7 +8238,12 @@ describeEmbeddedPostgres("workspace runtime startup reconciliation", () => {
expect(services[0]?.url).not.toBe(rootUrl);
await expect(fetch(services[0]!.url!)).resolves.toMatchObject({ ok: true });
await expect(fetch(healthUrl)).resolves.toMatchObject({ ok: false, status: 503 });
- expect(await readLocalServicePortOwner(stalePort!)).toBe(staleProcess.pid);
+ const stalePortOwnerPid = await readLocalServicePortOwner(stalePort!);
+ expect(stalePortOwnerPid).not.toBeNull();
+ expect(staleProcess.pid).toBeTypeOf("number");
+ await expect(
+ isLocalServiceProcessOwnedBy(stalePortOwnerPid!, staleProcess.pid!),
+ ).resolves.toBe(true);
} finally {
leasedRunIds.delete(runId);
await releaseRuntimeServicesForRun(runId);