fix(packages/coding-agent): corrected interactive submit shutdown handling in coding-agent
- Updated submitInteractiveInput to await checkShutdownRequested after submission, avoiding premature teardown (#1020). - Mapped extension UI shutdown hook to set ctx.shutdownRequested for deferred teardown handling (#1020). - Added regression coverage for interactive shutdown propagation and issue #1020 teardown behavior.
This commit is contained in:
@@ -125,7 +125,10 @@ export interface InteractiveModeNotify {
|
||||
}
|
||||
|
||||
export async function submitInteractiveInput(
|
||||
mode: Pick<InteractiveMode, "markPendingSubmissionStarted" | "finishPendingSubmission" | "showError">,
|
||||
mode: Pick<
|
||||
InteractiveMode,
|
||||
"markPendingSubmissionStarted" | "finishPendingSubmission" | "showError" | "checkShutdownRequested"
|
||||
>,
|
||||
session: Pick<AgentSession, "prompt">,
|
||||
input: SubmittedUserInput,
|
||||
): Promise<void> {
|
||||
@@ -144,6 +147,7 @@ export async function submitInteractiveInput(
|
||||
mode.showError(errorMessage);
|
||||
} finally {
|
||||
mode.finishPendingSubmission(input);
|
||||
await mode.checkShutdownRequested();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -119,7 +119,10 @@ export class ExtensionUiController {
|
||||
abort: () => this.ctx.session.abort(),
|
||||
hasPendingMessages: () => this.ctx.session.queuedMessageCount > 0,
|
||||
shutdown: () => {
|
||||
// Signal shutdown request (will be handled by main loop)
|
||||
// Defer the actual teardown to the main loop, which calls
|
||||
// `checkShutdownRequested()` at idle boundaries so any queued
|
||||
// steering / follow-up messages drain first (see issue #1020).
|
||||
this.ctx.shutdownRequested = true;
|
||||
},
|
||||
getContextUsage: () => this.ctx.session.getContextUsage(),
|
||||
compact: instructionsOrOptions => this.#compactSession(instructionsOrOptions),
|
||||
|
||||
Reference in New Issue
Block a user