Conversation
pd95
force-pushed
the
fix/gemma4-tool-call-safety
branch
from
August 8, 2026 17:37
3836daa to
be842b2
Compare
pd95
changed the base branch from
main
to
feature/responses-custom-apply-patch-tool
August 8, 2026 17:41
pd95
force-pushed
the
fix/gemma4-tool-call-safety
branch
2 times, most recently
from
August 14, 2026 21:08
c7a2752 to
f767266
Compare
pd95
force-pushed
the
fix/gemma4-tool-call-safety
branch
from
August 23, 2026 07:27
f767266 to
7e48aba
Compare
pd95
force-pushed
the
fix/gemma4-tool-call-safety
branch
2 times, most recently
from
August 31, 2026 05:38
851fdd9 to
9979c21
Compare
pd95
force-pushed
the
fix/gemma4-tool-call-safety
branch
from
September 5, 2026 09:33
9979c21 to
ba4e7ff
Compare
pd95
force-pushed
the
fix/gemma4-tool-call-safety
branch
from
September 14, 2026 06:09
ba4e7ff to
6401840
Compare
pd95
removed this pull request from stack #26
September 14, 2026 18:24
pd95
added this pull request to stack #27
September 14, 2026 18:24
Co-authored-by: Codex <noreply@openai.com>
pd95
force-pushed
the
fix/gemma4-tool-call-safety
branch
from
September 18, 2026 12:17
6401840 to
e9d3eee
Compare
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.
Motivation
Gemma 4 tool-call parsing includes a best-effort repair path for malformed
model output. A preserved control token inside unfinished arguments could be
mistaken for the end of a call, allowing a truncated prefix to be repaired into
valid JSON and returned as an executable tool call. Other malformed events
could be silently dropped rather than surfaced to the caller.
Model-generated tool arguments are untrusted input. Repair must not turn
control-token injection or incomplete structured output into a command an
agent may execute.
What this changes
attempting repair;
behavior.
Dependency and scope
This PR depends on custom
apply_patchPR #10 and changes only the Gemma 4parser and its safety tests. It does not change Gemma model execution or media
support.
Compare:
feature/responses-custom-apply-patch-tool...fix/gemma4-tool-call-safety
Validation
Focused parser tests cover split streaming tokens, raw and quoted truncation,
control characters, empty calls, valid repairs, and chunked multiline content.
The complete
model/parserspackage, integrated Linux test/lint/build, andDarwin MLX build gates pass.
Refresh and AI assistance
Reconstructed on Ollama
v0.34.0; head64018404c0fec31e08ecea52ee1ca3f254ea87c3. Codex materially assistedimplementation review, tests, refresh validation, and this PR description.