mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-06 08:24:46 +00:00
fix(creation): prevent duplicate workspaces and agents on retries
This commit is contained in:
@@ -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 }
|
||||
|
||||
Reference in New Issue
Block a user