fix(model-availability): honor connected providers for fallback

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
YeonGyu-Kim
2026-02-04 16:00:16 +09:00
parent d099b0255f
commit 80297f890e
4 changed files with 36 additions and 15 deletions
+6 -2
View File
@@ -228,11 +228,12 @@ describe("createBuiltinAgents without systemDefaultModel", () => {
})
describe("createBuiltinAgents with requiresModel gating", () => {
test("hephaestus is not created when gpt-5.2-codex is unavailable", async () => {
test("hephaestus is not created when gpt-5.2-codex is unavailable and provider not connected", async () => {
// #given
const fetchSpy = spyOn(shared, "fetchAvailableModels").mockResolvedValue(
new Set(["anthropic/claude-opus-4-5"])
)
const cacheSpy = spyOn(connectedProvidersCache, "readConnectedProvidersCache").mockReturnValue([])
try {
// #when
@@ -242,6 +243,7 @@ describe("createBuiltinAgents with requiresModel gating", () => {
expect(agents.hephaestus).toBeUndefined()
} finally {
fetchSpy.mockRestore()
cacheSpy.mockRestore()
}
})
@@ -355,11 +357,12 @@ describe("createBuiltinAgents with requiresAnyModel gating (sisyphus)", () => {
}
})
test("sisyphus is not created when no fallback model is available (unrelated model only)", async () => {
test("sisyphus is not created when no fallback model is available and provider not connected", async () => {
// #given - only openai/gpt-5.2 available, not in sisyphus fallback chain
const fetchSpy = spyOn(shared, "fetchAvailableModels").mockResolvedValue(
new Set(["openai/gpt-5.2"])
)
const cacheSpy = spyOn(connectedProvidersCache, "readConnectedProvidersCache").mockReturnValue([])
try {
// #when
@@ -369,6 +372,7 @@ describe("createBuiltinAgents with requiresAnyModel gating (sisyphus)", () => {
expect(agents.sisyphus).toBeUndefined()
} finally {
fetchSpy.mockRestore()
cacheSpy.mockRestore()
}
})
})
+1 -1
View File
@@ -395,7 +395,7 @@ export async function createBuiltinAgents(
!hephaestusRequirement?.requiresModel ||
hasHephaestusExplicitConfig ||
isFirstRunNoCache ||
(availableModels.size > 0 && isModelAvailable(hephaestusRequirement.requiresModel, availableModels))
isAnyFallbackModelAvailable(hephaestusRequirement.fallbackChain, availableModels)
if (hasRequiredModel) {
let hephaestusResolution = applyModelResolution({