fix: retain legacy plugin login output during session binding

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip committed 2026-09-09 11:29:49 -05:00
1 parent 1e608d78fc
commit a31eba2381
2 files changed
+98 -5

No files matched your search

+8 -1
View File
@@ -1548,7 +1548,14 @@ export function createPluginWorkerHandle(
if (loginPtyRoutesByHostRouteId.size !== 1) return null;
const workerSessionId = readNonEmptyString(params.workerSessionId);
if (!workerSessionId) return null;
return loginPtyRoutesByWorkerSessionId.get(workerSessionId) ?? null;
const bound = loginPtyRoutesByWorkerSessionId.get(workerSessionId);
if (bound) return bound;
// The open reply and a legacy notification can share one stdout chunk,
// before the await continuation binds the session ID. Queue against the
// sole opening route; bounded replay still checks the claimed ID against
// the validated reply. Never guess between concurrent or bound routes.
const opening = loginPtyRoutesByHostRouteId.values().next().value;
return opening?.state === "opening" ? opening : null;
}
// Route one login pseudo-terminal output notification to the per-session