|
|
@@ -139,6 +139,7 @@ const OhMyOpenCodeLite: Plugin = async (ctx) => {
|
|
|
let agents: ReturnType<typeof getAgentConfigs>;
|
|
|
let mcps: ReturnType<typeof createBuiltinMcps>;
|
|
|
let modelArrayMap: Record<string, Array<{ id: string; variant?: string }>>;
|
|
|
+ let everModelSwitched: Set<string>;
|
|
|
let runtimeChains: Record<string, string[]>;
|
|
|
let multiplexerConfig: MultiplexerConfig;
|
|
|
let multiplexerEnabled: boolean;
|
|
|
@@ -213,6 +214,7 @@ const OhMyOpenCodeLite: Plugin = async (ctx) => {
|
|
|
string,
|
|
|
Array<{ id: string; variant?: string }>
|
|
|
>;
|
|
|
+ everModelSwitched = new Set<string>();
|
|
|
runtimeChains = {} as Record<string, string[]>;
|
|
|
for (const agentDef of agentDefs) {
|
|
|
if (agentDef._modelArray?.length) {
|
|
|
@@ -561,13 +563,17 @@ const OhMyOpenCodeLite: Plugin = async (ctx) => {
|
|
|
const existing = (opencodeConfig.agent as Record<string, unknown>)[
|
|
|
name
|
|
|
] as Record<string, unknown> | undefined;
|
|
|
- // User picked a model via /model → disable fallback for that agent.
|
|
|
+ // User explicitly picked a model via /model → disable fallback.
|
|
|
+ // Only marks the agent if the model differs from the chain primary.
|
|
|
+ // Once marked, stays disabled even if user switches back to chain[0].
|
|
|
if (existing && typeof existing.model === 'string') {
|
|
|
- foregroundFallback.disableChain(name);
|
|
|
- log('[plugin] disabled fallback chain for model-switched agent', {
|
|
|
- agent: name,
|
|
|
- model: existing.model,
|
|
|
- });
|
|
|
+ const primary = modelArrayMap[name]?.[0]?.id;
|
|
|
+ if (primary && existing.model !== primary) {
|
|
|
+ everModelSwitched.add(name);
|
|
|
+ }
|
|
|
+ if (everModelSwitched.has(name)) {
|
|
|
+ foregroundFallback.disableChain(name);
|
|
|
+ }
|
|
|
}
|
|
|
if (existing) {
|
|
|
// Shallow merge: plugin defaults first, user overrides win
|