feat(inbox): rebuild compact cards and share task review controls (#20961)

## Thinking Path

> - Paperclip helps people manage AI agents and their work.
> - The inbox collects decisions, requests, and updates for the people
in a company.
> - People need a clear personal queue and a consistent way to answer
each request.
> - Repeated headings, inconsistent card actions, and separate review
flows make that work harder.
> - This pull request connects the inbox UI to the routing foundation in
#20959.
> - Compact cards use shared task controls and open supporting work in a
side panel.
> - People can answer, claim, transfer, archive, and inspect outcomes
from one place.

## Linked Issues or Issue Description

**What existing behavior does this improve?**

The inbox cards, personal views, shared task controls, and decision
history.

**Subsystem affected**

UI. This PR targets master and uses the routing foundation merged in
#20959.

**Current behavior**

The inbox repeats headings and counts. Cards have different layouts and
action placement. The requester can repeat the signed-in person's name.
Review and question controls differ between the inbox and task thread.

**Proposed behavior**

Open Assigned to you by default. Show one count line above the cards.
Use a compact card layout with consistent actions and supporting
details. Show the requester's avatar and name only when they differ from
the signed-in person. Share question controls, including a radio option
for Other that reveals a text field when selected.

**Reason and benefit**

People can scan their queue and complete requests without losing the
surrounding task or creating separate drafts for the same review.

**Breaking changes**

The default inbox view becomes personal. The all-assignee and shared
views remain available. Card close menus distinguish personal archive
and snooze from shared withdrawal.

**Additional context**

Refs #20959, #19363, and #19520. Refs #20268 for related
actionable-request work. This stack adds personal routing and shared
controls. ROADMAP.md includes Multiple Human Users and Agent Reviews and
Approvals.

## What Changed

- Add personal, unassigned, company, all-assignee, and archived inbox
views. Add claim, transfer, personal close actions, receipts, and
history controls.
- Use compact decision cards with a single count line, one-pixel
borders, and equal space above, below, and to the right of each primary
action.
- Open artifacts and synchronized confirmation/approval controls in a
shared side panel. Share their revision drafts and action state with the
task thread. Other requests keep one editable form on the inbox card
while reviewing an artifact.
- Make Other match the question options and reveal its field only when
selected. Apply this to inbox and task question cards.
- Hide self-requester labels, space agent avatars, and use the standard
canceled status icon for withdrawn requests.
- Use connector logos in connector cards. Keep the connector promotion
background and sidebar border continuous.
- Add company and project decision-owner controls and document the
updated inbox behavior.

## Verification

- The complete [GitHub Actions CI
matrix](https://github.com/paperclipai/paperclip/actions/runs/43141559641)
passes on `8d81a75e49b518fff6b6ff4c23dd67979b0b97ee` (Linux/Node 24:
typecheck, build, general and serialized tests, Runner support, browser
shards, and aggregate gates). Greptile is 5/5 on that exact head with
zero open findings, and the security scan passes.
- Local UI typechecking passes. Eight focused suites pass 382 tests: 236
inbox/review/question/connector tests plus all 146 composer tests.
Regressions passed red to green for attachment links, prompt rendering,
single-form artifact review, connector scope copy, accessible headings,
and the composer test harness's missing theme provider. The final commit
changes only that test harness; production code is unchanged from
`59d015833f`.
- Browser acceptance on the production implementation confirms preserved
selected answers with one editable question form, accessible Markdown
prompts, inert image references, accurate connector scope copy, native
PDF downloads, image sidebar previews, and Open file requesting the
attachment endpoint while preserving the inbox URL. Request reads and
file responses were intercepted; no question answers were written. The
preview is healthy on the final head.
- Visual and interaction checks cover Other radio behavior in both
themes and on mobile, the loaded Google Calendar logo, and 20px above,
below, and to the right of the primary action across all 23 visible
cards. The affected desktop/mobile navigation and sidebar specs pass
locally and in the final CI browser matrix.
- Real-editor browser checks confirm Ctrl/Cmd+Enter cannot bypass
another person's confirmation. Cancel preserves the draft and unlocks
silently; Continue submits once. Approval write failures remain visible.
- `pnpm verify` returns exit 2 because DESIGN.md requires broader
coverage; the final full CI matrix supplies every requested gate. Maps
and Storybook catalog structural checks pass. The routing foundation
#20959 merged after passing 249 database tests, server typechecking,
full CI, Greptile 5/5, and security scanning. Its backend and SDK
registry are preserved.
- Demo data is retained for testing; database suites and browser specs
use separate disposable databases.

## Risks

- The inbox uses the routing contracts merged in #20959. Personal
filters and history affect shared task entry points; the affected
controls are included in local regression coverage and full CI.
- Personal defaults and close-menu wording change inbox behavior.
Existing resolver permissions still control shared actions.
- Shared revision state and live invalidation affect two surfaces.
Focused tests cover draft synchronization, action locks, and incoming
updates.
- Visual changes use the existing design tokens and component
primitives.

## Model Used

OpenAI GPT-6 through Codex. Used repository tools, code execution, and
browser checks. This session does not expose a more specific runtime
model ID or its context-window size.

## 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 described the issue in-PR following the relevant issue
template
- [x] I have not referenced internal/instance-local Paperclip issues or
links
- [x] My branch name describes the change and contains no internal
Paperclip ticket id
- [x] I have run focused 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
- [x] All Paperclip CI gates are green
- [x] 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: Scott Tong <scott@scottsmbpm5max.lan>
Co-authored-by: Paperclip <noreply@paperclip.ing>
This commit is contained in:
authored and GitHub committed 2026-11-11 21:05:00 -08:00
1 parent 156453fe7c
commit cf1def0ca6
85 files changed
+9492 -1043

No files matched your search

@@ -0,0 +1,41 @@
// @vitest-environment jsdom
import { act } from "react";
import { createRoot } from "react-dom/client";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { describe, expect, it, vi } from "vitest";
import { ThemeProvider } from "@/context/ThemeContext";
import { QuestionForm } from "./QuestionForm";
vi.mock("./TaskChatRichInput", () => ({ TaskChatRichInput: () => null }));
(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true;
describe("question prompt Markdown", () => {
it.each(["default", "decision"] as const)("renders rich prompts as inert reference content in %s questions", async presentation => {
const container = document.createElement("div");
document.body.append(container);
const root = createRoot(container);
const client = new QueryClient({ defaultOptions: { queries: { retry: false } } });
try {
await act(async () => root.render(<QueryClientProvider client={client}><ThemeProvider>
<QuestionForm id="rich-prompts" presentation={presentation} onSubmit={vi.fn()} questionSet={{
schema: "paperclip.question_set.v1", questions: [{
id: "first", required: true, answerMode: "single_select",
prompt: "**Choose** a [plan](https://example.com/plan):\n\n- Fast\n- Careful\n\n![Reference](https://example.com/reference.png)",
options: [{ id: "a", label: "Option A" }],
}, { id: "second", required: false, answerMode: "text", prompt: "Any notes?" }],
}} />
</ThemeProvider></QueryClientProvider>));
expect(container.querySelector("strong")?.textContent).toBe("Choose");
expect(container.querySelector('a[href="https://example.com/plan"]')?.textContent).toBe("plan");
expect([...container.querySelectorAll("li")].map(item => item.textContent)).toEqual(["Fast", "Careful"]);
expect(container.querySelector("[data-markdown-image-reference]")?.textContent).toContain("Reference");
expect(container.querySelector("img")).toBeNull();
expect(container.querySelector("p div")).toBeNull();
} finally {
await act(async () => root.unmount());
client.clear();
container.remove();
}
});
});
@@ -22,8 +22,8 @@ describe("QuestionForm initial text", () => {
beforeEach(() => { localStorage.clear(); submit.mockReset(); container = document.createElement("div"); document.body.append(container); root = createRoot(container); });
afterEach(async () => { await act(async () => root.unmount()); container.remove(); localStorage.clear(); });
const input = () => container.querySelector("textarea")!;
async function render(set = questionSet, initialResponse?: PaperclipQuestionResponse) {
await act(async () => root.render(<QuestionForm id="edit" questionSet={set} initialResponse={initialResponse} draftKey="question-initial-text" onSubmit={submit} />));
async function render(set = questionSet, initialResponse?: PaperclipQuestionResponse, presentation: "default" | "decision" = "default") {
await act(async () => root.render(<QuestionForm id="edit" presentation={presentation} questionSet={set} initialResponse={initialResponse} draftKey="question-initial-text" onSubmit={submit} />));
}
async function edit(text: string) {
await act(async () => {
@@ -32,6 +32,40 @@ describe("QuestionForm initial text", () => {
});
}
async function remount(set = questionSet) { await act(async () => root.unmount()); root = createRoot(container); await render(set); }
it.each([
["default", "single_select", "radio"],
["decision", "single_select", "radio"],
["default", "multi_select", "checkbox"],
] as const)("keeps Other in the choice group with matching selection behavior (%s, %s)", async (presentation, answerMode, role) => {
await render({ schema: "paperclip.question_set.v1", questions: [{
id: "choice", prompt: "Pick an option", required: true, answerMode,
options: [{ id: "a", label: "Option A" }, { id: "b", label: "Option B" }],
customAnswer: { enabled: true },
}] }, undefined, presentation);
const choices = [...container.querySelectorAll<HTMLButtonElement>(`[role="${role}"]`)];
const other = choices.find(button => button.textContent === "Other")!;
expect(choices).toHaveLength(3);
expect(other.closest('[role="radiogroup"], [role="group"]')).toBe(choices[0]!.closest('[role="radiogroup"], [role="group"]'));
expect(input()).toBeNull();
await act(async () => choices[0]!.click());
await act(async () => other.click());
expect(other.getAttribute("aria-checked")).toBe("true");
expect(choices[0]!.getAttribute("aria-checked")).toBe(answerMode === "single_select" ? "false" : "true");
await edit("My alternative");
await act(async () => other.click());
if (answerMode === "single_select") {
expect(other.getAttribute("aria-checked")).toBe("true");
expect(input().value).toBe("My alternative");
await act(async () => choices[0]!.click());
}
expect(other.getAttribute("aria-checked")).toBe("false");
expect(input()).toBeNull();
await act(async () => [...container.querySelectorAll("button")].find(button => button.textContent === "Submit answers")!.click());
expect(submit).toHaveBeenCalledOnce();
expect(submit.mock.calls[0]![0].answers.choice.selectedOptionIds).toEqual(["a"]);
expect(submit.mock.calls[0]![0].answers.choice.customText).toBeUndefined();
});
it("shows exact editable text without sending until the operator submits", async () => {
await render();
expect(input().value).toBe(" Draft\n漢字\n");
+53 -43
View File
@@ -12,6 +12,7 @@ import type {
} from "@paperclipai/adapter-utils";
import type { MentionOption } from "@/components/MarkdownEditor";
import { DecisionCardFooter } from "@/components/DecisionCardFooter";
import { NeedsYouPanel } from "@/components/coordinator/NeedsYouCardKit";
import { MarkdownBody } from "@/components/MarkdownBody";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
@@ -46,6 +47,8 @@ export interface QuestionFormProps {
footerSlot?: ReactNode;
id: string;
presentation?: "default" | "decision";
/** A decision card's ask already is this (single) question's prompt. */
promptStated?: boolean;
questionSet: PaperclipQuestionSet;
initialResponse?: PaperclipQuestionResponse | null;
implicitCustomAnswer?: boolean;
@@ -244,6 +247,7 @@ function QuestionFormForRequest({
footerSlot,
id,
presentation = "default",
promptStated = false,
questionSet,
initialResponse,
implicitCustomAnswer = false,
@@ -296,7 +300,7 @@ function QuestionFormForRequest({
const [inputUploading, setInputUploading] = useState(false);
const [error, setError] = useState<FormError | null>(null);
const [attemptedQuestions, setAttemptedQuestions] = useState<Record<string, boolean>>({});
const promptRef = useRef<HTMLParagraphElement>(null);
const promptRef = useRef<HTMLDivElement>(null);
const previousPage = useRef(page);
useEffect(() => {
@@ -384,7 +388,8 @@ function QuestionFormForRequest({
}
function toggleCustom() {
const active = !isCustomActive;
if (disabled || working || inputUploading) return;
const active = !multiple || !isCustomActive;
setCustomActive((current) => ({ ...current, [question.id]: active }));
updateAnswer({
...answer,
@@ -422,6 +427,7 @@ function QuestionFormForRequest({
});
if (draftKey) clearDraft(draftKey);
} catch (cause) {
if (cause instanceof DOMException && cause.name === "AbortError") return;
setError({
message:
cause instanceof Error
@@ -519,41 +525,21 @@ function QuestionFormForRequest({
}
void submit();
}
return (
<div
key={question.id}
className="tc-question-page"
onKeyDown={(event) => {
if (
disabled ||
working ||
event.repeat ||
question.answerMode === "text" ||
event.metaKey ||
event.ctrlKey ||
event.altKey
)
return;
const target = event.target as HTMLElement;
if (target.matches("input, textarea, [contenteditable='true']")) return;
const optionIndex = Number.parseInt(event.key, 10) - 1;
const option = visibleOptions[optionIndex];
if (!option || optionIndex < 0 || optionIndex > 8) return;
event.preventDefault();
toggleOption(option.id);
}}
>
// A Needs You decision card puts the question in its inset panel under the
// card's ask, numbered when there are several (PAP-775).
const decision = presentation === "decision";
const body = <>
{questionSet.description ? (
<div
role="region"
aria-label="Question context"
tabIndex={0}
className="mb-3 max-h-96 overflow-auto text-sm text-muted-foreground"
className={cn("max-h-96 overflow-auto text-muted-foreground", decision ? "text-xs" : "mb-3 text-sm")}
>
<MarkdownBody mediaMode="reference" linkIssueReferences={false}>{questionSet.description}</MarkdownBody>
</div>
) : null}
{question.answerMode === "text" && presentation !== "decision" ? (
{question.answerMode === "text" && !decision ? (
<div className="mb-2 flex items-center gap-3 text-xs text-muted-foreground">
{question.answerMode === "text" ? <span>Write an answer</span> : null}
</div>
@@ -564,26 +550,24 @@ function QuestionFormForRequest({
{pagination}
</TaskChatComposerTakeoverControls>
) : (
<div className="mb-2 flex justify-end text-xs text-muted-foreground">
<div className={cn("flex justify-end text-xs text-muted-foreground", !decision && "mb-2")}>
{pagination}
</div>
)
) : null}
<div>
{question.header && presentation !== "decision" ? (
{question.header && !decision ? (
<p className="mb-1 text-xs font-medium text-muted-foreground">
{question.header}
</p>
) : null}
<p
ref={promptRef}
tabIndex={-1}
id={`${id}-${question.id}-prompt`}
data-decision-prompt={presentation === "decision" ? true : undefined}
className={presentation === "decision" ? "text-lg font-medium leading-relaxed text-foreground" : "text-sm font-medium leading-5 text-foreground"}
>
{question.prompt}
</p>
<div ref={promptRef} tabIndex={-1} className={cn("leading-5", decision ? "text-(length:--text-compact)" : "text-sm", decision && promptStated && "sr-only")}>
<div id={`${id}-${question.id}-prompt`} className="flex items-start gap-1 font-medium text-foreground">
{decision && questionSet.questions.length > 1 ? <span>{page + 1}.</span> : null}
<MarkdownBody mediaMode="reference" linkIssueReferences={false} className={cn("min-w-0", decision && "text-(length:--text-compact)")}>{question.prompt}</MarkdownBody>
</div>
{decision ? <span aria-hidden className="text-muted-foreground"> · {question.required ? "Required" : "Optional"}</span> : null}
</div>
{question.helpText ? (
<p className="mt-1 text-xs leading-4 text-muted-foreground">
{question.helpText}
@@ -591,7 +575,7 @@ function QuestionFormForRequest({
) : null}
</div>
{question.answerMode === "text" ? (
<div className="mt-3">
<div className={decision ? undefined : "mt-3"}>
<TaskChatRichInput
questionAnswer
ariaLabelledBy={`${id}-${question.id}-prompt`}
@@ -599,10 +583,10 @@ function QuestionFormForRequest({
value={answer.text ?? ""}
disabled={disabled || working != null}
onChange={(value) => updateAnswer({ text: value })}
placeholder="Write your answer"
placeholder={decision ? "Add context for the agent…" : "Write your answer"}
imageUploadHandler={imageUploadHandler}
mentions={mentions}
autoFocus
autoFocus={!decision}
onUploadingChange={setInputUploading}
onSubmit={() => {
progressOrSubmit();
@@ -612,7 +596,7 @@ function QuestionFormForRequest({
</div>
) : (
<div
className="mt-3 grid gap-1.5"
className={cn("grid gap-1.5", !decision && "mt-3")}
role={multiple ? "group" : "radiogroup"}
aria-labelledby={`${id}-${question.id}-prompt`}
>
@@ -689,6 +673,32 @@ function QuestionFormForRequest({
{currentError && attemptedQuestions[question.id] ? (
<p role="alert" className="mt-2 text-xs text-destructive">{currentError}</p>
) : null}
</>;
return (
<div
key={question.id}
className="tc-question-page"
onKeyDown={(event) => {
if (
disabled ||
working ||
event.repeat ||
question.answerMode === "text" ||
event.metaKey ||
event.ctrlKey ||
event.altKey
)
return;
const target = event.target as HTMLElement;
if (target.matches("input, textarea, [contenteditable='true']")) return;
const optionIndex = Number.parseInt(event.key, 10) - 1;
const option = visibleOptions[optionIndex];
if (!option || optionIndex < 0 || optionIndex > 8) return;
event.preventDefault();
toggleOption(option.id);
}}
>
{decision ? <NeedsYouPanel>{body}</NeedsYouPanel> : body}
<div aria-live="assertive">
{errorMessage ? (
<div className="mt-2 rounded-sm border border-destructive/60 bg-destructive/10 px-2.5 py-2 text-sm text-destructive">
@@ -61,6 +61,7 @@ import {
type SuggestTasksInteraction,
type SuggestedTaskTreeNode,
} from "@/lib/issue-thread-interactions";
import { claimReviseDraftWork, clearReviseDraft, getReviseDraft, releaseReviseDraftWork, reviseDraftKey, updateReviseDraft, useReviseDraft } from "@/lib/revise-draft-store";
import { cn } from "@/lib/utils";
import { QuestionForm } from "./QuestionForm";
import { useCoordinatorWorkspaceEnabled } from "@/hooks/useCoordinatorWorkspaceEnabled";
@@ -849,11 +850,12 @@ function ConfirmationCard({
mentions?: MentionOption[];
}) {
const preparingApproval = isInteractionPreparingApproval(interaction);
const [rejecting, setRejecting] = useState(false);
const [reason, setReason] = useState(() =>
draftKey ? loadStructuredDraft(draftKey, "") : "",
);
const [working, setWorking] = useState<"accept" | "reject" | null>(null);
const target = interaction.payload.target;
const sharedKey = reviseDraftKey(interaction.id, target?.type === "issue_document" ? target.revisionId : null);
const [draft, updateDraft] = useReviseDraft(sharedKey);
const { revising: rejecting, reason, working } = draft;
const setRejecting = (revising: boolean) => revising ? updateDraft({ revising }) : clearReviseDraft(sharedKey);
const setReason = (value: string) => updateDraft({ reason: value });
const [actionError, setActionError] = useState<string | null>(null);
const [revisionUploading, setRevisionUploading] = useState(false);
const collectsRejectReason = Boolean(
@@ -865,8 +867,17 @@ function ConfirmationCard({
interaction.payload.target?.type === "issue_document" &&
interaction.payload.target.key === "plan";
useEffect(() => {
if (draftKey) saveStructuredDraft(draftKey, reason);
}, [draftKey, reason]);
if (!draftKey) return;
const legacyReason = loadStructuredDraft(draftKey, "");
const current = getReviseDraft(sharedKey);
if (legacyReason && !current.reason && !current.revising && !current.working) {
updateReviseDraft(sharedKey, { reason: legacyReason, revising: true });
}
clearDraft(draftKey);
}, [draftKey, sharedKey]);
useEffect(() => {
if (interaction.status !== "pending") clearReviseDraft(sharedKey);
}, [interaction.status, sharedKey]);
async function resolve(action: "accept" | "reject") {
if (
action === "reject" &&
@@ -874,16 +885,17 @@ function ConfirmationCard({
!reason.trim()
)
return;
setWorking(action);
if (!claimReviseDraftWork(sharedKey, action)) return;
setActionError(null);
try {
if (action === "accept") await onAcceptInteraction?.(interaction);
else await onRejectInteraction?.(interaction, reason.trim() || undefined);
if (draftKey) clearDraft(draftKey);
clearReviseDraft(sharedKey);
} catch (error) {
setActionError(errorMessage(error));
} finally {
setWorking(null);
releaseReviseDraftWork(sharedKey);
}
}
@@ -17,6 +17,7 @@ import type { Agent, HeartbeatRun, IssueWorkMode } from "@paperclipai/shared";
import { agentsApi } from "@/api/agents";
import { instanceSettingsApi } from "@/api/instanceSettings";
import { CoordinatorPresentation } from "@/components/coordinator/CoordinatorPresentation";
import { ThemeProvider } from "@/context/ThemeContext";
import { DRAFT_DEBOUNCE_MS } from "../../lib/composer-draft";
import {
loadDraftAttachments,
@@ -215,7 +216,7 @@ afterEach(() => {
});
function render(ui: ReactElement) {
flushSync(() => root!.render(ui));
flushSync(() => root!.render(<ThemeProvider>{ui}</ThemeProvider>));
}
async function flushAsync() {