paperclip/ui/storybook/stories/ux-labs.stories.tsx
Dotta 454edfe81e
Add recovery handoff system notices (#5289)
## Thinking Path

> - Paperclip orchestrates AI agents for zero-human companies.
> - Agent runs can end productively while the source issue still lacks a
durable final disposition.
> - That leaves the control plane unsure whether to resume, escalate, or
close the work.
> - Issue comments also need a presentation contract so system-authored
recovery notices can render as first-class thread messages without
overloading normal comments.
> - This pull request adds successful-run handoff recovery, comment
presentation metadata, and system notice rendering.
> - The benefit is stricter task liveness with clearer operator-facing
recovery state.

## What Changed

- Added successful-run handoff decisions, wake payloads, escalation
behavior, and recovery tests.
- Added issue comment presentation metadata with migration
`0078_white_darwin.sql` and shared/server/company portability support.
- Rendered recovery/system notices in issue chat with dedicated UI
components, fixtures, tests, and storybook/lab coverage.
- Included the current recovery model-profile hint patch so automatic
recovery follow-ups use the cheap profile.

## Verification

- `pnpm install --frozen-lockfile`
- `pnpm exec vitest run
server/src/services/recovery/successful-run-handoff.test.ts
ui/src/components/SystemNotice.test.tsx
ui/src/lib/system-notice-comment.test.ts
ui/src/components/IssueChatThreadSystemNotice.test.tsx`

## Risks

- Migration-bearing PR: merge this before any other branch that might
later add a migration.
- The branch touches both recovery services and issue-thread rendering,
so review should pay attention to recovery wake idempotency and comment
metadata compatibility.

## Model Used

- OpenAI GPT-5 Codex via Paperclip `codex_local` adapter, with
shell/git/GitHub CLI tool use.

## 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-06 06:05:58 -05:00

97 lines
2.6 KiB
TypeScript

import type { Meta, StoryObj } from "@storybook/react-vite";
import { IssueChatUxLab } from "@/pages/IssueChatUxLab";
import { InviteUxLab } from "@/pages/InviteUxLab";
import { RunTranscriptUxLab } from "@/pages/RunTranscriptUxLab";
import { SystemNoticeUxLab } from "@/pages/SystemNoticeUxLab";
function StoryFrame({ children }: { children: React.ReactNode }) {
return (
<div className="paperclip-story">
<main className="paperclip-story__inner">{children}</main>
</div>
);
}
const meta = {
title: "UX Labs/Converted Test Pages",
parameters: {
docs: {
description: {
component:
"The former in-app UX test routes are represented here as Storybook stories so fixture-backed review surfaces stay out of production routing.",
},
},
},
} satisfies Meta;
export default meta;
type Story = StoryObj<typeof meta>;
export const IssueChatReviewSurface: Story = {
name: "Issue Chat Review Surface",
render: () => (
<StoryFrame>
<IssueChatUxLab />
</StoryFrame>
),
parameters: {
docs: {
description: {
story:
"Exercises assistant-ui issue chat states: timeline events, live run stream, queued message, feedback controls, submitting bubble, empty state, and disabled composer.",
},
},
},
};
export const RunTranscriptFixtures: Story = {
name: "Run Transcript Fixtures",
render: () => (
<StoryFrame>
<RunTranscriptUxLab />
</StoryFrame>
),
parameters: {
docs: {
description: {
story:
"Exercises run transcript presentation across the run detail page, issue live widget, and dashboard card density.",
},
},
},
};
export const SystemNoticeTreatment: Story = {
name: "System Notice Treatment",
render: () => (
<StoryFrame>
<SystemNoticeUxLab />
</StoryFrame>
),
parameters: {
docs: {
description: {
story:
"Renders the first-class system notice (PAP-3525 plan): warning, danger, and neutral tones in collapsed and expanded states, an in-thread hierarchy comparison against user and agent bubbles, and a before/after replacement of the current nested user-bubble + warning-callout pattern.",
},
},
},
};
export const InviteAndAccessFlow: Story = {
name: "Invite And Access Flow",
render: () => (
<StoryFrame>
<InviteUxLab />
</StoryFrame>
),
parameters: {
docs: {
description: {
story:
"Exercises invitation and access UX states with fixture-backed role choices, landing frames, history, and failure treatments.",
},
},
},
};