Fix int() crash on float strings and model alias suffix stripping - #322
Open
sridhar-3009 wants to merge 2 commits into
Open
Fix int() crash on float strings and model alias suffix stripping#322sridhar-3009 wants to merge 2 commits into
sridhar-3009 wants to merge 2 commits into
Conversation
Some LLMs emit JSON numbers as floats (e.g. 250.0 instead of 250). int() raises ValueError on such strings; wrapping with float() first handles both integer and float-formatted numeric strings. Fixes HKUDS#302
Two independent bug fixes: 1. _copy_output() (manager.py): each 4 KB chunk was written to disk but never flushed between iterations of the while-loop. If the subprocess exited abruptly, data sitting in the Python file buffer was lost. Adding handle.flush() after handle.write() keeps the on-disk file current across all chunk boundaries. Fixes HKUDS#308. 2. resolve_model_setting() (settings.py): display aliases like "MiniMax-M3[1M]" were passed raw to the provider API, causing a 400 "unknown model" error. Strip any trailing [N K/M] context-window suffix before returning the resolved model ID. Fixes HKUDS#312.
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.
Fixes #302, #308, #312
Changes
Fix 1:
_record_tool_carryover()crashes on float-format numeric strings (fixes #302)File:
src/openharness/engine/query.pySome LLMs emit JSON integer fields as floats (e.g.
250.0instead of250).int()raisesValueErroron such strings. Wrapping withfloat()first handles both integer and float-formatted numeric strings:Fix 2: Async subprocess stdout data loss between chunks (fixes #308)
File:
src/openharness/tasks/manager.py_copy_output()writes 4 KB chunks to disk but never callsflush(). If the subprocess exits abruptly between iterations, data sitting in the Python file buffer is lost. Addedhandle.flush()afterhandle.write(chunk).Fix 3: MiniMax
[1M]model alias suffix rejected by API (fixes #312)File:
src/openharness/config/settings.pyresolve_model_setting()was passing display aliases likeMiniMax-M3[1M]raw to the provider API, causing a400 unknown modelerror. Added a regex strip for any trailing[N K/M]context-window suffix before returning the resolved model ID. This is consistent with how Claude handles similar display variants.