auth: bootstrap legacy workspace ownership

This commit is contained in:
2026-08-02 00:26:28 +09:00
parent 0f9f06048a
commit e530150e43
6 changed files with 330 additions and 21 deletions
@@ -564,11 +564,29 @@
];
}
},
onStatus: (status) => {
onStatus: (status, message) => {
if (token !== reloadToken) return;
protocolState = status === "open" ? "connecting" : status;
const authenticationRequired = message?.startsWith("Authentication required") ?? false;
protocolState = authenticationRequired
? "error"
: status === "open"
? "connecting"
: status;
if (authenticationRequired && message) {
streamDiagnostics = [
...streamDiagnostics.filter(
(diagnostic) =>
diagnostic.code !== "workspace_subscription_auth_required",
),
{
code: "workspace_subscription_auth_required",
severity: "error",
message,
},
];
}
if (status === "closed") {
rejectPendingCompletion(new Error("Worker protocol WebSocket closed."));
rejectPendingCompletion(new Error(message ?? "Worker protocol WebSocket closed."));
}
},
},