Repository navigation
Fix ensure_list splitting str/bytes into characters - #266
Merged
zRzRzRzRzRzRzR merged 1 commit intoJul 21, 2026
Merged
Conversation
ensure_list is meant to normalize a single value or a sequence into a list, but str and bytes are themselves Sequence subclasses, so a single string was split into one-character elements instead of wrapped as ["the string"]. This misfires on the documented Union[Sequence[str], str] inputs. In RewardSystem.get_reward, passing a single prompt/answer/gt as a string scores every character as a separate example. In the verifier LLM-judge fallback, a scalar llm_api_key / llm_judge_url / llm_model (the form used throughout configs/full_config.yaml, e.g. the mmsi verifier) gets exploded character-by-character; the judge then fires one request per URL character and finally crashes with "ValueError: zip() argument 3 is shorter than arguments 1-2". Treat str/bytes/bytearray as scalar values, and add tests for the misc helpers, which had none.
zRzRzRzRzRzRzR
approved these changes
Jul 21, 2026
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.
ensure_list()usesisinstance(obj, Sequence)to decide whether to wrap or spread its argument, butstr/bytesareSequencesubclasses — so a single string is exploded into one-character elements instead of being wrapped as["the string"].This corrupts the documented
Union[Sequence[str], str]inputs:RewardSystem.get_reward— a single-stringprompts/answers/gt_answersis scored one character at a time.llm_api_key/llm_judge_url/llm_model. This scalar form is the one shipped in the project's ownconfigs/full_config.yaml, so when the fallback fires the judge URL is requested one character at a time and then crashes withValueError: zip() argument 3 is shorter than arguments 1-2.Treat
str/bytes/bytearrayas scalar before theSequencecheck. Adds tests for the previously-untestedmischelpers.