fix(mcp): get_run_details only caches completed runs (#3253)

This commit is contained in:
Eric Allam
2026-03-24 11:28:52 +00:00
committed by GitHub
parent f86e492c31
commit 774007e9b9
+15 -1
View File
@@ -101,12 +101,26 @@ export const getRunDetailsTool = {
const filePath = path.join(getTraceCacheDir(), `${input.runId}.txt`);
fs.writeFileSync(filePath, fullTrace, "utf-8");
// Only cache runs in terminal states — active runs need fresh traces
const terminalStatuses = new Set([
"COMPLETED",
"CANCELED",
"FAILED",
"CRASHED",
"SYSTEM_FAILURE",
"EXPIRED",
"TIMED_OUT",
]);
cached = {
filePath,
totalLines: traceLines.length,
expiresAt: Date.now() + TRACE_CACHE_TTL_MS,
};
traceCache.set(input.runId, cached);
if (terminalStatuses.has(runResult.status)) {
traceCache.set(input.runId, cached);
}
}
// Read the requested page