From 2912b6598ca43d6eb31117cefe56d735ce0672d1 Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Thu, 12 Mar 2026 11:05:31 +0900 Subject: [PATCH] fix: address Cubic findings for provider preserve fallback - Reorder resolveFallbackProviderID: providerHint now checked before global connected-provider cache - Revert require('bun:test') hack to standard ESM import in fallback-chain-from-models.test.ts Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus --- src/plugin/event.ts | 10 +++++----- src/shared/fallback-chain-from-models.test.ts | 3 +-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/plugin/event.ts b/src/plugin/event.ts index 1e3e5e176..096d6a64f 100644 --- a/src/plugin/event.ts +++ b/src/plugin/event.ts @@ -177,16 +177,16 @@ export function createEventHandler(args: { return lastKnownModel.providerID; } - const connectedProvider = readConnectedProvidersCache()?.[0]; - if (connectedProvider) { - return connectedProvider; - } - const normalizedProviderHint = providerHint?.trim(); if (normalizedProviderHint) { return normalizedProviderHint; } + const connectedProvider = readConnectedProvidersCache()?.[0]; + if (connectedProvider) { + return connectedProvider; + } + return "opencode"; }; diff --git a/src/shared/fallback-chain-from-models.test.ts b/src/shared/fallback-chain-from-models.test.ts index ca605f809..cdfbb9daf 100644 --- a/src/shared/fallback-chain-from-models.test.ts +++ b/src/shared/fallback-chain-from-models.test.ts @@ -1,5 +1,4 @@ -declare const require: (name: string) => any -const { describe, test, expect } = require("bun:test") +import { describe, test, expect } from "bun:test" import { buildFallbackChainFromModels, parseFallbackModelEntry } from "./fallback-chain-from-models" describe("fallback-chain-from-models", () => {