fix: restore green check after upstream API changes

This commit is contained in:
Peter Steinberger 2026-03-27 20:28:50 +00:00
parent 79e495a627
commit 41901c19bf
No known key found for this signature in database
9 changed files with 14 additions and 58 deletions

View File

@ -257,7 +257,6 @@ async function summarizeChunks(params: {
model,
params.reserveTokens,
params.apiKey,
params.headers,
params.signal,
effectiveInstructions,
summary,

View File

@ -1649,7 +1649,7 @@ describe("compaction-safeguard extension model fallback", () => {
messageText: "test message",
tokensBefore: 1000,
});
const { result, getApiKeyMock } = await runCompactionScenario({
const { result, getApiKeyAndHeadersMock } = await runCompactionScenario({
sessionManager,
event: mockEvent,
apiKey: null,
@ -1660,7 +1660,7 @@ describe("compaction-safeguard extension model fallback", () => {
// KEY ASSERTION: Prove the fallback path was exercised
// The handler should have resolved request auth with runtime.model
// (via ctx.model ?? runtime?.model).
expect(getApiKeyMock).toHaveBeenCalledWith(model);
expect(getApiKeyAndHeadersMock).toHaveBeenCalledWith(model);
// Verify runtime.model is still available (for completeness)
const retrieved = getCompactionSafeguardRuntime(sessionManager);
@ -1676,7 +1676,7 @@ describe("compaction-safeguard extension model fallback", () => {
messageText: "test",
tokensBefore: 500,
});
const { result, getApiKeyMock } = await runCompactionScenario({
const { result, getApiKeyAndHeadersMock } = await runCompactionScenario({
sessionManager,
event: mockEvent,
apiKey: null,
@ -1685,7 +1685,7 @@ describe("compaction-safeguard extension model fallback", () => {
expect(result).toEqual({ cancel: true });
// Verify early return: request auth should NOT have been resolved when both models are missing.
expect(getApiKeyMock).not.toHaveBeenCalled();
expect(getApiKeyAndHeadersMock).not.toHaveBeenCalled();
});
});
@ -1706,7 +1706,7 @@ describe("compaction-safeguard double-compaction guard", () => {
customInstructions: "",
signal: new AbortController().signal,
};
const { result, getApiKeyMock } = await runCompactionScenario({
const { result, getApiKeyAndHeadersMock } = await runCompactionScenario({
sessionManager,
event: mockEvent,
apiKey: "sk-test", // pragma: allowlist secret
@ -1720,7 +1720,7 @@ describe("compaction-safeguard double-compaction guard", () => {
expect(compaction.summary).toContain("## Open TODOs");
expect(compaction.firstKeptEntryId).toBe("entry-1");
expect(compaction.tokensBefore).toBe(1500);
expect(getApiKeyMock).not.toHaveBeenCalled();
expect(getApiKeyAndHeadersMock).not.toHaveBeenCalled();
});
it("returns compaction result with structured fallback summary sections", async () => {
@ -1831,13 +1831,13 @@ describe("compaction-safeguard double-compaction guard", () => {
messageText: "real message",
tokensBefore: 1500,
});
const { result, getApiKeyMock } = await runCompactionScenario({
const { result, getApiKeyAndHeadersMock } = await runCompactionScenario({
sessionManager,
event: mockEvent,
apiKey: null,
});
expect(result).toEqual({ cancel: true });
expect(getApiKeyMock).toHaveBeenCalled();
expect(getApiKeyAndHeadersMock).toHaveBeenCalled();
});
it("treats tool results as real conversation only when linked to a meaningful user ask", async () => {

View File

@ -60,13 +60,7 @@ function buildEntry(name: string): SkillEntry {
description: `${name} test skill`,
filePath: path.join(skillDir, "SKILL.md"),
baseDir: skillDir,
sourceInfo: {
path: skillDir,
source: "openclaw-workspace",
scope: "project",
origin: "package",
baseDir: skillDir,
},
source: "openclaw-workspace",
disableModelInvocation: false,
},
frontmatter: {},

View File

@ -17,13 +17,7 @@ describe("buildWorkspaceSkillStatus", () => {
description: "test",
filePath: "/tmp/os-scoped",
baseDir: "/tmp",
sourceInfo: {
path: "/tmp",
source: "test",
scope: "project",
origin: "package",
baseDir: "/tmp",
},
source: "test",
disableModelInvocation: false,
},
frontmatter: {},

View File

@ -24,13 +24,7 @@ function makeEntry(params: {
description: `desc:${params.name}`,
filePath: `/tmp/${params.name}/SKILL.md`,
baseDir: `/tmp/${params.name}`,
sourceInfo: {
path: `/tmp/${params.name}`,
source: params.source ?? "openclaw-workspace",
scope: "project",
origin: "package",
baseDir: `/tmp/${params.name}`,
},
source: params.source ?? "openclaw-workspace",
disableModelInvocation: false,
},
frontmatter: {},

View File

@ -17,13 +17,7 @@ describe("resolveSkillsPromptForRun", () => {
description: "Demo",
filePath: "/app/skills/demo-skill/SKILL.md",
baseDir: "/app/skills/demo-skill",
sourceInfo: {
path: "/app/skills/demo-skill",
source: "openclaw-bundled",
scope: "project",
origin: "package",
baseDir: "/app/skills/demo-skill",
},
source: "openclaw-bundled",
disableModelInvocation: false,
},
frontmatter: {},

View File

@ -15,13 +15,7 @@ function makeSkill(name: string, desc = "A skill", filePath = `/skills/${name}/S
description: desc,
filePath,
baseDir: `/skills/${name}`,
sourceInfo: {
path: `/skills/${name}`,
source: "workspace",
scope: "project",
origin: "package",
baseDir: `/skills/${name}`,
},
source: "workspace",
disableModelInvocation: false,
};
}

View File

@ -38,13 +38,7 @@ describe("skills-cli (e2e)", () => {
description: "Capture UI screenshots",
filePath: path.join(baseDir, "SKILL.md"),
baseDir,
sourceInfo: {
path: baseDir,
source: "openclaw-bundled",
scope: "project",
origin: "package",
baseDir,
},
source: "openclaw-bundled",
disableModelInvocation: false,
},
frontmatter: {},

View File

@ -9,13 +9,6 @@ import {
} from "./provider-auth-helpers.js";
const resolveAuthAgentDir = (agentDir?: string) => agentDir ?? resolveOpenClawAgentDir();
const ZAI_DEFAULT_MODEL_REF = "zai/glm-5";
const XIAOMI_DEFAULT_MODEL_REF = "xiaomi/mimo-v2-flash";
const OPENROUTER_DEFAULT_MODEL_REF = "openrouter/auto";
const HUGGINGFACE_DEFAULT_MODEL_REF = "huggingface/deepseek-ai/DeepSeek-R1";
const TOGETHER_DEFAULT_MODEL_REF = "together/moonshotai/Kimi-K2.5";
const LITELLM_DEFAULT_MODEL_REF = "litellm/claude-opus-4-6";
const VERCEL_AI_GATEWAY_DEFAULT_MODEL_REF = "vercel-ai-gateway/anthropic/claude-opus-4.6";
type ProviderApiKeySetter = (
key: SecretInput,