@@ -62,6 +62,7 @@ import { activeBrowserRunner } from './browser-runner'
6262import { setMessages } from './chat-storage'
6363import { checkpointManager } from './checkpoints/checkpoint-manager'
6464import { CLI } from './cli'
65+ import { waitForPreviousCheckpoint } from './cli-handlers/checkpoint'
6566import { backendUrl , websiteUrl } from './config'
6667import { CREDENTIALS_PATH , userFromJson } from './credentials'
6768import { calculateFingerprint } from './fingerprint'
@@ -1085,26 +1086,26 @@ export class Client {
10851086 toolCall . name === 'str_replace' ||
10861087 toolCall . name === 'create_plan'
10871088 ) {
1089+ await waitForPreviousCheckpoint ( )
10881090 // Save lastChanges for `diff` command
10891091 this . lastChanges . push ( FileChangeSchema . parse ( toolCall . parameters ) )
10901092 this . hadFileChanges = true
10911093 // Track the changed file path
10921094 this . filesChangedForHook . push ( toolCall . parameters . path )
10931095 }
1094- if (
1095- toolCall . name === 'run_terminal_command' &&
1096- toolCall . parameters . mode === 'user'
1097- ) {
1098- // Special case: when terminal command is run as a user command, then no need to reprompt assistant.
1099- this . responseComplete = true
1100- isComplete = true
1101- }
1102- if (
1103- toolCall . name === 'run_terminal_command' &&
1104- toolCall . parameters . mode === 'assistant' &&
1105- toolCall . parameters . process_type === 'BACKGROUND'
1106- ) {
1107- this . oneTimeFlags [ SHOULD_ASK_CONFIG ] = true
1096+ if ( toolCall . name === 'run_terminal_command' ) {
1097+ await waitForPreviousCheckpoint ( )
1098+ if ( toolCall . parameters . mode === 'user' ) {
1099+ // Special case: when terminal command is run as a user command, then no need to reprompt assistant.
1100+ this . responseComplete = true
1101+ isComplete = true
1102+ }
1103+ if (
1104+ toolCall . parameters . mode === 'assistant' &&
1105+ toolCall . parameters . process_type === 'BACKGROUND'
1106+ ) {
1107+ this . oneTimeFlags [ SHOULD_ASK_CONFIG ] = true
1108+ }
11081109 }
11091110 const toolResult = await handleToolCall ( toolCall )
11101111 toolResults . push ( toolResult )
0 commit comments