MCPcopy Index your code
hub / github.com/coder/mux / persistFinalizationToken

Method persistFinalizationToken

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

Source from the content-addressed store, hash-verified

5077 }
5078 let finalizationAccepted = false;
5079 const persistFinalizationToken = async (): Promise<void> => {
5080 await this.workspaceEventLocks.withLock(taskId, async () => {
5081 const cfg = this.config.loadConfigOrDefault();
5082 const entry = findWorkspaceEntry(cfg, taskId);
5083 if (!entry?.workspace.parentWorkspaceId) {
5084 return;
5085 }
5086 if (hasCompletedAgentReport(entry.workspace) || this.completedReportsByTaskId.has(taskId)) {
5087 return;
5088 }
5089 await this.editWorkspaceEntry(
5090 taskId,
5091 (workspace) => {
5092 const existing = workspace.taskTimeoutFinalizationTokens ?? [];
5093 workspace.taskTimeoutFinalizationTokens = Array.from(
5094 new Set([...existing, options.finalizationToken])
5095 );
5096 workspace.taskStatus = "awaiting_report";
5097 },
5098 { allowMissing: true }
5099 );
5100 });
5101 finalizationAccepted = true;
5102 };
5103 const completionToolName = (await this.isPlanLikeTaskWorkspace(freshEntry))
5104 ? "propose_plan"
5105 : "agent_report";

Callers

nothing calls this directly

Calls 6

editWorkspaceEntryMethod · 0.95
findWorkspaceEntryFunction · 0.90
hasCompletedAgentReportFunction · 0.90
withLockMethod · 0.80
loadConfigOrDefaultMethod · 0.80
hasMethod · 0.45

Tested by

no test coverage detected