2026-02-20 14:03:43 -06:00
|
|
|
import { useEffect, useState } from "react";
|
2026-03-02 16:44:03 -06:00
|
|
|
import { Link } from "@/lib/router";
|
2026-02-20 13:47:13 -06:00
|
|
|
import { X } from "lucide-react";
|
[codex] Harden execution reliability and heartbeat tooling (#3679)
## Thinking Path
> - Paperclip orchestrates AI agents for zero-human companies
> - Reliable execution depends on heartbeat routing, issue lifecycle
semantics, telemetry, and a fast enough local verification loop to keep
regressions visible
> - The remaining commits on this branch were mostly server/runtime
correctness fixes plus test and documentation follow-ups in that area
> - Those changes are logically separate from the UI-focused
issue-detail and workspace/navigation branches even when they touch
overlapping issue APIs
> - This pull request groups the execution reliability, heartbeat,
telemetry, and tooling changes into one standalone branch
> - The benefit is a focused review of the control-plane correctness
work, including the follow-up fix that restored the implicit
comment-reopen helpers after branch splitting
## What Changed
- Hardened issue/heartbeat execution behavior, including self-review
stage skipping, deferred mention wakes during active execution, stranded
execution recovery, active-run scoping, assignee resolution, and
blocked-to-todo wake resumption
- Reduced noisy polling/logging overhead by trimming issue run payloads,
compacting persisted run logs, silencing high-volume request logs, and
capping heartbeat-run queries in dashboard/inbox surfaces
- Expanded telemetry and status semantics with adapter/model fields on
task completion plus clearer status guidance in docs/onboarding material
- Updated test infrastructure and verification defaults with faster
route-test module isolation, cheaper default `pnpm test`, e2e isolation
from local state, and repo verification follow-ups
- Included docs/release housekeeping from the branch and added a small
follow-up commit restoring the implicit comment-reopen helpers that were
dropped during branch reconstruction
## Verification
- `pnpm vitest run
server/src/__tests__/issue-comment-reopen-routes.test.ts
server/src/__tests__/issue-telemetry-routes.test.ts`
- `pnpm vitest run server/src/__tests__/http-log-policy.test.ts
server/src/__tests__/heartbeat-run-log.test.ts
server/src/__tests__/health.test.ts`
- `server/src/__tests__/activity-service.test.ts`,
`server/src/__tests__/heartbeat-comment-wake-batching.test.ts`, and
`server/src/__tests__/heartbeat-process-recovery.test.ts` were attempted
on this host but the embedded Postgres harness reported
init-script/data-dir problems and skipped or failed to start, so they
are noted as environment-limited
## Risks
- Medium: this branch changes core issue/heartbeat routing and
reopen/wakeup behavior, so regressions would affect agent execution flow
rather than isolated UI polish
- Because it also updates verification infrastructure, reviewers should
pay attention to whether the new tests are asserting the right failure
modes and not just reshaping harness behavior
## Model Used
- OpenAI Codex coding agent (GPT-5-class runtime in Codex CLI; exact
deployed model ID is not exposed in this environment), reasoning
enabled, tool use and local code execution enabled
## 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)
- [ ] 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
---------
Co-authored-by: Paperclip <noreply@paperclip.ing>
2026-04-14 13:34:52 -05:00
|
|
|
import {
|
|
|
|
|
useToastActions,
|
|
|
|
|
useToastState,
|
|
|
|
|
type ToastItem,
|
|
|
|
|
type ToastTone,
|
|
|
|
|
} from "../context/ToastContext";
|
2026-02-20 13:47:13 -06:00
|
|
|
import { cn } from "../lib/utils";
|
|
|
|
|
|
|
|
|
|
const toneClasses: Record<ToastTone, string> = {
|
2026-02-26 16:32:02 -06:00
|
|
|
info: "border-sky-300 bg-sky-50 text-sky-900 dark:border-sky-500/25 dark:bg-sky-950/60 dark:text-sky-100",
|
|
|
|
|
success: "border-emerald-300 bg-emerald-50 text-emerald-900 dark:border-emerald-500/25 dark:bg-emerald-950/60 dark:text-emerald-100",
|
|
|
|
|
warn: "border-amber-300 bg-amber-50 text-amber-900 dark:border-amber-500/25 dark:bg-amber-950/60 dark:text-amber-100",
|
|
|
|
|
error: "border-red-300 bg-red-50 text-red-900 dark:border-red-500/30 dark:bg-red-950/60 dark:text-red-100",
|
2026-02-20 13:47:13 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const toneDotClasses: Record<ToastTone, string> = {
|
2026-02-26 16:32:02 -06:00
|
|
|
info: "bg-sky-500 dark:bg-sky-400",
|
|
|
|
|
success: "bg-emerald-500 dark:bg-emerald-400",
|
|
|
|
|
warn: "bg-amber-500 dark:bg-amber-400",
|
|
|
|
|
error: "bg-red-500 dark:bg-red-400",
|
2026-02-20 13:47:13 -06:00
|
|
|
};
|
|
|
|
|
|
2026-02-20 14:03:43 -06:00
|
|
|
function AnimatedToast({
|
|
|
|
|
toast,
|
|
|
|
|
onDismiss,
|
|
|
|
|
}: {
|
|
|
|
|
toast: ToastItem;
|
|
|
|
|
onDismiss: (id: string) => void;
|
|
|
|
|
}) {
|
|
|
|
|
const [visible, setVisible] = useState(false);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
const frame = requestAnimationFrame(() => setVisible(true));
|
|
|
|
|
return () => cancelAnimationFrame(frame);
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<li
|
|
|
|
|
className={cn(
|
2026-03-02 16:44:03 -06:00
|
|
|
"pointer-events-auto rounded-sm border shadow-lg backdrop-blur-xl transition-[transform,opacity] duration-200 ease-out",
|
2026-02-20 14:03:43 -06:00
|
|
|
visible
|
|
|
|
|
? "translate-y-0 opacity-100"
|
|
|
|
|
: "translate-y-3 opacity-0",
|
|
|
|
|
toneClasses[toast.tone],
|
|
|
|
|
)}
|
|
|
|
|
>
|
|
|
|
|
<div className="flex items-start gap-3 px-3 py-2.5">
|
|
|
|
|
<span className={cn("mt-1 h-2 w-2 shrink-0 rounded-full", toneDotClasses[toast.tone])} />
|
|
|
|
|
<div className="min-w-0 flex-1">
|
|
|
|
|
<p className="text-sm font-semibold leading-5">{toast.title}</p>
|
|
|
|
|
{toast.body && (
|
|
|
|
|
<p className="mt-1 text-xs leading-4 opacity-70">
|
|
|
|
|
{toast.body}
|
|
|
|
|
</p>
|
|
|
|
|
)}
|
|
|
|
|
{toast.action && (
|
|
|
|
|
<Link
|
|
|
|
|
to={toast.action.href}
|
|
|
|
|
onClick={() => onDismiss(toast.id)}
|
|
|
|
|
className="mt-2 inline-flex text-xs font-medium underline underline-offset-4 hover:opacity-90"
|
|
|
|
|
>
|
|
|
|
|
{toast.action.label}
|
|
|
|
|
</Link>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
aria-label="Dismiss notification"
|
|
|
|
|
onClick={() => onDismiss(toast.id)}
|
2026-02-26 16:32:02 -06:00
|
|
|
className="mt-0.5 shrink-0 rounded p-1 opacity-50 hover:bg-black/10 hover:opacity-100 dark:hover:bg-white/10"
|
2026-02-20 14:03:43 -06:00
|
|
|
>
|
|
|
|
|
<X className="h-3.5 w-3.5" />
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</li>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-20 13:47:13 -06:00
|
|
|
export function ToastViewport() {
|
[codex] Harden execution reliability and heartbeat tooling (#3679)
## Thinking Path
> - Paperclip orchestrates AI agents for zero-human companies
> - Reliable execution depends on heartbeat routing, issue lifecycle
semantics, telemetry, and a fast enough local verification loop to keep
regressions visible
> - The remaining commits on this branch were mostly server/runtime
correctness fixes plus test and documentation follow-ups in that area
> - Those changes are logically separate from the UI-focused
issue-detail and workspace/navigation branches even when they touch
overlapping issue APIs
> - This pull request groups the execution reliability, heartbeat,
telemetry, and tooling changes into one standalone branch
> - The benefit is a focused review of the control-plane correctness
work, including the follow-up fix that restored the implicit
comment-reopen helpers after branch splitting
## What Changed
- Hardened issue/heartbeat execution behavior, including self-review
stage skipping, deferred mention wakes during active execution, stranded
execution recovery, active-run scoping, assignee resolution, and
blocked-to-todo wake resumption
- Reduced noisy polling/logging overhead by trimming issue run payloads,
compacting persisted run logs, silencing high-volume request logs, and
capping heartbeat-run queries in dashboard/inbox surfaces
- Expanded telemetry and status semantics with adapter/model fields on
task completion plus clearer status guidance in docs/onboarding material
- Updated test infrastructure and verification defaults with faster
route-test module isolation, cheaper default `pnpm test`, e2e isolation
from local state, and repo verification follow-ups
- Included docs/release housekeeping from the branch and added a small
follow-up commit restoring the implicit comment-reopen helpers that were
dropped during branch reconstruction
## Verification
- `pnpm vitest run
server/src/__tests__/issue-comment-reopen-routes.test.ts
server/src/__tests__/issue-telemetry-routes.test.ts`
- `pnpm vitest run server/src/__tests__/http-log-policy.test.ts
server/src/__tests__/heartbeat-run-log.test.ts
server/src/__tests__/health.test.ts`
- `server/src/__tests__/activity-service.test.ts`,
`server/src/__tests__/heartbeat-comment-wake-batching.test.ts`, and
`server/src/__tests__/heartbeat-process-recovery.test.ts` were attempted
on this host but the embedded Postgres harness reported
init-script/data-dir problems and skipped or failed to start, so they
are noted as environment-limited
## Risks
- Medium: this branch changes core issue/heartbeat routing and
reopen/wakeup behavior, so regressions would affect agent execution flow
rather than isolated UI polish
- Because it also updates verification infrastructure, reviewers should
pay attention to whether the new tests are asserting the right failure
modes and not just reshaping harness behavior
## Model Used
- OpenAI Codex coding agent (GPT-5-class runtime in Codex CLI; exact
deployed model ID is not exposed in this environment), reasoning
enabled, tool use and local code execution enabled
## 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)
- [ ] 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
---------
Co-authored-by: Paperclip <noreply@paperclip.ing>
2026-04-14 13:34:52 -05:00
|
|
|
const toasts = useToastState();
|
|
|
|
|
const { dismissToast } = useToastActions();
|
2026-02-20 13:47:13 -06:00
|
|
|
|
|
|
|
|
if (toasts.length === 0) return null;
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<aside
|
|
|
|
|
aria-live="polite"
|
|
|
|
|
aria-atomic="false"
|
2026-02-20 14:03:43 -06:00
|
|
|
className="pointer-events-none fixed bottom-3 left-3 z-[120] w-full max-w-sm px-1"
|
2026-02-20 13:47:13 -06:00
|
|
|
>
|
2026-02-20 14:03:43 -06:00
|
|
|
<ol className="flex w-full flex-col-reverse gap-2">
|
2026-02-20 13:47:13 -06:00
|
|
|
{toasts.map((toast) => (
|
2026-02-20 14:03:43 -06:00
|
|
|
<AnimatedToast
|
2026-02-20 13:47:13 -06:00
|
|
|
key={toast.id}
|
2026-02-20 14:03:43 -06:00
|
|
|
toast={toast}
|
|
|
|
|
onDismiss={dismissToast}
|
|
|
|
|
/>
|
2026-02-20 13:47:13 -06:00
|
|
|
))}
|
|
|
|
|
</ol>
|
|
|
|
|
</aside>
|
|
|
|
|
);
|
|
|
|
|
}
|