fix: harden flaky tests and cover native google thought signatures (#23457) (thanks @echoVic)

This commit is contained in:
Peter Steinberger
2026-02-22 12:22:38 +01:00
parent 9176571ec1
commit 401106b963
9 changed files with 110 additions and 13 deletions

View File

@@ -1,10 +1,11 @@
import { beforeEach, describe, expect, it, vi } from "vitest";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import "./test-helpers/fast-core-tools.js";
import {
getCallGatewayMock,
getSessionsSpawnTool,
setSessionsSpawnConfigOverride,
} from "./openclaw-tools.subagents.sessions-spawn.test-harness.js";
import { resetSubagentRegistryForTests } from "./subagent-registry.js";
const hookRunnerMocks = vi.hoisted(() => ({
hasSubagentEndedHook: true,
@@ -79,6 +80,7 @@ function mockAgentStartFailure() {
describe("sessions_spawn subagent lifecycle hooks", () => {
beforeEach(() => {
resetSubagentRegistryForTests();
hookRunnerMocks.hasSubagentEndedHook = true;
hookRunnerMocks.runSubagentSpawning.mockClear();
hookRunnerMocks.runSubagentSpawned.mockClear();
@@ -103,6 +105,10 @@ describe("sessions_spawn subagent lifecycle hooks", () => {
});
});
afterEach(() => {
resetSubagentRegistryForTests();
});
it("runs subagent_spawning and emits subagent_spawned with requester metadata", async () => {
const tool = await getSessionsSpawnTool({
agentSessionKey: "main",