From cba86b7303fa8f9470dd68daa0c6126c6d8760b8 Mon Sep 17 00:00:00 2001 From: YAMAGUCHI Seiji Date: Sat, 25 Apr 2026 11:50:17 +0900 Subject: [PATCH] fix(cronjob): treat bare 'custom' provider as unspecified in override MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `_resolve_model_override` treated any non-empty `provider` string from the LLM as user-specified and skipped the pin-to-current-provider fallback. When the LLM wrote bare `'custom'` (instead of the canonical `'custom:'` referring to a custom_providers entry), the value serialized into jobs.json as `"provider": "custom"` and the scheduler could never resolve a provider from it — the cron job failed silently at run time. Treat bare `'custom'` as "no provider supplied" so the current main provider gets pinned instead, matching behaviour for the omitted case. Defence-in-depth complement to a schema-description fix (#15477) that discourages the LLM from emitting bare `'custom'` in the first place. --- tools/cronjob_tools.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/cronjob_tools.py b/tools/cronjob_tools.py index d0ef994ae..ec4b41b3c 100644 --- a/tools/cronjob_tools.py +++ b/tools/cronjob_tools.py @@ -128,6 +128,15 @@ def _resolve_model_override(model_obj: Optional[Dict[str, Any]]) -> tuple: return (None, None) model_name = (model_obj.get("model") or "").strip() or None provider_name = (model_obj.get("provider") or "").strip() or None + # Bare "custom" is an incomplete spec — the canonical form is + # "custom:" matching a custom_providers entry. LLMs frequently + # supply the bare type because the schema does not advertise the + # ":" suffix, which used to bypass the pinning path below and + # leave the job stored with an unresolvable "custom" provider. Treat + # the bare value as "no provider supplied" so the current main + # provider gets pinned instead. + if provider_name == "custom": + provider_name = None if model_name and not provider_name: # Pin to the current main provider so the job is stable try: