Repository navigation
fix: reject tool calls with missing arguments instead of running empty (#83) - #101
Merged
Merged
Conversation
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
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.
What
Provider-layer fix: a
tool_callwhosefunction.argumentsfield is missing, null, or a blank string now surfaces asProviderOutput::InvalidToolArgs(reason: "missing arguments") instead of silently running the tool with empty input. Also accepts object-shapedarguments(some gateways emit a JSON object rather than a string) and tolerates surrounding whitespace when parsing.Why
Issue #83: the old
_ => "{}"fallback treated a malformed call as an empty one —write_filerecordedinput: {}, failed withmissing 'path', and the model retried the identical empty call until the loop guard tripped. Re-confirmed live today (2026-09-19, installed v0.3.0 vs glm-5.3-flash via Bifrost): the approval prompt showedwhat: write file <missing path>withinput: {}. A missing-arguments call is a malformed call, not an empty one.Changes
parse_completion: missing/null/blankarguments→InvalidToolArgs { reason: "missing arguments" }; object/array-shaped arguments serialized through the normal parse path;args.trim()parse (fixes a blank-string crash class too)parse_completion_missing_arguments_is_invalid_not_emptycovering missing / null / blank (assertInvalidToolArgs) + object-shaped (assert normalToolCall)InvalidToolArgssettlement path in the turn loop — the model sees the parse error and can retry well-formed (no new plumbing)Testing
cargo fmt --all/cargo clippy --workspace --all-targets -- -D warnings✅cargo test --workspace✅ (207 tests, exit 0; new test green:parse_completion_missing_arguments_is_invalid_not_empty ... ok)cora review --staged✅ No issues foundtole runtoday reproducedinput: {}+<missing path>on the approval prompt (deny path, fail-closed held — no file written)Closes #83