Skip to content

Repair over-quoted tool-call argument keys so a rejected call can self-correct (closes #1876) - #1901

Merged
malibio merged 4 commits into
mainfrom
issue-1876-toolcall-json-retry
Aug 1, 2026
Merged

malibio merged 4 commits into
mainfrom
issue-1876-toolcall-json-retry

Conversation

@malibio

@malibio malibio commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

Closes #1876.

What was actually happening

The issue suspected a model-side encoding quirk in how nested-object-array arguments are emitted. Measured against gemma-4-e4b-q4km on the real chat path, that turned out not to be it.

Condition Result
First attempt, create_schema fields array 0/8 malformed
Retry, malformed prior call seeded in history 8/8 malformed
Retry, well-formed prior call, otherwise identical 0/8 malformed
Flat (non-nested) argument control clean throughout

The tool-call grammar makes an over-quoted key unreachable at generation time, so first attempts are clean. What the model does on a retry is copy the shape it reads in its own conversation history. A rejected call stays in the transcript as an assistant turn, so the malformed payload poisons every subsequent attempt — the retry path is a copy machine, not a repair mechanism.

Nothing in the loop could break this:

  • The arguments are valid JSON (only the keys are wrong), so consecutive_parse_failures never increments.
  • Alternating create_schema → update_schema gives a different (tool, args) identity each round, defeating the duplicate-call guard.

The turn burns its iteration budget and ends with nothing persisted and nothing said — exactly the reported end state.

The fix

Repair the keys in the agent loop, ahead of both the tool executor and the duplicate guards.

The malformation is mechanical — the intended key is the same string minus a wrapping quote pair — so the rewrite is unambiguous. It applies only when the trimmed name carries no quote of its own and collides with no genuine key already present; anything else is passed through untouched. Values are never rewritten, so user data containing quotes survives intact.

Repairing generically rather than inside create_schema's validator matters twice over: the propagation mechanism is the conversation, not the tool, so any tool taking an array of objects is reachable the same way; and repairing before canonical_args means a malformed call and its repaired retry resolve to one identity instead of two.

Acceptance criteria

  • Specific to fields/add_fields, or general? General. The propagating mechanism is history imitation, independent of which tool's arguments carry the shape — hence the generic fix.
  • Byte-identical retries or independent regeneration? Independently regenerated, converging on the same malformed shape because it is being read back out of history. Not a stuck generation.
  • Self-corrects, or fails honestly? Self-corrects. An end-to-end test drives the loop with the exact wire shape captured from the live model and asserts the tool receives repaired keys and the turn completes successfully.

Tests

  • Four fast unit tests covering the repair, nesting depth, and its ambiguity/collision guards (a key containing quotes, an empty inner name, a collision with a real key, and values left alone).
  • One end-to-end agent-loop test using the exact malformed payload measured from the live model.
  • Three #[ignore]d live characterisation tests (packages/nlp-engine/tests/toolcall_json_shape.rs) recording the measurement above, so a later template, grammar, or model change can be rechecked against evidence rather than a remembered claim. Each needs the E4B GGUF and ~20s of GPU time; run with --ignored --nocapture.

test:all green (frontend 4108/4108, agent 412, core 1105); full pre-push gate passed. The 5 svelte-check errors quality:fix reports are pre-existing on main in test files untouched here (verified against a clean tree).

🤖 Generated with Claude Code

…f-correct (closes #1876)

A rejected tool call was retried forever with the identical malformed
payload. Measured against gemma-4-e4b-q4km on the real chat path, the
cause is not the model's encoding ability:

- First attempts encode nested-object-array arguments cleanly, 0/8
  malformed — the tool-call grammar makes an over-quoted key unreachable
  at generation time.
- A retry copies whatever shape the prior assistant turn holds. Seed a
  malformed prior call and 8/8 retries are malformed; seed a well-formed
  one under otherwise identical conditions and 0/8 are. A flat-argument
  control stays clean throughout.

So the malformed call poisons the conversation it lives in, and every
retry faithfully reproduces what it reads. No existing guard breaks the
loop: the arguments are valid JSON (only the keys are wrong), so the
parse-failure counter never increments, and alternating create_schema
with update_schema defeats the duplicate-call guard. The turn burns its
budget and ends with nothing persisted and nothing said.

Repair the keys in the agent loop, ahead of both the tool executor and
the duplicate guards. The malformation is mechanical — the intended key
is the same string minus a wrapping quote pair — so the rewrite is
unambiguous, and it applies only when the trimmed name carries no quote
of its own and collides with no genuine key. Values are never touched,
so user data containing quotes survives intact. Repairing generically
rather than in create_schema's validator covers any tool taking an array
of objects, and keeps the poisoned shape from re-entering history.

Answers the acceptance criteria: the fault is general to nested-object
array arguments rather than specific to fields/add_fields; retries are
independently regenerated copies of the malformed shape rather than a
stuck generation; and a call with this malformation now self-corrects.

Adds live characterisation tests recording the measurement the fix rests
on, so a later template, grammar, or model change can be rechecked
against evidence rather than a remembered claim. They are #[ignore]d —
each needs the E4B GGUF and GPU time — alongside fast unit tests
covering the repair and its ambiguity and collision guards.

Co-Authored-By: Claude <[email protected]>
@malibio

malibio commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator Author

Pragmatic Code Review — PR #1901

Review Type: Initial Review
Scope: 2 files, 1 commit, +568/−1 (agent_loop.rs, new toolcall_json_shape.rs)

Summary

This is a well-diagnosed fix. The headline value is not the ~50 lines of repair code — it's the measurement that overturned the issue's own hypothesis. #1876 guessed at a "model-side encoding quirk in nested-object-array arguments"; the evidence shows first attempts are clean 0/8 and the malformation propagates by history imitation (8/8 malformed-in → malformed-out, 0/8 clean-in → clean-out). That reframing is what makes a generic repair the right shape of fix instead of a create_schema validator patch, and it is exactly the kind of "verify the premise before coding" work that pays off later.

I verified the risk areas rather than taking them on faith — compiling the repair function standalone and running adversarial inputs through it. The two scariest hypotheses turned out to be non-issues, and I want to record why so they don't get re-litigated:

  • UTF-8 slicing is safe. key[1..key.len()-1] looked like a panic waiting to happen, but strip_prefix('"')/strip_suffix('"') already proved byte 0 and byte len-1 are the ASCII quote 0x22, so both indices are guaranteed char boundaries. Confirmed empirically: {"\"héllo→\"": 1} repairs to {"héllo→": 1} cleanly. The single-character key " is also safe — strip_suffix fails on the empty remainder, so it's filtered out before slicing.
  • No order-dependence bug. The collision check reads the pre-mutation map while iterating, which is a classic source of same-pass corruption. I probed the cascade case {"\"a\"": 1, "\"\"a\"\"": 2}: the outer-quoted key fails the !inner.contains('"') guard, so it can never repair into a name an earlier repair just inserted. And JSON cannot carry two keys that repair to the same name, since they'd have to be byte-identical. serde_json::Map::insert on collision would overwrite, but the predicate makes that state unreachable.
  • Unbounded recursion is not reachable. repair_over_quoted_keys recurses without a depth cap and does overflow the stack at ~20k nesting in isolation. But every payload reaching it has already survived serde_json::from_str, whose default recursion limit is 128 — I verified a depth-200 document is rejected at column 128 before it ever reaches this code. Not a finding; noting it so a future change that parses with disable_recursion_limit() knows it would turn this into a crash.

All 5 new tests pass locally (0.04s). Standards are clean: no lint suppressions, no #[allow(dead_code)], no #[deprecated], no compat shims, no issue numbers in code comments, no new .md files.

The findings below are one Important design-hazard question and some polish. Nothing here is a blocker.


Requirements Check (issue #1876)

# Acceptance criterion Status Notes
1 Specific to fields/add_fields, or general to any nested-object-array parameter? ✅ Genuinely answered, not just asserted. retry_after_rejection_reencodes_arguments_cleanly seeds a malformed prior call and measures the retry; flat_arguments_control isolates nesting as the variable. Conclusion — propagation is via conversation history, independent of tool — is supported by the arms actually run, and it's what justifies the generic fix.
2 Byte-identical retries or independent regeneration? ✅ Independently regenerated, converging on the malformed shape read from history. The seeded-prior-call design is the right experiment for this: swapping only the prior turn's shape while holding everything else fixed cleanly separates "stuck generation" from "copying".
3 Self-corrects, or fails honestly ✅ Self-corrects. over_quoted_argument_keys_reach_the_tool_repaired drives the real LocalAgentLoop with the exact wire shape captured live, and asserts both that the tool receives repaired keys and that the turn completes non-error. That's an end-to-end assertion on the reported failure, not a unit test of the helper.

All three met by code I verified, not merely claimed in the PR body.


Code Review Findings

🟡 Important

1. The recursive repair reaches free-form user data, diverging from the normalize_param_aliases precedent directly above it

📁 packages/agent/src/local_agent/agent_loop.rs:155-215

normalize_param_aliases is deliberately top-level-only, and its doc comment states the reason explicitly:

/// Only the top level: a nested `properties` blob is the user's own data, where
/// a key named `node_id` means whatever the user's schema says and must not be
/// renamed.

repair_over_quoted_keys recurses into exactly that data. This is a real behavioural divergence between two adjacent functions whose comments give opposite rationales, and the new function's doc doesn't acknowledge it.

I confirmed the blob is genuinely free-form: exec_create_node (tools.rs:1766-1790) collects all unknown top-level keys into properties and merges them with the user's explicit properties object. So arbitrary user-schema key names do flow through this repair. Concretely, {"properties": {"\"quoted title\"": "v"}} is rewritten to {"properties": {"quoted title": "v"}} — and the PR's own repair_never_rewrites_values test asserts that rewrite on a properties blob as correct behaviour.

Weighing it honestly, I think the current choice is defensible and I'm not asking for it to be reverted:

  • A user schema field whose name genuinely begins and ends with a literal " is vanishingly rare, and NodeSpace has zero users today.
  • Restricting the repair to top level would defeat the fix entirely — the malformation is only observed nested inside fields/add_fields array elements.
  • The failure mode is a silently renamed property key, not data loss or a crash.

But the asymmetry deserves to be a recorded decision rather than an implicit one. Recommendation: extend the doc comment on repair_over_quoted_keys with a sentence naming the divergence and why it's accepted — something like "Unlike normalize_param_aliases, this does recurse into nested user data: the malformation only ever appears there, and a wrapping quote pair is not a shape any real property name takes. The cost of being wrong is a renamed key, not a lost value." A future reader comparing the two functions will otherwise reasonably conclude one of them is a bug.

Principle: Principle of Least Astonishment / decision provenance. When two neighbouring functions make opposite choices on the same question, the reasoning must be written down or the inconsistency will read as an oversight and get "fixed" in the wrong direction.


2. malformed == trials * 2 couples a characterisation test to an incidental count

📁 packages/nlp-engine/tests/toolcall_json_shape.rs:337-343

assert_eq!(
    malformed,
    trials * 2,
    "a malformed prior call must reproduce malformed on every retry \
     (2 malformed fields per trial); ..."
);

To be clear on what's fine here: asserting that the bug still reproduces is a legitimate characterisation test, and the comment explaining that this asserts measured rather than desirable behaviour — with failure as the signal to re-check whether the repair is still load-bearing — is genuinely good practice. It's also correctly #[ignore]d with a reason string, degrades gracefully when the GGUF is absent (early return after a SKIP: line), and is therefore not gating the pre-push hook. None of that is a problem.

The narrow issue is the counter's granularity. malformed increments per malformed field object, not per trial, so the assertion encodes "the model emits exactly 2 fields per trial, both malformed, in all 8 trials". Two independent facts are fused into one number, and the failure message can't distinguish them. A run where the model emits 3 fields in one trial and 1 in another — same underlying behaviour, malformed throughout — fails with a message pointing at the wrong conclusion ("no longer holds, re-check whether the repair is load-bearing") and could prompt someone to remove a repair that is still needed.

This is a live-only, manually-run test, so blast radius is small — hence 🟡 not 🔴.

Recommendation: count trials, not fields. Track malformed_trials with a per-trial boolean (any field has a quoted key), assert malformed_trials == trials, and log the field counts separately for diagnostics. The claim under test is "every retry reproduces the malformation" — assert exactly that.

Principle: Tests should assert the claim, not its incidental side effects. An assertion coupled to details the hypothesis doesn't depend on fails for reasons unrelated to what it's protecting.


🟢 Suggestions

3. PRIOR_ARGS env-var override is undocumented and read inside the loop

📁 packages/nlp-engine/tests/toolcall_json_shape.rs:246

let prior_args = std::env::var("PRIOR_ARGS").unwrap_or_else(|_| { ... });

This is the switch that runs the clean-prior-call control arm — one of the two arms the whole diagnosis rests on — but nothing in the file or module docs says so. The module header describes "clean in, clean out" as measured, yet a reader has no way to know how to reproduce that arm. Since the point of these tests is to let a future engineer recheck the premise against evidence, the mechanism for running half the experiment should be discoverable.

Also, the read sits inside the trial loop, so it's re-read 8 times to produce the same value. Harmless, but it belongs above the loop where it reads as a per-run parameter.

Recommendation: hoist the env::var above for i in 0..trials, and add a line to the module docs: "Set PRIOR_ARGS to a well-formed call to run the control arm."

Principle: Reproducibility. A characterisation test's value is proportional to how easily the next person can re-run it.


4. repair_over_quoted_keys runs twice per call — load-bearing in both places, but not obviously so

📁 packages/agent/src/local_agent/agent_loop.rs:122 and :1277

I checked whether this is redundant. It isn't — both sites are genuinely needed, for different reasons:

  • The canonical_args call serves the per-turn duplicate detector (:1225, :1241), which canonicalises tc.arguments_json — the raw emitted text — and never sees the parsed-and-repaired args.
  • The execution-path call at :1277 mutates args, which is what reaches execute and what the cross-turn guard canonicalises at :1306 via args.to_string().

So removing either one leaves a consumer reading unrepaired keys. The idempotence that makes double-application safe is easy to confirm: a repaired key no longer starts with ", so the second pass is a no-op.

On the parent's specific concern — that repairing inside canonical_args could make two genuinely-different calls compare equal, the one failure normalize_param_aliases's comment says the guard must never have — I probed it and consider it not a real risk. Collapsing {"\"k\"":1} and {"k":1} to one identity is the intended effect and is correct: those are the same logical call, one of them malformed. For two semantically distinct calls to collide, a user would need one property literally named "k" (quotes included) and another named k in the same object — and the !obj.contains_key(inner) guard already declines to repair in precisely that case, leaving both keys intact. I verified this with the colliding-key probe. The existing repair_leaves_ambiguous_and_colliding_keys_untouched test covers it.

Recommendation: no code change. Optionally add one line at :1277 noting that the canonical_args copy serves the per-turn loop-breaker on raw text and does not cover this path — the current comment explains why repair happens but not why it happens again here, which is the question a future reader deleting "duplicate" code will ask.

Principle: Comment the non-obvious "why". Apparent duplication that is actually load-bearing needs a note, or someone will helpfully remove it.


5. Nit: to_string() allocation is avoidable

📁 packages/agent/src/local_agent/agent_loop.rs:203

let inner = key[1..key.len() - 1].to_string(); allocates a fresh String after key was already cloned into the over_quoted vector. Trivial to avoid, and irrelevant at these payload sizes — flagging only for completeness. Not worth a commit on its own.


Recommendation

APPROVE — merge once you've considered the two 🟡 items.

Net assessment: this clearly improves code health. The diagnosis is the real contribution and it's rigorous — the seeded-prior-call experiment with a flat-argument control is a properly designed A/B, and it disproved the issue's stated hypothesis rather than confirming it, which is the harder and more valuable outcome. All three acceptance criteria are met by verified code. The repair predicate is conservative in the right places: it declines on empty inner names, inner quotes, and collisions, and it never touches values.

Neither 🟡 blocks merge. #1 is a documentation gap around an accepted trade-off, not a defect — the behaviour is intentional and reasonable for a zero-user codebase; it just needs the reasoning recorded so it isn't mistaken for an inconsistency later. #2 is a brittle assertion in a manually-run #[ignore]d test that cannot affect the push gate.

One forward-looking note worth carrying into a future issue rather than this PR: this repair treats a symptom of a more general property — the model copies malformed shapes out of its own conversation history. Over-quoted keys are one instance; the same mechanism will reproduce any other malformation that survives JSON parsing. If a second instance of this class shows up, the more durable fix is likely at the history level (not persisting a rejected call's malformed arguments back into the transcript) rather than adding a second shape-specific repair beside this one. Right call not to build that speculatively now — YAGNI — but the pattern is worth naming.

@malibio malibio left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initial review posted as a PR comment. Verdict: APPROVE — 2 Important (non-blocking) items, 3 suggestions. See the review comment for details.

…cterisation assertion

Two non-blocking items from the review of the repair fix.

Record why `repair_over_quoted_keys` recurses where the neighbouring
`normalize_param_aliases` deliberately does not. The two answer different
questions: an alias rewrite guesses at intent and could rename a key the
user meant, so it stays top-level; a key carrying its own quote marks is
not expressible as a deliberate choice, and the malformation only ever
appears nested, so a top-level-only rule would decline every case the
repair exists for. Written down so the inconsistency is not later
"fixed" in the wrong direction.

Decouple the live characterisation assertion from an incidental count.
It previously fused "every retry is malformed" with "exactly 2 fields
per trial", so a run with identical behaviour but a different field
count would fail while pointing at the wrong conclusion — and could
prompt removing a repair that is still load-bearing. Now counts trials,
and reports field totals separately.

Fold the PRIOR_ARGS env switch into an explicit two-arm loop that
asserts both outcomes in one run. Holding everything but the prior
turn's shape fixed is the actual experiment, so both arms belong in the
test rather than one being reachable only by making it fail on purpose.
Renamed to retry_copies_the_shape_of_the_prior_call, which is what it
measures.

Verified live: malformed-prior 8/8, clean-prior 0/8, all three
characterisation tests green.

Co-Authored-By: Claude <[email protected]>
@malibio

malibio commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator Author

Review items addressed (97a3fb5)

Both 🟡 items fixed. Thanks for the empirical verification on the UTF-8 slicing, cascade-repair ordering, and identity-collision concerns — those were the three I was least sure of, and probing them beat reasoning about them.

🟡 1 — recursion divergence from normalize_param_aliases. Documented rather than changed, as recommended. The doc now names the divergence and why it's accepted: the two functions answer different questions. An alias rewrite guesses at intent and could rename a key the user meant, so it stays top-level; a key carrying its own quote marks is not expressible as a deliberate choice, and the malformation only ever appears nested, so a top-level-only rule would decline every case the repair exists for. Also records that the residual risk is a renamed key, never a dropped value.

🟡 2 — malformed == trials * 2. Fixed as suggested: counts trials via a per-trial boolean and asserts malformed_trials == trials, with field totals logged separately.

🟢 3 — undocumented PRIOR_ARGS. Went further than hoisting. The switch is gone; the test now runs both arms in one pass and asserts each:

[malformed-prior] malformed trials: 8/8 (16 malformed fields total)
[clean-prior]     malformed trials: 0/8 (0 malformed fields total)

Holding everything but the prior turn's shape fixed is the experiment, so both arms belong in the test — previously the control was only observable by making the test fail on purpose, which is a bad way to store a load-bearing result. Renamed to retry_copies_the_shape_of_the_prior_call, which is what it actually measures.

🟢 4 / 5 — no change, agreed. The double call is load-bearing in both places as you verified, and the to_string() allocation isn't worth a commit.

All 3 live characterisation tests green; cargo clippy -D warnings and cargo fmt --check clean on both packages; agent suite 412/412; full pre-push gate passed.

On the forward-looking note — agreed, and worth stating plainly since it's the more interesting half of this: the repair treats a symptom of a general property, that the model copies malformed shapes out of its own history. The durable fix is at the history level (not persisting a rejected call's malformed arguments back into the transcript). I deliberately didn't build that here — one measured instance doesn't justify reworking transcript persistence, and doing it speculatively would be a much riskier change than this one. If a second shape shows up, that's the signal to do it properly rather than adding a second shape-specific repair.

malibio and others added 2 commits August 1, 2026 21:14
`quality:fix` reported 5 type errors in two test files. All were the same
root cause: mocks whose types were inferred from a single default return,
narrower than the contract they stand in for. The tests passed at runtime
throughout — these were type-check-only failures.

- daemon-status: the mock stands in for two commands with different
  return types. The status commands answer with a string and
  `probe_and_recover_channel` answers with a boolean, but inference from
  the default narrowed it to `string` and rejected the boolean the probe
  tests legitimately return. Widened to `Promise<string | boolean>`.

- update-status: inference from a default carrying `latest: null` fixed
  the property to `null`, rejecting tests that resolve a real version.
  Annotated with the exported `UpdateStatus` interface so the mock is
  tied to the contract it mirrors rather than to one sample value. The
  import is type-only, so it is erased before `vi.mock` hoisting.

- Both `invoke` and `openUrl` mocks are called with forwarded arguments
  but were inferred as zero-arity; given rest parameters.

Widening the declared types rather than suppressing: each error named a
real gap between the mock's type and its use.

Frontend suite green (171 files, 4108 tests); svelte-check now reports
0 errors and 0 warnings across 2171 files.

Co-Authored-By: Claude <[email protected]>
Closes the last actionable item from the PR review. The reviewer noted
that `repair_over_quoted_keys` runs twice per call and verified both are
load-bearing, but that nothing at either site says so.

Each site already explained its own purpose; neither mentioned the
other's existence, so a reader at either one could reasonably conclude it
was redundant and delete it. Both now name the other and say what it does
not cover: `canonical_args` repairs only the copy taken for the duplicate
guards' identity and never touches the arguments handed to the tool,
while the execution-path repair is the only one the tool itself and the
cross-turn write guard observe. Verified before asserting it — both
production callers of `canonical_args` pass `&tc.arguments_json` and
discard the parsed value, so it cannot reach the executed arguments.

Comment-only; no behaviour change.

Deliberately not taking suggestion 5 (an avoidable `to_string()` in the
repair loop). It allocates once per malformed key on a path that runs
only when a model emitted a broken key, and the borrow it would avoid
requires restructuring the remove/insert around the borrow checker for no
measurable gain. Worth revisiting only if this ever shows up in a profile.

Co-Authored-By: Claude <[email protected]>
@malibio

malibio commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator Author

Review items — final status

All 5 findings resolved (0 🔴, 2 🟡, 3 🟢). Commits 97a3fb59 and 818254ea.

# Sev Item Status
1 🟡 Recursion divergence from normalize_param_aliases ✅ Documented (97a3fb59)
2 🟡 malformed == trials * 2 couples to incidental count ✅ Fixed (97a3fb59)
3 🟢 PRIOR_ARGS undocumented, read inside loop ✅ Switch removed entirely (97a3fb59)
4 🟢 Double repair call load-bearing but not obviously so ✅ Cross-referenced (818254ea)
5 🟢 Avoidable to_string() allocation ⏭️ Skipped — reasoning below

On #4 (addressed in this last commit): each call site already explained its own purpose, but neither mentioned the other existed — so a reader at either one could reasonably delete it as redundant. Both now name the other and state what it does not cover. I verified the claim before asserting it in a comment: both production callers of canonical_args (agent_loop.rs:1244, :1260) pass &tc.arguments_json and discard the parsed value, so that path genuinely cannot reach the executed arguments. Comment-only, no behaviour change.

On #5 — skipped, with reasoning: the allocation happens once per malformed key, on a path that only runs when a model emitted a broken key in the first place. Avoiding it means restructuring the remove/insert around the borrow checker for no measurable gain. Revisit only if it ever appears in a profile.

Verification: cargo fmt --check and cargo clippy -D warnings clean; agent suite 412/412; frontend 4108/4108; svelte-check 0 errors / 0 warnings across 2171 files; full pre-push gate passed on every commit.

Re-Review Decision

Decision: NO RE-REVIEW NEEDED

Rationale: Nothing since the approving review changes production behaviour. The delta is: doc comments in agent_loop.rs (97a3fb59, 818254ea), a test restructure that preserves the measured result (97a3fb59), and test-mock type annotations (e4580573). No 🔴 items existed; both 🟡 items were a documentation gap and a test-assertion fix, neither architectural. The one substantive verification — that the two repair sites are non-overlapping — was checked against the code rather than asserted.

The reviewer's own guidance was "merge once you've considered the two 🟡 items." Both are addressed, and the third 🟢 went further than suggested.

One scope note for the merge decision: e4580573 fixes 5 pre-existing svelte-check errors in two test files unrelated to #1876 (under-inferred vi.fn() mocks). It rode along because quality:fix surfaced them. Happy to split it into its own PR if you'd rather keep this one strictly scoped — clean cherry-pick either way.

Ready for merge, pending your call.

@malibio
malibio merged commit 09a5407 into main Aug 1, 2026
2 checks passed
@malibio
malibio deleted the issue-1876-toolcall-json-retry branch August 1, 2026 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Model retries a rejected tool call with identical malformed JSON, never self-corrects

1 participant