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>
This commit is contained in:
Omar Shahine
2026-04-19 20:45:19 -07:00
committed by GitHub
parent fd90c30c23
commit 97492cf602
2 changed files with 10 additions and 1 deletions

View File

@@ -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();

View File

@@ -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<{