454edfe81e
## 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>
205 lines
5.4 KiB
TypeScript
205 lines
5.4 KiB
TypeScript
import type {
|
|
SystemNoticeMetadataSection,
|
|
SystemNoticeProps,
|
|
} from "../components/SystemNotice";
|
|
|
|
export type SystemNoticeFixture = {
|
|
id: string;
|
|
caption: string;
|
|
} & SystemNoticeProps;
|
|
|
|
const HANDOFF_METADATA: SystemNoticeMetadataSection[] = [
|
|
{
|
|
title: "Recovery owner",
|
|
rows: [
|
|
{
|
|
kind: "issue",
|
|
label: "Recovery issue",
|
|
identifier: "PAP-3440",
|
|
href: "/PAP/issues/PAP-3440",
|
|
title: "Successful run handoff missing disposition",
|
|
},
|
|
{
|
|
kind: "agent",
|
|
label: "Owner",
|
|
name: "CTO",
|
|
href: "/PAP/agents/cto",
|
|
},
|
|
{
|
|
kind: "text",
|
|
label: "Suggested action",
|
|
value: "Reassign to a recovery agent and pick a disposition.",
|
|
},
|
|
],
|
|
},
|
|
{
|
|
title: "Run evidence",
|
|
rows: [
|
|
{
|
|
kind: "run",
|
|
label: "Source run",
|
|
runId: "9cdba892-c7ca-4d93-8604-4843873b127c",
|
|
href: "/PAP/agents/codexcoder/runs/9cdba892-c7ca-4d93-8604-4843873b127c",
|
|
status: "succeeded",
|
|
},
|
|
{
|
|
kind: "run",
|
|
label: "Recovery run",
|
|
runId: "61fdb79b-8012-4676-ac71-2971830e126a",
|
|
href: "/PAP/agents/codexcoder/runs/61fdb79b-8012-4676-ac71-2971830e126a",
|
|
status: "failed",
|
|
},
|
|
{
|
|
kind: "text",
|
|
label: "Normalized cause",
|
|
value: "Run completed without issuing a disposition for an in_progress task.",
|
|
},
|
|
],
|
|
},
|
|
];
|
|
|
|
const REQUIRED_METADATA: SystemNoticeMetadataSection[] = [
|
|
{
|
|
title: "Required action",
|
|
rows: [
|
|
{
|
|
kind: "issue",
|
|
label: "Source issue",
|
|
identifier: "PAP-3440",
|
|
href: "/PAP/issues/PAP-3440",
|
|
title: "Successful run handoff missing disposition",
|
|
},
|
|
{
|
|
kind: "agent",
|
|
label: "Assignee",
|
|
name: "CodexCoder",
|
|
href: "/PAP/agents/codexcoder",
|
|
},
|
|
{
|
|
kind: "text",
|
|
label: "Next step",
|
|
value: "Pick done, blocked, or in_review and post a one-line rationale.",
|
|
},
|
|
],
|
|
},
|
|
{
|
|
title: "Run context",
|
|
rows: [
|
|
{
|
|
kind: "run",
|
|
label: "Successful run",
|
|
runId: "9cdba892-c7ca-4d93-8604-4843873b127c",
|
|
href: "/PAP/agents/codexcoder/runs/9cdba892-c7ca-4d93-8604-4843873b127c",
|
|
status: "succeeded",
|
|
},
|
|
{
|
|
kind: "code",
|
|
label: "Status before",
|
|
value: "in_progress",
|
|
},
|
|
],
|
|
},
|
|
];
|
|
|
|
const NEUTRAL_METADATA: SystemNoticeMetadataSection[] = [
|
|
{
|
|
rows: [
|
|
{
|
|
kind: "agent",
|
|
label: "Reassigned to",
|
|
name: "ClaudeFixer",
|
|
href: "/PAP/agents/claudefixer",
|
|
},
|
|
{
|
|
kind: "agent",
|
|
label: "From",
|
|
name: "CodexCoder",
|
|
href: "/PAP/agents/codexcoder",
|
|
},
|
|
{
|
|
kind: "text",
|
|
label: "Reason",
|
|
value: "Manual reassignment requested by Board.",
|
|
},
|
|
],
|
|
},
|
|
];
|
|
|
|
export const systemNoticeFixtures: readonly SystemNoticeFixture[] = [
|
|
{
|
|
id: "warning-collapsed",
|
|
caption: "Warning · collapsed (default)",
|
|
tone: "warning",
|
|
label: "System warning",
|
|
source: { label: "Paperclip", href: "/PAP/agents" },
|
|
timestamp: "2026-05-04T16:32:00.000Z",
|
|
body: "Paperclip needs a disposition before this issue can continue.",
|
|
metadata: REQUIRED_METADATA,
|
|
detailsDefaultOpen: false,
|
|
},
|
|
{
|
|
id: "warning-expanded",
|
|
caption: "Warning · expanded",
|
|
tone: "warning",
|
|
label: "System warning",
|
|
source: { label: "Paperclip", href: "/PAP/agents" },
|
|
timestamp: "2026-05-04T16:32:00.000Z",
|
|
body: "Paperclip needs a disposition before this issue can continue.",
|
|
metadata: REQUIRED_METADATA,
|
|
detailsDefaultOpen: true,
|
|
},
|
|
{
|
|
id: "danger-collapsed",
|
|
caption: "Danger · collapsed (default)",
|
|
tone: "danger",
|
|
label: "System alert",
|
|
source: { label: "Paperclip", href: "/PAP/agents" },
|
|
timestamp: "2026-05-04T16:48:00.000Z",
|
|
body: "Paperclip could not resolve this issue's missing disposition automatically. The issue is blocked on a recovery owner.",
|
|
metadata: HANDOFF_METADATA,
|
|
detailsDefaultOpen: false,
|
|
},
|
|
{
|
|
id: "danger-expanded",
|
|
caption: "Danger · expanded",
|
|
tone: "danger",
|
|
label: "System alert",
|
|
source: { label: "Paperclip", href: "/PAP/agents" },
|
|
timestamp: "2026-05-04T16:48:00.000Z",
|
|
body: "Paperclip could not resolve this issue's missing disposition automatically. The issue is blocked on a recovery owner.",
|
|
metadata: HANDOFF_METADATA,
|
|
detailsDefaultOpen: true,
|
|
},
|
|
{
|
|
id: "neutral-collapsed",
|
|
caption: "Neutral · collapsed (default)",
|
|
tone: "neutral",
|
|
label: "System notice",
|
|
source: { label: "Paperclip" },
|
|
timestamp: "2026-05-04T15:10:00.000Z",
|
|
body: "Reassigned to ClaudeFixer.",
|
|
metadata: NEUTRAL_METADATA,
|
|
detailsDefaultOpen: false,
|
|
},
|
|
{
|
|
id: "neutral-expanded",
|
|
caption: "Neutral · expanded",
|
|
tone: "neutral",
|
|
label: "System notice",
|
|
source: { label: "Paperclip" },
|
|
timestamp: "2026-05-04T15:10:00.000Z",
|
|
body: "Reassigned to ClaudeFixer.",
|
|
metadata: NEUTRAL_METADATA,
|
|
detailsDefaultOpen: true,
|
|
},
|
|
{
|
|
id: "warning-no-details",
|
|
caption: "Warning · no metadata (Details affordance hidden)",
|
|
tone: "warning",
|
|
label: "System warning",
|
|
source: { label: "Paperclip" },
|
|
timestamp: "2026-05-04T17:02:00.000Z",
|
|
body: "This run paused while waiting on board approval.",
|
|
},
|
|
];
|