From 39ffe879f03b94d3c1a84a89c2b5a8051a090ec9 Mon Sep 17 00:00:00 2001 From: jungwoo choi Date: Sun, 15 Feb 2026 08:45:36 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20inspect=5Fpage=20=ED=8F=B4=EB=A7=81?= =?UTF-8?q?=EC=97=90=EC=84=9C=20404=20=EC=9D=91=EB=8B=B5=EC=9D=84=20?= =?UTF-8?q?=EC=9E=AC=EC=8B=9C=EB=8F=84=ED=95=98=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 검사 시작 직후 결과가 아직 DB에 저장되기 전 404가 반환되면 폴링을 계속하도록 에러 핸들링 추가 Co-Authored-By: Claude Opus 4.6 --- mcp/src/tools/inspect-page.ts | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/mcp/src/tools/inspect-page.ts b/mcp/src/tools/inspect-page.ts index 5b45e60..2d2f928 100644 --- a/mcp/src/tools/inspect-page.ts +++ b/mcp/src/tools/inspect-page.ts @@ -13,17 +13,25 @@ export async function inspectPage( // 1. Start inspection const { inspection_id } = await client.startInspection(url, standard); - // 2. Poll until completion + // 2. Poll until completion (404 = not yet saved, keep polling) let result: InspectionResult | null = null; for (let i = 0; i < MAX_POLLS; i++) { await sleep(POLL_INTERVAL); - const data = await client.getInspection(inspection_id); - if (data.status === "completed") { - result = data; - break; - } - if (data.status === "error") { - throw new Error(`Inspection failed for ${url}`); + try { + const data = await client.getInspection(inspection_id); + if (data.status === "completed") { + result = data; + break; + } + if (data.status === "error") { + throw new Error(`Inspection failed for ${url}`); + } + } catch (err) { + // 404 or transient error — keep polling + if (err instanceof Error && err.message.includes("failed")) { + continue; + } + throw err; } }