diff --git a/src/main/runtime/orca-runtime-write-terminal-agent-prompt.ts b/src/main/runtime/orca-runtime-write-terminal-agent-prompt.ts index be6e8189db8..5cb95bc8a4c 100644 --- a/src/main/runtime/orca-runtime-write-terminal-agent-prompt.ts +++ b/src/main/runtime/orca-runtime-write-terminal-agent-prompt.ts @@ -52,7 +52,9 @@ export class OrcaRuntimeWithWriteTerminalAgentPrompt extends OrcaRuntimeWithReso if (!this.ptyController?.write(ptyId, pastePayload)) { throw new Error('terminal_not_writable') } - await options.afterWrite?.(ptyId) + if (options.afterWrite) { + await options.afterWrite(ptyId) + } } catch (error) { renderGate?.dispose() throw error @@ -90,7 +92,9 @@ export class OrcaRuntimeWithWriteTerminalAgentPrompt extends OrcaRuntimeWithReso if (!this.ptyController?.write(ptyId, AGENT_PROMPT_SUBMIT)) { throw new Error(options.suffixFailureError ?? 'terminal_not_writable') } - await options.afterWrite?.(ptyId) + if (options.afterWrite) { + await options.afterWrite(ptyId) + } await verifyAgentPromptSubmission({ baseline, readActivity: () => this.getAgentPromptActivity(handle, ptyId, waitTextCache),