Merge pull request #3930 from mastertyko/fix/3924-tool-invocation-json-variant

fix(gsd): detect property-value JSON invocation errors
This commit is contained in:
Jeremy McSpadden 2026-04-11 22:35:07 -05:00 committed by GitHub
commit 904cc4a3cd
2 changed files with 8 additions and 1 deletions

View file

@ -92,7 +92,7 @@ export function clearInFlightTools(): void {
* handler. When these errors occur, retrying the same unit will produce the same
* failure, so the retry loop must be broken.
*/
const TOOL_INVOCATION_ERROR_RE = /Validation failed for tool|Expected ',' or '\}' in JSON|Unexpected end of JSON|Unexpected token.*in JSON/i;
const TOOL_INVOCATION_ERROR_RE = /Validation failed for tool|Expected ',' or '\}'(?: after property value)?(?: in JSON)?|Unexpected end of JSON|Unexpected token.*in JSON/i;
/**
* Returns true if the error message indicates a tool invocation failure due to

View file

@ -61,6 +61,13 @@ describe("#2883: isToolInvocationError classification", () => {
);
});
test("detects Node v18+ JSON parse variant with property-value text", () => {
assert.equal(
isToolInvocationError("Expected ',' or '}' after property value in JSON at position 4096"),
true,
);
});
test("detects Unexpected end of JSON input", () => {
assert.equal(
isToolInvocationError("Unexpected end of JSON input"),