MCPcopy
hub / github.com/coder/mux / markWorkspaceTurnAccepted

Method markWorkspaceTurnAccepted

src/node/services/taskService.ts:3066–3090  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3064 }
3065
3066 const markWorkspaceTurnAccepted = async () => {
3067 await this.workspaceTurnSettlementLocks.withLock(handleId, async () => {
3068 const current = await this.taskHandleStore.getWorkspaceTurn(ownerWorkspaceId, handleId);
3069 if (current?.workspaceId !== targetWorkspaceId) {
3070 throw new Error("Workspace turn was canceled before stream start");
3071 }
3072 if (current.turnId !== turnId) {
3073 throw new Error("Workspace turn correlation changed before stream start");
3074 }
3075 if (this.isTerminalWorkspaceTurnStatus(current.status)) {
3076 throw new Error(current.error ?? "Workspace turn was canceled before stream start");
3077 }
3078 if (current.status !== "running") {
3079 await this.taskHandleStore.upsertWorkspaceTurn({
3080 ...current,
3081 status: "running",
3082 updatedAt: getIsoNow(),
3083 });
3084 }
3085 this.activeWorkspaceTurnHandleByWorkspaceId.set(targetWorkspaceId, {
3086 handleId,
3087 ownerWorkspaceId,
3088 });
3089 });
3090 };
3091
3092 const sendResult = await this.workspaceService.sendMessage(
3093 targetWorkspaceId,

Callers

nothing calls this directly

Calls 6

getIsoNowFunction · 0.85
withLockMethod · 0.80
getWorkspaceTurnMethod · 0.80
upsertWorkspaceTurnMethod · 0.80
setMethod · 0.80

Tested by

no test coverage detected