From 768dd92e9373ce5946b905ef8cec1bdaabe0ea10 Mon Sep 17 00:00:00 2001 From: marcusquinn <6428977+marcusquinn@users.noreply.github.com> Date: Mon, 9 Feb 2026 18:37:06 +0000 Subject: [PATCH 1/3] fix: redirect all supervisor log functions to stderr log_info, log_success, log_warn, and log_verbose were writing to stdout, which polluted return values of functions like resolve_task_model() when captured via $() subshells. This caused ProviderModelNotFoundError in all worker dispatches because the model string contained ANSI-colored log lines prepended to the actual model identifier. log_error already used >&2 correctly. Now all log functions follow the Unix convention: logs to stderr, data to stdout. --- .agents/scripts/supervisor-helper.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.agents/scripts/supervisor-helper.sh b/.agents/scripts/supervisor-helper.sh index a3e6a6889e..f241465020 100755 --- a/.agents/scripts/supervisor-helper.sh +++ b/.agents/scripts/supervisor-helper.sh @@ -227,11 +227,11 @@ readonly -a VALID_TRANSITIONS=( readonly BOLD='\033[1m' -log_info() { echo -e "${BLUE}[SUPERVISOR]${NC} $*"; } -log_success() { echo -e "${GREEN}[SUPERVISOR]${NC} $*"; } -log_warn() { echo -e "${YELLOW}[SUPERVISOR]${NC} $*"; } +log_info() { echo -e "${BLUE}[SUPERVISOR]${NC} $*" >&2; } +log_success() { echo -e "${GREEN}[SUPERVISOR]${NC} $*" >&2; } +log_warn() { echo -e "${YELLOW}[SUPERVISOR]${NC} $*" >&2; } log_error() { echo -e "${RED}[SUPERVISOR]${NC} $*" >&2; } -log_verbose() { [[ "${SUPERVISOR_VERBOSE:-}" == "true" ]] && echo -e "${BLUE}[SUPERVISOR]${NC} $*" || true; } +log_verbose() { [[ "${SUPERVISOR_VERBOSE:-}" == "true" ]] && echo -e "${BLUE}[SUPERVISOR]${NC} $*" >&2 || true; } # Check GitHub authentication in a way that works with GH_TOKEN env var. # gh auth status may fail in cron even when GH_TOKEN is valid (keyring issues). From aa4dc4dd678c3bb5c44e726b049055dbd3698b96 Mon Sep 17 00:00:00 2001 From: marcusquinn <6428977+marcusquinn@users.noreply.github.com> Date: Mon, 9 Feb 2026 18:41:37 +0000 Subject: [PATCH 2/3] fix: remove openrouter/openai from fallback chains, update stale model IDs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CRITICAL: openrouter dispatch was draining budget — all fallback chains now use only anthropic/ and google/ providers (the only ones configured in OpenCode). Also updated stale model IDs: - haiku: claude-3-5-haiku-20241022 -> claude-haiku-4-5 - flash: gemini-2.5-flash-preview-05-20 -> gemini-2.5-flash - pro: gemini-2.5-pro-preview-06-05 -> gemini-2.5-pro - sonnet: claude-sonnet-4-20250514 -> claude-sonnet-4-5 Removed xai/grok-3 tier (not configured). --- .agents/scripts/fallback-chain-helper.sh | 14 +++++++------- .agents/scripts/supervisor-helper.sh | 9 +++------ 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/.agents/scripts/fallback-chain-helper.sh b/.agents/scripts/fallback-chain-helper.sh index 5df24f124a..3ad4418e41 100755 --- a/.agents/scripts/fallback-chain-helper.sh +++ b/.agents/scripts/fallback-chain-helper.sh @@ -257,13 +257,13 @@ get_chain_for_tier() { # Use the existing model-availability-helper.sh tier mapping local tier_spec="" case "$tier" in - haiku) tier_spec='["anthropic/claude-3-5-haiku-20241022","google/gemini-2.5-flash","openrouter/anthropic/claude-3-5-haiku-20241022"]' ;; - flash) tier_spec='["google/gemini-2.5-flash","openai/gpt-4.1-mini","openrouter/google/gemini-2.5-flash"]' ;; - sonnet) tier_spec='["anthropic/claude-sonnet-4-20250514","openai/gpt-4.1","openrouter/anthropic/claude-sonnet-4-20250514"]' ;; - pro) tier_spec='["google/gemini-2.5-pro","anthropic/claude-sonnet-4-20250514","openrouter/google/gemini-2.5-pro"]' ;; - opus) tier_spec='["anthropic/claude-opus-4-6","openai/o3","openrouter/anthropic/claude-opus-4-6"]' ;; - coding) tier_spec='["anthropic/claude-opus-4-6","openai/o3","openrouter/anthropic/claude-opus-4-6"]' ;; - eval) tier_spec='["anthropic/claude-sonnet-4-5","google/gemini-2.5-flash","openrouter/anthropic/claude-sonnet-4-5"]' ;; + haiku) tier_spec='["anthropic/claude-haiku-4-5","google/gemini-2.5-flash"]' ;; + flash) tier_spec='["google/gemini-2.5-flash","anthropic/claude-haiku-4-5"]' ;; + sonnet) tier_spec='["anthropic/claude-sonnet-4-5","google/gemini-2.5-pro"]' ;; + pro) tier_spec='["google/gemini-2.5-pro","anthropic/claude-sonnet-4-5"]' ;; + opus) tier_spec='["anthropic/claude-opus-4-6","google/gemini-2.5-pro"]' ;; + coding) tier_spec='["anthropic/claude-opus-4-6","google/gemini-2.5-pro"]' ;; + eval) tier_spec='["anthropic/claude-sonnet-4-5","google/gemini-2.5-flash"]' ;; health) tier_spec='["anthropic/claude-sonnet-4-5","google/gemini-2.5-flash"]' ;; *) print_error "Unknown tier: $tier" diff --git a/.agents/scripts/supervisor-helper.sh b/.agents/scripts/supervisor-helper.sh index f241465020..49bc990da2 100755 --- a/.agents/scripts/supervisor-helper.sh +++ b/.agents/scripts/supervisor-helper.sh @@ -2818,16 +2818,13 @@ resolve_model() { echo "anthropic/claude-sonnet-4-5" ;; haiku) - echo "anthropic/claude-3-5-haiku-20241022" + echo "anthropic/claude-haiku-4-5" ;; flash) - echo "google/gemini-2.5-flash-preview-05-20" + echo "google/gemini-2.5-flash" ;; pro) - echo "google/gemini-2.5-pro-preview-06-05" - ;; - grok) - echo "xai/grok-3" + echo "google/gemini-2.5-pro" ;; *) # Unknown tier — treat as coding tier default From 43ad44330a0f993120678d838952662f1fd3d958 Mon Sep 17 00:00:00 2001 From: marcusquinn <6428977+marcusquinn@users.noreply.github.com> Date: Mon, 9 Feb 2026 18:42:54 +0000 Subject: [PATCH 3/3] fix: purge openrouter/openai from fallback chain config template The config template (Priority 2) was overriding the hardcoded fallback (Priority 4), so the previous .sh fix had no effect. Now the config template only uses anthropic/ and google/ providers. Also disabled openrouter gateway (enabled: false) and updated all model IDs to current versions. --- .../configs/fallback-chain-config.json.txt | 38 +++++++------------ 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/.agents/configs/fallback-chain-config.json.txt b/.agents/configs/fallback-chain-config.json.txt index 660858310b..41bdb7c512 100644 --- a/.agents/configs/fallback-chain-config.json.txt +++ b/.agents/configs/fallback-chain-config.json.txt @@ -3,44 +3,36 @@ "_docs": "See .agents/tools/ai-assistants/fallback-chains.md for full documentation", "chains": { - "_comment": "Per-tier fallback chains. Models tried in order. Formats: provider/model, openrouter/provider/model, gateway/cf/provider/model", + "_comment": "Per-tier fallback chains. Models tried in order. Only use providers configured in OpenCode (anthropic, google). Never use openrouter (expensive gateway).", "haiku": [ - "anthropic/claude-3-5-haiku-20241022", - "google/gemini-2.5-flash", - "openrouter/anthropic/claude-3-5-haiku-20241022" + "anthropic/claude-haiku-4-5", + "google/gemini-2.5-flash" ], "flash": [ "google/gemini-2.5-flash", - "openai/gpt-4.1-mini", - "openrouter/google/gemini-2.5-flash" + "anthropic/claude-haiku-4-5" ], "sonnet": [ - "anthropic/claude-sonnet-4-20250514", - "openai/gpt-4.1", - "google/gemini-2.5-pro", - "openrouter/anthropic/claude-sonnet-4-20250514" + "anthropic/claude-sonnet-4-5", + "google/gemini-2.5-pro" ], "pro": [ "google/gemini-2.5-pro", - "anthropic/claude-sonnet-4-20250514", - "openrouter/google/gemini-2.5-pro" + "anthropic/claude-sonnet-4-5" ], "opus": [ "anthropic/claude-opus-4-6", - "openai/o3", - "openrouter/anthropic/claude-opus-4-6" + "google/gemini-2.5-pro" ], "coding": [ "anthropic/claude-opus-4-6", - "openai/o3", - "anthropic/claude-sonnet-4-20250514", - "openrouter/anthropic/claude-opus-4-6" + "anthropic/claude-sonnet-4-5", + "google/gemini-2.5-pro" ], "eval": [ "anthropic/claude-sonnet-4-5", - "google/gemini-2.5-flash", - "openrouter/anthropic/claude-sonnet-4-5" + "google/gemini-2.5-flash" ], "health": [ "anthropic/claude-sonnet-4-5", @@ -48,10 +40,8 @@ ], "default": [ - "anthropic/claude-sonnet-4-20250514", - "openai/gpt-4.1", - "google/gemini-2.5-pro", - "openrouter/anthropic/claude-sonnet-4-20250514" + "anthropic/claude-sonnet-4-5", + "google/gemini-2.5-pro" ] }, @@ -89,7 +79,7 @@ "_comment": "Gateway provider configuration for provider-level fallback routing", "openrouter": { - "enabled": true, + "enabled": false, "endpoint": "https://openrouter.ai/api/v1", "key_env_var": "OPENROUTER_API_KEY", "description": "OpenRouter - multi-provider gateway with unified API"