From 357dd7fe8b93af9ad2aa249d7b5c5c28b35ba9a5 Mon Sep 17 00:00:00 2001 From: mastertyko <11311479+mastertyko@users.noreply.github.com> Date: Fri, 10 Apr 2026 16:40:06 +0200 Subject: [PATCH] fix(gsd): detect property-value JSON invocation errors --- src/resources/extensions/gsd/auto-tool-tracking.ts | 2 +- .../gsd/tests/tool-invocation-error-loop-break.test.ts | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/resources/extensions/gsd/auto-tool-tracking.ts b/src/resources/extensions/gsd/auto-tool-tracking.ts index 9e7ffc049..cab495813 100644 --- a/src/resources/extensions/gsd/auto-tool-tracking.ts +++ b/src/resources/extensions/gsd/auto-tool-tracking.ts @@ -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 diff --git a/src/resources/extensions/gsd/tests/tool-invocation-error-loop-break.test.ts b/src/resources/extensions/gsd/tests/tool-invocation-error-loop-break.test.ts index 5a2cdfa58..c802e91a5 100644 --- a/src/resources/extensions/gsd/tests/tool-invocation-error-loop-break.test.ts +++ b/src/resources/extensions/gsd/tests/tool-invocation-error-loop-break.test.ts @@ -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"),