(run: WorkflowRunRecord, error: unknown)
| 64 | } |
| 65 | |
| 66 | function workflowRunRecoveryNote(run: WorkflowRunRecord, error: unknown): string { |
| 67 | const statusGuidance: Record<WorkflowRunRecord["status"], string> = { |
| 68 | pending: "resume it with workflow_resume because no runner may be active yet", |
| 69 | running: "await it with task_await", |
| 70 | backgrounded: "await it with task_await", |
| 71 | interrupted: "resume it with workflow_resume", |
| 72 | failed: "use workflow_resume({ mode: 'retry_from_checkpoint' }) only if the run is eligible", |
| 73 | completed: "inspect the returned durable result instead of rerunning", |
| 74 | }; |
| 75 | return ( |
| 76 | `workflow_run errored after creating durable run \`${run.id}\`: ${getErrorMessage(error)}. ` + |
| 77 | `The durable run is ${run.status}; ${statusGuidance[run.status]}. Do not start another copy.` |
| 78 | ); |
| 79 | } |
| 80 | |
| 81 | export const createWorkflowRunTool: ToolFactory = (config: ToolConfiguration) => { |
| 82 | return tool({ |
no test coverage detected