fix: gate direct session creation by workspace policy

This commit is contained in:
2026-08-04 06:13:22 +02:00
parent 7a780d8904
commit b686ffe271
5 changed files with 144 additions and 4 deletions
+5 -2
View File
@@ -9,6 +9,9 @@ export interface WorkspaceDraft {
updatedAt: string;
}
export const WORKSPACE_SUMMARY_ERROR = "Could not load workspace registry. Please retry.";
export const WORKSPACE_POLICY_ERROR = "Could not load selected workspace policy. Please retry.";
export class WorkspaceSelectionError extends Error {}
type PolicySelection = {
@@ -70,7 +73,7 @@ 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.error = new WorkspaceSelectionError(WORKSPACE_SUMMARY_ERROR);
selection.settle();
},
@@ -88,7 +91,7 @@ export const workspacePolicyGate = {
reject(workspaceId: string): void {
if (!selection || selection.workspaceId !== workspaceId || selection.state !== "pending") return;
selection.state = "error";
selection.error = new WorkspaceSelectionError("Could not load selected workspace policy. Please retry.");
selection.error = new WorkspaceSelectionError(WORKSPACE_POLICY_ERROR);
selection.settle();
},