fix: stabilize plugin startup boundaries

This commit is contained in:
Peter Steinberger
2026-03-28 05:01:21 +00:00
parent 838013c87a
commit 23f0486810
6 changed files with 357 additions and 252 deletions

View File

@@ -47,6 +47,10 @@ type LaneState = {
generation: number;
};
function isExpectedNonErrorLaneFailure(err: unknown): boolean {
return err instanceof Error && err.name === "LiveSessionModelSwitchError";
}
/**
* Keep queue runtime state on globalThis so every bundled entry/chunk shares
* the same lanes, counters, and draining flag in production builds.
@@ -141,10 +145,14 @@ function drainLane(lane: string) {
} catch (err) {
const completedCurrentGeneration = completeTask(state, taskId, taskGeneration);
const isProbeLane = lane.startsWith("auth-probe:") || lane.startsWith("session:probe-");
if (!isProbeLane) {
if (!isProbeLane && !isExpectedNonErrorLaneFailure(err)) {
diag.error(
`lane task error: lane=${lane} durationMs=${Date.now() - startTime} error="${String(err)}"`,
);
} else if (!isProbeLane) {
diag.debug(
`lane task interrupted: lane=${lane} durationMs=${Date.now() - startTime} reason="${String(err)}"`,
);
}
if (completedCurrentGeneration) {
pump();