diff --git a/ui/src/components/AgentLifecycleStatus.tsx b/ui/src/components/AgentLifecycleStatus.tsx
index 689a54b8314..65998141514 100644
--- a/ui/src/components/AgentLifecycleStatus.tsx
+++ b/ui/src/components/AgentLifecycleStatus.tsx
@@ -35,7 +35,7 @@ export function useAgentLifecycleStatus(agent?: Agent) {
queryKey: [...queryKeys.agents.detail(agent?.id ?? ""), "lifecycle", agent?.companyId],
queryFn: () => agentsApi.get(agent!.id, agent!.companyId),
enabled: Boolean(agent),
- select: current => ({ status: current.status, lifecycleState: current.lifecycleState,
+ select: current => ({ status: current.status, pauseReason: current.pauseReason, pausedAt: current.pausedAt, lifecycleState: current.lifecycleState,
lifecycleVersion: current.lifecycleVersion, lifecycleError: current.lifecycleError }),
refetchInterval: query => agentLifecycleRefetchInterval(query.state.data?.lifecycleState ?? agent?.lifecycleState),
});
diff --git a/ui/src/components/IssueMonitorBanner.test.tsx b/ui/src/components/IssueMonitorBanner.test.tsx
index 5680dc963af..9156408fc95 100644
--- a/ui/src/components/IssueMonitorBanner.test.tsx
+++ b/ui/src/components/IssueMonitorBanner.test.tsx
@@ -3,7 +3,7 @@
import { act } from "react";
import { flushSync } from "react-dom";
import { createRoot } from "react-dom/client";
-import type { Issue, IssueWorkProduct } from "@paperclipai/shared";
+import { PROVIDER_QUOTA_MONITOR_SERVICE_NAME, type Issue, type IssueWorkProduct } from "@paperclipai/shared";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import {
@@ -260,6 +260,49 @@ describe("IssueMonitorBanner / IssueMonitorComposerStrip rendering", () => {
flushSync(() => root.unmount());
});
+ it("offers a manual check on a blocked task without promising an automatic wake", () => {
+ const onCheckNow = vi.fn();
+ const issue = { ...issueWithMonitor(new Date(NOW.getTime() - 12 * 60_000).toISOString()), status: "blocked" as const };
+ const root = createRoot(container);
+ flushSync(() => root.render(<>
+
+
+ >));
+ expect(container.textContent).toContain("Automatic checks paused");
+ expect(container.textContent).not.toMatch(/overdue|next tick|scheduled check/i);
+ const buttons = Array.from(container.querySelectorAll("button"));
+ expect(buttons.map(button => button.textContent)).toEqual(["Check now", "Check now"]);
+ flushSync(() => buttons[1]!.click());
+ expect(onCheckNow).toHaveBeenCalledTimes(1);
+ flushSync(() => root.unmount());
+ });
+
+ it.each(["backlog", "todo"] as const)("does not offer a monitor check on a %s task", (status) => {
+ const issue = { ...issueWithMonitor(NOW.toISOString()), status };
+ const root = createRoot(container);
+ flushSync(() => root.render(<>
+
+
+ >));
+ expect(container.textContent).toContain("Resume this task to continue checking.");
+ expect(container.querySelector("button")).toBeNull();
+ expect(container.textContent).not.toMatch(/next tick|momentarily|reply wakes/i);
+ flushSync(() => root.unmount());
+ });
+
+ it("keeps blocked quota recovery paused until the task resumes", () => {
+ const issue = { ...issueWithMonitor(NOW.toISOString()), status: "blocked" as const };
+ issue.executionState!.monitor!.serviceName = PROVIDER_QUOTA_MONITOR_SERVICE_NAME;
+ const root = createRoot(container);
+ flushSync(() => root.render(<>
+
+
+ >));
+ expect(container.textContent).toContain("Resume this task to continue checking.");
+ expect(container.querySelector("button")).toBeNull();
+ flushSync(() => root.unmount());
+ });
+
it("hides the banner and strip when there is no monitor", () => {
expect(hasVisibleMonitorSurface(issueWithMonitor(null))).toBe(false);
const root = createRoot(container);
diff --git a/ui/src/components/IssueMonitorBanner.tsx b/ui/src/components/IssueMonitorBanner.tsx
index 78f36b8ca11..01021dd1c3a 100644
--- a/ui/src/components/IssueMonitorBanner.tsx
+++ b/ui/src/components/IssueMonitorBanner.tsx
@@ -18,6 +18,8 @@ import { IssuePullRequestLinks } from "@/components/IssuePullRequestLinks";
import { getIssuePullRequests, pullRequestNeedsReview } from "@/lib/issue-pull-requests";
import { cn } from "@/lib/utils";
import {
+ areAutomaticMonitorChecksPaused,
+ canCheckIssueMonitorNow,
deriveMonitorState,
formatMonitorAbsolute,
formatMonitorEta,
@@ -63,6 +65,8 @@ export interface MonitorSurfaceCopy {
tone: "info" | "warning";
workspaceWait?: boolean;
pullRequestReview?: boolean;
+ automaticChecksPaused?: boolean;
+ checkUnavailable?: boolean;
}
function capitalize(value: string): string {
@@ -79,9 +83,26 @@ export function buildMonitorSurfaceCopy(
now: MonitorDate,
scheduledRetryReason?: string | null,
pendingPullRequestReviews = 0,
+ issueStatus?: string,
): MonitorSurfaceCopy | null {
if (!isWaitingMonitorState(derived.state) || !derived.nextCheckAt) return null;
+ if (derived.source === "monitor" && areAutomaticMonitorChecksPaused({ status: issueStatus })) {
+ const canCheckNow = canCheckIssueMonitorNow({ status: issueStatus }, derived.serviceName);
+ const hint = canCheckNow
+ ? "This task is blocked. You can ask the agent to check now."
+ : "Resume this task to continue checking.";
+ return {
+ bannerTitle: "Automatic checks paused",
+ stripTitle: "Automatic checks paused",
+ bannerMeta: [hint],
+ stripMeta: [hint],
+ tone: "info",
+ automaticChecksPaused: true,
+ checkUnavailable: !canCheckNow,
+ };
+ }
+
if (derived.source === "scheduled-retry" && scheduledRetryReason === "workspace_busy") {
return {
bannerTitle: "Waiting for workspace",
@@ -162,9 +183,12 @@ function useMonitorSurfaceCopy(issue: Issue, pendingPullRequestReviews: number):
// `nextCheckAt` is stable for a given issue; derive once to seed the ticking
// countdown cadence, then re-derive against the live clock so the surfaces
// roll scheduled → due → overdue on their own.
- const nextCheckAt = useMemo(() => deriveMonitorState(issue).nextCheckAt, [issue]);
+ const nextCheckAt = useMemo(() => {
+ const derived = deriveMonitorState(issue);
+ return derived.source === "monitor" && areAutomaticMonitorChecksPaused(issue) ? null : derived.nextCheckAt;
+ }, [issue]);
const now = useMonitorCountdown(nextCheckAt);
- return useMemo(() => buildMonitorSurfaceCopy(deriveMonitorState(issue, now), now, issue.scheduledRetry?.scheduledRetryReason, pendingPullRequestReviews), [issue, now, pendingPullRequestReviews]);
+ return useMemo(() => buildMonitorSurfaceCopy(deriveMonitorState(issue, now), now, issue.scheduledRetry?.scheduledRetryReason, pendingPullRequestReviews, issue.status), [issue, now, pendingPullRequestReviews]);
}
function CheckNowButton({
@@ -262,7 +286,7 @@ export function IssueMonitorBanner({
icon={Clock}
title={copy.bannerTitle}
className={cn("relative my-3", canCancel && "pr-12")}
- actions={onCheckNow && !copy.workspaceWait ? : null}
+ actions={onCheckNow && !copy.workspaceWait && !copy.checkUnavailable ? : null}
>
{canCancel ? : null}
@@ -306,15 +330,17 @@ export function IssueMonitorComposerStrip({
{copy.stripMeta.join(" · ")}
- {onCheckNow && !copy.workspaceWait ? : null}
+ {onCheckNow && !copy.workspaceWait && !copy.checkUnavailable ? : null}
-
- {copy.pullRequestReview
- ? "Review on GitHub, then check status to have the agent verify the result."
- : copy.workspaceWait
- ? "You can keep sending instructions while the agent waits."
- : "Sending a reply wakes the agent now — before the scheduled check."}
-
+ {!copy.automaticChecksPaused ? (
+
+ {copy.pullRequestReview
+ ? "Review on GitHub, then check status to have the agent verify the result."
+ : copy.workspaceWait
+ ? "You can keep sending instructions while the agent waits."
+ : "Sending a reply wakes the agent now — before the scheduled check."}
+
+ ) : null}
{checkError ? {checkError}
: null}
);
diff --git a/ui/src/components/IssueProperties.test.tsx b/ui/src/components/IssueProperties.test.tsx
index cb981180726..5ed4d721649 100644
--- a/ui/src/components/IssueProperties.test.tsx
+++ b/ui/src/components/IssueProperties.test.tsx
@@ -3032,6 +3032,7 @@ describe("IssueProperties", () => {
};
renderMonitor(createIssue({
+ status: "in_progress",
executionPolicy: createExecutionPolicy({ monitor: { ...baseMonitorState, serviceName: "vercel-deploy" } }),
executionState: createExecutionState({ monitor: baseMonitorState }),
monitorAttemptCount: 1,
@@ -3045,6 +3046,7 @@ describe("IssueProperties", () => {
expect(monitorRowText()).toContain("Today, 4:08 PM · Attempt 1");
renderMonitor(createIssue({
+ status: "in_progress",
executionPolicy: createExecutionPolicy({ monitor: { ...baseMonitorState, nextCheckAt: at(252) } }),
executionState: createExecutionState({ monitor: { ...baseMonitorState, nextCheckAt: at(132) } }),
monitorNextCheckAt: new Date(at(192)),
@@ -3054,6 +3056,7 @@ describe("IssueProperties", () => {
expect(monitorRowText()).toContain("Today, 4:08 PM");
renderMonitor(createIssue({
+ status: "in_progress",
executionPolicy: createExecutionPolicy({ monitor: { ...baseMonitorState, serviceName: "vercel-deploy" } }),
executionState: createExecutionState({ monitor: { ...baseMonitorState, attemptCount: 3 } }),
monitorAttemptCount: 3,
@@ -3062,6 +3065,7 @@ describe("IssueProperties", () => {
expect(monitorRowText()).toContain("Attempt 3");
renderMonitor(createIssue({
+ status: "in_progress",
executionPolicy: createExecutionPolicy({ monitor: { ...baseMonitorState, nextCheckAt: at(0) } }),
executionState: createExecutionState({ monitor: { ...baseMonitorState, nextCheckAt: at(0) } }),
}));
@@ -3070,6 +3074,7 @@ describe("IssueProperties", () => {
expect(monitorRowText()).toContain("checking momentarily…");
renderMonitor(createIssue({
+ status: "in_progress",
executionPolicy: createExecutionPolicy({ monitor: { ...baseMonitorState, nextCheckAt: at(-18) } }),
executionState: createExecutionState({ monitor: { ...baseMonitorState, nextCheckAt: at(-18) } }),
}));
@@ -3078,6 +3083,17 @@ describe("IssueProperties", () => {
expect(monitorRowText()).toContain("Today, 1:38 PM · fires on next tick");
renderMonitor(createIssue({
+ status: "blocked",
+ executionPolicy: createExecutionPolicy({ monitor: { ...baseMonitorState, nextCheckAt: at(-18) } }),
+ executionState: createExecutionState({ monitor: { ...baseMonitorState, nextCheckAt: at(-18) } }),
+ }));
+ await flush();
+ expect(monitorRowText()).toContain("Automatic checks paused");
+ expect(monitorRowText()).toContain("Check now to request a manual check");
+ expect(monitorRowText()).not.toMatch(/overdue|next tick/i);
+
+ renderMonitor(createIssue({
+ status: "in_progress",
executionPolicy: createExecutionPolicy(),
executionState: createExecutionState({ monitor: {
...baseMonitorState,
diff --git a/ui/src/components/issue-properties/IssueProperties.tsx b/ui/src/components/issue-properties/IssueProperties.tsx
index 924c7c8eb05..91ccdb43932 100644
--- a/ui/src/components/issue-properties/IssueProperties.tsx
+++ b/ui/src/components/issue-properties/IssueProperties.tsx
@@ -50,6 +50,8 @@ import { formatAssigneeUserLabel, formatUserLabel } from "../../lib/assignees";
import { buildExecutionPolicy, stageParticipantValues } from "../../lib/issue-execution-policy";
import { useExecutionPolicy } from "../../hooks/useExecutionPolicy";
import {
+ areAutomaticMonitorChecksPaused,
+ canCheckIssueMonitorNow,
formatMonitorAbsolute,
formatMonitorAbsoluteFull,
formatMonitorEta,
@@ -1323,17 +1325,21 @@ export function IssueProperties({
const monitorLastTriggeredAt = issue.monitorLastTriggeredAt ?? monitorState?.lastTriggeredAt ?? null;
const monitorServiceName = executionPolicy?.monitor?.serviceName ?? monitorState?.serviceName ?? null;
const monitorNotes = executionPolicy?.monitor?.notes ?? monitorState?.notes ?? null;
- const monitorNow = useMonitorCountdown(monitorNextCheckAt);
+ const monitorPaused = areAutomaticMonitorChecksPaused(issue);
+ const canCheckMonitorNow = canCheckIssueMonitorNow(issue, monitorServiceName);
+ const monitorNow = useMonitorCountdown(monitorPaused ? null : monitorNextCheckAt);
const monitorRelative = monitorNextCheckAt ? formatMonitorEta(monitorNextCheckAt, monitorNow) : null;
const monitorIsDueNow = monitorRelative === "due now";
const monitorIsOverdue = Boolean(monitorRelative?.startsWith("overdue by "));
const monitorPrimary = monitorNextCheckAt
- ? formatMonitorEtaLabel(monitorNextCheckAt, monitorNow)
+ ? monitorPaused ? "Automatic checks paused" : formatMonitorEtaLabel(monitorNextCheckAt, monitorNow)
: monitorState?.status === "cleared"
? "Cleared"
: "None";
const monitorSecondary = monitorNextCheckAt
- ? monitorIsDueNow
+ ? monitorPaused
+ ? canCheckMonitorNow ? "Check now to request a manual check" : "Resume this task to continue checking"
+ : monitorIsDueNow
? "checking momentarily…"
: `${formatMonitorAbsolute(monitorNextCheckAt, {}, monitorNow)}${monitorIsOverdue ? " · fires on next tick" : monitorAttemptCount > 0 ? ` · Attempt ${monitorAttemptCount}` : ""}`
: monitorState?.status === "cleared"
@@ -1376,7 +1382,7 @@ export function IssueProperties({
Next check
{formatMonitorAbsoluteFull(monitorNextCheckAt)}
-
{monitorRelative}
+
{monitorPaused ? "Automatic checks paused" : monitorRelative}
Watching
@@ -1392,7 +1398,7 @@ export function IssueProperties({
- {onCheckMonitorNow ? (
+ {onCheckMonitorNow && canCheckMonitorNow ? (
{ setMonitorDetailsOpen(false); onCheckMonitorNow(); }}>
{checkingMonitorNow ? "Checking…" : "Check now"}
diff --git a/ui/src/lib/issue-monitor.ts b/ui/src/lib/issue-monitor.ts
index 3a313b1ba17..90eecaeb9c4 100644
--- a/ui/src/lib/issue-monitor.ts
+++ b/ui/src/lib/issue-monitor.ts
@@ -1,4 +1,5 @@
import { useEffect, useState } from "react";
+import { PROVIDER_QUOTA_MONITOR_SERVICE_NAME } from "@paperclipai/shared";
const SECOND_MS = 1_000;
const MINUTE_MS = 60 * SECOND_MS;
@@ -56,6 +57,15 @@ export interface MonitorDateTimeFormatOptions {
timeZone?: string;
}
+export function areAutomaticMonitorChecksPaused(issue: Pick
): boolean {
+ return issue.status !== undefined && issue.status !== "in_progress" && issue.status !== "in_review";
+}
+
+export function canCheckIssueMonitorNow(issue: Pick, serviceName?: string | null): boolean {
+ return !areAutomaticMonitorChecksPaused(issue) ||
+ (issue.status === "blocked" && serviceName !== PROVIDER_QUOTA_MONITOR_SERVICE_NAME);
+}
+
function toTimestamp(value: MonitorDate): number {
const timestamp = new Date(value).getTime();
if (Number.isNaN(timestamp)) throw new RangeError("Invalid monitor date");
diff --git a/ui/storybook/stories/task-coordination/monitor-surfaces.stories.tsx b/ui/storybook/stories/task-coordination/monitor-surfaces.stories.tsx
index 35585c557b3..c74133c5ee0 100644
--- a/ui/storybook/stories/task-coordination/monitor-surfaces.stories.tsx
+++ b/ui/storybook/stories/task-coordination/monitor-surfaces.stories.tsx
@@ -1,7 +1,9 @@
import type { Meta, StoryObj } from "@storybook/react-vite";
+import { useState } from "react";
import type { Issue } from "@paperclipai/shared";
import { IssueMonitorBanner, IssueMonitorComposerStrip } from "@/components/IssueMonitorBanner";
import { IssueProperties } from "@/components/IssueProperties";
+import { prepareFixtureApi } from "../../support/capability-gaps/api";
import {
storybookExecutionWorkspaces,
storybookIssueDocuments,
@@ -335,3 +337,27 @@ export default meta;
type Story = StoryObj;
export const MonitorSurfaces: Story = {};
+
+export const BlockedTask: Story = {
+ beforeEach: () => prepareFixtureApi([
+ { path: `/api/issues/${overdueMonitorIssue.id}/work-products`, read: () => [] },
+ ]).cleanup,
+ render: function BlockedMonitor() {
+ const [checkingNow, setCheckingNow] = useState(false);
+ const issue = { ...overdueMonitorIssue, status: "blocked" as const };
+ const onCheckNow = () => setCheckingNow(true);
+ return
+
+
+ undefined} onCheckMonitorNow={onCheckNow} checkingMonitorNow={checkingNow} inline />
+
;
+ },
+ parameters: {
+ paperclip: {
+ capabilities: ["task-coordination/tree-control", "tasks/properties"],
+ implementation: "production",
+ boundary: "fixtures",
+ notes: "A retained monitor on a blocked task. Automatic checks are paused. Clicking Check now shows the shared pending state; dispatch is simulated.",
+ },
+ },
+};