File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
packages/cli-v3/src/mcp/tools Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -101,12 +101,26 @@ export const getRunDetailsTool = {
101101 const filePath = path . join ( getTraceCacheDir ( ) , `${ input . runId } .txt` ) ;
102102 fs . writeFileSync ( filePath , fullTrace , "utf-8" ) ;
103103
104+ // Only cache runs in terminal states — active runs need fresh traces
105+ const terminalStatuses = new Set ( [
106+ "COMPLETED" ,
107+ "CANCELED" ,
108+ "FAILED" ,
109+ "CRASHED" ,
110+ "SYSTEM_FAILURE" ,
111+ "EXPIRED" ,
112+ "TIMED_OUT" ,
113+ ] ) ;
114+
104115 cached = {
105116 filePath,
106117 totalLines : traceLines . length ,
107118 expiresAt : Date . now ( ) + TRACE_CACHE_TTL_MS ,
108119 } ;
109- traceCache . set ( input . runId , cached ) ;
120+
121+ if ( terminalStatuses . has ( runResult . status ) ) {
122+ traceCache . set ( input . runId , cached ) ;
123+ }
110124 }
111125
112126 // Read the requested page
You can’t perform that action at this time.
0 commit comments