fix: address Codex harness review regressions

This commit is contained in:
Peter Steinberger
2026-04-10 17:17:19 +01:00
parent b79f9f965e
commit 106256d896
6 changed files with 172 additions and 12 deletions

View File

@@ -63,7 +63,8 @@ async function prewarmConfiguredPrimaryModel(params: {
if (isCliProvider(provider, params.cfg)) {
return;
}
if (resolveEmbeddedAgentRuntime() !== "auto") {
const runtime = resolveEmbeddedAgentRuntime();
if (runtime !== "auto" && runtime !== "pi") {
return;
}
if (selectAgentHarness({ provider, modelId: model }).id !== "pi") {

View File

@@ -167,4 +167,29 @@ describe("gateway startup primary model warmup", () => {
expect(ensureOpenClawModelsJsonMock).not.toHaveBeenCalled();
expect(resolveModelMock).not.toHaveBeenCalled();
});
it("keeps PI static warmup when the PI agent runtime is forced", async () => {
resolveEmbeddedAgentRuntimeMock.mockReturnValue("pi");
const cfg = {
agents: {
defaults: {
model: {
primary: "openai-codex/gpt-5.4",
},
},
},
} as OpenClawConfig;
await prewarmConfiguredPrimaryModel({
cfg,
log: { warn: vi.fn() },
});
expect(selectAgentHarnessMock).toHaveBeenCalledWith({
provider: "openai-codex",
modelId: "gpt-5.4",
});
expect(ensureOpenClawModelsJsonMock).toHaveBeenCalledWith(cfg, "/tmp/agent");
expect(resolveModelMock).toHaveBeenCalled();
});
});