fix(health-check): treat env var errors from executor 500 responses as HEALTHY

The executor returns HTTP 500 for all tool errors, including missing env vars.
Before: 500 response = BROKEN
After: Check error message for env/validation patterns before marking BROKEN

This ensures tools that require API keys (like @parallel-web/ai-sdk-tools)
show importHealth: HEALTHY since the tool loads correctly - it just needs config.
This commit is contained in:
Ajax Davis 2025-12-12 04:56:02 +10:00
parent e09596a7fa
commit 4b337c8fe0
2 changed files with 9 additions and 5 deletions

View file

@ -1,6 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
import "./.next/dev/types/routes.d.ts";
import "./.next/types/routes.d.ts";
// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

View file

@ -136,13 +136,17 @@ async function checkExecutionHealth(tool: Tool & { package: Package }): Promise<
return { status: 'HEALTHY', error: null, timeMs, testParams };
}
// HTTP error from executor itself (not from tool)
// This could be executor down, rate limited, etc.
// HTTP error from executor - could be tool-level or infrastructure
const data = await response.json().catch(() => ({}));
const error = data.error || `HTTP ${response.status}`;
// Even HTTP errors might be tool-level errors returned through executor
// Only mark as BROKEN for true infrastructure failures
// Check if this is a config/validation error (tool is working, just missing setup)
// The executor returns 500 for all tool errors, so we need to inspect the message
if (isNonBreakingError(error)) {
return { status: 'HEALTHY', error: null, timeMs, testParams };
}
// True infrastructure failures (executor down, rate limited, etc.)
if (response.status >= 500) {
return { status: 'BROKEN', error, timeMs, testParams };
}