diff --git a/packages/pi-coding-agent/src/core/agent-session.ts b/packages/pi-coding-agent/src/core/agent-session.ts index 6e0910971..203517525 100644 --- a/packages/pi-coding-agent/src/core/agent-session.ts +++ b/packages/pi-coding-agent/src/core/agent-session.ts @@ -1214,17 +1214,16 @@ export class AgentSession { ]); } - // If streaming, queue via steer() or followUp() based on option + // If streaming, queue via steer() or followUp() based on option. + // Default to followUp when no streamingBehavior is given — this covers + // user prompts that arrive while a system-triggered turn (e.g. autonomous + // dispatch at startup) is already running. The user's message queues as + // a clean new turn after the current one finishes, not steered into it. if (this.isStreaming) { - if (!options?.streamingBehavior) { - throw new Error( - "Agent is already processing. Please wait for it to finish before sending another message.", - ); - } - if (options.streamingBehavior === "followUp") { - await this._queueFollowUp(expandedText, currentImages); - } else { + if (options?.streamingBehavior === "steer") { await this._queueSteer(expandedText, currentImages); + } else { + await this._queueFollowUp(expandedText, currentImages); } return; }