diff --git a/docs/features.md b/docs/features.md index 67cca007..11a483aa 100644 --- a/docs/features.md +++ b/docs/features.md @@ -352,7 +352,7 @@ Hooks intercept and modify behavior at key points in the agent lifecycle. | **session-recovery** | Stop | Recovers from session errors - missing tool results, thinking block issues, empty messages. | | **anthropic-context-window-limit-recovery** | Stop | Handles Claude context window limits gracefully. | | **background-compaction** | Stop | Auto-compacts sessions hitting token limits. | -| **runtime-fallback** | Stop | Automatically switches to fallback models on API errors (429, 503, 529). Configurable via `runtime_fallback` and `fallback_models`. | +| **runtime-fallback** | Event | Automatically switches to fallback models on API errors (429, 503, 529). Configurable via `runtime_fallback` and `fallback_models`, with retry logic and cooldown. | #### Truncation & Context Management diff --git a/src/config/schema/oh-my-opencode-config.ts b/src/config/schema/oh-my-opencode-config.ts index d2179b15..ddbbf724 100644 --- a/src/config/schema/oh-my-opencode-config.ts +++ b/src/config/schema/oh-my-opencode-config.ts @@ -45,6 +45,7 @@ export const OhMyOpenCodeConfigSchema = z.object({ auto_update: z.boolean().optional(), skills: SkillsConfigSchema.optional(), ralph_loop: RalphLoopConfigSchema.optional(), + runtime_fallback: RuntimeFallbackConfigSchema.optional(), background_task: BackgroundTaskConfigSchema.optional(), notification: NotificationConfigSchema.optional(), babysitting: BabysittingConfigSchema.optional(), diff --git a/src/plugin/hooks/create-session-hooks.ts b/src/plugin/hooks/create-session-hooks.ts index 95356534..3e395371 100644 --- a/src/plugin/hooks/create-session-hooks.ts +++ b/src/plugin/hooks/create-session-hooks.ts @@ -179,9 +179,11 @@ export function createSessionHooks(args: { const runtimeFallback = isHookEnabled("runtime-fallback") ? safeHook("runtime-fallback", () => - createRuntimeFallbackHook(ctx, { config: pluginConfig.runtime_fallback })) + createRuntimeFallbackHook(ctx, { + config: pluginConfig.runtime_fallback, + pluginConfig, + })) : null - return { contextWindowMonitor, preemptiveCompaction,