mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-11 05:11:49 +01:00
test(chaos): retry a rejected model's run the way its task marker does
A rejected model asks the user to choose a model (userAction choose_model) instead of offering the task-level Retry. Its "Model unavailable" marker offers Retry, which retries that run on the agent. The config wave now uses that action after it restores the model. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
1 parent
d2e8494e41
commit
263ef18098
1 file changed
+7
-1
@@ -254,7 +254,7 @@ function time(value: unknown): number | null {
|
||||
return Number.isFinite(at) ? at : null;
|
||||
}
|
||||
|
||||
/** Use what the task offers: complete a pending connection card, then Retry, then the agent's setup Retry. */
|
||||
/** Use what the task offers: complete a pending connection card, then Retry (the task's, or a rejected model's marker), then the agent's setup Retry. */
|
||||
async function offeredAction(api: ChaosApi, record: ConfigTaskRecord, resources: TaskResources, current: ConfigSnapshot): Promise<string> {
|
||||
const card = current.cards.find(candidate => candidate.status === "pending" && candidate.kind === "connection_intent");
|
||||
if (card && resources.connectionId) {
|
||||
@@ -265,6 +265,12 @@ async function offeredAction(api: ChaosApi, record: ConfigTaskRecord, resources:
|
||||
const response = await api.post<Json>(`/api/issues/${record.issueId}/retry`, { idempotencyKey: randomUUID(), observedRunId: current.interruption.observedRunId });
|
||||
return `clicked Retry (accepted=${String(response?.accepted)})`;
|
||||
}
|
||||
// A rejected model offers Retry on the run's "Model unavailable" marker, which retries that run on the agent.
|
||||
if (current.interruption?.userAction === "choose_model" && current.interruption.observedRunId) {
|
||||
const response = await api.post<Json>(`/api/agents/${resources.agentId}/wakeup`, { source: "on_demand", triggerDetail: "manual",
|
||||
reason: "retry_failed_run", failedRunId: current.interruption.observedRunId });
|
||||
return `clicked the model marker's Retry (run ${String(response?.id ?? "none")})`;
|
||||
}
|
||||
if (current.agent && current.agent.lifecycleState !== "ready") {
|
||||
await api.post(`/api/agents/${resources.agentId}/lifecycle/retry`, {});
|
||||
return `agent setup Retry (lifecycle ${current.agent.lifecycleState})`;
|
||||
|
||||
Reference in new issue
Block a user