fix: block creation when workspace summaries fail

This commit is contained in:
2026-08-04 06:05:22 +02:00
parent 41c558e06c
commit 7a780d8904
3 changed files with 58 additions and 5 deletions
+10 -1
View File
@@ -9,6 +9,8 @@ export interface WorkspaceDraft {
updatedAt: string;
}
export class WorkspaceSelectionError extends Error {}
type PolicySelection = {
workspaceId: string;
generation: number;
@@ -65,6 +67,13 @@ export const workspacePolicyGate = {
}
},
rejectSummary(workspaceId: string): void {
if (!selection || selection.workspaceId !== workspaceId || selection.state !== "summary") return;
selection.state = "error";
selection.error = new WorkspaceSelectionError("Could not load workspace registry. Please retry.");
selection.settle();
},
clear(): void {
selection?.supersede();
selection = undefined;
@@ -79,7 +88,7 @@ export const workspacePolicyGate = {
reject(workspaceId: string): void {
if (!selection || selection.workspaceId !== workspaceId || selection.state !== "pending") return;
selection.state = "error";
selection.error = new Error("Selected workspace policy could not be loaded.");
selection.error = new WorkspaceSelectionError("Could not load selected workspace policy. Please retry.");
selection.settle();
},