Add Retry for failed results
A failed plan item gets a Retry button on its card and in the preview. It asks the engine for a fresh quote for that item and starts it again, while the engine still allows another attempt (three per item). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -273,6 +273,7 @@ export interface PlanItem {
|
||||
id: number
|
||||
status: 'proposed' | 'approved' | 'queued' | 'generating' | 'ready' | 'blocked' | 'failed' | 'skipped' | 'cancelled' | 'rejected'
|
||||
run_id: number | null
|
||||
attempt_count: number
|
||||
title: string
|
||||
required_outputs: { kind: ContentKind }[]
|
||||
}
|
||||
@@ -301,6 +302,20 @@ export const quoteProduction = (id: number, target: number) =>
|
||||
export const confirmProduction = (id: number, plan: ContentPlan) =>
|
||||
request<ContentPlan>(`${AGENTS}/${id}/content/plans/${plan.id}/confirm-planning`, { method: 'POST', json: { revision: plan.revision } })
|
||||
|
||||
// Retrying a failed item = a fresh generation quote for that item alone, then starting it. The engine
|
||||
// allows three attempts per item and only by the person who started the first one.
|
||||
export const MAX_ATTEMPTS = 3
|
||||
export async function retryItem(agentId: number, planId: number, itemId: number) {
|
||||
const plan = (await productionStatus(agentId)).plans.find(p => p.id === planId)
|
||||
if (!plan) throw new Error('The production plan is no longer available')
|
||||
const base = `${AGENTS}/${agentId}/content/plans/${planId}`
|
||||
const quote = await request<{ revision: number; quote_signature: string }>(`${base}/items/${itemId}/retry-quote`, { method: 'POST', json: { revision: plan.revision } })
|
||||
return request<ContentPlan>(`${base}/start`, {
|
||||
method: 'POST', headers: { 'Idempotency-Key': opKey(`retry-${itemId}`) },
|
||||
json: { revision: quote.revision, quote_signature: quote.quote_signature },
|
||||
})
|
||||
}
|
||||
|
||||
export const PLAN_ACTIVE = new Set<ContentPlan['status']>(['planning', 'review', 'approved', 'running'])
|
||||
|
||||
export interface RunSummary {
|
||||
|
||||
Reference in New Issue
Block a user