From b2d618e851c3c298dc65b29e2acea3c665fb6855 Mon Sep 17 00:00:00 2001 From: justsisyphus Date: Wed, 28 Jan 2026 14:27:34 +0900 Subject: [PATCH] fix: mock provider cache in delegate-task tests for CI stability - Add spyOn for readConnectedProvidersCache to return connected providers - Tests now work consistently regardless of actual provider cache state - Fixes CI failures for category variant and unstable agent tests --- src/tools/delegate-task/tools.test.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/tools/delegate-task/tools.test.ts b/src/tools/delegate-task/tools.test.ts index f927cf5d..39d8cf90 100644 --- a/src/tools/delegate-task/tools.test.ts +++ b/src/tools/delegate-task/tools.test.ts @@ -1,14 +1,17 @@ -import { describe, test, expect, beforeEach, afterEach } from "bun:test" +import { describe, test, expect, beforeEach, afterEach, spyOn } from "bun:test" import { DEFAULT_CATEGORIES, CATEGORY_PROMPT_APPENDS, CATEGORY_DESCRIPTIONS, isPlanAgent, PLAN_AGENT_NAMES } from "./constants" import { resolveCategoryConfig } from "./tools" import type { CategoryConfig } from "../../config/schema" import { __resetModelCache } from "../../shared/model-availability" import { clearSkillCache } from "../../features/opencode-skill-loader/skill-content" import { __setTimingConfig, __resetTimingConfig } from "./timing" +import * as connectedProvidersCache from "../../shared/connected-providers-cache" const SYSTEM_DEFAULT_MODEL = "anthropic/claude-sonnet-4-5" describe("sisyphus-task", () => { + let cacheSpy: ReturnType + beforeEach(() => { __resetModelCache() clearSkillCache() @@ -21,10 +24,12 @@ describe("sisyphus-task", () => { MAX_POLL_TIME_MS: 2000, SESSION_CONTINUATION_STABILITY_MS: 50, }) + cacheSpy = spyOn(connectedProvidersCache, "readConnectedProvidersCache").mockReturnValue(["anthropic", "google", "openai"]) }) afterEach(() => { __resetTimingConfig() + cacheSpy?.mockRestore() }) describe("DEFAULT_CATEGORIES", () => {