From 38dc3b96ef95d252a0da72697ecbe1730a845117 Mon Sep 17 00:00:00 2001 From: Dotta <34892728+cryppadotta@users.noreply.github.com> Date: Fri, 4 Dec 2026 15:03:26 -0600 Subject: [PATCH] fix(ui): remove monitor reply-wake copy and vertically center Check now (#23763) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - The task detail view renders two monitor surfaces (`IssueMonitorBanner` and `IssueMonitorComposerStrip`) when a task waits for a scheduled monitor check or scheduled retry. > - The composer monitor strip displayed a default helper line ("Sending a reply wakes the agent now — before the scheduled check.") below the header row. > - That helper line added unnecessary copy and pushed the `Check now` button upward, leaving it off-center inside the card, while `IssueMonitorBanner` inherited top alignment (`sm:items-start`) from `InlineBanner`. > - This pull request removes the default reply-wake copy, computes the remaining specialized hints in `buildMonitorSurfaceCopy`, places them inside the left column of the flex row, and vertically centers the `Check now` button on both monitor surfaces. > - The benefit is a cleaner monitor card with a vertically centered primary action across all waiting states. ## Linked Issues or Issue Description **What existing behavior does this improve?** The task detail monitor card above the reply composer (`IssueMonitorComposerStrip`) and the pinned monitor banner (`IssueMonitorBanner`) in `ui/src/components/IssueMonitorBanner.tsx`. **Subsystem affected** ui/ — React + Vite board UI **Current behavior** For scheduled monitors and ordinary scheduled retries, `IssueMonitorComposerStrip` renders `"Sending a reply wakes the agent now — before the scheduled check."` below the flex row that holds the `Check now` button. That footer paragraph makes the `Check now` button sit near the top of the card instead of the vertical center. `IssueMonitorBanner` also inherits `sm:items-start` from `InlineBanner`, which top-aligns `Check now`. **Proposed behavior** Remove the default `"Sending a reply wakes the agent now — before the scheduled check."` text completely. Move the remaining specialized hints (pull request review, workspace wait, active run wait, and AI connection pool wait) into `buildMonitorSurfaceCopy` (`stripHint`) and render them inside the left content column so `sm:items-center` vertically centers `Check now` against the full card content. Override `sm:items-center` on `IssueMonitorBanner` so `Check now` is also vertically centered in the pinned banner. **Reason and benefit** Operators do not need the generic reply-wake reminder on every scheduled monitor, and removing it eliminates unnecessary text clutter. Keeping `Check now` vertically centered improves visual balance on both the composer strip and the pinned banner. **Breaking changes** None. Existing specialized wait hints and button actions remain unchanged. ## What Changed - Removed the default `"Sending a reply wakes the agent now — before the scheduled check."` copy from `IssueMonitorComposerStrip` in `ui/src/components/IssueMonitorBanner.tsx`. - Added `stripHint?: string` to `MonitorSurfaceCopy`, computed state-specific strip hints directly in `buildMonitorSurfaceCopy`, removed the now-unused write-only flags (`automaticChecksPaused`, `executionWait`, `usageWait`), and rendered `copy.stripHint` inside the left column of the `sm:flex-row sm:items-center sm:justify-between` row so `Check now` / `Check status` stays vertically centered whether a specialized hint is shown or omitted. - Replaced per-element `mt-1.5` margin with `flex flex-col gap-1.5` spacing on `IssueMonitorComposerStrip`. - Added `sm:items-center` to `IssueMonitorBanner` so `InlineBanner` vertically centers `Check now` instead of top-aligning it. - Switched `ui/src/components/IssueMonitorBanner.test.tsx` to `jsdom` DOM rendering and asserted the structural ancestor relationship: specialized hint `

` nodes (usage wait and PR review requested) live inside the left column whose parent is the same `sm:flex-row sm:items-center` row as `Check now` / `Check status`, active-run monitor states render their relocated `stripHint` copy, default scheduled monitors and ordinary retries omit the reply-wake copy and render no `

` hint, and `IssueMonitorBanner` overrides `sm:items-start` with `sm:items-center`. ## Verification - Ran `pnpm vitest run ui/src/components/IssueMonitorBanner.test.tsx ui/src/lib/issue-monitor.test.tsx` on the exact tree committed in `a4f8a78401`: 2 files, 29 tests passed (4 in `IssueMonitorBanner.test.tsx`, 25 in `issue-monitor.test.tsx`). - Ran `pnpm --filter @paperclipai/ui typecheck`: exited 0. - Ran `pnpm check:tokens`: no forbidden tokens found. - Confirmed all CI gates (including all 16 e2e shards, `ci / verify`, `ci / Typecheck + Release Registry`, `ci / Build`, `ci / policy`) passed on `ce42421728`; waiting for fresh CI and reviews on `a4f8a78401`. ## Risks - Low risk. The change is scoped to layout alignment, `buildMonitorSurfaceCopy` hint mapping, and unit tests in `ui/src/components/IssueMonitorBanner.tsx` and `ui/src/components/IssueMonitorBanner.test.tsx`, with no API, schema, or behavioral changes to monitor scheduling or wakeup logic. ## Model Used - Google Gemini (Antigravity coding agent with tool use and code execution) ## 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 searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [ ] All Paperclip CI gates are green - [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: Paperclip --- ui/src/components/IssueMonitorBanner.test.tsx | 193 ++++++++++++++++-- ui/src/components/IssueMonitorBanner.tsx | 51 ++--- 2 files changed, 201 insertions(+), 43 deletions(-) diff --git a/ui/src/components/IssueMonitorBanner.test.tsx b/ui/src/components/IssueMonitorBanner.test.tsx index 3074c002537..825724a797b 100644 --- a/ui/src/components/IssueMonitorBanner.test.tsx +++ b/ui/src/components/IssueMonitorBanner.test.tsx @@ -1,8 +1,39 @@ -// @vitest-environment node -import { renderToStaticMarkup } from "react-dom/server"; -import { expect, it } from "vitest"; -import type { Issue } from "@paperclipai/shared"; -import { IssueMonitorComposerStrip } from "./IssueMonitorBanner"; +// @vitest-environment jsdom +import type { ReactElement } from "react"; +import { flushSync } from "react-dom"; +import { createRoot, type Root } from "react-dom/client"; +import { afterEach, expect, it } from "vitest"; +import type { Issue, IssueWorkProduct } from "@paperclipai/shared"; +import { IssueMonitorBanner, IssueMonitorComposerStrip } from "./IssueMonitorBanner"; + +const mounted: Array<{ root: Root; container: HTMLDivElement }> = []; + +afterEach(() => { + while (mounted.length > 0) { + const entry = mounted.pop()!; + flushSync(() => entry.root.unmount()); + entry.container.remove(); + } +}); + +function render(element: ReactElement): HTMLDivElement { + const container = document.createElement("div"); + document.body.appendChild(container); + const root = createRoot(container); + flushSync(() => root.render(element)); + mounted.push({ root, container }); + return container; +} + +function findButton(container: HTMLElement, label: string): HTMLButtonElement | undefined { + return Array.from(container.querySelectorAll("button")).find( + (button) => button.textContent?.trim() === label, + ); +} + +function findCheckNowButton(container: HTMLElement): HTMLButtonElement | undefined { + return findButton(container, "Check now"); +} function waitingIssue(scheduledRetryReason: string) { return { @@ -17,14 +48,150 @@ function waitingIssue(scheduledRetryReason: string) { } as unknown as Issue; } -it("tells a user that a reply rechecks usage, not that it starts work outright", () => { - const markup = renderToStaticMarkup(); - expect(markup).toContain("Pool exhausted"); - expect(markup).toContain("Sending a reply checks usage again now."); - expect(markup).not.toContain("wakes the agent now"); +function monitoredIssue(serviceName = "github_pr_checks") { + return { + id: "issue-2", + status: "in_progress", + executionState: { + monitor: { + status: "scheduled", + nextCheckAt: new Date(Date.now() + 3 * 60_000).toISOString(), + attemptCount: 1, + serviceName, + }, + }, + } as unknown as Issue; +} + +function pendingPullRequestWorkProduct(): IssueWorkProduct { + return { + id: "wp-pr-1", + type: "pull_request", + title: "PR #23763", + status: "open", + reviewState: "needs_board_review", + url: "https://github.com/paperclipai/paperclip/pull/23763", + isPrimary: true, + updatedAt: new Date().toISOString(), + } as unknown as IssueWorkProduct; +} + +it("tells a user that a reply rechecks usage and keeps Check now vertically centered alongside the hint", () => { + const container = render( + {}} />, + ); + const strip = container.querySelector('[data-testid="issue-monitor-composer-strip"]'); + expect(strip?.textContent).toContain("Pool exhausted"); + expect(strip?.textContent).not.toContain("wakes the agent now"); + + const hint = Array.from(container.querySelectorAll("p")).find((node) => + node.textContent?.includes("Sending a reply checks usage again now."), + ); + const button = findCheckNowButton(container); + expect(hint).toBeDefined(); + expect(button).toBeDefined(); + + const row = button!.parentElement; + const leftColumn = hint!.parentElement; + expect(row).not.toBeNull(); + expect(row!.classList.contains("sm:flex-row")).toBe(true); + expect(row!.classList.contains("sm:items-center")).toBe(true); + expect(leftColumn).not.toBeNull(); + expect(leftColumn).not.toBe(row); + expect(leftColumn!.parentElement).toBe(row); + expect(leftColumn!.textContent).toContain("Pool exhausted"); + expect(leftColumn!.contains(hint!)).toBe(true); + expect(leftColumn!.contains(button!)).toBe(false); + expect(row!.contains(hint!)).toBe(true); + expect(row!.contains(button!)).toBe(true); }); -it("keeps the wake-now promise for an ordinary scheduled retry", () => { - const markup = renderToStaticMarkup(); - expect(markup).toContain("Sending a reply wakes the agent now"); +it("omits the reply wake copy for an ordinary scheduled retry", () => { + const container = render( + {}} />, + ); + expect(container.textContent).not.toContain("wakes the agent now"); + expect(container.textContent).not.toContain("before the scheduled check"); + expect(container.querySelector("p")).toBeNull(); + + const button = findCheckNowButton(container); + expect(button).toBeDefined(); + expect(button!.parentElement?.classList.contains("sm:flex-row")).toBe(true); + expect(button!.parentElement?.classList.contains("sm:items-center")).toBe(true); +}); + +it("omits the reply wake copy and centers Check now for a scheduled monitor", () => { + const stripContainer = render( + {}} />, + ); + expect(stripContainer.textContent).toContain("Watching: github_pr_checks"); + expect(stripContainer.textContent).not.toContain("wakes the agent now"); + expect(stripContainer.textContent).not.toContain("before the scheduled check"); + expect(stripContainer.querySelector("p")).toBeNull(); + + const stripButton = findCheckNowButton(stripContainer); + expect(stripButton).toBeDefined(); + expect(stripButton!.parentElement?.classList.contains("sm:flex-row")).toBe(true); + expect(stripButton!.parentElement?.classList.contains("sm:items-center")).toBe(true); + + const bannerContainer = render( + {}} />, + ); + const banner = bannerContainer.querySelector('[role="note"]'); + const bannerButton = findCheckNowButton(bannerContainer); + expect(banner).not.toBeNull(); + expect(banner!.classList.contains("sm:flex-row")).toBe(true); + expect(banner!.classList.contains("sm:items-center")).toBe(true); + expect(banner!.classList.contains("sm:items-start")).toBe(false); + expect(bannerButton).toBeDefined(); + expect(bannerButton!.parentElement?.parentElement).toBe(banner); +}); + +it("renders the relocated pullRequestReview and active-run strip hints inside the centered row", () => { + const workProducts = [pendingPullRequestWorkProduct()]; + + const reviewContainer = render( + {}} + />, + ); + const reviewHint = Array.from(reviewContainer.querySelectorAll("p")).find((node) => + node.textContent?.includes("Review on GitHub, then check status to have the agent verify the result."), + ); + const checkStatusButton = findButton(reviewContainer, "Check status"); + expect(reviewHint).toBeDefined(); + expect(checkStatusButton).toBeDefined(); + const reviewRow = checkStatusButton!.parentElement; + const reviewLeftColumn = reviewHint!.parentElement; + expect(reviewRow?.classList.contains("sm:flex-row")).toBe(true); + expect(reviewRow?.classList.contains("sm:items-center")).toBe(true); + expect(reviewLeftColumn?.parentElement).toBe(reviewRow); + expect(reviewLeftColumn?.contains(checkStatusButton!)).toBe(false); + + const activeReviewContainer = render( + {}} + />, + ); + expect(activeReviewContainer.textContent).toContain( + "Review on GitHub while the current run finishes saving its work.", + ); + expect(findButton(activeReviewContainer, "Check status")).toBeUndefined(); + + const activeRunContainer = render( + {}} + />, + ); + expect(activeRunContainer.textContent).toContain( + "You can keep sending instructions while the agent waits.", + ); + expect(findCheckNowButton(activeRunContainer)).toBeUndefined(); }); diff --git a/ui/src/components/IssueMonitorBanner.tsx b/ui/src/components/IssueMonitorBanner.tsx index ba30072750a..7eca5d53b46 100644 --- a/ui/src/components/IssueMonitorBanner.tsx +++ b/ui/src/components/IssueMonitorBanner.tsx @@ -61,15 +61,13 @@ export interface MonitorSurfaceCopy { bannerMeta: string[]; /** Muted detail line for the composer strip. */ stripMeta: string[]; + /** Optional state-specific hint rendered beneath the strip metadata inside the left column. */ + stripHint?: string; /** `warning` (amber) once overdue, `info` (blue) while still on schedule. */ tone: "info" | "warning"; workspaceWait?: boolean; pullRequestReview?: boolean; - automaticChecksPaused?: boolean; checkUnavailable?: boolean; - executionWait?: boolean; - /** Waiting for AI account usage; a reply rechecks usage instead of starting work outright. */ - usageWait?: boolean; } function capitalize(value: string): string { @@ -102,7 +100,6 @@ export function buildMonitorSurfaceCopy( bannerMeta: [hint], stripMeta: [hint], tone: "info", - automaticChecksPaused: true, checkUnavailable: !canCheckNow, }; } @@ -113,6 +110,7 @@ export function buildMonitorSurfaceCopy( stripTitle: "Waiting for the sandbox provider", bannerMeta: ["The sandbox provider is unavailable. Work continues automatically when it is back."], stripMeta: ["Work continues automatically when the sandbox provider is back."], + stripHint: "You can keep sending instructions while the agent waits.", tone: "info", workspaceWait: true, }; @@ -124,6 +122,7 @@ export function buildMonitorSurfaceCopy( stripTitle: "Waiting for workspace", bannerMeta: ["Another task is using this workspace. Work starts automatically when it is available."], stripMeta: ["Work starts automatically when the workspace is available."], + stripHint: "You can keep sending instructions while the agent waits.", tone: "info", workspaceWait: true, }; @@ -139,8 +138,10 @@ export function buildMonitorSurfaceCopy( stripTitle: "Monitor waits for current run", bannerMeta: [hint, `Scheduled for ${absolute} (your time)`], stripMeta: [hint, `Scheduled for ${absolute}`], + stripHint: awaitingPullRequestReview + ? "Review on GitHub while the current run finishes saving its work." + : "You can keep sending instructions while the agent waits.", tone: "info", - executionWait: true, checkUnavailable: true, pullRequestReview: awaitingPullRequestReview, }; @@ -151,6 +152,7 @@ export function buildMonitorSurfaceCopy( stripTitle: "Pull request review requested", bannerMeta: [`Next check ${eta} · ${absolute} (your time)`], stripMeta: [`Next check ${eta} · ${absolute}`], + stripHint: "Review on GitHub, then check status to have the agent verify the result.", tone: derived.state === "overdue" ? "warning" : "info", pullRequestReview: true, }; @@ -161,8 +163,8 @@ export function buildMonitorSurfaceCopy( stripTitle: "Pool exhausted", bannerMeta: [`Usage recheck ${eta} · ${absolute} (your time)`, "Tasks with a selected account keep it while waiting. Work resumes when usage permits or the agent uses a different account."], stripMeta: [`Usage recheck ${eta} · ${absolute}`, "Tasks with a selected account keep it while waiting."], + stripHint: "Sending a reply checks usage again now. The agent starts as soon as usage is available.", tone: "info", - usageWait: true, }; } @@ -321,7 +323,7 @@ export function IssueMonitorBanner({ tone={copy.tone} icon={Clock} title={copy.bannerTitle} - className={cn("relative my-3", canCancel && "pr-12")} + className={cn("relative my-3 sm:items-center", canCancel && "pr-12")} actions={onCheckNow && !copy.workspaceWait && !copy.checkUnavailable ? : null} > {canCancel ? : null} @@ -336,8 +338,7 @@ export function IssueMonitorBanner({ /** * Slim, inline (not sticky) strip anchored directly above the reply composer. - * Mirrors the banner's monitor state and reminds the reader that replying wakes - * the agent early (PAP-14557 decisions 2 + wireframe 02). + * Mirrors the banner's monitor state. */ export function IssueMonitorComposerStrip({ issue, @@ -356,32 +357,22 @@ export function IssueMonitorComposerStrip({

-
-
);