File tree Expand file tree Collapse file tree 5 files changed +33
-3
lines changed
testdriver/behavior/lifecycle Expand file tree Collapse file tree 5 files changed +33
-3
lines changed Original file line number Diff line number Diff line change @@ -196,7 +196,8 @@ class TestDriverAgent extends EventEmitter2 {
196
196
}
197
197
198
198
await this . summarize ( error . message ) ;
199
- return await this . exit ( true ) ;
199
+ // Always run postrun lifecycle script, even for fatal errors
200
+ return await this . exit ( true , false , true ) ;
200
201
}
201
202
202
203
// creates a new "thread" in which the AI is given an error
Original file line number Diff line number Diff line change @@ -101,9 +101,14 @@ class BaseCommand extends Command {
101
101
logger . createMarkdownLogger ( this . agent . emitter ) ;
102
102
103
103
// Handle exit events
104
- this . agent . emitter . on ( "error:fatal" , ( error ) => {
104
+ this . agent . emitter . on ( "error:fatal" , async ( error ) => {
105
105
console . error ( "Fatal error:" , error ) ;
106
- process . exit ( 1 ) ;
106
+ // Call the agent's exit method to ensure postrun lifecycle script is executed
107
+ if ( this . agent ) {
108
+ await this . agent . exit ( true , false , true ) ;
109
+ } else {
110
+ process . exit ( 1 ) ;
111
+ }
107
112
} ) ;
108
113
109
114
this . agent . emitter . on ( "exit" , ( exitCode ) => {
Original file line number Diff line number Diff line change
1
+ version : 6.0.1-canary.4f31816.0
2
+ session : 68767e31eb9cc3d8f639b8e0
3
+ steps :
4
+ - prompt : " run"
5
+ commands :
6
+ - command : exec
7
+ lang : pwsh
8
+ code : Write-Output "postrun.yaml"
Original file line number Diff line number Diff line change
1
+ version : 6.0.1-canary.4f31816.0
2
+ session : 68767e31eb9cc3d8f639b8e0
3
+ steps :
4
+ - prompt : " run"
5
+ commands :
6
+ - command : exec
7
+ lang : pwsh
8
+ code : Write-Output "prerun.yaml"
Original file line number Diff line number Diff line change
1
+ version : 6.0.1-canary.4f31816.0
2
+ session : 68767e31eb9cc3d8f639b8e0
3
+ steps :
4
+ - prompt : " run"
5
+ commands :
6
+ - command : exec
7
+ lang : pwsh
8
+ code : Write-Output "provision.yaml"
You can’t perform that action at this time.
0 commit comments