test: fix gate regressions

This commit is contained in:
Peter Steinberger
2026-02-24 04:39:29 +00:00
parent 2d6d6797d8
commit 31f2bf9519
6 changed files with 53 additions and 41 deletions

View File

@@ -19,6 +19,25 @@ const unitIsolatedFilesRaw = [
"src/auto-reply/tool-meta.test.ts", "src/auto-reply/tool-meta.test.ts",
"src/auto-reply/envelope.test.ts", "src/auto-reply/envelope.test.ts",
"src/commands/auth-choice.test.ts", "src/commands/auth-choice.test.ts",
// Process supervision + docker setup suites are stable but setup-heavy.
"src/process/supervisor/supervisor.test.ts",
"src/docker-setup.test.ts",
// Filesystem-heavy skills sync suite.
"src/agents/skills.build-workspace-skills-prompt.syncs-merged-skills-into-target-workspace.test.ts",
// Real git hook integration test; keep signal, move off unit-fast critical path.
"test/git-hooks-pre-commit.test.ts",
// Setup-heavy doctor command suites; keep them off the unit-fast critical path.
"src/commands/doctor.warns-state-directory-is-missing.test.ts",
"src/commands/doctor.warns-per-agent-sandbox-docker-browser-prune.test.ts",
"src/commands/doctor.runs-legacy-state-migrations-yes-mode-without.test.ts",
// Setup-heavy CLI update flow suite; move off unit-fast critical path.
"src/cli/update-cli.test.ts",
// Expensive schema build/bootstrap checks; keep coverage but run in isolated lane.
"src/config/schema.test.ts",
"src/config/schema.tags.test.ts",
// CLI smoke/agent flows are stable but setup-heavy.
"src/cli/program.smoke.test.ts",
"src/commands/agent.test.ts",
"src/media/store.test.ts", "src/media/store.test.ts",
"src/media/store.header-ext.test.ts", "src/media/store.header-ext.test.ts",
"src/web/media.test.ts", "src/web/media.test.ts",
@@ -210,7 +229,7 @@ const defaultWorkerBudget =
unit: Math.max(4, Math.min(14, Math.floor((localWorkers * 7) / 8))), unit: Math.max(4, Math.min(14, Math.floor((localWorkers * 7) / 8))),
unitIsolated: Math.max(1, Math.min(2, Math.floor(localWorkers / 6) || 1)), unitIsolated: Math.max(1, Math.min(2, Math.floor(localWorkers / 6) || 1)),
extensions: Math.max(1, Math.min(4, Math.floor(localWorkers / 4))), extensions: Math.max(1, Math.min(4, Math.floor(localWorkers / 4))),
gateway: Math.max(2, Math.min(4, Math.floor(localWorkers / 3))), gateway: Math.max(2, Math.min(6, Math.floor(localWorkers / 2))),
} }
: lowMemLocalHost : lowMemLocalHost
? { ? {

View File

@@ -112,7 +112,7 @@ async function runReasoningDefaultCase(params: {
describe("directive behavior", () => { describe("directive behavior", () => {
installDirectiveBehaviorE2EHooks(); installDirectiveBehaviorE2EHooks();
it("shows /think defaults for reasoning and non-reasoning models", async () => { it("covers /think status and reasoning defaults for reasoning and non-reasoning models", async () => {
await withTempHome(async (home) => { await withTempHome(async (home) => {
await expectThinkStatusForReasoningModel({ await expectThinkStatusForReasoningModel({
home, home,
@@ -125,6 +125,25 @@ describe("directive behavior", () => {
expectedLevel: "off", expectedLevel: "off",
}); });
expect(runEmbeddedPiAgent).not.toHaveBeenCalled(); expect(runEmbeddedPiAgent).not.toHaveBeenCalled();
vi.mocked(runEmbeddedPiAgent).mockClear();
for (const scenario of [
{
expectedThinkLevel: "low" as const,
expectedReasoningLevel: "off" as const,
},
{
expectedThinkLevel: "off" as const,
expectedReasoningLevel: "on" as const,
thinkingDefault: "off" as const,
},
]) {
await runReasoningDefaultCase({
home,
...scenario,
});
}
}); });
}); });
it("renders model list and status variants across catalog/config combinations", async () => { it("renders model list and status variants across catalog/config combinations", async () => {
@@ -282,26 +301,6 @@ describe("directive behavior", () => {
expect(runEmbeddedPiAgent).toHaveBeenCalledOnce(); expect(runEmbeddedPiAgent).toHaveBeenCalledOnce();
}); });
}); });
it("applies reasoning defaults based on thinkingDefault configuration", async () => {
await withTempHome(async (home) => {
for (const scenario of [
{
expectedThinkLevel: "low" as const,
expectedReasoningLevel: "off" as const,
},
{
expectedThinkLevel: "off" as const,
expectedReasoningLevel: "on" as const,
thinkingDefault: "off" as const,
},
]) {
await runReasoningDefaultCase({
home,
...scenario,
});
}
});
});
it("passes elevated defaults when sender is approved", async () => { it("passes elevated defaults when sender is approved", async () => {
await withTempHome(async (home) => { await withTempHome(async (home) => {
mockEmbeddedTextResult("done"); mockEmbeddedTextResult("done");

View File

@@ -64,14 +64,16 @@ describe("browser control server", () => {
}); });
expect(nav.ok).toBe(true); expect(nav.ok).toBe(true);
expect(typeof nav.targetId).toBe("string"); expect(typeof nav.targetId).toBe("string");
expect(pwMocks.navigateViaPlaywright).toHaveBeenCalledWith({ expect(pwMocks.navigateViaPlaywright).toHaveBeenCalledWith(
cdpUrl: state.cdpBaseUrl, expect.objectContaining({
targetId: "abcd1234", cdpUrl: state.cdpBaseUrl,
url: "https://example.com", targetId: "abcd1234",
ssrfPolicy: { url: "https://example.com",
dangerouslyAllowPrivateNetwork: true, ssrfPolicy: {
}, dangerouslyAllowPrivateNetwork: true,
}); },
}),
);
const click = await postJson<{ ok: boolean }>(`${base}/act`, { const click = await postJson<{ ok: boolean }>(`${base}/act`, {
kind: "click", kind: "click",

View File

@@ -636,14 +636,6 @@ describe("update-cli", () => {
} }
}); });
it("updateCommand skips restart when --no-restart is set", async () => {
vi.mocked(runGatewayUpdate).mockResolvedValue(makeOkUpdateResult());
await updateCommand({ restart: false });
expect(runDaemonRestart).not.toHaveBeenCalled();
});
it("updateCommand skips success message when restart does not run", async () => { it("updateCommand skips success message when restart does not run", async () => {
vi.mocked(runGatewayUpdate).mockResolvedValue(makeOkUpdateResult()); vi.mocked(runGatewayUpdate).mockResolvedValue(makeOkUpdateResult());
vi.mocked(runDaemonRestart).mockResolvedValue(false); vi.mocked(runDaemonRestart).mockResolvedValue(false);

View File

@@ -134,7 +134,7 @@ describe("config io write", () => {
logger: silentLogger, logger: silentLogger,
}); });
const invalidConfig = { const invalidConfig: OpenClawConfig = {
channels: { channels: {
telegram: { telegram: {
dmPolicy: "open", dmPolicy: "open",

View File

@@ -105,12 +105,12 @@ describe("runCommandWithTimeout", () => {
"clearInterval(ticker);", "clearInterval(ticker);",
"process.exit(0);", "process.exit(0);",
"}", "}",
"}, 40);", "}, 12);",
].join(" "), ].join(" "),
], ],
{ {
timeoutMs: 5_000, timeoutMs: 5_000,
noOutputTimeoutMs: 1_500, noOutputTimeoutMs: 120,
}, },
); );