From 6a97f00a22459612918cc1760508309ed7ef30a6 Mon Sep 17 00:00:00 2001 From: Youngbin Kim <64558592+youngbinkim0@users.noreply.github.com> Date: Thu, 12 Feb 2026 13:10:55 -0500 Subject: [PATCH] feat(runtime-fallback): add configurable session timeout controls --- src/config/schema/runtime-fallback.ts | 2 ++ src/hooks/runtime-fallback/constants.ts | 1 + src/hooks/runtime-fallback/types.ts | 2 ++ 3 files changed, 5 insertions(+) diff --git a/src/config/schema/runtime-fallback.ts b/src/config/schema/runtime-fallback.ts index 6c25a113..3089d28b 100644 --- a/src/config/schema/runtime-fallback.ts +++ b/src/config/schema/runtime-fallback.ts @@ -9,6 +9,8 @@ export const RuntimeFallbackConfigSchema = z.object({ max_fallback_attempts: z.number().min(1).max(20).optional(), /** Cooldown in seconds before retrying a failed model (default: 60) */ cooldown_seconds: z.number().min(0).optional(), + /** Session-level timeout in seconds to advance fallback when provider hangs (default: 30) */ + timeout_seconds: z.number().min(1).optional(), /** Show toast notification when switching to fallback model (default: true) */ notify_on_fallback: z.boolean().optional(), }) diff --git a/src/hooks/runtime-fallback/constants.ts b/src/hooks/runtime-fallback/constants.ts index e0ea1fb5..a49831fb 100644 --- a/src/hooks/runtime-fallback/constants.ts +++ b/src/hooks/runtime-fallback/constants.ts @@ -14,6 +14,7 @@ export const DEFAULT_CONFIG: Required = { retry_on_errors: [400, 429, 503, 529], max_fallback_attempts: 3, cooldown_seconds: 60, + timeout_seconds: 30, notify_on_fallback: true, } diff --git a/src/hooks/runtime-fallback/types.ts b/src/hooks/runtime-fallback/types.ts index 3ff6334a..5cb28504 100644 --- a/src/hooks/runtime-fallback/types.ts +++ b/src/hooks/runtime-fallback/types.ts @@ -58,6 +58,8 @@ export interface RuntimeFallbackOptions { config?: RuntimeFallbackConfig /** Optional plugin config override (primarily for testing) */ pluginConfig?: OhMyOpenCodeConfig + /** Optional session-level timeout override in milliseconds (primarily for testing) */ + session_timeout_ms?: number } export interface RuntimeFallbackHook {