From 97492cf602e57dcf4264594399b4a62e9dcebab3 Mon Sep 17 00:00:00 2001 From: Omar Shahine Date: Sun, 19 Apr 2026 20:45:19 -0700 Subject: [PATCH] test(agents,gateway): fix two main-baseline test breakages from #68726 and #65986 (#69173) * test(agents): expect timing fields in killed-run outcome Aligns the steer-restart killed-run test with the timing fields added to subagent run outcomes in #68726. The production code now returns startedAt/endedAt/elapsedMs alongside status and error on the error outcome, but this test's toEqual still asserted only status+error, so it has been failing on main since #68726 landed. Uses the same expect.any(Number) matcher already in use a few lines below for the ended hook payload. * test(gateway): register ops agent in sessions.create task-start test The "sessions.create can start the first agent turn from an initial task" test triggers the auto chat.send path by passing `task:`. After #65986 added a deleted-agent guard to chat.send, an unregistered `ops` agent triggers the reject path and the auto-started run never happens, so runStarted comes back false. Register `ops` via testState.agentsConfig (matching the pattern already used by other ops-agent tests in this file) so the guard lets chat.send through and the first turn starts as expected. --------- Co-authored-by: Omar Shahine <10343873+omarshahine@users.noreply.github.com> --- src/agents/subagent-registry.steer-restart.test.ts | 8 +++++++- .../server.sessions.gateway-server-sessions-a.test.ts | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/agents/subagent-registry.steer-restart.test.ts b/src/agents/subagent-registry.steer-restart.test.ts index 1c68cc72202..b51f76e949c 100644 --- a/src/agents/subagent-registry.steer-restart.test.ts +++ b/src/agents/subagent-registry.steer-restart.test.ts @@ -563,7 +563,13 @@ describe("subagent registry steer restarts", () => { expect(mod.isSubagentSessionRunActive(childSessionKey)).toBe(false); const run = listMainRuns()[0]; - expect(run?.outcome).toEqual({ status: "error", error: "manual kill" }); + expect(run?.outcome).toEqual({ + status: "error", + error: "manual kill", + startedAt: expect.any(Number), + endedAt: expect.any(Number), + elapsedMs: expect.any(Number), + }); expect(run?.cleanupHandled).toBe(true); expect(typeof run?.cleanupCompletedAt).toBe("number"); await flushAnnounce(); diff --git a/src/gateway/server.sessions.gateway-server-sessions-a.test.ts b/src/gateway/server.sessions.gateway-server-sessions-a.test.ts index 94a673f0b06..5d6d9f190ae 100644 --- a/src/gateway/server.sessions.gateway-server-sessions-a.test.ts +++ b/src/gateway/server.sessions.gateway-server-sessions-a.test.ts @@ -590,6 +590,9 @@ describe("gateway server sessions", () => { test("sessions.create can start the first agent turn from an initial task", async () => { await createSessionStoreDir(); + // Register "ops" so the deleted-agent guard added in #65986 does not + // reject the auto-started chat.send triggered by `task:`. + testState.agentsConfig = { list: [{ id: "ops", default: true }] }; const { ws } = await openClient(); const created = await rpcReq<{