fix(creation): prevent duplicate workspaces and agents on retries

This commit is contained in:
Mohamed Boudra
2026-09-14 10:38:49 +02:00
parent d1b705a0cd
commit 815b83c96d
31 changed files with 800 additions and 243 deletions
+9
View File
@@ -4333,15 +4333,24 @@ export class DaemonClient {
input: {
source: WorkspaceCreateRequest["source"];
title?: string;
idempotencyKey?: string;
firstAgentContext?: WorkspaceCreateRequest["firstAgentContext"];
},
requestId?: string,
): Promise<WorkspaceCreatePayload> {
// COMPAT(workspaceRequestReceipts): added in v0.7.3; remove gate after 2027-03-07.
if (
input.idempotencyKey !== undefined &&
!this.lastServerInfoMessage?.features?.workspaceRequestReceipts
) {
throw new Error("Update the host to use retry-safe workspace creation.");
}
return this.sendCorrelatedSessionRequest({
requestId,
message: {
type: "workspace.create.request",
source: input.source,
...(input.idempotencyKey !== undefined ? { idempotencyKey: input.idempotencyKey } : {}),
...(input.title !== undefined ? { title: input.title } : {}),
...(input.firstAgentContext !== undefined
? { firstAgentContext: input.firstAgentContext }