feat(config): disable runtime_fallback by default (opt-in)
This commit is contained in:
parent
309869a79f
commit
976798d0e3
@ -551,7 +551,7 @@ Auto-switches to backup models on API errors.
|
|||||||
|
|
||||||
| Option | Default | Description |
|
| Option | Default | Description |
|
||||||
|--------|---------|-------------|
|
|--------|---------|-------------|
|
||||||
| `enabled` | `true` | Enable runtime fallback |
|
| `enabled` | `false` | Enable runtime fallback |
|
||||||
| `retry_on_errors` | `[400,429,503,529]` | HTTP codes that trigger fallback. Also handles classified provider key errors. |
|
| `retry_on_errors` | `[400,429,503,529]` | HTTP codes that trigger fallback. Also handles classified provider key errors. |
|
||||||
| `max_fallback_attempts` | `3` | Max fallback attempts per session (1–20) |
|
| `max_fallback_attempts` | `3` | Max fallback attempts per session (1–20) |
|
||||||
| `cooldown_seconds` | `60` | Seconds before retrying a failed model |
|
| `cooldown_seconds` | `60` | Seconds before retrying a failed model |
|
||||||
|
|||||||
@ -45,7 +45,7 @@ export const OhMyOpenCodeConfigSchema = z.object({
|
|||||||
skills: SkillsConfigSchema.optional(),
|
skills: SkillsConfigSchema.optional(),
|
||||||
ralph_loop: RalphLoopConfigSchema.optional(),
|
ralph_loop: RalphLoopConfigSchema.optional(),
|
||||||
/**
|
/**
|
||||||
* Enable runtime fallback (default: true)
|
* Enable runtime fallback (default: false)
|
||||||
* Set to false to disable, or use object for advanced config:
|
* Set to false to disable, or use object for advanced config:
|
||||||
* { "enabled": true, "retry_on_errors": [400, 429], "timeout_seconds": 30 }
|
* { "enabled": true, "retry_on_errors": [400, 429], "timeout_seconds": 30 }
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { z } from "zod"
|
import { z } from "zod"
|
||||||
|
|
||||||
export const RuntimeFallbackConfigSchema = z.object({
|
export const RuntimeFallbackConfigSchema = z.object({
|
||||||
/** Enable runtime fallback (default: true) */
|
/** Enable runtime fallback (default: false) */
|
||||||
enabled: z.boolean().optional(),
|
enabled: z.boolean().optional(),
|
||||||
/** HTTP status codes that trigger fallback (default: [400, 429, 503, 529]) */
|
/** HTTP status codes that trigger fallback (default: [400, 429, 503, 529]) */
|
||||||
retry_on_errors: z.array(z.number()).optional(),
|
retry_on_errors: z.array(z.number()).optional(),
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import type { RuntimeFallbackConfig } from "../../config"
|
|||||||
* Default configuration values for runtime fallback
|
* Default configuration values for runtime fallback
|
||||||
*/
|
*/
|
||||||
export const DEFAULT_CONFIG: Required<RuntimeFallbackConfig> = {
|
export const DEFAULT_CONFIG: Required<RuntimeFallbackConfig> = {
|
||||||
enabled: true,
|
enabled: false,
|
||||||
retry_on_errors: [429, 500, 502, 503, 504],
|
retry_on_errors: [429, 500, 502, 503, 504],
|
||||||
max_fallback_attempts: 3,
|
max_fallback_attempts: 3,
|
||||||
cooldown_seconds: 60,
|
cooldown_seconds: 60,
|
||||||
|
|||||||
@ -64,7 +64,7 @@ export function createChatMessageHandler(args: {
|
|||||||
hooks.runtimeFallback !== undefined &&
|
hooks.runtimeFallback !== undefined &&
|
||||||
(typeof pluginConfig.runtime_fallback === "boolean"
|
(typeof pluginConfig.runtime_fallback === "boolean"
|
||||||
? pluginConfig.runtime_fallback
|
? pluginConfig.runtime_fallback
|
||||||
: (pluginConfig.runtime_fallback?.enabled ?? true))
|
: (pluginConfig.runtime_fallback?.enabled ?? false))
|
||||||
|
|
||||||
return async (
|
return async (
|
||||||
input: ChatMessageInput,
|
input: ChatMessageInput,
|
||||||
|
|||||||
@ -123,7 +123,7 @@ export function createEventHandler(args: {
|
|||||||
hooks.runtimeFallback !== undefined &&
|
hooks.runtimeFallback !== undefined &&
|
||||||
(typeof args.pluginConfig.runtime_fallback === "boolean"
|
(typeof args.pluginConfig.runtime_fallback === "boolean"
|
||||||
? args.pluginConfig.runtime_fallback
|
? args.pluginConfig.runtime_fallback
|
||||||
: (args.pluginConfig.runtime_fallback?.enabled ?? true))
|
: (args.pluginConfig.runtime_fallback?.enabled ?? false))
|
||||||
|
|
||||||
// Avoid triggering multiple abort+continue cycles for the same failing assistant message.
|
// Avoid triggering multiple abort+continue cycles for the same failing assistant message.
|
||||||
const lastHandledModelErrorMessageID = new Map<string, string>()
|
const lastHandledModelErrorMessageID = new Map<string, string>()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user