fix: return recovery action descriptors (#174)

Co-authored-by: AgentRun Codex <agentrun-codex@users.noreply.github.com>
This commit is contained in:
Lyon
2026-06-12 01:20:02 +08:00
committed by GitHub
parent 1a9b6debbb
commit 216209ca95
11 changed files with 298 additions and 74 deletions
+20 -6
View File
@@ -52,12 +52,26 @@ export async function dispatchQueueTask(options: DispatchQueueTaskOptions): Prom
envImage: jsonRecordOrNull(runnerJob.envImage),
workReady: jsonRecordOrNull(runnerJob.workReady),
latestAttempt,
pollCommands: {
queue: `./scripts/agentrun queue show ${task.id}`,
run: `./scripts/agentrun runs show ${run.id}`,
command: `./scripts/agentrun commands show ${command.id} --run-id ${run.id}`,
events: `./scripts/agentrun runs events ${run.id} --after-seq 0 --limit 100`,
},
pollActions: [
dispatchActionDescriptor({ action: "inspect-task", operation: "describe", resourceKind: "task", resourceName: task.id }),
dispatchActionDescriptor({ action: "inspect-run", operation: "describe", resourceKind: "run", resourceName: run.id, runId: run.id }),
dispatchActionDescriptor({ action: "inspect-command", operation: "describe", resourceKind: "command", resourceName: command.id, runId: run.id, commandId: command.id }),
dispatchActionDescriptor({ action: "poll-events", operation: "events", resourceKind: "run", resourceName: run.id, runId: run.id, commandId: command.id, afterSeq: 0, limit: 100 }),
],
};
}
function dispatchActionDescriptor(input: { action: string; operation: string; resourceKind: string; resourceName: string; runId?: string | null; commandId?: string | null; afterSeq?: number | null; limit?: number | null }): JsonRecord {
return {
action: input.action,
operation: input.operation,
resourceKind: input.resourceKind,
resourceName: input.resourceName,
runId: input.runId ?? null,
commandId: input.commandId ?? null,
...(input.afterSeq !== undefined ? { afterSeq: input.afterSeq } : {}),
...(input.limit !== undefined ? { limit: input.limit } : {}),
valuesPrinted: false,
};
}