Repository navigation
fix(utils): keep blank model parameter values instead of raising #1452 - #1453
Merged
ulleo merged 1 commit intoNov 10, 2026
Merged
Conversation
…ease#1452 prepare_model_arg inspected the first character of the stripped value, so an empty or whitespace-only string raised IndexError; get_default_config swallowed the error and dropped every additional parameter of that model configuration. Blank values now pass through unchanged and non-string inputs keep their current behaviour.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cause
prepare_model_argdecides whether a value looks like JSON by inspecting the first character oforigin_arg.strip():so an empty or whitespace-only value raised
IndexError: string index out of range.get_default_configbuilds the runtimeadditional_paramsfrom a dict comprehension whose result is wrapped intry/except Exception: pass, so one blank parameter made the whole mapping disappear:check_llmskips blank values through its own truthiness filter, which is why the crash only shows on the runtime path; which values that filter should keep is tracked separately in #1446.Fix
0,False,None, numbers, dicts, lists) keep their current pass-through behaviour;except:next to it becomesexcept Exception:so a JSON decode error stays contained.Tests
backend/tests/test_prepare_model_arg.pypins the contract: blank values (""," ","\t","\n") come back unchanged, JSON-looking strings are still parsed, malformed JSON and plain strings stay strings, non-string values keep their identity, and a config carrying one blank parameter keeps its siblings — the last two are exactly the reported failure mode.Verification
python -m pytest -q tests/test_prepare_model_arg.py-> 28 passed after the fix; the same file fails 11 cases against the unmodified source (IndexErrorin the blank-value cases), run inbackend/on a checkout ofmainat f10255b;ruff checkandruff format --checkpass on the touched files;uv run pytest -qsuite was not run in the sandbox where the change was prepared, which has no access to the private xpack index.Fixes #1452