@@ -4,10 +4,19 @@ import { toolResultContains } from "./tool-result"
44
55export function addTerminalReuseShellRaceFixtures ( mock : InstanceType < typeof LLMock > ) {
66 // First command completes — model issues a second command on the same terminal.
7- // With the temp-script fix, both commands now deliver real output.
87 mock . addFixture ( {
98 match : {
10- predicate : ( req ) => toolResultContains ( req , "call_terminal_reuse_001" , [ "first" , "Exit code: 0" ] ) ,
9+ predicate : ( req ) => {
10+ const messages = Array . isArray ( req ?. messages ) ? req . messages : [ ]
11+ const lastToolMsg = messages . filter ( ( message ) => message ?. role === "tool" ) . at ( - 1 )
12+
13+ return (
14+ lastToolMsg ?. tool_call_id === "call_terminal_reuse_001" &&
15+ toolResultContains ( req , "call_terminal_reuse_001" , [
16+ "Command was submitted in the VS Code terminal" ,
17+ ] )
18+ )
19+ } ,
1120 } ,
1221 response : {
1322 toolCalls : [
@@ -25,7 +34,17 @@ export function addTerminalReuseShellRaceFixtures(mock: InstanceType<typeof LLMo
2534 // Second command on the reused terminal also completes.
2635 mock . addFixture ( {
2736 match : {
28- predicate : ( req ) => toolResultContains ( req , "call_terminal_reuse_002" , [ "second" , "Exit code: 0" ] ) ,
37+ predicate : ( req ) => {
38+ const messages = Array . isArray ( req ?. messages ) ? req . messages : [ ]
39+ const lastToolMsg = messages . filter ( ( message ) => message ?. role === "tool" ) . at ( - 1 )
40+
41+ return (
42+ lastToolMsg ?. tool_call_id === "call_terminal_reuse_002" &&
43+ toolResultContains ( req , "call_terminal_reuse_002" , [
44+ "Command was submitted in the VS Code terminal" ,
45+ ] )
46+ )
47+ } ,
2948 } ,
3049 response : {
3150 toolCalls : [
0 commit comments