mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-15 18:30:39 +09:00
## Thinking Path > - Paperclip orchestrates AI agents through issue checkout, heartbeat runs, routines, and auditable control-plane state > - The runtime path has to recover from lost local processes, transient adapter failures, blocked dependencies, and routine coalescing without stranding work > - The existing branch carried several reliability fixes across heartbeat scheduling, issue runtime controls, routine dispatch, and operator-facing run state > - These changes belong together because they share backend contracts, migrations, and runtime status semantics > - This pull request groups the control-plane/runtime slice so it can merge independently from board UI polish and adapter sandbox work > - The benefit is safer heartbeat recovery, clearer runtime controls, and more predictable recurring execution behavior ## What Changed - Adds bounded heartbeat retry scheduling, scheduled retry state, and Codex transient failure recovery handling. - Tightens heartbeat process recovery, blocker wake behavior, issue comment wake handling, routine dispatch coalescing, and activity/dashboard bounds. - Adds runtime-control MCP tools and Paperclip skill docs for issue workspace runtime management. - Adds migrations `0061_lively_thor_girl.sql` and `0062_routine_run_dispatch_fingerprint.sql`. - Surfaces retry state in run ledger/agent UI and keeps related shared types synchronized. ## Verification - `pnpm exec vitest run server/src/__tests__/heartbeat-retry-scheduling.test.ts server/src/__tests__/heartbeat-process-recovery.test.ts server/src/__tests__/routines-service.test.ts` - `pnpm exec vitest run src/tools.test.ts` from `packages/mcp-server` ## Risks - Medium risk: this touches heartbeat recovery and routine dispatch, which are central execution paths. - Migration order matters if split branches land out of order: merge this PR before branches that assume the new runtime/routine fields. - Runtime retry behavior should be watched in CI and in local operator smoke tests because it changes how transient failures are resumed. > 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, GPT-5-based coding agent runtime, shell/git tool use enabled. Exact hosted model build and context window are not exposed in this Paperclip heartbeat environment. ## 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 - [ ] 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
109 lines
5.1 KiB
TypeScript
109 lines
5.1 KiB
TypeScript
/**
|
|
* Canonical status & priority color definitions.
|
|
*
|
|
* Every component that renders a status indicator (StatusIcon, StatusBadge,
|
|
* agent status dots, etc.) should import from here so colors stay consistent.
|
|
*/
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// Issue status colors
|
|
// ---------------------------------------------------------------------------
|
|
|
|
/** StatusIcon circle: text + border classes */
|
|
export const issueStatusIcon: Record<string, string> = {
|
|
backlog: "text-muted-foreground border-muted-foreground",
|
|
todo: "text-blue-600 border-blue-600 dark:text-blue-400 dark:border-blue-400",
|
|
in_progress: "text-yellow-600 border-yellow-600 dark:text-yellow-400 dark:border-yellow-400",
|
|
in_review: "text-violet-600 border-violet-600 dark:text-violet-400 dark:border-violet-400",
|
|
done: "text-green-600 border-green-600 dark:text-green-400 dark:border-green-400",
|
|
cancelled: "text-neutral-500 border-neutral-500",
|
|
blocked: "text-red-600 border-red-600 dark:text-red-400 dark:border-red-400",
|
|
};
|
|
|
|
export const issueStatusIconDefault = "text-muted-foreground border-muted-foreground";
|
|
|
|
/** Text-only color for issue statuses (dropdowns, labels) */
|
|
export const issueStatusText: Record<string, string> = {
|
|
backlog: "text-muted-foreground",
|
|
todo: "text-blue-600 dark:text-blue-400",
|
|
in_progress: "text-yellow-600 dark:text-yellow-400",
|
|
in_review: "text-violet-600 dark:text-violet-400",
|
|
done: "text-green-600 dark:text-green-400",
|
|
cancelled: "text-neutral-500",
|
|
blocked: "text-red-600 dark:text-red-400",
|
|
};
|
|
|
|
export const issueStatusTextDefault = "text-muted-foreground";
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// Badge colors — used by StatusBadge for all entity types
|
|
// ---------------------------------------------------------------------------
|
|
|
|
export const statusBadge: Record<string, string> = {
|
|
// Agent statuses
|
|
active: "bg-green-100 text-green-700 dark:bg-green-900/50 dark:text-green-300",
|
|
running: "bg-cyan-100 text-cyan-700 dark:bg-cyan-900/50 dark:text-cyan-300",
|
|
scheduled_retry: "bg-sky-100 text-sky-700 dark:bg-sky-900/50 dark:text-sky-300",
|
|
paused: "bg-orange-100 text-orange-700 dark:bg-orange-900/50 dark:text-orange-300",
|
|
idle: "bg-yellow-100 text-yellow-700 dark:bg-yellow-900/50 dark:text-yellow-300",
|
|
archived: "bg-muted text-muted-foreground",
|
|
|
|
// Goal statuses
|
|
planned: "bg-muted text-muted-foreground",
|
|
achieved: "bg-green-100 text-green-700 dark:bg-green-900/50 dark:text-green-300",
|
|
completed: "bg-green-100 text-green-700 dark:bg-green-900/50 dark:text-green-300",
|
|
|
|
// Run statuses
|
|
failed: "bg-red-100 text-red-700 dark:bg-red-900/50 dark:text-red-300",
|
|
timed_out: "bg-orange-100 text-orange-700 dark:bg-orange-900/50 dark:text-orange-300",
|
|
succeeded: "bg-green-100 text-green-700 dark:bg-green-900/50 dark:text-green-300",
|
|
error: "bg-red-100 text-red-700 dark:bg-red-900/50 dark:text-red-300",
|
|
terminated: "bg-red-100 text-red-700 dark:bg-red-900/50 dark:text-red-300",
|
|
pending: "bg-yellow-100 text-yellow-700 dark:bg-yellow-900/50 dark:text-yellow-300",
|
|
|
|
// Approval statuses
|
|
pending_approval: "bg-amber-100 text-amber-700 dark:bg-amber-900/50 dark:text-amber-300",
|
|
revision_requested: "bg-amber-100 text-amber-700 dark:bg-amber-900/50 dark:text-amber-300",
|
|
approved: "bg-green-100 text-green-700 dark:bg-green-900/50 dark:text-green-300",
|
|
rejected: "bg-red-100 text-red-700 dark:bg-red-900/50 dark:text-red-300",
|
|
|
|
// Issue statuses — consistent hues with issueStatusIcon above
|
|
backlog: "bg-muted text-muted-foreground",
|
|
todo: "bg-blue-100 text-blue-700 dark:bg-blue-900/50 dark:text-blue-300",
|
|
in_progress: "bg-yellow-100 text-yellow-700 dark:bg-yellow-900/50 dark:text-yellow-300",
|
|
in_review: "bg-violet-100 text-violet-700 dark:bg-violet-900/50 dark:text-violet-300",
|
|
blocked: "bg-red-100 text-red-700 dark:bg-red-900/50 dark:text-red-300",
|
|
done: "bg-green-100 text-green-700 dark:bg-green-900/50 dark:text-green-300",
|
|
cancelled: "bg-muted text-muted-foreground",
|
|
};
|
|
|
|
export const statusBadgeDefault = "bg-muted text-muted-foreground";
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// Agent status dot — solid background for small indicator dots
|
|
// ---------------------------------------------------------------------------
|
|
|
|
export const agentStatusDot: Record<string, string> = {
|
|
running: "bg-cyan-400 animate-pulse",
|
|
active: "bg-green-400",
|
|
paused: "bg-yellow-400",
|
|
idle: "bg-yellow-400",
|
|
pending_approval: "bg-amber-400",
|
|
error: "bg-red-400",
|
|
archived: "bg-neutral-400",
|
|
};
|
|
|
|
export const agentStatusDotDefault = "bg-neutral-400";
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// Priority colors
|
|
// ---------------------------------------------------------------------------
|
|
|
|
export const priorityColor: Record<string, string> = {
|
|
critical: "text-red-600 dark:text-red-400",
|
|
high: "text-orange-600 dark:text-orange-400",
|
|
medium: "text-yellow-600 dark:text-yellow-400",
|
|
low: "text-blue-600 dark:text-blue-400",
|
|
};
|
|
|
|
export const priorityColorDefault = "text-yellow-600 dark:text-yellow-400";
|