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
test(ui): cover monitor-only task policies (#15587)
Dotta0111689d0aa5
diff --git a/ui/src/components/IssueProperties.test.tsx b/ui/src/components/IssueProperties.test.tsxindex dd19e8712b..6fd44f52b1 100644--- a/ui/src/components/IssueProperties.test.tsx+++ b/ui/src/components/IssueProperties.test.tsx@@ -2728,6 +2728,30 @@ describe("IssueProperties", () => {act(() => root.unmount());});+ it("renders reviewer and approver controls for a monitor-only execution policy", async () => {+ const policy = {+ monitor: {+ nextCheckAt: "2026-10-08T16:00:00.000Z",+ notes: "Check pull request",+ scheduledBy: "assignee",+ kind: "external_service",+ serviceName: "github-pr",+ },+ } as IssueExecutionPolicy;+ const root = renderProperties(container, {+ issue: createIssue({ executionPolicy: policy }),+ childIssues: [],+ onUpdate: vi.fn(),+ });+ await flush();++ expect(findRowTrigger(container, "Reviewers")?.textContent).toContain("None");+ expect(findRowTrigger(container, "Approvers")?.textContent).toContain("None");+ expect(container.querySelector('[data-testid="monitor-row-trigger"]')).not.toBeNull();++ act(() => root.unmount());+ });+it("shows a run review action after reviewers are configured and starts execution explicitly when clicked", async () => {const onUpdate = vi.fn();const root = renderProperties(container, {diff --git a/ui/src/lib/issue-execution-policy.test.ts b/ui/src/lib/issue-execution-policy.test.tsindex 4b16adb2ef..6b94e33130 100644--- a/ui/src/lib/issue-execution-policy.test.ts+++ b/ui/src/lib/issue-execution-policy.test.ts@@ -36,11 +36,57 @@ describe("reading execution policy defaults", () => {});});+// Persisted monitor-only policies can omit fields supplied by schema defaults.+const monitorOnlyPolicy = {+ monitor: {+ nextCheckAt: "2026-10-08T16:00:00.000Z",+ notes: "Check pull request",+ scheduledBy: "assignee",+ kind: "external_service",+ serviceName: "github-pr",+ externalRef: "https://github.com/example/repo/pull/1",+ maxAttempts: 5,+ },+} as IssueExecutionPolicy;++describe("stageParticipantValues", () => {+ it.each(["review", "approval"] as const)("reads %s participants from a monitor-only policy", (stageType) => {+ expect(issueExecutionPolicySchema.safeParse(monitorOnlyPolicy).success).toBe(true);+ expect(stageParticipantValues(monitorOnlyPolicy, stageType)).toEqual([]);+ });+});+describe("buildExecutionPolicy", () => {afterEach(() => {vi.unstubAllGlobals();});+ it("adds review and approval stages to a monitor-only policy without losing its monitor", () => {+ const policy = buildExecutionPolicy({+ existingPolicy: monitorOnlyPolicy,+ reviewerValues: [`agent:${AGENT_ID}`],+ approverValues: ["user:local-board"],+ });++ expect(issueExecutionPolicySchema.safeParse(policy).success).toBe(true);+ expect(policy?.monitor).toEqual(monitorOnlyPolicy.monitor);+ expect(stageParticipantValues(policy, "review")).toEqual([`agent:${AGENT_ID}`]);+ expect(stageParticipantValues(policy, "approval")).toEqual(["user:local-board"]);+ });++ it("keeps a monitor-only policy when there are no review or approval stages", () => {+ expect(buildExecutionPolicy({+ existingPolicy: monitorOnlyPolicy,+ reviewerValues: [],+ approverValues: [],+ })).toEqual({+ mode: "normal",+ commentRequired: true,+ stages: [],+ monitor: monitorOnlyPolicy.monitor,+ });+ });+it("generates schema-valid UUIDs when crypto.randomUUID is unavailable", () => {vi.stubGlobal("crypto", {getRandomValues: (bytes: Uint8Array) => {