()
| 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"; |
nothing calls this directly
no test coverage detected