mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-16 10:50:38 +09:00
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>
This commit is contained in:
parent
50db8c01d2
commit
454edfe81e
70 changed files with 21919 additions and 125 deletions
|
|
@ -89,6 +89,9 @@ type FeedbackTargetRecord = {
|
|||
createdAt: Date;
|
||||
authorAgentId: string | null;
|
||||
authorUserId: string | null;
|
||||
authorType?: string | null;
|
||||
presentation?: unknown;
|
||||
metadata?: unknown;
|
||||
createdByRunId: string | null;
|
||||
documentId: string | null;
|
||||
documentKey: string | null;
|
||||
|
|
@ -797,6 +800,9 @@ async function resolveFeedbackTarget(
|
|||
companyId: issueComments.companyId,
|
||||
authorAgentId: issueComments.authorAgentId,
|
||||
authorUserId: issueComments.authorUserId,
|
||||
authorType: issueComments.authorType,
|
||||
presentation: issueComments.presentation,
|
||||
metadata: issueComments.metadata,
|
||||
createdByRunId: issueComments.createdByRunId,
|
||||
body: issueComments.body,
|
||||
createdAt: issueComments.createdAt,
|
||||
|
|
@ -820,6 +826,9 @@ async function resolveFeedbackTarget(
|
|||
createdAt: targetComment.createdAt,
|
||||
authorAgentId: targetComment.authorAgentId,
|
||||
authorUserId: targetComment.authorUserId,
|
||||
authorType: targetComment.authorType ?? (targetComment.authorAgentId ? "agent" : targetComment.authorUserId ? "user" : "system"),
|
||||
presentation: targetComment.presentation ?? null,
|
||||
metadata: targetComment.metadata ?? null,
|
||||
createdByRunId: targetComment.createdByRunId ?? null,
|
||||
documentId: null,
|
||||
documentKey: null,
|
||||
|
|
@ -833,6 +842,9 @@ async function resolveFeedbackTarget(
|
|||
createdAt: targetComment.createdAt.toISOString(),
|
||||
authorAgentId: targetComment.authorAgentId,
|
||||
authorUserId: targetComment.authorUserId,
|
||||
authorType: targetComment.authorType ?? (targetComment.authorAgentId ? "agent" : targetComment.authorUserId ? "user" : "system"),
|
||||
presentation: targetComment.presentation ?? null,
|
||||
metadata: targetComment.metadata ?? null,
|
||||
createdByRunId: targetComment.createdByRunId ?? null,
|
||||
issuePath,
|
||||
targetPath: issuePath ? `${issuePath}#comment-${targetComment.id}` : null,
|
||||
|
|
@ -918,6 +930,9 @@ async function listIssueContextItems(
|
|||
createdAt: issueComments.createdAt,
|
||||
authorAgentId: issueComments.authorAgentId,
|
||||
authorUserId: issueComments.authorUserId,
|
||||
authorType: issueComments.authorType,
|
||||
presentation: issueComments.presentation,
|
||||
metadata: issueComments.metadata,
|
||||
createdByRunId: issueComments.createdByRunId,
|
||||
})
|
||||
.from(issueComments)
|
||||
|
|
@ -952,6 +967,9 @@ async function listIssueContextItems(
|
|||
createdAt: row.createdAt,
|
||||
authorAgentId: row.authorAgentId,
|
||||
authorUserId: row.authorUserId,
|
||||
authorType: row.authorType ?? (row.authorAgentId ? "agent" : row.authorUserId ? "user" : "system"),
|
||||
presentation: row.presentation ?? null,
|
||||
metadata: row.metadata ?? null,
|
||||
createdByRunId: row.createdByRunId ?? null,
|
||||
documentId: null,
|
||||
documentKey: null,
|
||||
|
|
@ -1023,6 +1041,9 @@ async function buildIssueContext(
|
|||
createdAt: item.createdAt.toISOString(),
|
||||
authorAgentId: item.authorAgentId,
|
||||
authorUserId: item.authorUserId,
|
||||
authorType: item.authorType ?? null,
|
||||
presentation: item.presentation ?? null,
|
||||
metadata: item.metadata ?? null,
|
||||
createdByRunId: item.createdByRunId,
|
||||
documentKey: item.documentKey,
|
||||
documentTitle: item.documentTitle,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue