The open-source app everyone uses to manage agents at work
TypeScript acpxagent-orchestrationagent-skillsagentic-aiai-agentsai-engineeringai-governanceai-toolsautonomous-agentsclaudeclaude-codeclaude-skillscodexhermesllmmcpmulti-agentopenclawproject-managementworkflow-automation
feat: dedicated import pause reason with visible paused-assignee notices (#12140)
Devin Foley11f6c754c919
diff --git a/packages/shared/src/constants.ts b/packages/shared/src/constants.tsindex 935cf0e510..734e2f1739 100644--- a/packages/shared/src/constants.ts+++ b/packages/shared/src/constants.ts@@ -669,7 +669,10 @@ export type RoutineRunStatus = (typeof ROUTINE_RUN_STATUSES)[number];export const ROUTINE_RUN_SOURCES = ["schedule", "manual", "api", "webhook"] as const;export type RoutineRunSource = (typeof ROUTINE_RUN_SOURCES)[number];-export const PAUSE_REASONS = ["manual", "budget", "system", "company_archived"] as const;+// "import" marks agents parked by a company import (safety default) so the UI+// can explain the pause and offer a scoped bulk-resume; "system" remains the+// reason for platform-managed pauses (plugins, built-ins).+export const PAUSE_REASONS = ["manual", "budget", "system", "company_archived", "import"] as const;export type PauseReason = (typeof PAUSE_REASONS)[number];export const PROJECT_COLORS = [diff --git a/server/src/__tests__/company-portability.test.ts b/server/src/__tests__/company-portability.test.tsindex a01036839a..49edb4c881 100644--- a/server/src/__tests__/company-portability.test.ts+++ b/server/src/__tests__/company-portability.test.ts@@ -2667,7 +2667,9 @@ describe("company portability", () => {expect(agentSvc.create).toHaveBeenCalledWith("company-imported", expect.objectContaining({status: "paused",- pauseReason: "system",+ // The dedicated "import" reason lets the UI explain the pause and offer+ // a scoped resume; "system" stays for platform-managed pauses.+ pauseReason: "import",pausedAt: expect.any(Date),}));expect(routineSvc.create).toHaveBeenCalledWith("company-imported", expect.objectContaining({diff --git a/server/src/services/company-portability.ts b/server/src/services/company-portability.tsindex ecc17fc4e5..a6df4e9ee1 100644--- a/server/src/services/company-portability.ts+++ b/server/src/services/company-portability.ts@@ -5549,10 +5549,14 @@ export function companyPortabilityService(db: Db, storage?: StorageService) {permissions: manifestAgent.permissions,metadata: manifestAgent.metadata,};+ // "import", not "system": the UI reads this to explain that the+ // agent was parked by the import safety default and to offer a+ // scoped resume; "system" stays reserved for platform-managed+ // pauses (plugins, built-ins).const automationPausePatch = pauseAutomations? {status: "paused",- pauseReason: "system",+ pauseReason: "import",pausedAt: importedAutomationPausedAt,}: {};diff --git a/ui/src/components/IssueChatThread.test.tsx b/ui/src/components/IssueChatThread.test.tsxindex 2fbba554b0..0fbc3a1a14 100644--- a/ui/src/components/IssueChatThread.test.tsx+++ b/ui/src/components/IssueChatThread.test.tsx@@ -8,6 +8,7 @@ import { MemoryRouter } from "react-router-dom";import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";import type { Agent } from "@paperclipai/shared";import {+ IssueAssigneePausedNotice,IssueChatThread,VIRTUALIZED_THREAD_ROW_THRESHOLD,canStopIssueChatRun,@@ -3915,3 +3916,80 @@ describe("IssueChatThread", () => {});});});++describe("IssueAssigneePausedNotice", () => {+ let container: HTMLDivElement;++ beforeEach(() => {+ container = document.createElement("div");+ document.body.appendChild(container);+ });++ afterEach(() => {+ container.remove();+ });++ function pausedAgent(pauseReason: string): Agent {+ return {+ id: "agent-1",+ name: "CEO",+ status: "paused",+ pauseReason,+ } as unknown as Agent;+ }++ it("explains an import pause and resumes the agent on click", () => {+ const onResume = vi.fn();+ const root = createRoot(container);++ act(() => {+ root.render(+ <IssueAssigneePausedNotice agent={pausedAgent("import")} onResume={onResume} resuming={false} />,+ );+ });++ expect(container.textContent).toContain("arrived paused from a company import");+ const resumeButton = container.querySelector(+ '[data-testid="issue-assignee-paused-resume"]',+ ) as HTMLButtonElement | null;+ expect(resumeButton).not.toBeNull();++ act(() => {+ resumeButton?.dispatchEvent(new MouseEvent("click", { bubbles: true }));+ });+ expect(onResume).toHaveBeenCalledTimes(1);++ act(() => root.unmount());+ });++ it("offers no resume action for budget pauses", () => {+ const root = createRoot(container);++ act(() => {+ root.render(+ <IssueAssigneePausedNotice agent={pausedAgent("budget")} onResume={vi.fn()} resuming={false} />,+ );+ });++ expect(container.textContent).toContain("budget hard stop");+ expect(container.querySelector('[data-testid="issue-assignee-paused-resume"]')).toBeNull();++ act(() => root.unmount());+ });++ it("renders nothing for an active agent", () => {+ const root = createRoot(container);++ act(() => {+ root.render(+ <IssueAssigneePausedNotice+ agent={{ id: "agent-1", name: "CEO", status: "idle" } as unknown as Agent}+ />,+ );+ });++ expect(container.querySelector('[data-testid="issue-assignee-paused-notice"]')).toBeNull();++ act(() => root.unmount());+ });+});diff --git a/ui/src/components/IssueChatThread.tsx b/ui/src/components/IssueChatThread.tsxindex 23012b98aa..71862484c1 100644--- a/ui/src/components/IssueChatThread.tsx+++ b/ui/src/components/IssueChatThread.tsx@@ -82,6 +82,7 @@ import {type IssueWorkModeChange,} from "../lib/issue-timeline-events";import { Button } from "@/components/ui/button";+import { InlineBanner } from "@/components/InlineBanner";import { Card } from "@/components/ui/card";import { Badge } from "@/components/ui/badge";import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";@@ -476,6 +477,9 @@ interface IssueChatThreadProps {issueAssigneeAgentId?: string | null;onResumeFromBacklog?: () => Promise<void> | void;resumeFromBacklogPending?: boolean;+ /** Resume a paused assignee agent so runs can start again. */+ onResumeAssignee?: () => Promise<void> | void;+ resumeAssigneePending?: boolean;companyId?: string | null;projectId?: string | null;issueStatus?: string;@@ -625,24 +629,50 @@ class IssueChatErrorBoundary extends Component<IssueChatErrorBoundaryProps, Issu}}-function IssueAssigneePausedNotice({ agent }: { agent: Agent | null }) {+export function IssueAssigneePausedNotice({+ agent,+ onResume,+ resuming,+}: {+ agent: Agent | null;+ onResume?: () => Promise<void> | void;+ resuming?: boolean;+}) {if (!agent || agent.status !== "paused") return null;const pauseDetail =agent.pauseReason === "budget"? "It was paused by a budget hard stop."- : agent.pauseReason === "system"- ? "It was paused by the system."- : "It was paused manually.";+ : agent.pauseReason === "import"+ ? "It arrived paused from a company import — imported agents stay parked until you resume them."+ : agent.pauseReason === "system"+ ? "It was paused by the system."+ : "It was paused manually.";+ // Budget pauses clear on their own when the budget resets; resuming by hand+ // would fight the hard stop, so the action is only offered for the rest.+ const canResume = Boolean(onResume) && agent.pauseReason !== "budget";return (- <div className="mb-3 rounded-md border border-orange-300/70 bg-orange-50/90 px-3 py-2.5 text-sm text-orange-950 shadow-sm dark:border-orange-500/40 dark:bg-orange-500/10 dark:text-orange-100">- <div className="flex items-start gap-2">- <PauseCircle className="mt-0.5 h-4 w-4 shrink-0 text-orange-600 dark:text-orange-300" />- <p className="min-w-0 leading-5">- <span className="font-medium">{agent.name}</span> is paused. New runs will not start until the agent is resumed. {pauseDetail}- </p>- </div>+ <div data-testid="issue-assignee-paused-notice" className="mb-3">+ <InlineBanner+ tone="warning"+ icon={PauseCircle}+ compact+ title={<><span className="font-medium">{agent.name}</span> is paused.</>}+ actions={canResume ? (+ <Button+ size="sm"+ variant="outline"+ onClick={onResume}+ disabled={resuming}+ data-testid="issue-assignee-paused-resume"+ >+ {resuming ? "Resuming…" : "Resume agent"}+ </Button>+ ) : undefined}+ >+ New runs will not start until the agent is resumed. {pauseDetail}+ </InlineBanner></div>);}@@ -4493,6 +4523,8 @@ export function IssueChatThread({assigneeUserId = null,onResumeFromBacklog,resumeFromBacklogPending = false,+ onResumeAssignee,+ resumeAssigneePending = false,externalReferences,linkCaseReferences = false,}: IssueChatThreadProps) {@@ -5241,9 +5273,22 @@ export function IssueChatThread({: null}/>- <IssueAssigneePausedNotice agent={assignedAgent} />+ <IssueAssigneePausedNotice+ agent={assignedAgent}+ onResume={onResumeAssignee}+ resuming={resumeAssigneePending}+ /></div>- ) : null}+ ) : (+ // Read-only viewers still need to see why nothing is running.+ <div data-testid="issue-chat-thread-notices" className="space-y-2">+ <IssueAssigneePausedNotice+ agent={assignedAgent}+ onResume={onResumeAssignee}+ resuming={resumeAssigneePending}+ />+ </div>+ )}{footer ? <div data-testid="issue-chat-thread-footer">{footer}</div> : null}<div ref={bottomAnchorRef} />{showComposer ? (diff --git a/ui/src/components/NewIssueDialog.test.tsx b/ui/src/components/NewIssueDialog.test.tsxindex 1d1474351e..2a6c778a7a 100644--- a/ui/src/components/NewIssueDialog.test.tsx+++ b/ui/src/components/NewIssueDialog.test.tsx@@ -548,6 +548,33 @@ describe("NewIssueDialog", () => {act(() => root.unmount());});+ it("warns when the selected assignee is a paused imported agent", async () => {+ dialogState.newIssueDefaults = {+ title: "Compare onboarding flows",+ assigneeAgentId: "agent-1",+ };+ mockAgentsApi.list.mockResolvedValue([+ {+ id: "agent-1",+ name: "CEO",+ status: "paused",+ pauseReason: "import",+ adapterType: "claude_local",+ adapterConfig: {},+ runtimeConfig: {},+ permissions: {},+ },+ ]);++ const { root } = renderDialog(container);+ await waitForAssertion(() => {+ expect(container.querySelector('[data-testid="new-issue-paused-assignee-note"]')).not.toBeNull();+ });+ expect(container.textContent).toContain("arrived paused from a company import");++ act(() => root.unmount());+ });+it("restores the planning mode from dialog defaults", async () => {dialogState.newIssueDefaults = {title: "Planned from defaults",diff --git a/ui/src/components/NewIssueDialog.tsx b/ui/src/components/NewIssueDialog.tsxindex f5652ee784..a382b7c13a 100644--- a/ui/src/components/NewIssueDialog.tsx+++ b/ui/src/components/NewIssueDialog.tsx@@ -61,6 +61,7 @@ import {Paperclip,FileText,Flag,+ PauseCircle,Loader2,ListTree,X,@@ -76,6 +77,7 @@ import { issueStatusText, issueStatusTextDefault, priorityColor, priorityColorDeimport { SHOW_TASK_PRIORITY_UI } from "../lib/ui-flags";import { MarkdownEditor, type MarkdownEditorRef, type MentionOption } from "./MarkdownEditor";import { AgentIcon } from "./AgentIconPicker";+import { InlineBanner } from "./InlineBanner";import { InlineEntitySelector, type InlineEntityOption } from "./InlineEntitySelector";import { getTrustPreset } from "../lib/trust-policy-ui";import { ReusableExecutionWorkspaceSelect } from "./ReusableExecutionWorkspaceSelect";@@ -586,7 +588,11 @@ export function NewIssueDialog() {const selectedAssigneeAgentId = selectedAssignee.assigneeAgentId;const selectedAssigneeUserId = selectedAssignee.assigneeUserId;- const assigneeAdapterType = (agents ?? []).find((agent) => agent.id === selectedAssigneeAgentId)?.adapterType ?? null;+ const selectedAssigneeAgent = useMemo(+ () => (agents ?? []).find((agent) => agent.id === selectedAssigneeAgentId) ?? null,+ [agents, selectedAssigneeAgentId],+ );+ const assigneeAdapterType = selectedAssigneeAgent?.adapterType ?? null;const supportsAssigneeOverrides = Boolean(assigneeAdapterType && ISSUE_OVERRIDE_ADAPTER_TYPES.has(assigneeAdapterType),);@@ -2331,6 +2337,15 @@ export function NewIssueDialog() {</div>) : null}+ {selectedAssigneeAgent?.status === "paused" ? (+ <div data-testid="new-issue-paused-assignee-note" className="mx-4 mb-2">+ <InlineBanner tone="warning" icon={PauseCircle} compact>+ <span className="font-medium">{selectedAssigneeAgent.name}</span> is paused and will not start work on this task until it is resumed+ {selectedAssigneeAgent.pauseReason === "import" ? " — it arrived paused from a company import" : ""}. You can resume it from the task page after creating the task.+ </InlineBanner>+ </div>+ ) : null}+{currentAssigneeLowTrust ? (<divdata-testid="new-issue-low-trust-assignee-note"diff --git a/ui/src/components/TaskChatThread.tsx b/ui/src/components/TaskChatThread.tsxindex b6e27856fd..0e74685788 100644--- a/ui/src/components/TaskChatThread.tsx+++ b/ui/src/components/TaskChatThread.tsx@@ -1,5 +1,5 @@import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type ComponentProps } from "react";-import { IssueChatThread } from "@/components/IssueChatThread";+import { IssueChatThread, IssueAssigneePausedNotice } from "@/components/IssueChatThread";import {useLiveRunTranscripts,type RunTranscriptSource,@@ -136,6 +136,8 @@ export function TaskChatThread(props: TaskChatThreadProps) {blockedBy = [],blockerAttention,liveIssueIds,+ onResumeAssignee,+ resumeAssigneePending = false,} = props;const liveWorkLinks = useMemo(@@ -642,6 +644,12 @@ export function TaskChatThread(props: TaskChatThreadProps) {],);+ const assignedAgentForNotice = useMemo(() => {+ if (!currentAssigneeValue?.startsWith("agent:")) return null;+ const assigneeAgentId = currentAssigneeValue.slice("agent:".length);+ return agentMap?.get(assigneeAgentId) ?? null;+ }, [agentMap, currentAssigneeValue]);+// Mobile (PAP-360): the app shell scrolls the DOCUMENT (Layout's main is// overflow-visible with auto height), so the desktop bounded h-dvh chain// collapses the absolute-inset transcript viewport to 0px. Render the thread@@ -715,6 +723,15 @@ export function TaskChatThread(props: TaskChatThreadProps) {/>)}</div>+ {assignedAgentForNotice?.status === "paused" ? (+ <div className="mx-auto w-full max-w-(--tc-shell-max-w) px-4 pt-2">+ <IssueAssigneePausedNotice+ agent={assignedAgentForNotice}+ onResume={onResumeAssignee}+ resuming={resumeAssigneePending}+ />+ </div>+ ) : null}{showComposer ? (<divdata-testid="task-chat-composer-dock"diff --git a/ui/src/pages/IssueDetail.tsx b/ui/src/pages/IssueDetail.tsxindex 135b438c21..6d7b5e8aa2 100644--- a/ui/src/pages/IssueDetail.tsx+++ b/ui/src/pages/IssueDetail.tsx@@ -1048,6 +1048,8 @@ type IssueDetailChatTabProps = {assigneeUserId: string | null;onResumeFromBacklog?: () => Promise<void> | void;resumeFromBacklogPending?: boolean;+ onResumeAssignee?: () => Promise<void> | void;+ resumeAssigneePending?: boolean;externalReferences?: MarkdownExternalReferenceMap;linkCaseReferences?: boolean;};@@ -1126,6 +1128,8 @@ const IssueDetailChatTab = memo(function IssueDetailChatTab({assigneeUserId,onResumeFromBacklog,resumeFromBacklogPending,+ onResumeAssignee,+ resumeAssigneePending,externalReferences,linkCaseReferences,}: IssueDetailChatTabProps) {@@ -1401,6 +1405,8 @@ const IssueDetailChatTab = memo(function IssueDetailChatTab({assigneeUserId={assigneeUserId}onResumeFromBacklog={onResumeFromBacklog}resumeFromBacklogPending={resumeFromBacklogPending}+ onResumeAssignee={onResumeAssignee}+ resumeAssigneePending={resumeAssigneePending}footer={footer}externalReferences={externalReferences}linkCaseReferences={linkCaseReferences}@@ -4063,6 +4069,46 @@ export function IssueDetail() {const handleResumeFromBacklog = useCallback(async () => {await updateIssue.mutateAsync({ status: "todo" });}, [updateIssue.mutateAsync]);+ // Resume a paused assignee agent straight from the thread notice: a paused+ // assignee silently drops every assignment wake, so the fix belongs next to+ // the explanation.+ const issueAssigneeAgentIdForResume = issue?.assigneeAgentId ?? null;+ const issueCompanyIdForResume = issue?.companyId ?? null;+ const issueStatusForResume = issue?.status ?? null;+ const issueIdForResume = issue?.id ?? null;+ const resumeAssigneeAgent = useMutation({+ mutationFn: async () => {+ if (!issueAssigneeAgentIdForResume) throw new Error("No assignee agent");+ await agentsApi.resume(issueAssigneeAgentIdForResume, issueCompanyIdForResume ?? undefined);+ // The pause silently dropped this issue's assignment wake, so resuming+ // alone would leave the task idle until some other trigger fires.+ // Re-issue the wake for executable statuses; best-effort — the agent is+ // resumed either way and the next comment or timer also wakes it.+ if (issueIdForResume && (issueStatusForResume === "todo" || issueStatusForResume === "in_progress")) {+ try {+ await agentsApi.wakeup(+ issueAssigneeAgentIdForResume,+ {+ source: "assignment",+ reason: "Assignee resumed from the task page",+ payload: { issueId: issueIdForResume, mutation: "assignee_resumed" },+ },+ issueCompanyIdForResume ?? undefined,+ );+ } catch {+ // Non-fatal: the resume succeeded; the wake retries on the next trigger.+ }+ }+ },+ onSuccess: async () => {+ if (issueCompanyIdForResume) {+ await queryClient.invalidateQueries({ queryKey: queryKeys.agents.list(issueCompanyIdForResume) });+ }+ },+ });+ const handleResumeAssignee = useCallback(async () => {+ await resumeAssigneeAgent.mutateAsync();+ }, [resumeAssigneeAgent.mutateAsync]);const activeRecoveryActionId = issue?.activeRecoveryAction?.id;const handleResolveRecoveryAction = useCallback((outcome: import("../components/IssueRecoveryActionCard").RecoveryResolveOutcome) => {@@ -5365,6 +5411,8 @@ export function IssueDetail() {resumeFromBacklogPending={updateIssue.isPending && updateIssue.variables?.status === "todo"}+ onResumeAssignee={issue.assigneeAgentId ? handleResumeAssignee : undefined}+ resumeAssigneePending={resumeAssigneeAgent.isPending}externalReferences={externalObjectsState.isEnabled ? externalObjectsState.markdownReferences : undefined}linkCaseReferences={casesChipsEnabled}/>