Files
paperclip/ui/storybook/stories/scheduled-retry.stories.tsx
T
Dotta 772fc92619 Add issue controls and retry-now recovery (#5426)
## Thinking Path

> - Paperclip orchestrates AI agents for zero-human companies
> - Issue operators need clear controls for execution settings, model
overrides, and recovery retries
> - Existing issue properties hid useful adapter override state and did
not expose a board-triggered retry for scheduled heartbeat recovery
> - Scheduled retries also need to respect the same safety gates as
normal execution instead of bypassing budget, review, pause, dependency,
or terminal-state checks
> - This pull request adds the issue property controls and retry-now
surfaces together because they share the issue details/properties UI
> - The benefit is that operators can inspect and adjust issue execution
settings and safely trigger pending scheduled recovery without hidden
control-plane behavior

## What Changed

- Adds editable issue assignee model override controls in
`IssueProperties`, with focused coverage.
- Removes the stale workspace tasks link from issue properties.
- Adds a scheduled retry `retry-now` backend path and shared response
types.
- Adds main-pane and properties-pane scheduled retry UI, backed by a
shared `useRetryNowMutation` hook.
- Adds suppression coverage for budget hard stops, review participant
changes, subtree pause holds, unresolved blockers, terminal issues, and
company scoping.
- Updates the `IssueProperties` test harness with toast actions required
by the retry-now hook.

## Verification

- `pnpm exec vitest run ui/src/components/IssueProperties.test.tsx
ui/src/components/IssueScheduledRetryCard.test.tsx` — 31 passed.
- `pnpm exec vitest run
server/src/__tests__/issue-scheduled-retry-routes.test.ts` — exited 0,
but this host skipped the embedded Postgres route tests with: `Postgres
init script exited with code null. Please check the logs for extra info.
The data directory might already exist.`
- Pairwise merge check against the assigned-backlog PR branch completed
without conflicts via `git merge --no-commit --no-ff` in a temporary
worktree.

### Visual verification screenshots

Storybook story: `Product/Issue Scheduled retry surfaces /
ScheduledRetrySurfaces`.

![Scheduled retry card and issue properties rows -
desktop](https://raw.githubusercontent.com/paperclipai/paperclip/62fb566f357312b43b9162af02252d0175530a8f/docs/assets/pr-5426/scheduled-retry-story-desktop.png)

![Scheduled retry card and issue properties rows -
mobile](https://raw.githubusercontent.com/paperclipai/paperclip/62fb566f357312b43b9162af02252d0175530a8f/docs/assets/pr-5426/scheduled-retry-story-mobile.png)

## Risks

- Medium: this touches issue execution/retry behavior, so CI should run
the embedded Postgres route tests on a host that can initialize
Postgres.
- Low-to-medium UI risk around duplicated retry-now entry points; both
surfaces share one mutation hook to keep behavior consistent.

> For core feature work, check [`ROADMAP.md`](ROADMAP.md) first and
discuss it in `#dev` before opening the PR. Feature PRs that overlap
with planned core work may need to be redirected — check the roadmap
first. See `CONTRIBUTING.md`.

## Model Used

- OpenAI Codex coding agent, GPT-5 model family (`gpt-5`), tool-enabled
Paperclip heartbeat environment. Context window and internal reasoning
mode are not exposed by the runtime.

## Checklist

- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] If this change affects the UI, I have included before/after
screenshots
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [x] I will address all Greptile and reviewer comments before
requesting merge

---------

Co-authored-by: Paperclip <noreply@paperclip.ing>
2026-05-07 12:23:13 -05:00

164 lines
6.0 KiB
TypeScript

import type { Meta, StoryObj } from "@storybook/react-vite";
import type { Issue, IssueScheduledRetry } from "@paperclipai/shared";
import { IssueScheduledRetryCard } from "@/components/IssueScheduledRetryCard";
import { IssueProperties } from "@/components/IssueProperties";
import {
storybookExecutionWorkspaces,
storybookIssueDocuments,
storybookIssues,
} from "../fixtures/paperclipData";
const issueDocumentSummaries = storybookIssueDocuments.map(({ body: _body, ...summary }) => summary);
const baseIssue: Issue = {
...storybookIssues[0]!,
planDocument: storybookIssueDocuments.find((document) => document.key === "plan") ?? null,
documentSummaries: issueDocumentSummaries,
currentExecutionWorkspace: storybookExecutionWorkspaces[0]!,
};
const inFifteenMinutes = () => new Date(Date.now() + 15 * 60_000).toISOString();
const justNow = () => new Date(Date.now() + 5_000).toISOString();
const inTwoDays = () => new Date(Date.now() + 2 * 24 * 60 * 60_000).toISOString();
const transientRetry: IssueScheduledRetry = {
runId: "run-aaaaaaaa-1111-1111-1111-111111111111",
status: "scheduled_retry",
agentId: baseIssue.assigneeAgentId ?? "agent-1",
agentName: "ClaudeCoder",
retryOfRunId: "run-prev-2222-2222-2222-222222222222",
scheduledRetryAt: inFifteenMinutes(),
scheduledRetryAttempt: 4,
scheduledRetryReason: "transient_failure",
retryExhaustedReason: null,
error: "Upstream provider returned 502",
errorCode: "upstream_502",
};
const continuationRetry: IssueScheduledRetry = {
...transientRetry,
runId: "run-bbbbbbbb-3333-3333-3333-333333333333",
retryOfRunId: "run-prev-4444-4444-4444-444444444444",
scheduledRetryAt: inTwoDays(),
scheduledRetryAttempt: 1,
scheduledRetryReason: "max_turns_continuation",
error: null,
};
const dueNowRetry: IssueScheduledRetry = {
...transientRetry,
runId: "run-cccccccc-5555-5555-5555-555555555555",
scheduledRetryAt: justNow(),
};
const issueWithRetry = (retry: IssueScheduledRetry): Issue => ({
...baseIssue,
scheduledRetry: retry,
});
function ScheduledRetrySurfaceStories() {
return (
<div className="space-y-8 p-6">
<section className="space-y-2">
<div className="text-xs uppercase tracking-wide text-muted-foreground">
IssueScheduledRetryCard - transient failure, in 15m
</div>
<IssueScheduledRetryCard issueId={baseIssue.id} scheduledRetry={transientRetry} />
</section>
<section className="space-y-2">
<div className="text-xs uppercase tracking-wide text-muted-foreground">
IssueScheduledRetryCard - max-turn continuation, in 2d
</div>
<IssueScheduledRetryCard issueId={baseIssue.id} scheduledRetry={continuationRetry} />
</section>
<section className="space-y-2">
<div className="text-xs uppercase tracking-wide text-muted-foreground">
IssueScheduledRetryCard - due now (overdue)
</div>
<IssueScheduledRetryCard issueId={baseIssue.id} scheduledRetry={dueNowRetry} />
</section>
<section className="space-y-2">
<div className="text-xs uppercase tracking-wide text-muted-foreground">
IssueScheduledRetryCard - returns null with no live scheduled retry
</div>
<div className="rounded-lg border border-dashed border-border px-3 py-2 text-xs text-muted-foreground">
(intentionally renders nothing for issues without a live scheduled retry)
</div>
<IssueScheduledRetryCard issueId={baseIssue.id} scheduledRetry={null} />
</section>
<div className="grid gap-6 lg:grid-cols-2">
<section className="space-y-2">
<div className="text-xs uppercase tracking-wide text-muted-foreground">
IssueProperties Scheduled retry row - hidden when no live retry
</div>
<div className="rounded-lg border border-border bg-background/70 p-4">
<IssueProperties issue={baseIssue} onUpdate={() => undefined} inline />
</div>
</section>
<section className="space-y-2">
<div className="text-xs uppercase tracking-wide text-muted-foreground">
IssueProperties Scheduled retry row - transient failure, in 15m
</div>
<div className="rounded-lg border border-border bg-background/70 p-4">
<IssueProperties
issue={issueWithRetry(transientRetry)}
onUpdate={() => undefined}
inline
/>
</div>
</section>
<section className="space-y-2">
<div className="text-xs uppercase tracking-wide text-muted-foreground">
IssueProperties Scheduled retry row - continuation, in 2d
</div>
<div className="rounded-lg border border-border bg-background/70 p-4">
<IssueProperties
issue={issueWithRetry(continuationRetry)}
onUpdate={() => undefined}
inline
/>
</div>
</section>
<section className="space-y-2">
<div className="text-xs uppercase tracking-wide text-muted-foreground">
IssueProperties Scheduled retry row - due now
</div>
<div className="rounded-lg border border-border bg-background/70 p-4">
<IssueProperties
issue={issueWithRetry(dueNowRetry)}
onUpdate={() => undefined}
inline
/>
</div>
</section>
</div>
</div>
);
}
const meta = {
title: "Product/Issue Scheduled retry surfaces",
component: ScheduledRetrySurfaceStories,
parameters: {
docs: {
description: {
component:
"Surfaces the IssueScheduledRetryCard and IssueProperties Scheduled retry row in transient/continuation/due-now variants for UX review. The card mounts above IssueMonitorActivityCard and the property row sits sibling-to (and above) Monitor.",
},
},
},
} satisfies Meta<typeof ScheduledRetrySurfaceStories>;
export default meta;
type Story = StoryObj<typeof meta>;
export const ScheduledRetrySurfaces: Story = {};