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

Method failAgentTaskForHardTimeout

src/node/services/taskService.ts:5146–5187  ·  view source on GitHub ↗
(
    taskId: string,
    options: { workflowRunId: string; stepId: string; inputHash: string; reason: string }
  )

Source from the content-addressed store, hash-verified

5144 }
5145
5146 async failAgentTaskForHardTimeout(
5147 taskId: string,
5148 options: { workflowRunId: string; stepId: string; inputHash: string; reason: string }
5149 ): Promise<void> {
5150 assert(taskId.length > 0, "failAgentTaskForHardTimeout: taskId must be non-empty");
5151 assert(options.reason.length > 0, "failAgentTaskForHardTimeout: reason must be non-empty");
5152
5153 await this.workspaceEventLocks.withLock(taskId, async () => {
5154 const cfg = this.config.loadConfigOrDefault();
5155 const entry = findWorkspaceEntry(cfg, taskId);
5156 if (!entry?.workspace.parentWorkspaceId) {
5157 return;
5158 }
5159 if (hasCompletedAgentReport(entry.workspace) || this.completedReportsByTaskId.has(taskId)) {
5160 return;
5161 }
5162 try {
5163 const clearQueueResult = this.workspaceService.clearQueue(taskId);
5164 if (!clearQueueResult.success) {
5165 log.debug("failAgentTaskForHardTimeout: clearQueue failed", {
5166 taskId,
5167 error: clearQueueResult.error,
5168 });
5169 }
5170 } catch (error: unknown) {
5171 log.debug("failAgentTaskForHardTimeout: clearQueue threw", { taskId, error });
5172 }
5173 try {
5174 await this.aiService.stopStream(taskId, {
5175 abandonPartial: true,
5176 abortReason: "system",
5177 });
5178 } catch (error: unknown) {
5179 log.debug("failAgentTaskForHardTimeout: stopStream threw", { taskId, error });
5180 }
5181 await this.terminateAllDescendantAgentTasks(taskId, { workflowRunId: options.workflowRunId });
5182 await this.failAgentTaskTerminally(taskId, entry, {
5183 errorType: "workflow_agent_timeout",
5184 errorMessage: options.reason,
5185 });
5186 });
5187 }
5188
5189 async waitForAgentReport(
5190 taskId: string,

Callers

nothing calls this directly

Calls 11

findWorkspaceEntryFunction · 0.90
hasCompletedAgentReportFunction · 0.90
withLockMethod · 0.80
loadConfigOrDefaultMethod · 0.80
debugMethod · 0.80
assertFunction · 0.50
hasMethod · 0.45
clearQueueMethod · 0.45
stopStreamMethod · 0.45

Tested by

no test coverage detected