@@ -147,7 +147,6 @@ async function run() {
147147 } | null = null ;
148148 let actionFailed = false ;
149149 let errorDetails : string | undefined ;
150- let errorSubtype : string | undefined ;
151150
152151 // First check if prepare step failed
153152 const prepareSuccess = process . env . PREPARE_SUCCESS !== "false" ;
@@ -167,40 +166,23 @@ async function run() {
167166 // Output file is an array, get the last element which contains execution details
168167 if ( Array . isArray ( outputData ) && outputData . length > 0 ) {
169168 const lastElement = outputData [ outputData . length - 1 ] ;
170- if ( lastElement . type === "result" ) {
171- // Extract execution details
169+ if (
170+ lastElement . type === "result" &&
171+ "cost_usd" in lastElement &&
172+ "duration_ms" in lastElement
173+ ) {
172174 executionDetails = {
173- cost_usd : lastElement . total_cost_usd ,
175+ cost_usd : lastElement . cost_usd ,
174176 duration_ms : lastElement . duration_ms ,
175177 duration_api_ms : lastElement . duration_api_ms ,
176178 } ;
177-
178- // Check if this is an error result based on subtype
179- switch ( lastElement . subtype ) {
180- case "error_during_execution" :
181- errorSubtype = "Error during execution" ;
182- // Override the actionFailed flag based on the result
183- actionFailed = true ;
184- break ;
185- case "error_max_turns" :
186- errorSubtype = "Maximum turns exceeded" ;
187- actionFailed = true ;
188- break ;
189- }
190179 }
191180 }
192181 }
193182
194- // Check if the Claude action failed (only if not already determined from result)
195- if ( ! actionFailed ) {
196- const claudeSuccess = process . env . CLAUDE_SUCCESS !== "false" ;
197- actionFailed = ! claudeSuccess ;
198- }
199-
200- // Use errorSubtype as errorDetails if no other error details are available
201- if ( actionFailed && ! errorDetails && errorSubtype ) {
202- errorDetails = errorSubtype ;
203- }
183+ // Check if the Claude action failed
184+ const claudeSuccess = process . env . CLAUDE_SUCCESS !== "false" ;
185+ actionFailed = ! claudeSuccess ;
204186 } catch ( error ) {
205187 console . error ( "Error reading output file:" , error ) ;
206188 // If we can't read the file, check for any failure markers
0 commit comments