Merge pull request #5195 from yzhg1983/private/fix-startup-input-queue

fix(coding-agent): buffer early input before prompt loop
This commit is contained in:
Mario Zechner
2026-05-30 01:15:45 +02:00
committed by GitHub
2 changed files with 80 additions and 0 deletions

View File

@@ -277,6 +277,7 @@ export class InteractiveMode {
private version: string;
private isInitialized = false;
private onInputCallback?: (text: string) => void;
private pendingUserInputs: string[] = [];
private loadingAnimation: Loader | undefined = undefined;
private workingMessage: string | undefined = undefined;
private workingVisible = true;
@@ -2660,6 +2661,8 @@ export class InteractiveMode {
if (this.onInputCallback) {
this.onInputCallback(text);
} else {
this.pendingUserInputs.push(text);
}
this.editor.addToHistory?.(text);
};
@@ -3231,6 +3234,11 @@ export class InteractiveMode {
}
async getUserInput(): Promise<string> {
const queuedInput = this.pendingUserInputs.shift();
if (queuedInput !== undefined) {
return queuedInput;
}
return new Promise((resolve) => {
this.onInputCallback = (text: string) => {
this.onInputCallback = undefined;