fix: preserve workspace recovery contracts

This commit is contained in:
Mohamed Boudra
2026-07-16 15:16:13 +02:00
parent 05cb0f99e5
commit d3fcef01f1
9 changed files with 78 additions and 18 deletions
+1 -8
View File
@@ -1494,14 +1494,7 @@ export const WorkspaceRecoveryStateSchema = z.discriminatedUnion("kind", [
z.object({
kind: z.literal("unavailable"),
workspaceId: z.string(),
reason: z.enum([
"workspace_not_found",
"workspace_not_archived",
"project_not_found",
"project_directory_missing",
"workspace_directory_missing",
"worktree_branch_missing",
]),
reason: z.string(),
message: z.string(),
}),
]);
@@ -83,4 +83,28 @@ describe("workspace recovery protocol", () => {
}).features?.workspaceRecovery,
).toBe(true);
});
test("accepts unavailable reasons added by newer daemons", () => {
expect(
SessionOutboundMessageSchema.parse({
type: "workspace.recovery.inspect.response",
payload: {
requestId: "inspect-future",
state: {
kind: "unavailable",
workspaceId: "workspace-1",
reason: "future_recovery_constraint",
message: "This host cannot recover the workspace yet.",
},
},
}),
).toMatchObject({
payload: {
state: {
kind: "unavailable",
reason: "future_recovery_constraint",
},
},
});
});
});