fix: restore gate after rebase

This commit is contained in:
Peter Steinberger
2026-03-08 18:39:37 +00:00
parent c5095153b0
commit 3ada30e670
4 changed files with 26 additions and 14 deletions

View File

@@ -123,7 +123,9 @@ const testProfile =
rawTestProfile === "serial"
? rawTestProfile
: "normal";
const shouldSplitUnitRuns = testProfile !== "low" && testProfile !== "serial";
// Even on low-memory hosts, keep the isolated lane split so files like
// git-commit.test.ts still get the worker/process isolation they require.
const shouldSplitUnitRuns = testProfile !== "serial";
const runs = [
...(shouldSplitUnitRuns
? [

View File

@@ -914,7 +914,7 @@ describe("applyExtraParamsToAgent", () => {
compat: {
requiresOpenAiAnthropicToolPayload: true,
},
} as Model<"anthropic-messages">;
} as unknown as Model<"anthropic-messages">;
const context: Context = { messages: [] };
void agent.streamFn?.(model, context, {});

View File

@@ -157,5 +157,5 @@ export function resolveTranscriptToolCallIdMode(
if (modelIncludesAnyHint(modelId, capabilities.transcriptToolCallIdModelHints)) {
return "strict9";
}
return mode === "strict9" ? mode : undefined;
return undefined;
}

View File

@@ -3,8 +3,8 @@ import fs from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import process from "node:process";
import { pathToFileURL } from "node:url";
import { afterEach, describe, expect, it, vi } from "vitest";
import { fileURLToPath, pathToFileURL } from "node:url";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
async function makeTempDir(label: string): Promise<string> {
return fs.mkdtemp(path.join(os.tmpdir(), `openclaw-${label}-`));
@@ -39,10 +39,20 @@ async function makeFakeGitRepo(
}
describe("git commit resolution", () => {
const originalCwd = process.cwd();
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../..");
beforeEach(async () => {
process.chdir(repoRoot);
vi.restoreAllMocks();
vi.doUnmock("node:fs");
vi.doUnmock("node:module");
vi.resetModules();
const { __testing } = await import("./git-commit.js");
__testing.clearCachedGitCommits();
});
afterEach(async () => {
process.chdir(originalCwd);
process.chdir(repoRoot);
vi.restoreAllMocks();
vi.doUnmock("node:fs");
vi.doUnmock("node:module");
@@ -53,7 +63,7 @@ describe("git commit resolution", () => {
it("resolves commit metadata from the caller module root instead of the caller cwd", async () => {
const repoHead = execFileSync("git", ["rev-parse", "--short=7", "HEAD"], {
cwd: originalCwd,
cwd: repoRoot,
encoding: "utf-8",
}).trim();
@@ -75,7 +85,7 @@ describe("git commit resolution", () => {
process.chdir(otherRepo);
const { resolveCommitHash } = await import("./git-commit.js");
const entryModuleUrl = pathToFileURL(path.join(originalCwd, "src", "entry.ts")).href;
const entryModuleUrl = pathToFileURL(path.join(repoRoot, "src", "entry.ts")).href;
expect(resolveCommitHash({ moduleUrl: entryModuleUrl })).toBe(repoHead);
expect(resolveCommitHash({ moduleUrl: entryModuleUrl })).not.toBe(otherHead);
@@ -83,12 +93,12 @@ describe("git commit resolution", () => {
it("prefers live git metadata over stale build info in a real checkout", async () => {
const repoHead = execFileSync("git", ["rev-parse", "--short=7", "HEAD"], {
cwd: originalCwd,
cwd: repoRoot,
encoding: "utf-8",
}).trim();
const { resolveCommitHash } = await import("./git-commit.js");
const entryModuleUrl = pathToFileURL(path.join(originalCwd, "src", "entry.ts")).href;
const entryModuleUrl = pathToFileURL(path.join(repoRoot, "src", "entry.ts")).href;
expect(
resolveCommitHash({
@@ -149,16 +159,16 @@ describe("git commit resolution", () => {
it("treats invalid moduleUrl inputs as a fallback hint instead of throwing", async () => {
const repoHead = execFileSync("git", ["rev-parse", "--short=7", "HEAD"], {
cwd: originalCwd,
cwd: repoRoot,
encoding: "utf-8",
}).trim();
const { resolveCommitHash } = await import("./git-commit.js");
expect(() =>
resolveCommitHash({ moduleUrl: "not-a-file-url", cwd: originalCwd, env: {} }),
resolveCommitHash({ moduleUrl: "not-a-file-url", cwd: repoRoot, env: {} }),
).not.toThrow();
expect(resolveCommitHash({ moduleUrl: "not-a-file-url", cwd: originalCwd, env: {} })).toBe(
expect(resolveCommitHash({ moduleUrl: "not-a-file-url", cwd: repoRoot, env: {} })).toBe(
repoHead,
);
});