fix: release wizard admission before terminal response

This commit is contained in:
Shakker
2026-08-10 14:09:14 +01:00
parent f286928210
commit 5c308e0eba
+5 -4
View File
@@ -155,8 +155,9 @@ export const wizardHandlers: GatewayRequestHandlers = {
context.wizardSessions.set(sessionId, session);
const result = await session.next();
if (result.done) {
// Completed sessions cannot accept later answers; purge immediately so
// clients get a clean not-found response for stale session ids.
// Let the runner release setup admission before the terminal response,
// so an immediate replacement wizard is not rejected as still busy.
await session.whenSettled();
context.purgeWizardSession(sessionId);
}
respond(true, { sessionId, ...sanitizeWizardResultForClient(result) }, undefined);
@@ -196,8 +197,8 @@ export const wizardHandlers: GatewayRequestHandlers = {
}
const result = await session.next();
if (result.done) {
// The final step may be reached after an answer, so cleanup mirrors
// wizard.start's immediate-completion path.
// Keep terminal response ordering identical to wizard.start.
await session.whenSettled();
context.purgeWizardSession(sessionId);
}
respond(true, sanitizeWizardResultForClient(result), undefined);