Skip to content

Commit acda69c

Browse files
anandgupta42claude
andcommitted
fix: [release] scope MCP annotation-hint classifier to the path array
Follow-up to the v0.9.1 adversarial review. `isAnnotationHintValidationError` previously AND-ed three independent substring checks (`"path"`, `annotations`, a hint name) anywhere in the error text, so an unrelated field's Zod validation error whose message merely co-mentioned those words could trip the tolerant `tools/list` retry. Require the hint to sit immediately after `annotations` inside a serialized `"path"` array (`"path":[...,"annotations","<hint>"]`), which pins the retry to a genuine annotation-hint error while still matching the real Microsoft Fabric payload. Covered by the v0.9.1 adversarial suite. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 4baf41b commit acda69c

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

packages/opencode/src/mcp/catalog.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -186,13 +186,15 @@ function isOutputSchemaValidationError(error: Error) {
186186
// JSON array of issues with `"path": [..., "annotations", "<hint>"]`), never
187187
// off transport or pagination-guard error text.
188188
function isAnnotationHintValidationError(error: Error) {
189-
return (
190-
// Require the Zod issue-payload shape (a JSON array of issues carrying a
191-
// `"path"`) so arbitrary transport/server text that merely mentions these
192-
// words can't trip the tolerant retry — only a real validation error does.
193-
/"path"/.test(error.message) &&
194-
/annotations/i.test(error.message) &&
195-
/readOnlyHint|destructiveHint|idempotentHint|openWorldHint/.test(error.message)
189+
// Require the hint to appear as a path segment *immediately after* `annotations`
190+
// INSIDE a serialized Zod issue `"path"` array (e.g.
191+
// `"path":[...,"annotations","destructiveHint"]`). Matching the tokens
192+
// independently anywhere in the message would let an unrelated validation error
193+
// (a different field) whose text merely happens to mention these words trip the
194+
// tolerant retry; scoping the adjacency to the `"path"` array pins it to a genuine
195+
// annotation-hint error while still matching the real SDK/Fabric payload.
196+
return /"path"\s*:\s*\[[^\]]*"annotations"\s*,\s*"(readOnlyHint|destructiveHint|idempotentHint|openWorldHint)"/.test(
197+
error.message,
196198
)
197199
}
198200

0 commit comments

Comments
 (0)