Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Tool-call repair

Models often emit tool arguments that are almost valid JSON or almost match the tool schema: stringified objects, trailing commas, truncated payloads, or misnamed fields. Without a repair step those calls fail validation and cost a full turn.

Repair runs in the agent loop before argument validation. Clear malformations are coerced into a schema-valid object; ambiguous cases are rejected and returned to the model as an error tool result (no dispatch).

Behavior

StepWhat it does
SeamRuns at tool dispatch, before schema validation
Fix-if-clearTrailing commas, parse sentinels (__parseError / __rawJson), stringified JSON objects
Refuse-if-ambiguousMissing required strings with multiple plausible sources → unrepairable
Alias / typo renameUnknown keys that clearly map to a declared property are renamed; ambiguous renames are rejected
Strict unknown keysSchemas with additionalProperties: false reject leftover keys after alias resolution
Size boundInputs over 1 MiB are not repaired
DisableVEYYON_REPAIR_DISABLE=1, or per-model harness.profiles with repair: false

Implementation: packages/coding-agent/src/repair/schema-repair.ts
Tests: packages/coding-agent/test/repair/schema-repair.test.ts