Skip to content

The open-source app everyone uses to manage agents at work

feat(ui): refine streamlined task experience (#12748)

scotttong4d30efa8e3ab
diff --git a/ui/src/App.activity-routing.test.tsx b/ui/src/App.activity-routing.test.tsx
index c1adf64c58..b87aec4405 100644
--- a/ui/src/App.activity-routing.test.tsx
+++ b/ui/src/App.activity-routing.test.tsx
@@ -1,11 +1,10 @@
// @vitest-environment jsdom
-// Regression guard for PAP-16302: `/audit` was merged into the single rich
-// Activity page. Both the company-prefixed `/:company/audit` and the bare
-// `/audit` (PAP-16300's unprefixed redirect) must keep resolving — as redirects
-// into `/:company/activity?mode=agents`, so old deep links land on the
-// agent-actions scope instead of 404ing. This drives the real <App> route table
-// so removing either registration fails loudly.
+// Regression guard for the Audit hub: Activity remains the canonical root,
+// while Runs, Costs, and Budgets live beneath it. Company-prefixed and bare
+// legacy routes must keep resolving with their query filters intact; `/audit`
+// specifically retains the historical Agent Actions preset. This drives the
+// real <App> route table so removing either registration fails loudly.
import type { ReactNode } from "react";
import { flushSync } from "react-dom";
@@ -14,6 +13,12 @@ import { MemoryRouter, useLocation } from "react-router-dom";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { App } from "./App";
+const streamlinedUiState = vi.hoisted(() => ({ enabled: true, loaded: true }));
+
+vi.mock("./hooks/useStreamlinedUiEnabled", () => ({
+ useStreamlinedUiEnabled: () => streamlinedUiState,
+}));
+
// jsdom's CSS parser rejects the custom-property marker rule stitches inserts
// (`--sxs{--sxs:N}`), pulled into <App>'s eager import graph transitively via
// @codesandbox/sandpack-react. Substitute a benign, valid rule on parse failure
@@ -48,6 +53,11 @@ vi.mock("./components/Layout", async () => {
return { Layout: () => <Outlet /> };
});
+vi.mock("./components/Layout.production", async () => {
+ const { Outlet } = await import("react-router-dom");
+ return { Layout: () => <Outlet /> };
+});
+
// Rendered by <App> outside <Routes> and needs DialogProvider; irrelevant here.
vi.mock("./components/OnboardingWizardVariant", () => ({
OnboardingWizardVariant: () => null,
@@ -83,6 +93,28 @@ vi.mock("./pages/Issues", () => ({
},
}));
+vi.mock("./pages/audit/CompanyActivity.production", () => ({
+ CompanyActivity: () => {
+ const location = useLocation();
+ return <div>{`PRODUCTION_ACTIVITY@${location.pathname}${location.search}`}</div>;
+ },
+}));
+
+vi.mock("./pages/Costs.production", () => ({
+ Costs: () => {
+ const location = useLocation();
+ return <div>{`PRODUCTION_COSTS@${location.pathname}${location.search}`}</div>;
+ },
+}));
+
+vi.mock("./pages/NotFound", () => ({
+ NotFoundPage: ({ scope }: { scope: string }) => <div>{`NOT_FOUND:${scope}`}</div>,
+}));
+
+vi.mock("./pages/PluginPage", () => ({
+ PluginPage: () => <div>PRODUCTION_PLUGIN_FALLBACK</div>,
+}));
+
const PAP_COMPANY = {
id: "company-1",
name: "Paperclip",
@@ -144,6 +176,8 @@ describe("App Activity routing (PAP-16302)", () => {
container = document.createElement("div");
document.body.appendChild(container);
companyState = { companies: [PAP_COMPANY], selected: PAP_COMPANY };
+ streamlinedUiState.enabled = true;
+ streamlinedUiState.loaded = true;
});
afterEach(() => {
@@ -177,6 +211,27 @@ describe("App Activity routing (PAP-16302)", () => {
flushSync(() => root.unmount());
});
+ it("serves each canonical Audit section under Activity", async () => {
+ const root = renderAppAt(container, "/PAP/activity/runs?agentId=agent-1");
+ await waitForRoute(container, "AUDIT_RUNS@/PAP/activity/runs?agentId=agent-1");
+ flushSync(() => root.unmount());
+ });
+
+ it("redirects legacy costs and preserves its deep-link filters", async () => {
+ const root = renderAppAt(container, "/PAP/costs?range=30d#usage");
+ await waitForRoute(container, "AUDIT_COSTS@/PAP/activity/costs?range=30d");
+ flushSync(() => root.unmount());
+ });
+
+ it("redirects legacy Audit sections to their canonical destination", async () => {
+ const root = renderAppAt(container, "/PAP/audit/budgets?projectId=project-1");
+ await waitForRoute(
+ container,
+ "AUDIT_BUDGETS@/PAP/activity/budgets?projectId=project-1",
+ );
+ flushSync(() => root.unmount());
+ });
+
it("keeps the company from the URL when /:company/audit is not the selected company", async () => {
// A shared /ACME/audit link opened by someone whose selected company is PAP
// must still show ACME's activity. The redirect target is written absolute
@@ -205,4 +260,48 @@ describe("App Activity routing (PAP-16302)", () => {
expect(container.textContent).not.toContain("/tasks/dashboard");
flushSync(() => root.unmount());
});
+
+ it("redirects a bare legacy section through to the prefixed Audit hub", async () => {
+ const root = renderAppAt(container, "/runs?runStatus=succeeded");
+ await waitForRoute(container, "AUDIT_RUNS@/PAP/activity/runs?runStatus=succeeded");
+ flushSync(() => root.unmount());
+ });
+
+ it("uses the production Activity and Costs routes when Streamlined UI is disabled", async () => {
+ streamlinedUiState.enabled = false;
+ const activityRoot = renderAppAt(container, "/PAP/activity");
+ await waitForRoute(container, "PRODUCTION_ACTIVITY@/PAP/activity");
+ flushSync(() => activityRoot.unmount());
+
+ const costsRoot = renderAppAt(container, "/PAP/costs?range=30d");
+ await waitForRoute(container, "PRODUCTION_COSTS@/PAP/costs?range=30d");
+ flushSync(() => costsRoot.unmount());
+ });
+
+ it("omits streamlined-only Audit routes when Streamlined UI is disabled", async () => {
+ streamlinedUiState.enabled = false;
+ const root = renderAppAt(container, "/PAP/activity/runs");
+ await waitForRoute(container, "PRODUCTION_PLUGIN_FALLBACK");
+ expect(container.textContent).not.toContain("AUDIT_RUNS");
+ flushSync(() => root.unmount());
+ });
+
+ it("does not mount streamlined routes before the experiment setting loads", async () => {
+ streamlinedUiState.loaded = false;
+ const root = renderAppAt(container, "/PAP/activity");
+ expect(container.textContent).not.toContain("ACTIVITY_PAGE");
+ expect(container.textContent).not.toContain("PRODUCTION_ACTIVITY");
+
+ streamlinedUiState.enabled = false;
+ streamlinedUiState.loaded = true;
+ flushSync(() => {
+ root.render(
+ <MemoryRouter initialEntries={["/PAP/activity"]}>
+ <App />
+ </MemoryRouter>,
+ );
+ });
+ await waitForRoute(container, "PRODUCTION_ACTIVITY@/PAP/activity");
+ flushSync(() => root.unmount());
+ });
});
diff --git a/ui/src/App.tsx b/ui/src/App.tsx
index 147b6a4645..a75caa480e 100644
--- a/ui/src/App.tsx
+++ b/ui/src/App.tsx
@@ -1,9 +1,10 @@
-import { lazy, Suspense } from "react";
+import { lazy, Suspense, type ReactNode } from "react";
import type { ToolConnectionCredentialSource } from "@paperclipai/shared";
import { Navigate, Outlet, Route, Routes, useActiveCompanyPrefix, useLocation, useParams } from "@/lib/router";
import { Button } from "@/components/ui/button";
import { useTranslation } from "@/i18n";
import { Layout } from "./components/Layout";
+import { Layout as ProductionLayout } from "./components/Layout.production";
import { ConferenceRoomChatGate } from "./components/ConferenceRoomChatGate";
import { TaskChatLab } from "./pages/TaskChatLab";
import { PipelinesExperimentalGate } from "./components/PipelinesExperimentalGate";
@@ -48,7 +49,6 @@ import { Artifacts } from "./pages/Artifacts";
import { GoalDetail } from "./pages/GoalDetail";
import { Approvals } from "./pages/Approvals";
import { ApprovalDetail } from "./pages/ApprovalDetail";
-import { Costs } from "./pages/Costs";
import { CompanyActivity } from "./pages/audit/CompanyActivity";
import { AuditHub } from "./pages/audit/AuditHub";
import { Inbox } from "./pages/Inbox";
@@ -85,7 +85,6 @@ import { PluginManager } from "./pages/PluginManager";
import { PluginSettings } from "./pages/PluginSettings";
import { AdapterManager } from "./pages/AdapterManager";
import { PluginPage } from "./pages/PluginPage";
-import { OrgChart } from "./pages/OrgChart";
import { NewAgent } from "./pages/NewAgent";
import { AuthPage } from "./pages/Auth";
import { BoardClaimPage } from "./pages/BoardClaim";
@@ -103,6 +102,7 @@ import {
} from "./lib/onboarding-route";
import { filterHiddenInstanceSettingsPath, normalizeRememberedInstanceSettingsPath } from "./lib/instance-settings";
import { useCloudInstance } from "./hooks/useCloudInstance";
+import { useStreamlinedUiEnabled } from "./hooks/useStreamlinedUiEnabled";
import { cloudStackCreateUrl } from "./lib/cloudLinks";
import { navigateTopLevel } from "@/lib/browserNavigation";
@@ -110,13 +110,45 @@ const CompanyExport = lazy(() =>
import("./pages/CompanyExport").then((module) => ({ default: module.CompanyExport })),
);
-function boardRoutes() {
+const ProductionAgents = lazy(() =>
+ import("./pages/Agents.production").then((module) => ({ default: module.Agents })),
+);
+const ProductionAgentDetail = lazy(() =>
+ import("./pages/AgentDetail.production").then((module) => ({ default: module.AgentDetail })),
+);
+const ProductionRoutines = lazy(() =>
+ import("./pages/Routines.production").then((module) => ({ default: module.Routines })),
+);
+const ProductionRoutineDetail = lazy(() =>
+ import("./pages/RoutineDetail.production").then((module) => ({ default: module.RoutineDetail })),
+);
+const ProductionCompanySkills = lazy(() =>
+ import("./pages/CompanySkills.production").then((module) => ({ default: module.CompanySkills })),
+);
+const ProductionCompanyActivity = lazy(() =>
+ import("./pages/audit/CompanyActivity.production").then((module) => ({ default: module.CompanyActivity })),
+);
+const ProductionCosts = lazy(() =>
+ import("./pages/Costs.production").then((module) => ({ default: module.Costs })),
+);
+const ProductionOrgChart = lazy(() =>
+ import("./pages/OrgChart.production").then((module) => ({ default: module.OrgChart })),
+);
+
+function ProductionSurface({ children }: { children: ReactNode }) {
+ return <Suspense fallback={<PaperclipLoading />}>{children}</Suspense>;
+}
+
+function boardRoutes(streamlinedUiEnabled: boolean) {
return (
<>
<Route index element={<Navigate to="dashboard" replace />} />
<Route path="dashboard" element={<Dashboard />} />
<Route path="dashboard/live" element={<DashboardLive />} />
- <Route path="timeline" element={<Timeline />} />
+ <Route
+ path="timeline"
+ element={streamlinedUiEnabled ? <AuditCompatibilityRedirect to="/activity/timeline" /> : <Timeline />}
+ />
<Route path="onboarding" element={<OnboardingRoutePage />} />
<Route path="companies" element={<Companies />} />
<Route path="company/settings" element={<CompanySettings />} />
@@ -214,19 +246,29 @@ function boardRoutes() {
<Route path="skills/studio/new" element={<SkillStudio />} />
<Route path="skills/studio/:skillId" element={<SkillStudio />} />
<Route path="skills/:skillId/studio" element={<LegacySkillStudioRedirect />} />
- <Route path="skills/*" element={<CompanySkills />} />
+ <Route
+ path="skills/*"
+ element={streamlinedUiEnabled ? <CompanySkills /> : <ProductionSurface><ProductionCompanySkills /></ProductionSurface>}
+ />
<Route path="settings" element={<LegacySettingsRedirect />} />
<Route path="settings/*" element={<LegacySettingsRedirect />} />
<Route path="plugins/:pluginId" element={<PluginPage />} />
- <Route path="org" element={<OrgChart />} />
+ <Route
+ path="org"
+ element={streamlinedUiEnabled ? <Navigate to="/agents/all" replace /> : <ProductionSurface><ProductionOrgChart /></ProductionSurface>}
+ />
<Route path="agents" element={<Navigate to="/agents/all" replace />} />
{AGENT_FILTER_TABS.map((tab) => (
- <Route key={tab} path={`agents/${tab}`} element={<Agents />} />
+ <Route
+ key={tab}
+ path={`agents/${tab}`}
+ element={streamlinedUiEnabled ? <Agents /> : <ProductionSurface><ProductionAgents /></ProductionSurface>}
+ />
))}
<Route path="agents/new" element={<NewAgent />} />
- <Route path="agents/:agentId" element={<AgentDetail />} />
- <Route path="agents/:agentId/:tab" element={<AgentDetail />} />
- <Route path="agents/:agentId/runs/:runId" element={<AgentDetail />} />
+ <Route path="agents/:agentId" element={streamlinedUiEnabled ? <AgentDetail /> : <ProductionSurface><ProductionAgentDetail /></ProductionSurface>} />
+ <Route path="agents/:agentId/:tab" element={streamlinedUiEnabled ? <AgentDetail /> : <ProductionSurface><ProductionAgentDetail /></ProductionSurface>} />
+ <Route path="agents/:agentId/runs/:runId" element={streamlinedUiEnabled ? <AgentDetail /> : <ProductionSurface><ProductionAgentDetail /></ProductionSurface>} />
<Route path="projects" element={<Projects />} />
<Route path="projects/:projectId" element={<ProjectDetail />} />
<Route path="projects/:projectId/overview" element={<ProjectDetail />} />
@@ -253,7 +295,7 @@ function boardRoutes() {
{import.meta.env.DEV ? (
<Route path="tests/perf/long-thread" element={<IssueChatLongThreadPerf />} />
) : null}
- <Route path="routines" element={<Routines />} />
+ <Route path="routines" element={streamlinedUiEnabled ? <Routines /> : <ProductionSurface><ProductionRoutines /></ProductionSurface>} />
<Route
path="cases"
element={<CasesExperimentalGate><Cases /></CasesExperimentalGate>}
@@ -305,8 +347,8 @@ function boardRoutes() {
path="pipelines/:pipelineId/cases/:caseId"
element={<PipelinesExperimentalGate><PipelineItemLegacyRedirect /></PipelinesExperimentalGate>}
/>
- <Route path="routines/:routineId" element={<RoutineDetail />} />
- <Route path="routines/:routineId/:section" element={<RoutineDetail />} />
+ <Route path="routines/:routineId" element={streamlinedUiEnabled ? <RoutineDetail /> : <ProductionSurface><ProductionRoutineDetail /></ProductionSurface>} />
+ <Route path="routines/:routineId/:section" element={streamlinedUiEnabled ? <RoutineDetail /> : <ProductionSurface><ProductionRoutineDetail /></ProductionSurface>} />
<Route element={<IsolatedWorkspacesRouteGate />}>
<Route element={<ExecutionWorkspaceCompanyGate />}>
<Route path="execution-workspaces/:workspaceId" element={<ExecutionWorkspaceDetail />} />
@@ -324,15 +366,29 @@ function boardRoutes() {
<Route path="approvals/pending" element={<Approvals />} />
<Route path="approvals/all" element={<Approvals />} />
<Route path="approvals/:approvalId" element={<ApprovalDetail />} />
- <Route path="costs" element={<Costs />} />
- <Route path="activity" element={<CompanyActivity />} />
- <Route path="activity/runs" element={<AuditHub section="runs" />} />
- <Route path="activity/costs" element={<AuditHub section="costs" />} />
- <Route path="activity/budgets" element={<AuditHub section="budgets" />} />
- <Route path="activity/timeline" element={<AuditHub section="timeline" />} />
- {/* `/audit` merged into the single Activity page (PAP-16302). Existing deep
- links keep working, preset to the agent-actions scope. */}
- <Route path="audit" element={<Navigate to="/activity?mode=agents" replace />} />
+ <Route path="activity" element={streamlinedUiEnabled ? <CompanyActivity /> : <ProductionSurface><ProductionCompanyActivity /></ProductionSurface>} />
+ {streamlinedUiEnabled ? (
+ <>
+ <Route path="activity/runs" element={<AuditHub section="runs" />} />
+ <Route path="activity/costs" element={<AuditHub section="costs" />} />
+ <Route path="activity/budgets" element={<AuditHub section="budgets" />} />
+ <Route path="activity/timeline" element={<AuditHub section="timeline" />} />
+ <Route path="audit" element={<AuditCompatibilityRedirect to="/activity" forceAgentMode />} />
+ <Route path="audit/activity" element={<AuditCompatibilityRedirect to="/activity" />} />
+ <Route path="audit/runs" element={<AuditCompatibilityRedirect to="/activity/runs" />} />
+ <Route path="audit/costs" element={<AuditCompatibilityRedirect to="/activity/costs" />} />
+ <Route path="audit/budgets" element={<AuditCompatibilityRedirect to="/activity/budgets" />} />
+ <Route path="audit/timeline" element={<AuditCompatibilityRedirect to="/activity/timeline" />} />
+ <Route path="runs" element={<AuditCompatibilityRedirect to="/activity/runs" />} />
+ <Route path="costs" element={<AuditCompatibilityRedirect to="/activity/costs" />} />
+ <Route path="budgets" element={<AuditCompatibilityRedirect to="/activity/budgets" />} />
+ </>
+ ) : (
+ <>
+ <Route path="costs" element={<ProductionSurface><ProductionCosts /></ProductionSurface>} />
+ <Route path="audit" element={<Navigate to="/activity?mode=agents" replace />} />
+ </>
+ )}
{/* Conference Room Chat surfaces (PAP-136/PAP-137): routes stay
registered but redirect to the company home while the experimental
flag is off. The board-level `artifacts` mount below is the new
@@ -580,6 +636,20 @@ function StatusCardsLegacyRedirect() {
return <Navigate to={`${base}/status${cardId ? `/${cardId}` : ""}`} replace />;
}
+function AuditCompatibilityRedirect({
+ to,
+ forceAgentMode = false,
+}: {
+ to: string;
+ forceAgentMode?: boolean;
+}) {
+ const location = useLocation();
+ const searchParams = new URLSearchParams(location.search);
+ if (forceAgentMode) searchParams.set("mode", "agents");
+ const search = searchParams.toString();
+ return <Navigate to={`${to}${search ? `?${search}` : ""}${location.hash}`} replace />;
+}
+
function UnprefixedBoardRedirect() {
const location = useLocation();
const { companies, selectedCompany, loading } = useCompany();
@@ -654,6 +724,8 @@ function NoCompaniesStartPage() {
}
export function App() {
+ const { enabled: streamlinedUiEnabled, loaded: streamlinedUiLoaded } = useStreamlinedUiEnabled();
+
return (
<>
<Routes>
@@ -666,7 +738,7 @@ export function App() {
<Route path="ux-lab/responsible-user-denial" element={<ResponsibleUserDenialUxLab />} />
<Route path="ux-lab/cross-issue-collaboration" element={<CrossIssueCollaborationUxLab />} />
- <Route element={<CloudAccessGate />}>
+ <Route element={streamlinedUiLoaded ? <CloudAccessGate /> : <PaperclipLoading />}>
<Route index element={<CompanyRootRedirect />} />
<Route path="onboarding" element={<OnboardingRoutePage />} />
<Route path="instance" element={<LegacySettingsRedirect />} />
@@ -694,6 +766,16 @@ export function App() {
<Route path="pipelines/:pipelineId/cases/:caseId" element={<UnprefixedBoardRedirect />} />
<Route path="artifacts" element={<UnprefixedBoardRedirect />} />
<Route path="audit" element={<UnprefixedBoardRedirect />} />
+ {streamlinedUiEnabled ? (
+ <>
+ <Route path="audit/*" element={<UnprefixedBoardRedirect />} />
+ <Route path="activity" element={<UnprefixedBoardRedirect />} />
+ <Route path="activity/*" element={<UnprefixedBoardRedirect />} />
+ <Route path="runs" element={<UnprefixedBoardRedirect />} />
+ <Route path="costs" element={<UnprefixedBoardRedirect />} />
+ <Route path="budgets" element={<UnprefixedBoardRedirect />} />
+ </>
+ ) : null}
<Route path="decisions" element={<UnprefixedBoardRedirect />} />
<Route path="u/:userSlug" element={<UnprefixedBoardRedirect />} />
<Route path="skills/studio" element={<UnprefixedBoardRedirect />} />
@@ -726,8 +808,8 @@ export function App() {
<Route path="execution-workspaces/:workspaceId/runtime-logs" element={<UnprefixedExecutionWorkspaceRedirect />} />
<Route path="execution-workspaces/:workspaceId/issues" element={<UnprefixedExecutionWorkspaceRedirect />} />
<Route path="execution-workspaces/:workspaceId/routines" element={<UnprefixedExecutionWorkspaceRedirect />} />
- <Route path=":companyPrefix" element={<Layout />}>
- {boardRoutes()}
+ <Route path=":companyPrefix" element={streamlinedUiEnabled ? <Layout /> : <ProductionLayout />}>
+ {boardRoutes(streamlinedUiEnabled)}
</Route>
<Route path="*" element={<NotFoundPage scope="global" />} />
</Route>
diff --git a/ui/src/components/BlockedInboxView.test.tsx b/ui/src/components/BlockedInboxView.test.tsx
index 9bd971fe4e..5b02970e85 100644
--- a/ui/src/components/BlockedInboxView.test.tsx
+++ b/ui/src/components/BlockedInboxView.test.tsx
@@ -164,6 +164,7 @@ describe("BlockedInboxView", () => {
const { root } = renderWithClient(
<BlockedInboxView
{...blockedViewProps}
+ presentation="task"
/>,
container,
);
@@ -258,6 +259,7 @@ describe("BlockedInboxView", () => {
const { root } = renderWithClient(
<BlockedInboxView
{...blockedViewProps}
+ presentation="task"
/>,
container,
);
@@ -269,6 +271,40 @@ describe("BlockedInboxView", () => {
expect(rowText.indexOf("Board")).toBeGreaterThan(rowText.indexOf("Needs decision"));
expect(rowText).not.toContain("Accept or reject");
expect(container.querySelector('[data-testid="blocked-row-reason-column"]')?.textContent).toContain("Needs decision");
+ const taskRow = container.querySelector('[data-slot="task-row"]');
+ const identifier = container.querySelector('[data-slot="task-row-identifier"]');
+ const timestamp = container.querySelector('[data-slot="task-row-timestamp"]');
+ expect(taskRow).not.toBeNull();
+ expect(taskRow?.className).not.toContain("border-b");
+ expect(identifier).not.toBeNull();
+ expect(timestamp).not.toBeNull();
+ if (!identifier || !timestamp) throw new Error("Expected canonical identifier and timestamp columns");
+ expect(identifier.compareDocumentPosition(timestamp) & Node.DOCUMENT_POSITION_FOLLOWING).not.toBe(0);
+
+ act(() => root.unmount());
+ });
+
+ it("restores the legacy status/id prefix, timestamp column, and row divider", async () => {
+ mockIssuesApi.list.mockResolvedValue([
+ makeIssue(
+ "issue-legacy",
+ "PAP-41",
+ "Legacy blocked row",
+ attention({ owner: { type: "board", agentId: null, userId: null, label: "Board" } }),
+ ),
+ ]);
+
+ const { root } = renderWithClient(
+ <BlockedInboxView {...blockedViewProps} presentation="legacy" />,
+ container,
+ );
+ await waitFor(() => container.textContent?.includes("Legacy blocked row") === true);
+
+ expect(container.querySelector('[data-slot="task-row"]')).toBeNull();
+ expect(container.querySelector('[data-testid="blocked-row-age"]')).not.toBeNull();
+ const row = container.querySelector("a")?.parentElement;
+ expect(row?.className).toContain("border-b");
+ expect(row?.textContent).toContain("PAP-41");
act(() => root.unmount());
});
diff --git a/ui/src/components/BlockedInboxView.tsx b/ui/src/components/BlockedInboxView.tsx
index 1880fe2e0c..c858655e1d 100644
--- a/ui/src/components/BlockedInboxView.tsx
+++ b/ui/src/components/BlockedInboxView.tsx
@@ -19,7 +19,7 @@ import {
} from "../lib/blockedInbox";
import { BlockedReasonChip } from "./BlockedReasonChip";
import { IssueGroupHeader } from "./IssueGroupHeader";
-import { IssueRow } from "./IssueRow";
+import { IssueRow, type IssueRowPresentation } from "./IssueRow";
import { Identity } from "./Identity";
import { StatusIcon } from "./StatusIcon";
import { Button } from "@/components/ui/button";
@@ -41,6 +41,7 @@ interface BlockedInboxViewProps {
showStatusColumn: boolean;
showIdentifierColumn: boolean;
showUpdatedColumn: boolean;
+ presentation?: IssueRowPresentation;
}
const BLOCKED_LIST_LIMIT = 200;
@@ -61,6 +62,7 @@ export function BlockedInboxView({
showStatusColumn,
showIdentifierColumn,
showUpdatedColumn,
+ presentation = "legacy",
}: BlockedInboxViewProps) {
const [collapsedVariants, setCollapsedVariants] = useState<Set<string>>(() => new Set());
@@ -124,7 +126,10 @@ export function BlockedInboxView({
{Array.from({ length: 2 }).map((__, rowIdx) => (
<div
key={rowIdx}
- className="flex items-center gap-3 border-b border-border/60 px-3 py-2.5 sm:px-4"
+ className={cn(
+ "flex items-center gap-3 px-3 py-2.5 sm:px-4",
+ presentation === "legacy" && "border-b border-border/60",
+ )}
>
<div className="h-3.5 w-3.5 animate-pulse rounded-full bg-muted" />
<div className="h-4 w-16 animate-pulse rounded bg-muted/70" />
@@ -219,6 +224,7 @@ export function BlockedInboxView({
showStatusColumn={showStatusColumn}
showIdentifierColumn={showIdentifierColumn}
showUpdatedColumn={showUpdatedColumn}
+ presentation={presentation}
/>
))
) : (
@@ -226,7 +232,7 @@ export function BlockedInboxView({
const isCollapsed = collapsedVariants.has(group.variant);
return (
<div key={group.variant} data-testid={`blocked-inbox-group-${group.variant}`}>
- <div className="px-3 sm:px-4">
+ <div className={presentation === "task" ? "rounded-lg px-3 sm:pl-0 sm:pr-4" : "px-3 sm:px-4"}>
<IssueGroupHeader
label={`${group.label} · ${group.rows.length}`}
collapsible
@@ -248,6 +254,7 @@ export function BlockedInboxView({
showStatusColumn={showStatusColumn}
showIdentifierColumn={showIdentifierColumn}
showUpdatedColumn={showUpdatedColumn}
+ presentation={presentation}
/>
))}
</div>
@@ -271,6 +278,7 @@ interface BlockedInboxRowProps {
showStatusColumn: boolean;
showIdentifierColumn: boolean;
showUpdatedColumn: boolean;
+ presentation: IssueRowPresentation;
}
function resolveOwnerName(
@@ -299,6 +307,7 @@ function BlockedInboxRow({
showStatusColumn,
showIdentifierColumn,
showUpdatedColumn,
+ presentation,
}: BlockedInboxRowProps) {
const { label: ownerName, isAgent } = resolveOwnerName(row, agentNameById, userLabelById);
const stoppedAge = formatStoppedAge(row.attention.stoppedSinceAt);
@@ -330,7 +339,7 @@ function BlockedInboxRow({
) : (
<span className="hidden w-(--sz-150px) shrink-0 sm:inline-flex" aria-hidden="true" />
)}
- {showUpdatedColumn ? (
+ {presentation === "legacy" && showUpdatedColumn ? (
<span className="hidden w-(--sz-5_75rem) text-right text-muted-foreground sm:inline" data-testid="blocked-row-age">
{stoppedAge}
</span>
@@ -359,15 +368,22 @@ function BlockedInboxRow({
<IssueRow
issue={row.issue}
issueLinkState={issueLinkState}
- showDivider
- desktopMetaLeading={
+ presentation={presentation}
+ showDivider={presentation === "legacy"}
+ statusSlot={presentation === "task"
+ ? showStatusColumn
+ ? <StatusIcon status={row.issue.status} blockerAttention={blockerAttention} />
+ : <span className="inline-flex size-4" aria-hidden="true" />
+ : undefined}
+ showIdentifier={presentation === "task" ? showIdentifierColumn : undefined}
+ desktopMetaLeading={presentation === "legacy" ? (
<BlockedRowDesktopMeta
row={row}
blockerAttention={blockerAttention}
showStatusColumn={showStatusColumn}
showIdentifierColumn={showIdentifierColumn}
/>
- }
+ ) : undefined}
mobileLeading={
<span className="flex shrink-0 items-center gap-1.5 pt-px">
<StatusIcon status={row.issue.status} blockerAttention={blockerAttention} />
@@ -382,6 +398,7 @@ function BlockedInboxRow({
}
mobileMeta={mobileMeta}
desktopTrailing={desktopTrailing}
+ trailingMeta={presentation === "task" && showUpdatedColumn ? stoppedAge : null}
/>
);
}
diff --git a/ui/src/components/IssueColumns.test.tsx b/ui/src/components/IssueColumns.test.tsx
index 55a2325432..d63f1ad8a9 100644
--- a/ui/src/components/IssueColumns.test.tsx
+++ b/ui/src/components/IssueColumns.test.tsx
@@ -2,9 +2,14 @@
import { createRoot } from "react-dom/client";
import { flushSync } from "react-dom";
-import { afterEach, describe, expect, it } from "vitest";
+import { afterEach, describe, expect, it, vi } from "vitest";
import type { Issue } from "@paperclipai/shared";
-import { InboxIssueMetaLeading, InboxIssueTrailingColumns } from "./IssueColumns";
+import {
+ InboxIssueMetaLeading,
+ InboxIssueTrailingColumns,
+ IssueColumnPicker,
+ issueColumnDescription,
+} from "./IssueColumns";
import { TooltipProvider } from "@/components/ui/tooltip";
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -42,7 +47,42 @@ function renderLeading(element: React.ReactElement): string {
return container.textContent ?? "";
}
+describe("IssueColumnPicker presentation options", () => {
+ it("offers date group separators as a toggle in the Columns menu", () => {
+ const onToggleDateGroupSeparators = vi.fn();
+ renderLeading(
+ <IssueColumnPicker
+ availableColumns={["status", "id", "updated"]}
+ visibleColumnSet={new Set(["status", "id", "updated"] as const)}
+ onToggleColumn={() => undefined}
+ showDateGroupSeparators
+ onToggleDateGroupSeparators={onToggleDateGroupSeparators}
+ onResetColumns={() => undefined}
+ title="Choose which task columns stay visible"
+ iconOnly
+ rowPresentation="task"
+ />,
+ );
+
+ const columnsButton = container?.querySelector<HTMLButtonElement>('button[title="Columns"]');
+ expect(columnsButton).not.toBeNull();
+ act(() => columnsButton?.dispatchEvent(new MouseEvent("pointerdown", { bubbles: true })));
+
+ const option = Array.from(document.body.querySelectorAll<HTMLElement>('[role="menuitemcheckbox"]'))
+ .find((item) => item.textContent?.includes("Date group separators"));
+ expect(option?.getAttribute("aria-checked")).toBe("true");
+
+ act(() => option?.dispatchEvent(new MouseEvent("click", { bubbles: true })));
+ expect(onToggleDateGroupSeparators).toHaveBeenCalledWith(false);
+ });
+});
+
describe("InboxIssueMetaLeading live state", () => {
+ it("describes the canonical identifier at the trailing edge", () => {
+ expect(issueColumnDescription("id", "task")).toContain("trailing edge");
+ expect(issueColumnDescription("id", "legacy")).not.toContain("trailing edge");
+ });
+
it("shows the own Live chip for a running issue and never the subtree chip", () => {
const text = renderLeading(
<InboxIssueMetaLeading
diff --git a/ui/src/components/IssueColumns.tsx b/ui/src/components/IssueColumns.tsx
index 5f1f328d3d..11d4b8fcf8 100644
--- a/ui/src/components/IssueColumns.tsx
+++ b/ui/src/components/IssueColumns.tsx
@@ -47,8 +47,25 @@ const issueColumnDescriptions: Record<InboxIssueColumn, string> = {
updated: "Latest visible activity time.",
};
+export function issueColumnDescription(
+ column: InboxIssueColumn,
+ presentation: "legacy" | "task" = "legacy",
+): string {
+ if (column === "id" && presentation === "task") {
+ return "Task identifier like PAP-1009 on the trailing edge.";
+ }
+ if (column === "status" && presentation === "task") {
+ return "Task state icon on the leading edge.";
+ }
+ return issueColumnDescriptions[column];
+}
+
+export function issueActivityTimestamp(issue: Issue): string {
+ return timeAgo(issue.lastActivityAt ?? issue.lastExternalCommentAt ?? issue.updatedAt);
+}
+
export function issueActivityText(issue: Issue): string {
- return `Updated ${timeAgo(issue.lastActivityAt ?? issue.lastExternalCommentAt ?? issue.updatedAt)}`;
+ return `Updated ${issueActivityTimestamp(issue)}`;
}
function issueTrailingGridTemplate(columns: InboxIssueColumn[]): string {
@@ -69,16 +86,22 @@ export function IssueColumnPicker({
availableColumns,
visibleColumnSet,
onToggleColumn,
+ showDateGroupSeparators,
+ onToggleDateGroupSeparators,
onResetColumns,
title,
iconOnly = false,
+ rowPresentation = "legacy",
}: {
availableColumns: InboxIssueColumn[];
visibleColumnSet: ReadonlySet<InboxIssueColumn>;
onToggleColumn: (column: InboxIssueColumn, enabled: boolean) => void;
+ showDateGroupSeparators?: boolean;
+ onToggleDateGroupSeparators?: (enabled: boolean) => void;
onResetColumns: () => void;
title: string;
iconOnly?: boolean;
+ rowPresentation?: "legacy" | "task";
}) {
return (
<DropdownMenu>
@@ -119,11 +142,28 @@ export function IssueColumnPicker({
{issueColumnLabels[column]}
</span>
<span className="text-xs leading-relaxed text-muted-foreground">
- {issueColumnDescriptions[column]}
+ {issueColumnDescription(column, rowPresentation)}
</span>
</span>
</DropdownMenuCheckboxItem>
))}
+ {showDateGroupSeparators !== undefined && onToggleDateGroupSeparators ? (
+ <DropdownMenuCheckboxItem
+ checked={showDateGroupSeparators}
+ onSelect={(event) => event.preventDefault()}
+ onCheckedChange={(checked) => onToggleDateGroupSeparators(checked === true)}
+ className="items-start rounded-lg px-3 py-2.5 pl-8"
+ >
+ <span className="flex flex-col gap-0.5">
+ <span className="text-sm font-medium text-foreground">
+ Date group separators
+ </span>
+ <span className="text-xs leading-relaxed text-muted-foreground">
+ Show Today, Yesterday, and Earlier rules on newest-first task lists.
+ </span>
+ </span>
+ </DropdownMenuCheckboxItem>
+ ) : null}
<DropdownMenuSeparator />
<DropdownMenuItem
onSelect={onResetColumns}
@@ -262,7 +302,7 @@ export function InboxIssueTrailingColumns({
assigneeContent?: ReactNode;
onFilterWorkspace?: (workspaceId: string) => void;
}) {
- const activityText = timeAgo(issue.lastActivityAt ?? issue.lastExternalCommentAt ?? issue.updatedAt);
+ const activityText = issueActivityTimestamp(issue);
const userLabel = assigneeUserName ?? formatAssigneeUserLabel(issue.assigneeUserId, currentUserId) ?? "User";
const originatingActor = deriveOriginatingActor(issue);
const originatingUserId = originatingActor?.kind === "user" ? originatingActor.id : null;
diff --git a/ui/src/components/IssueFiltersPopover.test.tsx b/ui/src/components/IssueFiltersPopover.test.tsx
index 718041bd66..69eb612fee 100644
--- a/ui/src/components/IssueFiltersPopover.test.tsx
+++ b/ui/src/components/IssueFiltersPopover.test.tsx
@@ -58,6 +58,7 @@ describe("IssueFiltersPopover", () => {
act(() => {
root.render(
<IssueFiltersPopover
+ presentation="streamlined"
state={defaultIssueFilterState}
onChange={vi.fn()}
activeFilterCount={0}
@@ -74,6 +75,7 @@ describe("IssueFiltersPopover", () => {
expect(popoverContent).not.toBeNull();
expect(popoverContent?.className).toContain("overflow-y-auto");
expect(popoverContent?.className).toContain("max-h-(--sz-calc-9)");
+ expect(popoverContent?.querySelectorAll(".overflow-y-auto").length).toBe(0);
const layoutGrid = Array.from(popoverContent?.querySelectorAll("div") ?? []).find((element) =>
element.className.includes("md:grid-cols-3"),
@@ -88,6 +90,7 @@ describe("IssueFiltersPopover", () => {
act(() => {
root.render(
<IssueFiltersPopover
+ presentation="streamlined"
state={defaultIssueFilterState}
onChange={vi.fn()}
activeFilterCount={0}
@@ -106,4 +109,124 @@ describe("IssueFiltersPopover", () => {
expect(popoverContent?.textContent).toContain("Status");
expect(popoverContent?.textContent).not.toContain("Priority");
});
+
+ it("searches long option lists while the popover remains the only scroll owner", () => {
+ const root = createRoot(container);
+ const agents = Array.from({ length: 7 }, (_, index) => ({
+ id: `agent-${index + 1}`,
+ name: `Agent ${index + 1}`,
+ }));
+
+ act(() => {
+ root.render(
+ <IssueFiltersPopover
+ presentation="streamlined"
+ state={defaultIssueFilterState}
+ onChange={vi.fn()}
+ activeFilterCount={0}
+ agents={agents}
+ enableExternalObjectFilters={false}
+ />,
+ );
+ });
+
+ const input = container.querySelector<HTMLInputElement>('input[aria-label="Search responsible"]');
+ expect(input).not.toBeNull();
+ act(() => {
+ const valueSetter = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set;
+ valueSetter?.call(input, "Agent 7");
+ input?.dispatchEvent(new Event("input", { bubbles: true }));
+ });
+
+ const responsibleOptions = container.querySelector('[data-filter-options="responsible"]');
+ expect(responsibleOptions?.textContent).toContain("Agent 7");
+ expect(responsibleOptions?.textContent).not.toContain("Agent 1");
+ expect(container.querySelector('[data-testid="popover-content"]')?.querySelectorAll(".overflow-y-auto").length).toBe(0);
+
+ act(() => root.unmount());
+ });
+
+ it("restores per-section scrolling and hides added option searches in legacy presentation", () => {
+ const root = createRoot(container);
+ const agents = Array.from({ length: 7 }, (_, index) => ({
+ id: `agent-${index + 1}`,
+ name: `Agent ${index + 1}`,
+ }));
+
+ act(() => {
+ root.render(
+ <IssueFiltersPopover
+ state={defaultIssueFilterState}
+ onChange={vi.fn()}
+ activeFilterCount={0}
+ agents={agents}
+ projects={Array.from({ length: 7 }, (_, index) => ({
+ id: `project-${index + 1}`,
+ name: `Project ${index + 1}`,
+ }))}
+ presentation="legacy"
+ enableExternalObjectFilters={false}
+ />,
+ );
+ });
+
+ const popoverContent = container.querySelector("[data-testid='popover-content']");
+ expect(popoverContent?.className).not.toContain("overflow-y-auto");
+ expect(container.querySelector('input[aria-label="Search responsible"]')).toBeNull();
+ expect(container.querySelector('[data-filter-options="responsible"]')?.className).toContain("overflow-y-auto");
+ expect(container.querySelector('[data-filter-options="projects"]')?.className).toContain("overflow-y-auto");
+
+ act(() => root.unmount());
+ });
+
+ it("integrates Inbox category and approval status into the filter menu", () => {
+ const root = createRoot(container);
+ const onChange = vi.fn();
+ const onCategoryChange = vi.fn();
+ const onApprovalStatusChange = vi.fn();
+ const onClear = vi.fn();
+
+ act(() => {
+ root.render(
+ <IssueFiltersPopover
+ presentation="streamlined"
+ state={defaultIssueFilterState}
+ onChange={onChange}
+ activeFilterCount={2}
+ enableExternalObjectFilters={false}
+ inboxScopeFilters={{
+ category: "approvals",
+ approvalStatus: "actionable",
+ showApprovalStatus: true,
+ onCategoryChange,
+ onApprovalStatusChange,
+ onClear,
+ }}
+ />,
+ );
+ });
+
+ const categoryOptions = container.querySelector('[data-filter-options="inbox-category"]');
+ const approvalOptions = container.querySelector('[data-filter-options="inbox-approval-status"]');
+ expect(categoryOptions?.textContent).toContain("All categories");
+ expect(categoryOptions?.querySelector('button[aria-pressed="true"]')?.textContent).toContain("Approvals");
+ expect(approvalOptions?.querySelector('button[aria-pressed="true"]')?.textContent).toContain("Needs action");
+
+ const allCategoriesButton = Array.from(categoryOptions?.querySelectorAll("button") ?? [])
+ .find((button) => button.textContent?.includes("All categories"));
+ const resolvedButton = Array.from(approvalOptions?.querySelectorAll("button") ?? [])
+ .find((button) => button.textContent?.includes("Resolved"));
+ act(() => allCategoriesButton?.click());
+ act(() => resolvedButton?.click());
+ expect(onCategoryChange).toHaveBeenCalledWith("everything");
+ expect(onApprovalStatusChange).toHaveBeenCalledWith("resolved");
+
+ const clearButton = Array.from(container.querySelectorAll("button"))
+ .find((button) => button.textContent?.trim() === "Clear");
+ act(() => clearButton?.click());
+ expect(onChange).toHaveBeenCalledWith(defaultIssueFilterState);
+ expect(onClear).toHaveBeenCalledTimes(1);
+
+ act(() => root.unmount());
+ });
});
diff --git a/ui/src/components/IssueFiltersPopover.tsx b/ui/src/components/IssueFiltersPopover.tsx
index d491c74c1e..05f717493e 100644
--- a/ui/src/components/IssueFiltersPopover.tsx
+++ b/ui/src/components/IssueFiltersPopover.tsx
@@ -4,7 +4,7 @@ import { Badge } from "@/components/ui/badge";
import { Checkbox } from "@/components/ui/checkbox";
import { Input } from "@/components/ui/input";
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
-import { Bot, Filter, HardDrive, Search, User, X } from "lucide-react";
+import { Bot, Check, Filter, HardDrive, Search, User, X } from "lucide-react";
import { PriorityIcon } from "./PriorityIcon";
import { SHOW_TASK_PRIORITY_UI } from "../lib/ui-flags";
import { StatusIcon } from "./StatusIcon";
@@ -17,12 +17,15 @@ import {
issuePriorityOrder,
issueQuickFilterPresets,
issueStatusOrder,
+ searchIssueFilterOptions,
toggleIssueFilterValue,
type IssueFilterState,
} from "../lib/issue-filters";
import { externalObjectIconForCategory } from "../lib/external-objects";
import { externalObjectStatusIcon } from "../lib/status-colors";
import { formatAssigneeUserLabel } from "../lib/assignees";
+import type { InboxApprovalFilter, InboxCategoryFilter } from "../lib/inbox";
+import { cn } from "../lib/utils";
type AgentOption = {
id: string;
@@ -52,6 +55,55 @@ type CreatorOption = {
searchText?: string;
};
+type InboxScopeFilters = {
+ category: InboxCategoryFilter;
+ approvalStatus: InboxApprovalFilter;
+ showApprovalStatus: boolean;
+ onCategoryChange: (value: InboxCategoryFilter) => void;
+ onApprovalStatusChange: (value: InboxApprovalFilter) => void;
+ onClear: () => void;
+};
+
+const INBOX_CATEGORY_OPTIONS: ReadonlyArray<[InboxCategoryFilter, string]> = [
+ ["everything", "All categories"],
+ ["issues_i_touched", "My recent tasks"],
+ ["join_requests", "Join requests"],
+ ["approvals", "Approvals"],
+ ["failed_runs", "Failed runs"],
+ ["alerts", "Alerts"],
+];
+
+const INBOX_APPROVAL_STATUS_OPTIONS: ReadonlyArray<[InboxApprovalFilter, string]> = [
+ ["all", "All approval statuses"],
+ ["actionable", "Needs action"],
+ ["resolved", "Resolved"],
+];
+
+const SEARCHABLE_FILTER_THRESHOLD = 6;
+
+function FilterOptionSearch({
+ value,
+ onChange,
+ label,
+}: {
+ value: string;
+ onChange: (value: string) => void;
+ label: string;
+}) {
+ return (
+ <div className="relative">
+ <Search className="pointer-events-none absolute left-2 top-1/2 h-3 w-3 -translate-y-1/2 text-muted-foreground" />
+ <Input
+ value={value}
+ onChange={(event) => onChange(event.target.value)}
+ placeholder={`Search ${label.toLowerCase()}...`}
+ aria-label={`Search ${label.toLowerCase()}`}
+ className="h-8 pl-7 text-xs"
+ />
+ </div>
+ );
+}
+
export function IssueFiltersPopover({
state,
onChange,
@@ -66,6 +118,8 @@ export function IssueFiltersPopover({
iconOnly = false,
workspaces,
creators,
+ presentation = "legacy",
+ inboxScopeFilters,
}: {
state: IssueFilterState;
onChange: (patch: Partial<IssueFilterState>) => void;
@@ -80,8 +134,31 @@ export function IssueFiltersPopover({
iconOnly?: boolean;
workspaces?: WorkspaceOption[];
creators?: CreatorOption[];
+ presentation?: "legacy" | "streamlined";
+ inboxScopeFilters?: InboxScopeFilters;
}) {
+ const streamlined = presentation === "streamlined";
const [creatorSearch, setCreatorSearch] = useState("");
+ const [assigneeSearch, setAssigneeSearch] = useState("");
+ const [projectSearch, setProjectSearch] = useState("");
+ const [labelSearch, setLabelSearch] = useState("");
+ const [workspaceSearch, setWorkspaceSearch] = useState("");
+ const visibleAgents = useMemo(
+ () => searchIssueFilterOptions(agents, assigneeSearch, (option) => option.name),
+ [agents, assigneeSearch],
+ );
+ const visibleProjects = useMemo(
+ () => searchIssueFilterOptions(projects, projectSearch, (option) => option.name),
+ [projects, projectSearch],
+ );
+ const visibleLabels = useMemo(
+ () => searchIssueFilterOptions(labels, labelSearch, (option) => option.name),
+ [labels, labelSearch],
+ );
+ const visibleWorkspaces = useMemo(
+ () => searchIssueFilterOptions(workspaces, workspaceSearch, (option) => option.name),
+ [workspaces, workspaceSearch],
+ );
const creatorOptions = creators ?? [];
const creatorOptionById = useMemo(
() => new Map(creatorOptions.map((option) => [option.id, option])),
@@ -111,6 +188,10 @@ export function IssueFiltersPopover({
}),
[creatorOptionById, currentUserId, state.creators],
);
+ const clearFilters = () => {
+ onChange(defaultIssueFilterState);
+ inboxScopeFilters?.onClear();
+ };
return (
<Popover>
@@ -125,7 +206,7 @@ export function IssueFiltersPopover({
className="ml-1 hidden h-3 w-3 sm:block"
onClick={(event) => {
event.stopPropagation();
- onChange(defaultIssueFilterState);
+ clearFilters();
}}
/>
) : null}
@@ -133,7 +214,9 @@ export function IssueFiltersPopover({
</PopoverTrigger>
<PopoverContent
align="end"
- className="w-(--sz-calc-10) max-h-(--sz-calc-9) overflow-y-auto overscroll-contain p-0"
+ className={streamlined
+ ? "w-(--sz-calc-10) max-h-(--sz-calc-9) overflow-y-auto overscroll-contain p-0"
+ : "w-(--sz-calc-10) p-0"}
>
<div className="space-y-3 p-3">
<div className="flex items-center justify-between">
@@ -142,13 +225,75 @@ export function IssueFiltersPopover({
<button
type="button"
className="text-xs text-muted-foreground hover:text-foreground"
- onClick={() => onChange(defaultIssueFilterState)}
+ onClick={clearFilters}
>
Clear
</button>
) : null}
</div>
+ {inboxScopeFilters ? (
+ <>
+ <div className="grid grid-cols-1 gap-4 sm:grid-cols-2">
+ <div className="space-y-1" data-filter-options="inbox-category">
+ <span className="text-xs text-muted-foreground">Category</span>
+ <div className="space-y-0.5">
+ {INBOX_CATEGORY_OPTIONS.map(([value, label]) => {
+ const selected = inboxScopeFilters.category === value;
+ return (
+ <button
+ key={value}
+ type="button"
+ aria-pressed={selected}
+ className={cn(
+ "flex w-full items-center justify-between rounded-sm px-2 py-1 text-left text-sm",
+ selected
+ ? "bg-accent/50 text-foreground"
+ : "text-muted-foreground hover:bg-accent/50 hover:text-foreground",
+ )}
+ onClick={() => inboxScopeFilters.onCategoryChange(value)}
+ >
+ <span>{label}</span>
+ {selected ? <Check className="h-3.5 w-3.5" /> : null}
+ </button>
+ );
+ })}
+ </div>
+ </div>
+
+ {inboxScopeFilters.showApprovalStatus ? (
+ <div className="space-y-1" data-filter-options="inbox-approval-status">
+ <span className="text-xs text-muted-foreground">Approval status</span>
+ <div className="space-y-0.5">
+ {INBOX_APPROVAL_STATUS_OPTIONS.map(([value, label]) => {
+ const selected = inboxScopeFilters.approvalStatus === value;
+ return (
+ <button
+ key={value}
+ type="button"
+ aria-pressed={selected}
+ className={cn(
+ "flex w-full items-center justify-between rounded-sm px-2 py-1 text-left text-sm",
+ selected
+ ? "bg-accent/50 text-foreground"
+ : "text-muted-foreground hover:bg-accent/50 hover:text-foreground",
+ )}
+ onClick={() => inboxScopeFilters.onApprovalStatusChange(value)}
+ >
+ <span>{label}</span>
+ {selected ? <Check className="h-3.5 w-3.5" /> : null}
+ </button>
+ );
+ })}
+ </div>
+ </div>
+ ) : null}
+ </div>
+
+ <div className="border-t border-border" />
+ </>
+ ) : null}
+
<div className="space-y-1.5">
<span className="text-xs text-muted-foreground">Quick filters</span>
<div className="flex flex-wrap gap-1.5">
@@ -215,7 +360,10 @@ export function IssueFiltersPopover({
<div className="min-w-0 space-y-3">
<div className="space-y-1">
<span className="text-xs text-muted-foreground">Responsible</span>
- <div className="max-h-32 space-y-0.5 overflow-y-auto">
+ {streamlined && (agents?.length ?? 0) + (currentUserId ? 2 : 1) > SEARCHABLE_FILTER_THRESHOLD ? (
+ <FilterOptionSearch value={assigneeSearch} onChange={setAssigneeSearch} label="Responsible" />
+ ) : null}
+ <div data-filter-options="responsible" className={streamlined ? "space-y-0.5" : "max-h-32 space-y-0.5 overflow-y-auto"}>
<label className="flex cursor-pointer items-center gap-2 rounded-sm px-2 py-1 hover:bg-accent/50">
<Checkbox
checked={state.assignees.includes("__unassigned")}
@@ -233,7 +381,7 @@ export function IssueFiltersPopover({
<span className="text-sm">Me</span>
</label>
) : null}
- {(agents ?? []).map((agent) => (
+ {(streamlined ? visibleAgents : agents ?? []).map((agent) => (
<label key={agent.id} className="flex cursor-pointer items-center gap-2 rounded-sm px-2 py-1 hover:bg-accent/50">
<Checkbox
checked={state.assignees.includes(agent.id)}
@@ -275,7 +423,7 @@ export function IssueFiltersPopover({
className="h-8 pl-7 text-xs"
/>
</div>
- <div className="max-h-32 space-y-0.5 overflow-y-auto">
+ <div data-filter-options="creators" className={streamlined ? "space-y-0.5" : "max-h-32 space-y-0.5 overflow-y-auto"}>
{visibleCreatorOptions.length > 0 ? visibleCreatorOptions.map((creator) => {
const selected = state.creators.includes(creator.id);
return (
@@ -302,8 +450,11 @@ export function IssueFiltersPopover({
{projects && projects.length > 0 ? (
<div className="space-y-1">
<span className="text-xs text-muted-foreground">Project</span>
- <div className="max-h-32 space-y-0.5 overflow-y-auto">
- {projects.map((project) => (
+ {streamlined && projects.length > SEARCHABLE_FILTER_THRESHOLD ? (
+ <FilterOptionSearch value={projectSearch} onChange={setProjectSearch} label="Projects" />
+ ) : null}
+ <div data-filter-options="projects" className={streamlined ? "space-y-0.5" : "max-h-32 space-y-0.5 overflow-y-auto"}>
+ {(streamlined ? visibleProjects : projects).map((project) => (
<label key={project.id} className="flex cursor-pointer items-center gap-2 rounded-sm px-2 py-1 hover:bg-accent/50">
<Checkbox
checked={state.projects.includes(project.id)}
@@ -321,8 +472,11 @@ export function IssueFiltersPopover({
{labels && labels.length > 0 ? (
<div className="space-y-1">
<span className="text-xs text-muted-foreground">Labels</span>
- <div className="max-h-32 space-y-0.5 overflow-y-auto">
- {labels.map((label) => (
+ {streamlined && labels.length > SEARCHABLE_FILTER_THRESHOLD ? (
+ <FilterOptionSearch value={labelSearch} onChange={setLabelSearch} label="Labels" />
+ ) : null}
+ <div data-filter-options="labels" className={streamlined ? "space-y-0.5" : "max-h-32 space-y-0.5 overflow-y-auto"}>
+ {(streamlined ? visibleLabels : labels).map((label) => (
<label key={label.id} className="flex cursor-pointer items-center gap-2 rounded-sm px-2 py-1 hover:bg-accent/50">
<Checkbox
checked={state.labels.includes(label.id)}
@@ -339,8 +493,11 @@ export function IssueFiltersPopover({
{workspaces && workspaces.length > 0 ? (
<div className="space-y-1">
<span className="text-xs text-muted-foreground">Workspace</span>
- <div className="max-h-32 space-y-0.5 overflow-y-auto">
- {workspaces.map((workspace) => (
+ {streamlined && workspaces.length > SEARCHABLE_FILTER_THRESHOLD ? (
+ <FilterOptionSearch value={workspaceSearch} onChange={setWorkspaceSearch} label="Workspaces" />
+ ) : null}
+ <div data-filter-options="workspaces" className={streamlined ? "space-y-0.5" : "max-h-32 space-y-0.5 overflow-y-auto"}>
+ {(streamlined ? visibleWorkspaces : workspaces).map((workspace) => (
<label key={workspace.id} className="flex cursor-pointer items-center gap-2 rounded-sm px-2 py-1 hover:bg-accent/50">
<Checkbox
checked={state.workspaces.includes(workspace.id)}
diff --git a/ui/src/components/IssueProperties.test.tsx b/ui/src/components/IssueProperties.test.tsx
index 700717c774..66e9327bb1 100644
--- a/ui/src/components/IssueProperties.test.tsx
+++ b/ui/src/components/IssueProperties.test.tsx
@@ -148,7 +148,14 @@ vi.mock("./AgentIconPicker", () => ({
}));
vi.mock("@/lib/router", () => ({
- Link: ({ children, to, ...props }: { children: ReactNode; to: string } & ComponentProps<"a">) => <a href={to} {...props}>{children}</a>,
+ Link: ({
+ children,
+ to,
+ state: _state,
+ disableIssueQuicklook: _disableIssueQuicklook,
+ issuePrefetch: _issuePrefetch,
+ ...props
+ }: { children: ReactNode; to: string; state?: unknown; disableIssueQuicklook?: boolean; issuePrefetch?: unknown } & ComponentProps<"a">) => <a href={to} {...props}>{children}</a>,
useCaseHref: () => (caseId: string) => `/cases/${caseId}`,
useLocation: () => ({ hash: "", pathname: "/", search: "", state: null, key: "test" }),
}));
@@ -497,6 +504,8 @@ describe("IssueProperties", () => {
],
});
mockInstanceSettingsApi.getExperimental.mockResolvedValue({
+ enableTaskWatchdogs: false,
+ enableStreamlinedUi: true,
});
});
@@ -504,6 +513,249 @@ describe("IssueProperties", () => {
document.body.innerHTML = "";
});
+ it("marks the task-detail property typography and section rhythm", () => {
+ const root = renderProperties(container, {
+ issue: createIssue(),
+ childIssues: [],
+ onUpdate: vi.fn(),
+ inline: true,
+ });
+
+ const surface = container.querySelector(".task-detail-properties");
+ expect(surface).not.toBeNull();
+ expect(surface?.classList).toContain("pl-4");
+ expect(surface?.querySelectorAll('[data-property-section="true"]').length).toBeGreaterThan(1);
+ expect(surface?.querySelector('[data-property-value="true"]')).not.toBeNull();
+ expect(surface?.querySelector('[data-property-section="true"] > div')?.classList)
+ .toContain("text-muted-foreground/70");
+ const projectLabel = surface?.querySelector('[data-property-label="Project"]');
+ const labelsLabel = surface?.querySelector('[data-property-label="Labels"]');
+ if (!projectLabel || !labelsLabel) throw new Error("Expected Project and Labels rows");
+ expect(projectLabel.compareDocumentPosition(labelsLabel) & Node.DOCUMENT_POSITION_FOLLOWING)
+ .toBeTruthy();
+
+ act(() => root.unmount());
+ });
+
+ it("stacks property chips vertically and aligns each label with the first chip", async () => {
+ const blockedBy = Array.from({ length: 3 }, (_, index) => ({
+ id: `blocker-${index + 1}`,
+ identifier: `BLOCK-${index + 1}`,
+ title: `Blocker ${index + 1}`,
+ status: "todo",
+ priority: "medium",
+ assigneeAgentId: null,
+ assigneeUserId: null,
+ })) as NonNullable<Issue["blockedBy"]>;
+ const blocks = Array.from({ length: 3 }, (_, index) => ({
+ id: `blocked-${index + 1}`,
+ identifier: `BLOCKED-${index + 1}`,
+ title: `Blocked task ${index + 1}`,
+ status: "todo",
+ priority: "medium",
+ assigneeAgentId: null,
+ assigneeUserId: null,
+ })) as NonNullable<Issue["blocks"]>;
+ const labels = Array.from({ length: 3 }, (_, index) => createLabel({
+ id: `label-${index + 1}`,
+ name: `Label ${index + 1}`,
+ }));
+ const childIssues = Array.from({ length: 3 }, (_, index) => createIssue({
+ id: `child-${index + 1}`,
+ identifier: `SUB-${index + 1}`,
+ title: `Subtask ${index + 1}`,
+ }));
+ const root = renderProperties(container, {
+ issue: createIssue({
+ blockedBy,
+ blocks,
+ labels,
+ labelIds: labels.map((label) => label.id),
+ }),
+ childIssues,
+ onUpdate: vi.fn(),
+ sidePanelContentOnly: true,
+ });
+ await flush();
+
+ for (const label of ["Labels", "Blocked by", "Blocking", "Subtasks"]) {
+ const labelNode = container.querySelector(`[data-property-label="${label}"]`);
+ const row = labelNode?.closest('[data-property-row="true"]');
+ const value = row?.querySelector('[data-property-value="true"]');
+ expect(row?.classList).toContain("items-start");
+ expect(labelNode?.classList).toContain("mt-0.5");
+ expect(value?.classList).toContain("flex-col");
+ expect(value?.classList).toContain("items-start");
+ }
+
+ for (const label of ["Labels", "Blocked by", "Subtasks"]) {
+ const trigger = findRowTrigger(container, label);
+ const chipStack = trigger?.querySelector("div");
+ expect(chipStack?.classList).toContain("flex-col");
+ expect(chipStack?.classList).toContain("items-start");
+ }
+
+ const blockingValue = container
+ .querySelector('[data-property-label="Blocking"]')
+ ?.closest('[data-property-row="true"]')
+ ?.querySelector('[data-property-value="true"] > div');
+ expect(blockingValue?.classList).toContain("flex-col");
+
+ act(() => root.unmount());
+ });
+
+ it("renders the lone Properties header as the active filled tab", async () => {
+ const headerSlot = document.createElement("div");
+ headerSlot.id = "properties-pane-header-slot";
+ document.body.appendChild(headerSlot);
+
+ const root = renderProperties(container, {
+ issue: createIssue(),
+ childIssues: [],
+ onUpdate: vi.fn(),
+ });
+ await flush();
+
+ const tab = headerSlot.querySelector<HTMLButtonElement>('[role="tab"]');
+ expect(tab?.textContent).toBe("Properties");
+ expect(tab?.getAttribute("aria-selected")).toBe("true");
+ expect(tab?.classList).toContain("bg-muted");
+ expect(tab?.classList).toContain("px-3");
+ expect(tab?.classList).toContain("inline-flex");
+
+ act(() => root.unmount());
+ });
+
+ it("uses the same filled active-tab treatment in a multi-tab pane header", async () => {
+ const headerSlot = document.createElement("div");
+ headerSlot.id = "properties-pane-header-slot";
+ document.body.appendChild(headerSlot);
+
+ const root = renderProperties(container, {
+ issue: createIssue(),
+ childIssues: [createIssue({ id: "child-1", identifier: "PAP-2", title: "Child task" })],
+ onUpdate: vi.fn(),
+ });
+ await flush();
+
+ const tabs = Array.from(headerSlot.querySelectorAll<HTMLButtonElement>('[role="tab"]'));
+ const propertiesTab = tabs.find((tab) => tab.textContent === "Properties");
+ const subtasksTab = tabs.find((tab) => tab.textContent?.includes("Subtasks"));
+ const tabItems = Array.from(headerSlot.querySelectorAll<HTMLElement>('[data-slot="task-detail-pane-tab"]'));
+ const tabDividers = Array.from(headerSlot.querySelectorAll<HTMLElement>('[data-slot="task-detail-pane-tab-divider"]'));
+ const subtasksLabel = subtasksTab?.querySelector<HTMLElement>('[title="Subtasks"]');
+ const subtasksCount = Array.from(subtasksTab?.querySelectorAll<HTMLElement>("span") ?? [])
+ .find((span) => span.textContent === "1");
+ const closeSubtasks = headerSlot.querySelector<HTMLButtonElement>('[aria-label="Close Subtasks tab"]');
+ const openClosedTab = headerSlot.querySelector<HTMLButtonElement>('[aria-label="Open closed sidebar tab"]');
+
+ expect(propertiesTab?.getAttribute("data-state")).toBe("active");
+ expect(subtasksTab?.getAttribute("data-state")).toBe("inactive");
+ expect(tabItems).toHaveLength(2);
+ expect(tabDividers).toHaveLength(1);
+ expect(tabDividers[0]?.classList).toContain("h-4");
+ expect(propertiesTab?.classList).toContain("mx-1.5");
+ expect(propertiesTab?.classList).toContain("px-3");
+ expect(subtasksTab?.classList).toContain("px-3");
+ expect(subtasksTab?.classList).toContain("hover:bg-accent/50");
+ expect(subtasksLabel?.classList).toContain("task-detail-pane-tab-label");
+ expect(subtasksLabel?.classList).toContain("flex-1");
+ expect(subtasksLabel?.classList).toContain("overflow-hidden");
+ expect(subtasksLabel?.classList).toContain("whitespace-nowrap");
+ expect(subtasksCount?.classList).toContain("group-hover/pane-tab:opacity-0");
+ expect(closeSubtasks?.classList).toContain("opacity-0");
+ expect(closeSubtasks?.classList).toContain("right-2.5");
+ expect(closeSubtasks?.classList).toContain("group-hover/pane-tab:opacity-100");
+ expect(openClosedTab?.classList).toContain("size-6");
+ expect(openClosedTab?.classList).not.toContain("ml-1");
+ expect(openClosedTab?.disabled).toBe(true);
+ for (const tab of tabs) {
+ expect(tab.classList).toContain("task-detail-pane-tab");
+ expect(tab.classList).toContain("h-7");
+ expect(tab.classList).toContain("rounded-md");
+ }
+
+ await act(async () => {
+ subtasksTab?.dispatchEvent(new MouseEvent("mousedown", { bubbles: true, button: 0 }));
+ });
+
+ expect(propertiesTab?.getAttribute("data-state")).toBe("inactive");
+ expect(subtasksTab?.getAttribute("data-state")).toBe("active");
+
+ await act(async () => closeSubtasks?.click());
+ expect(headerSlot.querySelector('[role="tab"][data-state="active"]')?.textContent).toBe("Properties");
+ expect(headerSlot.textContent).not.toContain("Subtasks");
+ expect(openClosedTab?.disabled).toBe(false);
+
+ await act(async () => {
+ openClosedTab?.dispatchEvent(new PointerEvent("pointerdown", { bubbles: true, button: 0 }));
+ openClosedTab?.dispatchEvent(new MouseEvent("click", { bubbles: true }));
+ });
+ await flush();
+ let reopenSubtasks: HTMLElement | undefined;
+ await waitForAssertion(() => {
+ reopenSubtasks = Array.from(document.body.querySelectorAll<HTMLElement>('[role="menuitem"]'))
+ .find((item) => item.textContent === "Subtasks");
+ expect(reopenSubtasks).not.toBeUndefined();
+ });
+
+ await act(async () => {
+ reopenSubtasks?.dispatchEvent(new PointerEvent("pointerdown", { bubbles: true, button: 0 }));
+ reopenSubtasks?.dispatchEvent(new MouseEvent("click", { bubbles: true }));
+ });
+ await flush();
+ expect(headerSlot.querySelector('[role="tab"][data-state="active"]')?.textContent).toContain("Subtasks");
+
+ act(() => root.unmount());
+ });
+
+ it("restores master's production property styling when Streamlined UI is off", async () => {
+ mockInstanceSettingsApi.getExperimental.mockResolvedValue({
+ enableTaskWatchdogs: false,
+ enableStreamlinedUi: false,
+ enableClassicTaskInterface: false,
+ });
+
+ const root = renderProperties(container, {
+ issue: createIssue(),
+ childIssues: [],
+ onUpdate: vi.fn(),
+ inline: true,
+ });
+ await waitForAssertion(() => {
+ expect(container.querySelector(".task-detail-properties")).toBeNull();
+ expect(container.querySelector('[role="tab"]')).toBeNull();
+ });
+ expect(container.textContent).toContain("Status");
+ expect(container.textContent).toContain("Triage");
+
+ act(() => root.unmount());
+ });
+
+ it("restores master's plain Properties pane header when Streamlined UI is off", async () => {
+ mockInstanceSettingsApi.getExperimental.mockResolvedValue({
+ enableTaskWatchdogs: false,
+ enableStreamlinedUi: false,
+ enableClassicTaskInterface: false,
+ });
+ const headerSlot = document.createElement("div");
+ headerSlot.id = "properties-pane-header-slot";
+ document.body.appendChild(headerSlot);
+
+ const root = renderProperties(container, {
+ issue: createIssue(),
+ childIssues: [],
+ onUpdate: vi.fn(),
+ });
+ await waitForAssertion(() => {
+ expect(headerSlot.textContent).toBe("Properties");
+ expect(headerSlot.querySelector('[role="tab"]')).toBeNull();
+ expect(container.querySelector(".task-detail-properties")).toBeNull();
+ });
+
+ act(() => root.unmount());
+ });
+
it("does not show a Plan tab for a planning-mode issue without a plan document", async () => {
mockInstanceSettingsApi.getExperimental.mockResolvedValue({
enableClassicTaskInterface: false,
@@ -852,9 +1104,7 @@ describe("IssueProperties", () => {
act(() => root.unmount());
});
- it("exposes the classic-layout add sub-issue pill action", async () => {
- // The chat shell hosts the full tree in the center pane; the slim pill row
- // + its Add sub-task button only render in the classic layout (PAP-496).
+ it("exposes the add-subtask action from the relationships picker", async () => {
mockInstanceSettingsApi.getExperimental.mockResolvedValue({
enableClassicTaskInterface: true,
});
@@ -865,16 +1115,14 @@ describe("IssueProperties", () => {
onAddSubIssue,
onUpdate: vi.fn(),
});
- // Wait for the classic-layout settings query to resolve (the pane starts in
- // the chat shell until it does).
await waitForAssertion(() => {
- expect(container.textContent).toContain("Add sub-task");
+ expect(container.textContent).toContain("Add subtask");
});
- expect(container.textContent).toContain("Sub-tasks");
+ expect(container.textContent).toContain("Subtasks");
const addButton = Array.from(container.querySelectorAll("button"))
- .find((button) => button.textContent?.includes("Add sub-task"));
+ .find((button) => button.textContent?.includes("Add subtask"));
expect(addButton).not.toBeUndefined();
await act(async () => {
@@ -886,16 +1134,31 @@ describe("IssueProperties", () => {
act(() => root.unmount());
});
- it("does not duplicate sub-tasks in the properties pane in the chat shell", async () => {
+ it("gives sub-tasks a dedicated chat-shell panel tab", async () => {
+ const onAddSubIssue = vi.fn();
const root = renderProperties(container, {
issue: createIssue(),
- childIssues: [],
+ childIssues: [createIssue({ id: "child-2", identifier: "PAP-2", title: "Panel child" })],
+ onAddSubIssue,
onUpdate: vi.fn(),
+ inline: true,
});
await flush();
- expect(container.textContent).not.toContain("Add sub-task");
- expect(container.textContent).not.toContain("Sub-tasks");
+ const subtasksTab = Array.from(container.querySelectorAll<HTMLButtonElement>('button[role="tab"]'))
+ .find((button) => button.textContent?.includes("Subtasks"));
+ expect(subtasksTab).not.toBeUndefined();
+ await act(async () => {
+ subtasksTab!.dispatchEvent(new MouseEvent("mousedown", { bubbles: true, button: 0 }));
+ });
+ expect(container.textContent).toContain("Panel child");
+ expect(container.textContent).toContain("0 of 1 complete");
+ expect(container.textContent).toContain("Next action");
+ expect(container.querySelector('[data-slot="task-row"]')).not.toBeNull();
+ const addButton = Array.from(container.querySelectorAll("button"))
+ .find((button) => button.textContent?.includes("Add subtask"));
+ await act(async () => addButton!.click());
+ expect(onAddSubIssue).toHaveBeenCalledOnce();
act(() => root.unmount());
});
@@ -943,7 +1206,7 @@ describe("IssueProperties", () => {
act(() => root.unmount());
});
- it("renders blocked-by issues as direct chips and edits them from an add action", async () => {
+ it("edits blockers from the blocked-by relationship flyout", async () => {
const onUpdate = vi.fn();
mockIssuesApi.list.mockResolvedValue([
createIssue({ id: "issue-3", identifier: "PAP-3", title: "New blocker", status: "todo" }),
@@ -969,24 +1232,13 @@ describe("IssueProperties", () => {
});
await flush();
- const blockerLink = container.querySelector('a[href="/issues/PAP-2"]');
- expect(blockerLink).not.toBeNull();
- expect(blockerLink?.textContent).toContain("PAP-2");
- expect(blockerLink?.closest("button")).toBeNull();
- expect(blockerLink?.className).toContain("px-2");
- expect(blockerLink?.className).toContain("py-0.5");
- expect(blockerLink?.className).toContain("text-xs");
- const removeButton = container.querySelector('button[aria-label="Remove PAP-2 as blocker"]');
- expect(removeButton?.className).toContain("absolute");
- expect(container.textContent).toContain("Add blocker");
+ const blockerTrigger = findRowTrigger(container, "Blocked by");
+ expect(blockerTrigger?.textContent).toContain("PAP-2");
+ expect(container.textContent).not.toContain("Add blocker");
expect(container.querySelector('input[placeholder="Search tasks..."]')).toBeNull();
- const addButton = Array.from(container.querySelectorAll("button"))
- .find((button) => button.textContent?.includes("Add blocker"));
- expect(addButton).not.toBeUndefined();
-
await act(async () => {
- addButton!.dispatchEvent(new MouseEvent("click", { bubbles: true }));
+ blockerTrigger!.dispatchEvent(new MouseEvent("click", { bubbles: true }));
});
await flush();
@@ -1022,12 +1274,11 @@ describe("IssueProperties", () => {
});
await flush();
- const addButton = Array.from(container.querySelectorAll("button"))
- .find((button) => button.textContent?.includes("Add blocker"));
- expect(addButton).not.toBeUndefined();
+ const blockerTrigger = findRowTrigger(container, "Blocked by");
+ expect(blockerTrigger).not.toBeUndefined();
await act(async () => {
- addButton!.dispatchEvent(new MouseEvent("click", { bubbles: true }));
+ blockerTrigger!.dispatchEvent(new MouseEvent("click", { bubbles: true }));
});
await flush();
@@ -1059,7 +1310,7 @@ describe("IssueProperties", () => {
act(() => root.unmount());
});
- it("removes a blocked-by issue from the chip remove action after confirmation", async () => {
+ it("removes a blocked-by issue by toggling it in the relationship flyout", async () => {
const onUpdate = vi.fn();
const root = renderProperties(container, {
issue: createIssue({
@@ -1090,21 +1341,20 @@ describe("IssueProperties", () => {
});
await flush();
- const removeButton = container.querySelector('button[aria-label="Remove PAP-2 as blocker"]');
- expect(removeButton).not.toBeNull();
+ const blockerTrigger = findRowTrigger(container, "Blocked by");
+ expect(blockerTrigger).not.toBeUndefined();
await act(async () => {
- removeButton!.dispatchEvent(new MouseEvent("click", { bubbles: true }));
+ blockerTrigger!.dispatchEvent(new MouseEvent("click", { bubbles: true }));
});
await flush();
- expect(document.body.textContent).toContain("Remove PAP-2: Existing blocker as a blocker for this task.");
- const confirmButton = Array.from(document.body.querySelectorAll("button"))
- .find((button) => button.textContent?.includes("Remove blocker"));
- expect(confirmButton).not.toBeUndefined();
+ const selectedBlocker = Array.from(container.querySelectorAll("button"))
+ .find((button) => button.textContent?.includes("PAP-2 Existing blocker"));
+ expect(selectedBlocker).not.toBeUndefined();
await act(async () => {
- confirmButton!.dispatchEvent(new MouseEvent("click", { bubbles: true }));
+ selectedBlocker!.dispatchEvent(new MouseEvent("click", { bubbles: true }));
});
expect(onUpdate).toHaveBeenCalledWith({ blockedByIssueIds: ["issue-4"] });
@@ -1112,7 +1362,7 @@ describe("IssueProperties", () => {
act(() => root.unmount());
});
- it("opens visit and remove actions when a blocked-by chip is tapped on mobile", async () => {
+ it("uses the same blocked-by relationship picker on mobile", async () => {
mockSidebarState.isMobile = true;
const onUpdate = vi.fn();
const root = renderProperties(container, {
@@ -1144,36 +1394,20 @@ describe("IssueProperties", () => {
});
await flush();
- expect(container.querySelector('a[href="/issues/PAP-2"]')).toBeNull();
- expect(container.querySelector('button[aria-label="Remove PAP-2 as blocker"]')).toBeNull();
- const blockerActions = container.querySelector('button[aria-label="Actions for blocker PAP-2"]');
- expect(blockerActions).not.toBeNull();
-
- await act(async () => {
- blockerActions!.dispatchEvent(new PointerEvent("pointerdown", { bubbles: true, button: 0 }));
- blockerActions!.dispatchEvent(new MouseEvent("click", { bubbles: true }));
- });
- await flush();
-
- const visitLink = Array.from(document.body.querySelectorAll('a[href="/issues/PAP-2"]'))
- .find((link) => link.textContent?.includes("Visit task"));
- expect(visitLink).not.toBeUndefined();
- const removeMenuItem = Array.from(document.body.querySelectorAll('[data-slot="dropdown-menu-item"]'))
- .find((item) => item.textContent?.includes("Remove blocker"));
- expect(removeMenuItem).not.toBeUndefined();
+ const blockerTrigger = findRowTrigger(container, "Blocked by");
+ expect(blockerTrigger?.textContent).toContain("PAP-2");
await act(async () => {
- removeMenuItem!.dispatchEvent(new MouseEvent("click", { bubbles: true }));
+ blockerTrigger!.dispatchEvent(new MouseEvent("click", { bubbles: true }));
});
await flush();
- expect(document.body.textContent).toContain("Remove PAP-2: Existing blocker as a blocker for this task.");
- const confirmButton = Array.from(document.body.querySelectorAll("button"))
- .find((button) => button.textContent?.includes("Remove blocker"));
- expect(confirmButton).not.toBeUndefined();
+ const selectedBlocker = Array.from(container.querySelectorAll("button"))
+ .find((button) => button.textContent?.includes("PAP-2 Existing blocker"));
+ expect(selectedBlocker).not.toBeUndefined();
await act(async () => {
- confirmButton!.dispatchEvent(new MouseEvent("click", { bubbles: true }));
+ selectedBlocker!.dispatchEvent(new MouseEvent("click", { bubbles: true }));
});
expect(onUpdate).toHaveBeenCalledWith({ blockedByIssueIds: ["issue-4"] });
@@ -1181,12 +1415,7 @@ describe("IssueProperties", () => {
act(() => root.unmount());
});
- it("collapses long blocked-by and sub-task lists until the more button is clicked", async () => {
- // The sub-task pill row (with its collapse control) is classic-layout only
- // now — the chat shell promotes sub-tasks to their own pane tab (PAP-496).
- mockInstanceSettingsApi.getExperimental.mockResolvedValue({
- enableClassicTaskInterface: true,
- });
+ it("summarizes long blocked-by and subtask relationships in their picker triggers", async () => {
const blockedBy = Array.from({ length: 7 }, (_, index) => ({
id: `blocker-${index + 1}`,
identifier: `BLOCK-${index + 1}`,
@@ -1207,71 +1436,46 @@ describe("IssueProperties", () => {
onUpdate: vi.fn(),
inline: true,
});
- // Wait for the classic-layout settings query to resolve so the sub-task
- // pill row renders (the pane starts in the chat shell until it does).
- await waitForAssertion(() => {
- expect(container.textContent).toContain("SUB-5");
- });
+ await flush();
- expect(container.textContent).toContain("BLOCK-5");
- expect(container.textContent).not.toContain("BLOCK-6");
- expect(container.textContent).not.toContain("SUB-6");
- expect(
- Array.from(container.querySelectorAll("button")).filter((button) =>
- button.textContent?.trim() === "Show 2 more",
- ),
- ).toHaveLength(2);
+ const blockedByTrigger = findRowTrigger(container, "Blocked by");
+ expect(blockedByTrigger?.textContent).toContain("BLOCK-1");
+ expect(blockedByTrigger?.textContent).toContain("BLOCK-2");
+ expect(blockedByTrigger?.textContent).toContain("+5 more");
+ expect(blockedByTrigger?.textContent).not.toContain("BLOCK-7");
+
+ const subtasksTrigger = findRowTrigger(container, "Subtasks");
+ expect(subtasksTrigger?.textContent).toContain("SUB-1");
+ expect(subtasksTrigger?.textContent).toContain("SUB-2");
+ expect(subtasksTrigger?.textContent).toContain("+5 more");
+ expect(subtasksTrigger?.textContent).not.toContain("SUB-7");
- const expandBlockedBy = Array.from(container.querySelectorAll("button")).find((button) =>
- button.textContent?.trim() === "Show 2 more",
- );
- expect(expandBlockedBy).not.toBeUndefined();
await act(async () => {
- expandBlockedBy!.dispatchEvent(new MouseEvent("click", { bubbles: true }));
+ blockedByTrigger!.dispatchEvent(new MouseEvent("click", { bubbles: true }));
});
+ await flush();
- expect(container.textContent).toContain("BLOCK-6");
expect(container.textContent).toContain("BLOCK-7");
- expect(container.textContent).not.toContain("SUB-6");
- expect(container.textContent).toContain("Show less");
- const expandSubTasks = Array.from(container.querySelectorAll("button")).find((button) =>
- button.textContent?.trim() === "Show 2 more",
- );
- expect(expandSubTasks).not.toBeUndefined();
await act(async () => {
- expandSubTasks!.dispatchEvent(new MouseEvent("click", { bubbles: true }));
+ blockedByTrigger!.dispatchEvent(new MouseEvent("click", { bubbles: true }));
});
-
- expect(container.textContent).toContain("SUB-6");
- expect(container.textContent).toContain("SUB-7");
- expect(
- Array.from(container.querySelectorAll("button")).filter((button) =>
- button.textContent?.trim() === "Show 2 more",
- ),
- ).toHaveLength(0);
- expect(
- Array.from(container.querySelectorAll("button")).filter((button) =>
- button.textContent?.trim() === "Show less",
- ),
- ).toHaveLength(2);
-
- const collapseBlockedBy = Array.from(container.querySelectorAll("button")).find((button) =>
- button.textContent?.trim() === "Show less",
- );
- expect(collapseBlockedBy).not.toBeUndefined();
+ await flush();
await act(async () => {
- collapseBlockedBy!.dispatchEvent(new MouseEvent("click", { bubbles: true }));
+ subtasksTrigger!.dispatchEvent(new MouseEvent("click", { bubbles: true }));
});
+ await flush();
- expect(container.textContent).not.toContain("BLOCK-6");
- expect(container.textContent).toContain("SUB-6");
- expect(container.textContent).toContain("Show 2 more");
+ expect(container.textContent).toContain("SUB-7");
act(() => root.unmount());
});
it("collapses long blocking and related task lists until the more button is clicked", async () => {
+ mockInstanceSettingsApi.getExperimental.mockResolvedValue({
+ enableTaskWatchdogs: false,
+ enableClassicTaskInterface: true,
+ });
const blocking = Array.from({ length: 7 }, (_, index) => ({
id: `blocking-${index + 1}`,
identifier: `BLOCKING-${index + 1}`,
@@ -1308,9 +1512,11 @@ describe("IssueProperties", () => {
});
await flush();
+ await waitForAssertion(() => {
+ expect(container.textContent).toContain("RELATED-5");
+ });
expect(container.textContent).toContain("BLOCKING-5");
expect(container.textContent).not.toContain("BLOCKING-6");
- expect(container.textContent).toContain("RELATED-5");
expect(container.textContent).not.toContain("RELATED-6");
expect(
Array.from(container.querySelectorAll("button")).filter((button) =>
@@ -1395,7 +1601,7 @@ describe("IssueProperties", () => {
act(() => root.unmount());
});
- it("resets expanded relation previews when the issue changes", async () => {
+ it("updates the blocked-by relationship summary when the issue changes", async () => {
const blockedBy = Array.from({ length: 7 }, (_, index) => ({
id: `blocker-${index + 1}`,
identifier: `BLOCK-${index + 1}`,
@@ -1426,21 +1632,24 @@ describe("IssueProperties", () => {
});
await flush();
- const expandBlockedBy = Array.from(container.querySelectorAll("button")).find((button) =>
- button.textContent?.trim() === "Show 2 more",
- );
- expect(expandBlockedBy).not.toBeUndefined();
- await act(async () => {
- expandBlockedBy!.dispatchEvent(new MouseEvent("click", { bubbles: true }));
- });
+ expect(findRowTrigger(container, "Blocked by")?.textContent).toContain("BLOCK-1");
+ expect(findRowTrigger(container, "Blocked by")?.textContent).toContain("+5 more");
- expect(container.textContent).toContain("BLOCK-6");
+ const nextBlockedBy = [{
+ id: "next-blocker",
+ identifier: "NEXT-1",
+ title: "Next blocker",
+ status: "todo" as const,
+ priority: "medium" as const,
+ assigneeAgentId: null,
+ assigneeUserId: null,
+ }];
act(() => {
root.render(
<QueryClientProvider client={queryClient}>
<IssueProperties
- issue={createIssue({ id: "issue-b", blockedBy })}
+ issue={createIssue({ id: "issue-b", blockedBy: nextBlockedBy })}
childIssues={[]}
onUpdate={vi.fn()}
inline
@@ -1450,8 +1659,9 @@ describe("IssueProperties", () => {
});
await flush();
- expect(container.textContent).not.toContain("BLOCK-6");
- expect(container.textContent).toContain("Show 2 more");
+ expect(findRowTrigger(container, "Blocked by")?.textContent).toContain("NEXT-1");
+ expect(findRowTrigger(container, "Blocked by")?.textContent).not.toContain("BLOCK-1");
+ expect(findRowTrigger(container, "Blocked by")?.textContent).not.toContain("more");
act(() => root.unmount());
});
@@ -1481,6 +1691,33 @@ describe("IssueProperties", () => {
act(() => root.unmount());
});
+ it("uses the configured project color and icon in the project property", async () => {
+ mockProjectsApi.list.mockResolvedValue([
+ createProject({
+ name: "Configured Project",
+ color: "#0ea5e9",
+ icon: "rocket",
+ }),
+ ]);
+
+ const root = renderProperties(container, {
+ issue: createIssue({ projectId: "project-1" }),
+ childIssues: [],
+ onUpdate: vi.fn(),
+ sidePanelContentOnly: true,
+ });
+ await waitForAssertion(() => {
+ expect(findRowTrigger(container, "Project")?.textContent).toContain("Configured Project");
+ });
+
+ const projectTrigger = findRowTrigger(container, "Project");
+ const projectTile = projectTrigger?.querySelector<HTMLElement>('span.inline-flex[aria-hidden="true"]');
+ expect(projectTile?.style.backgroundColor).toBe("rgb(14, 165, 233)");
+ expect(projectTile?.querySelector("svg")?.classList).toContain("lucide-rocket");
+
+ act(() => root.unmount());
+ });
+
it("shows a green service link above the workspace row for a live non-main workspace", async () => {
mockProjectsApi.list.mockResolvedValue([createProject()]);
const serviceUrl = "http://127.0.0.1:62475";
@@ -1560,6 +1797,15 @@ describe("IssueProperties", () => {
expect(container.textContent).toMatch(/StartedApr 6, 2026, \d{1,2}:35 (AM|PM)/);
expect(container.textContent).toMatch(/CompletedApr 6, 2026, \d{1,2}:36 (AM|PM)/);
+ for (const label of ["Started", "Completed", "Created"]) {
+ const labelNode = container.querySelector(`[data-property-label="${label}"]`);
+ const value = labelNode?.parentElement?.querySelector<HTMLElement>('[data-property-value="true"] > span');
+ expect(value?.classList).toContain("min-w-0");
+ expect(value?.classList).toContain("truncate");
+ expect(value?.classList).toContain("whitespace-nowrap");
+ expect(value?.title).toBe(value?.textContent);
+ }
+
act(() => root.unmount());
});
@@ -1608,11 +1854,18 @@ describe("IssueProperties", () => {
onUpdate: vi.fn(),
});
await flush();
+ await flush();
const branchCopyButton = container.querySelector<HTMLButtonElement>(
'button[aria-label="Copy pap-1-workspace to clipboard"]',
);
+ const folderCopyButton = container.querySelector<HTMLButtonElement>(
+ 'button[aria-label="Copy /tmp/paperclip/PAP-1 to clipboard"]',
+ );
expect(branchCopyButton).not.toBeNull();
+ expect(folderCopyButton?.querySelector('[data-middle-truncate="true"]')?.textContent)
+ .toBe("/tmp/paperclip/PAP-1");
+ expect(folderCopyButton?.title).toBe("/tmp/paperclip/PAP-1");
await act(async () => {
branchCopyButton!.dispatchEvent(new MouseEvent("click", { bubbles: true }));
@@ -1653,7 +1906,7 @@ describe("IssueProperties", () => {
act(() => root.unmount());
});
- it("shows related task references below sub-issues", async () => {
+ it("separates referenced tasks from tasks that mention this task", async () => {
const root = renderProperties(container, {
issue: createIssue({
relatedWork: {
@@ -1672,22 +1925,49 @@ describe("IssueProperties", () => {
sources: [{ kind: "description", sourceRecordId: null, label: "description", matchedText: "PAP-22" }],
},
],
- inbound: [],
+ inbound: [
+ {
+ issue: {
+ id: "issue-23",
+ identifier: "PAP-23",
+ title: "Mentions this task",
+ status: "in_progress",
+ priority: "medium",
+ assigneeAgentId: null,
+ assigneeUserId: null,
+ },
+ mentionCount: 1,
+ sources: [{ kind: "description", sourceRecordId: null, label: "description", matchedText: "PAP-1" }],
+ },
+ ],
},
}),
childIssues: [],
onUpdate: vi.fn(),
+ inline: true,
});
await flush();
expect(container.textContent).not.toContain("Task ids");
- expect(container.textContent).toContain("Related tasks");
+ expect(container.textContent).not.toContain("Related tasks");
+ const referencesTab = Array.from(container.querySelectorAll<HTMLButtonElement>('button[role="tab"]'))
+ .find((button) => button.textContent === "References");
+ await act(async () => {
+ referencesTab!.dispatchEvent(new MouseEvent("mousedown", { bubbles: true, button: 0 }));
+ });
+ expect(container.textContent).toContain("Referenced");
expect(container.textContent).toContain("PAP-22");
+ expect(container.textContent).toContain("Mentioned in");
+ expect(container.textContent).toContain("PAP-23");
act(() => root.unmount());
});
it("hides related task references already covered by blockers, blocking, and sub-issues", async () => {
+ mockInstanceSettingsApi.getExperimental.mockResolvedValue({
+ enableTaskWatchdogs: false,
+ enableClassicTaskInterface: true,
+ });
const root = renderProperties(container, {
issue: createIssue({
blockedBy: [
@@ -1768,12 +2048,14 @@ describe("IssueProperties", () => {
});
await flush();
- expect(container.textContent).not.toContain("Related tasks");
+ await waitForAssertion(() => {
+ expect(container.textContent).not.toContain("Referenced");
+ });
act(() => root.unmount());
});
- it("shows an add-label button when labels already exist and opens the picker", async () => {
+ it("opens the label picker from its relationship value without a redundant add button", async () => {
const root = renderProperties(container, {
issue: createIssue({
labels: [{ id: "label-1", companyId: "company-1", name: "Bug", color: "#ef4444", createdAt: new Date("2026-04-06T12:00:00.000Z"), updatedAt: new Date("2026-04-06T12:00:00.000Z") }],
@@ -1785,12 +2067,17 @@ describe("IssueProperties", () => {
});
await flush();
- const addLabelButton = container.querySelector('button[aria-label="Add label"]');
- expect(addLabelButton).not.toBeNull();
+ expect(container.querySelector('button[aria-label="Add label"]')).toBeNull();
expect(container.querySelector('input[placeholder="Search labels..."]')).toBeNull();
+ const labelsTrigger = findRowTrigger(container, "Labels");
+ expect(labelsTrigger?.textContent).toContain("Bug");
+ const labelChip = labelsTrigger?.querySelector<HTMLElement>('[title="Bug"]');
+ expect(labelChip?.classList).toContain("border-0");
+ expect(labelChip?.style.borderColor).toBe("");
+ expect(labelChip?.style.color).not.toBe("");
await act(async () => {
- addLabelButton!.dispatchEvent(new MouseEvent("click", { bubbles: true }));
+ labelsTrigger!.dispatchEvent(new MouseEvent("click", { bubbles: true }));
});
await flush();
@@ -1978,10 +2265,10 @@ describe("IssueProperties", () => {
});
await flush();
- const addLabelButton = container.querySelector('button[aria-label="Add label"]');
- expect(addLabelButton).not.toBeNull();
+ const labelsTrigger = findRowTrigger(container, "Labels");
+ expect(labelsTrigger?.textContent).toContain("Bug");
await act(async () => {
- addLabelButton!.dispatchEvent(new MouseEvent("click", { bubbles: true }));
+ labelsTrigger!.dispatchEvent(new MouseEvent("click", { bubbles: true }));
});
await flush();
diff --git a/ui/src/components/IssuesList.test.tsx b/ui/src/components/IssuesList.test.tsx
index 00b9cc7a19..72cdcf23ec 100644
--- a/ui/src/components/IssuesList.test.tsx
+++ b/ui/src/components/IssuesList.test.tsx
@@ -13,6 +13,7 @@ import {
issueAgeSeparatorLabel,
} from "./IssuesList";
import { TooltipProvider } from "@/components/ui/tooltip";
+import { taskCollectionPreferencesStorageKey } from "../lib/task-collection-preferences";
const companyState = vi.hoisted(() => ({
selectedCompanyId: "company-1",
@@ -28,6 +29,7 @@ const mockIssuesApi = vi.hoisted(() => ({
}));
const mockKanbanBoard = vi.hoisted(() => vi.fn());
+const mockNavigate = vi.hoisted(() => vi.fn());
const mockAuthApi = vi.hoisted(() => ({
getSession: vi.fn(),
@@ -61,7 +63,7 @@ vi.mock("../context/DialogContext", () => ({
}));
vi.mock("@/lib/router", () => ({
- useNavigate: () => vi.fn(),
+ useNavigate: () => mockNavigate,
Link: ({
children,
to,
@@ -130,6 +132,11 @@ vi.mock("./IssueRow", () => ({
checklistDependencyChips,
checklistRowId,
externalObjectSummary,
+ presentation,
+ leadingControl,
+ treeGuides,
+ showIdentifier,
+ trailingMeta,
}: {
issue: Issue;
desktopMetaLeading?: ReactNode;
@@ -140,20 +147,32 @@ vi.mock("./IssueRow", () => ({
checklistDependencyChips?: ReactNode;
checklistRowId?: string;
externalObjectSummary?: { total: number } | null;
+ presentation?: "legacy" | "task";
+ leadingControl?: ReactNode;
+ treeGuides?: number;
+ showIdentifier?: boolean;
+ trailingMeta?: ReactNode;
}) => (
<div
data-testid="issue-row"
+ data-presentation={presentation}
+ data-tree-guides={treeGuides ?? 0}
+ data-show-identifier={showIdentifier ? "true" : "false"}
+ data-trailing-meta={typeof trailingMeta === "string" ? trailingMeta : undefined}
+ data-has-desktop-trailing={desktopTrailing ? "true" : "false"}
id={checklistRowId}
data-step={checklistStepNumber ?? undefined}
data-current-step={checklistCurrentStep ? "true" : undefined}
data-title-class={titleClassName ?? undefined}
>
<span>{issue.title}</span>
+ {leadingControl}
{externalObjectSummary ? (
<span data-testid="external-object-summary">{externalObjectSummary.total}</span>
) : null}
{desktopMetaLeading}
{desktopTrailing}
+ {trailingMeta}
{checklistDependencyChips}
</div>
),
@@ -324,6 +343,7 @@ describe("IssuesList", () => {
document.body.appendChild(container);
dialogState.openNewIssue.mockReset();
mockKanbanBoard.mockReset();
+ mockNavigate.mockReset();
mockIssuesApi.list.mockReset();
mockIssuesApi.listLabels.mockReset();
mockAuthApi.getSession.mockReset();
@@ -343,6 +363,7 @@ describe("IssuesList", () => {
mockInstanceSettingsApi.getExperimental.mockResolvedValue({
enableIsolatedWorkspaces: false,
enableExternalObjects: false,
+ enableStreamlinedUi: true,
});
setDocumentScrollMetrics({ innerHeight: 600, scrollY: 0, scrollHeight: 2400 });
mockExternalObjectsApi.getIssueSummaries.mockResolvedValue({ summaries: {} });
@@ -354,6 +375,50 @@ describe("IssuesList", () => {
container.remove();
});
+ it("uses the master list and legacy persistence when Streamlined UI is off", async () => {
+ mockInstanceSettingsApi.getExperimental.mockResolvedValue({
+ enableIsolatedWorkspaces: false,
+ enableExternalObjects: false,
+ enableStreamlinedUi: false,
+ });
+ localStorage.setItem(
+ taskCollectionPreferencesStorageKey({
+ companyId: "company-1",
+ collectionKey: "paperclip:test-issues",
+ }),
+ JSON.stringify({
+ version: 1,
+ companyId: "company-1",
+ collectionKey: "paperclip:test-issues",
+ viewState: { viewMode: "board" },
+ columns: [],
+ }),
+ );
+
+ const { root } = renderWithQueryClient(
+ <IssuesList
+ issues={[createIssue({ id: "legacy-issue", title: "Master task row" })]}
+ isLoading={false}
+ agents={[]}
+ projects={[]}
+ viewStateKey="paperclip:test-issues"
+ rowPresentation="task"
+ toolbarPresentation="collection"
+ onUpdateIssue={() => undefined}
+ />,
+ container,
+ );
+
+ await waitForAssertion(() => {
+ const row = container.querySelector("[data-testid='issue-row']");
+ expect(row).not.toBeNull();
+ expect(row?.getAttribute("data-presentation")).toBeNull();
+ expect(container.querySelector("[data-testid='kanban-board']")).toBeNull();
+ });
+
+ act(() => root.unmount());
+ });
+
it("forwards external-object summaries into issue rows", async () => {
mockInstanceSettingsApi.getExperimental.mockResolvedValue({
enableIsolatedWorkspaces: false,
@@ -380,6 +445,7 @@ describe("IssuesList", () => {
agents={[]}
projects={[]}
viewStateKey="paperclip:test-issues"
+ rowPresentation="task"
onUpdateIssue={() => undefined}
/>,
container,
@@ -395,6 +461,80 @@ describe("IssuesList", () => {
});
});
+ it("keeps the canonical task-row presentation opt in per collection", async () => {
+ const { root } = renderWithQueryClient(
+ <IssuesList
+ issues={[createIssue()]}
+ agents={[]}
+ projects={[]}
+ viewStateKey="paperclip:test-issues"
+ rowPresentation="task"
+ onUpdateIssue={() => undefined}
+ />,
+ container,
+ );
+
+ await waitForAssertion(() => {
+ const row = container.querySelector("[data-testid='issue-row']");
+ expect(row?.getAttribute("data-presentation")).toBe("task");
+ expect(row?.getAttribute("data-show-identifier")).toBe("true");
+ expect(row?.getAttribute("data-trailing-meta")).toMatch(/\S/);
+ expect(row?.getAttribute("data-trailing-meta")).not.toContain("Updated");
+ expect(row?.getAttribute("data-has-desktop-trailing")).toBe("false");
+ expect(row?.querySelector('[data-slot="task-row-disclosure-spacer"]')).not.toBeNull();
+ });
+
+ act(() => root.unmount());
+ });
+
+ it("reserves a disclosure column after each ancestor guide in canonical task trees", async () => {
+ const parent = createIssue({ id: "parent", identifier: "PAP-1", title: "Parent task" });
+ const child = createIssue({ id: "child", identifier: "PAP-2", parentId: parent.id, title: "Child task" });
+ const { root } = renderWithQueryClient(
+ <IssuesList
+ issues={[parent, child]}
+ agents={[]}
+ projects={[]}
+ viewStateKey="paperclip:test-issues"
+ rowPresentation="task"
+ onUpdateIssue={() => undefined}
+ />,
+ container,
+ );
+
+ await waitForAssertion(() => {
+ const rows = Array.from(container.querySelectorAll('[data-testid="issue-row"]'));
+ const parentRow = rows.find((row) => row.textContent?.includes("Parent task"));
+ const childRow = rows.find((row) => row.textContent?.includes("Child task"));
+ expect(parentRow?.getAttribute("data-tree-guides")).toBe("0");
+ expect(parentRow?.querySelector('button[aria-label="Collapse sub-tasks"]')).not.toBeNull();
+ expect(childRow?.getAttribute("data-tree-guides")).toBe("1");
+ expect(childRow?.querySelector('[data-slot="task-row-disclosure-spacer"]')).not.toBeNull();
+ });
+
+ act(() => root.unmount());
+ });
+
+ it("keeps the shared collection toolbar opt in per surface", async () => {
+ const { root } = renderWithQueryClient(
+ <IssuesList
+ issues={[createIssue()]}
+ agents={[]}
+ projects={[]}
+ viewStateKey="paperclip:test-issues"
+ toolbarPresentation="collection"
+ onUpdateIssue={() => undefined}
+ />,
+ container,
+ );
+
+ await waitForAssertion(() => {
+ expect(container.querySelector("[role='toolbar'][aria-label='Task controls']")).not.toBeNull();
+ });
+
+ act(() => root.unmount());
+ });
+
it("does not load external-object summaries when the experimental flag is disabled", async () => {
const { root } = renderWithQueryClient(
<IssuesList
@@ -402,6 +542,7 @@ describe("IssuesList", () => {
agents={[]}
projects={[]}
viewStateKey="paperclip:test-issues"
+ rowPresentation="task"
onUpdateIssue={() => undefined}
/>,
container,
@@ -458,6 +599,7 @@ describe("IssuesList", () => {
agents={[]}
projects={[]}
viewStateKey="paperclip:test-issues"
+ rowPresentation="task"
onUpdateIssue={() => undefined}
/>,
container,
@@ -780,6 +922,7 @@ describe("IssuesList", () => {
agents={[]}
projects={[]}
viewStateKey="paperclip:test-issues"
+ rowPresentation="task"
onUpdateIssue={() => undefined}
/>,
container,
@@ -2013,11 +2156,11 @@ describe("IssuesList", () => {
});
});
- it("draws day and week separators between recency-sorted rows", async () => {
- const now = Date.now();
- const hourAgo = new Date(now - 60 * 60 * 1000);
- const threeDaysAgo = new Date(now - 3 * 24 * 60 * 60 * 1000);
- const tenDaysAgo = new Date(now - 10 * 24 * 60 * 60 * 1000);
+ it("draws local-calendar separators between date-sorted rows", async () => {
+ const now = new Date();
+ const hourAgo = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 12);
+ const threeDaysAgo = new Date(now.getFullYear(), now.getMonth(), now.getDate() - 3, 12);
+ const tenDaysAgo = new Date(now.getFullYear(), now.getMonth(), now.getDate() - 10, 12);
const { root } = renderWithQueryClient(
<IssuesList
@@ -2029,6 +2172,7 @@ describe("IssuesList", () => {
agents={[]}
projects={[]}
viewStateKey="paperclip:test-issues"
+ rowPresentation="task"
onUpdateIssue={() => undefined}
/>,
container,
@@ -2037,7 +2181,57 @@ describe("IssuesList", () => {
await waitForAssertion(() => {
const separators = Array.from(container.querySelectorAll("[data-issues-date-separator]"));
const labels = separators.map((el) => el.getAttribute("aria-label"));
- expect(labels).toEqual(["Older than a day", "Older than a week"]);
+ expect(labels).toEqual(["Today", "Earlier"]);
+ expect(separators.every((separator) => (
+ separator.querySelectorAll("[data-date-group-rule]").length === 2
+ ))).toBe(true);
+ expect(separators.every((separator) => (
+ separator.querySelector("[data-date-group-label]")?.classList.contains("text-muted-foreground/70")
+ ))).toBe(true);
+ });
+
+ act(() => {
+ root.unmount();
+ });
+ });
+
+ it("can hide date group separators from the persisted Columns option", async () => {
+ const collectionKey = "paperclip:test-issues";
+ localStorage.setItem(
+ taskCollectionPreferencesStorageKey({
+ companyId: "company-1",
+ collectionKey,
+ }),
+ JSON.stringify({
+ version: 1,
+ companyId: "company-1",
+ collectionKey,
+ viewState: { showDateGroupSeparators: false },
+ columns: ["status", "id", "updated"],
+ }),
+ );
+ const now = new Date();
+ const today = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 12);
+ const threeDaysAgo = new Date(now.getFullYear(), now.getMonth(), now.getDate() - 3, 12);
+
+ const { root } = renderWithQueryClient(
+ <IssuesList
+ issues={[
+ createIssue({ id: "issue-recent", title: "Just updated", updatedAt: today }),
+ createIssue({ id: "issue-old", title: "Earlier task", updatedAt: threeDaysAgo }),
+ ]}
+ agents={[]}
+ projects={[]}
+ viewStateKey={collectionKey}
+ rowPresentation="task"
+ onUpdateIssue={() => undefined}
+ />,
+ container,
+ );
+
+ await waitForAssertion(() => {
+ expect(container.textContent).toContain("Earlier task");
+ expect(container.querySelector("[data-issues-date-separator]")).toBeNull();
});
act(() => {
@@ -2045,18 +2239,21 @@ describe("IssuesList", () => {
});
});
- it("draws both separators when adjacent rows skip the middle age bucket", async () => {
- const now = Date.now();
+ it("does not synthesize an empty Yesterday group", async () => {
+ const now = new Date();
+ const today = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 12);
+ const tenDaysAgo = new Date(now.getFullYear(), now.getMonth(), now.getDate() - 10, 12);
const { root } = renderWithQueryClient(
<IssuesList
issues={[
- createIssue({ id: "issue-recent", identifier: "PAP-1", title: "Just updated", updatedAt: new Date(now - 60 * 60 * 1000) }),
- createIssue({ id: "issue-old", identifier: "PAP-2", title: "Over a week old", updatedAt: new Date(now - 10 * 24 * 60 * 60 * 1000) }),
+ createIssue({ id: "issue-recent", identifier: "PAP-1", title: "Just updated", updatedAt: today }),
+ createIssue({ id: "issue-old", identifier: "PAP-2", title: "Over a week old", updatedAt: tenDaysAgo }),
]}
agents={[]}
projects={[]}
viewStateKey="paperclip:test-issues"
+ rowPresentation="task"
onUpdateIssue={() => undefined}
/>,
container,
@@ -2065,7 +2262,7 @@ describe("IssuesList", () => {
await waitForAssertion(() => {
const labels = Array.from(container.querySelectorAll("[data-issues-date-separator]"))
.map((el) => el.getAttribute("aria-label"));
- expect(labels).toEqual(["Older than a day", "Older than a week"]);
+ expect(labels).toEqual(["Today", "Earlier"]);
});
act(() => {
@@ -2074,18 +2271,22 @@ describe("IssuesList", () => {
});
it("places separators around expanded nested rows in visible order", async () => {
- const now = Date.now();
+ const now = new Date();
+ const today = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 12);
+ const threeDaysAgo = new Date(now.getFullYear(), now.getMonth(), now.getDate() - 3, 12);
+ const tenDaysAgo = new Date(now.getFullYear(), now.getMonth(), now.getDate() - 10, 12);
const { root } = renderWithQueryClient(
<IssuesList
issues={[
- createIssue({ id: "issue-parent", identifier: "PAP-1", title: "Recent parent", updatedAt: new Date(now - 60 * 60 * 1000) }),
- createIssue({ id: "issue-child", identifier: "PAP-2", parentId: "issue-parent", title: "Older child", updatedAt: new Date(now - 3 * 24 * 60 * 60 * 1000) }),
- createIssue({ id: "issue-old", identifier: "PAP-3", title: "Old root", updatedAt: new Date(now - 10 * 24 * 60 * 60 * 1000) }),
+ createIssue({ id: "issue-parent", identifier: "PAP-1", title: "Recent parent", updatedAt: today }),
+ createIssue({ id: "issue-child", identifier: "PAP-2", parentId: "issue-parent", title: "Older child", updatedAt: threeDaysAgo }),
+ createIssue({ id: "issue-old", identifier: "PAP-3", title: "Old root", updatedAt: tenDaysAgo }),
]}
agents={[]}
projects={[]}
viewStateKey="paperclip:test-issues"
+ rowPresentation="task"
onUpdateIssue={() => undefined}
/>,
container,
@@ -2096,10 +2297,10 @@ describe("IssuesList", () => {
container.querySelectorAll("[data-testid='issue-row'], [data-issues-date-separator]"),
).map((element) => element.getAttribute("aria-label") ?? element.firstElementChild?.textContent);
expect(visibleOrder).toEqual([
+ "Today",
"Recent parent",
- "Older than a day",
+ "Earlier",
"Older child",
- "Older than a week",
"Old root",
]);
});
@@ -2109,18 +2310,21 @@ describe("IssuesList", () => {
});
});
- it("omits date separators when all rows share a recency bucket", async () => {
- const now = Date.now();
+ it("emits one Today heading when all rows share today's calendar group", async () => {
+ const now = new Date();
+ const todayMorning = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 9);
+ const todayNoon = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 12);
const { root } = renderWithQueryClient(
<IssuesList
issues={[
- createIssue({ id: "issue-a", identifier: "PAP-1", title: "One", updatedAt: new Date(now - 60 * 60 * 1000) }),
- createIssue({ id: "issue-b", identifier: "PAP-2", title: "Two", updatedAt: new Date(now - 2 * 60 * 60 * 1000) }),
+ createIssue({ id: "issue-a", identifier: "PAP-1", title: "One", updatedAt: todayNoon }),
+ createIssue({ id: "issue-b", identifier: "PAP-2", title: "Two", updatedAt: todayMorning }),
]}
agents={[]}
projects={[]}
viewStateKey="paperclip:test-issues"
+ rowPresentation="task"
onUpdateIssue={() => undefined}
/>,
container,
@@ -2129,7 +2333,8 @@ describe("IssuesList", () => {
await waitForAssertion(() => {
expect(container.querySelector("[data-testid='issue-row']")).not.toBeNull();
});
- expect(container.querySelectorAll("[data-issues-date-separator]").length).toBe(0);
+ expect(Array.from(container.querySelectorAll("[data-issues-date-separator]"))
+ .map((element) => element.getAttribute("aria-label"))).toEqual(["Today"]);
act(() => {
root.unmount();
@@ -2137,24 +2342,15 @@ describe("IssuesList", () => {
});
});
-describe("issueAgeBucket", () => {
+describe("legacy issue age separators", () => {
const now = new Date("2026-04-10T12:00:00.000Z").getTime();
- it("buckets by day and week boundaries", () => {
+ it("retains the rolling day and week boundaries used by the legacy list", () => {
expect(issueAgeBucket(new Date(now - 60 * 60 * 1000), now)).toBe(0);
expect(issueAgeBucket(new Date(now - 3 * 24 * 60 * 60 * 1000), now)).toBe(1);
expect(issueAgeBucket(new Date(now - 10 * 24 * 60 * 60 * 1000), now)).toBe(2);
- });
-
- it("labels the day and week separators", () => {
expect(issueAgeSeparatorLabel(1)).toBe("Older than a day");
expect(issueAgeSeparatorLabel(2)).toBe("Older than a week");
- });
-
- it("returns every boundary crossed between adjacent rows", () => {
- expect(issueAgeBucketsCrossed(0, 1)).toEqual([1]);
- expect(issueAgeBucketsCrossed(1, 2)).toEqual([2]);
expect(issueAgeBucketsCrossed(0, 2)).toEqual([1, 2]);
- expect(issueAgeBucketsCrossed(2, 1)).toEqual([]);
});
});
diff --git a/ui/src/components/IssuesList.tsx b/ui/src/components/IssuesList.tsx
index d463691c55..378fd79948 100644
--- a/ui/src/components/IssuesList.tsx
+++ b/ui/src/components/IssuesList.tsx
@@ -53,6 +53,7 @@ import {
InboxIssueTrailingColumns,
IssueColumnPicker,
issueActivityText,
+ issueActivityTimestamp,
issueTrailingColumns,
} from "./IssueColumns";
import { StatusIcon } from "./StatusIcon";
@@ -60,7 +61,10 @@ import { EmptyState } from "./EmptyState";
import { Identity } from "./Identity";
import { IssueGroupHeader } from "./IssueGroupHeader";
import { IssueFiltersPopover } from "./IssueFiltersPopover";
-import { IssueRow } from "./IssueRow";
+import { IssueRow, type IssueRowPresentation } from "./IssueRow";
+import { CollectionToolbar, type CollectionToolbarProps } from "./CollectionToolbar";
+import { IssuesList as LegacyIssuesList } from "./LegacyIssuesList";
+import { useStreamlinedUiEnabled } from "../hooks/useStreamlinedUiEnabled";
import { PageSkeleton } from "./PageSkeleton";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
@@ -85,6 +89,12 @@ import { buildSubIssueDefaultsForViewer } from "../lib/subIssueDefaults";
import { statusBadge } from "../lib/status-colors";
import { workflowSort } from "../lib/workflow-sort";
import { isSuccessfulRunHandoffRequired } from "../lib/successful-run-handoff";
+import {
+ loadTaskCollectionPreferences,
+ saveTaskCollectionPreferences,
+ type TaskCollectionPreferenceLocation,
+} from "../lib/task-collection-preferences";
+import { taskDateGroup, taskDateGroupSeparator, type TaskDateGroup } from "../lib/task-date-groups";
import { deriveOriginatingActor, ISSUE_STATUSES, type Issue, type IssueStatus, type Project } from "@paperclipai/shared";
import { Badge } from "@/components/ui/badge";
const ISSUE_SEARCH_DEBOUNCE_MS = 250;
@@ -154,6 +164,7 @@ export type IssueViewState = IssueFilterState & {
groupBy: "status" | "priority" | "assignee" | "project" | "workspace" | "parent" | "none";
viewMode: "list" | "board";
nestingEnabled: boolean;
+ showDateGroupSeparators: boolean;
collapsedGroups: string[];
collapsedParents: string[];
boardCardDensity: BoardCardDensity;
@@ -168,6 +179,7 @@ const defaultViewState: IssueViewState = {
groupBy: "none",
viewMode: "list",
nestingEnabled: true,
+ showDateGroupSeparators: true,
collapsedGroups: [],
collapsedParents: [],
boardCardDensity: "auto",
@@ -189,38 +201,42 @@ function normalizeBoardColumnPageSize(value: unknown): BoardColumnPageSize {
: KANBAN_COLUMN_DEFAULT_PAGE_SIZE;
}
-function getViewState(key: string): IssueViewState {
- try {
- const raw = localStorage.getItem(key);
- if (raw) {
- const parsed = JSON.parse(raw);
- return {
- ...defaultViewState,
- ...parsed,
- ...normalizeIssueFilterState(parsed),
- boardCardDensity: normalizeBoardCardDensity(parsed.boardCardDensity),
- boardColdLaneMode: normalizeBoardColdLaneMode(parsed.boardColdLaneMode),
- boardColumnPageSize: normalizeBoardColumnPageSize(parsed.boardColumnPageSize),
- };
- }
- } catch { /* ignore */ }
- return { ...defaultViewState };
-}
-
-function saveViewState(key: string, state: IssueViewState) {
- localStorage.setItem(key, JSON.stringify(state));
+function normalizeIssueViewState(value: unknown): IssueViewState {
+ const parsed = value && typeof value === "object" ? value as Partial<IssueViewState> : {};
+ return {
+ ...defaultViewState,
+ ...parsed,
+ ...normalizeIssueFilterState(parsed),
+ sortField: ["status", "priority", "title", "created", "updated", "workflow"].includes(parsed.sortField ?? "")
+ ? parsed.sortField as IssueSortField
+ : defaultViewState.sortField,
+ sortDir: parsed.sortDir === "asc" ? "asc" : "desc",
+ groupBy: ["status", "priority", "assignee", "project", "workspace", "parent", "none"].includes(parsed.groupBy ?? "")
+ ? parsed.groupBy as IssueViewState["groupBy"]
+ : defaultViewState.groupBy,
+ viewMode: parsed.viewMode === "board" ? "board" : "list",
+ nestingEnabled: parsed.nestingEnabled !== false,
+ showDateGroupSeparators: parsed.showDateGroupSeparators !== false,
+ collapsedGroups: Array.isArray(parsed.collapsedGroups)
+ ? parsed.collapsedGroups.filter((entry): entry is string => typeof entry === "string")
+ : [],
+ collapsedParents: Array.isArray(parsed.collapsedParents)
+ ? parsed.collapsedParents.filter((entry): entry is string => typeof entry === "string")
+ : [],
+ boardCardDensity: normalizeBoardCardDensity(parsed.boardCardDensity),
+ boardColdLaneMode: normalizeBoardColdLaneMode(parsed.boardColdLaneMode),
+ boardColumnPageSize: normalizeBoardColumnPageSize(parsed.boardColumnPageSize),
+ };
}
function getInitialViewState(
- key: string,
+ stored: { viewState: IssueViewState; source: "current" | "legacy" | "default" },
initialAssignees?: string[],
defaultSortField?: IssueSortField,
): IssueViewState {
- const hasStored = hasStoredViewState(key);
- const stored = getViewState(key);
- const base = !hasStored && defaultSortField
- ? { ...stored, sortField: defaultSortField, sortDir: "asc" as const }
- : stored;
+ const base = stored.source === "default" && defaultSortField
+ ? { ...stored.viewState, sortField: defaultSortField, sortDir: "asc" as const }
+ : stored.viewState;
if (!initialAssignees) return base;
return {
...base,
@@ -230,53 +246,34 @@ function getInitialViewState(
}
function getInitialWorkspaceViewState(
- key: string,
+ stored: { viewState: IssueViewState; source: "current" | "legacy" | "default" },
initialAssignees?: string[],
initialWorkspaces?: string[],
defaultSortField?: IssueSortField,
): IssueViewState {
- const stored = getInitialViewState(key, initialAssignees, defaultSortField);
- if (!initialWorkspaces) return stored;
+ const initial = getInitialViewState(stored, initialAssignees, defaultSortField);
+ if (!initialWorkspaces) return initial;
return {
- ...stored,
+ ...initial,
workspaces: initialWorkspaces,
statuses: [],
};
}
-function hasStoredViewState(key: string): boolean {
- try {
- return localStorage.getItem(key) !== null;
- } catch {
- return false;
- }
-}
-
function getIssueColumnsStorageKey(key: string): string {
return `${key}:issue-columns`;
}
-function loadIssueColumns(key: string): InboxIssueColumn[] {
- try {
- const raw = localStorage.getItem(getIssueColumnsStorageKey(key));
- if (raw === null) return DEFAULT_INBOX_ISSUE_COLUMNS;
- const parsed = JSON.parse(raw);
- if (!Array.isArray(parsed)) return DEFAULT_INBOX_ISSUE_COLUMNS;
- return normalizeInboxIssueColumns(parsed);
- } catch {
- return DEFAULT_INBOX_ISSUE_COLUMNS;
- }
-}
-
-function saveIssueColumns(key: string, columns: InboxIssueColumn[]) {
- try {
- localStorage.setItem(
- getIssueColumnsStorageKey(key),
- JSON.stringify(normalizeInboxIssueColumns(columns)),
- );
- } catch {
- // Ignore localStorage failures.
- }
+function loadIssueCollectionPreferences(
+ location: TaskCollectionPreferenceLocation,
+) {
+ return loadTaskCollectionPreferences<IssueViewState, InboxIssueColumn>({
+ ...location,
+ defaultViewState: defaultViewState,
+ defaultColumns: DEFAULT_INBOX_ISSUE_COLUMNS,
+ normalizeViewState: normalizeIssueViewState,
+ normalizeColumns: (value) => normalizeInboxIssueColumns(Array.isArray(value) ? value : []),
+ });
}
function sortIssues(issues: Issue[], state: IssueViewState): Issue[] {
@@ -305,13 +302,18 @@ function sortIssues(issues: Issue[], state: IssueViewState): Issue[] {
return sorted;
}
+// Only recency sorts (newest first) get date separators — for any other
+// sort/direction the boundaries would be meaningless.
+function issueDateSeparatorField(state: IssueViewState): "createdAt" | "updatedAt" | null {
+ if (state.sortDir !== "desc") return null;
+ if (state.sortField === "created") return "createdAt";
+ if (state.sortField === "updated") return "updatedAt";
+ return null;
+}
+
const AGE_BUCKET_DAY_MS = 24 * 60 * 60 * 1000;
const AGE_BUCKET_WEEK_MS = 7 * AGE_BUCKET_DAY_MS;
-// Recency buckets for the date separators shown in date-sorted lists:
-// 0 = within the last day, 1 = within the last week, 2 = older than a week.
-// A separator is drawn between rows whenever the bucket increases, so the
-// "1 day" and "1 week" boundaries appear as the list ages downward.
export function issueAgeBucket(date: Date | string, now: number = Date.now()): 0 | 1 | 2 {
const age = now - new Date(date).getTime();
if (age < AGE_BUCKET_DAY_MS) return 0;
@@ -333,28 +335,22 @@ export function issueAgeBucketsCrossed(
return crossedBuckets;
}
-// Only recency sorts (newest first) get date separators — for any other
-// sort/direction the boundaries would be meaningless.
-function issueDateSeparatorField(state: IssueViewState): "createdAt" | "updatedAt" | null {
- if (state.sortDir !== "desc") return null;
- if (state.sortField === "created") return "createdAt";
- if (state.sortField === "updated") return "updatedAt";
- return null;
-}
-
function IssueDateSeparator({ label }: { label: string }) {
return (
<div
- className="flex items-center gap-2 px-3 py-1.5 sm:pl-0 sm:pr-4"
+ className="flex items-center gap-3 px-3 py-1.5 sm:pl-0 sm:pr-4"
role="separator"
aria-label={label}
data-issues-date-separator=""
>
- <div className="h-px flex-1 bg-border" />
- <span className="text-(length:--text-nano) font-medium uppercase tracking-wider text-muted-foreground">
+ <span className="h-px min-w-0 flex-1 bg-border/80" aria-hidden="true" data-date-group-rule="" />
+ <span
+ className="shrink-0 text-(length:--text-nano) font-medium uppercase tracking-wider text-muted-foreground/70"
+ data-date-group-label=""
+ >
{label}
</span>
- <div className="h-px flex-1 bg-border" />
+ <span className="h-px min-w-0 flex-1 bg-border/80" aria-hidden="true" data-date-group-rule="" />
</div>
);
}
@@ -495,9 +491,27 @@ interface IssuesListProps {
issueBadgeById?: Map<string, string>;
onLoadMoreIssues?: () => void;
onSearchChange?: (search: string) => void;
+ /** Opt in per surface while the canonical task row rolls out across collections. */
+ rowPresentation?: IssueRowPresentation;
+ /** Opt in per surface while the shared collection toolbar rolls out. */
+ toolbarPresentation?: "legacy" | "collection";
onUpdateIssue: (id: string, data: Record<string, unknown>) => void;
}
+function LegacyIssuesToolbar({ context, search, controls }: CollectionToolbarProps) {
+ return (
+ <div className="flex items-center justify-between gap-2 sm:gap-3">
+ <div className="flex min-w-0 items-center gap-2 sm:gap-3">
+ {context}
+ {search}
+ </div>
+ <div className="flex shrink-0 items-center gap-0.5 sm:gap-1">
+ {controls}
+ </div>
+ </div>
+ );
+}
+
function IssueSearchInput({
value,
onDebouncedChange,
@@ -679,7 +693,12 @@ function SubIssueProgressSummaryStrip({
// Mobile-only indent for nested task rows (desktop uses IssueRow treeGuides).
const MOBILE_TREE_INDENT = ["", "pl-4 sm:pl-0", "pl-8 sm:pl-0", "pl-12 sm:pl-0", "pl-16 sm:pl-0"];
-export function IssuesList({
+export function IssuesList(props: IssuesListProps) {
+ const { enabled: streamlinedUiEnabled } = useStreamlinedUiEnabled();
+ return streamlinedUiEnabled ? <StreamlinedIssuesList {...props} /> : <LegacyIssuesList {...props} />;
+}
+
+function StreamlinedIssuesList({
issues,
isLoading,
error,
@@ -706,6 +725,8 @@ export function IssuesList({
issueBadgeById,
onLoadMoreIssues,
onSearchChange,
+ rowPresentation = "legacy",
+ toolbarPresentation = "legacy",
onUpdateIssue,
}: IssuesListProps) {
const rootRef = useRef<HTMLDivElement | null>(null);
@@ -760,17 +781,28 @@ export function IssuesList({
// Scope the storage key per company so folding/view state is independent across companies.
const scopedKey = selectedCompanyId ? `${viewStateKey}:${selectedCompanyId}` : viewStateKey;
+ const preferenceLocation: TaskCollectionPreferenceLocation = {
+ companyId: selectedCompanyId ?? "__unscoped__",
+ collectionKey: viewStateKey,
+ legacyViewStorageKey: scopedKey,
+ legacyColumnsStorageKey: getIssueColumnsStorageKey(scopedKey),
+ };
const initialAssigneesKey = initialAssignees?.join("|") ?? "";
const initialWorkspacesKey = initialWorkspaces?.join("|") ?? "";
+ const initialPreferencesRef = useRef<ReturnType<typeof loadIssueCollectionPreferences> | null>(null);
+ if (initialPreferencesRef.current === null) {
+ initialPreferencesRef.current = loadIssueCollectionPreferences(preferenceLocation);
+ }
+ const initialPreferences = initialPreferencesRef.current;
const [viewState, setViewState] = useState<IssueViewState>(() =>
- getInitialWorkspaceViewState(scopedKey, initialAssignees, initialWorkspaces, defaultSortField),
+ getInitialWorkspaceViewState(initialPreferences, initialAssignees, initialWorkspaces, defaultSortField),
);
const [assigneePickerIssueId, setAssigneePickerIssueId] = useState<string | null>(null);
const [assigneeSearch, setAssigneeSearch] = useState("");
const [issueSearch, setIssueSearch] = useState(initialSearch ?? "");
const [renderedIssueRowLimit, setRenderedIssueRowLimit] = useState(INITIAL_ISSUE_ROW_RENDER_LIMIT);
- const [visibleIssueColumns, setVisibleIssueColumns] = useState<InboxIssueColumn[]>(() => loadIssueColumns(scopedKey));
+ const [visibleIssueColumns, setVisibleIssueColumns] = useState<InboxIssueColumn[]>(initialPreferences.columns);
const renderedIssueIdsRef = useRef("");
const initialServerFillRequestedRef = useRef(false);
const deferredIssueSearch = useDeferredValue(issueSearch);
@@ -786,25 +818,39 @@ export function IssuesList({
const nextContextKey = `${scopedKey}::${initialAssigneesKey}::${initialWorkspacesKey}`;
if (prevViewStateContextKey.current !== nextContextKey) {
prevViewStateContextKey.current = nextContextKey;
- setViewState(getInitialWorkspaceViewState(scopedKey, initialAssignees, initialWorkspaces, defaultSortField));
+ const preferences = loadIssueCollectionPreferences(preferenceLocation);
+ setViewState(getInitialWorkspaceViewState(preferences, initialAssignees, initialWorkspaces, defaultSortField));
+ setVisibleIssueColumns(preferences.columns);
}
- }, [scopedKey, initialAssignees, initialAssigneesKey, initialWorkspaces, initialWorkspacesKey, defaultSortField]);
-
- const prevColumnsScopedKey = useRef(scopedKey);
- useEffect(() => {
- if (prevColumnsScopedKey.current !== scopedKey) {
- prevColumnsScopedKey.current = scopedKey;
- setVisibleIssueColumns(loadIssueColumns(scopedKey));
- }
- }, [scopedKey]);
+ }, [
+ scopedKey,
+ initialAssignees,
+ initialAssigneesKey,
+ initialWorkspaces,
+ initialWorkspacesKey,
+ defaultSortField,
+ preferenceLocation.companyId,
+ preferenceLocation.collectionKey,
+ preferenceLocation.legacyViewStorageKey,
+ preferenceLocation.legacyColumnsStorageKey,
+ ]);
const updateView = useCallback((patch: Partial<IssueViewState>) => {
setViewState((prev) => {
const next = { ...prev, ...patch };
- saveViewState(scopedKey, next);
+ saveTaskCollectionPreferences(preferenceLocation, {
+ viewState: next,
+ columns: visibleIssueColumns,
+ });
return next;
});
- }, [scopedKey]);
+ }, [
+ preferenceLocation.companyId,
+ preferenceLocation.collectionKey,
+ preferenceLocation.legacyColumnsStorageKey,
+ preferenceLocation.legacyViewStorageKey,
+ visibleIssueColumns,
+ ]);
useEffect(() => {
if (!experimentalSettingsLoaded || externalObjectsEnabled || viewState.externalObjectStatuses.length === 0) return;
@@ -1047,8 +1093,12 @@ export function IssuesList({
[issues, liveIssueIds],
);
const visibleTrailingIssueColumns = useMemo(
- () => issueTrailingColumns.filter((column) => visibleIssueColumnSet.has(column) && availableIssueColumnSet.has(column)),
- [availableIssueColumnSet, visibleIssueColumnSet],
+ () => issueTrailingColumns.filter((column) =>
+ visibleIssueColumnSet.has(column)
+ && availableIssueColumnSet.has(column)
+ && (rowPresentation === "legacy" || column !== "updated"),
+ ),
+ [availableIssueColumnSet, rowPresentation, visibleIssueColumnSet],
);
const issueById = useMemo(() => {
@@ -1635,8 +1685,17 @@ export function IssuesList({
const setIssueColumns = useCallback((next: InboxIssueColumn[]) => {
const normalized = normalizeInboxIssueColumns(next);
setVisibleIssueColumns(normalized);
- saveIssueColumns(scopedKey, normalized);
- }, [scopedKey]);
+ saveTaskCollectionPreferences(preferenceLocation, {
+ viewState,
+ columns: normalized,
+ });
+ }, [
+ preferenceLocation.companyId,
+ preferenceLocation.collectionKey,
+ preferenceLocation.legacyColumnsStorageKey,
+ preferenceLocation.legacyViewStorageKey,
+ viewState,
+ ]);
const toggleIssueColumn = useCallback((column: InboxIssueColumn, enabled: boolean) => {
if (enabled) {
@@ -1653,6 +1712,7 @@ export function IssuesList({
}, [onUpdateIssue]);
let remainingRowsToRender = viewState.viewMode === "list" ? renderedIssueRowLimit : Number.POSITIVE_INFINITY;
+ const IssuesToolbar = toolbarPresentation === "collection" ? CollectionToolbar : LegacyIssuesToolbar;
return (
<div ref={rootRef} className="space-y-4">
@@ -1665,12 +1725,15 @@ export function IssuesList({
) : null}
{/* Toolbar */}
- <div className="flex items-center justify-between gap-2 sm:gap-3">
- <div className="flex min-w-0 items-center gap-2 sm:gap-3">
+ <IssuesToolbar
+ ariaLabel={toolbarPresentation === "collection" ? "Task controls" : undefined}
+ context={(
<Button size="sm" variant="outline" onClick={() => openCreateIssueDialog()}>
<Plus className="h-4 w-4 sm:mr-1" />
<span className="hidden sm:inline">{createButtonLabel}</span>
</Button>
+ )}
+ search={(
<IssueSearchInput
value={issueSearch}
onDebouncedChange={(nextSearch) => {
@@ -1678,9 +1741,9 @@ export function IssuesList({
onSearchChange?.(nextSearch);
}}
/>
- </div>
-
- <div className="flex items-center gap-0.5 sm:gap-1 shrink-0">
+ )}
+ controls={(
+ <>
{/* View mode toggle */}
<div className="flex items-center border border-border rounded-md overflow-hidden mr-1" role="group" aria-label="View mode">
<button
@@ -1797,9 +1860,12 @@ export function IssuesList({
availableColumns={availableIssueColumns}
visibleColumnSet={visibleIssueColumnSet}
onToggleColumn={toggleIssueColumn}
+ showDateGroupSeparators={viewState.showDateGroupSeparators}
+ onToggleDateGroupSeparators={(enabled) => updateView({ showDateGroupSeparators: enabled })}
onResetColumns={() => setIssueColumns(DEFAULT_INBOX_ISSUE_COLUMNS)}
title="Choose which task columns stay visible"
iconOnly
+ rowPresentation={rowPresentation}
/>
<IssueFiltersPopover
@@ -1816,6 +1882,7 @@ export function IssuesList({
enableRoutineVisibilityFilter={enableRoutineVisibilityFilter}
iconOnly
workspaces={isolatedWorkspacesEnabled ? workspaceOptions : undefined}
+ presentation={rowPresentation === "task" ? "streamlined" : "legacy"}
/>
{/* Sort (list view only) */}
@@ -1902,8 +1969,9 @@ export function IssuesList({
</PopoverContent>
</Popover>
)}
- </div>
- </div>
+ </>
+ )}
+ />
{(isLoading || externalObjectFilterLoading) && <PageSkeleton variant="issues-list" />}
{error && <p className="text-sm text-destructive">{error.message}</p>}
@@ -2099,6 +2167,7 @@ export function IssuesList({
>
<IssueRow
issue={issue}
+ presentation={rowPresentation}
issueLinkState={issueLinkState}
selected={selectedNavKey === `issue:${issue.id}`}
onMouseEnter={() => setNavSelectionFromPointer(`issue:${issue.id}`)}
@@ -2146,6 +2215,37 @@ export function IssuesList({
</>
)}
className={cn(isMutedIssue && "opacity-70", selectedNavKey === `issue:${issue.id}` && "bg-accent/50 hover:bg-accent/50")}
+ leadingControl={rowPresentation === "task" ? (
+ hasChildren ? (
+ <button
+ type="button"
+ data-slot="icon-button"
+ className="inline-flex h-4 w-4 shrink-0 items-center justify-center"
+ aria-label={isExpanded ? "Collapse sub-tasks" : "Expand sub-tasks"}
+ onClick={toggleCollapse}
+ >
+ <ChevronRight className={cn("h-3.5 w-3.5 transition-transform", isExpanded && "rotate-90")} />
+ </button>
+ ) : (
+ <span data-slot="task-row-disclosure-spacer" className="h-4 w-4 shrink-0" aria-hidden="true" />
+ )
+ ) : undefined}
+ statusSlot={rowPresentation === "task" ? (
+ <span className="inline-flex items-center" onClick={(e) => { e.preventDefault(); e.stopPropagation(); }}>
+ <StatusIcon status={issue.status} size="md" blockerAttention={issue.blockerAttention} onChange={(s) => onUpdateIssue(issue.id, { status: s })} />
+ </span>
+ ) : undefined}
+ metadata={rowPresentation === "task" ? (
+ <InboxIssueMetaLeading
+ issue={issue}
+ isLive={liveIssueIds?.has(issue.id) === true}
+ subtreeLiveCount={subtreeLiveCounts.get(issue.id) ?? 0}
+ showStatus={false}
+ showIdentifier={false}
+ checklistStepNumber={checklistStepNumber}
+ />
+ ) : undefined}
+ showIdentifier={visibleIssueColumnSet.has("id") && availableIssueColumnSet.has("id")}
mobileLeading={
hasChildren ? (
<button type="button" data-slot="icon-button" onClick={toggleCollapse}>
@@ -2157,7 +2257,7 @@ export function IssuesList({
</span>
)
}
- desktopMetaLeading={(
+ desktopMetaLeading={rowPresentation === "legacy" ? (
<>
{hasChildren ? (
<button
@@ -2185,8 +2285,13 @@ export function IssuesList({
)}
/>
</>
- )}
+ ) : undefined}
mobileMeta={issueActivityText(issue).toLowerCase()}
+ trailingMeta={rowPresentation === "task"
+ && visibleIssueColumnSet.has("updated")
+ && availableIssueColumnSet.has("updated")
+ ? issueActivityTimestamp(issue)
+ : undefined}
desktopTrailing={(
visibleTrailingIssueColumns.length > 0 ? (
<InboxIssueTrailingColumns
@@ -2319,28 +2424,43 @@ export function IssuesList({
);
};
- const separatorField = issueDateSeparatorField(viewState);
- const separatorNow = Date.now();
+ const separatorField = viewState.showDateGroupSeparators
+ ? issueDateSeparatorField(viewState)
+ : null;
+ const separatorNow = new Date();
const nodes: ReactNode[] = [];
- let prevBucket: 0 | 1 | 2 | null = null;
+ let previousDateGroup: TaskDateGroup | null = null;
+ let previousAgeBucket: 0 | 1 | 2 | null = null;
const appendIssueRow = (issue: Issue, depth: number) => {
const node = renderIssueRow(issue, depth);
// Skip rows the render budget dropped so separators never
// dangle above an unrendered (or absent) row.
if (node === null) return;
- if (separatorField) {
- const bucket = issueAgeBucket(issue[separatorField], separatorNow);
- for (const crossedBucket of prevBucket === null
+ if (separatorField && rowPresentation === "task") {
+ const currentDateGroup = taskDateGroup(issue[separatorField], separatorNow);
+ const separatorLabel = taskDateGroupSeparator(previousDateGroup, currentDateGroup);
+ if (separatorLabel) {
+ nodes.push(
+ <IssueDateSeparator
+ key={`date-sep-${issue.id}-${currentDateGroup}`}
+ label={separatorLabel}
+ />,
+ );
+ }
+ previousDateGroup = currentDateGroup;
+ } else if (separatorField) {
+ const currentAgeBucket = issueAgeBucket(issue[separatorField], separatorNow.getTime());
+ for (const crossedBucket of previousAgeBucket === null
? []
- : issueAgeBucketsCrossed(prevBucket, bucket)) {
+ : issueAgeBucketsCrossed(previousAgeBucket, currentAgeBucket)) {
nodes.push(
<IssueDateSeparator
- key={`age-sep-${issue.id}-${crossedBucket}`}
+ key={`date-sep-${issue.id}-${crossedBucket}`}
label={issueAgeSeparatorLabel(crossedBucket)}
/>,
);
}
- prevBucket = bucket;
+ previousAgeBucket = currentAgeBucket;
}
nodes.push(node);
if (!viewState.collapsedParents.includes(issue.id)) {
diff --git a/ui/src/components/Layout.production.tsx b/ui/src/components/Layout.production.tsx
new file mode 100644
index 0000000000..2903267e57
--- /dev/null
+++ b/ui/src/components/Layout.production.tsx
@@ -0,0 +1,706 @@
+import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from "react";
+import { useQuery } from "@tanstack/react-query";
+import { Outlet, useLocation, useNavigate, useNavigationType, useParams } from "@/lib/router";
+import { Sidebar } from "./Sidebar.production";
+import { CompanySettingsSidebar } from "./CompanySettingsSidebar.production";
+import { CompanySettingsNav } from "./access/CompanySettingsNav";
+import { AppsSidebar } from "./AppsSidebar.production";
+import { AppDetailSidebar } from "./AppConnectionSidebar.production";
+import { BreadcrumbBar } from "./BreadcrumbBar.production";
+import { PropertiesPanel } from "./PropertiesPanel";
+import { CommandPalette } from "./CommandPalette";
+import { NewIssueDialog } from "./NewIssueDialog";
+import { NewProjectDialog } from "./NewProjectDialog";
+import { NewGoalDialog } from "./NewGoalDialog";
+import { NewAgentDialog } from "./NewAgentDialog";
+import { KeyboardShortcutsCheatsheet } from "./KeyboardShortcutsCheatsheet";
+import { ToastViewport } from "./ToastViewport";
+import { MobileBottomNav } from "./MobileBottomNav";
+import { WorktreeBanner } from "./WorktreeBanner";
+import { DevRestartBanner } from "./DevRestartBanner";
+import { StandaloneBrowserControls } from "./StandaloneBrowserControls";
+import { RouteErrorBoundary } from "./RouteErrorBoundary";
+import { SidebarShell } from "./SidebarShell.production";
+import { SecondarySidebar } from "./SecondarySidebar.production";
+import { SidebarAccountMenu } from "./SidebarAccountMenu.production";
+import { useDialogActions } from "../context/DialogContext";
+import { GeneralSettingsProvider } from "../context/GeneralSettingsContext";
+import { usePanel } from "../context/PanelContext";
+import { useCompany } from "../context/CompanyContext";
+import { useSidebar } from "../context/SidebarContext";
+import { useKeyboardShortcuts } from "../hooks/useKeyboardShortcuts";
+import { useCompanyPageMemory } from "../hooks/useCompanyPageMemory";
+import { healthApi } from "../api/health";
+import { instanceSettingsApi } from "../api/instanceSettings";
+import { resolveArchivedCompanyBounce, shouldSyncCompanySelectionFromRoute } from "../lib/company-selection";
+import { useOptionalToastActions } from "../context/ToastContext";
+import {
+ applyMainContentScrollTop,
+ NavigationScrollMemory,
+ resetNavigationScroll,
+ shouldResetScrollOnNavigation,
+} from "../lib/navigation-scroll";
+import { queryKeys } from "../lib/queryKeys";
+import { scheduleMainContentFocus } from "../lib/main-content-focus";
+import { pinDocumentScrollToZero } from "../lib/pin-document-scroll";
+import { cn } from "../lib/utils";
+import { NotFoundPage } from "../pages/NotFound";
+import { PluginSlotMount, resolveRouteSidebarSlot, usePluginSlots } from "../plugins/slots";
+
+function getCompanyRouteSegment(pathname: string, companyPrefix: string | undefined): string | null {
+ return getCompanyPathSegments(pathname, companyPrefix)[0]?.toLowerCase() ?? null;
+}
+
+function getCompanyPathSegments(pathname: string, companyPrefix: string | undefined): string[] {
+ if (!companyPrefix) return [];
+ const segments = pathname.split("/").filter(Boolean);
+ if (segments.length < 2) return [];
+ if (segments[0]?.toUpperCase() !== companyPrefix.toUpperCase()) return [];
+ return segments.slice(1);
+}
+
+const RESERVED_APP_SUBPATHS = new Set([
+ "browse",
+ "connections",
+ "connect",
+ "review",
+ "attention",
+ "gateways",
+ "advanced",
+ "app",
+]);
+
+function isSkillsStoreRoute(pathname: string, companyPrefix: string | undefined) {
+ const segments = pathname.split("/").filter(Boolean);
+ if (segments[0]?.toLowerCase() === "skills") return true;
+ if (!companyPrefix) return false;
+ return (
+ segments[0]?.toUpperCase() === companyPrefix.toUpperCase() &&
+ segments[1]?.toLowerCase() === "skills"
+ );
+}
+
+export function Layout() {
+ const {
+ sidebarOpen,
+ setSidebarOpen,
+ toggleSidebar,
+ collapsed,
+ peeking,
+ setPeeking,
+ isMobile,
+ setForceCollapsed,
+ } = useSidebar();
+ const { openNewIssue, openOnboarding } = useDialogActions();
+ const { togglePanelVisible } = usePanel();
+ // Optional: Layout also renders in harnesses without a ToastProvider.
+ const pushToast = useOptionalToastActions()?.pushToast ?? null;
+ const {
+ companies,
+ loading: companiesLoading,
+ selectedCompany,
+ selectedCompanyId,
+ selectionSource,
+ setSelectedCompanyId,
+ } = useCompany();
+ const {
+ companyPrefix,
+ pluginRoutePath: matchedPluginRoutePath,
+ } = useParams<{ companyPrefix: string; pluginRoutePath?: string }>();
+ const navigate = useNavigate();
+ const location = useLocation();
+ const navigationType = useNavigationType();
+ const isCompanySettingsRoute = [
+ "/company/settings",
+ "/company/export",
+ "/company/import",
+ ].some((settingsPath) => location.pathname.includes(settingsPath));
+ const companyPathSegments = getCompanyPathSegments(location.pathname, companyPrefix);
+ const isToolsRoute = companyPathSegments[0]?.toLowerCase() === "tools";
+ const isAppsRoute = companyPathSegments[0]?.toLowerCase() === "apps";
+ const appDetailConnectionId =
+ isAppsRoute && companyPathSegments[1] && !RESERVED_APP_SUBPATHS.has(companyPathSegments[1].toLowerCase())
+ ? companyPathSegments[1]
+ : null;
+ const appDetailApplicationId =
+ isAppsRoute && companyPathSegments[1]?.toLowerCase() === "app" && companyPathSegments[2]
+ ? companyPathSegments[2]
+ : null;
+ // The Skills Store renders its own secondary (category) sidebar, so the main
+ // app nav collapses to its rail throughout the Skills Store section (PAP-10879).
+ const isSkillsRoute = isSkillsStoreRoute(location.pathname, companyPrefix);
+ const onboardingTriggered = useRef(false);
+ const lastMainScrollTop = useRef(0);
+ const previousPathname = useRef<string | null>(null);
+ const mainContentRef = useRef<HTMLElement | null>(null);
+ const scrollMemory = useRef(new NavigationScrollMemory());
+ const activeScrollKey = useRef<string>(location.key);
+ const [mobileNavVisible, setMobileNavVisible] = useState(true);
+ const [shortcutsOpen, setShortcutsOpen] = useState(false);
+ const matchedCompany = useMemo(() => {
+ if (!companyPrefix) return null;
+ const requestedPrefix = companyPrefix.toUpperCase();
+ return companies.find((company) => company.issuePrefix.toUpperCase() === requestedPrefix) ?? null;
+ }, [companies, companyPrefix]);
+ const hasUnknownCompanyPrefix =
+ Boolean(companyPrefix) && !companiesLoading && companies.length > 0 && !matchedCompany;
+ const pluginRoutePath = useMemo(
+ () => matchedPluginRoutePath?.toLowerCase() ?? getCompanyRouteSegment(location.pathname, companyPrefix),
+ [companyPrefix, location.pathname, matchedPluginRoutePath],
+ );
+ const routeSidebarCompanyId = matchedCompany?.id ?? null;
+ const routeSidebarCompanyPrefix = matchedCompany?.issuePrefix ?? null;
+ const { slots: routeSidebarSlots } = usePluginSlots({
+ slotTypes: ["page", "routeSidebar"],
+ companyId: routeSidebarCompanyId,
+ enabled: Boolean(routeSidebarCompanyId && pluginRoutePath),
+ });
+ const routeSidebarSlot = useMemo(
+ () => resolveRouteSidebarSlot(routeSidebarSlots, pluginRoutePath),
+ [pluginRoutePath, routeSidebarSlots],
+ );
+ const sidebarContext = useMemo(
+ () => ({
+ companyId: routeSidebarCompanyId,
+ companyPrefix: routeSidebarCompanyPrefix,
+ }),
+ [routeSidebarCompanyId, routeSidebarCompanyPrefix],
+ );
+ // Takeover routes (company settings, plugin `routeSidebar`) no longer replace
+ // the app `<Sidebar/>`. Instead the host collapses it to its rail and renders
+ // the contextual sidebar in a second pane (PAP-10695). One resolver drives
+ // both desktop (SecondarySidebar) and mobile (off-canvas drawer).
+ const secondarySidebar = isCompanySettingsRoute ? (
+ <CompanySettingsSidebar />
+ ) : appDetailConnectionId ? (
+ <AppDetailSidebar kind="connection" connectionId={appDetailConnectionId} />
+ ) : appDetailApplicationId ? (
+ <AppDetailSidebar kind="application" applicationId={appDetailApplicationId} />
+ ) : isAppsRoute || isToolsRoute ? (
+ <AppsSidebar />
+ ) : routeSidebarSlot ? (
+ <PluginSlotMount
+ slot={routeSidebarSlot}
+ context={sidebarContext}
+ className="h-full w-full"
+ missingBehavior="placeholder"
+ />
+ ) : null;
+ const hasSecondarySidebar = secondarySidebar != null;
+ const { data: health } = useQuery({
+ queryKey: queryKeys.health,
+ queryFn: () => healthApi.get(),
+ retry: false,
+ refetchInterval: (query) => {
+ const data = query.state.data as { devServer?: { enabled?: boolean } } | undefined;
+ return data?.devServer?.enabled ? 2000 : false;
+ },
+ refetchIntervalInBackground: true,
+ });
+ const keyboardShortcutsEnabled = useQuery({
+ queryKey: queryKeys.instance.generalSettings,
+ queryFn: () => instanceSettingsApi.getGeneral(),
+ }).data?.keyboardShortcuts === true;
+
+ // A secondary sidebar always collapses the app sidebar to its rail (still
+ // peek-able) — a hard invariant that overrides the user pin while the route
+ // is active, but does NOT mutate the persisted preference. Clearing the force
+ // on cleanup restores the user's expanded/collapsed choice when navigating
+ // off the takeover route (PAP-10694).
+ const forceRailCollapsed = hasSecondarySidebar || isSkillsRoute;
+ useLayoutEffect(() => {
+ setForceCollapsed(forceRailCollapsed);
+ return () => setForceCollapsed(false);
+ }, [forceRailCollapsed, setForceCollapsed]);
+
+ useEffect(() => {
+ if (companiesLoading || onboardingTriggered.current) return;
+ if (health?.deploymentMode === "authenticated") return;
+ // Cloud provisions the single company for a stack, and POST /companies is a
+ // 403 floor there — auto-opening the wizard could only dead-end.
+ if (health?.cloud) return;
+ if (companies.length === 0) {
+ onboardingTriggered.current = true;
+ openOnboarding();
+ }
+ }, [companies, companiesLoading, openOnboarding, health?.cloud, health?.deploymentMode]);
+
+ useEffect(() => {
+ if (!companyPrefix || companiesLoading || companies.length === 0) return;
+
+ if (!matchedCompany) {
+ const fallback = (selectedCompanyId ? companies.find((company) => company.id === selectedCompanyId) : null)
+ ?? companies[0]
+ ?? null;
+ if (fallback && selectedCompanyId !== fallback.id) {
+ setSelectedCompanyId(fallback.id, { source: "route_sync" });
+ }
+ return;
+ }
+
+ if (companyPrefix !== matchedCompany.issuePrefix) {
+ const suffix = location.pathname.replace(/^\/[^/]+/, "");
+ navigate(`/${matchedCompany.issuePrefix}${suffix}${location.search}`, { replace: true });
+ return;
+ }
+
+ // Stale state (remembered paths, history, bookmarks, restored tabs)
+ // deposits users into archived companies long after archiving; a cold
+ // arrival bounces to an active company instead of dwelling there.
+ // Deliberate visits (the company is already the selection) stay put.
+ const bounce = resolveArchivedCompanyBounce({
+ matchedCompany,
+ selectedCompanyId,
+ companies,
+ });
+ if (bounce) {
+ pushToast?.({
+ title: `${matchedCompany.name} is archived`,
+ body: `Switched to ${bounce.name}.`,
+ tone: "info",
+ dedupeKey: `archived-company-bounce:${matchedCompany.id}`,
+ });
+ setSelectedCompanyId(bounce.id, { source: "route_sync" });
+ navigate(`/${bounce.issuePrefix}/dashboard`, { replace: true });
+ return;
+ }
+
+ if (
+ shouldSyncCompanySelectionFromRoute({
+ selectionSource,
+ selectedCompanyId,
+ routeCompanyId: matchedCompany.id,
+ })
+ ) {
+ setSelectedCompanyId(matchedCompany.id, { source: "route_sync" });
+ }
+ }, [
+ companyPrefix,
+ companies,
+ companiesLoading,
+ matchedCompany,
+ location.pathname,
+ location.search,
+ navigate,
+ pushToast,
+ selectionSource,
+ selectedCompanyId,
+ setSelectedCompanyId,
+ ]);
+
+ const togglePanel = togglePanelVisible;
+ const openSearch = useCallback(() => {
+ document.dispatchEvent(new KeyboardEvent("keydown", {
+ key: "k",
+ metaKey: true,
+ bubbles: true,
+ cancelable: true,
+ }));
+ }, []);
+
+ // Peek (hover flyout) triggers for the collapsed rail. Opening has a tiny
+ // delay so a pointer merely sweeping across the rail doesn't flash it open;
+ // closing is debounced to avoid flicker on the rail→overlay seam. Keyboard
+ // focus opens immediately so tabbing reaches the full nav. Context gates the
+ // effective `peeking` to desktop + collapsed + hover-capable pointers, so
+ // these handlers are inert otherwise.
+ const peekTimer = useRef<number | null>(null);
+ // Whether the pointer is currently over the peek panel. Used to keep the peek
+ // open across focus changes (e.g. navigation steals focus to <main>) as long as
+ // the user is still hovering — it should only close when they actually mouse off
+ // (PAP-10676).
+ const pointerInsidePanel = useRef(false);
+ // When the user explicitly collapses while the pointer is still over the panel,
+ // suppress re-peeking until the pointer actually leaves — otherwise the lingering
+ // hover immediately re-expands the rail and the collapse "doesn't take" until the
+ // mouse moves away (PAP-10676). Re-armed on the next genuine pointer-leave.
+ const suppressPeekRef = useRef(false);
+ const clearPeekTimer = useCallback(() => {
+ if (peekTimer.current !== null) {
+ window.clearTimeout(peekTimer.current);
+ peekTimer.current = null;
+ }
+ }, []);
+ const openPeek = useCallback(() => {
+ clearPeekTimer();
+ peekTimer.current = window.setTimeout(() => setPeeking(true), 50);
+ }, [clearPeekTimer, setPeeking]);
+ const openPeekImmediate = useCallback(() => {
+ clearPeekTimer();
+ setPeeking(true);
+ }, [clearPeekTimer, setPeeking]);
+ const closePeek = useCallback(() => {
+ clearPeekTimer();
+ peekTimer.current = window.setTimeout(() => setPeeking(false), 120);
+ }, [clearPeekTimer, setPeeking]);
+ // Tracked even while expanded so that, at the moment of collapse, we know
+ // whether the pointer is over the panel and should suppress the re-peek.
+ const handlePanelPointerEnter = useCallback(() => {
+ pointerInsidePanel.current = true;
+ if (collapsed && !suppressPeekRef.current) openPeek();
+ }, [collapsed, openPeek]);
+ const handlePanelPointerLeave = useCallback(() => {
+ pointerInsidePanel.current = false;
+ suppressPeekRef.current = false; // pointer left — re-arm peek for the next hover
+ closePeek();
+ }, [closePeek]);
+ const handlePanelFocus = useCallback(() => {
+ if (suppressPeekRef.current) return;
+ openPeekImmediate();
+ }, [openPeekImmediate]);
+ // Close on focus leaving the panel only when the pointer isn't hovering it.
+ // Clicking a rail/peek nav item moves focus to <main> on navigation; if the
+ // mouse is still over the flyout we keep it open until the pointer leaves.
+ const handlePanelBlur = useCallback(() => {
+ if (pointerInsidePanel.current) return;
+ closePeek();
+ }, [closePeek]);
+
+ // Tidy up any pending peek timer on unmount.
+ useEffect(() => clearPeekTimer, [clearPeekTimer]);
+
+ // An explicit collapse must be atomic: cancel any in-flight/active peek, and if
+ // the pointer is still over the panel suppress re-peeking until it leaves, so the
+ // rail doesn't immediately re-expand under the lingering hover (PAP-10676).
+ const wasCollapsed = useRef(collapsed);
+ useEffect(() => {
+ if (collapsed !== wasCollapsed.current) {
+ if (collapsed) {
+ clearPeekTimer();
+ setPeeking(false);
+ suppressPeekRef.current = pointerInsidePanel.current;
+ } else {
+ suppressPeekRef.current = false;
+ }
+ wasCollapsed.current = collapsed;
+ }
+ }, [collapsed, clearPeekTimer, setPeeking]);
+
+ // Intentionally do NOT close the peek on navigation: clicking a nav item means
+ // the pointer is still over the flyout, so it should stay open until the user
+ // actually mouses off (handled by onPanelMouseLeave) or blurs out / hits Escape
+ // (PAP-10676). Auto-closing here made the sidebar collapse on every page change.
+
+ // Escape closes an open peek without trapping the pointer.
+ useEffect(() => {
+ if (!peeking) return;
+ const onKeyDown = (event: KeyboardEvent) => {
+ if (event.key === "Escape") {
+ clearPeekTimer();
+ setPeeking(false);
+ }
+ };
+ window.addEventListener("keydown", onKeyDown);
+ return () => window.removeEventListener("keydown", onKeyDown);
+ }, [peeking, clearPeekTimer, setPeeking]);
+
+ useCompanyPageMemory();
+
+ useKeyboardShortcuts({
+ enabled: keyboardShortcutsEnabled,
+ onNewIssue: () => openNewIssue(),
+ onSearch: openSearch,
+ onToggleSidebar: toggleSidebar,
+ onTogglePanel: togglePanel,
+ onShowShortcuts: () => setShortcutsOpen(true),
+ onGoToInbox: () => navigate("/inbox"),
+ });
+
+ useEffect(() => {
+ if (!isMobile) {
+ setMobileNavVisible(true);
+ return;
+ }
+ lastMainScrollTop.current = 0;
+ setMobileNavVisible(true);
+ }, [isMobile]);
+
+ // Swipe gesture to open/close sidebar on mobile
+ useEffect(() => {
+ if (!isMobile) return;
+
+ const EDGE_ZONE = 30; // px from left edge to start open-swipe
+ const MIN_DISTANCE = 50; // minimum horizontal swipe distance
+ const MAX_VERTICAL = 75; // max vertical drift before we ignore
+
+ let startX = 0;
+ let startY = 0;
+
+ const onTouchStart = (e: TouchEvent) => {
+ const t = e.touches[0]!;
+ startX = t.clientX;
+ startY = t.clientY;
+ };
+
+ const onTouchEnd = (e: TouchEvent) => {
+ const t = e.changedTouches[0]!;
+ const dx = t.clientX - startX;
+ const dy = Math.abs(t.clientY - startY);
+
+ if (dy > MAX_VERTICAL) return; // vertical scroll, ignore
+
+ // Swipe right from left edge → open
+ if (!sidebarOpen && startX < EDGE_ZONE && dx > MIN_DISTANCE) {
+ setSidebarOpen(true);
+ return;
+ }
+
+ // Swipe left when open → close
+ if (sidebarOpen && dx < -MIN_DISTANCE) {
+ setSidebarOpen(false);
+ }
+ };
+
+ document.addEventListener("touchstart", onTouchStart, { passive: true });
+ document.addEventListener("touchend", onTouchEnd, { passive: true });
+
+ return () => {
+ document.removeEventListener("touchstart", onTouchStart);
+ document.removeEventListener("touchend", onTouchEnd);
+ };
+ }, [isMobile, sidebarOpen, setSidebarOpen]);
+
+ const updateMobileNavVisibility = useCallback((currentTop: number) => {
+ const delta = currentTop - lastMainScrollTop.current;
+
+ if (currentTop <= 24) {
+ setMobileNavVisible(true);
+ } else if (delta > 8) {
+ setMobileNavVisible(false);
+ } else if (delta < -8) {
+ setMobileNavVisible(true);
+ }
+
+ lastMainScrollTop.current = currentTop;
+ }, []);
+
+ useEffect(() => {
+ if (!isMobile) {
+ setMobileNavVisible(true);
+ lastMainScrollTop.current = 0;
+ return;
+ }
+
+ const onScroll = () => {
+ updateMobileNavVisibility(window.scrollY || document.documentElement.scrollTop || 0);
+ };
+
+ onScroll();
+ window.addEventListener("scroll", onScroll, { passive: true });
+
+ return () => {
+ window.removeEventListener("scroll", onScroll);
+ };
+ }, [isMobile, updateMobileNavVisibility]);
+
+ useEffect(() => {
+ const previousOverflow = document.body.style.overflow;
+
+ document.body.style.overflow = isMobile ? "visible" : "clip";
+
+ return () => {
+ document.body.style.overflow = previousOverflow;
+ };
+ }, [isMobile]);
+
+ // `scrollIntoView` walks every ancestor scroll container. On a long thread
+ // the post-submit `scrollIntoView` on the new comment reaches `<html>` and
+ // animates `documentElement.scrollTop` via the browser's internal scroll
+ // algorithm, which bypasses the CSS `overflow` on the root element and
+ // visually shifts the entire shell (sidebar included) off-screen. Pin
+ // both roots to scrollTop=0 on every scroll tick.
+ useEffect(() => {
+ if (isMobile) return;
+ return pinDocumentScrollToZero();
+ }, [isMobile]);
+
+ useEffect(() => {
+ if (typeof document === "undefined") return;
+ const mainContent = mainContentRef.current;
+ return scheduleMainContentFocus(mainContent);
+ }, [location.pathname]);
+
+ // Continuously record the scroll offset of the active history entry so a
+ // later back/forward navigation can restore it (see NavigationScrollMemory).
+ useEffect(() => {
+ const main = mainContentRef.current;
+ if (!main) return;
+ const recordScroll = () => {
+ scrollMemory.current.remember(activeScrollKey.current, main.scrollTop);
+ };
+ main.addEventListener("scroll", recordScroll, { passive: true });
+ return () => main.removeEventListener("scroll", recordScroll);
+ }, []);
+
+ useLayoutEffect(() => {
+ const main = mainContentRef.current;
+ const shouldResetScroll = shouldResetScrollOnNavigation({
+ previousPathname: previousPathname.current,
+ pathname: location.pathname,
+ navigationType,
+ state: location.state,
+ });
+
+ previousPathname.current = location.pathname;
+
+ const isHistoryPop = navigationType === "POP";
+ const restoredScrollTop = isHistoryPop ? scrollMemory.current.recall(location.key) : 0;
+ activeScrollKey.current = location.key;
+
+ if (isHistoryPop) {
+ applyMainContentScrollTop(main, restoredScrollTop);
+ // Cached page content can finish laying out a frame after commit; re-apply
+ // once it has so the restored offset isn't clamped to a shorter interim height.
+ const raf = requestAnimationFrame(() => applyMainContentScrollTop(main, restoredScrollTop));
+ return () => cancelAnimationFrame(raf);
+ }
+
+ if (shouldResetScroll) {
+ resetNavigationScroll(main);
+ }
+ }, [location.key, location.pathname, location.state, navigationType]);
+
+ return (
+ <GeneralSettingsProvider value={{ keyboardShortcutsEnabled }}>
+ <div
+ className={cn(
+ "bg-background text-foreground pt-(--sz-safe-top)",
+ // overflow-x-clip on mobile keeps a stray wide descendant from making the
+ // whole viewport scroll horizontally. clip (not hidden) leaves overflow-y
+ // computed as visible, so native body scroll + the sticky breadcrumb keep
+ // working.
+ isMobile ? "min-h-dvh overflow-x-clip" : "flex h-dvh flex-col overflow-clip",
+ )}
+ >
+ <a
+ href="#main-content"
+ className="sr-only focus:not-sr-only focus:fixed focus:left-3 focus:top-3 focus:z-(--z-200) focus:rounded-md focus:bg-background focus:px-3 focus:py-2 focus:text-sm focus:font-medium focus:shadow-lg focus:outline-none focus-visible:ring-2 focus-visible:ring-ring"
+ >
+ Skip to Main Content
+ </a>
+ <WorktreeBanner />
+ <DevRestartBanner devServer={health?.devServer} />
+ <div className={cn("min-h-0 flex-1", isMobile ? "w-full" : "flex overflow-clip")}>
+ {isMobile && sidebarOpen && (
+ <button
+ type="button"
+ className="fixed inset-0 z-40 bg-black/50"
+ onClick={() => setSidebarOpen(false)}
+ aria-label="Close sidebar"
+ />
+ )}
+
+ {isMobile ? (
+ <div
+ className={cn(
+ "fixed inset-y-0 left-0 z-50 flex flex-col overflow-hidden pt-(--sz-safe-top) transition-transform duration-100 ease-out",
+ sidebarOpen ? "translate-x-0" : "-translate-x-full"
+ )}
+ >
+ <div className="flex flex-1 min-h-0 overflow-hidden">
+ <div className="w-60 shrink-0 overflow-hidden">
+ {hasSecondarySidebar ? secondarySidebar : <Sidebar />}
+ </div>
+ </div>
+ <SidebarAccountMenu
+ deploymentMode={health?.deploymentMode}
+ serverGit={health?.serverInfo?.git}
+ version={health?.version}
+ />
+ </div>
+ ) : (
+ <SidebarShell
+ open={sidebarOpen}
+ collapsed={collapsed}
+ peeking={peeking}
+ resizable
+ onPanelMouseEnter={handlePanelPointerEnter}
+ onPanelMouseLeave={handlePanelPointerLeave}
+ onPanelFocusCapture={collapsed ? handlePanelFocus : undefined}
+ onPanelBlurCapture={collapsed ? handlePanelBlur : undefined}
+ >
+ <div className="flex flex-1 min-h-0">
+ <Sidebar />
+ </div>
+ <SidebarAccountMenu
+ deploymentMode={health?.deploymentMode}
+ serverGit={health?.serverInfo?.git}
+ version={health?.version}
+ />
+ </SidebarShell>
+ )}
+
+ {!isMobile && hasSecondarySidebar ? (
+ <SecondarySidebar>{secondarySidebar}</SecondarySidebar>
+ ) : null}
+
+ <div className={cn("flex min-w-0 flex-col", isMobile ? "w-full" : "h-full flex-1")}>
+ <div
+ className={cn(
+ isMobile && "sticky top-0 z-20 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/85",
+ )}
+ >
+ <StandaloneBrowserControls mobile={isMobile} />
+ <BreadcrumbBar />
+ {isMobile && isCompanySettingsRoute ? (
+ <div className="border-b border-border px-4 pb-3">
+ <CompanySettingsNav />
+ </div>
+ ) : null}
+ </div>
+ <div className={cn(isMobile ? "block" : "flex flex-1 min-h-0")}>
+ <main
+ id="main-content"
+ ref={mainContentRef}
+ tabIndex={-1}
+ // Publish the pinned-composer bottom offset to descendants
+ // (PAP-495): while the auto-hiding mobile nav is on screen, raise
+ // it to the nav height so a sticky composer clears the nav; drop
+ // it back to the safe-area dock when the nav hides. Desktop leaves
+ // the token at its :root default.
+ style={
+ isMobile
+ ? ({
+ "--tc-composer-bottom": mobileNavVisible
+ ? "var(--sz-calc-14)"
+ : "var(--sz-calc-8)",
+ } as CSSProperties)
+ : undefined
+ }
+ className={cn(
+ "flex-1 p-4 outline-none md:p-6",
+ // Reserve the scrollbar gutter on desktop so pages whose height
+ // changes (e.g. switching skill-detail tabs) don't widen/shift
+ // when the vertical scrollbar appears or disappears (PAP-10907).
+ isMobile
+ ? "overflow-visible pb-(--sz-calc-14)"
+ : "overflow-auto [scrollbar-gutter:stable]",
+ )}
+ >
+ {hasUnknownCompanyPrefix ? (
+ <NotFoundPage
+ scope="invalid_company_prefix"
+ requestedPrefix={companyPrefix ?? selectedCompany?.issuePrefix}
+ />
+ ) : (
+ <RouteErrorBoundary>
+ <Outlet />
+ </RouteErrorBoundary>
+ )}
+ </main>
+ <PropertiesPanel />
+ </div>
+ </div>
+ </div>
+ {isMobile && <MobileBottomNav visible={mobileNavVisible} />}
+ <CommandPalette />
+ <NewIssueDialog />
+ <NewProjectDialog />
+ <NewGoalDialog />
+ <NewAgentDialog />
+ <KeyboardShortcutsCheatsheet open={shortcutsOpen} onOpenChange={setShortcutsOpen} />
+ <ToastViewport />
+ </div>
+ </GeneralSettingsProvider>
+ );
+}
diff --git a/ui/src/components/Layout.test.tsx b/ui/src/components/Layout.test.tsx
index bd04975db9..62117a25c3 100644
--- a/ui/src/components/Layout.test.tsx
+++ b/ui/src/components/Layout.test.tsx
@@ -18,7 +18,6 @@ const mockInstanceSettingsApi = vi.hoisted(() => ({
const mockNavigate = vi.hoisted(() => vi.fn());
const mockSetSelectedCompanyId = vi.hoisted(() => vi.fn());
const mockSetSidebarOpen = vi.hoisted(() => vi.fn());
-const mockSetForceCollapsed = vi.hoisted(() => vi.fn());
const mockCompanyState = vi.hoisted(() => ({
companies: [{ id: "company-1", issuePrefix: "PAP", name: "Paperclip" }],
selectedCompany: { id: "company-1", issuePrefix: "PAP", name: "Paperclip" },
@@ -30,6 +29,7 @@ const mockPluginSlots = vi.hoisted(() => ({
const mockUsePluginSlots = vi.hoisted(() => vi.fn());
const mockPluginSlotContexts = vi.hoisted(() => [] as Array<Record<string, unknown>>);
const mockSetPeeking = vi.hoisted(() => vi.fn());
+const mockSetForceCollapsed = vi.hoisted(() => vi.fn());
const mockSidebarState = vi.hoisted(() => ({
sidebarOpen: true,
isMobile: false,
@@ -44,16 +44,20 @@ vi.mock("@/lib/router", () => ({
useNavigate: () => mockNavigate,
useNavigationType: () => "PUSH",
useParams: () => {
- const [firstSegment, secondSegment] = currentPathname.split("/").filter(Boolean);
+ const [firstSegment, secondSegment, entityId] = currentPathname.split("/").filter(Boolean);
return {
companyPrefix: firstSegment ?? "PAP",
pluginRoutePath: secondSegment,
+ agentId: secondSegment === "agents" ? entityId : undefined,
+ routineId: secondSegment === "routines" ? entityId : undefined,
};
},
}));
vi.mock("./Sidebar", () => ({
- Sidebar: () => <div>Main company nav</div>,
+ Sidebar: ({ contentHeaderControls }: { contentHeaderControls?: boolean }) => (
+ <div data-content-header-controls={String(contentHeaderControls ?? false)}>Main company nav</div>
+ ),
}));
vi.mock("./CompanySettingsSidebar", () => ({
@@ -64,6 +68,18 @@ vi.mock("./AppsSidebar", () => ({
AppsSidebar: () => <div>Apps sidebar</div>,
}));
+vi.mock("./AgentContextualSidebar", () => ({
+ AgentContextualSidebar: ({ agentRef }: { agentRef: string }) => <div>Agent sidebar {agentRef}</div>,
+}));
+
+vi.mock("./RoutineContextualSidebar", () => ({
+ RoutineContextualSidebar: ({ routineId }: { routineId: string }) => <div>Routine sidebar {routineId}</div>,
+}));
+
+vi.mock("./SkillsContextualSidebar", () => ({
+ SkillsContextualSidebar: () => <div>Skills sidebar</div>,
+}));
+
vi.mock("./AppConnectionSidebar", () => ({
AppDetailSidebar: (props: { kind: "connection"; connectionId: string } | { kind: "application"; applicationId: string }) => (
<div>
@@ -188,12 +204,10 @@ vi.mock("../context/SidebarContext", () => ({
toggleSidebar: vi.fn(),
toggleCollapsed: vi.fn(),
collapsed: mockSidebarState.collapsed,
- collapseLocked: false,
peeking: mockSidebarState.peeking,
setPeeking: mockSetPeeking,
- isMobile: mockSidebarState.isMobile,
- forceCollapsed: false,
setForceCollapsed: mockSetForceCollapsed,
+ isMobile: mockSidebarState.isMobile,
routeRequestsCollapsed: false,
setRouteRequestsCollapsed: vi.fn(),
}),
@@ -272,6 +286,7 @@ describe("Layout", () => {
mockSidebarState.collapsed = false;
mockSidebarState.peeking = false;
mockSetPeeking.mockClear();
+ mockSetForceCollapsed.mockClear();
});
afterEach(() => {
@@ -310,6 +325,36 @@ describe("Layout", () => {
});
});
+ it("scopes the Streamlined task-detail surface to the main pane and right sidebar row", async () => {
+ currentPathname = "/PAP/issues/PAP-1";
+ mockInstanceSettingsApi.getExperimental.mockResolvedValue({
+ enableApps: true,
+ enableStreamlinedUi: true,
+ });
+ const root = createRoot(container);
+ const queryClient = new QueryClient({ defaultOptions: { queries: { retry: false } } });
+
+ await act(async () => {
+ root.render(
+ <QueryClientProvider client={queryClient}>
+ <Layout />
+ </QueryClientProvider>,
+ );
+ });
+ await flushReact();
+ await flushReact();
+
+ expect(container.querySelector(".streamlined-task-detail-surface")).not.toBeNull();
+ expect(container.querySelector("#main-content")?.classList.contains("pt-0")).toBe(true);
+ expect(container.querySelector("#main-content")?.classList.contains("md:pt-0")).toBe(true);
+ expect(container.querySelector("#main-content")?.classList.contains("pr-0")).toBe(true);
+ expect(container.querySelector("#main-content")?.classList.contains("md:pr-0")).toBe(true);
+
+ await act(async () => {
+ root.unmount();
+ });
+ });
+
it("collapses atomically when the pointer is still over the sidebar (no re-peek) — PAP-10676", async () => {
const root = createRoot(container);
const queryClient = new QueryClient({ defaultOptions: { queries: { retry: false } } });
@@ -384,7 +429,7 @@ describe("Layout", () => {
await act(async () => { root.unmount(); });
});
- it("keeps the app sidebar and shows the settings sidebar in the secondary pane on settings routes", async () => {
+ it("keeps the app sidebar beside settings navigation on settings routes", async () => {
currentPathname = "/PAP/company/settings/access";
mockPluginSlots.slots = [
{
@@ -425,14 +470,41 @@ describe("Layout", () => {
await flushReact();
await flushReact();
- // Takeover model (PAP-10695): the app sidebar is kept (collapsed to its
- // rail) AND the settings sidebar renders in the secondary pane.
expect(container.textContent).toContain("Company settings sidebar");
expect(container.textContent).toContain("Main company nav");
+ const secondaryRail = container.querySelector("[data-secondary-sidebar]");
+ expect(secondaryRail?.classList.contains("w-60")).toBe(true);
+ expect(secondaryRail?.classList.contains("bg-background")).toBe(true);
expect(container.textContent).not.toContain("Company rail");
expect(container.textContent).not.toContain("Instance sidebar");
expect(container.textContent).not.toContain("Plugin route sidebar");
- // The route asks the host to collapse the app sidebar to its rail.
+
+ await act(async () => {
+ root.unmount();
+ });
+ });
+
+ it("keeps the global sidebar beside legacy settings navigation when Streamlined UI is off", async () => {
+ currentPathname = "/PAP/company/settings/access";
+ mockInstanceSettingsApi.getExperimental.mockResolvedValue({
+ enableApps: true,
+ enableStreamlinedUi: false,
+ });
+ const root = createRoot(container);
+ const queryClient = new QueryClient({ defaultOptions: { queries: { retry: false } } });
+
+ await act(async () => {
+ root.render(
+ <QueryClientProvider client={queryClient}>
+ <Layout />
+ </QueryClientProvider>,
+ );
+ });
+ await flushReact();
+ await flushReact();
+
+ expect(container.textContent).toContain("Main company nav");
+ expect(container.textContent).toContain("Company settings sidebar");
expect(mockSetForceCollapsed).toHaveBeenCalledWith(true);
await act(async () => {
@@ -481,7 +553,7 @@ describe("Layout", () => {
});
});
- it("renders the company settings sidebar on instance settings routes", async () => {
+ it("keeps the company nav beside settings on instance settings routes", async () => {
currentPathname = "/PAP/company/settings/instance/general";
const root = createRoot(container);
const queryClient = new QueryClient({
@@ -502,7 +574,6 @@ describe("Layout", () => {
expect(container.textContent).toContain("Main company nav");
expect(container.textContent).not.toContain("Company rail");
expect(container.textContent).not.toContain("Plugin route sidebar");
- expect(mockSetForceCollapsed).toHaveBeenCalledWith(true);
await act(async () => {
root.unmount();
@@ -510,7 +581,7 @@ describe("Layout", () => {
});
it.each(["/PAP/company/export", "/PAP/company/import"])(
- "renders the shared settings sidebar on %s",
+ "keeps the company nav beside the shared settings sidebar on %s",
async (pathname) => {
currentPathname = pathname;
const root = createRoot(container);
@@ -530,7 +601,6 @@ describe("Layout", () => {
expect(container.textContent).toContain("Company settings sidebar");
expect(container.textContent).toContain("Main company nav");
- expect(mockSetForceCollapsed).toHaveBeenCalledWith(true);
await act(async () => {
root.unmount();
@@ -538,7 +608,7 @@ describe("Layout", () => {
},
);
- it("keeps the app sidebar and shows the Apps sidebar in the secondary pane on legacy tools routes", async () => {
+ it("keeps the company nav beside Apps navigation on legacy tools routes", async () => {
currentPathname = "/PAP/tools/runtime";
const root = createRoot(container);
const queryClient = new QueryClient({
@@ -558,7 +628,6 @@ describe("Layout", () => {
expect(container.textContent).toContain("Apps sidebar");
expect(container.textContent).toContain("Main company nav");
expect(container.textContent).not.toContain("Company settings sidebar");
- expect(mockSetForceCollapsed).toHaveBeenCalledWith(true);
await act(async () => {
root.unmount();
@@ -585,7 +654,6 @@ describe("Layout", () => {
expect(container.textContent).toContain("Apps sidebar");
expect(container.textContent).toContain("Main company nav");
- expect(mockSetForceCollapsed).toHaveBeenCalledWith(true);
const secondaryRail = container.querySelector("[data-secondary-sidebar]");
expect(secondaryRail?.classList.contains("w-60")).toBe(true);
expect(secondaryRail?.classList.contains("shrink-0")).toBe(true);
@@ -753,7 +821,7 @@ describe("Layout", () => {
});
});
- it("forces the app sidebar rail only for the Skills Store route", async () => {
+ it("keeps global navigation beside Skills, Agent, and Routine details", async () => {
async function renderAt(pathname: string) {
currentPathname = pathname;
const root = createRoot(container);
@@ -773,24 +841,123 @@ describe("Layout", () => {
return root;
}
- let root = await renderAt("/PAP/skills/studio");
- expect(mockSetForceCollapsed).toHaveBeenCalledWith(true);
- await act(async () => {
- root.unmount();
+ for (const [pathname, sidebarText] of [
+ ["/PAP/skills/studio", "Skills sidebar"],
+ ["/PAP/agents/briefing-analyst/skills", "Agent sidebar briefing-analyst"],
+ ["/PAP/agents/briefing-analyst/runs/run-1", "Agent sidebar briefing-analyst"],
+ ["/PAP/routines/routine-1/overview", "Routine sidebar routine-1"],
+ ] as const) {
+ const root = await renderAt(pathname);
+ expect(container.textContent).toContain(sidebarText);
+ expect(container.textContent).toContain("Main company nav");
+ const secondaryRail = container.querySelector("[data-secondary-sidebar]");
+ expect(secondaryRail?.classList.contains("w-60")).toBe(true);
+ expect(secondaryRail?.classList.contains("bg-background")).toBe(true);
+ const breadcrumb = Array.from(container.querySelectorAll("div"))
+ .find((element) => element.textContent === "Breadcrumbs");
+ expect(breadcrumb).toBeDefined();
+ expect(
+ breadcrumb && secondaryRail
+ ? breadcrumb.compareDocumentPosition(secondaryRail) & Node.DOCUMENT_POSITION_FOLLOWING
+ : 0,
+ ).not.toBe(0);
+ await act(async () => {
+ root.unmount();
+ });
+ container.innerHTML = "";
+ }
+ });
+
+ it("keeps global navigation on legacy Agent and Routine detail routes", async () => {
+ mockInstanceSettingsApi.getExperimental.mockResolvedValue({
+ enableApps: true,
+ enableStreamlinedUi: false,
});
- mockSetForceCollapsed.mockClear();
- container.innerHTML = "";
+ for (const pathname of [
+ "/PAP/agents/briefing-analyst/skills",
+ "/PAP/routines/routine-1/overview",
+ ]) {
+ currentPathname = pathname;
+ const root = createRoot(container);
+ const queryClient = new QueryClient({ defaultOptions: { queries: { retry: false } } });
- root = await renderAt("/PAP/agents/briefing-analyst/skills");
- expect(mockSetForceCollapsed).not.toHaveBeenCalledWith(true);
- expect(mockSetForceCollapsed).toHaveBeenCalledWith(false);
+ await act(async () => {
+ root.render(
+ <QueryClientProvider client={queryClient}>
+ <Layout />
+ </QueryClientProvider>,
+ );
+ });
+ await flushReact();
+ await flushReact();
+
+ expect(container.textContent).toContain("Main company nav");
+ expect(container.textContent).not.toContain("Agent sidebar");
+ expect(container.textContent).not.toContain("Routine sidebar");
+
+ await act(async () => {
+ root.unmount();
+ });
+ container.innerHTML = "";
+ }
+ });
+
+ it("keeps the global rail beside Skills navigation in the legacy shell", async () => {
+ currentPathname = "/PAP/skills/studio";
+ mockInstanceSettingsApi.getExperimental.mockResolvedValue({
+ enableApps: true,
+ enableStreamlinedUi: false,
+ });
+ const root = createRoot(container);
+ const queryClient = new QueryClient({ defaultOptions: { queries: { retry: false } } });
+
+ await act(async () => {
+ root.render(
+ <QueryClientProvider client={queryClient}>
+ <Layout />
+ </QueryClientProvider>,
+ );
+ });
+ await flushReact();
+ await flushReact();
+
+ expect(container.textContent).toContain("Main company nav");
+ expect(container.textContent).toContain("Skills sidebar");
+ expect(mockSetForceCollapsed).toHaveBeenCalledWith(true);
await act(async () => {
root.unmount();
});
});
+ it("keeps Agent and Routine collection routes in global navigation", async () => {
+ for (const pathname of ["/PAP/agents/all", "/PAP/agents/new", "/PAP/routines"]) {
+ currentPathname = pathname;
+ const root = createRoot(container);
+ const queryClient = new QueryClient({ defaultOptions: { queries: { retry: false } } });
+
+ await act(async () => {
+ root.render(
+ <QueryClientProvider client={queryClient}>
+ <Layout />
+ </QueryClientProvider>,
+ );
+ });
+ await flushReact();
+ await flushReact();
+
+ expect(container.textContent).toContain("Main company nav");
+ expect(container.textContent).not.toContain("Agent sidebar");
+ expect(container.textContent).not.toContain("Routine sidebar");
+
+ await act(async () => {
+ root.unmount();
+ });
+ container.innerHTML = "";
+ }
+ });
+
it("renders a route-scoped plugin sidebar for a matching plugin page route", async () => {
currentPathname = "/PAP/wiki";
mockPluginSlots.slots = [
@@ -832,14 +999,11 @@ describe("Layout", () => {
await flushReact();
await flushReact();
- // Takeover model (PAP-10695): the app sidebar coexists with the plugin's
- // route sidebar, which renders in the secondary pane.
expect(container.textContent).toContain("Plugin route sidebar: Wiki Sidebar");
- expect(container.querySelector("[data-plugin-slot-class='h-full w-full']")).not.toBeNull();
- expect(container.textContent).toContain("Main company nav");
+ expect(container.querySelector("[data-plugin-slot-class='min-h-0 flex-1']")).not.toBeNull();
+ expect(container.textContent).not.toContain("Main company nav");
expect(container.textContent).not.toContain("Company settings sidebar");
expect(container.textContent).not.toContain("Instance sidebar");
- expect(mockSetForceCollapsed).toHaveBeenCalledWith(true);
await act(async () => {
root.unmount();
@@ -894,7 +1058,7 @@ describe("Layout", () => {
}),
);
expect(container.textContent).toContain("Plugin route sidebar: Wiki Sidebar");
- expect(container.textContent).toContain("Main company nav");
+ expect(container.textContent).not.toContain("Main company nav");
await act(async () => {
root.unmount();
@@ -1022,9 +1186,6 @@ describe("Layout", () => {
expect(container.textContent).toContain("Main company nav");
expect(container.textContent).not.toContain("Plugin route sidebar");
- // No secondary pane, so the route must not force the sidebar collapsed.
- expect(mockSetForceCollapsed).not.toHaveBeenCalledWith(true);
- expect(mockSetForceCollapsed).toHaveBeenCalledWith(false);
await act(async () => {
root.unmount();
diff --git a/ui/src/components/Layout.tsx b/ui/src/components/Layout.tsx
index 43004ed114..9b3dd5f2db 100644
--- a/ui/src/components/Layout.tsx
+++ b/ui/src/components/Layout.tsx
@@ -6,6 +6,9 @@ import { CompanySettingsSidebar } from "./CompanySettingsSidebar";
import { CompanySettingsNav } from "./access/CompanySettingsNav";
import { AppsSidebar } from "./AppsSidebar";
import { AppDetailSidebar } from "./AppConnectionSidebar";
+import { AgentContextualSidebar } from "./AgentContextualSidebar";
+import { RoutineContextualSidebar } from "./RoutineContextualSidebar";
+import { SkillsContextualSidebar } from "./SkillsContextualSidebar";
import { BreadcrumbBar } from "./BreadcrumbBar";
import { PropertiesPanel } from "./PropertiesPanel";
import { CommandPalette } from "./CommandPalette";
@@ -22,6 +25,7 @@ import { StandaloneBrowserControls } from "./StandaloneBrowserControls";
import { RouteErrorBoundary } from "./RouteErrorBoundary";
import { SidebarShell } from "./SidebarShell";
import { SecondarySidebar } from "./SecondarySidebar";
+import { ContextualSidebarFrame } from "./ContextualSidebarFrame";
import { SidebarAccountMenu } from "./SidebarAccountMenu";
import { useDialogActions } from "../context/DialogContext";
import { GeneralSettingsProvider } from "../context/GeneralSettingsContext";
@@ -29,6 +33,7 @@ import { usePanel } from "../context/PanelContext";
import { useCompany } from "../context/CompanyContext";
import { useSidebar } from "../context/SidebarContext";
import { useKeyboardShortcuts } from "../hooks/useKeyboardShortcuts";
+import { useStreamlinedUiEnabled } from "../hooks/useStreamlinedUiEnabled";
import { useCompanyPageMemory } from "../hooks/useCompanyPageMemory";
import { healthApi } from "../api/health";
import { instanceSettingsApi } from "../api/instanceSettings";
@@ -43,6 +48,12 @@ import {
import { queryKeys } from "../lib/queryKeys";
import { scheduleMainContentFocus } from "../lib/main-content-focus";
import { pinDocumentScrollToZero } from "../lib/pin-document-scroll";
+import {
+ classifyShellRoute,
+ getCompanyPathSegments,
+ rememberContextualSidebarOrigin,
+ type ContextualSidebarSurface,
+} from "../lib/shell-navigation";
import { cn } from "../lib/utils";
import { NotFoundPage } from "../pages/NotFound";
import { PluginSlotMount, resolveRouteSidebarSlot, usePluginSlots } from "../plugins/slots";
@@ -51,14 +62,6 @@ function getCompanyRouteSegment(pathname: string, companyPrefix: string | undefi
return getCompanyPathSegments(pathname, companyPrefix)[0]?.toLowerCase() ?? null;
}
-function getCompanyPathSegments(pathname: string, companyPrefix: string | undefined): string[] {
- if (!companyPrefix) return [];
- const segments = pathname.split("/").filter(Boolean);
- if (segments.length < 2) return [];
- if (segments[0]?.toUpperCase() !== companyPrefix.toUpperCase()) return [];
- return segments.slice(1);
-}
-
const RESERVED_APP_SUBPATHS = new Set([
"browse",
"connections",
@@ -71,22 +74,11 @@ const RESERVED_APP_SUBPATHS = new Set([
"app",
]);
-function isSkillsStoreRoute(pathname: string, companyPrefix: string | undefined) {
- const segments = pathname.split("/").filter(Boolean);
- if (segments[0]?.toLowerCase() === "skills") return true;
- if (!companyPrefix) return false;
- return (
- segments[0]?.toUpperCase() === companyPrefix.toUpperCase() &&
- segments[1]?.toLowerCase() === "skills"
- );
-}
-
export function Layout() {
const {
sidebarOpen,
setSidebarOpen,
toggleSidebar,
- toggleCollapsed,
collapsed,
peeking,
setPeeking,
@@ -108,16 +100,23 @@ export function Layout() {
const {
companyPrefix,
pluginRoutePath: matchedPluginRoutePath,
- } = useParams<{ companyPrefix: string; pluginRoutePath?: string }>();
+ agentId,
+ routineId,
+ } = useParams<{
+ companyPrefix: string;
+ pluginRoutePath?: string;
+ agentId?: string;
+ routineId?: string;
+ }>();
const navigate = useNavigate();
const location = useLocation();
const navigationType = useNavigationType();
- const isCompanySettingsRoute = [
- "/company/settings",
- "/company/export",
- "/company/import",
- ].some((settingsPath) => location.pathname.includes(settingsPath));
- const companyPathSegments = getCompanyPathSegments(location.pathname, companyPrefix);
+ const { enabled: streamlinedUiEnabled } = useStreamlinedUiEnabled();
+ const shellRoute = classifyShellRoute(location.pathname, companyPrefix);
+ const isCompanySettingsRoute = shellRoute.builtInContextualSurface === "settings";
+ const companyPathSegments = shellRoute.companySegments;
+ const isTaskDetailRoute = shellRoute.isTaskDetail;
+ const useStreamlinedTaskDetailShell = streamlinedUiEnabled && isTaskDetailRoute;
const isToolsRoute = companyPathSegments[0]?.toLowerCase() === "tools";
const isAppsRoute = companyPathSegments[0]?.toLowerCase() === "apps";
const appDetailConnectionId =
@@ -128,9 +127,6 @@ export function Layout() {
isAppsRoute && companyPathSegments[1]?.toLowerCase() === "app" && companyPathSegments[2]
? companyPathSegments[2]
: null;
- // The Skills Store renders its own secondary (category) sidebar, so the main
- // app nav collapses to its rail throughout the Skills Store section (PAP-10879).
- const isSkillsRoute = isSkillsStoreRoute(location.pathname, companyPrefix);
const onboardingTriggered = useRef(false);
const lastMainScrollTop = useRef(0);
const previousPathname = useRef<string | null>(null);
@@ -168,12 +164,14 @@ export function Layout() {
}),
[routeSidebarCompanyId, routeSidebarCompanyPrefix],
);
- // Takeover routes (company settings, plugin `routeSidebar`) no longer replace
- // the app `<Sidebar/>`. Instead the host collapses it to its rail and renders
- // the contextual sidebar in a second pane (PAP-10695). One resolver drives
- // both desktop (SecondarySidebar) and mobile (off-canvas drawer).
- const secondarySidebar = isCompanySettingsRoute ? (
+ // Most contextual routes replace the global navigation inside the same
+ // sidebar shell. Skills, Apps, Agent details, and Routine details are the
+ // exceptions in Streamlined UI: their local navigation is a second rail
+ // beside the persistent company nav.
+ const sharedSecondarySidebar = isCompanySettingsRoute ? (
<CompanySettingsSidebar />
+ ) : !streamlinedUiEnabled && shellRoute.builtInContextualSurface === "skills" ? (
+ <SkillsContextualSidebar />
) : appDetailConnectionId ? (
<AppDetailSidebar kind="connection" connectionId={appDetailConnectionId} />
) : appDetailApplicationId ? (
@@ -181,14 +179,54 @@ export function Layout() {
) : isAppsRoute || isToolsRoute ? (
<AppsSidebar />
) : routeSidebarSlot ? (
- <PluginSlotMount
- slot={routeSidebarSlot}
- context={sidebarContext}
- className="h-full w-full"
- missingBehavior="placeholder"
- />
+ streamlinedUiEnabled ? (
+ <ContextualSidebarFrame
+ surface={`plugin:${routeSidebarSlot.id}`}
+ title={routeSidebarSlot.displayName}
+ >
+ <PluginSlotMount
+ slot={routeSidebarSlot}
+ context={sidebarContext}
+ className="min-h-0 flex-1"
+ missingBehavior="placeholder"
+ />
+ </ContextualSidebarFrame>
+ ) : (
+ <PluginSlotMount
+ slot={routeSidebarSlot}
+ context={sidebarContext}
+ className="h-full w-full"
+ missingBehavior="placeholder"
+ />
+ )
) : null;
+ const secondarySidebar = streamlinedUiEnabled && shellRoute.builtInContextualSurface === "agent" && agentId ? (
+ <AgentContextualSidebar agentRef={agentId} />
+ ) : streamlinedUiEnabled && shellRoute.builtInContextualSurface === "routine" && routineId ? (
+ <RoutineContextualSidebar routineId={routineId} />
+ ) : streamlinedUiEnabled && shellRoute.builtInContextualSurface === "skills" ? (
+ <SkillsContextualSidebar />
+ ) : sharedSecondarySidebar;
const hasSecondarySidebar = secondarySidebar != null;
+ const keepsPrimarySidebar = streamlinedUiEnabled && hasSecondarySidebar && (
+ shellRoute.builtInContextualSurface === "settings"
+ || shellRoute.builtInContextualSurface === "skills"
+ || shellRoute.builtInContextualSurface === "agent"
+ || shellRoute.builtInContextualSurface === "routine"
+ || isAppsRoute
+ || isToolsRoute
+ );
+ const replacesPrimarySidebar = streamlinedUiEnabled && hasSecondarySidebar && !keepsPrimarySidebar;
+ const showsAdjacentSecondarySidebar = hasSecondarySidebar && (!streamlinedUiEnabled || keepsPrimarySidebar);
+ const contextualSurface: ContextualSidebarSurface | null = !streamlinedUiEnabled || !hasSecondarySidebar
+ ? null
+ : routeSidebarSlot && !shellRoute.builtInContextualSurface
+ ? `plugin:${routeSidebarSlot.id}`
+ : shellRoute.builtInContextualSurface;
+ const previousShellRoute = useRef<{
+ pathname: string;
+ surface: ContextualSidebarSurface | null;
+ } | null>(null);
const { data: health } = useQuery({
queryKey: queryKeys.health,
queryFn: () => healthApi.get(),
@@ -204,16 +242,28 @@ export function Layout() {
queryFn: () => instanceSettingsApi.getGeneral(),
}).data?.keyboardShortcuts === true;
- // A secondary sidebar always collapses the app sidebar to its rail (still
- // peek-able) — a hard invariant that overrides the user pin while the route
- // is active, but does NOT mutate the persisted preference. Clearing the force
- // on cleanup restores the user's expanded/collapsed choice when navigating
- // off the takeover route (PAP-10694).
- const forceRailCollapsed = hasSecondarySidebar || isSkillsRoute;
useLayoutEffect(() => {
- setForceCollapsed(forceRailCollapsed);
+ setForceCollapsed(!streamlinedUiEnabled && hasSecondarySidebar);
return () => setForceCollapsed(false);
- }, [forceRailCollapsed, setForceCollapsed]);
+ }, [hasSecondarySidebar, setForceCollapsed, streamlinedUiEnabled]);
+
+ useEffect(() => {
+ const previous = previousShellRoute.current;
+ if (
+ contextualSurface
+ && companyPrefix
+ && previous
+ && previous.surface !== contextualSurface
+ && previous.pathname !== location.pathname
+ ) {
+ rememberContextualSidebarOrigin({
+ surface: contextualSurface,
+ companyPrefix,
+ previousPathname: previous.pathname,
+ });
+ }
+ previousShellRoute.current = { pathname: location.pathname, surface: contextualSurface };
+ }, [companyPrefix, contextualSurface, location.pathname]);
useEffect(() => {
if (companiesLoading || onboardingTriggered.current) return;
@@ -291,15 +341,6 @@ export function Layout() {
]);
const togglePanel = togglePanelVisible;
- // Cmd/Ctrl+B: collapse/expand the pinned rail on desktop; on mobile keep
- // toggling the off-canvas drawer.
- const toggleCollapse = useCallback(() => {
- if (isMobile) {
- toggleSidebar();
- } else {
- toggleCollapsed();
- }
- }, [isMobile, toggleSidebar, toggleCollapsed]);
const openSearch = useCallback(() => {
document.dispatchEvent(new KeyboardEvent("keydown", {
key: "k",
@@ -412,7 +453,6 @@ export function Layout() {
onNewIssue: () => openNewIssue(),
onSearch: openSearch,
onToggleSidebar: toggleSidebar,
- onToggleCollapse: toggleCollapse,
onTogglePanel: togglePanel,
onShowShortcuts: () => setShortcutsOpen(true),
onGoToInbox: () => navigate("/inbox"),
@@ -611,44 +651,57 @@ export function Layout() {
>
<div className="flex flex-1 min-h-0 overflow-hidden">
<div className="w-60 shrink-0 overflow-hidden">
- {hasSecondarySidebar ? secondarySidebar : <Sidebar />}
+ {hasSecondarySidebar ? (
+ <SecondarySidebar>{secondarySidebar}</SecondarySidebar>
+ ) : (
+ <Sidebar />
+ )}
</div>
</div>
<SidebarAccountMenu
deploymentMode={health?.deploymentMode}
serverGit={health?.serverInfo?.git}
version={health?.version}
+ forceExpanded={replacesPrimarySidebar}
/>
</div>
) : (
<SidebarShell
open={sidebarOpen}
- collapsed={collapsed}
- peeking={peeking}
+ collapsed={replacesPrimarySidebar ? false : collapsed}
+ peeking={replacesPrimarySidebar ? false : peeking}
resizable
- onPanelMouseEnter={handlePanelPointerEnter}
- onPanelMouseLeave={handlePanelPointerLeave}
- onPanelFocusCapture={collapsed ? handlePanelFocus : undefined}
- onPanelBlurCapture={collapsed ? handlePanelBlur : undefined}
+ onPanelMouseEnter={replacesPrimarySidebar ? undefined : handlePanelPointerEnter}
+ onPanelMouseLeave={replacesPrimarySidebar ? undefined : handlePanelPointerLeave}
+ onPanelFocusCapture={!replacesPrimarySidebar && collapsed ? handlePanelFocus : undefined}
+ onPanelBlurCapture={!replacesPrimarySidebar && collapsed ? handlePanelBlur : undefined}
>
<div className="flex flex-1 min-h-0">
- <Sidebar />
+ {replacesPrimarySidebar ? (
+ <SecondarySidebar>{secondarySidebar}</SecondarySidebar>
+ ) : (
+ <Sidebar />
+ )}
</div>
<SidebarAccountMenu
deploymentMode={health?.deploymentMode}
serverGit={health?.serverInfo?.git}
version={health?.version}
+ forceExpanded={replacesPrimarySidebar}
/>
</SidebarShell>
)}
- {!isMobile && hasSecondarySidebar ? (
- <SecondarySidebar className="w-60 shrink-0">{secondarySidebar}</SecondarySidebar>
+ {!isMobile && showsAdjacentSecondarySidebar && !keepsPrimarySidebar ? (
+ <SecondarySidebar className="w-60 shrink-0">
+ {secondarySidebar}
+ </SecondarySidebar>
) : null}
<div className={cn("flex min-w-0 flex-col", isMobile ? "w-full" : "h-full flex-1")}>
<div
className={cn(
+ !isMobile && useStreamlinedTaskDetailShell && "hidden",
isMobile && "sticky top-0 z-20 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/85",
)}
>
@@ -660,8 +713,23 @@ export function Layout() {
</div>
) : null}
</div>
- <div className={cn(isMobile ? "block" : "flex flex-1 min-h-0")}>
- <main
+ <div className={cn(
+ isMobile ? "block" : "flex flex-1 min-h-0",
+ !isMobile && useStreamlinedTaskDetailShell && "streamlined-task-detail-surface",
+ )}>
+ {!isMobile && keepsPrimarySidebar ? (
+ <SecondarySidebar className="w-60 shrink-0 bg-background">
+ {secondarySidebar}
+ </SecondarySidebar>
+ ) : null}
+ <div className={cn(!isMobile && useStreamlinedTaskDetailShell ? "flex min-w-0 flex-1 flex-col" : "contents")}>
+ {!isMobile && useStreamlinedTaskDetailShell ? (
+ <>
+ <StandaloneBrowserControls mobile={false} />
+ <BreadcrumbBar taskDetailLayout />
+ </>
+ ) : null}
+ <main
id="main-content"
ref={mainContentRef}
tabIndex={-1}
@@ -681,6 +749,10 @@ export function Layout() {
}
className={cn(
"flex-1 p-4 outline-none md:p-6",
+ // The task thread owns its scrollable top spacing. Leaving the
+ // page shell's top padding in place creates a stationary dark
+ // strip below the breadcrumb while messages scroll behind it.
+ !isMobile && useStreamlinedTaskDetailShell && "pt-0 pr-0 md:pt-0 md:pr-0",
// Reserve the scrollbar gutter on desktop so pages whose height
// changes (e.g. switching skill-detail tabs) don't widen/shift
// when the vertical scrollbar appears or disappears (PAP-10907).
@@ -699,8 +771,9 @@ export function Layout() {
<Outlet />
</RouteErrorBoundary>
)}
- </main>
- <PropertiesPanel />
+ </main>
+ </div>
+ <PropertiesPanel taskDetailLayout={!isMobile && useStreamlinedTaskDetailShell} />
</div>
</div>
</div>
diff --git a/ui/src/components/LegacyIssuesList.tsx b/ui/src/components/LegacyIssuesList.tsx
new file mode 100644
index 0000000000..2e4e606701
--- /dev/null
+++ b/ui/src/components/LegacyIssuesList.tsx
@@ -0,0 +1,2377 @@
+import { startTransition, useDeferredValue, useEffect, useMemo, useState, useCallback, useRef } from "react";
+import type { ReactNode } from "react";
+import { useQueries, useQuery, useQueryClient } from "@tanstack/react-query";
+import { useVisibilityRefetchInterval } from "@/lib/polling";
+import { accessApi } from "../api/access";
+import { useDialogActions } from "../context/DialogContext";
+import { useCompany } from "../context/CompanyContext";
+import { Link, useNavigate } from "@/lib/router";
+import { executionWorkspacesApi } from "../api/execution-workspaces";
+import { issuesApi } from "../api/issues";
+import { authApi } from "../api/auth";
+import { instanceSettingsApi } from "../api/instanceSettings";
+import { queryKeys } from "../lib/queryKeys";
+import { useIssueExternalObjectSummaries } from "../hooks/useIssueExternalObjects";
+import {
+ shouldBlurPageSearchOnEnter,
+ shouldBlurPageSearchOnEscape,
+} from "../lib/keyboardShortcuts";
+import { formatAssigneeUserLabel } from "../lib/assignees";
+import { buildCompanyUserLabelMap, buildCompanyUserProfileMap } from "../lib/company-members";
+import { createIssueDetailPath, rememberIssueDetailLocationState, withIssueDetailHeaderSeed } from "../lib/issueDetailBreadcrumb";
+import { prefetchIssueDetailForNavigation } from "../lib/issueDetailCache";
+import {
+ buildSubIssueProgressSummary,
+ shouldRenderSubIssueProgressSummary,
+ type SubIssueProgressSummary,
+} from "../lib/issue-detail-subissues";
+import { groupBy } from "../lib/groupBy";
+import {
+ applyIssueFilters,
+ countActiveIssueFilters,
+ defaultIssueFilterState,
+ issueFilterLabel,
+ issuePriorityOrder,
+ normalizeIssueFilterState,
+ resolveIssueFilterWorkspaceId,
+ shouldIncludeIssueFilterWorkspaceOption,
+ issueStatusOrder,
+ type IssueFilterState,
+} from "../lib/issue-filters";
+import {
+ DEFAULT_INBOX_ISSUE_COLUMNS,
+ getAvailableInboxIssueColumns,
+ normalizeInboxIssueColumns,
+ resolveIssueWorkspaceName,
+ type InboxIssueColumn,
+} from "../lib/inbox";
+import { cn, formatDurationMs, formatTokens } from "../lib/utils";
+import { SHOW_TASK_PRIORITY_UI } from "../lib/ui-flags";
+import { collectSubtreeLiveCounts } from "../lib/liveIssueIds";
+import {
+ InboxIssueMetaLeading,
+ InboxIssueTrailingColumns,
+ IssueColumnPicker,
+ issueActivityText,
+ issueTrailingColumns,
+} from "./IssueColumns";
+import { StatusIcon } from "./StatusIcon";
+import { EmptyState } from "./EmptyState";
+import { Identity } from "./Identity";
+import { IssueGroupHeader } from "./IssueGroupHeader";
+import { IssueFiltersPopover } from "./IssueFiltersPopover";
+import { IssueRow } from "./IssueRow";
+import { PageSkeleton } from "./PageSkeleton";
+import { Button } from "@/components/ui/button";
+import { Input } from "@/components/ui/input";
+import { Popover, PopoverTrigger, PopoverContent } from "@/components/ui/popover";
+import { Collapsible, CollapsibleContent } from "@/components/ui/collapsible";
+import { CircleDot, Plus, ArrowUpDown, Layers, Check, ChevronRight, List, ListTree, User, Search, CircleSlash2, ChevronsDownUp, PanelTopClose, RotateCcw, ListCollapse,
+ SquareKanban,
+} from "lucide-react";
+import {
+ KanbanBoard,
+ KANBAN_BOARD_HIGH_VOLUME_THRESHOLD,
+ KANBAN_COLD_STATUSES,
+ KANBAN_COLUMN_DEFAULT_PAGE_SIZE,
+ KANBAN_COLUMN_PAGE_SIZE_OPTIONS,
+ type KanbanColumnPageSize,
+} from "./KanbanBoard";
+import { buildIssueTree, countDescendants } from "../lib/issue-tree";
+import { getInboxKeyboardSelectionIndex } from "../lib/inbox";
+import { hasBlockingShortcutDialog, isKeyboardShortcutTextInputTarget } from "../lib/keyboardShortcuts";
+import { useGeneralSettings } from "../context/GeneralSettingsContext";
+import { buildSubIssueDefaultsForViewer } from "../lib/subIssueDefaults";
+import { statusBadge } from "../lib/status-colors";
+import { workflowSort } from "../lib/workflow-sort";
+import { isSuccessfulRunHandoffRequired } from "../lib/successful-run-handoff";
+import { deriveOriginatingActor, ISSUE_STATUSES, type Issue, type IssueStatus, type Project } from "@paperclipai/shared";
+import { Badge } from "@/components/ui/badge";
+const ISSUE_SEARCH_DEBOUNCE_MS = 250;
+const ISSUE_SEARCH_RESULT_LIMIT = 200;
+const ISSUE_BOARD_COLUMN_RESULT_LIMIT = 200;
+type IssuesListNavEntry =
+ | { type: "group"; key: string; collapsed: boolean }
+ | { type: "issue"; issue: Issue; hasChildren: boolean; expanded: boolean; budgetOrdinal: number };
+
+function issuesListNavEntryKey(entry: IssuesListNavEntry): string {
+ return entry.type === "group" ? `group:${entry.key}` : `issue:${entry.issue.id}`;
+}
+
+// CSS.escape is missing in some non-browser environments (jsdom tests).
+function escapeAttrValue(value: string): string {
+ return typeof CSS !== "undefined" && typeof CSS.escape === "function"
+ ? CSS.escape(value)
+ : value.replace(/["\\]/g, "\\$&");
+}
+
+const INITIAL_ISSUE_ROW_RENDER_LIMIT = 100;
+const ISSUE_ROW_RENDER_BATCH_SIZE = 150;
+const ISSUE_SCROLL_LOAD_THRESHOLD_PX = 320;
+
+function findIssuesScrollContainer(element: HTMLElement | null): HTMLElement | null {
+ if (!element || typeof window === "undefined") return null;
+ let current = element.parentElement;
+ while (current && current !== document.body && current !== document.documentElement) {
+ const overflowY = window.getComputedStyle(current).overflowY;
+ if (overflowY === "auto" || overflowY === "scroll" || overflowY === "overlay") {
+ return current;
+ }
+ current = current.parentElement;
+ }
+ return null;
+}
+const boardIssueStatuses = ISSUE_STATUSES;
+const issueStatusLabels: Record<IssueStatus, string> = {
+ backlog: "Backlog",
+ todo: "Todo",
+ in_progress: "In progress",
+ in_review: "In review",
+ done: "Done",
+ blocked: "Blocked",
+ cancelled: "Cancelled",
+};
+const progressSegmentClasses: Record<IssueStatus, string> = {
+ backlog: "bg-muted-foreground/40",
+ todo: "bg-blue-500",
+ in_progress: "bg-yellow-500",
+ in_review: "bg-violet-500",
+ done: "bg-green-500",
+ blocked: "bg-red-500",
+ cancelled: "bg-neutral-400",
+};
+
+/* ── View state ── */
+
+export type IssueSortField = "status" | "priority" | "title" | "created" | "updated" | "workflow";
+export type BoardCardDensity = "auto" | "compact" | "comfortable";
+export type BoardColdLaneMode = "auto" | "collapsed" | "expanded";
+export type BoardColumnPageSize = KanbanColumnPageSize;
+
+export type IssueViewState = IssueFilterState & {
+ sortField: IssueSortField;
+ sortDir: "asc" | "desc";
+ groupBy: "status" | "priority" | "assignee" | "project" | "workspace" | "parent" | "none";
+ viewMode: "list" | "board";
+ nestingEnabled: boolean;
+ collapsedGroups: string[];
+ collapsedParents: string[];
+ boardCardDensity: BoardCardDensity;
+ boardColdLaneMode: BoardColdLaneMode;
+ boardColumnPageSize: BoardColumnPageSize;
+};
+
+const defaultViewState: IssueViewState = {
+ ...defaultIssueFilterState,
+ sortField: "updated",
+ sortDir: "desc",
+ groupBy: "none",
+ viewMode: "list",
+ nestingEnabled: true,
+ collapsedGroups: [],
+ collapsedParents: [],
+ boardCardDensity: "auto",
+ boardColdLaneMode: "expanded",
+ boardColumnPageSize: KANBAN_COLUMN_DEFAULT_PAGE_SIZE,
+};
+
+function normalizeBoardCardDensity(value: unknown): BoardCardDensity {
+ return value === "compact" || value === "comfortable" || value === "auto" ? value : "auto";
+}
+
+function normalizeBoardColdLaneMode(value: unknown): BoardColdLaneMode {
+ return value === "collapsed" || value === "expanded" || value === "auto" ? value : "auto";
+}
+
+function normalizeBoardColumnPageSize(value: unknown): BoardColumnPageSize {
+ return KANBAN_COLUMN_PAGE_SIZE_OPTIONS.includes(value as BoardColumnPageSize)
+ ? value as BoardColumnPageSize
+ : KANBAN_COLUMN_DEFAULT_PAGE_SIZE;
+}
+
+function getViewState(key: string): IssueViewState {
+ try {
+ const raw = localStorage.getItem(key);
+ if (raw) {
+ const parsed = JSON.parse(raw);
+ return {
+ ...defaultViewState,
+ ...parsed,
+ ...normalizeIssueFilterState(parsed),
+ boardCardDensity: normalizeBoardCardDensity(parsed.boardCardDensity),
+ boardColdLaneMode: normalizeBoardColdLaneMode(parsed.boardColdLaneMode),
+ boardColumnPageSize: normalizeBoardColumnPageSize(parsed.boardColumnPageSize),
+ };
+ }
+ } catch { /* ignore */ }
+ return { ...defaultViewState };
+}
+
+function saveViewState(key: string, state: IssueViewState) {
+ localStorage.setItem(key, JSON.stringify(state));
+}
+
+function getInitialViewState(
+ key: string,
+ initialAssignees?: string[],
+ defaultSortField?: IssueSortField,
+): IssueViewState {
+ const hasStored = hasStoredViewState(key);
+ const stored = getViewState(key);
+ const base = !hasStored && defaultSortField
+ ? { ...stored, sortField: defaultSortField, sortDir: "asc" as const }
+ : stored;
+ if (!initialAssignees) return base;
+ return {
+ ...base,
+ assignees: initialAssignees,
+ statuses: [],
+ };
+}
+
+function getInitialWorkspaceViewState(
+ key: string,
+ initialAssignees?: string[],
+ initialWorkspaces?: string[],
+ defaultSortField?: IssueSortField,
+): IssueViewState {
+ const stored = getInitialViewState(key, initialAssignees, defaultSortField);
+ if (!initialWorkspaces) return stored;
+ return {
+ ...stored,
+ workspaces: initialWorkspaces,
+ statuses: [],
+ };
+}
+
+function hasStoredViewState(key: string): boolean {
+ try {
+ return localStorage.getItem(key) !== null;
+ } catch {
+ return false;
+ }
+}
+
+function getIssueColumnsStorageKey(key: string): string {
+ return `${key}:issue-columns`;
+}
+
+function loadIssueColumns(key: string): InboxIssueColumn[] {
+ try {
+ const raw = localStorage.getItem(getIssueColumnsStorageKey(key));
+ if (raw === null) return DEFAULT_INBOX_ISSUE_COLUMNS;
+ const parsed = JSON.parse(raw);
+ if (!Array.isArray(parsed)) return DEFAULT_INBOX_ISSUE_COLUMNS;
+ return normalizeInboxIssueColumns(parsed);
+ } catch {
+ return DEFAULT_INBOX_ISSUE_COLUMNS;
+ }
+}
+
+function saveIssueColumns(key: string, columns: InboxIssueColumn[]) {
+ try {
+ localStorage.setItem(
+ getIssueColumnsStorageKey(key),
+ JSON.stringify(normalizeInboxIssueColumns(columns)),
+ );
+ } catch {
+ // Ignore localStorage failures.
+ }
+}
+
+function sortIssues(issues: Issue[], state: IssueViewState): Issue[] {
+ if (state.sortField === "workflow") {
+ const ordered = workflowSort(issues);
+ return state.sortDir === "desc" ? [...ordered].reverse() : ordered;
+ }
+ const sorted = [...issues];
+ const dir = state.sortDir === "asc" ? 1 : -1;
+ sorted.sort((a, b) => {
+ switch (state.sortField) {
+ case "status":
+ return dir * (issueStatusOrder.indexOf(a.status) - issueStatusOrder.indexOf(b.status));
+ case "priority":
+ return dir * (issuePriorityOrder.indexOf(a.priority) - issuePriorityOrder.indexOf(b.priority));
+ case "title":
+ return dir * a.title.localeCompare(b.title);
+ case "created":
+ return dir * (new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime());
+ case "updated":
+ return dir * (new Date(a.updatedAt).getTime() - new Date(b.updatedAt).getTime());
+ default:
+ return 0;
+ }
+ });
+ return sorted;
+}
+
+const AGE_BUCKET_DAY_MS = 24 * 60 * 60 * 1000;
+const AGE_BUCKET_WEEK_MS = 7 * AGE_BUCKET_DAY_MS;
+
+// Recency buckets for the date separators shown in date-sorted lists:
+// 0 = within the last day, 1 = within the last week, 2 = older than a week.
+// A separator is drawn between rows whenever the bucket increases, so the
+// "1 day" and "1 week" boundaries appear as the list ages downward.
+export function issueAgeBucket(date: Date | string, now: number = Date.now()): 0 | 1 | 2 {
+ const age = now - new Date(date).getTime();
+ if (age < AGE_BUCKET_DAY_MS) return 0;
+ if (age < AGE_BUCKET_WEEK_MS) return 1;
+ return 2;
+}
+
+export function issueAgeSeparatorLabel(bucket: 1 | 2): string {
+ return bucket === 1 ? "Older than a day" : "Older than a week";
+}
+
+export function issueAgeBucketsCrossed(
+ previousBucket: 0 | 1 | 2,
+ currentBucket: 0 | 1 | 2,
+): Array<1 | 2> {
+ const crossedBuckets: Array<1 | 2> = [];
+ if (previousBucket < 1 && currentBucket >= 1) crossedBuckets.push(1);
+ if (previousBucket < 2 && currentBucket >= 2) crossedBuckets.push(2);
+ return crossedBuckets;
+}
+
+// Only recency sorts (newest first) get date separators — for any other
+// sort/direction the boundaries would be meaningless.
+function issueDateSeparatorField(state: IssueViewState): "createdAt" | "updatedAt" | null {
+ if (state.sortDir !== "desc") return null;
+ if (state.sortField === "created") return "createdAt";
+ if (state.sortField === "updated") return "updatedAt";
+ return null;
+}
+
+function IssueDateSeparator({ label }: { label: string }) {
+ return (
+ <div
+ className="flex items-center gap-2 px-3 py-1.5 sm:pl-0 sm:pr-4"
+ role="separator"
+ aria-label={label}
+ data-issues-date-separator=""
+ >
+ <div className="h-px flex-1 bg-border" />
+ <span className="text-(length:--text-nano) font-medium uppercase tracking-wider text-muted-foreground">
+ {label}
+ </span>
+ <div className="h-px flex-1 bg-border" />
+ </div>
+ );
+}
+
+function issueMatchesLocalSearch(issue: Issue, normalizedSearch: string): boolean {
+ if (!normalizedSearch) return true;
+ return [
+ issue.identifier,
+ issue.title,
+ issue.description,
+ ].some((value) => value?.toLowerCase().includes(normalizedSearch));
+}
+
+function isActionableWorkflowStatus(status: IssueStatus): boolean {
+ return status !== "done" && status !== "cancelled" && status !== "blocked";
+}
+
+function buildChecklistStepNumberMap(issues: Issue[], nestingEnabled: boolean): Map<string, string> {
+ const stepNumberByIssueId = new Map<string, string>();
+
+ if (!nestingEnabled) {
+ issues.forEach((issue, index) => {
+ stepNumberByIssueId.set(issue.id, String(index + 1));
+ });
+ return stepNumberByIssueId;
+ }
+
+ const { roots, childMap } = buildIssueTree(issues);
+ const visit = (siblings: Issue[], prefix: string | null) => {
+ siblings.forEach((issue, index) => {
+ const stepNumber = prefix ? `${prefix}.${index + 1}` : String(index + 1);
+ stepNumberByIssueId.set(issue.id, stepNumber);
+ visit(childMap.get(issue.id) ?? [], stepNumber);
+ });
+ };
+ visit(roots, null);
+
+ issues.forEach((issue, index) => {
+ if (!stepNumberByIssueId.has(issue.id)) {
+ stepNumberByIssueId.set(issue.id, String(index + 1));
+ }
+ });
+
+ return stepNumberByIssueId;
+}
+
+function buildPreviousSiblingIssueIdMap(issues: Issue[], nestingEnabled: boolean): Map<string, string> {
+ const previousSiblingByIssueId = new Map<string, string>();
+
+ if (!nestingEnabled) {
+ const previousByParentId = new Map<string, Issue>();
+ for (const issue of issues) {
+ if (!issue.parentId) continue;
+ const previousSibling = previousByParentId.get(issue.parentId);
+ if (previousSibling) {
+ previousSiblingByIssueId.set(issue.id, previousSibling.id);
+ }
+ previousByParentId.set(issue.parentId, issue);
+ }
+ return previousSiblingByIssueId;
+ }
+
+ const { roots, childMap } = buildIssueTree(issues);
+ const visit = (siblings: Issue[]) => {
+ siblings.forEach((issue, index) => {
+ const previousSibling = index > 0 ? siblings[index - 1] : null;
+ if (issue.parentId && previousSibling?.parentId === issue.parentId) {
+ previousSiblingByIssueId.set(issue.id, previousSibling.id);
+ }
+ visit(childMap.get(issue.id) ?? []);
+ });
+ };
+ visit(roots);
+
+ return previousSiblingByIssueId;
+}
+
+function shouldSuppressSinglePreviousSiblingBlockerChip(
+ issue: Issue,
+ unresolvedVisibleBlockerIds: string[],
+ previousSiblingIssueId: string | undefined,
+): boolean {
+ return Boolean(
+ issue.parentId
+ && previousSiblingIssueId
+ && (issue.blockedBy ?? []).length === 1
+ && unresolvedVisibleBlockerIds.length === 1
+ && unresolvedVisibleBlockerIds[0] === previousSiblingIssueId,
+ );
+}
+
+/* ── Component ── */
+
+interface Agent {
+ id: string;
+ name: string;
+}
+
+type CreatorOption = {
+ id: string;
+ label: string;
+ kind: "agent" | "user";
+ searchText?: string;
+};
+
+type ProjectOption = Pick<Project, "id" | "name"> & Partial<Pick<Project, "color" | "workspaces" | "executionWorkspacePolicy" | "primaryWorkspace">>;
+type IssueListRequestFilters = NonNullable<Parameters<typeof issuesApi.list>[1]>;
+
+interface IssuesListProps {
+ issues: Issue[];
+ isLoading?: boolean;
+ error?: Error | null;
+ agents?: Agent[];
+ projects?: ProjectOption[];
+ liveIssueIds?: Set<string>;
+ projectId?: string;
+ viewStateKey: string;
+ issueLinkState?: unknown;
+ initialAssignees?: string[];
+ initialWorkspaces?: string[];
+ initialSearch?: string;
+ searchFilters?: Omit<IssueListRequestFilters, "q" | "projectId" | "limit" | "includeRoutineExecutions">;
+ searchWithinLoadedIssues?: boolean;
+ baseCreateIssueDefaults?: Record<string, unknown>;
+ createIssueLabel?: string;
+ defaultSortField?: IssueSortField;
+ showProgressSummary?: boolean;
+ /**
+ * When set together with `showProgressSummary`, the progress strip fetches
+ * the recursive cost-summary for this parent issue and renders aggregate
+ * tokens + wall-clock runtime for every run in the tree.
+ */
+ parentIssueIdForCostSummary?: string;
+ enableRoutineVisibilityFilter?: boolean;
+ hasMoreIssues?: boolean;
+ isLoadingMoreIssues?: boolean;
+ mutedIssueIds?: Set<string>;
+ issueBadgeById?: Map<string, string>;
+ onLoadMoreIssues?: () => void;
+ onSearchChange?: (search: string) => void;
+ onUpdateIssue: (id: string, data: Record<string, unknown>) => void;
+}
+
+function IssueSearchInput({
+ value,
+ onDebouncedChange,
+}: {
+ value: string;
+ onDebouncedChange?: (search: string) => void;
+}) {
+ const [draftValue, setDraftValue] = useState(value);
+ const lastCommittedValueRef = useRef(value);
+
+ useEffect(() => {
+ setDraftValue(value);
+ lastCommittedValueRef.current = value;
+ }, [value]);
+
+ useEffect(() => {
+ if (!onDebouncedChange || draftValue === lastCommittedValueRef.current) return;
+
+ const timeoutId = window.setTimeout(() => {
+ lastCommittedValueRef.current = draftValue;
+ startTransition(() => {
+ onDebouncedChange(draftValue);
+ });
+ }, ISSUE_SEARCH_DEBOUNCE_MS);
+
+ return () => window.clearTimeout(timeoutId);
+ }, [draftValue, onDebouncedChange]);
+
+ return (
+ <div className="relative w-48 sm:w-64 md:w-80">
+ <Search className="pointer-events-none absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" />
+ <Input
+ value={draftValue}
+ onChange={(e) => {
+ setDraftValue(e.target.value);
+ }}
+ onKeyDown={(e) => {
+ if (shouldBlurPageSearchOnEnter({
+ key: e.key,
+ isComposing: e.nativeEvent.isComposing,
+ })) {
+ e.currentTarget.blur();
+ return;
+ }
+
+ if (shouldBlurPageSearchOnEscape({
+ key: e.key,
+ isComposing: e.nativeEvent.isComposing,
+ currentValue: e.currentTarget.value,
+ })) {
+ e.currentTarget.blur();
+ }
+ }}
+ placeholder="Search tasks..."
+ className="pl-7 text-xs sm:text-sm"
+ aria-label="Search tasks"
+ data-page-search-target="true"
+ />
+ </div>
+ );
+}
+
+function SubIssueProgressSummaryStrip({
+ summary,
+ issueLinkState,
+ parentIssueIdForCostSummary,
+}: {
+ summary: SubIssueProgressSummary;
+ issueLinkState?: unknown;
+ parentIssueIdForCostSummary?: string;
+}) {
+ const target = summary.target;
+ const targetIssue = target?.issue ?? null;
+ const targetPathId = targetIssue?.identifier ?? targetIssue?.id ?? "";
+ const targetState = targetIssue ? withIssueDetailHeaderSeed(issueLinkState, targetIssue) : undefined;
+ const statusEntries = ISSUE_STATUSES
+ .map((status) => ({ status, count: summary.countsByStatus[status] ?? 0 }))
+ .filter((entry) => entry.count > 0);
+
+ // Refresh fast enough that the runtime ticks up while a sub-issue is still
+ // running, but slow enough not to hammer the recursive CTE on idle trees.
+ const hasInProgress = summary.inProgressCount > 0;
+ const costRefetchInterval = useVisibilityRefetchInterval({ visibleMs: 5_000 });
+ const { data: costSummary } = useQuery({
+ queryKey: queryKeys.issues.costSummary(parentIssueIdForCostSummary ?? "pending", { excludeRoot: true }),
+ queryFn: () => issuesApi.getCostSummary(parentIssueIdForCostSummary!, { excludeRoot: true }),
+ enabled: !!parentIssueIdForCostSummary,
+ refetchInterval: hasInProgress ? costRefetchInterval : false,
+ });
+
+ const totalTokens = costSummary
+ ? costSummary.inputTokens + costSummary.cachedInputTokens + costSummary.outputTokens
+ : 0;
+ const showCostSummary = !!costSummary && (costSummary.runCount > 0 || totalTokens > 0);
+
+ return (
+ <div className="border border-border bg-background p-3">
+ <div className="flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between">
+ <div className="min-w-0 flex-1 space-y-2">
+ <div className="flex flex-wrap items-center gap-x-4 gap-y-1 text-sm">
+ <span className="font-medium text-foreground">
+ {summary.doneCount}/{summary.totalCount} done
+ </span>
+ <span className="text-muted-foreground">
+ {summary.inProgressCount} in progress
+ </span>
+ <span className="text-muted-foreground">
+ {summary.blockedCount} blocked
+ </span>
+ {showCostSummary && (
+ <>
+ <span
+ className="text-muted-foreground tabular-nums"
+ title={`${costSummary.runCount.toLocaleString()} run${
+ costSummary.runCount === 1 ? "" : "s"
+ } across ${costSummary.issueCount} sub-task${
+ costSummary.issueCount === 1 ? "" : "s"
+ }`}
+ >
+ {formatTokens(totalTokens)} tokens
+ </span>
+ <span className="text-muted-foreground tabular-nums">
+ {formatDurationMs(costSummary.runtimeMs)} runtime
+ </span>
+ </>
+ )}
+ </div>
+ <div
+ role="progressbar"
+ aria-label="Sub-tasks completion progress"
+ aria-valuemin={0}
+ aria-valuenow={summary.doneCount}
+ aria-valuemax={summary.totalCount}
+ className="flex h-2 w-full overflow-hidden rounded-full bg-muted"
+ >
+ {statusEntries.map(({ status, count }) => (
+ <span
+ key={status}
+ className={cn("h-full", progressSegmentClasses[status])}
+ style={{ width: `${(count / summary.totalCount) * 100}%` }}
+ title={`${issueStatusLabels[status]}: ${count}`}
+ aria-hidden="true"
+ />
+ ))}
+ </div>
+ </div>
+
+ <div className="min-w-0 border border-border bg-background px-3 py-2 text-sm lg:w-72">
+ {target && targetIssue ? (
+ <>
+ <div className="text-xs font-medium text-muted-foreground">
+ {target.kind === "next" ? "Next up" : "Waiting on blockers"}
+ </div>
+ <Link
+ to={createIssueDetailPath(targetPathId)}
+ state={targetState}
+ issuePrefetch={targetIssue}
+ className="mt-1 block min-w-0 text-foreground underline-offset-2 hover:underline"
+ >
+ <span className="font-mono text-xs text-muted-foreground">
+ {targetIssue.identifier ?? targetIssue.id.slice(0, 8)}
+ </span>{" "}
+ <span>{targetIssue.title}</span>
+ </Link>
+ </>
+ ) : summary.totalCount === 0 ? (
+ <div className="text-sm font-medium text-foreground">No active sub-tasks</div>
+ ) : summary.doneCount === summary.totalCount ? (
+ <div className="text-sm font-medium text-foreground">All sub-tasks done</div>
+ ) : (
+ <div className="text-sm font-medium text-foreground">No actionable sub-tasks</div>
+ )}
+ </div>
+ </div>
+ </div>
+ );
+}
+
+// Mobile-only indent for nested task rows (desktop uses IssueRow treeGuides).
+const MOBILE_TREE_INDENT = ["", "pl-4 sm:pl-0", "pl-8 sm:pl-0", "pl-12 sm:pl-0", "pl-16 sm:pl-0"];
+
+export function IssuesList({
+ issues,
+ isLoading,
+ error,
+ agents,
+ projects,
+ liveIssueIds,
+ projectId,
+ viewStateKey,
+ issueLinkState,
+ initialAssignees,
+ initialWorkspaces,
+ initialSearch,
+ searchFilters,
+ searchWithinLoadedIssues = false,
+ baseCreateIssueDefaults,
+ createIssueLabel,
+ defaultSortField,
+ showProgressSummary = false,
+ parentIssueIdForCostSummary,
+ enableRoutineVisibilityFilter = false,
+ hasMoreIssues = false,
+ isLoadingMoreIssues = false,
+ mutedIssueIds,
+ issueBadgeById,
+ onLoadMoreIssues,
+ onSearchChange,
+ onUpdateIssue,
+}: IssuesListProps) {
+ const rootRef = useRef<HTMLDivElement | null>(null);
+ const navigate = useNavigate();
+ const queryClient = useQueryClient();
+ const { keyboardShortcutsEnabled } = useGeneralSettings();
+ // Keyboard selection for the list view (mirrors the inbox). Hover moves the
+ // selection only after real pointer movement, so keyboard-driven scrolling
+ // doesn't hand the selection to whatever row lands under the cursor.
+ const [selectedNavKey, setSelectedNavKey] = useState<string | null>(null);
+ const pointerMovedSinceKeyNavRef = useRef(true);
+ useEffect(() => {
+ const handlePointerMove = () => {
+ pointerMovedSinceKeyNavRef.current = true;
+ };
+ window.addEventListener("mousemove", handlePointerMove, { passive: true });
+ return () => window.removeEventListener("mousemove", handlePointerMove);
+ }, []);
+ // Which entry the cursor is over, tracked WITHOUT React state so scrubbing the
+ // list costs zero re-renders (hover paints via CSS `:hover`). Keyboard nav
+ // reads this to continue from the hovered row. Key-based, so it self-heals if
+ // the entry disappears (findIndex → -1).
+ const hoveredNavKeyRef = useRef<string | null>(null);
+ const setNavSelectionFromPointer = useCallback((navKey: string) => {
+ if (!pointerMovedSinceKeyNavRef.current) return;
+ hoveredNavKeyRef.current = navKey;
+ // Drop any keyboard selection band the moment the mouse takes over, so we
+ // never show two identical highlights at once. React bails when already
+ // null, so continuous hovering triggers no re-render.
+ setSelectedNavKey((prev) => (prev === null ? prev : null));
+ }, []);
+ const { selectedCompanyId } = useCompany();
+ const { openNewIssue } = useDialogActions();
+ const { data: session } = useQuery({
+ queryKey: queryKeys.auth.session,
+ queryFn: () => authApi.getSession(),
+ });
+ const { data: companyMembers } = useQuery({
+ queryKey: queryKeys.access.companyUserDirectory(selectedCompanyId!),
+ queryFn: () => accessApi.listUserDirectory(selectedCompanyId!),
+ enabled: !!selectedCompanyId,
+ });
+ const { data: experimentalSettings } = useQuery({
+ queryKey: queryKeys.instance.experimentalSettings,
+ queryFn: () => instanceSettingsApi.getExperimental(),
+ retry: false,
+ });
+ const currentUserId = session?.user?.id ?? session?.session?.userId ?? null;
+ const experimentalSettingsLoaded = experimentalSettings !== undefined;
+ const isolatedWorkspacesEnabled = experimentalSettings?.enableIsolatedWorkspaces === true;
+ const externalObjectsEnabled = experimentalSettings?.enableExternalObjects === true;
+
+ // Scope the storage key per company so folding/view state is independent across companies.
+ const scopedKey = selectedCompanyId ? `${viewStateKey}:${selectedCompanyId}` : viewStateKey;
+ const initialAssigneesKey = initialAssignees?.join("|") ?? "";
+ const initialWorkspacesKey = initialWorkspaces?.join("|") ?? "";
+
+ const [viewState, setViewState] = useState<IssueViewState>(() =>
+ getInitialWorkspaceViewState(scopedKey, initialAssignees, initialWorkspaces, defaultSortField),
+ );
+ const [assigneePickerIssueId, setAssigneePickerIssueId] = useState<string | null>(null);
+ const [assigneeSearch, setAssigneeSearch] = useState("");
+ const [issueSearch, setIssueSearch] = useState(initialSearch ?? "");
+ const [renderedIssueRowLimit, setRenderedIssueRowLimit] = useState(INITIAL_ISSUE_ROW_RENDER_LIMIT);
+ const [visibleIssueColumns, setVisibleIssueColumns] = useState<InboxIssueColumn[]>(() => loadIssueColumns(scopedKey));
+ const renderedIssueIdsRef = useRef("");
+ const initialServerFillRequestedRef = useRef(false);
+ const deferredIssueSearch = useDeferredValue(issueSearch);
+ const normalizedIssueSearch = deferredIssueSearch.trim().toLowerCase();
+
+ useEffect(() => {
+ setIssueSearch(initialSearch ?? "");
+ }, [initialSearch]);
+
+ // Reload view state whenever the persisted context changes.
+ const prevViewStateContextKey = useRef(`${scopedKey}::${initialAssigneesKey}::${initialWorkspacesKey}`);
+ useEffect(() => {
+ const nextContextKey = `${scopedKey}::${initialAssigneesKey}::${initialWorkspacesKey}`;
+ if (prevViewStateContextKey.current !== nextContextKey) {
+ prevViewStateContextKey.current = nextContextKey;
+ setViewState(getInitialWorkspaceViewState(scopedKey, initialAssignees, initialWorkspaces, defaultSortField));
+ }
+ }, [scopedKey, initialAssignees, initialAssigneesKey, initialWorkspaces, initialWorkspacesKey, defaultSortField]);
+
+ const prevColumnsScopedKey = useRef(scopedKey);
+ useEffect(() => {
+ if (prevColumnsScopedKey.current !== scopedKey) {
+ prevColumnsScopedKey.current = scopedKey;
+ setVisibleIssueColumns(loadIssueColumns(scopedKey));
+ }
+ }, [scopedKey]);
+
+ const updateView = useCallback((patch: Partial<IssueViewState>) => {
+ setViewState((prev) => {
+ const next = { ...prev, ...patch };
+ saveViewState(scopedKey, next);
+ return next;
+ });
+ }, [scopedKey]);
+
+ useEffect(() => {
+ if (!experimentalSettingsLoaded || externalObjectsEnabled || viewState.externalObjectStatuses.length === 0) return;
+ updateView({ externalObjectStatuses: [] });
+ }, [experimentalSettingsLoaded, externalObjectsEnabled, updateView, viewState.externalObjectStatuses.length]);
+
+ // Prune stale IDs from collapsedParents whenever the issue list changes.
+ // Deleted or reassigned issues leave orphan IDs in localStorage; this keeps
+ // the stored array bounded to only current parent IDs.
+ useEffect(() => {
+ const parentIds = new Set(issues.map((i) => i.parentId).filter(Boolean) as string[]);
+ const pruned = viewState.collapsedParents.filter((id) => parentIds.has(id));
+ if (pruned.length !== viewState.collapsedParents.length) {
+ updateView({ collapsedParents: pruned });
+ }
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [issues]);
+
+ const { data: searchedIssues = [] } = useQuery({
+ queryKey: [
+ ...queryKeys.issues.search(selectedCompanyId!, normalizedIssueSearch, projectId),
+ searchFilters ?? {},
+ "compact",
+ ISSUE_SEARCH_RESULT_LIMIT,
+ enableRoutineVisibilityFilter ? "with-routine-executions" : "without-routine-executions",
+ ],
+ queryFn: ({ signal }) =>
+ issuesApi.listCompact(selectedCompanyId!, {
+ q: normalizedIssueSearch,
+ projectId,
+ limit: ISSUE_SEARCH_RESULT_LIMIT,
+ ...searchFilters,
+ ...(enableRoutineVisibilityFilter ? { includeRoutineExecutions: true } : {}),
+ }, { signal }).then((rows) => rows as Issue[]),
+ enabled: !!selectedCompanyId && normalizedIssueSearch.length > 0 && !searchWithinLoadedIssues,
+ placeholderData: (previousData) => previousData,
+ });
+ const boardIssueQueries = useQueries({
+ queries: boardIssueStatuses.map((status) => ({
+ queryKey: [
+ ...queryKeys.issues.list(selectedCompanyId ?? "__no-company__"),
+ "board-column",
+ status,
+ normalizedIssueSearch,
+ projectId ?? "__all-projects__",
+ searchFilters ?? {},
+ "compact",
+ ISSUE_BOARD_COLUMN_RESULT_LIMIT,
+ enableRoutineVisibilityFilter ? "with-routine-executions" : "without-routine-executions",
+ ],
+ queryFn: ({ signal }: { signal: AbortSignal }) =>
+ issuesApi.listCompact(selectedCompanyId!, {
+ ...searchFilters,
+ ...(normalizedIssueSearch.length > 0 ? { q: normalizedIssueSearch } : {}),
+ projectId,
+ status,
+ limit: ISSUE_BOARD_COLUMN_RESULT_LIMIT,
+ ...(enableRoutineVisibilityFilter ? { includeRoutineExecutions: true } : {}),
+ }, { signal }).then((rows) => rows as Issue[]),
+ enabled: !!selectedCompanyId && viewState.viewMode === "board" && !searchWithinLoadedIssues,
+ placeholderData: (previousData: Issue[] | undefined) => previousData,
+ })),
+ });
+ const { data: executionWorkspaces = [] } = useQuery({
+ queryKey: selectedCompanyId
+ ? queryKeys.executionWorkspaces.summaryList(selectedCompanyId)
+ : ["execution-workspaces", "__disabled__"],
+ queryFn: () => executionWorkspacesApi.listSummaries(selectedCompanyId!),
+ enabled: !!selectedCompanyId && isolatedWorkspacesEnabled,
+ });
+
+ const agentName = useCallback((id: string | null) => {
+ if (!id || !agents) return null;
+ return agents.find((a) => a.id === id)?.name ?? null;
+ }, [agents]);
+
+ const companyUserLabelMap = useMemo(
+ () => buildCompanyUserLabelMap(companyMembers?.users),
+ [companyMembers?.users],
+ );
+ const companyUserProfileMap = useMemo(
+ () => buildCompanyUserProfileMap(companyMembers?.users),
+ [companyMembers?.users],
+ );
+
+ const projectById = useMemo(() => {
+ const map = new Map<string, { name: string; color: string | null }>();
+ for (const project of projects ?? []) {
+ map.set(project.id, { name: project.name, color: project.color ?? null });
+ }
+ return map;
+ }, [projects]);
+
+ const projectWorkspaceById = useMemo(() => {
+ const map = new Map<string, { name: string; projectId: string }>();
+ for (const project of projects ?? []) {
+ for (const workspace of project.workspaces ?? []) {
+ map.set(workspace.id, { name: workspace.name || project.name, projectId: project.id });
+ }
+ }
+ return map;
+ }, [projects]);
+
+ const defaultProjectWorkspaceIdByProjectId = useMemo(() => {
+ const map = new Map<string, string>();
+ for (const project of projects ?? []) {
+ const defaultWorkspaceId =
+ project.executionWorkspacePolicy?.defaultProjectWorkspaceId
+ ?? project.primaryWorkspace?.id
+ ?? null;
+ if (defaultWorkspaceId) map.set(project.id, defaultWorkspaceId);
+ }
+ return map;
+ }, [projects]);
+ const defaultProjectWorkspaceIds = useMemo(
+ () => new Set(defaultProjectWorkspaceIdByProjectId.values()),
+ [defaultProjectWorkspaceIdByProjectId],
+ );
+
+ const executionWorkspaceById = useMemo(() => {
+ const map = new Map<string, {
+ name: string;
+ mode: "shared_workspace" | "isolated_workspace" | "operator_branch" | "adapter_managed" | "cloud_sandbox";
+ projectWorkspaceId: string | null;
+ projectId: string | null;
+ }>();
+ for (const workspace of executionWorkspaces) {
+ const projectWorkspace = workspace.projectWorkspaceId
+ ? projectWorkspaceById.get(workspace.projectWorkspaceId) ?? null
+ : null;
+ map.set(workspace.id, {
+ name: workspace.name,
+ mode: workspace.mode,
+ projectWorkspaceId: workspace.projectWorkspaceId ?? null,
+ projectId: projectWorkspace?.projectId ?? null,
+ });
+ }
+ return map;
+ }, [executionWorkspaces, projectWorkspaceById]);
+ const issueFilterWorkspaceContext = useMemo(() => ({
+ executionWorkspaceById,
+ defaultProjectWorkspaceIdByProjectId,
+ }), [defaultProjectWorkspaceIdByProjectId, executionWorkspaceById]);
+
+ const workspaceNameMap = useMemo(() => {
+ const map = new Map<string, string>();
+ for (const [workspaceId, workspace] of projectWorkspaceById) {
+ if (!shouldIncludeIssueFilterWorkspaceOption({ id: workspaceId }, defaultProjectWorkspaceIds)) continue;
+ map.set(workspaceId, workspace.name);
+ }
+ for (const [workspaceId, workspace] of executionWorkspaceById) {
+ if (!shouldIncludeIssueFilterWorkspaceOption({
+ id: workspaceId,
+ mode: workspace.mode,
+ projectWorkspaceId: workspace.projectWorkspaceId,
+ }, defaultProjectWorkspaceIds)) continue;
+ map.set(workspaceId, workspace.name);
+ }
+ return map;
+ }, [defaultProjectWorkspaceIds, executionWorkspaceById, projectWorkspaceById]);
+
+ const workspaceOptions = useMemo(() => {
+ const options = new Map<string, string>();
+ for (const [workspaceId, workspaceName] of workspaceNameMap) {
+ options.set(workspaceId, workspaceName);
+ }
+ return [...options.entries()]
+ .sort((a, b) => a[1].localeCompare(b[1]))
+ .map(([id, name]) => ({ id, name }));
+ }, [workspaceNameMap]);
+
+ const creatorOptions = useMemo<CreatorOption[]>(() => {
+ const options = new Map<string, CreatorOption>();
+ const knownAgentIds = new Set<string>();
+
+ if (currentUserId) {
+ options.set(`user:${currentUserId}`, {
+ id: `user:${currentUserId}`,
+ label: currentUserId === "local-board" ? "Board" : "Me",
+ kind: "user",
+ searchText: currentUserId === "local-board" ? "board me human local-board" : `me board human ${currentUserId}`,
+ });
+ }
+
+ for (const issue of issues) {
+ if (issue.createdByUserId) {
+ const id = `user:${issue.createdByUserId}`;
+ if (!options.has(id)) {
+ options.set(id, {
+ id,
+ label: formatAssigneeUserLabel(issue.createdByUserId, currentUserId) ?? issue.createdByUserId.slice(0, 5),
+ kind: "user",
+ searchText: `${issue.createdByUserId} board user human`,
+ });
+ }
+ }
+ }
+
+ for (const agent of agents ?? []) {
+ knownAgentIds.add(agent.id);
+ const id = `agent:${agent.id}`;
+ if (!options.has(id)) {
+ options.set(id, {
+ id,
+ label: agent.name,
+ kind: "agent",
+ searchText: `${agent.name} ${agent.id} agent`,
+ });
+ }
+ }
+
+ for (const issue of issues) {
+ if (issue.createdByAgentId && !knownAgentIds.has(issue.createdByAgentId)) {
+ const id = `agent:${issue.createdByAgentId}`;
+ if (!options.has(id)) {
+ options.set(id, {
+ id,
+ label: issue.createdByAgentId.slice(0, 8),
+ kind: "agent",
+ searchText: `${issue.createdByAgentId} agent`,
+ });
+ }
+ }
+ }
+
+ return [...options.values()].sort((a, b) => {
+ if (a.kind !== b.kind) return a.kind === "user" ? -1 : 1;
+ return a.label.localeCompare(b.label);
+ });
+ }, [agents, currentUserId, issues]);
+
+ const visibleIssueColumnSet = useMemo(() => new Set(visibleIssueColumns), [visibleIssueColumns]);
+ const availableIssueColumns = useMemo(
+ () => getAvailableInboxIssueColumns(isolatedWorkspacesEnabled),
+ [isolatedWorkspacesEnabled],
+ );
+ const availableIssueColumnSet = useMemo(() => new Set(availableIssueColumns), [availableIssueColumns]);
+ const subtreeLiveCounts = useMemo(
+ () => collectSubtreeLiveCounts(issues, liveIssueIds ?? new Set<string>()),
+ [issues, liveIssueIds],
+ );
+ const visibleTrailingIssueColumns = useMemo(
+ () => issueTrailingColumns.filter((column) => visibleIssueColumnSet.has(column) && availableIssueColumnSet.has(column)),
+ [availableIssueColumnSet, visibleIssueColumnSet],
+ );
+
+ const issueById = useMemo(() => {
+ const map = new Map<string, Issue>();
+ for (const issue of issues) {
+ map.set(issue.id, issue);
+ }
+ return map;
+ }, [issues]);
+
+ const issueTitleMap = useMemo(() => {
+ const map = new Map<string, string>();
+ for (const issue of issues) {
+ map.set(issue.id, issue.identifier ? `${issue.identifier}: ${issue.title}` : issue.title);
+ }
+ return map;
+ }, [issues]);
+
+ const boardIssues = useMemo(() => {
+ if (viewState.viewMode !== "board" || searchWithinLoadedIssues) return null;
+ const merged = new Map<string, Issue>();
+ let isPending = false;
+ for (const query of boardIssueQueries) {
+ isPending ||= query.isPending;
+ for (const issue of query.data ?? []) {
+ merged.set(issue.id, issue);
+ }
+ }
+ if (merged.size > 0) return [...merged.values()];
+ return isPending ? issues : [];
+ }, [boardIssueQueries, issues, searchWithinLoadedIssues, viewState.viewMode]);
+ const boardColumnLimitReached = useMemo(
+ () =>
+ viewState.viewMode === "board" &&
+ !searchWithinLoadedIssues &&
+ boardIssueQueries.some((query) => (query.data?.length ?? 0) === ISSUE_BOARD_COLUMN_RESULT_LIMIT),
+ [boardIssueQueries, searchWithinLoadedIssues, viewState.viewMode],
+ );
+
+ const sourceIssues = useMemo(() => {
+ const useRemoteSearch = normalizedIssueSearch.length > 0 && !searchWithinLoadedIssues;
+ return boardIssues ?? (useRemoteSearch ? searchedIssues : issues);
+ }, [boardIssues, issues, normalizedIssueSearch, searchedIssues, searchWithinLoadedIssues]);
+
+ const searchScopedIssues = useMemo(
+ () => normalizedIssueSearch.length > 0 && searchWithinLoadedIssues
+ ? sourceIssues.filter((issue) => issueMatchesLocalSearch(issue, normalizedIssueSearch))
+ : sourceIssues,
+ [normalizedIssueSearch, searchWithinLoadedIssues, sourceIssues],
+ );
+ const hasExternalObjectStatusFilters = viewState.externalObjectStatuses.length > 0;
+ const issueIdsForExternalObjectSummaries = useMemo(
+ () => (viewState.viewMode === "list" || hasExternalObjectStatusFilters
+ ? searchScopedIssues.map((issue) => issue.id)
+ : []),
+ [hasExternalObjectStatusFilters, searchScopedIssues, viewState.viewMode],
+ );
+ const {
+ summaries: externalObjectSummaryByIssueId,
+ isLoading: externalObjectSummariesLoading,
+ isReady: externalObjectSummariesReady,
+ } = useIssueExternalObjectSummaries(
+ selectedCompanyId,
+ issueIdsForExternalObjectSummaries,
+ );
+ const issueFilterContext = useMemo(() => ({
+ ...issueFilterWorkspaceContext,
+ externalObjectSummaryByIssueId,
+ externalObjectSummariesReady: externalObjectSummariesReady && !externalObjectSummariesLoading,
+ }), [externalObjectSummariesLoading, externalObjectSummariesReady, externalObjectSummaryByIssueId, issueFilterWorkspaceContext]);
+ const externalObjectFilterLoading = hasExternalObjectStatusFilters
+ && externalObjectSummariesLoading
+ && !externalObjectSummariesReady;
+
+ const filtered = useMemo(() => {
+ const filteredByControls = applyIssueFilters(
+ searchScopedIssues,
+ viewState,
+ currentUserId,
+ enableRoutineVisibilityFilter,
+ liveIssueIds,
+ issueFilterContext,
+ );
+ return sortIssues(filteredByControls, viewState);
+ }, [
+ searchScopedIssues,
+ viewState,
+ currentUserId,
+ enableRoutineVisibilityFilter,
+ liveIssueIds,
+ issueFilterContext,
+ ]);
+
+ const progressSummary = useMemo(
+ () => shouldRenderSubIssueProgressSummary(showProgressSummary, issues.length)
+ ? buildSubIssueProgressSummary(issues)
+ : null,
+ [issues, showProgressSummary],
+ );
+ const checklistAffordanceEnabled = useMemo(
+ () =>
+ defaultSortField === "workflow"
+ && viewState.groupBy === "none",
+ [defaultSortField, viewState.groupBy],
+ );
+ const workflowChecklistMeta = useMemo(() => {
+ if (!checklistAffordanceEnabled) return null;
+
+ const visibleIssueIds = new Set(filtered.map((issue) => issue.id));
+ const stepNumberByIssueId = buildChecklistStepNumberMap(filtered, viewState.nestingEnabled);
+ const previousSiblingIssueIdByIssueId = buildPreviousSiblingIssueIdMap(filtered, viewState.nestingEnabled);
+ const unresolvedVisibleBlockersByIssueId = new Map<string, string[]>();
+
+ filtered.forEach((issue) => {
+ const unresolvedVisible = (issue.blockedBy ?? [])
+ .map((blocker) => blocker.id)
+ .filter((blockerId) => {
+ if (!visibleIssueIds.has(blockerId)) return false;
+ const blockerIssue = issueById.get(blockerId);
+ if (!blockerIssue) return false;
+ return blockerIssue.status !== "done" && blockerIssue.status !== "cancelled";
+ });
+ const shouldSuppressChip = shouldSuppressSinglePreviousSiblingBlockerChip(
+ issue,
+ unresolvedVisible,
+ previousSiblingIssueIdByIssueId.get(issue.id),
+ );
+ unresolvedVisibleBlockersByIssueId.set(issue.id, shouldSuppressChip ? [] : unresolvedVisible);
+ });
+
+ const firstActionable = filtered.find((issue) => isActionableWorkflowStatus(issue.status)) ?? null;
+ const currentStepIssue = firstActionable ?? filtered.find((issue) => issue.status === "blocked") ?? null;
+
+ return {
+ stepNumberByIssueId,
+ unresolvedVisibleBlockersByIssueId,
+ currentStepIssueId: currentStepIssue?.id ?? null,
+ };
+ }, [checklistAffordanceEnabled, filtered, issueById, viewState.nestingEnabled]);
+
+ const { data: labels } = useQuery({
+ queryKey: queryKeys.issues.labels(selectedCompanyId!),
+ queryFn: () => issuesApi.listLabels(selectedCompanyId!),
+ enabled: !!selectedCompanyId,
+ });
+
+ const activeFilterCount = countActiveIssueFilters(viewState, enableRoutineVisibilityFilter);
+ const boardHighVolume = viewState.viewMode === "board" && filtered.length > KANBAN_BOARD_HIGH_VOLUME_THRESHOLD;
+ const boardCompactCards =
+ viewState.boardCardDensity === "compact"
+ || (viewState.boardCardDensity === "auto" && boardHighVolume);
+ const boardCollapsedStatuses = useMemo(
+ () =>
+ viewState.boardColdLaneMode === "collapsed"
+ || (viewState.boardColdLaneMode === "auto" && boardHighVolume)
+ ? [...KANBAN_COLD_STATUSES]
+ : [],
+ [boardHighVolume, viewState.boardColdLaneMode],
+ );
+ const boardDensityCustomized =
+ viewState.boardCardDensity !== "auto"
+ || viewState.boardColdLaneMode !== "auto"
+ || viewState.boardColumnPageSize !== KANBAN_COLUMN_DEFAULT_PAGE_SIZE;
+
+ const groupedContent = useMemo(() => {
+ if (viewState.groupBy === "none") {
+ return [{ key: "__all", label: null as string | null, items: filtered }];
+ }
+ if (viewState.groupBy === "status") {
+ const groups = groupBy(filtered, (i) => i.status);
+ return issueStatusOrder
+ .filter((s) => groups[s]?.length)
+ .map((s) => ({ key: s, label: issueFilterLabel(s), items: groups[s]! }));
+ }
+ if (viewState.groupBy === "priority") {
+ const groups = groupBy(filtered, (i) => i.priority);
+ return issuePriorityOrder
+ .filter((p) => groups[p]?.length)
+ .map((p) => ({ key: p, label: issueFilterLabel(p), items: groups[p]! }));
+ }
+ if (viewState.groupBy === "workspace") {
+ const groups = groupBy(
+ filtered,
+ (issue) => resolveIssueFilterWorkspaceId(issue, issueFilterWorkspaceContext) ?? "__no_workspace",
+ );
+ return Object.keys(groups)
+ .sort((a, b) => {
+ // Groups with items first, "no workspace" last
+ if (a === "__no_workspace") return 1;
+ if (b === "__no_workspace") return -1;
+ return (groups[b]?.length ?? 0) - (groups[a]?.length ?? 0);
+ })
+ .map((key) => ({
+ key,
+ label: key === "__no_workspace" ? "No Workspace" : (workspaceNameMap.get(key) ?? key.slice(0, 8)),
+ items: groups[key]!,
+ }));
+ }
+ if (viewState.groupBy === "project") {
+ const groups = groupBy(filtered, (issue) => issue.projectId ?? "__no_project");
+ return Object.keys(groups)
+ .sort((a, b) => {
+ if (a === "__no_project") return 1;
+ if (b === "__no_project") return -1;
+ const labelA = projectById.get(a)?.name ?? a;
+ const labelB = projectById.get(b)?.name ?? b;
+ return labelA.localeCompare(labelB);
+ })
+ .map((key) => ({
+ key,
+ label: key === "__no_project" ? "No Project" : (projectById.get(key)?.name ?? key.slice(0, 8)),
+ items: groups[key]!,
+ }));
+ }
+ if (viewState.groupBy === "parent") {
+ const groups = groupBy(filtered, (i) => i.parentId ?? "__no_parent");
+ return Object.keys(groups)
+ .sort((a, b) => {
+ // Groups with items first, "no parent" last
+ if (a === "__no_parent") return 1;
+ if (b === "__no_parent") return -1;
+ return (groups[b]?.length ?? 0) - (groups[a]?.length ?? 0);
+ })
+ .map((key) => ({
+ key,
+ label: key === "__no_parent" ? "No Parent" : (issueTitleMap.get(key) ?? key.slice(0, 8)),
+ items: groups[key]!,
+ }));
+ }
+ // assignee
+ const groups = groupBy(
+ filtered,
+ (issue) => issue.assigneeAgentId ?? (issue.assigneeUserId ? `__user:${issue.assigneeUserId}` : "__unassigned"),
+ );
+ return Object.keys(groups).map((key) => ({
+ key,
+ label:
+ key === "__unassigned"
+ ? "Unassigned"
+ : key.startsWith("__user:")
+ ? (formatAssigneeUserLabel(key.slice("__user:".length), currentUserId, companyUserLabelMap) ?? "User")
+ : (agentName(key) ?? key.slice(0, 8)),
+ items: groups[key]!,
+ }));
+ }, [
+ filtered,
+ issueFilterWorkspaceContext,
+ viewState.groupBy,
+ agents,
+ agentName,
+ currentUserId,
+ workspaceNameMap,
+ issueTitleMap,
+ companyUserLabelMap,
+ projectById,
+ ]);
+
+ // Flattened visible order (group headers, then tree DFS per group —
+ // collapsed groups keep their header entry but skip their rows) — must
+ // match render order below for keyboard traversal. `budgetOrdinal` counts
+ // rows the way the progressive renderer consumes its budget (collapsed
+ // groups still consume rows; collapsed parents' subtrees do not).
+ const flatNavEntries = useMemo(() => {
+ if (viewState.viewMode !== "list") return [] as IssuesListNavEntry[];
+ const out: IssuesListNavEntry[] = [];
+ let budgetCount = 0;
+ for (const group of groupedContent) {
+ const collapsed = Boolean(group.label) && viewState.collapsedGroups.includes(group.key);
+ if (group.label) out.push({ type: "group", key: group.key, collapsed });
+ const { roots, childMap } = viewState.nestingEnabled
+ ? buildIssueTree(group.items)
+ : { roots: group.items, childMap: new Map<string, Issue[]>() };
+ const walk = (issue: Issue) => {
+ budgetCount += 1;
+ const children = childMap.get(issue.id) ?? [];
+ const expanded = !viewState.collapsedParents.includes(issue.id);
+ if (!collapsed) {
+ out.push({
+ type: "issue",
+ issue,
+ hasChildren: children.length > 0,
+ expanded,
+ budgetOrdinal: budgetCount,
+ });
+ }
+ if (expanded) for (const child of children) walk(child);
+ };
+ for (const root of roots) walk(root);
+ }
+ return out;
+ }, [
+ groupedContent,
+ viewState.viewMode,
+ viewState.collapsedGroups,
+ viewState.collapsedParents,
+ viewState.nestingEnabled,
+ ]);
+
+ const listNavStateRef = useRef({
+ flatNavEntries,
+ selectedNavKey,
+ viewMode: viewState.viewMode,
+ issueLinkState,
+ collapsedGroups: viewState.collapsedGroups,
+ collapsedParents: viewState.collapsedParents,
+ updateView,
+ });
+ listNavStateRef.current = {
+ flatNavEntries,
+ selectedNavKey,
+ viewMode: viewState.viewMode,
+ issueLinkState,
+ collapsedGroups: viewState.collapsedGroups,
+ collapsedParents: viewState.collapsedParents,
+ updateView,
+ };
+
+ const findSelectedNavElement = useCallback((navKey: string) => {
+ if (navKey.startsWith("group:")) {
+ const header = rootRef.current?.querySelector(
+ `[data-issues-group-key="${escapeAttrValue(navKey.slice("group:".length))}"]`,
+ );
+ return header instanceof HTMLElement ? header : null;
+ }
+ const row = rootRef.current?.querySelector(
+ `[data-issue-row-id="${escapeAttrValue(navKey.slice("issue:".length))}"]`,
+ );
+ const link = row?.querySelector("[data-inbox-issue-link]");
+ return link instanceof HTMLElement ? link : null;
+ }, []);
+
+ useEffect(() => {
+ if (!keyboardShortcutsEnabled) return;
+ const handleKeyDown = (e: KeyboardEvent) => {
+ if (e.defaultPrevented) return;
+ const target = e.target;
+ if (
+ !(target instanceof HTMLElement) ||
+ isKeyboardShortcutTextInputTarget(target) ||
+ hasBlockingShortcutDialog(document) ||
+ e.metaKey ||
+ e.ctrlKey ||
+ e.altKey
+ ) {
+ return;
+ }
+ const st = listNavStateRef.current;
+ if (st.viewMode !== "list" || st.flatNavEntries.length === 0) return;
+ // The row a keystroke acts on: the hovered row when the mouse moved since
+ // the last key nav (so "hover a row → press Arrow/Enter" acts on it),
+ // otherwise the keyboard selection. Hover no longer writes selection
+ // state, so this threads the pointer position into every handler.
+ const indexOfKey = (key: string | null) =>
+ key ? st.flatNavEntries.findIndex((entry) => issuesListNavEntryKey(entry) === key) : -1;
+ const hoveredIndex = indexOfKey(hoveredNavKeyRef.current);
+ const fromHover = pointerMovedSinceKeyNavRef.current && hoveredIndex >= 0;
+ const currentIndex = fromHover ? hoveredIndex : indexOfKey(st.selectedNavKey);
+ switch (e.key) {
+ case "j":
+ case "ArrowDown":
+ case "k":
+ case "ArrowUp": {
+ e.preventDefault();
+ pointerMovedSinceKeyNavRef.current = false;
+ const direction = e.key === "j" || e.key === "ArrowDown" ? "next" : "previous";
+ const nextIndex = getInboxKeyboardSelectionIndex(currentIndex, st.flatNavEntries.length, direction);
+ const nextEntry = st.flatNavEntries[nextIndex];
+ if (!nextEntry) break;
+ setSelectedNavKey(issuesListNavEntryKey(nextEntry));
+ // The list renders progressively; make sure the selected row is
+ // within the render budget so the band mounts and can scroll into
+ // view (the +1 keeps the next row visible as a scroll cue).
+ if (nextEntry.type === "issue") {
+ setRenderedIssueRowLimit((current) => Math.max(current, nextEntry.budgetOrdinal + 1));
+ }
+ break;
+ }
+ case "ArrowLeft":
+ case "ArrowRight": {
+ // Groups and parent tasks collapse/expand with the same keys as the
+ // inbox.
+ const entry = st.flatNavEntries[currentIndex];
+ if (!entry) return;
+ const collapse = e.key === "ArrowLeft";
+ if (entry.type === "group") {
+ e.preventDefault();
+ pointerMovedSinceKeyNavRef.current = false;
+ setSelectedNavKey(issuesListNavEntryKey(entry));
+ st.updateView({
+ collapsedGroups: collapse
+ ? (st.collapsedGroups.includes(entry.key) ? st.collapsedGroups : [...st.collapsedGroups, entry.key])
+ : st.collapsedGroups.filter((k) => k !== entry.key),
+ });
+ break;
+ }
+ if (!entry.hasChildren) return;
+ e.preventDefault();
+ pointerMovedSinceKeyNavRef.current = false;
+ setSelectedNavKey(issuesListNavEntryKey(entry));
+ st.updateView({
+ collapsedParents: collapse
+ ? (st.collapsedParents.includes(entry.issue.id) ? st.collapsedParents : [...st.collapsedParents, entry.issue.id])
+ : st.collapsedParents.filter((id) => id !== entry.issue.id),
+ });
+ break;
+ }
+ case "Enter": {
+ const entry = st.flatNavEntries[currentIndex];
+ if (!entry || entry.type !== "issue") return;
+ e.preventDefault();
+ // Navigate from the entry data (like the inbox) rather than the DOM
+ // row — the selected row may sit past the mounted render batch.
+ const issue = entry.issue;
+ const pathId = issue.identifier ?? issue.id;
+ const detailState = withIssueDetailHeaderSeed(st.issueLinkState, issue);
+ rememberIssueDetailLocationState(pathId, detailState);
+ // Seed the full list-row snapshot + first comments page before we
+ // navigate so keyboard-driven opens paint from cache instantly, the
+ // same way pointer hover/click does through the issue link. Mirrors
+ // the inbox Enter handler.
+ void prefetchIssueDetailForNavigation(queryClient, pathId, { issue });
+ navigate(createIssueDetailPath(pathId), { state: detailState });
+ break;
+ }
+ default:
+ return;
+ }
+ };
+ window.addEventListener("keydown", handleKeyDown);
+ return () => window.removeEventListener("keydown", handleKeyDown);
+ }, [keyboardShortcutsEnabled, navigate, queryClient]);
+
+ // Keep the keyboard selection visible while navigating. Depends on the
+ // render budget too: a selection past the mounted batch scrolls once its
+ // row mounts.
+ useEffect(() => {
+ if (!selectedNavKey) return;
+ findSelectedNavElement(selectedNavKey)?.scrollIntoView({ block: "nearest" });
+ }, [findSelectedNavElement, renderedIssueRowLimit, selectedNavKey]);
+
+ useEffect(() => {
+ if (viewState.viewMode !== "list") return;
+ const nextIssueIds = filtered.map((issue) => issue.id).join("|");
+ const previousIssueIds = renderedIssueIdsRef.current;
+ renderedIssueIdsRef.current = nextIssueIds;
+
+ setRenderedIssueRowLimit((current) => {
+ const nextInitialLimit = Math.min(filtered.length, INITIAL_ISSUE_ROW_RENDER_LIMIT);
+ const listAppended = previousIssueIds.length > 0
+ && nextIssueIds.startsWith(previousIssueIds)
+ && filtered.length >= current;
+ if (listAppended) return Math.min(filtered.length, Math.max(current, nextInitialLimit));
+ return nextInitialLimit;
+ });
+ }, [filtered, viewState.viewMode]);
+
+ const hasMoreRenderedRows = viewState.viewMode === "list" && renderedIssueRowLimit < filtered.length;
+ const remainingIssueRowCount = Math.max(filtered.length - renderedIssueRowLimit, 0);
+ const loadMoreIssueRows = useCallback(() => {
+ if (viewState.viewMode !== "list") return;
+ if (hasMoreRenderedRows) {
+ setRenderedIssueRowLimit((current) => Math.min(filtered.length, current + ISSUE_ROW_RENDER_BATCH_SIZE));
+ return;
+ }
+ if (hasMoreIssues && !isLoadingMoreIssues) {
+ onLoadMoreIssues?.();
+ }
+ }, [
+ filtered.length,
+ hasMoreIssues,
+ hasMoreRenderedRows,
+ isLoadingMoreIssues,
+ onLoadMoreIssues,
+ viewState.viewMode,
+ ]);
+
+ const canLoadMoreIssues = viewState.viewMode === "list"
+ && !isLoading
+ && (hasMoreRenderedRows || (hasMoreIssues && !isLoadingMoreIssues));
+
+ useEffect(() => {
+ if (!canLoadMoreIssues) return;
+ let animationFrameId: number | null = null;
+ const scrollContainer = findIssuesScrollContainer(rootRef.current);
+ const scrollTarget: Window | HTMLElement = scrollContainer ?? window;
+
+ const checkScrollPosition = (trigger: "initial" | "scroll" | "resize" = "scroll") => {
+ if (animationFrameId !== null) return;
+ animationFrameId = window.requestAnimationFrame(() => {
+ animationFrameId = null;
+ const scrollHeight = scrollContainer?.scrollHeight ?? document.documentElement.scrollHeight;
+ if (scrollHeight === 0) return;
+ const viewportHeight = scrollContainer?.clientHeight ?? window.innerHeight;
+ const scrollBottom = scrollContainer
+ ? scrollContainer.scrollTop + scrollContainer.clientHeight
+ : window.scrollY + window.innerHeight;
+ const hasScrollableOverflow = scrollHeight > viewportHeight + 1;
+ const threshold = scrollHeight - ISSUE_SCROLL_LOAD_THRESHOLD_PX;
+ if (scrollBottom >= threshold) {
+ if (trigger === "initial" && !hasMoreRenderedRows && hasMoreIssues && !hasScrollableOverflow) {
+ if (initialServerFillRequestedRef.current) return;
+ initialServerFillRequestedRef.current = true;
+ }
+ loadMoreIssueRows();
+ }
+ });
+ };
+
+ const handleScroll = () => checkScrollPosition("scroll");
+ const handleResize = () => checkScrollPosition("resize");
+ scrollTarget.addEventListener("scroll", handleScroll, { passive: true });
+ window.addEventListener("resize", handleResize);
+ checkScrollPosition("initial");
+
+ return () => {
+ scrollTarget.removeEventListener("scroll", handleScroll);
+ window.removeEventListener("resize", handleResize);
+ if (animationFrameId !== null) window.cancelAnimationFrame(animationFrameId);
+ };
+ }, [canLoadMoreIssues, hasMoreIssues, hasMoreRenderedRows, loadMoreIssueRows]);
+
+ const newIssueDefaults = useCallback((group?: { key: string; items: Issue[] }) => {
+ const groupKey = group?.key;
+ const defaults: Record<string, unknown> = { ...(baseCreateIssueDefaults ?? {}) };
+ if (projectId && defaults.projectId === undefined) defaults.projectId = projectId;
+ if (groupKey) {
+ if (viewState.groupBy === "status") defaults.status = groupKey;
+ else if (viewState.groupBy === "priority") defaults.priority = groupKey;
+ else if (viewState.groupBy === "assignee" && groupKey !== "__unassigned") {
+ if (groupKey.startsWith("__user:")) defaults.assigneeUserId = groupKey.slice("__user:".length);
+ else defaults.assigneeAgentId = groupKey;
+ }
+ else if (viewState.groupBy === "project" && groupKey !== "__no_project") defaults.projectId = groupKey;
+ else if (viewState.groupBy === "workspace" && groupKey !== "__no_workspace") {
+ const representativeIssue = group?.items.find((issue) =>
+ issue.executionWorkspaceId === groupKey || issue.projectWorkspaceId === groupKey,
+ ) ?? null;
+ const executionWorkspace = executionWorkspaceById.get(groupKey);
+ if (executionWorkspace) {
+ defaults.executionWorkspaceId = groupKey;
+ defaults.executionWorkspaceMode = "reuse_existing";
+ if (executionWorkspace.projectWorkspaceId) defaults.projectWorkspaceId = executionWorkspace.projectWorkspaceId;
+ const groupedProjectId = executionWorkspace.projectId
+ ?? (executionWorkspace.projectWorkspaceId
+ ? projectWorkspaceById.get(executionWorkspace.projectWorkspaceId)?.projectId
+ : null)
+ ?? (representativeIssue?.executionWorkspaceId === groupKey ? representativeIssue.projectId : null);
+ if (groupedProjectId) defaults.projectId = groupedProjectId;
+ } else {
+ const projectWorkspace = projectWorkspaceById.get(groupKey);
+ if (projectWorkspace) {
+ defaults.projectWorkspaceId = groupKey;
+ defaults.projectId = projectWorkspace.projectId;
+ }
+ }
+ }
+ else if (viewState.groupBy === "parent" && groupKey !== "__no_parent") {
+ const parentIssue = issueById.get(groupKey);
+ if (parentIssue) Object.assign(defaults, buildSubIssueDefaultsForViewer(parentIssue, currentUserId));
+ else defaults.parentId = groupKey;
+ }
+ }
+ return defaults;
+ }, [
+ baseCreateIssueDefaults,
+ currentUserId,
+ executionWorkspaceById,
+ issueById,
+ projectId,
+ projectWorkspaceById,
+ viewState.groupBy,
+ ]);
+
+ const createActionLabel = createIssueLabel ? `Create ${createIssueLabel}` : "Create Task";
+ const createButtonLabel = createIssueLabel ? `New ${createIssueLabel}` : "New Task";
+ const openCreateIssueDialog = useCallback((group?: { key: string; items: Issue[] }) => {
+ openNewIssue(newIssueDefaults(group));
+ }, [newIssueDefaults, openNewIssue]);
+
+ const filterToWorkspace = useCallback((workspaceId: string) => {
+ updateView({ workspaces: [workspaceId] });
+ }, [updateView]);
+
+ const setIssueColumns = useCallback((next: InboxIssueColumn[]) => {
+ const normalized = normalizeInboxIssueColumns(next);
+ setVisibleIssueColumns(normalized);
+ saveIssueColumns(scopedKey, normalized);
+ }, [scopedKey]);
+
+ const toggleIssueColumn = useCallback((column: InboxIssueColumn, enabled: boolean) => {
+ if (enabled) {
+ setIssueColumns([...visibleIssueColumns, column]);
+ return;
+ }
+ setIssueColumns(visibleIssueColumns.filter((value) => value !== column));
+ }, [setIssueColumns, visibleIssueColumns]);
+
+ const assignIssue = useCallback((issueId: string, assigneeAgentId: string | null, assigneeUserId: string | null = null) => {
+ onUpdateIssue(issueId, { assigneeAgentId, assigneeUserId });
+ setAssigneePickerIssueId(null);
+ setAssigneeSearch("");
+ }, [onUpdateIssue]);
+
+ let remainingRowsToRender = viewState.viewMode === "list" ? renderedIssueRowLimit : Number.POSITIVE_INFINITY;
+
+ return (
+ <div ref={rootRef} className="space-y-4">
+ {progressSummary ? (
+ <SubIssueProgressSummaryStrip
+ summary={progressSummary}
+ issueLinkState={issueLinkState}
+ parentIssueIdForCostSummary={parentIssueIdForCostSummary}
+ />
+ ) : null}
+
+ {/* Toolbar */}
+ <div className="flex items-center justify-between gap-2 sm:gap-3">
+ <div className="flex min-w-0 items-center gap-2 sm:gap-3">
+ <Button size="sm" variant="outline" onClick={() => openCreateIssueDialog()}>
+ <Plus className="h-4 w-4 sm:mr-1" />
+ <span className="hidden sm:inline">{createButtonLabel}</span>
+ </Button>
+ <IssueSearchInput
+ value={issueSearch}
+ onDebouncedChange={(nextSearch) => {
+ setIssueSearch(nextSearch);
+ onSearchChange?.(nextSearch);
+ }}
+ />
+ </div>
+
+ <div className="flex items-center gap-0.5 sm:gap-1 shrink-0">
+ {/* View mode toggle */}
+ <div className="flex items-center border border-border rounded-md overflow-hidden mr-1" role="group" aria-label="View mode">
+ <button
+ className={`flex h-8 w-8 items-center justify-center transition-colors ${viewState.viewMode === "list" ? "bg-accent text-foreground" : "text-muted-foreground hover:text-foreground"}`}
+ onClick={() => updateView({ viewMode: "list" })}
+ title="List view"
+ aria-label="List view"
+ aria-pressed={viewState.viewMode === "list"}
+ >
+ <List className="h-3.5 w-3.5" />
+ </button>
+ <button
+ className={`flex h-8 w-8 items-center justify-center transition-colors ${viewState.viewMode === "board" ? "bg-accent text-foreground" : "text-muted-foreground hover:text-foreground"}`}
+ onClick={() => updateView({ viewMode: "board" })}
+ title="Board view"
+ aria-label="Board view"
+ aria-pressed={viewState.viewMode === "board"}
+ >
+ <SquareKanban className="h-3.5 w-3.5" />
+ </button>
+ </div>
+
+ {viewState.viewMode === "list" && (
+ <Button
+ type="button"
+ variant="outline"
+ size="icon"
+ className={cn("hidden h-8 w-8 shrink-0 sm:inline-flex", viewState.nestingEnabled && "bg-accent")}
+ onClick={() => updateView({ nestingEnabled: !viewState.nestingEnabled })}
+ title={viewState.nestingEnabled ? "Disable parent-child nesting" : "Enable parent-child nesting"}
+ >
+ <ListTree className="h-3.5 w-3.5" />
+ </Button>
+ )}
+
+ {viewState.viewMode === "board" && (
+ <>
+ <Button
+ type="button"
+ variant="outline"
+ size="icon"
+ className={cn("h-8 w-8 shrink-0", boardCompactCards && "bg-accent")}
+ onClick={() => updateView({ boardCardDensity: boardCompactCards ? "comfortable" : "compact" })}
+ title={boardCompactCards ? "Use comfortable cards" : "Use compact cards"}
+ >
+ <ChevronsDownUp className="h-3.5 w-3.5" />
+ </Button>
+ <Button
+ type="button"
+ variant="outline"
+ size="icon"
+ className={cn("h-8 w-8 shrink-0", boardCollapsedStatuses.length > 0 && "bg-accent")}
+ onClick={() => updateView({ boardColdLaneMode: boardCollapsedStatuses.length > 0 ? "expanded" : "collapsed" })}
+ title={boardCollapsedStatuses.length > 0 ? "Expand cold lanes" : "Collapse cold lanes"}
+ >
+ <PanelTopClose className="h-3.5 w-3.5" />
+ </Button>
+ <Popover>
+ <PopoverTrigger asChild>
+ <Button
+ type="button"
+ variant="outline"
+ size="sm"
+ className={cn(
+ "h-8 shrink-0 gap-1.5 px-2",
+ viewState.boardColumnPageSize !== KANBAN_COLUMN_DEFAULT_PAGE_SIZE && "bg-accent",
+ )}
+ title="Cards per column"
+ >
+ <ListCollapse className="h-3.5 w-3.5" />
+ <span className="min-w-4 text-xs tabular-nums">{viewState.boardColumnPageSize}</span>
+ </Button>
+ </PopoverTrigger>
+ <PopoverContent align="end" className="w-40 p-0">
+ <div className="p-2 space-y-0.5">
+ {KANBAN_COLUMN_PAGE_SIZE_OPTIONS.map((pageSize) => (
+ <button
+ key={pageSize}
+ type="button"
+ className={cn(
+ "flex w-full items-center justify-between rounded-sm px-2 py-1.5 text-sm",
+ viewState.boardColumnPageSize === pageSize
+ ? "bg-accent/50 text-foreground"
+ : "text-muted-foreground hover:bg-accent/50",
+ )}
+ onClick={() => updateView({ boardColumnPageSize: pageSize })}
+ >
+ <span>{pageSize} per column</span>
+ {viewState.boardColumnPageSize === pageSize && <Check className="h-3.5 w-3.5" />}
+ </button>
+ ))}
+ </div>
+ </PopoverContent>
+ </Popover>
+ <Button
+ type="button"
+ variant="outline"
+ size="icon"
+ className="h-8 w-8 shrink-0"
+ onClick={() => updateView({
+ boardCardDensity: "auto",
+ boardColdLaneMode: "expanded",
+ boardColumnPageSize: KANBAN_COLUMN_DEFAULT_PAGE_SIZE,
+ })}
+ disabled={!boardDensityCustomized}
+ title="Reset board density"
+ >
+ <RotateCcw className="h-3.5 w-3.5" />
+ </Button>
+ </>
+ )}
+
+ <IssueColumnPicker
+ availableColumns={availableIssueColumns}
+ visibleColumnSet={visibleIssueColumnSet}
+ onToggleColumn={toggleIssueColumn}
+ onResetColumns={() => setIssueColumns(DEFAULT_INBOX_ISSUE_COLUMNS)}
+ title="Choose which task columns stay visible"
+ iconOnly
+ />
+
+ <IssueFiltersPopover
+ presentation="legacy"
+ state={viewState}
+ onChange={updateView}
+ buttonVariant="outline"
+ activeFilterCount={activeFilterCount}
+ agents={agents}
+ creators={creatorOptions}
+ projects={projects?.map((project) => ({ id: project.id, name: project.name }))}
+ labels={labels?.map((label) => ({ id: label.id, name: label.name, color: label.color }))}
+ currentUserId={currentUserId}
+ enableExternalObjectFilters={externalObjectsEnabled}
+ enableRoutineVisibilityFilter={enableRoutineVisibilityFilter}
+ iconOnly
+ workspaces={isolatedWorkspacesEnabled ? workspaceOptions : undefined}
+ />
+
+ {/* Sort (list view only) */}
+ {viewState.viewMode === "list" && (
+ <Popover>
+ <PopoverTrigger asChild>
+ <Button variant="outline" size="icon" className="h-8 w-8 shrink-0" title="Sort">
+ <ArrowUpDown className="h-3.5 w-3.5" />
+ </Button>
+ </PopoverTrigger>
+ <PopoverContent align="end" className="w-48 p-0">
+ <div className="p-2 space-y-0.5">
+ {/* PAP-411: "priority" sort option hidden behind SHOW_TASK_PRIORITY_UI (comparator stays dormant). */}
+ {([
+ ["workflow", "Workflow"],
+ ["status", "Status"],
+ ["priority", "Priority"],
+ ["title", "Title"],
+ ["created", "Created"],
+ ["updated", "Updated"],
+ ] as const)
+ .filter(([field]) => SHOW_TASK_PRIORITY_UI || field !== "priority")
+ .map(([field, label]) => (
+ <button
+ key={field}
+ className={`flex items-center justify-between w-full px-2 py-1.5 text-sm rounded-sm ${
+ viewState.sortField === field ? "bg-accent/50 text-foreground" : "hover:bg-accent/50 text-muted-foreground"
+ }`}
+ onClick={() => {
+ if (viewState.sortField === field) {
+ updateView({ sortDir: viewState.sortDir === "asc" ? "desc" : "asc" });
+ } else {
+ updateView({ sortField: field, sortDir: "asc" });
+ }
+ }}
+ >
+ <span>{label}</span>
+ {viewState.sortField === field && (
+ <span className="text-xs text-muted-foreground">
+ {viewState.sortDir === "asc" ? "\u2191" : "\u2193"}
+ </span>
+ )}
+ </button>
+ ))}
+ </div>
+ </PopoverContent>
+ </Popover>
+ )}
+
+ {/* Group (list view only) */}
+ {viewState.viewMode === "list" && (
+ <Popover>
+ <PopoverTrigger asChild>
+ <Button variant="outline" size="icon" className="h-8 w-8 shrink-0" title="Group">
+ <Layers className="h-3.5 w-3.5" />
+ </Button>
+ </PopoverTrigger>
+ <PopoverContent align="end" className="w-44 p-0">
+ <div className="p-2 space-y-0.5">
+ {/* PAP-411: "priority" group-by option hidden behind SHOW_TASK_PRIORITY_UI (group logic stays dormant). */}
+ {([
+ ["status", "Status"],
+ ["priority", "Priority"],
+ ["assignee", "Responsible"],
+ ["project", "Project"],
+ ["workspace", "Workspace"],
+ ["parent", "Parent Task"],
+ ["none", "None"],
+ ] as const)
+ .filter(([value]) => SHOW_TASK_PRIORITY_UI || value !== "priority")
+ .map(([value, label]) => (
+ <button
+ key={value}
+ className={`flex items-center justify-between w-full px-2 py-1.5 text-sm rounded-sm ${
+ viewState.groupBy === value ? "bg-accent/50 text-foreground" : "hover:bg-accent/50 text-muted-foreground"
+ }`}
+ onClick={() => updateView({ groupBy: value })}
+ >
+ <span>{label}</span>
+ {viewState.groupBy === value && <Check className="h-3.5 w-3.5" />}
+ </button>
+ ))}
+ </div>
+ </PopoverContent>
+ </Popover>
+ )}
+ </div>
+ </div>
+
+ {(isLoading || externalObjectFilterLoading) && <PageSkeleton variant="issues-list" />}
+ {error && <p className="text-sm text-destructive">{error.message}</p>}
+ {!searchWithinLoadedIssues && normalizedIssueSearch.length > 0 && searchedIssues.length === ISSUE_SEARCH_RESULT_LIMIT && (
+ <p className="text-xs text-muted-foreground">
+ Showing up to {ISSUE_SEARCH_RESULT_LIMIT} matches. Refine the search to narrow further.
+ </p>
+ )}
+ {boardColumnLimitReached && (
+ <p className="text-xs text-muted-foreground">
+ Some board columns are showing up to {ISSUE_BOARD_COLUMN_RESULT_LIMIT} tasks. Refine filters or search to reveal the rest.
+ </p>
+ )}
+ {!isLoading && !externalObjectFilterLoading && filtered.length === 0 && viewState.viewMode === "list" && (
+ <EmptyState
+ icon={CircleDot}
+ message="No tasks match the current filters or search."
+ action={createActionLabel}
+ onAction={() => openCreateIssueDialog()}
+ />
+ )}
+
+ {viewState.viewMode === "board" ? (
+ <KanbanBoard
+ issues={filtered}
+ agents={agents}
+ liveIssueIds={liveIssueIds}
+ compactCards={boardCompactCards}
+ collapsedStatuses={boardCollapsedStatuses}
+ initialVisibleCount={viewState.boardColumnPageSize}
+ revealIncrement={viewState.boardColumnPageSize}
+ onUpdateIssue={onUpdateIssue}
+ />
+ ) : (
+ <>
+ {groupedContent.map((group) => {
+ if (remainingRowsToRender <= 0) return null;
+ return (
+ <Collapsible
+ key={group.key}
+ open={!viewState.collapsedGroups.includes(group.key)}
+ onOpenChange={(open) => {
+ updateView({
+ collapsedGroups: open
+ ? viewState.collapsedGroups.filter((k) => k !== group.key)
+ : [...viewState.collapsedGroups, group.key],
+ });
+ }}
+ >
+ {group.label && (
+ // Left inset aligns the header chevron with the nested task
+ // chevrons: tasks-list rows sit at pl-1 before their chevron
+ // (no unread column), so the band adds no extra left inset.
+ <div
+ data-issues-group-key={group.key}
+ className={cn("rounded-lg px-3 sm:pl-0 sm:pr-4", selectedNavKey === `group:${group.key}` ? "bg-accent/50" : "hover:bg-accent/50")}
+ onClick={() => setSelectedNavKey(`group:${group.key}`)}
+ onMouseEnter={() => setNavSelectionFromPointer(`group:${group.key}`)}
+ >
+ <IssueGroupHeader
+ label={group.label}
+ collapsible
+ collapsed={viewState.collapsedGroups.includes(group.key)}
+ onToggle={() => {
+ updateView({
+ collapsedGroups: viewState.collapsedGroups.includes(group.key)
+ ? viewState.collapsedGroups.filter((k) => k !== group.key)
+ : [...viewState.collapsedGroups, group.key],
+ });
+ }}
+ trailing={(
+ <Button
+ variant="ghost"
+ size="icon-xs"
+ className="-mr-2 text-muted-foreground"
+ title={`New task in ${group.label}`}
+ aria-label={`New task in ${group.label}`}
+ onClick={() => openCreateIssueDialog(group)}
+ >
+ <Plus className="h-3 w-3" />
+ </Button>
+ )}
+ />
+ </div>
+ )}
+ <CollapsibleContent>
+ {(() => {
+ const { roots, childMap } = viewState.nestingEnabled
+ ? buildIssueTree(group.items)
+ : { roots: group.items, childMap: new Map<string, Issue[]>() };
+
+ const renderIssueRow = (issue: Issue, depth: number) => {
+ if (remainingRowsToRender <= 0) return null;
+ remainingRowsToRender -= 1;
+
+ const children = childMap.get(issue.id) ?? [];
+ const hasChildren = children.length > 0;
+ const totalDescendants = hasChildren ? countDescendants(issue.id, childMap) : 0;
+ const isExpanded = !viewState.collapsedParents.includes(issue.id);
+ const useDeferredRowRendering = !(hasChildren && isExpanded);
+ const issueProject = issue.projectId ? projectById.get(issue.projectId) ?? null : null;
+ const parentIssue = issue.parentId ? issueById.get(issue.parentId) ?? null : null;
+ const issueBadge = issueBadgeById?.get(issue.id);
+ const isMutedIssue = mutedIssueIds?.has(issue.id) === true;
+ const assigneeUserProfile = issue.assigneeUserId
+ ? companyUserProfileMap.get(issue.assigneeUserId) ?? null
+ : null;
+ const assigneeUserLabel = formatAssigneeUserLabel(
+ issue.assigneeUserId,
+ currentUserId,
+ companyUserLabelMap,
+ ) ?? assigneeUserProfile?.label ?? null;
+ const originatingActor = deriveOriginatingActor(issue);
+ const originatingUserId = originatingActor?.kind === "user" ? originatingActor.id : null;
+ const originatingViaAgentId =
+ originatingActor?.kind === "user" ? originatingActor.viaAgentId ?? null : null;
+ const toggleCollapse = (e: { preventDefault: () => void; stopPropagation: () => void }) => {
+ e.preventDefault();
+ e.stopPropagation();
+ updateView({
+ collapsedParents: isExpanded
+ ? [...viewState.collapsedParents, issue.id]
+ : viewState.collapsedParents.filter((id) => id !== issue.id),
+ });
+ };
+ const checklistMeta = workflowChecklistMeta;
+ const checklistStepNumber = checklistMeta?.stepNumberByIssueId.get(issue.id) ?? null;
+ const unresolvedVisibleBlockers = checklistMeta?.unresolvedVisibleBlockersByIssueId.get(issue.id) ?? [];
+ const checklistRowId = checklistMeta ? `issue-workflow-row-${issue.id}` : undefined;
+ const doneRowTitleClass = checklistMeta && issue.status === "done"
+ ? "text-muted-foreground"
+ : undefined;
+ const visibleBlockerChips = unresolvedVisibleBlockers
+ .map((blockerId) => {
+ const blockerIssue = issueById.get(blockerId);
+ if (!blockerIssue) return null;
+ const label = blockerIssue.identifier ?? blockerIssue.id.slice(0, 8);
+ const blockerStep = checklistMeta?.stepNumberByIssueId.get(blockerId);
+ const blockerStepSuffix = blockerStep ? ` \u00b7 step ${blockerStep}` : "";
+ return { blockerId, chipLabel: `blocked by ${label}${blockerStepSuffix}` };
+ })
+ .filter((chip): chip is { blockerId: string; chipLabel: string } => chip !== null);
+ const firstVisibleBlockerChip = visibleBlockerChips[0] ?? null;
+ const additionalVisibleBlockerCount = Math.max(visibleBlockerChips.length - 1, 0);
+ const additionalVisibleBlockerLabel = additionalVisibleBlockerCount > 0
+ ? ` ... and ${additionalVisibleBlockerCount} more`
+ : "";
+ const firstVisibleBlockerDisplayLabel = firstVisibleBlockerChip
+ ? `${firstVisibleBlockerChip.chipLabel}${additionalVisibleBlockerLabel}`
+ : "";
+ const hiddenVisibleBlockerLabels = visibleBlockerChips
+ .slice(1)
+ .map((chip) => chip.chipLabel)
+ .join(", ");
+ const firstVisibleBlockerTitle = additionalVisibleBlockerCount > 0
+ ? `${firstVisibleBlockerDisplayLabel}: ${hiddenVisibleBlockerLabels}`
+ : firstVisibleBlockerDisplayLabel;
+ const checklistDependencyChips = checklistMeta && firstVisibleBlockerChip ? (
+ <button
+ key={firstVisibleBlockerChip.blockerId}
+ type="button"
+ data-slot="icon-button"
+ onClick={(event) => {
+ event.preventDefault();
+ event.stopPropagation();
+ const target = document.getElementById(`issue-workflow-row-${firstVisibleBlockerChip.blockerId}`);
+ if (!target) return;
+ target.scrollIntoView({ behavior: "smooth", block: "nearest" });
+ target.focus?.();
+ }}
+ className="inline-flex items-center rounded-full border border-amber-400/45 bg-amber-50/60 px-1.5 py-0.5 text-(length:--text-nano) font-medium text-amber-700 hover:bg-amber-100/80 dark:border-amber-300/35 dark:bg-amber-400/10 dark:text-amber-300"
+ title={firstVisibleBlockerTitle}
+ aria-label={firstVisibleBlockerTitle}
+ >
+ {firstVisibleBlockerDisplayLabel}
+ </button>
+ ) : null;
+
+ return (
+ <div
+ key={issue.id}
+ data-issue-row-id={issue.id}
+ // Desktop indentation comes from IssueRow's treeGuides
+ // (vertical connector slots); mobile keeps a plain
+ // padding indent (guides are sm-only).
+ className={depth > 0 ? MOBILE_TREE_INDENT[Math.min(depth, MOBILE_TREE_INDENT.length - 1)] : undefined}
+ style={useDeferredRowRendering
+ ? {
+ contentVisibility: "auto",
+ containIntrinsicSize: "44px",
+ }
+ : undefined}
+ >
+ <IssueRow
+ issue={issue}
+ issueLinkState={issueLinkState}
+ selected={selectedNavKey === `issue:${issue.id}`}
+ onMouseEnter={() => setNavSelectionFromPointer(`issue:${issue.id}`)}
+ treeGuides={depth}
+ chevronInGuide={depth > 0 && hasChildren}
+ checklistStepNumber={checklistStepNumber}
+ checklistCurrentStep={checklistMeta?.currentStepIssueId === issue.id}
+ checklistDependencyChips={checklistDependencyChips}
+ checklistRowId={checklistRowId}
+ titleClassName={doneRowTitleClass}
+ externalObjectSummary={externalObjectSummaryByIssueId.get(issue.id) ?? null}
+ titleSuffix={(
+ <>
+ {hasChildren && !isExpanded ? (
+ <span className="ml-1.5 text-xs text-muted-foreground">
+ ({totalDescendants} sub-task{totalDescendants !== 1 ? "s" : ""})
+ </span>
+ ) : null}
+ {issueBadge ? (
+ issueBadge === "Paused" ? (
+ <Badge variant="ghost"
+ className={cn("ml-1.5 px-1.5 text-(length:--text-nano)", statusBadge.paused)}
+ aria-label="Paused"
+ title="Paused"
+ >
+ <CircleSlash2 className="h-3 w-3" />
+ Paused
+ </Badge>
+ ) : (
+ <Badge variant="outline" className="ml-1.5 border-amber-500/40 bg-amber-500/10 px-1.5 text-(length:--text-nano) text-amber-700 dark:text-amber-300">
+ {issueBadge}
+ </Badge>
+ )
+ ) : null}
+ {isSuccessfulRunHandoffRequired(issue) ? (
+ <Badge variant="outline"
+ className="ml-1.5 border-amber-400/45 bg-amber-50/60 px-1.5 text-(length:--text-nano) text-amber-700 dark:border-amber-300/35 dark:bg-amber-400/10 dark:text-amber-300"
+ aria-label="Needs next step"
+ title="This task needs a next step"
+ >
+ <CircleDot className="h-3 w-3" />
+ Needs next step
+ </Badge>
+ ) : null}
+ </>
+ )}
+ className={cn(isMutedIssue && "opacity-70", selectedNavKey === `issue:${issue.id}` && "bg-accent/50 hover:bg-accent/50")}
+ mobileLeading={
+ hasChildren ? (
+ <button type="button" data-slot="icon-button" onClick={toggleCollapse}>
+ <ChevronRight className={cn("h-3.5 w-3.5 transition-transform", isExpanded && "rotate-90")} />
+ </button>
+ ) : (
+ <span className="inline-flex items-center" onClick={(e) => { e.preventDefault(); e.stopPropagation(); }}>
+ <StatusIcon status={issue.status} size="md" blockerAttention={issue.blockerAttention} onChange={(s) => onUpdateIssue(issue.id, { status: s })} />
+ </span>
+ )
+ }
+ desktopMetaLeading={(
+ <>
+ {hasChildren ? (
+ <button
+ type="button"
+ data-slot="icon-button"
+ className="relative z-10 hidden w-4 shrink-0 items-center justify-center sm:inline-flex"
+ onClick={toggleCollapse}
+ >
+ <ChevronRight className={cn("h-3.5 w-3.5 transition-transform", isExpanded && "rotate-90")} />
+ </button>
+ ) : (
+ <span className="hidden w-4 shrink-0 sm:block" />
+ )}
+ <InboxIssueMetaLeading
+ issue={issue}
+ isLive={liveIssueIds?.has(issue.id) === true}
+ subtreeLiveCount={subtreeLiveCounts.get(issue.id) ?? 0}
+ showStatus={visibleIssueColumnSet.has("status") && availableIssueColumnSet.has("status")}
+ showIdentifier={visibleIssueColumnSet.has("id") && availableIssueColumnSet.has("id")}
+ checklistStepNumber={checklistStepNumber}
+ statusSlot={(
+ <span className="inline-flex items-center" onClick={(e) => { e.preventDefault(); e.stopPropagation(); }}>
+ <StatusIcon status={issue.status} size="md" blockerAttention={issue.blockerAttention} onChange={(s) => onUpdateIssue(issue.id, { status: s })} />
+ </span>
+ )}
+ />
+ </>
+ )}
+ mobileMeta={issueActivityText(issue).toLowerCase()}
+ desktopTrailing={(
+ visibleTrailingIssueColumns.length > 0 ? (
+ <InboxIssueTrailingColumns
+ issue={issue}
+ columns={visibleTrailingIssueColumns}
+ projectName={issueProject?.name ?? null}
+ projectColor={issueProject?.color ?? null}
+ workspaceId={resolveIssueFilterWorkspaceId(issue, issueFilterWorkspaceContext)}
+ workspaceName={resolveIssueWorkspaceName(issue, {
+ executionWorkspaceById,
+ projectWorkspaceById,
+ defaultProjectWorkspaceIdByProjectId,
+ })}
+ onFilterWorkspace={filterToWorkspace}
+ assigneeName={agentName(issue.assigneeAgentId)}
+ assigneeUserName={assigneeUserLabel}
+ assigneeUserAvatarUrl={assigneeUserProfile?.image ?? null}
+ creatorAgentName={agentName(issue.createdByAgentId)}
+ creatorUserName={originatingUserId ? (companyUserProfileMap.get(originatingUserId)?.label ?? null) : null}
+ creatorUserAvatarUrl={originatingUserId ? (companyUserProfileMap.get(originatingUserId)?.image ?? null) : null}
+ viaAgentName={originatingViaAgentId ? agentName(originatingViaAgentId) : null}
+ currentUserId={currentUserId}
+ parentIdentifier={parentIssue?.identifier ?? null}
+ parentTitle={parentIssue?.title ?? null}
+ assigneeContent={(
+ <Popover
+ open={assigneePickerIssueId === issue.id}
+ onOpenChange={(open) => {
+ setAssigneePickerIssueId(open ? issue.id : null);
+ if (!open) setAssigneeSearch("");
+ }}
+ >
+ <PopoverTrigger asChild>
+ <button
+ className="flex w-full shrink-0 items-center overflow-hidden rounded-md px-2 py-1 transition-colors hover:bg-accent/50"
+ onClick={(e) => { e.preventDefault(); e.stopPropagation(); }}
+ >
+ {issue.assigneeAgentId && agentName(issue.assigneeAgentId) ? (
+ <Identity name={agentName(issue.assigneeAgentId)!} size="sm" shape="square" className="min-w-0" />
+ ) : issue.assigneeUserId ? (
+ <Identity
+ name={assigneeUserLabel ?? "User"}
+ avatarUrl={assigneeUserProfile?.image ?? null}
+ size="sm"
+ className="min-w-0"
+ />
+ ) : (
+ <span className="inline-flex items-center gap-1.5 text-xs text-muted-foreground">
+ <span className="inline-flex h-6 w-6 items-center justify-center rounded-full border border-dashed border-muted-foreground/35 bg-muted/30">
+ <User className="h-3.5 w-3.5" />
+ </span>
+ Assignee
+ </span>
+ )}
+ </button>
+ </PopoverTrigger>
+ <PopoverContent
+ className="w-56 p-1"
+ align="end"
+ onClick={(e) => e.stopPropagation()}
+ onPointerDownOutside={() => setAssigneeSearch("")}
+ >
+ <input
+ className="mb-1 w-full border-b border-border bg-transparent px-2 py-1.5 text-xs outline-none placeholder:text-muted-foreground/50"
+ placeholder="Search responsible..."
+ value={assigneeSearch}
+ onChange={(e) => setAssigneeSearch(e.target.value)}
+ autoFocus
+ />
+ <div className="max-h-48 overflow-y-auto overscroll-contain">
+ <button
+ className={cn(
+ "flex w-full items-center gap-2 rounded px-2 py-1.5 text-xs hover:bg-accent/50",
+ !issue.assigneeAgentId && !issue.assigneeUserId && "bg-accent",
+ )}
+ onClick={(e) => {
+ e.preventDefault();
+ e.stopPropagation();
+ assignIssue(issue.id, null, null);
+ }}
+ >
+ No responsible
+ </button>
+ {currentUserId && (
+ <button
+ className={cn(
+ "flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-xs hover:bg-accent/50",
+ issue.assigneeUserId === currentUserId && "bg-accent",
+ )}
+ onClick={(e) => {
+ e.preventDefault();
+ e.stopPropagation();
+ assignIssue(issue.id, null, currentUserId);
+ }}
+ >
+ <User className="h-3.5 w-3.5 shrink-0 text-muted-foreground" />
+ <span>Me</span>
+ </button>
+ )}
+ {(agents ?? [])
+ .filter((agent) => {
+ if (!assigneeSearch.trim()) return true;
+ return agent.name.toLowerCase().includes(assigneeSearch.toLowerCase());
+ })
+ .map((agent) => (
+ <button
+ key={agent.id}
+ className={cn(
+ "flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-xs hover:bg-accent/50",
+ issue.assigneeAgentId === agent.id && "bg-accent",
+ )}
+ onClick={(e) => {
+ e.preventDefault();
+ e.stopPropagation();
+ assignIssue(issue.id, agent.id, null);
+ }}
+ >
+ <Identity name={agent.name} size="sm" className="min-w-0" />
+ </button>
+ ))}
+ </div>
+ </PopoverContent>
+ </Popover>
+ )}
+ />
+ ) : undefined
+ )}
+ />
+ </div>
+ );
+ };
+
+ const separatorField = issueDateSeparatorField(viewState);
+ const separatorNow = Date.now();
+ const nodes: ReactNode[] = [];
+ let prevBucket: 0 | 1 | 2 | null = null;
+ const appendIssueRow = (issue: Issue, depth: number) => {
+ const node = renderIssueRow(issue, depth);
+ // Skip rows the render budget dropped so separators never
+ // dangle above an unrendered (or absent) row.
+ if (node === null) return;
+ if (separatorField) {
+ const bucket = issueAgeBucket(issue[separatorField], separatorNow);
+ for (const crossedBucket of prevBucket === null
+ ? []
+ : issueAgeBucketsCrossed(prevBucket, bucket)) {
+ nodes.push(
+ <IssueDateSeparator
+ key={`age-sep-${issue.id}-${crossedBucket}`}
+ label={issueAgeSeparatorLabel(crossedBucket)}
+ />,
+ );
+ }
+ prevBucket = bucket;
+ }
+ nodes.push(node);
+ if (!viewState.collapsedParents.includes(issue.id)) {
+ for (const child of childMap.get(issue.id) ?? []) {
+ appendIssueRow(child, depth + 1);
+ }
+ }
+ };
+ for (const issue of roots) {
+ appendIssueRow(issue, 0);
+ }
+ return nodes;
+ })()}
+ </CollapsibleContent>
+ </Collapsible>
+ );
+ })}
+ {(remainingIssueRowCount > 0 || hasMoreIssues || isLoadingMoreIssues) && (
+ <div className="py-2" data-testid="issues-load-more-sentinel">
+ <p className="text-xs text-muted-foreground">
+ {isLoadingMoreIssues
+ ? "Loading more tasks..."
+ : remainingIssueRowCount > 0
+ ? `Rendering ${Math.min(renderedIssueRowLimit, filtered.length)} of ${filtered.length} tasks`
+ : "Scroll to load more tasks"}
+ </p>
+ </div>
+ )}
+ </>
+ )}
+ </div>
+ );
+}
diff --git a/ui/src/components/NewIssueDialog.tsx b/ui/src/components/NewIssueDialog.tsx
index 913b52aaf2..34bd5c5407 100644
--- a/ui/src/components/NewIssueDialog.tsx
+++ b/ui/src/components/NewIssueDialog.tsx
@@ -21,8 +21,10 @@ import {
issueExecutionWorkspaceModeForExistingWorkspace,
} from "../lib/project-workspace-defaults";
import { useProjectOrder } from "../hooks/useProjectOrder";
+import { useStreamlinedUiEnabled } from "../hooks/useStreamlinedUiEnabled";
import { getRecentAssigneeIds, sortAgentsByRecency, trackRecentAssignee } from "../lib/recent-assignees";
import { getRecentProjectIds, trackRecentProject } from "../lib/recent-projects";
+import { recordRecentTask } from "../lib/recent-tasks";
import { buildExecutionPolicy } from "../lib/issue-execution-policy";
import { isIssueWorkMode, nextWorkMode, workModeMetaFor, workModeMetaList } from "../lib/work-mode-meta";
import { useToastActions } from "../context/ToastContext";
@@ -472,6 +474,7 @@ export function NewIssueDialog() {
const statuses = useMemo(() => buildStatusOptions(), []);
const queryClient = useQueryClient();
const { pushToast } = useToastActions();
+ const { enabled: streamlinedUiEnabled } = useStreamlinedUiEnabled();
const [title, setTitle] = useState("");
const [description, setDescription] = useState("");
const titleRef = useRef("");
@@ -641,6 +644,7 @@ export function NewIssueDialog() {
return { issue, companyId, failures };
},
onSuccess: ({ issue, companyId, failures }) => {
+ if (streamlinedUiEnabled) recordRecentTask(issue, currentUserId);
queryClient.invalidateQueries({ queryKey: queryKeys.issues.list(companyId) });
queryClient.invalidateQueries({ queryKey: queryKeys.issues.listMineByMe(companyId) });
queryClient.invalidateQueries({ queryKey: queryKeys.issues.listTouchedByMe(companyId) });
diff --git a/ui/src/components/PropertiesPanel.test.tsx b/ui/src/components/PropertiesPanel.test.tsx
index ca24f9cd4d..d30119222b 100644
--- a/ui/src/components/PropertiesPanel.test.tsx
+++ b/ui/src/components/PropertiesPanel.test.tsx
@@ -45,8 +45,12 @@ async function flushReact() {
describe("PropertiesPanel", () => {
let container: HTMLDivElement;
let root: Root | null = null;
+ let originalInnerWidth: number;
- async function renderPanel({ panelVisible = true }: { panelVisible?: boolean } = {}) {
+ async function renderPanel({
+ panelVisible = true,
+ taskDetailLayout = false,
+ }: { panelVisible?: boolean; taskDetailLayout?: boolean } = {}) {
mockPanelState.panelContent = <div data-testid="panel-content">content</div>;
mockPanelState.panelVisible = panelVisible;
root = createRoot(container);
@@ -55,7 +59,7 @@ describe("PropertiesPanel", () => {
root!.render(
<QueryClientProvider client={queryClient}>
<TooltipProvider>
- <PropertiesPanel />
+ <PropertiesPanel taskDetailLayout={taskDetailLayout} />
</TooltipProvider>
</QueryClientProvider>,
);
@@ -64,6 +68,8 @@ describe("PropertiesPanel", () => {
}
beforeEach(() => {
+ originalInnerWidth = window.innerWidth;
+ Object.defineProperty(window, "innerWidth", { configurable: true, value: 1440 });
container = document.createElement("div");
document.body.appendChild(container);
window.localStorage.clear();
@@ -76,12 +82,14 @@ describe("PropertiesPanel", () => {
});
root = null;
container.remove();
+ Object.defineProperty(window, "innerWidth", { configurable: true, value: originalInnerWidth });
vi.clearAllMocks();
});
describe("classic task interface on (legacy panel)", () => {
beforeEach(() => {
mockInstanceSettingsApi.getExperimental.mockResolvedValue({
+ enableStreamlinedUi: true,
enableClassicTaskInterface: true,
});
});
@@ -108,32 +116,59 @@ describe("PropertiesPanel", () => {
describe("classic task interface off (default resizable pane)", () => {
beforeEach(() => {
mockInstanceSettingsApi.getExperimental.mockResolvedValue({
+ enableStreamlinedUi: true,
enableClassicTaskInterface: false,
});
});
- it("renders the default 322px width with a drag grip and a maximize button", async () => {
- await renderPanel();
+ it("renders the Paper task-detail rail width with a drag grip and a maximize button", async () => {
+ await renderPanel({ taskDetailLayout: true });
const aside = container.querySelector("aside");
expect(aside).not.toBeNull();
- expect(aside!.style.width).toBe("322px");
+ expect(aside!.style.width).toBe("434px");
expect(aside!.querySelector('[role="separator"][aria-label="Resize panel"]')).not.toBeNull();
expect(container.querySelector('[aria-label="Maximize side panel"]')).not.toBeNull();
const inner = aside!.querySelector<HTMLDivElement>(":scope > div:not([role])");
- expect(inner!.style.width).toBe("322px");
- expect(inner!.style.minWidth).toBe("322px");
+ expect(inner!.style.width).toBe("434px");
+ expect(inner!.style.minWidth).toBe("434px");
+ expect(aside!.querySelector("header")?.className).toContain(
+ "h-(--side-panel-header-height)",
+ );
+ });
+
+ it("removes the left divider only while the sidebar is maximized", async () => {
+ await renderPanel({ taskDetailLayout: true });
+ const aside = container.querySelector("aside")!;
+ const maximize = container.querySelector<HTMLButtonElement>(
+ '[aria-label="Maximize side panel"]',
+ )!;
+
+ expect(aside.className).toContain("border-l");
+ maximize.click();
+ await flushReact();
+
+ expect(aside.className).not.toContain("border-l");
+ expect(container.querySelector("section")?.getAttribute("data-maximized")).toBe("true");
+ });
+
+ it("uses an X to close the Streamlined task-detail sidebar", async () => {
+ await renderPanel({ taskDetailLayout: true });
+ const close = container.querySelector<HTMLButtonElement>('[aria-label="Close side panel"]');
+ expect(close).not.toBeNull();
+ expect(close!.querySelector(".lucide-x")).not.toBeNull();
+ expect(container.querySelector('[aria-label="Toggle side panel"]')).toBeNull();
+
+ close!.click();
+ expect(mockSetPanelVisible).toHaveBeenCalledWith(false);
});
- it("uses the pressed side-panel toggle instead of an X to hide the open pane", async () => {
+ it("keeps the production toggle control outside Streamlined task detail", async () => {
await renderPanel();
const toggle = container.querySelector<HTMLButtonElement>('[aria-label="Toggle side panel"]');
expect(toggle).not.toBeNull();
expect(toggle!.getAttribute("aria-pressed")).toBe("true");
expect(toggle!.querySelector(".lucide-panel-right-close")).not.toBeNull();
- expect(container.querySelector('[aria-label="Hide side panel"]')).toBeNull();
-
- toggle!.click();
- expect(mockSetPanelVisible).toHaveBeenCalledWith(false);
+ expect(container.querySelector('[aria-label="Close side panel"]')).toBeNull();
});
it("restores a remembered width from localStorage (clamped to the minimum)", async () => {
@@ -163,4 +198,33 @@ describe("PropertiesPanel", () => {
expect(aside!.querySelector('[role="separator"]')).toBeNull();
});
});
+
+ describe("Streamlined UI off", () => {
+ beforeEach(() => {
+ mockInstanceSettingsApi.getExperimental.mockResolvedValue({
+ enableStreamlinedUi: false,
+ enableClassicTaskInterface: false,
+ });
+ });
+
+ it("restores master's default resizable panel rather than the classic panel", async () => {
+ await renderPanel({ taskDetailLayout: true });
+ const aside = container.querySelector("aside");
+ expect(aside).not.toBeNull();
+ expect(aside!.style.width).toBe("322px");
+ expect(aside!.querySelector('[role="separator"][aria-label="Resize panel"]')).not.toBeNull();
+ expect(container.querySelector('[aria-label="Maximize side panel"]')).not.toBeNull();
+ });
+
+ it("still honors the independent Classic Task Interface preference", async () => {
+ mockInstanceSettingsApi.getExperimental.mockResolvedValue({
+ enableStreamlinedUi: false,
+ enableClassicTaskInterface: true,
+ });
+ await renderPanel({ taskDetailLayout: true });
+ const aside = container.querySelector("aside");
+ expect(aside!.style.width).toBe("320px");
+ expect(aside!.querySelector('[role="separator"]')).toBeNull();
+ });
+ });
});
diff --git a/ui/src/components/PropertiesPanel.tsx b/ui/src/components/PropertiesPanel.tsx
index 777d2d9174..26bbd2ca32 100644
--- a/ui/src/components/PropertiesPanel.tsx
+++ b/ui/src/components/PropertiesPanel.tsx
@@ -2,14 +2,17 @@ import { useCallback, useEffect, useRef, useState, type ReactNode } from "react"
import { X } from "lucide-react";
import { usePanel } from "../context/PanelContext";
import { useClassicTaskInterfaceEnabled } from "../hooks/useClassicTaskInterfaceEnabled";
+import { useStreamlinedUiEnabled } from "../hooks/useStreamlinedUiEnabled";
import { cn } from "../lib/utils";
import { Button } from "@/components/ui/button";
import { ScrollArea } from "@/components/ui/scroll-area";
import { SidePanelFrame, SidePanelWindowControls } from "@/components/side-panel";
-export function PropertiesPanel() {
+export function PropertiesPanel({ taskDetailLayout = false }: { taskDetailLayout?: boolean }) {
const { panelContent, panelContentMode, panelVisible, setPanelVisible } = usePanel();
const { enabled: classicTaskInterfaceEnabled } = useClassicTaskInterfaceEnabled();
+ const { enabled: streamlinedUiEnabled } = useStreamlinedUiEnabled();
+ const streamlinedTaskDetailLayout = streamlinedUiEnabled && taskDetailLayout;
if (!panelContent) return null;
@@ -36,23 +39,27 @@ export function PropertiesPanel() {
return (
<ResizablePropertiesPanel
+ key={streamlinedTaskDetailLayout ? "task-detail" : "default"}
panelContent={panelContent}
panelContentMode={panelContentMode}
panelVisible={panelVisible}
setPanelVisible={setPanelVisible}
+ taskDetailLayout={streamlinedTaskDetailLayout}
/>
);
}
/* ------------------------------------------------------------------------- *
- * Chat-style (default) resizable/maximizable variant. Everything below
- * renders only when the Classic Task Interface flag is OFF.
+ * Production chat-style resizable/maximizable variant. Streamlined UI only
+ * changes its task-detail dimensions; Classic Task Interface selects the
+ * fixed panel above.
* ------------------------------------------------------------------------- */
/**
* Portal target in the redesigned pane's header bar: hosted content (the
- * Properties | Plan | Artifacts tab strip) renders here, left of the window
- * controls. See IssueProperties' flag-ON shell.
+ * Properties | Plan | Artifacts tab strip, including the single active
+ * Properties tab) renders here, left of the window controls. See
+ * IssueProperties' flag-ON shell.
*/
export const PROPERTIES_PANE_HEADER_SLOT_ID = "properties-pane-header-slot";
/**
@@ -63,7 +70,9 @@ export const PROPERTIES_PANE_HEADER_SLOT_ID = "properties-pane-header-slot";
export const PROPERTIES_PANE_FOOTER_SLOT_ID = "properties-pane-footer-slot";
const WIDTH_STORAGE_KEY = "taskChatRedesign.propertiesPaneWidth";
+const TASK_DETAIL_WIDTH_STORAGE_KEY = "taskChatRedesign.taskDetailPropertiesPaneWidth";
const DEFAULT_PANE_WIDTH = 322;
+const TASK_DETAIL_DEFAULT_PANE_WIDTH = 434;
const MIN_PANE_WIDTH = 260;
/** ~236px sidebar + ~420px minimum center column stay usable while resizing. */
const RESERVED_LAYOUT_WIDTH = 656;
@@ -84,30 +93,30 @@ function clampPaneWidth(width: number): number {
return Math.min(Math.max(Math.round(width), MIN_PANE_WIDTH), max);
}
-function readStoredPaneWidth(): number {
- if (typeof window === "undefined") return DEFAULT_PANE_WIDTH;
+function readStoredPaneWidth(storageKey: string, defaultWidth: number): number {
+ if (typeof window === "undefined") return defaultWidth;
try {
- const raw = window.localStorage.getItem(WIDTH_STORAGE_KEY);
+ const raw = window.localStorage.getItem(storageKey);
const parsed = raw === null ? Number.NaN : Number(raw);
- return Number.isFinite(parsed) ? parsed : DEFAULT_PANE_WIDTH;
+ return Number.isFinite(parsed) ? parsed : defaultWidth;
} catch {
- return DEFAULT_PANE_WIDTH;
+ return defaultWidth;
}
}
-function persistPaneWidth(width: number) {
+function persistPaneWidth(storageKey: string, width: number) {
if (typeof window === "undefined") return;
try {
- window.localStorage.setItem(WIDTH_STORAGE_KEY, String(width));
+ window.localStorage.setItem(storageKey, String(width));
} catch {
// Ignore storage failures.
}
}
-function clearStoredPaneWidth() {
+function clearStoredPaneWidth(storageKey: string) {
if (typeof window === "undefined") return;
try {
- window.localStorage.removeItem(WIDTH_STORAGE_KEY);
+ window.localStorage.removeItem(storageKey);
} catch {
// Ignore storage failures.
}
@@ -134,6 +143,7 @@ interface ResizablePropertiesPanelProps {
panelContentMode: "padded" | "prose" | "full-bleed";
panelVisible: boolean;
setPanelVisible: (visible: boolean) => void;
+ taskDetailLayout: boolean;
}
function ResizablePropertiesPanel({
@@ -141,8 +151,17 @@ function ResizablePropertiesPanel({
panelContentMode,
panelVisible,
setPanelVisible,
+ taskDetailLayout,
}: ResizablePropertiesPanelProps) {
- const [width, setWidth] = useState(() => clampPaneWidth(readStoredPaneWidth()));
+ const defaultPaneWidth = taskDetailLayout
+ ? TASK_DETAIL_DEFAULT_PANE_WIDTH
+ : DEFAULT_PANE_WIDTH;
+ const widthStorageKey = taskDetailLayout
+ ? TASK_DETAIL_WIDTH_STORAGE_KEY
+ : WIDTH_STORAGE_KEY;
+ const [width, setWidth] = useState(() =>
+ clampPaneWidth(readStoredPaneWidth(widthStorageKey, defaultPaneWidth)),
+ );
const [dragging, setDragging] = useState(false);
const [maximized, setMaximized] = useState(false);
const [fixedPane, setFixedPane] = useState<FixedPane | null>(null);
@@ -192,8 +211,8 @@ function ResizablePropertiesPanel({
dragStateRef.current = null;
setDragging(false);
document.body.style.userSelect = previousBodyUserSelectRef.current;
- if (persist) persistPaneWidth(widthRef.current);
- }, []);
+ if (persist) persistPaneWidth(widthStorageKey, widthRef.current);
+ }, [widthStorageKey]);
const handleGripPointerDown = useCallback((event: React.PointerEvent<HTMLDivElement>) => {
// Primary button only (touch/pen report button 0 or -1 for down events).
@@ -231,9 +250,9 @@ function ResizablePropertiesPanel({
}, [endDrag]);
const handleGripDoubleClick = useCallback(() => {
- setWidth(DEFAULT_PANE_WIDTH);
- clearStoredPaneWidth();
- }, []);
+ setWidth(defaultPaneWidth);
+ clearStoredPaneWidth(widthStorageKey);
+ }, [defaultPaneWidth, widthStorageKey]);
const handleMaximize = useCallback(() => {
const aside = asideRef.current;
@@ -307,7 +326,8 @@ function ResizablePropertiesPanel({
<aside
ref={asideRef}
className={cn(
- "hidden md:flex border-l border-border bg-card flex-col",
+ "hidden md:flex bg-card flex-col",
+ !maximized && "border-l border-border",
isFixed
? "tc-pane-glide fixed z-40 overflow-hidden"
: cn(
@@ -361,6 +381,7 @@ function ResizablePropertiesPanel({
presentation="docked"
maximized={maximized}
contentMode="full-bleed"
+ headerSize={taskDetailLayout ? "task-detail" : "default"}
className="flex-1 border-l-0"
header={(
<div
@@ -371,6 +392,7 @@ function ResizablePropertiesPanel({
trailingControls={(
<SidePanelWindowControls
maximized={maximized}
+ closeControl={taskDetailLayout ? "close" : "toggle"}
onMaximizedChange={(next) => {
if (next) handleMaximize();
else handleRestore();
diff --git a/ui/src/components/TaskChatThread.test.tsx b/ui/src/components/TaskChatThread.test.tsx
index 1dab94cf98..8ea15c6b60 100644
--- a/ui/src/components/TaskChatThread.test.tsx
+++ b/ui/src/components/TaskChatThread.test.tsx
@@ -36,6 +36,7 @@ const DIRECT_ADAPTER_TYPES = [
"http",
"custom_plugin",
] as const;
+const streamlinedState = vi.hoisted(() => ({ enabled: true }));
vi.mock("@/components/transcript/useLiveRunTranscripts", () => ({
useLiveRunTranscripts: ({ runs }: { runs: unknown[] }) => {
@@ -61,6 +62,9 @@ vi.mock("@/context/SidebarContext", () => ({
vi.mock("@/hooks/useIssuePlanDocument", () => ({
useIssuePlanDocument: () => planState,
}));
+vi.mock("@/hooks/useStreamlinedUiEnabled", () => ({
+ useStreamlinedUiEnabled: () => ({ enabled: streamlinedState.enabled, loaded: true }),
+}));
vi.mock("@/lib/router", () => ({
Link: ({
to,
@@ -101,6 +105,7 @@ beforeEach(() => {
transcriptHookRuns.native.length = 0;
sidebarState.isMobile = false;
planState.data = null;
+ streamlinedState.enabled = true;
container = document.createElement("div");
document.body.appendChild(container);
root = createRoot(container);
@@ -269,6 +274,22 @@ function questionInteraction(
} as IssueThreadInteraction;
}
+function createLongThreadComments() {
+ return Array.from({ length: 4 }, (_, index) => ({
+ id: `comment-${index + 1}`,
+ companyId: "company-1",
+ issueId: "issue-1",
+ authorType: "user" as const,
+ authorAgentId: null,
+ authorUserId: "user-1",
+ body: `Thread message ${index + 1}`,
+ presentation: null,
+ metadata: null,
+ createdAt: new Date(`2026-08-15T12:0${index}:00.000Z`),
+ updatedAt: new Date(`2026-08-15T12:0${index}:00.000Z`),
+ }));
+}
+
describe("TaskChatThread draft pass-through", () => {
it("aligns the desktop thread header with the side-panel tab row", () => {
render(
@@ -325,6 +346,10 @@ describe("TaskChatThread draft pass-through", () => {
);
expect(dock?.classList).toContain("px-4");
expect(dock?.classList).not.toContain("px-1");
+ expect(dock?.classList).toContain("-mt-(--radius-task-composer)");
+ expect(dock?.classList).not.toContain("pt-1");
+ expect(dock?.classList).not.toContain("bg-background/80");
+ expect(dock?.classList).not.toContain("backdrop-blur");
});
it("forwards draftKey so the composer restores a task's saved draft", () => {
@@ -332,7 +357,7 @@ describe("TaskChatThread draft pass-through", () => {
render(
<TaskChatThread
- comments={[]}
+ comments={createLongThreadComments()}
onAdd={async () => {}}
draftKey="task-chat-draft:issue-1"
/>,
@@ -1477,6 +1502,25 @@ describe("TaskChatThread composer alignment", () => {
expect(dock?.className).toContain("max-w-(--tc-shell-max-w)");
expect(dock?.className).not.toContain("md:w-(--pct-80)");
});
+
+ it("uses master's production composer and gutters when Streamlined UI is off", () => {
+ streamlinedState.enabled = false;
+ render(<TaskChatThread comments={[]} onAdd={async () => {}} />);
+
+ const dock = container.querySelector('[data-testid="task-chat-composer-dock"]');
+ const composer = container.querySelector(".paperclip-task-chat-composer");
+ const send = container.querySelector('[data-testid="task-chat-composer-send"]');
+
+ expect(dock?.classList).not.toContain("md:px-0");
+ expect(dock?.classList).not.toContain("md:pb-4");
+ expect(dock?.classList).toContain("bg-background/80");
+ expect(dock?.classList).toContain("pt-1");
+ expect(dock?.classList).not.toContain("-mt-(--radius-task-composer)");
+ expect(composer?.classList).not.toContain("border");
+ expect(composer?.classList).toContain("bg-card");
+ expect(send?.classList).toContain("rounded-md");
+ expect(send?.classList).not.toContain("rounded-full");
+ });
});
describe("TaskChatThread no-live-execution-path recovery", () => {
@@ -1551,7 +1595,7 @@ describe("TaskChatThread blocker links", () => {
render(
<TaskChatThread
- comments={[]}
+ comments={createLongThreadComments()}
onAdd={async () => {}}
issueStatus="blocked"
blockedBy={[
@@ -1586,13 +1630,11 @@ describe("TaskChatThread blocker links", () => {
expect(notices).toHaveLength(2);
expect(notices[0]?.getAttribute("data-placement")).toBe("top");
expect(notices[1]?.getAttribute("data-placement")).toBe("bottom");
+ expect(notices[0]?.textContent).toContain("Blocked byPAP-600Waiting in review");
+ expect(notices[0]?.textContent).toContain("Root blockerPAP-777Actual work");
+ expect(notices[1]?.textContent).toContain("Still blocked byPAP-600Waiting in review");
+ expect(notices[1]?.textContent).toContain("Root blocker remainsPAP-777Actual work");
for (const notice of notices) {
- expect(notice.textContent).toContain(
- "Blocked byPAP-600Waiting in review",
- );
- expect(notice.textContent).toContain(
- "Ultimately blocked byPAP-777Actual work",
- );
expect(notice.querySelector('a[href="/issues/PAP-600"]')).not.toBeNull();
expect(notice.querySelector('a[href="/issues/PAP-777"]')).not.toBeNull();
}
@@ -1615,7 +1657,7 @@ describe("TaskChatThread blocker links", () => {
render(
<TaskChatThread
- comments={[]}
+ comments={createLongThreadComments()}
onAdd={async () => {}}
issueStatus="blocked"
liveIssueIds={new Set(["direct-running", "terminal-running"])}
@@ -1672,24 +1714,20 @@ describe("TaskChatThread blocker links", () => {
expect(notices).toHaveLength(2);
expect(notices[0]?.getAttribute("data-placement")).toBe("top");
expect(notices[1]?.getAttribute("data-placement")).toBe("bottom");
+ expect(notices[0]?.textContent).toContain("Waiting on live work");
+ expect(notices[1]?.textContent).toContain("Still waiting on live work");
for (const notice of notices) {
- expect(notice.textContent).toContain("Waiting on live work");
- const orderedLinks = [
- ...notice.querySelectorAll(
- '[data-testid="task-chat-live-work-step"] a',
- ),
- ].map((link) => link.textContent);
+ const orderedLinks = [...notice.querySelectorAll('[data-testid="task-chat-live-work-step"] a')]
+ .map((link) => link.textContent);
expect(orderedLinks).toEqual([
"PAP-17424Run the guarded cutover",
"PAP-17425Verify the live projection",
"PAP-17427Verify the completed projection",
]);
- expect(notice.textContent).toContain(
- "Now runningPAP-17426Restore live alias projection",
- );
- expect(
- notice.querySelector('a[href="/issues/PAP-17426"]'),
- ).not.toBeNull();
+ expect(notice.textContent).toContain("Now runningPAP-17426Restore live alias projection");
+ expect(notice.querySelector('a[href="/issues/PAP-17426"]')).not.toBeNull();
+ expect(notice.querySelector('[data-testid="task-chat-live-work-step"] > a')).not.toBeNull();
+ expect(notice.querySelector('[data-testid="task-chat-live-work-step"] > span')).toBeNull();
}
expect(
container.querySelector('[data-testid="task-chat-blocker-links"]'),
@@ -1699,7 +1737,7 @@ describe("TaskChatThread blocker links", () => {
it("keeps the compact blocker rows when covered work is no longer live", () => {
render(
<TaskChatThread
- comments={[]}
+ comments={createLongThreadComments()}
onAdd={async () => {}}
issueStatus="blocked"
liveIssueIds={new Set()}
@@ -1739,7 +1777,7 @@ describe("TaskChatThread blocker links", () => {
it("shows only the direct row when the blocker has no deeper unresolved leaf", () => {
render(
<TaskChatThread
- comments={[]}
+ comments={createLongThreadComments()}
onAdd={async () => {}}
issueStatus="blocked"
blockedBy={[
@@ -1763,6 +1801,7 @@ describe("TaskChatThread blocker links", () => {
"Blocked byPAP-500Direct dependency",
);
expect(container.textContent).not.toContain("Ultimately blocked by");
+ expect(container.textContent).not.toContain("Root blocker");
});
it("keeps a server-selected intermediate blocker on its direct chain", () => {
@@ -1794,7 +1833,7 @@ describe("TaskChatThread blocker links", () => {
render(
<TaskChatThread
- comments={[]}
+ comments={createLongThreadComments()}
onAdd={async () => {}}
issueStatus="blocked"
blockedBy={[
@@ -1825,34 +1864,16 @@ describe("TaskChatThread blocker links", () => {
/>,
);
- for (const notice of container.querySelectorAll(
- '[data-testid="task-chat-blocker-links"]',
- )) {
- expect(notice.textContent).toContain(
- "Blocked byPAP-600Selected dependency",
- );
- expect(notice.textContent).toContain(
- "Ultimately blocked byPAP-650Stalled intermediate review",
- );
- }
+ const notices = container.querySelectorAll('[data-testid="task-chat-blocker-links"]');
+ expect(notices[0]?.textContent).toContain("Blocked byPAP-600Selected dependency");
+ expect(notices[0]?.textContent).toContain("Root blockerPAP-650Stalled intermediate review");
+ expect(notices[1]?.textContent).toContain("Still blocked byPAP-600Selected dependency");
+ expect(notices[1]?.textContent).toContain("Root blocker remainsPAP-650Stalled intermediate review");
expect(container.textContent).not.toContain("Unrelated dependency");
expect(container.textContent).not.toContain("Deeper structural leaf");
});
it("auto-follows the new bottom blocker row when a pinned thread becomes blocked", () => {
- const comment = {
- id: "comment-1",
- companyId: "company-1",
- issueId: "issue-1",
- authorType: "user" as const,
- authorAgentId: null,
- authorUserId: "user-1",
- body: "Waiting for the dependency.",
- presentation: null,
- metadata: null,
- createdAt: new Date("2026-08-15T12:00:00.000Z"),
- updatedAt: new Date("2026-08-15T12:00:00.000Z"),
- };
const directBlocker = {
id: "direct-1",
identifier: "PAP-500",
@@ -1863,7 +1884,7 @@ describe("TaskChatThread blocker links", () => {
assigneeUserId: null,
};
const baseProps = {
- comments: [comment],
+ comments: createLongThreadComments(),
onAdd: async () => {},
blockedBy: [directBlocker],
};
@@ -1879,10 +1900,33 @@ describe("TaskChatThread blocker links", () => {
expect(scroller.scrollTop).toBe(scroller.scrollHeight);
});
+ it("keeps a short blocked thread to one top affordance", () => {
+ render(
+ <TaskChatThread
+ comments={createLongThreadComments().slice(0, 1)}
+ onAdd={async () => {}}
+ issueStatus="blocked"
+ blockedBy={[{
+ id: "direct-1",
+ identifier: "PAP-500",
+ title: "Direct dependency",
+ status: "todo",
+ priority: "medium",
+ assigneeAgentId: null,
+ assigneeUserId: null,
+ }]}
+ />,
+ );
+
+ const notices = container.querySelectorAll('[data-testid="task-chat-blocker-links"]');
+ expect(notices).toHaveLength(1);
+ expect(notices[0]?.getAttribute("data-placement")).toBe("top");
+ });
+
it("does not show blocker rows outside the blocked state", () => {
render(
<TaskChatThread
- comments={[]}
+ comments={createLongThreadComments()}
onAdd={async () => {}}
issueStatus="in_progress"
blockedBy={[
diff --git a/ui/src/components/TaskChatThread.tsx b/ui/src/components/TaskChatThread.tsx
index c27b644de9..26f14a07d1 100644
--- a/ui/src/components/TaskChatThread.tsx
+++ b/ui/src/components/TaskChatThread.tsx
@@ -80,6 +80,7 @@ import { TaskChatComposer } from "@/components/task-chat/TaskChatComposer";
import { TaskChatQueuedMessages } from "@/components/task-chat/TaskChatQueuedMessages";
import { useWindowAutoFollow } from "@/components/task-chat/useWindowAutoFollow";
import { useSidebar } from "@/context/SidebarContext";
+import { useStreamlinedUiEnabled } from "@/hooks/useStreamlinedUiEnabled";
import { cn } from "@/lib/utils";
import { Button } from "@/components/ui/button";
import { useIssuePlanDocument } from "@/hooks/useIssuePlanDocument";
@@ -98,6 +99,7 @@ import {
workProductHref,
} from "@/lib/issue-artifacts";
import { heartbeatsApi, type RuntimeRequestResolution } from "@/api/heartbeats";
+import { TaskChatPresentationProvider } from "@/components/task-chat/presentation-mode";
function toMs(value: Date | string | null | undefined): number {
if (!value) return 0;
@@ -212,6 +214,16 @@ function isRunnerResponseComment(params: {
// well within this as soon as the settled turn/comment lands.
const SETTLING_TAIL_MAX_MS = 15_000;
const EMPTY_LIVE_ISSUE_IDS: ReadonlySet<string> = new Set<string>();
+const LONG_THREAD_BLOCKER_REPEAT_COUNT = 4;
+
+export function shouldRepeatTaskChatBlockers(items: TaskChatItem[]): boolean {
+ const conversationItems = items.filter((item) => (
+ item.kind === "brief"
+ || item.kind === "interaction"
+ || (item.kind === "message" && !item.interstitial)
+ ));
+ return conversationItems.length >= LONG_THREAD_BLOCKER_REPEAT_COUNT;
+}
function isNativePaperclipRunnerRun(
run:
@@ -432,6 +444,7 @@ function durableInputLabel(
* folded row. flag-OFF remains byte-for-byte IssueChatThread.
*/
export function TaskChatThread(props: TaskChatThreadProps) {
+ const { enabled: streamlinedUiEnabled } = useStreamlinedUiEnabled();
const {
comments,
interactions,
@@ -652,16 +665,6 @@ export function TaskChatThread(props: TaskChatThreadProps) {
</>
) : undefined;
- const bottomBlockerLinks = liveWorkLinks ? (
- <TaskChatLiveWorkLinks liveWork={liveWorkLinks} placement="bottom" />
- ) : blockerLinks ? (
- <TaskChatBlockerLinks
- directBlocker={blockerLinks.directBlocker}
- ultimateBlocker={blockerLinks.ultimateBlocker}
- placement="bottom"
- />
- ) : null;
-
const linkedRunMetaById = useMemo(() => {
const map = new Map<
string,
@@ -1867,6 +1870,18 @@ export function TaskChatThread(props: TaskChatThreadProps) {
? `${tailPlanItem.id}:${tailPlanItem.document.body.length}`
: "";
const threadContentKey = `${taskChatContentKey(items)}:${tailContentKey}:${tailPlanContentKey}:${blockerContentKey}`;
+ const repeatBlockersAtBottom = !streamlinedUiEnabled || shouldRepeatTaskChatBlockers(items);
+ const bottomBlockerLinks = repeatBlockersAtBottom
+ ? liveWorkLinks ? (
+ <TaskChatLiveWorkLinks liveWork={liveWorkLinks} placement="bottom" />
+ ) : blockerLinks ? (
+ <TaskChatBlockerLinks
+ directBlocker={blockerLinks.directBlocker}
+ ultimateBlocker={blockerLinks.ultimateBlocker}
+ placement="bottom"
+ />
+ ) : null
+ : null;
// Status-pill inputs for the tail (PAP-461, A1): the run's start, its finish
// (once terminal), and the "called N tools" summary. Memoized on the
@@ -2311,6 +2326,7 @@ export function TaskChatThread(props: TaskChatThreadProps) {
useWindowAutoFollow(isMobile ? autoFollowContentKey : 0, isMobile);
return (
+ <TaskChatPresentationProvider mode={streamlinedUiEnabled ? "streamlined" : "production"}>
<div
className={cn(
"flex flex-col",
@@ -2328,6 +2344,7 @@ export function TaskChatThread(props: TaskChatThreadProps) {
className={cn(
"mx-auto flex w-full max-w-(--tc-shell-max-w) flex-col gap-6 px-4",
isMobile ? "pt-4" : "pt-3",
+ streamlinedUiEnabled && "md:px-0",
)}
data-testid="task-chat-thread-header"
>
@@ -2338,7 +2355,10 @@ export function TaskChatThread(props: TaskChatThreadProps) {
{emptyMessage}
</div>
{bottomBlockerLinks ? (
- <div className="mx-auto w-full max-w-(--tc-shell-max-w) px-4 pb-4">
+ <div className={cn(
+ "mx-auto w-full max-w-(--tc-shell-max-w) px-4 pb-4",
+ streamlinedUiEnabled && "md:px-0",
+ )}>
{bottomBlockerLinks}
</div>
) : null}
@@ -2446,7 +2466,11 @@ export function TaskChatThread(props: TaskChatThreadProps) {
isMobile
? "bottom-(--tc-composer-bottom) z-20 transition-[bottom] duration-200 ease-out"
: "bottom-0 z-10",
- "mx-auto flex w-full max-w-(--tc-shell-max-w) flex-col gap-2 bg-background/80 px-4 pb-2 pt-1 backdrop-blur supports-[backdrop-filter]:bg-background/60",
+ "mx-auto flex w-full max-w-(--tc-shell-max-w) flex-col gap-2 px-4 pb-2",
+ streamlinedUiEnabled && "md:px-0 md:pb-4",
+ streamlinedUiEnabled && !isMobile
+ ? "-mt-(--radius-task-composer)"
+ : "bg-background/80 pt-1 backdrop-blur supports-[backdrop-filter]:bg-background/60",
)}
>
{composerAccessory}
@@ -2517,5 +2541,6 @@ export function TaskChatThread(props: TaskChatThreadProps) {
</div>
) : null}
</div>
+ </TaskChatPresentationProvider>
);
}
diff --git a/ui/src/components/issue-properties/IssueProperties.tsx b/ui/src/components/issue-properties/IssueProperties.tsx
index 4d211f3146..d1af86d380 100644
--- a/ui/src/components/issue-properties/IssueProperties.tsx
+++ b/ui/src/components/issue-properties/IssueProperties.tsx
@@ -1,7 +1,6 @@
import { useCallback, useEffect, useMemo, useRef, useState, type ComponentType } from "react";
import { createPortal } from "react-dom";
import { PROPERTIES_PANE_HEADER_SLOT_ID } from "../PropertiesPanel";
-import { pickTextColorForPillBg } from "@/lib/color-contrast";
import { issueStatusText } from "@/lib/status-colors";
import { copyTextToClipboard } from "@/lib/clipboard";
import { Link } from "@/lib/router";
@@ -21,6 +20,7 @@ import { instanceSettingsApi } from "../../api/instanceSettings";
import { issuesApi } from "../../api/issues";
import { useIssuePlanDocument } from "@/hooks/useIssuePlanDocument";
import { useIssueDocuments } from "@/hooks/useIssueDocuments";
+import { useStreamlinedUiEnabled } from "@/hooks/useStreamlinedUiEnabled";
import { selectAgentArtifactAttachments } from "@/lib/issue-artifacts";
import { projectsApi } from "../../api/projects";
import { useCompany } from "../../context/CompanyContext";
@@ -55,6 +55,7 @@ import { StatusIcon } from "../StatusIcon";
import { PriorityIcon } from "../PriorityIcon";
import { SHOW_TASK_PRIORITY_UI } from "../../lib/ui-flags";
import { Identity } from "../Identity";
+import { ProjectTile } from "../ProjectTile";
import { IssueReferencePill } from "../IssueReferencePill";
import { formatDate, formatDateTime, cn, projectUrl } from "../../lib/utils";
import type { IssueExternalObjectGroup } from "../../hooks/useIssueExternalObjects";
@@ -67,9 +68,15 @@ import { Textarea } from "@/components/ui/textarea";
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+} from "@/components/ui/dropdown-menu";
import { IssuePropertiesPlansTab } from "./IssuePropertiesPlansTab";
import { IssuePropertiesArtifactsTab } from "./IssuePropertiesArtifactsTab";
-import { User, ArrowUpRight, Plus, GitBranch, FolderOpen, HardDrive, Check, Clock, RotateCcw, Loader2, CheckCircle2, ArchiveRestore, ChevronLeft } from "lucide-react";
+import { User, ArrowUpRight, Plus, X, GitBranch, FolderOpen, HardDrive, Check, Clock, RotateCcw, Loader2, CheckCircle2, ArchiveRestore, ChevronLeft } from "lucide-react";
import { AgentIcon } from "../AgentIconPicker";
import { InlineEntitySelector, type InlineEntityOption } from "../InlineEntitySelector";
import {
@@ -112,6 +119,20 @@ import { issueReviewPolicyBadge } from "../../lib/review-policy";
import { IssueCasesPanel } from "../IssueCasesPanel";
import { ExpandRelationListButton, RemovableIssueReferencePill } from "./relation-controls";
import { Badge } from "@/components/ui/badge";
+import {
+ TaskDetailReferencesPanel,
+ TaskDetailSubtasksPanel,
+ type TaskDetailRelationItem,
+} from "../task-detail/TaskDetailRelationsPanel";
+
+function splitMiddleTruncation(value: string): { prefix: string; suffix: string } | null {
+ const splitAt = Math.max(value.lastIndexOf("/"), value.lastIndexOf("\\"));
+ if (splitAt <= 0 || splitAt >= value.length - 1) return null;
+ return {
+ prefix: value.slice(0, splitAt + 1),
+ suffix: value.slice(splitAt + 1),
+ };
+}
function TruncatedCopyable({ value, icon: Icon }: { value: string; icon: ComponentType<{ className?: string }> }) {
const [copied, setCopied] = useState(false);
@@ -125,18 +146,30 @@ function TruncatedCopyable({ value, icon: Icon }: { value: string; icon: Compone
timerRef.current = setTimeout(() => setCopied(false), 1500);
} catch { /* noop */ }
}, [value]);
+ const { enabled: streamlinedUiEnabled } = useStreamlinedUiEnabled();
+ const middle = streamlinedUiEnabled ? splitMiddleTruncation(value) : null;
return (
<div className="flex items-center gap-1.5 min-w-0 flex-1" title={value}>
<Icon className="h-3.5 w-3.5 text-muted-foreground shrink-0" />
<button
type="button"
- className="text-sm font-mono min-w-0 truncate text-left cursor-pointer hover:text-foreground transition-colors"
+ className={cn(
+ "cursor-pointer text-left font-mono text-sm transition-colors hover:text-foreground",
+ streamlinedUiEnabled ? "min-w-0 flex-1" : "min-w-0 truncate",
+ )}
onClick={handleCopy}
title={value}
aria-label={`Copy ${value} to clipboard`}
>
- {value}
+ {!streamlinedUiEnabled ? value : middle ? (
+ <span className="flex min-w-0" data-middle-truncate="true">
+ <span className="min-w-0 truncate">{middle.prefix}</span>
+ <span className="max-w-1/2 shrink-0 truncate">{middle.suffix}</span>
+ </span>
+ ) : (
+ <span className="block truncate">{value}</span>
+ )}
</button>
{copied && (
<span className={cn("inline-flex items-center gap-1 text-xs shrink-0", issueStatusText.done)} role="status">
@@ -151,6 +184,7 @@ function TruncatedCopyable({ value, icon: Icon }: { value: string; icon: Compone
interface IssuePropertiesProps {
issue: Issue;
childIssues?: Issue[];
+ issueLinkState?: unknown;
onAddSubIssue?: () => void;
onUpdate: (data: Record<string, unknown>) => void;
inline?: boolean;
@@ -176,10 +210,22 @@ export interface IssuePropertiesDocumentDeepLink {
const ISSUE_BLOCKER_SEARCH_LIMIT = 50;
const ISSUE_PROPERTY_RELATION_PREVIEW_COUNT = 5;
+const STREAMLINED_PANE_TAB_CLASS =
+ "task-detail-pane-tab h-7 rounded-md text-sm font-medium focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring";
+
+type IssuePaneTab = "properties" | "subtasks" | "references" | "plans" | "artifacts";
+
+interface IssuePaneTabDescriptor {
+ value: IssuePaneTab;
+ label: string;
+ count?: number;
+ closable: boolean;
+}
export function IssueProperties({
issue,
childIssues = [],
+ issueLinkState,
onAddSubIssue,
onUpdate,
inline,
@@ -208,12 +254,17 @@ export function IssueProperties({
// the folder the policy exists to hide.
const hideHostPaths =
experimentalSettings === undefined || experimentalSettings.enableManagedSandboxOnly === true;
+ const { enabled: streamlinedUiEnabled } = useStreamlinedUiEnabled();
// Classic Task Interface: gate the Properties | Plans | Artifacts tab shell.
// Flag ON renders the legacy stacked sections verbatim (no Tabs wrapper);
// flag OFF — including while settings load — renders the chat-style tab
// shell. This pane is always task-scoped, so the flag alone is a sufficient
// gate.
+ // Classic Task Interface alone controls the production tabbed-vs-stacked
+ // boundary. Streamlined UI layers new relationship tabs and visual treatment
+ // onto master's tabbed task-chat pane without changing that boundary.
const taskChatShellEnabled = experimentalSettings?.enableClassicTaskInterface !== true;
+ const streamlinedPropertiesEnabled = streamlinedUiEnabled && taskChatShellEnabled;
// When hosted by the resizable PropertiesPanel, the tab strip portals into
// the pane's header bar (left of the window controls). The slot only exists
// once the panel has committed, hence the effect; inline hosts (mobile sheet)
@@ -264,7 +315,8 @@ export function IssueProperties({
(paneTabWorkProducts?.length ?? 0) > 0
|| paneTabStandaloneDocuments.length > 0
|| selectAgentArtifactAttachments(paneTabAttachments, paneTabWorkProducts).length > 0;
- const [paneTab, setPaneTab] = useState("properties");
+ const [paneTab, setPaneTab] = useState<IssuePaneTab>("properties");
+ const [closedPaneTabs, setClosedPaneTabs] = useState<Set<IssuePaneTab>>(() => new Set());
// Once a plan document exists, surface it: switch the pane to the Plan tab so
// the write-up is exposed alongside the plan-approval card, instead of leaving
// the user on Properties. Only auto-switch until the user picks a tab by hand —
@@ -272,8 +324,11 @@ export function IssueProperties({
const paneTabUserChosenRef = useRef(false);
const handlePaneTabChange = useCallback((value: string) => {
paneTabUserChosenRef.current = true;
- setPaneTab(value);
+ setPaneTab(value as IssuePaneTab);
}, []);
+ useEffect(() => {
+ setClosedPaneTabs(new Set());
+ }, [issue.id]);
useEffect(() => {
if (hasPlanTab && !paneTabUserChosenRef.current) {
setPaneTab("plans");
@@ -281,9 +336,16 @@ export function IssueProperties({
}, [hasPlanTab]);
useEffect(() => {
if (!documentDeepLink) return;
- if (documentDeepLink.tab === "document") return;
+ const targetTab = documentDeepLink.tab;
+ if (targetTab === "document") return;
paneTabUserChosenRef.current = true;
- setPaneTab(documentDeepLink.tab);
+ setPaneTab(targetTab);
+ setClosedPaneTabs((current) => {
+ if (!current.has(targetTab)) return current;
+ const next = new Set(current);
+ next.delete(targetTab);
+ return next;
+ });
}, [documentDeepLink]);
const [assigneeOpen, setAssigneeOpen] = useState(false);
const [assigneeSearch, setAssigneeSearch] = useState("");
@@ -305,6 +367,7 @@ export function IssueProperties({
const [blockedByExpanded, setBlockedByExpanded] = useState(false);
const [blockingExpanded, setBlockingExpanded] = useState(false);
const [subTasksExpanded, setSubTasksExpanded] = useState(false);
+ const [subtasksOpen, setSubtasksOpen] = useState(false);
const [relatedTasksExpanded, setRelatedTasksExpanded] = useState(false);
const [parentOpen, setParentOpen] = useState(false);
const [parentSearch, setParentSearch] = useState("");
@@ -606,6 +669,29 @@ export function IssueProperties({
.filter((identifier) => !excluded.has(identifier))
.map((identifier) => ({ id: identifier, identifier, title: identifier }));
}, [childIssues, issue.blockedBy, issue.blocks, issue.relatedWork?.outbound, referencedIssueIdentifiers]);
+ const panelReferencedTasks = useMemo<TaskDetailRelationItem[]>(() => {
+ const outbound = issue.relatedWork?.outbound.map(({ issue: referenced }) => ({
+ id: referenced.id,
+ identifier: referenced.identifier,
+ title: referenced.title,
+ status: referenced.status,
+ })) ?? [];
+ if (outbound.length > 0) return outbound;
+ return referencedIssueIdentifiers.map((identifier) => ({
+ id: identifier,
+ identifier,
+ title: identifier,
+ }));
+ }, [issue.relatedWork?.outbound, referencedIssueIdentifiers]);
+ const panelMentionedInTasks = useMemo<TaskDetailRelationItem[]>(
+ () => issue.relatedWork?.inbound.map(({ issue: referenced }) => ({
+ id: referenced.id,
+ identifier: referenced.identifier,
+ title: referenced.title,
+ status: referenced.status,
+ })) ?? [],
+ [issue.relatedWork?.inbound],
+ );
const projectLink = (id: string | null) => {
if (!id) return null;
const project = projects?.find((p) => p.id === id) ?? null;
@@ -1046,6 +1132,18 @@ export function IssueProperties({
) : (
<span className="text-sm text-muted-foreground">None</span>
);
+ const labelsExtra = !streamlinedPropertiesEnabled && (issue.labelIds ?? []).length > 0 ? (
+ <button
+ type="button"
+ className="inline-flex items-center gap-1 rounded-full border border-border px-2 py-0.5 text-xs text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground"
+ onClick={() => setLabelsOpen(true)}
+ aria-label="Add label"
+ title="Add label"
+ >
+ <Plus className="h-3 w-3" />
+ Add label
+ </button>
+ ) : undefined;
const watchdogContent = (
<div className="space-y-3 p-2">
<div className="space-y-1.5">
@@ -1481,14 +1579,14 @@ export function IssueProperties({
}, [issue.labelIds, issue.labels, labels]);
const labelsTrigger = selectedIssueLabels.length > 0 ? (
- <div className="flex items-center gap-1 flex-wrap">
+ <div className="flex min-w-0 flex-col items-start gap-1">
{selectedIssueLabels.slice(0, 3).map((label) => (
<PropertyChip
key={label.id}
+ className="border-0"
style={{
- borderColor: label.color,
backgroundColor: `${label.color}22`,
- color: pickTextColorForPillBg(label.color, 0.13),
+ color: label.color,
}}
>
{label.name}
@@ -1503,19 +1601,6 @@ export function IssueProperties({
) : (
<span className="text-sm text-muted-foreground">None</span>
);
- const labelsExtra = (issue.labelIds ?? []).length > 0 ? (
- <button
- type="button"
- className="inline-flex items-center gap-1 rounded-full border border-border px-2 py-0.5 text-xs text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground"
- onClick={() => setLabelsOpen(true)}
- aria-label="Add label"
- title="Add label"
- >
- <Plus className="h-3 w-3" />
- Add label
- </button>
- ) : undefined;
-
const labelsContent = (
<>
<input
@@ -1832,9 +1917,10 @@ export function IssueProperties({
const projectTrigger = issue.projectId ? (
<>
- <span
- className="shrink-0 h-3 w-3 rounded-sm"
- style={{ backgroundColor: orderedProjects.find((p) => p.id === issue.projectId)?.color ?? "var(--project-seed)" }}
+ <ProjectTile
+ color={issueProject?.color ?? null}
+ icon={issueProject?.icon ?? null}
+ size="xs"
/>
<span className="text-sm truncate min-w-0" title={projectName(issue.projectId)}>{projectName(issue.projectId)}</span>
</>
@@ -1905,9 +1991,10 @@ export function IssueProperties({
}}
>
{option.kind === "project" ? (
- <span
- className="shrink-0 h-3 w-3 rounded-sm"
- style={{ backgroundColor: option.color ?? "var(--project-seed)" }}
+ <ProjectTile
+ color={option.project.color ?? null}
+ icon={option.project.icon ?? null}
+ size="xs"
/>
) : null}
{option.name}
@@ -1932,6 +2019,38 @@ export function IssueProperties({
? blockingIssues
: blockingIssues.slice(0, ISSUE_PROPERTY_RELATION_PREVIEW_COUNT);
const hiddenBlockingIssueCount = blockingIssues.length - visibleBlockingIssues.length;
+ const blockedByTrigger = blockedByRelations.length > 0 ? (
+ <div className="flex min-w-0 flex-col items-start gap-1">
+ {blockedByRelations.slice(0, 2).map((relation) => (
+ <PropertyChip key={relation.id}>
+ {relation.identifier ?? relation.title}
+ </PropertyChip>
+ ))}
+ {blockedByRelations.length > 2 ? (
+ <Badge variant="outline" className="border-border text-muted-foreground">
+ +{blockedByRelations.length - 2} more
+ </Badge>
+ ) : null}
+ </div>
+ ) : (
+ <span className="text-sm text-muted-foreground">None</span>
+ );
+ const subtasksTrigger = childIssues.length > 0 ? (
+ <div className="flex min-w-0 flex-col items-start gap-1">
+ {childIssues.slice(0, 2).map((child) => (
+ <PropertyChip key={child.id}>
+ {child.identifier ?? child.title}
+ </PropertyChip>
+ ))}
+ {childIssues.length > 2 ? (
+ <Badge variant="outline" className="border-border text-muted-foreground">
+ +{childIssues.length - 2} more
+ </Badge>
+ ) : null}
+ </div>
+ ) : (
+ <span className="text-sm text-muted-foreground">None</span>
+ );
const visibleRelatedTasks = relatedTasksExpanded
? relatedTasks
: relatedTasks.slice(0, ISSUE_PROPERTY_RELATION_PREVIEW_COUNT);
@@ -2048,9 +2167,20 @@ export function IssueProperties({
</>
);
const blockerSearchActive = normalizedBlockedBySearch.length > 0;
- const blockerSourceIssues = blockerSearchActive ? searchedBlockedByIssues : allIssues;
- const blockerOptions = (blockerSourceIssues ?? [])
- .filter((candidate) => candidate.id !== issue.id);
+ const blockerSourceIssues = blockerSearchActive
+ ? searchedBlockedByIssues
+ : streamlinedPropertiesEnabled
+ ? [...(issue.blockedBy ?? []), ...(allIssues ?? [])]
+ : allIssues;
+ const blockerOptions = streamlinedPropertiesEnabled
+ ? Array.from(
+ new Map(
+ (blockerSourceIssues ?? [])
+ .filter((candidate) => candidate.id !== issue.id)
+ .map((candidate) => [candidate.id, candidate]),
+ ).values(),
+ )
+ : (blockerSourceIssues ?? []).filter((candidate) => candidate.id !== issue.id);
if (!blockerSearchActive) {
blockerOptions.sort((a, b) => {
const aLabel = `${a.identifier ?? ""} ${a.title}`.trim();
@@ -2073,7 +2203,6 @@ export function IssueProperties({
const removeBlockedBy = (blockedByIssueId: string) => {
onUpdate({ blockedByIssueIds: blockedByIds.filter((candidate) => candidate !== blockedByIssueId) });
};
-
const blockedByContent = (
<>
<input
@@ -2136,10 +2265,52 @@ export function IssueProperties({
Add blocker
</button>
);
+ const subtasksContent = (
+ <>
+ <div className="max-h-48 overflow-y-auto overscroll-contain">
+ {childIssues.length > 0 ? childIssues.map((child) => (
+ <Link
+ key={child.id}
+ to={`/issues/${child.identifier ?? child.id}`}
+ state={issueLinkState}
+ className="flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-xs hover:bg-accent/50"
+ onClick={() => setSubtasksOpen(false)}
+ >
+ <StatusIcon status={child.status} className="h-3 w-3" />
+ <span className="min-w-0 truncate">
+ {child.identifier ? `${child.identifier} ` : ""}
+ {child.title}
+ </span>
+ </Link>
+ )) : (
+ <div className="px-2 py-2 text-xs text-muted-foreground">No subtasks yet.</div>
+ )}
+ </div>
+ {onAddSubIssue ? (
+ <div className="mt-2 border-t border-border pt-2">
+ <button
+ type="button"
+ className="flex w-full items-center justify-center gap-1.5 rounded border border-border px-2 py-1.5 text-xs hover:bg-accent/50"
+ onClick={() => {
+ setSubtasksOpen(false);
+ onAddSubIssue();
+ }}
+ >
+ <Plus className="h-3 w-3" />
+ Add subtask
+ </button>
+ </div>
+ ) : null}
+ </>
+ );
const propertiesBody = (
- <div>
- <PropertySection title="Triage" first>
+ <div className={cn(streamlinedPropertiesEnabled && "task-detail-properties pl-4")}>
+ <PropertySection
+ title={streamlinedPropertiesEnabled ? "Work" : "Triage"}
+ first
+ streamlined={streamlinedPropertiesEnabled}
+ >
<PropertyRow label="Status">
<StatusIcon
status={issue.status}
@@ -2161,19 +2332,6 @@ export function IssueProperties({
</PropertyRow>
)}
- <PropertyPicker
- inline={inline}
- label="Labels"
- open={labelsOpen}
- onOpenChange={(open) => { setLabelsOpen(open); if (!open) setLabelSearch(""); }}
- triggerContent={labelsTrigger}
- triggerClassName="min-w-0 max-w-full"
- popoverClassName="w-64"
- extra={labelsExtra}
- >
- {labelsContent}
- </PropertyPicker>
-
<PropertyPicker
inline={inline}
label="Assignee"
@@ -2228,9 +2386,23 @@ export function IssueProperties({
>
{projectContent}
</PropertyPicker>
+
+ <PropertyPicker
+ inline={inline}
+ label="Labels"
+ open={labelsOpen}
+ onOpenChange={(open) => { setLabelsOpen(open); if (!open) setLabelSearch(""); }}
+ triggerContent={labelsTrigger}
+ triggerClassName="min-w-0 max-w-full"
+ popoverClassName="w-64"
+ extra={labelsExtra}
+ stacked
+ >
+ {labelsContent}
+ </PropertyPicker>
</PropertySection>
- <PropertySection title="Relationships">
+ <PropertySection title="Relationships" streamlined={streamlinedPropertiesEnabled}>
<PropertyPicker
inline={inline}
label="Parent"
@@ -2247,7 +2419,23 @@ export function IssueProperties({
{parentContent}
</PropertyPicker>
- {inline ? (
+ {streamlinedPropertiesEnabled ? (
+ <PropertyPicker
+ inline={inline}
+ label="Blocked by"
+ open={blockedByOpen}
+ onOpenChange={(open) => {
+ setBlockedByOpen(open);
+ if (!open) setBlockedBySearch("");
+ }}
+ triggerContent={blockedByTrigger}
+ triggerClassName="min-w-0 max-w-full"
+ popoverClassName="w-72"
+ stacked
+ >
+ {blockedByContent}
+ </PropertyPicker>
+ ) : inline ? (
<div>
<PropertyRow label="Blocked by" wrap>
{visibleBlockedByRelations.map((relation) => (
@@ -2265,11 +2453,11 @@ export function IssueProperties({
/>
{renderAddBlockedByButton(() => setBlockedByOpen((open) => !open))}
</PropertyRow>
- {blockedByOpen && (
+ {blockedByOpen ? (
<div className="rounded-md border border-border bg-popover p-1 mb-2">
{blockedByContent}
</div>
- )}
+ ) : null}
</div>
) : (
<PropertyRow label="Blocked by" wrap>
@@ -2293,9 +2481,7 @@ export function IssueProperties({
if (!open) setBlockedBySearch("");
}}
>
- <PopoverTrigger asChild>
- {renderAddBlockedByButton()}
- </PopoverTrigger>
+ <PopoverTrigger asChild>{renderAddBlockedByButton()}</PopoverTrigger>
<PopoverContent className="w-72 p-1" align="end" collisionPadding={16}>
{blockedByContent}
</PopoverContent>
@@ -2305,7 +2491,7 @@ export function IssueProperties({
<PropertyRow label="Blocking" wrap>
{blockingIssues.length > 0 ? (
- <div className="flex flex-wrap items-center gap-1.5">
+ <div className="flex flex-col items-start gap-1.5">
{visibleBlockingIssues.map((relation) => (
<IssueReferencePill key={relation.id} issue={relation} />
))}
@@ -2320,17 +2506,25 @@ export function IssueProperties({
)}
</PropertyRow>
- {/* Chat shell promotes sub-tasks to their own pane tab (the full tree),
- so the slim pill row here would duplicate that home (PAP-496). Keep
- the pill row only for the classic center-column layout. */}
- {taskChatShellEnabled ? null : (
+ {streamlinedPropertiesEnabled ? (
+ <PropertyPicker
+ inline={inline}
+ label="Subtasks"
+ open={subtasksOpen}
+ onOpenChange={setSubtasksOpen}
+ triggerContent={subtasksTrigger}
+ triggerClassName="min-w-0 max-w-full"
+ popoverClassName="w-72"
+ stacked
+ >
+ {subtasksContent}
+ </PropertyPicker>
+ ) : !taskChatShellEnabled ? (
<PropertyRow label="Sub-tasks" wrap>
- <div className="flex flex-wrap items-center gap-1.5">
- {childIssues.length > 0
- ? visibleChildIssues.map((child) => (
- <IssueReferencePill key={child.id} issue={child} />
- ))
- : null}
+ <div className="flex flex-col items-start gap-1.5">
+ {visibleChildIssues.map((child) => (
+ <IssueReferencePill key={child.id} issue={child} />
+ ))}
<ExpandRelationListButton
hiddenCount={hiddenChildIssueCount}
expanded={subTasksExpanded}
@@ -2348,11 +2542,11 @@ export function IssueProperties({
) : null}
</div>
</PropertyRow>
- )}
+ ) : null}
- {relatedTasks.length > 0 ? (
- <PropertyRow label="Related tasks" wrap>
- <div className="flex flex-wrap items-center gap-1.5">
+ {(!streamlinedPropertiesEnabled || !taskChatShellEnabled) && relatedTasks.length > 0 ? (
+ <PropertyRow label={streamlinedPropertiesEnabled ? "Referenced" : "Related tasks"} wrap>
+ <div className="flex flex-col items-start gap-1.5">
{visibleRelatedTasks.map((related) => (
<IssueReferencePill key={related.id} issue={related} />
))}
@@ -2373,7 +2567,7 @@ export function IssueProperties({
/>
</PropertySection>
- <PropertySection title="Execution">
+ <PropertySection title="Execution" streamlined={streamlinedPropertiesEnabled}>
{/* Read-only: agents set the policy, the board does not. */}
{reviewPolicyBadge ? (
<PropertyRow label="Approvals">
@@ -2482,7 +2676,7 @@ export function IssueProperties({
</PropertySection>
{workspacePickerEligible || hasWorkspaceRuntimeControls || issue.currentExecutionWorkspace?.branchName || issue.currentExecutionWorkspace?.cwd || issue.executionWorkspaceId ? (
- <PropertySection title="Workspace">
+ <PropertySection title="Workspace" streamlined={streamlinedPropertiesEnabled}>
{workspacePickerEligible ? (
<PropertyPicker
inline={inline}
@@ -2651,7 +2845,7 @@ export function IssueProperties({
</PropertySection>
) : null}
- <PropertySection title="About">
+ <PropertySection title="About" streamlined={streamlinedPropertiesEnabled}>
{originatingActor ? (
<PropertyRow label="Originating">
{originatingActor.kind === "agent" ? (
@@ -2683,19 +2877,31 @@ export function IssueProperties({
) : null}
{issue.startedAt && (
<PropertyRow label="Started">
- <span className="text-sm">{formatDateTime(issue.startedAt)}</span>
+ <span
+ className={streamlinedPropertiesEnabled ? "min-w-0 truncate whitespace-nowrap text-sm" : "text-sm"}
+ title={streamlinedPropertiesEnabled ? formatDateTime(issue.startedAt) : undefined}
+ >{formatDateTime(issue.startedAt)}</span>
</PropertyRow>
)}
{issue.completedAt && (
<PropertyRow label="Completed">
- <span className="text-sm">{formatDateTime(issue.completedAt)}</span>
+ <span
+ className={streamlinedPropertiesEnabled ? "min-w-0 truncate whitespace-nowrap text-sm" : "text-sm"}
+ title={streamlinedPropertiesEnabled ? formatDateTime(issue.completedAt) : undefined}
+ >{formatDateTime(issue.completedAt)}</span>
</PropertyRow>
)}
<PropertyRow label="Created">
- <span className="text-sm">{formatDateTime(issue.createdAt)}</span>
+ <span
+ className={streamlinedPropertiesEnabled ? "min-w-0 truncate whitespace-nowrap text-sm" : "text-sm"}
+ title={streamlinedPropertiesEnabled ? formatDateTime(issue.createdAt) : undefined}
+ >{formatDateTime(issue.createdAt)}</span>
</PropertyRow>
<PropertyRow label="Updated">
- <span className="text-sm">{timeAgo(issue.updatedAt)}</span>
+ <span
+ className={streamlinedPropertiesEnabled ? "min-w-0 truncate whitespace-nowrap text-sm" : "text-sm"}
+ title={streamlinedPropertiesEnabled ? timeAgo(issue.updatedAt) : undefined}
+ >{timeAgo(issue.updatedAt)}</span>
</PropertyRow>
{issue.archivedAt && issue.archivedByActorType === "agent" && issue.archivedByAgentId ? (
(() => {
@@ -2761,13 +2967,51 @@ export function IssueProperties({
// Classic Task Interface ON: the legacy stacked pane, byte-for-byte.
if (!taskChatShellEnabled || sidePanelContentOnly) return propertiesBody;
- // Chat-style with nothing to switch between: no tab strip — the header bar
- // shows a plain title and the pane body is just the properties stack.
- if (!hasPlanTab && !hasArtifactsTab) {
+ const hasSubtasksTab = streamlinedPropertiesEnabled && childIssues.length > 0;
+ const hasReferencesTab = streamlinedPropertiesEnabled
+ && (panelReferencedTasks.length > 0 || panelMentionedInTasks.length > 0);
+ const availablePaneTabs: IssuePaneTabDescriptor[] = [
+ { value: "properties", label: "Properties", closable: false },
+ ...(hasSubtasksTab
+ ? [{ value: "subtasks" as const, label: "Subtasks", count: childIssues.length, closable: true }]
+ : []),
+ ...(hasReferencesTab
+ ? [{ value: "references" as const, label: "References", closable: true }]
+ : []),
+ ...(hasPlanTab
+ ? [{ value: "plans" as const, label: "Plan", closable: true }]
+ : []),
+ ...(hasArtifactsTab
+ ? [{ value: "artifacts" as const, label: "Artifacts", closable: true }]
+ : []),
+ ];
+ const visiblePaneTabs = availablePaneTabs.filter(
+ (tab) => tab.value === "properties" || !closedPaneTabs.has(tab.value),
+ );
+ const hiddenPaneTabs = availablePaneTabs.filter((tab) => closedPaneTabs.has(tab.value));
+
+ // Chat-style with nothing to switch between: render one selected tab button
+ // so the header uses the same filled-tab treatment as the multi-tab state.
+ if (!hasSubtasksTab && !hasReferencesTab && !hasPlanTab && !hasArtifactsTab) {
return (
<>
{paneHeaderSlot
- ? createPortal(<span className="text-sm font-medium">Properties</span>, paneHeaderSlot)
+ ? streamlinedPropertiesEnabled ? createPortal(
+ <div className="flex items-center" role="tablist" aria-label="Properties panel sections">
+ <button
+ type="button"
+ role="tab"
+ aria-selected="true"
+ className={cn(
+ STREAMLINED_PANE_TAB_CLASS,
+ "inline-flex flex-none items-center bg-muted px-3",
+ )}
+ >
+ Properties
+ </button>
+ </div>,
+ paneHeaderSlot,
+ ) : createPortal(<span className="text-sm font-medium">Properties</span>, paneHeaderSlot)
: null}
{propertiesBody}
</>
@@ -2783,37 +3027,150 @@ export function IssueProperties({
const activePaneTab =
(paneTab === "plans" && !hasPlanTab)
|| (paneTab === "artifacts" && !hasArtifactsTab)
+ || (paneTab === "subtasks" && !hasSubtasksTab)
+ || (paneTab === "references" && !hasReferencesTab)
+ || closedPaneTabs.has(paneTab)
? "properties"
: paneTab;
- // In the pane header the strip stretches to the bar's full height and the
- // active underline drops to bottom-0, so it hugs the header's border line.
+ const closePaneTab = (value: IssuePaneTab) => {
+ if (value === "properties") return;
+ paneTabUserChosenRef.current = true;
+ setClosedPaneTabs((current) => {
+ const next = new Set(current);
+ next.add(value);
+ return next;
+ });
+ if (activePaneTab !== value) return;
+ const closingIndex = visiblePaneTabs.findIndex((tab) => tab.value === value);
+ const fallback = visiblePaneTabs[closingIndex - 1]
+ ?? visiblePaneTabs[closingIndex + 1]
+ ?? availablePaneTabs[0];
+ setPaneTab(fallback.value);
+ };
+ const reopenPaneTab = (value: IssuePaneTab) => {
+ paneTabUserChosenRef.current = true;
+ setClosedPaneTabs((current) => {
+ if (!current.has(value)) return current;
+ const next = new Set(current);
+ next.delete(value);
+ return next;
+ });
+ setPaneTab(value);
+ };
+ const codexStylePaneTabs = Boolean(paneHeaderSlot && streamlinedPropertiesEnabled);
+ // Production keeps the master underline treatment. Streamlined task detail
+ // uses the compact, truncating Codex-inspired pane-tab treatment instead.
const paneTabTriggerClass = paneHeaderSlot
- ? "h-full group-data-[orientation=horizontal]/tabs:after:bottom-0"
+ ? streamlinedPropertiesEnabled
+ ? cn(
+ STREAMLINED_PANE_TAB_CLASS,
+ "min-w-0 flex-1 justify-start overflow-hidden after:hidden",
+ )
+ : "h-full group-data-[orientation=horizontal]/tabs:after:bottom-0"
: undefined;
- const tabStrip = (
+ const paneTabs = codexStylePaneTabs ? visiblePaneTabs : availablePaneTabs;
+ const tabList = (
<TabsList
variant="line"
className={
paneHeaderSlot
- ? "items-stretch justify-start gap-1 p-0 group-data-[orientation=horizontal]/tabs:h-full"
+ ? streamlinedPropertiesEnabled
+ ? "min-w-0 flex-1 items-center justify-start gap-0 overflow-hidden p-0 group-data-[orientation=horizontal]/tabs:h-full"
+ : "items-stretch justify-start gap-1 p-0 group-data-[orientation=horizontal]/tabs:h-full"
: "w-full justify-start gap-1"
}
>
- <TabsTrigger value="properties" className={paneTabTriggerClass}>
- Properties
- </TabsTrigger>
- {hasPlanTab ? (
- <TabsTrigger value="plans" className={paneTabTriggerClass}>
- Plan
- </TabsTrigger>
- ) : null}
- {hasArtifactsTab ? (
- <TabsTrigger value="artifacts" className={paneTabTriggerClass}>
- Artifacts
- </TabsTrigger>
- ) : null}
+ {paneTabs.map((tab, index) => {
+ const trigger = (
+ <TabsTrigger
+ key={codexStylePaneTabs ? undefined : tab.value}
+ value={tab.value}
+ className={cn(
+ paneTabTriggerClass,
+ codexStylePaneTabs && "mx-1.5 hover:bg-accent/50 group-focus-within/pane-tab:bg-accent/50",
+ codexStylePaneTabs && "px-3",
+ )}
+ >
+ <span
+ className={cn(
+ codexStylePaneTabs
+ && "task-detail-pane-tab-label min-w-0 flex-1 overflow-hidden whitespace-nowrap",
+ )}
+ title={tab.label}
+ >
+ {tab.label}
+ </span>
+ {tab.count ? (
+ <span className="shrink-0 font-mono text-(length:--text-nano) text-muted-foreground transition-opacity group-hover/pane-tab:opacity-0 group-focus-within/pane-tab:opacity-0">
+ {tab.count}
+ </span>
+ ) : null}
+ </TabsTrigger>
+ );
+ if (!codexStylePaneTabs) return trigger;
+ return (
+ <div
+ key={tab.value}
+ data-slot="task-detail-pane-tab"
+ className="group/pane-tab relative flex min-w-0 flex-1 basis-0 items-center"
+ >
+ {index > 0 ? (
+ <span
+ data-slot="task-detail-pane-tab-divider"
+ aria-hidden="true"
+ className="absolute left-0 top-1/2 h-4 w-px -translate-y-1/2 bg-border"
+ />
+ ) : null}
+ {trigger}
+ {tab.closable ? (
+ <button
+ type="button"
+ className="absolute right-2.5 top-1/2 z-20 inline-flex size-5 -translate-y-1/2 items-center justify-center rounded-sm text-muted-foreground opacity-0 transition-opacity hover:bg-accent hover:text-foreground focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-(length:--rad-3) focus-visible:ring-ring group-hover/pane-tab:opacity-100 group-focus-within/pane-tab:opacity-100"
+ aria-label={`Close ${tab.label} tab`}
+ onPointerDown={(event) => {
+ event.preventDefault();
+ event.stopPropagation();
+ }}
+ onClick={(event) => {
+ event.preventDefault();
+ event.stopPropagation();
+ closePaneTab(tab.value);
+ }}
+ >
+ <X className="size-3.5" aria-hidden />
+ </button>
+ ) : null}
+ </div>
+ );
+ })}
</TabsList>
);
+ const tabStrip = codexStylePaneTabs ? (
+ <div className="flex h-full min-w-0 flex-1 items-center">
+ {tabList}
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <Button
+ variant="ghost"
+ size="icon-xs"
+ className="size-6 shrink-0 text-muted-foreground"
+ disabled={hiddenPaneTabs.length === 0}
+ aria-label="Open closed sidebar tab"
+ title={hiddenPaneTabs.length === 0 ? "All sidebar tabs are open" : "Open closed sidebar tab"}
+ >
+ <Plus className="size-3.5" aria-hidden />
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="start" className="min-w-(--sz-8rem)">
+ {hiddenPaneTabs.map((tab) => (
+ <DropdownMenuItem key={tab.value} onClick={() => reopenPaneTab(tab.value)}>
+ {tab.label}
+ </DropdownMenuItem>
+ ))}
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </div>
+ ) : tabList;
return (
<Tabs value={activePaneTab} onValueChange={handlePaneTabChange} className="flex min-h-0 flex-col gap-3">
{paneHeaderSlot
@@ -2829,6 +3186,24 @@ export function IssueProperties({
)
: tabStrip}
<TabsContent value="properties">{propertiesBody}</TabsContent>
+ {hasSubtasksTab ? (
+ <TabsContent value="subtasks">
+ <TaskDetailSubtasksPanel
+ items={childIssues}
+ onAddSubtask={onAddSubIssue}
+ issueLinkState={issueLinkState}
+ />
+ </TabsContent>
+ ) : null}
+ {hasReferencesTab ? (
+ <TabsContent value="references">
+ <TaskDetailReferencesPanel
+ referenced={panelReferencedTasks}
+ mentionedIn={panelMentionedInTasks}
+ issueLinkState={issueLinkState}
+ />
+ </TabsContent>
+ ) : null}
{hasPlanTab ? (
<TabsContent value="plans">
<IssuePropertiesPlansTab issue={issue} inline={inline} />
diff --git a/ui/src/components/issue-properties/primitives.tsx b/ui/src/components/issue-properties/primitives.tsx
index aaf057016e..ce2a7666a7 100644
--- a/ui/src/components/issue-properties/primitives.tsx
+++ b/ui/src/components/issue-properties/primitives.tsx
@@ -7,6 +7,7 @@ export function PropertySection({
className,
title,
first,
+ streamlined,
}: {
children: ReactNode;
className?: string;
@@ -14,13 +15,16 @@ export function PropertySection({
title?: string;
/** First section drops the top padding on its header. */
first?: boolean;
+ streamlined?: boolean;
}) {
return (
- <div className={className}>
+ <div className={className} data-property-section="true">
{title ? (
<div
className={cn(
- "text-xs font-semibold uppercase tracking-wide text-muted-foreground pb-1",
+ streamlined
+ ? "pb-1 font-mono text-(length:--text-nano) font-normal uppercase tracking-wide text-muted-foreground/70"
+ : "text-xs font-semibold uppercase tracking-wide text-muted-foreground pb-1",
first ? "pt-0" : "pt-3",
)}
>
@@ -60,7 +64,15 @@ export function PropertyRow({
>
{label}
</span>
- <div className={cn("flex min-w-0 flex-1 items-center gap-1.5", wrap && "flex-wrap")}>{children}</div>
+ <div
+ className={cn(
+ "flex min-w-0 flex-1 items-center gap-1.5",
+ wrap && "flex-col items-start",
+ )}
+ data-property-value="true"
+ >
+ {children}
+ </div>
</div>
);
}
diff --git a/ui/src/components/issue-properties/property-picker.tsx b/ui/src/components/issue-properties/property-picker.tsx
index e25fe87146..582bc36049 100644
--- a/ui/src/components/issue-properties/property-picker.tsx
+++ b/ui/src/components/issue-properties/property-picker.tsx
@@ -1,6 +1,8 @@
import type { ReactNode } from "react";
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
+import { ChevronDown } from "lucide-react";
import { cn } from "../../lib/utils";
+import { useStreamlinedUiEnabled } from "../../hooks/useStreamlinedUiEnabled";
import { PropertyRow } from "./primitives";
/** Renders a Popover on desktop, or an inline collapsible section on mobile (inline mode). */
@@ -14,6 +16,7 @@ export function PropertyPicker({
popoverClassName,
popoverAlign = "end",
extra,
+ stacked = false,
children,
}: {
inline?: boolean;
@@ -25,19 +28,26 @@ export function PropertyPicker({
popoverClassName?: string;
popoverAlign?: "start" | "center" | "end";
extra?: ReactNode;
+ /** Top-aligns the row and vertically stacks chip collections in the trigger. */
+ stacked?: boolean;
children: ReactNode;
}) {
+ const { enabled: streamlinedUiEnabled } = useStreamlinedUiEnabled();
const btnCn = cn(
"inline-flex min-h-5 items-center gap-1.5 cursor-pointer hover:bg-accent/50 rounded px-1 -mx-1 py-0.5 transition-colors min-w-0 max-w-full text-left",
+ streamlinedUiEnabled && "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
triggerClassName,
);
if (inline) {
return (
<div>
- <PropertyRow label={label}>
- <button className={btnCn} onClick={() => onOpenChange(!open)}>
+ <PropertyRow label={label} wrap={stacked}>
+ <button className={cn(btnCn, stacked && "items-start")} onClick={() => onOpenChange(!open)} aria-expanded={streamlinedUiEnabled ? open : undefined}>
{triggerContent}
+ {streamlinedUiEnabled ? (
+ <ChevronDown className={cn("ml-auto h-3 w-3 shrink-0 text-muted-foreground transition-transform", open && "rotate-180")} aria-hidden />
+ ) : null}
</button>
{extra}
</PropertyRow>
@@ -51,10 +61,15 @@ export function PropertyPicker({
}
return (
- <PropertyRow label={label}>
+ <PropertyRow label={label} wrap={stacked}>
<Popover open={open} onOpenChange={onOpenChange}>
<PopoverTrigger asChild>
- <button className={btnCn}>{triggerContent}</button>
+ <button className={cn(btnCn, stacked && "items-start")} aria-expanded={streamlinedUiEnabled ? open : undefined}>
+ {triggerContent}
+ {streamlinedUiEnabled ? (
+ <ChevronDown className={cn("ml-auto h-3 w-3 shrink-0 text-muted-foreground transition-transform", open && "rotate-180")} aria-hidden />
+ ) : null}
+ </button>
</PopoverTrigger>
<PopoverContent className={cn("p-1", popoverClassName)} align={popoverAlign} collisionPadding={16}>
{children}
diff --git a/ui/src/components/side-panel/README.md b/ui/src/components/side-panel/README.md
index 54974cf9db..8fca6ee238 100644
--- a/ui/src/components/side-panel/README.md
+++ b/ui/src/components/side-panel/README.md
@@ -12,6 +12,14 @@ The components exported by `@/components/side-panel` are controlled, domain-free
Never put React nodes or fetched content in a persisted `SidePanelTabRecord`. Project icons and live status into `SidePanelTabItem` at render time.
+`SidePanelTabs` also accepts `appearance="streamlined-task"` for the experimental task-detail shell. That appearance preserves the approved pre-rebase Codex-inspired treatment—equal-width text tabs, separated surfaces, edge fades, and hover-revealed close actions—while the default appearance remains master's portable side-panel chrome.
+
+Use `headerSize="task-detail"` on `SidePanelFrame` when the panel shares the 60px task breadcrumb row. It keeps the task-detail footer treatment while matching the default portable header height.
+
+`SidePanelWindowControls` defaults to the production visibility-toggle icon. Streamlined task-detail panels use `closeControl="close"` for an explicit X while retaining the same close behavior and accessible labeling.
+
+The Streamlined task adapter registers a counted Subtasks tab only when the current task has child tasks. Closing it moves the surface back into the `+` launcher for the remainder of the session; tasks without children do not advertise the tab.
+
## Registering another page
1. Define a serializable payload union for that page, such as `details | activity | history`.
diff --git a/ui/src/components/side-panel/SidePanelFrame.test.tsx b/ui/src/components/side-panel/SidePanelFrame.test.tsx
index 40354cc397..fe9e2b81df 100644
--- a/ui/src/components/side-panel/SidePanelFrame.test.tsx
+++ b/ui/src/components/side-panel/SidePanelFrame.test.tsx
@@ -67,6 +67,53 @@ describe("side-panel shell controls", () => {
expect(onWindowToggle).toHaveBeenCalledOnce();
});
+ it("offers an explicit X close control for the task-detail sidebar", async () => {
+ const onToggle = vi.fn();
+ await act(async () => root.render(
+ <TooltipProvider>
+ <SidePanelWindowControls
+ maximized={false}
+ onMaximizedChange={vi.fn()}
+ onToggle={onToggle}
+ closeControl="close"
+ />
+ </TooltipProvider>,
+ ));
+
+ const closeButton = container.querySelector<HTMLButtonElement>('[aria-label="Close side panel"]');
+ expect(closeButton).not.toBeNull();
+ expect(closeButton?.querySelector(".lucide-x")).not.toBeNull();
+ expect(container.querySelector('[aria-label="Toggle side panel"]')).toBeNull();
+ await act(async () => closeButton?.click());
+ expect(onToggle).toHaveBeenCalledOnce();
+ });
+
+ it("keeps the task-detail frame borderless except for its docked left edge", async () => {
+ await act(async () => root.render(
+ <SidePanelFrame header={<div>Tabs</div>} footer={<div>Actions</div>} headerSize="task-detail">
+ Body
+ </SidePanelFrame>,
+ ));
+ const frame = container.querySelector("section")!;
+ const header = container.querySelector("header")!;
+ const footer = container.querySelector("footer")!;
+ expect(frame.className).toContain("border-l");
+ expect(header.className).toContain("h-(--side-panel-header-height)");
+ expect(header.className).not.toContain("h-(--sz-60px)");
+ expect(header.className).not.toContain("border-b");
+ expect(footer.className).not.toContain("border-t");
+ });
+
+ it("preserves the shared default header and footer treatment", async () => {
+ await act(async () => root.render(
+ <SidePanelFrame header={<div>Tabs</div>} footer={<div>Actions</div>}>
+ Body
+ </SidePanelFrame>,
+ ));
+ expect(container.querySelector("header")?.className).toContain("h-(--side-panel-header-height)");
+ expect(container.querySelector("footer")?.className).toContain("border-t");
+ });
+
it("keeps the prose scrollbar on the full-width viewport while centering its content", async () => {
await act(async () => root.render(
<SidePanelFrame contentMode="prose">Document body</SidePanelFrame>,
diff --git a/ui/src/components/side-panel/SidePanelFrame.tsx b/ui/src/components/side-panel/SidePanelFrame.tsx
index e38d4f92a9..614455e81b 100644
--- a/ui/src/components/side-panel/SidePanelFrame.tsx
+++ b/ui/src/components/side-panel/SidePanelFrame.tsx
@@ -1,5 +1,5 @@
import type { CSSProperties, ReactNode } from "react";
-import { Maximize2, Minimize2, PanelRightClose, PanelRightOpen } from "lucide-react";
+import { Maximize2, Minimize2, PanelRightClose, PanelRightOpen, X } from "lucide-react";
import { Button } from "@/components/ui/button";
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
import { cn } from "@/lib/utils";
@@ -17,6 +17,7 @@ export interface SidePanelFrameProps {
maximized?: boolean;
resizing?: boolean;
label?: string;
+ headerSize?: "default" | "task-detail";
className?: string;
bodyClassName?: string;
style?: CSSProperties;
@@ -33,6 +34,7 @@ export function SidePanelFrame({
maximized = false,
resizing = false,
label = "Side panel",
+ headerSize = "default",
className,
bodyClassName,
style,
@@ -57,7 +59,9 @@ export function SidePanelFrame({
style={style}
>
{(header || trailingControls) ? (
- <header className="flex h-(--side-panel-header-height) min-w-0 shrink-0 items-center gap-1 px-2">
+ <header className={cn(
+ "flex h-(--side-panel-header-height) min-w-0 shrink-0 items-center gap-1 px-2",
+ )}>
<div className="flex min-w-0 flex-1 self-stretch">{header}</div>
{trailingControls ? (
<div className="flex shrink-0 items-center gap-1">{trailingControls}</div>
@@ -81,7 +85,14 @@ export function SidePanelFrame({
</div>
) : children}
</div>
- {footer ? <footer className="shrink-0 border-t border-border">{footer}</footer> : null}
+ {footer ? (
+ <footer className={cn(
+ "shrink-0",
+ headerSize !== "task-detail" && "border-t border-border",
+ )}>
+ {footer}
+ </footer>
+ ) : null}
</section>
);
}
@@ -128,10 +139,12 @@ export function SidePanelWindowControls({
maximized,
onMaximizedChange,
onToggle,
+ closeControl = "toggle",
}: {
maximized: boolean;
onMaximizedChange: (maximized: boolean) => void;
onToggle: () => void;
+ closeControl?: "toggle" | "close";
}) {
return (
<>
@@ -146,7 +159,21 @@ export function SidePanelWindowControls({
>
{maximized ? <Minimize2 aria-hidden /> : <Maximize2 aria-hidden />}
</Button>
- <SidePanelToggleButton open onToggle={onToggle} />
+ {closeControl === "close" ? (
+ <Button
+ type="button"
+ variant="ghost"
+ size="icon-sm"
+ className="h-(--side-panel-tab-height) w-(--side-panel-tab-height) text-muted-foreground hover:text-foreground focus-visible:text-foreground"
+ onClick={onToggle}
+ aria-label="Close side panel"
+ title="Close side panel"
+ >
+ <X aria-hidden />
+ </Button>
+ ) : (
+ <SidePanelToggleButton open onToggle={onToggle} />
+ )}
</>
);
}
diff --git a/ui/src/components/side-panel/SidePanelTab.tsx b/ui/src/components/side-panel/SidePanelTab.tsx
index 9726f7a357..af419667c5 100644
--- a/ui/src/components/side-panel/SidePanelTab.tsx
+++ b/ui/src/components/side-panel/SidePanelTab.tsx
@@ -18,6 +18,7 @@ export interface SidePanelTabProps {
onClose?: () => void;
onAuxClick?: (event: MouseEvent<HTMLButtonElement>) => void;
onKeyDown?: ButtonHTMLAttributes<HTMLButtonElement>["onKeyDown"];
+ appearance?: "default" | "streamlined-task";
className?: string;
}
@@ -36,17 +37,19 @@ export function SidePanelTab({
onClose,
onAuxClick,
onKeyDown,
+ appearance = "default",
className,
}: SidePanelTabProps) {
const closeLabel = `Close ${label}`;
const wrapperRef = useRef<HTMLDivElement>(null);
const labelRef = useRef<HTMLSpanElement>(null);
const [labelIsTruncated, setLabelIsTruncated] = useState(false);
- const sizingKey = `${label}:${icon ? "icon" : "no-icon"}:${status ? "status" : "no-status"}:${closable ? "closable" : "fixed"}`;
+ const sizingKey = `${appearance}:${label}:${icon ? "icon" : "no-icon"}:${status ? "status" : "no-status"}:${closable ? "closable" : "fixed"}`;
const [stableWidth, setStableWidth] = useState<{ key: string; width: number } | null>(null);
const hasStableWidth = stableWidth?.key === sizingKey;
useLayoutEffect(() => {
+ if (appearance === "streamlined-task") return;
if (hasStableWidth) return;
const measuredWidth = wrapperRef.current?.getBoundingClientRect().width ?? 0;
if (measuredWidth <= 0) return;
@@ -71,18 +74,25 @@ export function SidePanelTab({
ref={wrapperRef}
data-side-panel-tab-wrapper={id}
data-active={active ? "true" : "false"}
- style={hasStableWidth ? { width: stableWidth.width } : undefined}
+ data-appearance={appearance}
+ style={appearance === "default" && hasStableWidth ? { width: stableWidth.width } : undefined}
className={cn(
- "group/side-panel-tab relative flex h-(--side-panel-tab-height) min-w-0 shrink-0 items-center rounded-(--side-panel-tab-radius) border border-transparent",
+ appearance === "streamlined-task"
+ ? "group/side-panel-tab relative mx-1.5 flex h-7 min-w-0 flex-1 basis-0 items-center rounded-md border border-transparent"
+ : "group/side-panel-tab relative flex h-(--side-panel-tab-height) min-w-0 shrink-0 items-center rounded-(--side-panel-tab-radius) border border-transparent",
"side-panel-tab-motion",
active
- ? "bg-(--side-panel-tab-active-bg) text-accent-foreground"
- : "text-muted-foreground hover:bg-(--side-panel-tab-hover-bg) hover:text-foreground",
+ ? appearance === "streamlined-task"
+ ? "text-foreground hover:bg-accent/50"
+ : "bg-(--side-panel-tab-active-bg) text-accent-foreground"
+ : appearance === "streamlined-task"
+ ? "text-muted-foreground hover:bg-accent/50 hover:text-foreground"
+ : "text-muted-foreground hover:bg-(--side-panel-tab-hover-bg) hover:text-foreground",
disabled && "opacity-50",
className,
)}
>
- <Tooltip>
+ <Tooltip open={labelIsTruncated ? undefined : false}>
<TooltipTrigger asChild>
<button
{...dragHandleProps}
@@ -90,6 +100,7 @@ export function SidePanelTab({
type="button"
role="tab"
data-side-panel-tab-target={id}
+ data-side-panel-tab-tooltip={labelIsTruncated ? "enabled" : "disabled"}
id={`side-panel-tab-${id}`}
aria-controls={`side-panel-content-${id}`}
aria-selected={active}
@@ -100,43 +111,66 @@ export function SidePanelTab({
onAuxClick={onAuxClick}
onKeyDown={onKeyDown}
className={cn(
- "flex h-full w-full min-w-0 items-center gap-1.5 rounded-(--side-panel-tab-radius) py-1.5 pl-2 text-xs font-medium outline-none",
- closable && (!hasStableWidth || active) ? "pr-7" : "pr-2.5",
+ appearance === "streamlined-task"
+ ? "flex h-full w-full min-w-0 items-center justify-start rounded-md px-3 text-sm font-medium outline-none"
+ : "flex h-full w-full min-w-0 items-center gap-1.5 rounded-(--side-panel-tab-radius) py-1.5 pl-2 text-xs font-medium outline-none",
+ appearance === "default" && (closable && (!hasStableWidth || active) ? "pr-7" : "pr-2.5"),
"focus-visible:ring-2 focus-visible:ring-ring/60",
dragHandleProps?.className,
)}
>
- {icon ? <span className="flex size-3.5 shrink-0 items-center justify-center [&_svg]:size-3.5">{icon}</span> : null}
+ {icon && appearance === "default" ? <span className="flex size-3.5 shrink-0 items-center justify-center [&_svg]:size-3.5">{icon}</span> : null}
<span
ref={labelRef}
data-truncated={labelIsTruncated ? "true" : undefined}
className={cn(
- "overflow-hidden whitespace-nowrap",
- closable && hasStableWidth && !active
- ? "max-w-(--side-panel-tab-label-expanded-max-width)"
- : "max-w-(--side-panel-tab-label-max-width)",
- labelIsTruncated && "side-panel-tab-label-fade",
+ appearance === "streamlined-task"
+ ? "side-panel-tab-label-close-fade task-detail-pane-tab-label min-w-0 flex-1 overflow-hidden whitespace-nowrap text-center"
+ : "overflow-hidden whitespace-nowrap",
+ appearance === "default" && (
+ closable && hasStableWidth && !active
+ ? "max-w-(--side-panel-tab-label-expanded-max-width)"
+ : "max-w-(--side-panel-tab-label-max-width)"
+ ),
+ appearance === "default" && labelIsTruncated && "side-panel-tab-label-fade",
)}
>
{label}
</span>
- {status ? <span className="flex shrink-0 items-center">{status}</span> : null}
+ {status ? (
+ <span className={cn(
+ "flex shrink-0 items-center",
+ appearance === "streamlined-task" && "transition-opacity group-hover/side-panel-tab:opacity-0 group-focus-within/side-panel-tab:opacity-0",
+ )}>
+ {status}
+ </span>
+ ) : null}
</button>
</TooltipTrigger>
- <TooltipContent side="bottom">{label}</TooltipContent>
+ {labelIsTruncated ? <TooltipContent side="bottom">{label}</TooltipContent> : null}
</Tooltip>
- {closable && onClose && active ? (
+ {closable && onClose && (appearance === "streamlined-task" || active) ? (
<button
type="button"
aria-label={closeLabel}
title={closeLabel}
+ onPointerDown={(event) => {
+ if (appearance !== "streamlined-task") return;
+ event.preventDefault();
+ event.stopPropagation();
+ }}
onClick={(event) => {
event.stopPropagation();
onClose();
}}
- className="side-panel-tab-motion absolute right-1 flex size-6 items-center justify-center rounded-lg text-muted-foreground outline-none hover:bg-background/70 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/60"
+ className={cn(
+ "side-panel-tab-close-motion absolute flex items-center justify-center text-muted-foreground outline-none hover:text-foreground",
+ appearance === "streamlined-task"
+ ? "right-0 top-1/2 z-20 size-5 -translate-y-1/2 rounded-sm opacity-0 hover:bg-accent focus-visible:opacity-100 focus-visible:ring-2 focus-visible:ring-ring/60 group-hover/side-panel-tab:opacity-100"
+ : "right-1 size-6 rounded-lg hover:bg-background/70 focus-visible:ring-2 focus-visible:ring-ring/60",
+ )}
>
- <X className="size-3" aria-hidden />
+ <X className={appearance === "streamlined-task" ? "size-3.5" : "size-3"} aria-hidden />
</button>
) : null}
</div>
diff --git a/ui/src/components/side-panel/SidePanelTabs.test.tsx b/ui/src/components/side-panel/SidePanelTabs.test.tsx
index 0321837641..c08e8c7671 100644
--- a/ui/src/components/side-panel/SidePanelTabs.test.tsx
+++ b/ui/src/components/side-panel/SidePanelTabs.test.tsx
@@ -101,6 +101,193 @@ describe("SidePanelTabs", () => {
expect(separators[0]?.parentElement?.querySelector('[data-side-panel-tab-target="inactive-two"]')).not.toBeNull();
});
+ it("restores the pre-rebase Streamlined UI tab treatment", () => {
+ act(() => {
+ root.render(
+ <TooltipProvider>
+ <SidePanelTabs
+ tabs={[
+ { id: "properties", type: "view", label: "Properties", icon: <SlidersHorizontal />, closable: true },
+ { id: "document:plan", type: "document", label: "Implementation plan", icon: <FileText />, closable: true },
+ ]}
+ activeTabId="properties"
+ onActiveTabChange={vi.fn()}
+ onCloseTab={vi.fn()}
+ onAddTab={vi.fn()}
+ appearance="streamlined-task"
+ />
+ </TooltipProvider>,
+ );
+ });
+
+ const tabs = container.querySelectorAll<HTMLButtonElement>('[role="tab"]');
+ expect(tabs).toHaveLength(2);
+ expect(tabs[0]?.className).toContain("text-sm");
+ expect(tabs[0]?.querySelector("svg")).toBeNull();
+ expect(container.querySelectorAll('[data-side-panel-tab-separator="true"]')).toHaveLength(1);
+
+ const propertiesWrapper = container.querySelector<HTMLElement>('[data-side-panel-tab-wrapper="properties"]');
+ expect(propertiesWrapper?.className).toContain("mx-1.5");
+ expect(propertiesWrapper?.className).toContain("h-7");
+ expect(propertiesWrapper?.className).toContain("text-foreground");
+ expect(propertiesWrapper?.className).toContain("hover:bg-accent/50");
+ expect(propertiesWrapper?.className).not.toContain("bg-muted");
+ expect(propertiesWrapper?.style.width).toBe("");
+ expect(propertiesWrapper?.parentElement?.className)
+ .toContain("min-w-(--side-panel-streamlined-tab-min-width)");
+ expect(propertiesWrapper?.parentElement?.className)
+ .toContain("max-w-(--side-panel-streamlined-tab-max-width)");
+
+ const planLabel = container.querySelector<HTMLElement>('[data-side-panel-tab-target="document:plan"] span');
+ expect(planLabel?.className).toContain("task-detail-pane-tab-label");
+ expect(planLabel?.className).toContain("side-panel-tab-label-close-fade");
+ expect(planLabel?.className).toContain("text-center");
+ const tabList = container.querySelector<HTMLElement>('[role="tablist"]');
+ expect(tabList?.className).toContain("overflow-x-auto");
+ expect(tabList?.className).not.toContain("overflow-hidden");
+ expect(tabList?.firstElementChild?.className).toContain("w-max");
+ expect(tabList?.firstElementChild?.className).toContain("min-w-full");
+ const planCloseButton = container.querySelector<HTMLButtonElement>('button[aria-label="Close Implementation plan"]');
+ expect(planCloseButton?.className).toContain("opacity-0");
+ expect(planCloseButton?.className).toContain("right-0");
+ expect(planCloseButton?.className).toContain("side-panel-tab-close-motion");
+ expect(planCloseButton?.className).not.toContain("side-panel-tab-motion");
+ expect(planCloseButton?.className).not.toContain("group-focus-within/side-panel-tab:opacity-100");
+ const addButton = container.querySelector<HTMLButtonElement>('button[aria-label="Open a new tab"]');
+ expect(addButton?.className).toContain("h-(--side-panel-tab-height)");
+ expect(addButton?.className).toContain("w-(--side-panel-tab-height)");
+ expect(addButton?.className).toContain("hover:bg-accent");
+ });
+
+ it("lets a lone Streamlined tab fill the space before the add action", () => {
+ act(() => {
+ root.render(
+ <TooltipProvider>
+ <SidePanelTabs
+ tabs={[
+ {
+ id: "properties",
+ type: "view",
+ label: "Properties",
+ closable: true,
+ },
+ ]}
+ activeTabId="properties"
+ onActiveTabChange={vi.fn()}
+ onCloseTab={vi.fn()}
+ onAddTab={vi.fn()}
+ appearance="streamlined-task"
+ />
+ </TooltipProvider>,
+ );
+ });
+
+ const tabList = container.querySelector<HTMLElement>('[role="tablist"]');
+ const tabTrack = tabList?.firstElementChild;
+ const propertiesWrapper = container.querySelector<HTMLElement>(
+ '[data-side-panel-tab-wrapper="properties"]',
+ )?.parentElement;
+ expect(tabTrack?.className).toContain("w-full");
+ expect(tabTrack?.className).not.toContain("w-max");
+ expect(propertiesWrapper?.className).toContain("max-w-none");
+ expect(propertiesWrapper?.className).toContain("flex-1");
+ expect(propertiesWrapper?.className).not.toContain(
+ "max-w-(--side-panel-streamlined-tab-max-width)",
+ );
+ });
+
+ it("enables the tab flyout only while its label is truncated", () => {
+ const scrollWidth = vi.spyOn(HTMLElement.prototype, "scrollWidth", "get").mockReturnValue(72);
+ const clientWidth = vi.spyOn(HTMLElement.prototype, "clientWidth", "get").mockReturnValue(96);
+
+ const renderLabel = (label: string) => {
+ act(() => {
+ root.render(
+ <TooltipProvider>
+ <SidePanelTabs
+ tabs={[{ id: "properties", type: "view", label, closable: true }]}
+ activeTabId="properties"
+ onActiveTabChange={vi.fn()}
+ onCloseTab={vi.fn()}
+ appearance="streamlined-task"
+ />
+ </TooltipProvider>,
+ );
+ });
+ };
+
+ renderLabel("Properties");
+ const tab = container.querySelector<HTMLButtonElement>('[data-side-panel-tab-target="properties"]')!;
+ const label = tab.querySelector<HTMLElement>(".task-detail-pane-tab-label")!;
+ expect(tab.dataset.sidePanelTabTooltip).toBe("disabled");
+ expect(label.dataset.truncated).toBeUndefined();
+
+ scrollWidth.mockReturnValue(128);
+ clientWidth.mockReturnValue(72);
+ renderLabel("Properties panel");
+ expect(tab.dataset.sidePanelTabTooltip).toBe("enabled");
+ expect(label.dataset.truncated).toBe("true");
+ });
+
+ it("fades the right edge only while more Streamlined tabs remain", () => {
+ act(() => {
+ root.render(
+ <TooltipProvider>
+ <SidePanelTabs
+ tabs={[
+ { id: "properties", type: "view", label: "Properties", closable: true },
+ { id: "subtasks", type: "view", label: "Subtasks", closable: true },
+ { id: "artifacts", type: "view", label: "Artifacts", closable: true },
+ ]}
+ activeTabId="properties"
+ onActiveTabChange={vi.fn()}
+ onCloseTab={vi.fn()}
+ onAddTab={vi.fn()}
+ appearance="streamlined-task"
+ />
+ </TooltipProvider>,
+ );
+ });
+
+ const tabList = container.querySelector<HTMLElement>('[role="tablist"]')!;
+ Object.defineProperties(tabList, {
+ clientWidth: { configurable: true, value: 152 },
+ scrollWidth: { configurable: true, value: 384 },
+ scrollLeft: { configurable: true, value: 0, writable: true },
+ });
+ act(() => tabList.dispatchEvent(new Event("scroll")));
+ expect(tabList.dataset.scrollEndFade).toBe("true");
+
+ tabList.scrollLeft = 232;
+ act(() => tabList.dispatchEvent(new Event("scroll")));
+ expect(tabList.dataset.scrollEndFade).toBeUndefined();
+ });
+
+ it("selects an inactive Streamlined UI tab without closing it", () => {
+ const onActiveTabChange = vi.fn();
+ const onCloseTab = vi.fn();
+ act(() => {
+ root.render(
+ <TooltipProvider>
+ <SidePanelTabs
+ tabs={[
+ { id: "properties", type: "view", label: "Properties", closable: true },
+ { id: "subtasks", type: "view", label: "Subtasks", closable: true },
+ ]}
+ activeTabId="properties"
+ onActiveTabChange={onActiveTabChange}
+ onCloseTab={onCloseTab}
+ appearance="streamlined-task"
+ />
+ </TooltipProvider>,
+ );
+ });
+
+ act(() => container.querySelector<HTMLButtonElement>('[data-side-panel-tab-target="subtasks"]')?.click());
+ expect(onActiveTabChange).toHaveBeenCalledWith("subtasks");
+ expect(onCloseTab).not.toHaveBeenCalled();
+ });
+
it("keeps intrinsic tab width stable while giving inactive labels the close-button space", () => {
vi.spyOn(HTMLElement.prototype, "getBoundingClientRect").mockReturnValue({
x: 0,
diff --git a/ui/src/components/side-panel/SidePanelTabs.tsx b/ui/src/components/side-panel/SidePanelTabs.tsx
index 4e8a9ce7cb..84b8b7378d 100644
--- a/ui/src/components/side-panel/SidePanelTabs.tsx
+++ b/ui/src/components/side-panel/SidePanelTabs.tsx
@@ -33,6 +33,8 @@ import type { SidePanelTabItem } from "./types";
interface SortableSidePanelTabProps {
tab: SidePanelTabItem;
active: boolean;
+ appearance: "default" | "streamlined-task";
+ fillAvailableWidth: boolean;
showLeadingSeparator: boolean;
onSelect: () => void;
onClose: () => void;
@@ -40,7 +42,17 @@ interface SortableSidePanelTabProps {
onKeyDown: (event: KeyboardEvent<HTMLButtonElement>) => void;
}
-function SortableSidePanelTab({ tab, active, showLeadingSeparator, onSelect, onClose, onAuxClick, onKeyDown }: SortableSidePanelTabProps) {
+function SortableSidePanelTab({
+ tab,
+ active,
+ appearance,
+ fillAvailableWidth,
+ showLeadingSeparator,
+ onSelect,
+ onClose,
+ onAuxClick,
+ onKeyDown,
+}: SortableSidePanelTabProps) {
const sortable = useSortable({ id: tab.id, disabled: tab.disabled });
return (
<div
@@ -49,13 +61,28 @@ function SortableSidePanelTab({ tab, active, showLeadingSeparator, onSelect, onC
transform: DndCSS.Transform.toString(sortable.transform),
transition: sortable.transition,
}}
- className={cn("relative", sortable.isDragging && "z-20 opacity-80")}
+ className={cn(
+ appearance === "streamlined-task"
+ ? cn(
+ "relative flex flex-1 items-center",
+ fillAvailableWidth
+ ? "min-w-0 max-w-none basis-auto"
+ : "min-w-(--side-panel-streamlined-tab-min-width) max-w-(--side-panel-streamlined-tab-max-width) basis-0",
+ )
+ : "relative",
+ sortable.isDragging && "z-20 opacity-80",
+ )}
>
{showLeadingSeparator ? (
<span
aria-hidden
data-side-panel-tab-separator="true"
- className="pointer-events-none absolute inset-y-2 -left-0.5 w-px bg-border/60"
+ className={cn(
+ "pointer-events-none absolute w-px bg-border",
+ appearance === "streamlined-task"
+ ? "left-0 top-1/2 h-4 -translate-y-1/2"
+ : "inset-y-2 -left-0.5 bg-border/60",
+ )}
/>
) : null}
<SidePanelTab
@@ -65,6 +92,7 @@ function SortableSidePanelTab({ tab, active, showLeadingSeparator, onSelect, onC
icon={tab.icon}
status={tab.status}
active={active}
+ appearance={appearance}
closable={tab.closable}
disabled={tab.disabled}
tabRef={sortable.setActivatorNodeRef}
@@ -90,6 +118,7 @@ export interface SidePanelTabsProps {
onAddTab?: () => void;
addControl?: ReactNode;
addLabel?: string;
+ appearance?: "default" | "streamlined-task";
className?: string;
}
@@ -102,9 +131,11 @@ export function SidePanelTabs({
onAddTab,
addControl,
addLabel = "Open a new tab",
+ appearance = "default",
className,
}: SidePanelTabsProps) {
const [announcement, setAnnouncement] = useState("");
+ const [showEndFade, setShowEndFade] = useState(false);
const scrollRef = useRef<HTMLDivElement>(null);
const addButtonRef = useRef<HTMLButtonElement>(null);
const addControlRef = useRef<HTMLDivElement>(null);
@@ -133,6 +164,27 @@ export function SidePanelTabs({
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [activeTabId]);
+ useEffect(() => {
+ const element = scrollRef.current;
+ if (!element || appearance !== "streamlined-task") {
+ setShowEndFade(false);
+ return;
+ }
+ const updateEndFade = () => {
+ const remainingScroll = element.scrollWidth - element.clientWidth - element.scrollLeft;
+ setShowEndFade(remainingScroll > 1);
+ };
+ updateEndFade();
+ element.addEventListener("scroll", updateEndFade, { passive: true });
+ const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(updateEndFade);
+ observer?.observe(element);
+ if (element.firstElementChild) observer?.observe(element.firstElementChild);
+ return () => {
+ element.removeEventListener("scroll", updateEndFade);
+ observer?.disconnect();
+ };
+ }, [appearance, tabIds]);
+
function focusTab(tabId: string | null) {
window.requestAnimationFrame(() => {
if (!tabId) {
@@ -198,25 +250,48 @@ export function SidePanelTabs({
}
return (
- <div className={cn("flex min-w-0 flex-1 items-center gap-1", className)}>
+ <div className={cn(
+ "flex min-w-0 flex-1 items-center",
+ appearance === "streamlined-task" ? "gap-0" : "gap-1",
+ className,
+ )}>
<div
ref={scrollRef}
role="tablist"
aria-orientation="horizontal"
- className="min-w-0 flex-1 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden"
+ data-scroll-end-fade={appearance === "streamlined-task" && showEndFade ? "true" : undefined}
+ className={cn(
+ "side-panel-tabs-scroll min-w-0 flex-1 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
+ appearance === "streamlined-task"
+ ? "overflow-x-auto overscroll-x-contain"
+ : "overflow-x-auto",
+ )}
>
<DndContext sensors={sensors} collisionDetection={closestCenter} onDragEnd={handleDragEnd}>
<SortableContext items={tabIds} strategy={horizontalListSortingStrategy}>
- <div className="flex min-w-max items-center gap-1 py-1">
+ <div className={cn(
+ "flex items-center",
+ appearance === "streamlined-task"
+ ? tabs.length === 1
+ ? "w-full gap-0"
+ : "w-max min-w-full gap-0"
+ : "min-w-max gap-1 py-1",
+ )}>
{tabs.map((tab, index) => (
<SortableSidePanelTab
key={tab.id}
tab={tab}
active={tab.id === activeTabId}
+ appearance={appearance}
+ fillAvailableWidth={
+ appearance === "streamlined-task" && tabs.length === 1
+ }
showLeadingSeparator={
- index > 0
- && tab.id !== activeTabId
- && tabs[index - 1]?.id !== activeTabId
+ appearance === "streamlined-task"
+ ? index > 0
+ : index > 0
+ && tab.id !== activeTabId
+ && tabs[index - 1]?.id !== activeTabId
}
onSelect={() => onActiveTabChange(tab.id)}
onClose={() => closeTab(tab.id)}
@@ -241,7 +316,12 @@ export function SidePanelTabs({
onClick={onAddTab}
aria-label={addLabel}
title={addLabel}
- className="h-(--side-panel-tab-height) w-(--side-panel-tab-height) shrink-0 rounded-(--side-panel-control-radius) text-muted-foreground hover:text-foreground focus-visible:text-foreground"
+ className={cn(
+ "shrink-0 text-muted-foreground hover:text-foreground focus-visible:text-foreground",
+ appearance === "streamlined-task"
+ ? "h-(--side-panel-tab-height) w-(--side-panel-tab-height) rounded-md"
+ : "h-(--side-panel-tab-height) w-(--side-panel-tab-height) rounded-(--side-panel-control-radius)",
+ )}
>
<Plus aria-hidden />
</Button>
diff --git a/ui/src/components/task-chat/TaskChatBlockerLinks.tsx b/ui/src/components/task-chat/TaskChatBlockerLinks.tsx
index 0e55b80785..e4d2576a36 100644
--- a/ui/src/components/task-chat/TaskChatBlockerLinks.tsx
+++ b/ui/src/components/task-chat/TaskChatBlockerLinks.tsx
@@ -10,6 +10,7 @@ import {
type WaitingBlockerStep,
} from "@/lib/issue-blockers";
import { Link } from "@/lib/router";
+import { useStreamlinedTaskChatPresentation } from "./presentation-mode";
function isUnresolved(blocker: IssueRelationIssueSummary): boolean {
return blocker.status !== "done" && blocker.status !== "cancelled";
@@ -100,9 +101,20 @@ function BlockerRow({
label: string;
blocker: IssueRelationIssueSummary | IssueBlockerAttentionIssueSummary;
}) {
+ const streamlined = useStreamlinedTaskChatPresentation();
const issuePathId = blocker.identifier ?? blocker.id;
- return (
+ return streamlined ? (
+ <Link
+ to={createIssueDetailPath(issuePathId)}
+ className="flex min-w-0 items-baseline gap-1.5 rounded px-1 py-0.5 text-amber-800 underline-offset-2 transition-colors hover:bg-accent/50 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring dark:text-amber-200"
+ title={`${blocker.identifier ?? blocker.id.slice(0, 8)} — ${blocker.title}`}
+ >
+ <span className="shrink-0 font-medium">{label}</span>
+ <span className="shrink-0 font-mono">{blocker.identifier ?? blocker.id.slice(0, 8)}</span>
+ <span className="truncate text-amber-700/80 dark:text-amber-300/80">{blocker.title}</span>
+ </Link>
+ ) : (
<div className="flex min-w-0 items-baseline gap-1.5 whitespace-nowrap">
<span className="shrink-0 font-medium">{label}</span>
<Link
@@ -146,16 +158,25 @@ function LiveWorkGlyph({ status }: { status: WaitingBlockerStatus }) {
function LiveWorkLink({
blocker,
+ status,
+ label,
}: {
blocker: IssueRelationIssueSummary | IssueBlockerAttentionIssueSummary;
+ status: WaitingBlockerStatus;
+ label?: string;
}) {
+ const streamlined = useStreamlinedTaskChatPresentation();
const issuePathId = blocker.identifier ?? blocker.id;
return (
<Link
to={createIssueDetailPath(issuePathId)}
- className="flex min-w-0 items-baseline gap-1 text-blue-800 underline-offset-2 hover:underline dark:text-blue-200"
+ className={streamlined
+ ? "flex min-w-0 items-center gap-1.5 rounded px-1 py-0.5 text-blue-800 underline-offset-2 transition-colors hover:bg-accent/50 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring dark:text-blue-200"
+ : "flex min-w-0 items-baseline gap-1 text-blue-800 underline-offset-2 hover:underline dark:text-blue-200"}
title={`${blocker.identifier ?? blocker.id.slice(0, 8)} — ${blocker.title}`}
>
+ {streamlined && label ? <span className="shrink-0 font-medium">{label}</span> : null}
+ {streamlined ? <LiveWorkGlyph status={status} /> : null}
<span className="shrink-0 font-mono">{blocker.identifier ?? blocker.id.slice(0, 8)}</span>
<span className="truncate text-blue-700/80 dark:text-blue-300/80">{blocker.title}</span>
</Link>
@@ -171,6 +192,11 @@ export function TaskChatBlockerLinks({
ultimateBlocker: IssueRelationIssueSummary | IssueBlockerAttentionIssueSummary | null;
placement: "top" | "bottom";
}) {
+ const streamlined = useStreamlinedTaskChatPresentation();
+ const directLabel = streamlined && placement === "bottom" ? "Still blocked by" : "Blocked by";
+ const rootLabel = streamlined
+ ? placement === "bottom" ? "Root blocker remains" : "Root blocker"
+ : "Ultimately blocked by";
return (
<div
aria-label="Task blockers"
@@ -178,9 +204,9 @@ export function TaskChatBlockerLinks({
data-testid="task-chat-blocker-links"
className="flex min-w-0 flex-col gap-1 overflow-hidden text-(length:--text-micro) leading-4 text-amber-700 dark:text-amber-300"
>
- <BlockerRow label="Blocked by" blocker={directBlocker} />
+ <BlockerRow label={directLabel} blocker={directBlocker} />
{ultimateBlocker ? (
- <BlockerRow label="Ultimately blocked by" blocker={ultimateBlocker} />
+ <BlockerRow label={rootLabel} blocker={ultimateBlocker} />
) : null}
</div>
);
@@ -193,6 +219,8 @@ export function TaskChatLiveWorkLinks({
liveWork: ResolvedTaskChatLiveWork;
placement: "top" | "bottom";
}) {
+ const streamlined = useStreamlinedTaskChatPresentation();
+ const heading = streamlined && placement === "bottom" ? "Still waiting on live work" : "Waiting on live work";
return (
<div
aria-label="Tasks waiting on live work"
@@ -204,27 +232,33 @@ export function TaskChatLiveWorkLinks({
<span className="flex h-3.5 w-3.5 items-center justify-center" aria-hidden>
<span className="h-2.5 w-2.5 animate-pulse rounded-full bg-blue-400" />
</span>
- Waiting on live work
+ {heading}
</div>
<ol className="flex min-w-0 flex-col gap-1">
{liveWork.steps.map(({ blocker, status }, index) => (
<li
key={blocker.id}
data-testid="task-chat-live-work-step"
- className="flex min-w-0 items-center gap-1.5 whitespace-nowrap"
+ className={streamlined ? "min-w-0 whitespace-nowrap" : "flex min-w-0 items-center gap-1.5 whitespace-nowrap"}
>
- <span className="w-4 shrink-0 text-right font-mono text-blue-500/80" aria-hidden>
- {index + 1}.
- </span>
- <LiveWorkGlyph status={status} />
- <LiveWorkLink blocker={blocker} />
+ {!streamlined ? (
+ <>
+ <span className="w-4 shrink-0 text-right font-mono text-blue-500/80" aria-hidden>
+ {index + 1}.
+ </span>
+ <LiveWorkGlyph status={status} />
+ </>
+ ) : null}
+ <LiveWorkLink blocker={blocker} status={status} />
</li>
))}
</ol>
- {liveWork.nowRunning.map((blocker) => (
+ {liveWork.nowRunning.map((blocker) => streamlined ? (
+ <LiveWorkLink key={blocker.id} blocker={blocker} status="running" label="Now running" />
+ ) : (
<div key={blocker.id} className="flex min-w-0 items-center gap-1.5 whitespace-nowrap">
<span className="shrink-0 font-medium">Now running</span>
- <LiveWorkLink blocker={blocker} />
+ <LiveWorkLink blocker={blocker} status="running" />
</div>
))}
</div>
diff --git a/ui/src/components/task-chat/TaskChatBubble.test.tsx b/ui/src/components/task-chat/TaskChatBubble.test.tsx
index c1801981fb..330ff59220 100644
--- a/ui/src/components/task-chat/TaskChatBubble.test.tsx
+++ b/ui/src/components/task-chat/TaskChatBubble.test.tsx
@@ -406,7 +406,7 @@ describe("TaskChatBubble footer actions (PAP-413)", () => {
expect(slot?.querySelector('[data-testid="fake-actions"]')).toBeNull();
});
- it("leads a runless agent reply with actions, timestamp trailing", () => {
+ it("keeps runless timestamp left and actions at the stable right edge", () => {
render(
{ id: "m1", kind: "message", author: "agent", authorName: "CEO", text: "Done.", timestamp: "2:34 PM" },
{ actions },
@@ -414,6 +414,9 @@ describe("TaskChatBubble footer actions (PAP-413)", () => {
expect(container.querySelector('[data-testid="fake-actions"]')).not.toBeNull();
const stamp = [...container.querySelectorAll("span")].find((el) => el.textContent === "2:34 PM");
expect(stamp).not.toBeNull();
+ const actionNode = container.querySelector('[data-testid="fake-actions"]')!;
+ expect(stamp!.compareDocumentPosition(actionNode) & Node.DOCUMENT_POSITION_FOLLOWING).not.toBe(0);
+ expect(actionNode.parentElement?.className).toContain("justify-between");
});
it("omits the actions row entirely when none are supplied (human bubble)", () => {
diff --git a/ui/src/components/task-chat/TaskChatBubble.tsx b/ui/src/components/task-chat/TaskChatBubble.tsx
index 08e262b432..7897c16b31 100644
--- a/ui/src/components/task-chat/TaskChatBubble.tsx
+++ b/ui/src/components/task-chat/TaskChatBubble.tsx
@@ -1,6 +1,7 @@
import { useState, type ReactNode } from "react";
import type { IssueAttachment } from "@paperclipai/shared";
import { cn } from "@/lib/utils";
+import { useStreamlinedTaskChatPresentation } from "./presentation-mode";
import { MarkdownBody } from "@/components/MarkdownBody";
import {
ImageGalleryModal,
@@ -139,6 +140,7 @@ export function TaskChatBubble({
onTryAgainNoLiveExecutionPath,
tryAgainNoLiveExecutionPathPending,
}: TaskChatBubbleProps) {
+ const streamlined = useStreamlinedTaskChatPresentation();
// Clicking an embedded image opens the full-screen lightbox (with download);
// arrow keys walk across the other images in the same bubble.
const [lightboxSrc, setLightboxSrc] = useState<string | null>(null);
@@ -364,16 +366,25 @@ export function TaskChatBubble({
{attachedTurn}
</div>
) : actions ? (
- // Agent reply without run activity: the actions still lead the footer,
- // with the always-visible timestamp trailing (PAP-413).
- <div className="flex items-center gap-1">
- {actions}
- {item.timestamp ? (
- <span className="px-1 text-(length:--text-micro) text-muted-foreground">
- {item.timestamp}
- </span>
- ) : null}
- </div>
+ streamlined ? (
+ <div className="flex w-full items-center justify-between gap-2 px-1">
+ {item.timestamp ? (
+ <span className="text-(length:--text-micro) text-muted-foreground">
+ {item.timestamp}
+ </span>
+ ) : null}
+ {actions}
+ </div>
+ ) : (
+ <div className="flex items-center gap-1">
+ {actions}
+ {item.timestamp ? (
+ <span className="px-1 text-(length:--text-micro) text-muted-foreground">
+ {item.timestamp}
+ </span>
+ ) : null}
+ </div>
+ )
) : item.timestamp ? (
// Timestamps are always visible (round 9) — no longer hover-revealed.
<span className="px-1 text-(length:--text-micro) text-muted-foreground">
diff --git a/ui/src/components/task-chat/TaskChatComposer.test.tsx b/ui/src/components/task-chat/TaskChatComposer.test.tsx
index f00675e8a4..b28e9467ed 100644
--- a/ui/src/components/task-chat/TaskChatComposer.test.tsx
+++ b/ui/src/components/task-chat/TaskChatComposer.test.tsx
@@ -293,7 +293,24 @@ describe("TaskChatComposer", () => {
expect(composer?.className).not.toContain("p-2");
});
- it("renders the composer shell and its selectors without outlines", () => {
+ it("leaves an 8px token gap between the editor and action row", () => {
+ render(
+ <TaskChatComposer
+ onAdd={async () => {}}
+ workMode="planning"
+ onWorkModeChange={async () => {}}
+ />,
+ );
+
+ const actions = container.querySelector(
+ '[data-testid="task-chat-composer-actions"]',
+ );
+
+ expect(actions?.classList).toContain("mt-2");
+ expect(actions?.classList).not.toContain("mt-1");
+ });
+
+ it("renders a light card shell while preserving the borderless dark treatment", () => {
render(
<TaskChatComposer
onAdd={async () => {}}
@@ -313,9 +330,14 @@ describe("TaskChatComposer", () => {
'[data-testid="task-chat-composer-assignee"]',
)!;
- expect(composer.classList).not.toContain("border");
- expect(composer.className).not.toContain("shadow-");
- expect(composer.className).not.toContain("focus-within:ring-");
+ expect(composer.classList).toContain("border");
+ expect(composer.classList).toContain("border-border");
+ expect(composer.classList).toContain("bg-card");
+ expect(composer.classList).toContain("shadow-(--shadow-task-composer)");
+ expect(composer.classList).toContain("dark:border-0");
+ expect(composer.classList).toContain("dark:bg-muted");
+ expect(composer.classList).toContain("dark:shadow-none");
+ expect(composer.className).not.toContain("focus-within:ring");
expect(mode.classList).not.toContain("border");
expect(mode.className).not.toContain("ring-");
expect(runner.classList).toContain("border-0");
@@ -450,6 +472,34 @@ describe("TaskChatComposer", () => {
expect(onWorkModeChange).not.toHaveBeenCalled();
});
+ it("uses the borderless Paper controls and inverse circular send button", () => {
+ render(
+ <TaskChatComposer
+ onAdd={vi.fn()}
+ workMode="standard"
+ onWorkModeChange={vi.fn()}
+ enableReassign
+ reassignOptions={[{ id: "agent:a1", label: "Chief of Staff" }]}
+ currentAssigneeValue="agent:a1"
+ />,
+ );
+
+ const mode = container.querySelector<HTMLButtonElement>('[data-testid="task-chat-composer-mode"]')!;
+ const assignee = container.querySelector<HTMLButtonElement>('[data-testid="task-chat-composer-assignee"]')!;
+ const send = sendButton();
+
+ expect(mode.classList).not.toContain("border");
+ expect(mode.classList).toContain("border-0");
+ expect(mode.classList).toContain("status-chip");
+ expect(mode.style.getPropertyValue("--sc")).toBe("var(--tc-mode-agent)");
+ expect(assignee.classList).toContain("border-0");
+ expect(assignee.classList).toContain("shadow-none");
+ expect(send.classList).toContain("rounded-full");
+ expect(send.classList).toContain("bg-foreground");
+ expect(send.classList).toContain("text-background");
+ expect(send.classList).toContain("disabled:opacity-100");
+ });
+
it("passes reopen=true when the issue resumes-to-todo and the assignee is an agent", async () => {
const onAdd = vi.fn().mockResolvedValue(undefined);
render(
diff --git a/ui/src/components/task-chat/TaskChatComposer.tsx b/ui/src/components/task-chat/TaskChatComposer.tsx
index 57c57bc5a7..ded198d76e 100644
--- a/ui/src/components/task-chat/TaskChatComposer.tsx
+++ b/ui/src/components/task-chat/TaskChatComposer.tsx
@@ -8,6 +8,7 @@ import {
type ReactNode,
} from "react";
import { cn } from "@/lib/utils";
+import { useStreamlinedTaskChatPresentation } from "./presentation-mode";
import {
DRAFT_DEBOUNCE_MS,
clearDraft,
@@ -269,7 +270,7 @@ function escapeMarkdownLabel(name: string): string {
* Composer for the redesigned thread (v7 spec): the shared MarkdownEditor
* (rich lists, @-mentions, /-commands, inline pasted images) over a 32px
* comp-bar of [attach] [mode chip] … [assignee] [send]. The mode chip is a
- * status-chip rectangle carrying the pending mode's hue; the composer chrome
+ * borderless filled control carrying the pending mode's hue; the composer chrome
* itself stays neutral. Cmd/Ctrl+. and Shift+Tab cycle modes (captured before
* Lexical); Cmd/Ctrl+Enter posts via the editor's native onSubmit; plain Enter
* stays a newline / next list item. Pasted or dropped images upload through
@@ -302,6 +303,7 @@ export function TaskChatComposer({
takeover = null,
pendingTakeover = null,
}: TaskChatComposerProps) {
+ const streamlined = useStreamlinedTaskChatPresentation();
const [body, setBody] = useState(() => (draftKey ? loadDraft(draftKey) : ""));
const [submitting, setSubmitting] = useState(false);
const [takeoverBusy, setTakeoverBusy] = useState(false);
@@ -677,7 +679,9 @@ export function TaskChatComposer({
return (
<div
className={cn(
- "paperclip-task-chat-composer rounded-xl bg-card p-(--sz-18px)",
+ streamlined
+ ? "paperclip-task-chat-composer rounded-(--radius-task-composer) border border-border bg-card p-(--sz-18px) shadow-(--shadow-task-composer) dark:border-0 dark:bg-muted dark:shadow-none"
+ : "paperclip-task-chat-composer rounded-xl bg-card p-(--sz-18px)",
)}
onKeyDownCapture={(e) => {
// Capture mode shortcuts on the wrapper so they work while the rich
@@ -882,7 +886,10 @@ export function TaskChatComposer({
</AttachmentGroup>
) : null}
- <div className="mt-1 flex items-center gap-2">
+ <div
+ className="mt-2 flex items-center gap-2"
+ data-testid="task-chat-composer-actions"
+ >
{canAcceptFiles ? (
<>
<input
@@ -918,7 +925,12 @@ export function TaskChatComposer({
type="button"
disabled={disabled || !onWorkModeChange}
aria-keyshortcuts="Meta+Period Control+Period Shift+Tab"
- className="status-chip flex h-8 shrink-0 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition hover:brightness-110 focus-visible:brightness-110 focus-visible:outline-none disabled:opacity-50"
+ className={cn(
+ "flex h-8 shrink-0 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium disabled:opacity-50",
+ streamlined
+ ? "status-chip border-0 transition hover:brightness-110 focus-visible:brightness-110 focus-visible:outline-none"
+ : "status-chip transition hover:brightness-110 focus-visible:brightness-110 focus-visible:outline-none",
+ )}
style={{ "--sc": modeHue(pendingMode) } as CSSProperties}
data-testid="task-chat-composer-mode"
data-pending-work-mode={pendingMode}
@@ -927,7 +939,11 @@ export function TaskChatComposer({
<ChevronDown className="h-3 w-3" aria-hidden />
</button>
</DropdownMenuTrigger>
- <DropdownMenuContent align="start" className="w-60">
+ <DropdownMenuContent
+ align="start"
+ className="flex w-(--sz-300px) flex-col gap-0.5"
+ data-testid="task-chat-composer-mode-menu"
+ >
{workModeMetaList().map((m) => {
const Icon = m.icon;
const selected = m.value === pendingMode;
@@ -950,7 +966,7 @@ export function TaskChatComposer({
/>
<span className="flex min-w-0 flex-1 flex-col">
<span className="font-medium">{m.label}</span>
- <span className="text-xs text-muted-foreground">
+ <span className="whitespace-nowrap text-xs text-muted-foreground">
{MODE_DESCRIPTION[m.value] ?? ""}
</span>
</span>
@@ -1052,7 +1068,12 @@ export function TaskChatComposer({
: "Save queued message"
: "Send"
}
- className="flex h-8 w-8 shrink-0 items-center justify-center rounded-md bg-primary text-primary-foreground transition-transform hover:scale-105 disabled:scale-100 disabled:bg-muted disabled:text-muted-foreground"
+ className={cn(
+ "flex h-8 w-8 shrink-0 items-center justify-center transition-transform hover:scale-105 disabled:scale-100",
+ streamlined
+ ? "rounded-full bg-foreground text-background disabled:bg-foreground disabled:text-background disabled:opacity-100"
+ : "rounded-md bg-primary text-primary-foreground disabled:bg-muted disabled:text-muted-foreground",
+ )}
data-testid="task-chat-composer-send"
>
{submitting ? (
diff --git a/ui/src/components/task-chat/TaskChatDescriptionBubble.test.tsx b/ui/src/components/task-chat/TaskChatDescriptionBubble.test.tsx
index 172f8118af..b2f4c23dc5 100644
--- a/ui/src/components/task-chat/TaskChatDescriptionBubble.test.tsx
+++ b/ui/src/components/task-chat/TaskChatDescriptionBubble.test.tsx
@@ -86,6 +86,7 @@ describe("TaskChatDescriptionBubble (PAP-375)", () => {
expect(body?.textContent).toContain("Ship the widget by");
// Markdown renders (bold), not raw asterisks.
expect(body?.querySelector("strong")?.textContent).toBe("Friday");
+ expect(bubble?.querySelector('[data-testid="task-chat-description-edit"]')).toBeNull();
});
it("renders an agent-created task as the agent-side bubble with the avatar author header", () => {
@@ -106,8 +107,8 @@ describe("TaskChatDescriptionBubble (PAP-375)", () => {
expect(container.textContent).not.toContain("Ship the widget");
});
- it("swaps to the InlineEditor on pencil click and returns to the bubble on Escape", () => {
- render(makeBrief());
+ it("keeps the agent-side pencil editor and returns to the bubble on Escape", () => {
+ render(makeBrief({ author: "agent", authorName: "CEO" }));
click(container.querySelector('[data-testid="task-chat-description-edit"]'));
const editorWrap = container.querySelector('[data-testid="task-chat-description-editor"]');
diff --git a/ui/src/components/task-chat/TaskChatDescriptionBubble.tsx b/ui/src/components/task-chat/TaskChatDescriptionBubble.tsx
index 28c874ac06..ed4b6b133b 100644
--- a/ui/src/components/task-chat/TaskChatDescriptionBubble.tsx
+++ b/ui/src/components/task-chat/TaskChatDescriptionBubble.tsx
@@ -51,12 +51,11 @@ function initialsForName(name: string) {
* The task description as the requester's first chat bubble (PAP-375):
* human-created tasks get the blue user bubble, agent-created tasks the
* agent-side card with the avatar header — same chrome as TaskChatBubble. The
- * body is the live issue.description; a hover pencil swaps the bubble for the
- * same InlineEditor the pre-redesign page used (mentions, image paste/drop,
- * autosave), restoring the edit surface the redesign had gated off. Long
- * descriptions fold at ~12 lines behind a Show more curtain; an empty
- * description renders a muted ghost row that opens the editor — never an
- * empty bubble.
+ * body is the live issue.description. Human-authored blue bubbles are
+ * presentation-only; agent-authored descriptions retain the hover edit
+ * affordance. Long descriptions fold at ~12 lines behind a Show more curtain;
+ * an empty description renders a muted ghost row that opens the editor — never
+ * an empty bubble.
*/
export function TaskChatDescriptionBubble({ brief }: TaskChatDescriptionBubbleProps) {
const [editing, setEditing] = useState(false);
@@ -160,15 +159,17 @@ export function TaskChatDescriptionBubble({ brief }: TaskChatDescriptionBubblePr
</MarkdownBody>
</FoldCurtain>
</div>
- <button
- type="button"
- className="mt-1 shrink-0 rounded-md p-1 text-muted-foreground opacity-0 transition-opacity hover:bg-accent/50 hover:text-foreground focus-visible:opacity-100 group-hover/brief:opacity-100"
- onClick={() => setEditing(true)}
- aria-label="Edit description"
- data-testid="task-chat-description-edit"
- >
- <Pencil className="h-3.5 w-3.5" aria-hidden />
- </button>
+ {!isHuman ? (
+ <button
+ type="button"
+ className="mt-1 shrink-0 rounded-md p-1 text-muted-foreground opacity-0 transition-opacity hover:bg-accent/50 hover:text-foreground focus-visible:opacity-100 group-hover/brief:opacity-100"
+ onClick={() => setEditing(true)}
+ aria-label="Edit description"
+ data-testid="task-chat-description-edit"
+ >
+ <Pencil className="h-3.5 w-3.5" aria-hidden />
+ </button>
+ ) : null}
</div>
{timestamp ? (
<span className="px-1 text-(length:--text-micro) text-muted-foreground">{timestamp}</span>
diff --git a/ui/src/components/task-chat/TaskChatInteractionCard.test.tsx b/ui/src/components/task-chat/TaskChatInteractionCard.test.tsx
index 3ea52e1374..a8189740c6 100644
--- a/ui/src/components/task-chat/TaskChatInteractionCard.test.tsx
+++ b/ui/src/components/task-chat/TaskChatInteractionCard.test.tsx
@@ -879,7 +879,7 @@ describe("TaskChatThreadView interaction items", () => {
expect(
container
.querySelector('[data-testid="task-chat-interaction"]')
- ?.parentElement?.classList.contains("-mt-3"),
+ ?.parentElement?.classList.contains("mt-3"),
).toBe(true);
});
diff --git a/ui/src/components/task-chat/TaskChatMarker.tsx b/ui/src/components/task-chat/TaskChatMarker.tsx
index 9aff564273..635158b1b6 100644
--- a/ui/src/components/task-chat/TaskChatMarker.tsx
+++ b/ui/src/components/task-chat/TaskChatMarker.tsx
@@ -1,6 +1,7 @@
import { useId, useState } from "react";
import { cn } from "@/lib/utils";
import { ChevronDown, CircleDot, OctagonX, Flag } from "lucide-react";
+import { useStreamlinedTaskChatPresentation } from "./presentation-mode";
import type { TaskChatMarkerItem } from "./task-chat-model";
import { Button } from "@/components/ui/button";
import { Link } from "@/lib/router";
@@ -28,6 +29,7 @@ export function TaskChatMarker({
}) {
const [open, setOpen] = useState(false);
const detailsId = useId();
+ const streamlined = useStreamlinedTaskChatPresentation();
const Icon = VARIANT_ICON[item.variant];
const interrupted = item.variant === "interrupted";
const relative = item.createdAtIso ? timeAgo(item.createdAtIso) : undefined;
@@ -117,7 +119,11 @@ export function TaskChatMarker({
}
return (
- <div className="tc-enter-marker flex items-center gap-2 py-1 text-xs text-muted-foreground">
+ <div
+ className="tc-enter-marker flex items-center gap-2 py-1 text-xs text-muted-foreground"
+ role={streamlined ? "separator" : undefined}
+ aria-label={streamlined ? item.label : undefined}
+ >
<span className={cn("h-px flex-1", interrupted ? "border-t border-dashed border-destructive/50" : "bg-border")} />
<span className={cn("flex items-center gap-1.5", interrupted && "text-destructive")}>
<Icon className="h-3.5 w-3.5" />
diff --git a/ui/src/components/task-chat/TaskChatSystemNotice.test.tsx b/ui/src/components/task-chat/TaskChatSystemNotice.test.tsx
index 946ec349c9..9635cade0b 100644
--- a/ui/src/components/task-chat/TaskChatSystemNotice.test.tsx
+++ b/ui/src/components/task-chat/TaskChatSystemNotice.test.tsx
@@ -154,7 +154,7 @@ describe("TaskChatSystemNotice (PAP-443)", () => {
expect(
container
.querySelector('[data-testid="task-chat-system-notice"]')
- ?.classList.contains("items-start"),
+ ?.classList.contains("items-center"),
).toBe(true);
});
@@ -224,4 +224,32 @@ describe("TaskChatSystemNotice (PAP-443)", () => {
container.querySelector('[data-testid="task-chat-no-live-path-try-again"]'),
).toBeNull();
});
+
+ it("keeps workspace-ready events as a compact expandable notice", () => {
+ renderNotice({
+ text: "Workspace ready. The isolated worktree is available at `/tmp/paperclip/worktrees/PAP-91`.",
+ metadata: null,
+ });
+
+ const button = toggleButton();
+ expect(button.getAttribute("aria-expanded")).toBe("false");
+ expect(button.textContent).toContain("System update");
+ expect(button.textContent).toContain("Workspace ready.");
+ expect(button.querySelector("code")).toBeNull();
+ expect(container.textContent).not.toContain("/tmp/paperclip/worktrees/PAP-91");
+
+ flushSync(() => button.click());
+ expect(container.textContent).toContain("/tmp/paperclip/worktrees/PAP-91");
+ });
+
+ it("ignores malformed metadata while preserving expandable raw detail", () => {
+ renderNotice({
+ text: "Workspace ready. Runtime metadata could not be decoded.",
+ metadata: { version: 1, sections: "malformed" } as unknown as TaskChatMessageItem["metadata"],
+ });
+
+ expect(() => flushSync(() => toggleButton().click())).not.toThrow();
+ expect(container.querySelector('[data-testid="task-chat-system-notice-details"]')).not.toBeNull();
+ expect(container.textContent).toContain("Runtime metadata could not be decoded");
+ });
});
diff --git a/ui/src/components/task-chat/TaskChatSystemNotice.tsx b/ui/src/components/task-chat/TaskChatSystemNotice.tsx
index 94c4145a6c..26a5e06e2b 100644
--- a/ui/src/components/task-chat/TaskChatSystemNotice.tsx
+++ b/ui/src/components/task-chat/TaskChatSystemNotice.tsx
@@ -8,6 +8,7 @@ import {
type LucideIcon,
} from "lucide-react";
import { cn } from "@/lib/utils";
+import { useStreamlinedTaskChatPresentation } from "./presentation-mode";
import { MarkdownBody } from "@/components/MarkdownBody";
import { Button } from "@/components/ui/button";
import {
@@ -52,6 +53,7 @@ export function TaskChatSystemNotice({
onTryAgainNoLiveExecutionPath?: () => Promise<void> | void;
tryAgainNoLiveExecutionPathPending?: boolean;
}) {
+ const streamlined = useStreamlinedTaskChatPresentation();
const [open, setOpen] = useState(Boolean(item.presentation?.detailsDefaultOpen));
const detailsId = useId();
const { title, tone, detail } = humanizeSystemNotice({
@@ -75,7 +77,13 @@ export function TaskChatSystemNotice({
};
return (
- <div className="tc-enter-bubble flex flex-col items-start py-1" data-testid="task-chat-system-notice">
+ <div
+ className={cn("tc-enter-bubble flex flex-col items-center", streamlined ? "py-0.5" : "py-1")}
+ data-testid="task-chat-system-notice"
+ data-tone={streamlined ? tone : undefined}
+ role={streamlined ? "group" : undefined}
+ aria-label={streamlined ? `System update: ${title}` : undefined}
+ >
<div className="flex max-w-(--pct-85) items-center gap-1.5">
<button
type="button"
diff --git a/ui/src/components/task-chat/TaskChatThreadView.tsx b/ui/src/components/task-chat/TaskChatThreadView.tsx
index 4fc5c7b48f..789d387479 100644
--- a/ui/src/components/task-chat/TaskChatThreadView.tsx
+++ b/ui/src/components/task-chat/TaskChatThreadView.tsx
@@ -1,6 +1,7 @@
import type { ReactNode } from "react";
import type { IssueAttachment } from "@paperclipai/shared";
import { cn } from "@/lib/utils";
+import { useStreamlinedTaskChatPresentation } from "./presentation-mode";
import type {
TaskChatInteractionItem,
TaskChatItem,
@@ -275,6 +276,24 @@ function renderItem(
}
}
+function isSystemLikeItem(item: TaskChatItem): boolean {
+ return item.kind === "marker" || (item.kind === "message" && item.author === "system");
+}
+
+export function taskChatItemSpacingClass(
+ item: TaskChatItem,
+ previousItem: TaskChatItem | null,
+): string | undefined {
+ if (!previousItem) return undefined;
+ const currentIsSystemLike = isSystemLikeItem(item);
+ const previousIsSystemLike = isSystemLikeItem(previousItem);
+ if (currentIsSystemLike && previousIsSystemLike) return "mt-2";
+ if (currentIsSystemLike || previousIsSystemLike) return "mt-3";
+ if (item.kind === "turn" || previousItem.kind === "turn") return "mt-3";
+ if (item.kind === "interaction" || previousItem.kind === "interaction") return "mt-4";
+ return "mt-6";
+}
+
/**
* Presentational render layer for the redesigned task thread. Consumed by both
* the live thread (adapter over comment/run props) and the dev harness
@@ -300,43 +319,22 @@ export function TaskChatThreadView({
scroll = true,
attachments = [],
}: TaskChatThreadViewProps) {
- const retryableMarkerId =
- onRetryFailedRun || onTryAgainNoLiveExecutionPath
- ? [...items]
- .reverse()
- .find(
- (item) =>
- item.kind === "marker" &&
- item.variant === "interrupted" &&
- item.label === "Run failed",
- )?.id
+ const streamlined = useStreamlinedTaskChatPresentation();
+ const retryableMarkerId = onRetryFailedRun || onTryAgainNoLiveExecutionPath
+ ? [...items]
+ .reverse()
+ .find(
+ (item) =>
+ item.kind === "marker" &&
+ item.variant === "interrupted" &&
+ item.label === "Run failed",
+ )?.id
: undefined;
- const body = (
- <div
- className={cn(
- "mx-auto flex w-full max-w-(--tc-shell-max-w) flex-col gap-5 px-4 py-4",
- className,
- )}
- >
- {header ? (
- <div
- className="flex flex-col gap-6 pb-2"
- data-testid="task-chat-thread-header"
- >
- {header}
- </div>
- ) : null}
- {items.map((item, index) => (
- <div
- key={item.id}
- className={cn(
- index > 0 &&
- item.kind === "interaction" &&
- item.interaction.status !== "pending" &&
- "-mt-3",
- )}
- >
- {renderItem(
+ const renderedItems = streamlined
+ ? items
+ .map((item) => ({
+ item,
+ content: renderItem(
item,
onApprovalDecision,
renderInteraction,
@@ -351,10 +349,65 @@ export function TaskChatThreadView({
onRetryFailedRun,
retryFailedRunId,
attachments,
- )}
+ ),
+ }))
+ .filter((entry) => entry.content !== null)
+ : [];
+ const body = (
+ <div
+ className={cn(
+ "mx-auto flex w-full max-w-(--tc-shell-max-w) flex-col px-4 py-4",
+ streamlined ? "md:px-0" : "gap-5",
+ className,
+ )}
+ >
+ {header ? (
+ <div
+ className={cn("flex flex-col gap-6", streamlined ? "pb-4" : "pb-2")}
+ data-testid="task-chat-thread-header"
+ >
+ {header}
</div>
- ))}
- {tail}
+ ) : null}
+ {streamlined
+ ? renderedItems.map(({ item, content }, index) => (
+ <div
+ key={item.id}
+ className={taskChatItemSpacingClass(item, renderedItems[index - 1]?.item ?? null)}
+ data-thread-item-kind={item.kind === "message" ? item.author : item.kind}
+ >
+ {content}
+ </div>
+ ))
+ : items.map((item, index) => (
+ <div
+ key={item.id}
+ className={cn(
+ index > 0 &&
+ item.kind === "interaction" &&
+ item.interaction.status !== "pending" &&
+ "-mt-3",
+ )}
+ >
+ {renderItem(
+ item,
+ onApprovalDecision,
+ renderInteraction,
+ renderBrief,
+ renderMessageActions,
+ renderQueuedAction,
+ onRuntimeRequestDecision,
+ "classic",
+ onTryAgainNoLiveExecutionPath,
+ tryAgainNoLiveExecutionPathPending,
+ retryableMarkerId,
+ onRetryFailedRun,
+ retryFailedRunId,
+ attachments,
+ )}
+ </div>
+ ))}
+ {tail ? (streamlined ? <div className="mt-4">{tail}</div> : tail) : null}
</div>
);
diff --git a/ui/src/components/task-chat/TaskChatTurn.test.tsx b/ui/src/components/task-chat/TaskChatTurn.test.tsx
index 8f3cced81e..b51b7bd870 100644
--- a/ui/src/components/task-chat/TaskChatTurn.test.tsx
+++ b/ui/src/components/task-chat/TaskChatTurn.test.tsx
@@ -476,6 +476,8 @@ describe("TaskChatTurn", () => {
// expandable fold — so expanding the tool history can't drag it down.
expect(fold()?.contains(lead!)).toBe(false);
expect(summaryBtn()).not.toBeNull();
+ expect(summaryBtn()!.compareDocumentPosition(lead!) & Node.DOCUMENT_POSITION_FOLLOWING).not.toBe(0);
+ expect(lead?.parentElement?.parentElement?.className).toContain("justify-between");
// Expanding still works and the leading slot stays put outside the fold.
flushSync(() => summaryBtn()!.click());
expect(fold()?.getAttribute("data-folded")).toBe("false");
diff --git a/ui/src/components/task-chat/TaskChatTurn.tsx b/ui/src/components/task-chat/TaskChatTurn.tsx
index 3cd09304ab..c9418f4c52 100644
--- a/ui/src/components/task-chat/TaskChatTurn.tsx
+++ b/ui/src/components/task-chat/TaskChatTurn.tsx
@@ -1,5 +1,6 @@
import { useState, type ReactNode } from "react";
import { cn } from "@/lib/utils";
+import { useStreamlinedTaskChatPresentation } from "./presentation-mode";
import { Check, ChevronRight, X } from "lucide-react";
import { MarkdownBody } from "@/components/MarkdownBody";
import type {
@@ -19,10 +20,9 @@ interface TaskChatTurnProps {
*/
timestampPrefix?: string;
/**
- * Content rendered on the header row, leading the summary line (PAP-413: the
- * copy/👍/👎 action cluster). It sits beside the summary button — NOT inside
- * the expandable fold — so it stays anchored to the summary line when the
- * tool history expands beneath it, instead of drifting to the fold's center.
+ * Content rendered on the header row (PAP-413: the copy/👍/👎 action
+ * cluster). The inspection caret and timestamp stay left; actions sit at the
+ * stable right edge, outside the expandable fold.
*/
leading?: ReactNode;
}
@@ -75,6 +75,7 @@ export function TaskChatTurn({
timestampPrefix,
leading,
}: TaskChatTurnProps) {
+ const streamlined = useStreamlinedTaskChatPresentation();
const parentRow = !item.settled && item.liveStatus != null;
// The new Paperclip Runner task surface owns one durable chronological
// timeline. The Worked/Stopped row is its stable header, so it stays directly
@@ -182,6 +183,7 @@ export function TaskChatTurn({
item.standaloneHeader
? "border-b border-border/70 py-2 text-sm"
: "py-0.5 text-xs",
+ streamlined && "min-w-0",
)}
data-testid="task-chat-turn-summary"
>
@@ -244,13 +246,17 @@ export function TaskChatTurn({
data-settled={item.settled ? "true" : "false"}
>
{leading ? (
- // Actions ride the header row (items-center matches them to the summary
- // line), and the fold below is a separate sibling — so expanding the
- // tool history never moves the actions off the summary line (PAP-413).
- <div className="flex items-center gap-1">
- {leading}
- {header}
- </div>
+ streamlined ? (
+ <div className="flex w-full items-center justify-between gap-2">
+ <div className="min-w-0">{header}</div>
+ <div className="shrink-0">{leading}</div>
+ </div>
+ ) : (
+ <div className="flex items-center gap-1">
+ {leading}
+ {header}
+ </div>
+ )
) : (
header
)}
diff --git a/ui/src/components/task-chat/TaskMessageScroller.test.tsx b/ui/src/components/task-chat/TaskMessageScroller.test.tsx
index a57beac995..1d0b9de5f4 100644
--- a/ui/src/components/task-chat/TaskMessageScroller.test.tsx
+++ b/ui/src/components/task-chat/TaskMessageScroller.test.tsx
@@ -160,6 +160,13 @@ describe("TaskMessageScroller", () => {
expect(el.getAttribute("data-scroll-active")).toBeNull();
});
+ it("contains horizontal overflow so no scrollbar appears above the composer", () => {
+ render();
+
+ expect(scroller().classList).toContain("overflow-x-hidden");
+ expect(scroller().classList).toContain("overflow-y-auto");
+ });
+
it("auto-follows content instantly while pinned", async () => {
render(1);
const el = scroller();
@@ -181,6 +188,8 @@ describe("TaskMessageScroller", () => {
expect(btn).not.toBeNull();
expect(btn!.className).toContain("tc-scroll-pill-in");
expect(btn!.className).toContain("size-8");
+ expect(btn!.className).toContain("bottom-7");
+ expect(btn!.className).not.toContain("bottom-3");
expect(btn!.className).not.toContain("-translate-x-1/2");
// Icon-only: no visible text.
expect(btn!.textContent).toBe("");
diff --git a/ui/src/components/task-chat/TaskMessageScroller.tsx b/ui/src/components/task-chat/TaskMessageScroller.tsx
index 107d52d68b..224d66aabc 100644
--- a/ui/src/components/task-chat/TaskMessageScroller.tsx
+++ b/ui/src/components/task-chat/TaskMessageScroller.tsx
@@ -1,5 +1,6 @@
import { useCallback, useEffect, useLayoutEffect, useRef, useState, type ReactNode } from "react";
import { cn } from "@/lib/utils";
+import { useStreamlinedTaskChatPresentation } from "./presentation-mode";
import { ArrowDown } from "lucide-react";
import { parseCssTimeMs } from "./motion-tokens";
@@ -42,6 +43,7 @@ interface TaskMessageScrollerProps {
* while pinned stays instant, so no reflow/jump happens during streaming.
*/
export function TaskMessageScroller({ children, contentKey, className }: TaskMessageScrollerProps) {
+ const streamlined = useStreamlinedTaskChatPresentation();
const ref = useRef<HTMLDivElement>(null);
const pinnedRef = useRef(true);
const easingRef = useRef(false);
@@ -216,7 +218,11 @@ export function TaskMessageScroller({ children, contentKey, className }: TaskMes
// absolute inset-0 (not h-full): the viewport must equal the flex-sized
// wrapper exactly — percentage heights don't reliably resolve against
// flex-determined block heights, which let the thread overflow the page.
- className={cn("scrollbar-while-scrolling absolute inset-0 overflow-y-auto", className)}
+ className={cn(
+ "scrollbar-while-scrolling absolute inset-0 overflow-y-auto",
+ streamlined && "overflow-x-hidden",
+ className,
+ )}
data-testid="task-chat-scroller"
>
{children}
@@ -232,7 +238,8 @@ export function TaskMessageScroller({ children, contentKey, className }: TaskMes
// The tc-scroll-pill-* keyframes carry the translate(-50%) X-centering
// (fill: both keeps it after the animation) — no -translate-x-1/2 here.
className={cn(
- "absolute bottom-3 left-1/2 flex size-8 items-center justify-center rounded-full border border-border bg-background shadow-sm hover:bg-muted",
+ "absolute left-1/2 flex size-8 items-center justify-center rounded-full border border-border bg-background shadow-sm hover:bg-muted",
+ streamlined ? "bottom-7" : "bottom-3",
pillPhase === "out" ? "tc-scroll-pill-out" : "tc-scroll-pill-in",
)}
>
diff --git a/ui/src/components/task-chat/presentation-mode.tsx b/ui/src/components/task-chat/presentation-mode.tsx
new file mode 100644
index 0000000000..1aec70e2c5
--- /dev/null
+++ b/ui/src/components/task-chat/presentation-mode.tsx
@@ -0,0 +1,25 @@
+import { createContext, useContext, type ReactNode } from "react";
+
+export type TaskChatPresentationMode = "production" | "streamlined";
+
+// Isolated component previews/tests render the new presentation by default.
+// The live TaskChatThread always provides an explicit instance-setting mode.
+const TaskChatPresentationContext = createContext<TaskChatPresentationMode>("streamlined");
+
+export function TaskChatPresentationProvider({
+ mode,
+ children,
+}: {
+ mode: TaskChatPresentationMode;
+ children: ReactNode;
+}) {
+ return (
+ <TaskChatPresentationContext.Provider value={mode}>
+ {children}
+ </TaskChatPresentationContext.Provider>
+ );
+}
+
+export function useStreamlinedTaskChatPresentation(): boolean {
+ return useContext(TaskChatPresentationContext) === "streamlined";
+}
diff --git a/ui/src/components/task-chat/task-chat-render.test.tsx b/ui/src/components/task-chat/task-chat-render.test.tsx
index 5807c6c632..a7fc23a9fa 100644
--- a/ui/src/components/task-chat/task-chat-render.test.tsx
+++ b/ui/src/components/task-chat/task-chat-render.test.tsx
@@ -6,6 +6,7 @@ import { afterEach, beforeEach, describe, expect, it } from "vitest";
import { TASK_CHAT_STATES } from "./task-chat-states";
import { buildScenario } from "./task-chat-fixtures";
import { TaskChatThreadView } from "./TaskChatThreadView";
+import type { TaskChatItem } from "./task-chat-model";
import { TaskChatPlanView } from "./TaskChatPlanView";
import { ThemeProvider } from "@/context/ThemeContext";
@@ -50,3 +51,36 @@ describe("Task chat state inventory renders", () => {
});
}
});
+
+describe("Task chat thread rhythm", () => {
+ it("keeps consecutive system events compact while preserving message separation", () => {
+ const items: TaskChatItem[] = [
+ { id: "human", kind: "message", author: "human", text: "Start", timestamp: "9:00 AM" },
+ { id: "system-1", kind: "message", author: "system", text: "Workspace ready." },
+ { id: "marker", kind: "marker", variant: "turn_boundary", label: "Plan created" },
+ { id: "agent", kind: "message", author: "agent", authorName: "Builder", text: "Done", timestamp: "9:01 AM" },
+ ];
+ const root = createRoot(document.body.appendChild(document.createElement("div")));
+ const host = document.body.lastElementChild as HTMLDivElement;
+
+ flushSync(() => root.render(
+ <ThemeProvider>
+ <TaskChatThreadView items={items} scroll={false} />
+ </ThemeProvider>,
+ ));
+
+ const human = host.querySelector('[data-thread-item-kind="human"]');
+ const system = host.querySelector('[data-thread-item-kind="system"]');
+ const marker = host.querySelector('[data-thread-item-kind="marker"]');
+ const agent = host.querySelector('[data-thread-item-kind="agent"]');
+ expect(human?.className).not.toContain("mt-");
+ expect(system?.className).toContain("mt-3");
+ expect(marker?.className).toContain("mt-2");
+ expect(agent?.className).toContain("mt-3");
+ expect(system?.querySelector('[role="group"]')?.getAttribute("aria-label")).toContain("System update");
+ expect(marker?.querySelector('[role="separator"]')?.getAttribute("aria-label")).toBe("Plan created");
+
+ flushSync(() => root.unmount());
+ host.remove();
+ });
+});
diff --git a/ui/src/components/task-detail/TaskDetailRelationsPanel.test.tsx b/ui/src/components/task-detail/TaskDetailRelationsPanel.test.tsx
new file mode 100644
index 0000000000..9af3c48eb0
--- /dev/null
+++ b/ui/src/components/task-detail/TaskDetailRelationsPanel.test.tsx
@@ -0,0 +1,128 @@
+// @vitest-environment jsdom
+
+import { flushSync } from "react-dom";
+import { createRoot, type Root } from "react-dom/client";
+import type { Issue } from "@paperclipai/shared";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import {
+ TaskDetailReferencesPanel,
+ TaskDetailSubtasksPanel,
+ resolveTaskDetailSubtaskState,
+} from "./TaskDetailRelationsPanel";
+
+vi.mock("@/lib/router", () => ({
+ Link: ({
+ to,
+ children,
+ state: _state,
+ disableIssueQuicklook: _disableIssueQuicklook,
+ issuePrefetch: _issuePrefetch,
+ ...props
+ }: { to: string; children: React.ReactNode; state?: unknown; disableIssueQuicklook?: boolean; issuePrefetch?: unknown }) => (
+ <a href={to} {...props}>{children}</a>
+ ),
+}));
+
+function createIssue(overrides: Partial<Issue> & Pick<Issue, "id" | "title" | "status">): Issue {
+ return {
+ companyId: "company-1",
+ identifier: `PAP-${overrides.id}`,
+ priority: "medium",
+ ...overrides,
+ } as Issue;
+}
+
+describe("task-detail relation panels", () => {
+ let container: HTMLDivElement;
+ let root: Root;
+
+ beforeEach(() => {
+ container = document.createElement("div");
+ document.body.appendChild(container);
+ root = createRoot(container);
+ });
+
+ afterEach(() => {
+ flushSync(() => root.unmount());
+ container.remove();
+ });
+
+ it("puts progress before wholly clickable subtask navigation rows", () => {
+ const onAdd = vi.fn();
+ flushSync(() => root.render(
+ <TaskDetailSubtasksPanel
+ items={[
+ createIssue({ id: "2", identifier: "PAP-2", title: "Completed setup", status: "done" }),
+ createIssue({ id: "3", identifier: "PAP-3", title: "Run verification", status: "in_progress" }),
+ ]}
+ onAddSubtask={onAdd}
+ />,
+ ));
+
+ const progress = container.querySelector('[role="progressbar"]');
+ const firstLink = container.querySelector('a[href="/issues/PAP-2"]');
+ expect(progress).not.toBeNull();
+ expect(firstLink).not.toBeNull();
+ expect(progress?.getAttribute("aria-valuenow")).toBe("50");
+ expect(progress!.compareDocumentPosition(firstLink!) & Node.DOCUMENT_POSITION_FOLLOWING).not.toBe(0);
+ expect(container.textContent).toContain("Next action");
+ expect(container.querySelector('a[href="/issues/PAP-3"]')?.textContent).toContain("Run verification");
+ expect(firstLink?.textContent).toContain("Completed setup");
+ expect(firstLink?.textContent).toContain("PAP-2");
+
+ flushSync(() => container.querySelector<HTMLButtonElement>("button")!.click());
+ expect(onAdd).toHaveBeenCalledOnce();
+ });
+
+ it("puts a blocked subtask's root blocker before the shared task row", () => {
+ const blocked = createIssue({
+ id: "12",
+ identifier: "PAP-12",
+ title: "Ship the integration",
+ status: "blocked",
+ blockerAttention: {
+ state: "needs_attention",
+ reason: "attention_required",
+ unresolvedBlockerCount: 1,
+ coveredBlockerCount: 0,
+ stalledBlockerCount: 0,
+ attentionBlockerCount: 1,
+ sampleBlockerIdentifier: "PAP-11",
+ sampleStalledBlockerIdentifier: null,
+ terminalBlocker: { id: "11", identifier: "PAP-11", title: "Approve the dependency" },
+ },
+ });
+ flushSync(() => root.render(<TaskDetailSubtasksPanel items={[blocked]} />));
+
+ const rootBlocker = container.querySelector('a[href="/issues/PAP-11"]');
+ const blockedSubtask = container.querySelector('a[href="/issues/PAP-12"]');
+ expect(rootBlocker?.textContent).toContain("Approve the dependency");
+ expect(blockedSubtask?.closest('[data-slot="task-row"]')).not.toBeNull();
+ expect(rootBlocker!.compareDocumentPosition(blockedSubtask!) & Node.DOCUMENT_POSITION_FOLLOWING).not.toBe(0);
+ });
+
+ it("chooses active work before queued work and does not repeat it in the remaining list", () => {
+ const todo = createIssue({ id: "21", title: "Queued follow-up", status: "todo" });
+ const active = createIssue({ id: "22", title: "Active verification", status: "in_progress" });
+ const done = createIssue({ id: "23", title: "Finished setup", status: "done" });
+
+ const state = resolveTaskDetailSubtaskState([todo, active, done]);
+ expect(state.nextAction?.id).toBe("22");
+ expect(state.remainingItems.map((item) => item.id)).toEqual(["21", "23"]);
+ });
+
+ it("separates outbound references from inbound mentions", () => {
+ flushSync(() => root.render(
+ <TaskDetailReferencesPanel
+ referenced={[{ id: "out", identifier: "PAP-8", title: "Referenced task", status: "todo" }]}
+ mentionedIn={[{ id: "in", identifier: "PAP-9", title: "Mentions this task", status: "blocked" }]}
+ />,
+ ));
+
+ const sections = container.querySelectorAll("section");
+ expect(sections[0]?.textContent).toContain("Referenced task");
+ expect(sections[0]?.textContent).not.toContain("Mentions this task");
+ expect(sections[1]?.textContent).toContain("Mentions this task");
+ expect(container.querySelector('a[href="/issues/PAP-9"]')).not.toBeNull();
+ });
+});
diff --git a/ui/src/components/task-detail/TaskDetailRelationsPanel.tsx b/ui/src/components/task-detail/TaskDetailRelationsPanel.tsx
new file mode 100644
index 0000000000..099e27f948
--- /dev/null
+++ b/ui/src/components/task-detail/TaskDetailRelationsPanel.tsx
@@ -0,0 +1,241 @@
+import type { Issue, IssueStatus } from "@paperclipai/shared";
+import { Plus } from "lucide-react";
+import { Button } from "@/components/ui/button";
+import { IssueRow } from "@/components/IssueRow";
+import { StatusIcon } from "@/components/StatusIcon";
+import {
+ createIssueDetailPath,
+ rememberIssueDetailLocationState,
+} from "@/lib/issueDetailBreadcrumb";
+import { Link } from "@/lib/router";
+
+export interface TaskDetailRelationItem {
+ id: string;
+ identifier?: string | null;
+ title: string;
+ status?: IssueStatus | null;
+}
+
+function RelationNavigationList({
+ items,
+ emptyMessage,
+ ariaLabel,
+ issueLinkState,
+}: {
+ items: TaskDetailRelationItem[];
+ emptyMessage: string;
+ ariaLabel: string;
+ issueLinkState?: unknown;
+}) {
+ if (items.length === 0) {
+ return <p className="py-6 text-center text-sm text-muted-foreground">{emptyMessage}</p>;
+ }
+
+ return (
+ <ul className="flex flex-col gap-0.5" aria-label={ariaLabel}>
+ {items.map((item) => {
+ const pathId = item.identifier ?? item.id;
+ return (
+ <li key={item.id}>
+ <Link
+ to={createIssueDetailPath(pathId)}
+ state={issueLinkState}
+ onClickCapture={() => rememberIssueDetailLocationState(pathId, issueLinkState)}
+ className="flex min-w-0 items-center gap-2 rounded-md px-2 py-2 text-sm transition-colors hover:bg-accent/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
+ title={`${item.identifier ? `${item.identifier} — ` : ""}${item.title}`}
+ >
+ {item.status ? (
+ <StatusIcon status={item.status} className="h-3.5 w-3.5 shrink-0" />
+ ) : null}
+ <span className="min-w-0 flex-1 truncate">{item.title}</span>
+ {item.identifier ? (
+ <span className="shrink-0 font-mono text-xs text-muted-foreground">
+ {item.identifier}
+ </span>
+ ) : null}
+ </Link>
+ </li>
+ );
+ })}
+ </ul>
+ );
+}
+
+const NEXT_SUBTASK_STATUS_ORDER: IssueStatus[] = [
+ "in_progress",
+ "in_review",
+ "todo",
+ "backlog",
+ "blocked",
+];
+
+export function resolveTaskDetailSubtaskState(items: Issue[]) {
+ const nextAction = NEXT_SUBTASK_STATUS_ORDER
+ .map((status) => items.find((item) => item.status === status))
+ .find((item): item is Issue => Boolean(item)) ?? null;
+ const rootBlocker = nextAction?.status === "blocked"
+ ? nextAction.blockerAttention?.terminalBlocker ?? null
+ : null;
+
+ return {
+ nextAction,
+ rootBlocker,
+ remainingItems: nextAction
+ ? items.filter((item) => item.id !== nextAction.id)
+ : items,
+ };
+}
+
+function SharedSubtaskList({
+ items,
+ ariaLabel,
+ issueLinkState,
+}: {
+ items: Issue[];
+ ariaLabel: string;
+ issueLinkState?: unknown;
+}) {
+ return (
+ <ul className="flex flex-col gap-0.5" aria-label={ariaLabel}>
+ {items.map((item) => (
+ <li key={item.id}>
+ <IssueRow
+ issue={item}
+ issueLinkState={issueLinkState}
+ presentation="task"
+ className="rounded-md"
+ />
+ </li>
+ ))}
+ </ul>
+ );
+}
+
+export function TaskDetailSubtasksPanel({
+ items,
+ onAddSubtask,
+ issueLinkState,
+}: {
+ items: Issue[];
+ onAddSubtask?: () => void;
+ issueLinkState?: unknown;
+}) {
+ const completed = items.filter((item) => item.status === "done").length;
+ const progress = items.length > 0 ? Math.round((completed / items.length) * 100) : 0;
+ const { nextAction, rootBlocker, remainingItems } = resolveTaskDetailSubtaskState(items);
+ const allCompleted = items.length > 0 && completed === items.length;
+
+ return (
+ <section className="flex flex-col gap-4" aria-label="Subtasks">
+ <div className="flex flex-col gap-2">
+ <div className="flex items-center justify-between gap-3 text-xs text-muted-foreground">
+ <span>Progress</span>
+ <span className="font-mono">{completed} of {items.length} complete</span>
+ </div>
+ <div
+ className="h-1.5 overflow-hidden rounded-full bg-muted"
+ role="progressbar"
+ aria-label="Subtask completion"
+ aria-valuemin={0}
+ aria-valuemax={100}
+ aria-valuenow={progress}
+ >
+ <div
+ className="h-full rounded-full bg-(--status-task-icon-done) transition-[width]"
+ style={{ width: `${progress}%` }}
+ />
+ </div>
+ </div>
+
+ {rootBlocker ? (
+ <section className="flex flex-col gap-1.5" aria-labelledby="task-root-blocker-heading">
+ <h3 id="task-root-blocker-heading" className="text-xs font-medium text-muted-foreground">
+ Root blocker
+ </h3>
+ <RelationNavigationList
+ items={[rootBlocker]}
+ emptyMessage=""
+ ariaLabel="Root blocker"
+ issueLinkState={issueLinkState}
+ />
+ </section>
+ ) : null}
+
+ {nextAction ? (
+ <section className="flex flex-col gap-1.5" aria-labelledby="task-next-action-heading">
+ <h3 id="task-next-action-heading" className="text-xs font-medium text-muted-foreground">
+ {nextAction.status === "blocked" ? "Blocked subtask" : "Next action"}
+ </h3>
+ <SharedSubtaskList
+ items={[nextAction]}
+ ariaLabel="Next subtask action"
+ issueLinkState={issueLinkState}
+ />
+ </section>
+ ) : items.length > 0 ? (
+ <p className="text-xs text-muted-foreground">
+ {allCompleted ? "All subtasks are complete." : "No remaining subtask actions."}
+ </p>
+ ) : (
+ <p className="py-6 text-center text-sm text-muted-foreground">No subtasks yet.</p>
+ )}
+
+ {remainingItems.length > 0 ? (
+ <section className="flex flex-col gap-1.5" aria-labelledby="task-other-subtasks-heading">
+ <h3 id="task-other-subtasks-heading" className="text-xs font-medium text-muted-foreground">
+ {nextAction ? "Other subtasks" : "Subtasks"}
+ </h3>
+ <SharedSubtaskList
+ items={remainingItems}
+ ariaLabel={nextAction ? "Other subtasks" : "Subtasks"}
+ issueLinkState={issueLinkState}
+ />
+ </section>
+ ) : null}
+
+ {onAddSubtask ? (
+ <Button type="button" variant="outline" size="sm" className="self-start" onClick={onAddSubtask}>
+ <Plus className="h-3.5 w-3.5" />
+ Add subtask
+ </Button>
+ ) : null}
+ </section>
+ );
+}
+
+export function TaskDetailReferencesPanel({
+ referenced,
+ mentionedIn,
+ issueLinkState,
+}: {
+ referenced: TaskDetailRelationItem[];
+ mentionedIn: TaskDetailRelationItem[];
+ issueLinkState?: unknown;
+}) {
+ return (
+ <div className="flex flex-col gap-6">
+ <section className="flex flex-col gap-2" aria-labelledby="task-referenced-heading">
+ <h3 id="task-referenced-heading" className="text-xs font-medium text-muted-foreground">
+ Referenced
+ </h3>
+ <RelationNavigationList
+ items={referenced}
+ emptyMessage="This task does not reference another task."
+ ariaLabel="Referenced tasks"
+ issueLinkState={issueLinkState}
+ />
+ </section>
+ <section className="flex flex-col gap-2" aria-labelledby="task-mentioned-in-heading">
+ <h3 id="task-mentioned-in-heading" className="text-xs font-medium text-muted-foreground">
+ Mentioned in
+ </h3>
+ <RelationNavigationList
+ items={mentionedIn}
+ emptyMessage="No other task mentions this task."
+ ariaLabel="Tasks that mention this task"
+ issueLinkState={issueLinkState}
+ />
+ </section>
+ </div>
+ );
+}
diff --git a/ui/src/components/task-side-panel/TaskSidePanel.test.tsx b/ui/src/components/task-side-panel/TaskSidePanel.test.tsx
index cb95325763..fc22194e35 100644
--- a/ui/src/components/task-side-panel/TaskSidePanel.test.tsx
+++ b/ui/src/components/task-side-panel/TaskSidePanel.test.tsx
@@ -63,6 +63,12 @@ vi.mock("@/components/issue-properties/IssuePropertiesPlansTab", () => ({
IssuePropertiesPlansTab: () => <div>Plan content</div>,
}));
+vi.mock("@/components/task-detail/TaskDetailRelationsPanel", () => ({
+ TaskDetailSubtasksPanel: ({ items }: { items: Issue[] }) => (
+ <div>{`Subtasks content: ${items.length}`}</div>
+ ),
+}));
+
vi.mock("@/components/WorkspaceFileBrowser", () => ({
WorkspaceFileBrowser: () => <div>Files browser</div>,
}));
@@ -158,6 +164,80 @@ describe("TaskSidePanel", () => {
expect(container.textContent).toContain("Properties content");
});
+ it("uses the approved pre-rebase tab appearance for Streamlined UI", async () => {
+ await render(panel({ streamlinedTabs: true }));
+ const propertiesTab = container.querySelector<HTMLElement>('[data-side-panel-tab-target="properties"]');
+ expect(propertiesTab?.className).toContain("text-sm");
+ expect(propertiesTab?.querySelector("svg")).toBeNull();
+ expect(container.querySelector('[data-side-panel-tab-wrapper="properties"]')?.className).toContain("mx-1.5");
+ expect(container.querySelector<HTMLButtonElement>('button[aria-label="Close Properties"]')?.className)
+ .toContain("opacity-0");
+ const addButton = container.querySelector<HTMLButtonElement>('button[aria-label="Open a new tab"]');
+ expect(addButton?.className).toContain("h-(--side-panel-tab-height)");
+ expect(addButton?.className).toContain("w-(--side-panel-tab-height)");
+ expect(addButton?.className).toContain("hover:bg-accent");
+ });
+
+ it("shows an uncounted Subtasks tab only when Streamlined UI has child tasks", async () => {
+ const children = [
+ issue({ id: "child-1", title: "First child" }),
+ issue({ id: "child-2", title: "Second child" }),
+ ];
+ await render(panel({ childIssues: children, showSubtasksTab: true, streamlinedTabs: true }));
+
+ const propertiesTab = container.querySelector<HTMLElement>('[data-side-panel-tab-target="properties"]');
+ const subtasksTab = container.querySelector<HTMLButtonElement>('[data-side-panel-tab-target="subtasks"]');
+ expect(propertiesTab?.getAttribute("aria-selected")).toBe("true");
+ expect(subtasksTab?.textContent?.trim()).toBe("Subtasks");
+ expect(subtasksTab?.getAttribute("aria-label")).toBe("Subtasks");
+
+ await act(async () => subtasksTab?.click());
+ expect(container.textContent).toContain("Subtasks content: 2");
+ });
+
+ it("inserts Subtasks after Properties when child tasks load later", async () => {
+ await render(panel({ childIssues: [], showSubtasksTab: true, streamlinedTabs: true }));
+ await act(async () => container.querySelector<HTMLButtonElement>('button[aria-label="Open a new tab"]')?.click());
+ const artifactsItem = Array.from(document.body.querySelectorAll<HTMLElement>('[role="option"]'))
+ .find((item) => item.textContent?.includes("Artifacts"));
+ await act(async () => artifactsItem?.click());
+
+ await render(panel({
+ childIssues: [issue({ id: "child-1" })],
+ showSubtasksTab: true,
+ streamlinedTabs: true,
+ }));
+
+ expect(Array.from(container.querySelectorAll('[role="tab"]')).map((tab) => tab.getAttribute("data-side-panel-tab-target")))
+ .toEqual(["properties", "subtasks", "artifacts"]);
+ });
+
+ it("hides Subtasks for tasks without children and when Streamlined UI is off", async () => {
+ await render(panel({ childIssues: [], showSubtasksTab: true }));
+ expect(container.querySelector('[data-side-panel-tab-target="subtasks"]')).toBeNull();
+
+ await render(panel({ childIssues: [issue({ id: "child-1" })], showSubtasksTab: false }));
+ expect(container.querySelector('[data-side-panel-tab-target="subtasks"]')).toBeNull();
+ });
+
+ it("reopens a closed Subtasks tab from the launcher", async () => {
+ await render(panel({
+ childIssues: [issue({ id: "child-1" })],
+ showSubtasksTab: true,
+ streamlinedTabs: true,
+ }));
+
+ await act(async () => container.querySelector<HTMLButtonElement>('button[aria-label="Close Subtasks"]')?.click());
+ expect(container.querySelector('[data-side-panel-tab-target="subtasks"]')).toBeNull();
+
+ await act(async () => container.querySelector<HTMLButtonElement>('button[aria-label="Open a new tab"]')?.click());
+ const launcherItem = Array.from(document.body.querySelectorAll<HTMLElement>('[role="option"]'))
+ .find((item) => item.textContent?.includes("Subtasks"));
+ expect(launcherItem).not.toBeUndefined();
+ await act(async () => launcherItem?.click());
+ expect(container.querySelector('[data-side-panel-tab-target="subtasks"]')).not.toBeNull();
+ });
+
it("does not create a Plan tab for planning mode before a plan exists", async () => {
await render(panel({ issue: issue({ workMode: "planning" }) }));
expect(container.querySelector('[role="tab"][aria-selected="true"]')?.textContent).toContain("Properties");
diff --git a/ui/src/components/task-side-panel/TaskSidePanel.tsx b/ui/src/components/task-side-panel/TaskSidePanel.tsx
index 4a7ae76ed0..da1640abe2 100644
--- a/ui/src/components/task-side-panel/TaskSidePanel.tsx
+++ b/ui/src/components/task-side-panel/TaskSidePanel.tsx
@@ -19,6 +19,7 @@ import {
FileText,
FolderOpen,
Lightbulb,
+ ListTree,
Plus,
SlidersHorizontal,
} from "lucide-react";
@@ -28,6 +29,7 @@ import { PROPERTIES_PANE_HEADER_SLOT_ID } from "@/components/PropertiesPanel";
import { WorkspaceFileBrowser } from "@/components/WorkspaceFileBrowser";
import { IssuePropertiesArtifactsTab } from "@/components/issue-properties/IssuePropertiesArtifactsTab";
import { IssuePropertiesPlansTab } from "@/components/issue-properties/IssuePropertiesPlansTab";
+import { TaskDetailSubtasksPanel } from "@/components/task-detail/TaskDetailRelationsPanel";
import {
SidePanelLauncher,
SidePanelToggleButton,
@@ -63,6 +65,7 @@ import {
taskPanelDocumentTab,
taskPanelFilesTab,
taskPanelPropertiesTab,
+ taskPanelSubtasksTab,
taskPanelWorkspaceFileTab,
writeTaskSidePanelState,
type TaskSidePanelTabPayload,
@@ -75,6 +78,7 @@ export interface TaskSidePanelProps {
issue: Issue;
accountScope: string;
childIssues?: Issue[];
+ issueLinkState?: unknown;
onAddSubIssue?: () => void;
onUpdate: (data: Record<string, unknown>) => void;
inline?: boolean;
@@ -88,6 +92,8 @@ export interface TaskSidePanelProps {
fileTabsEnabled: boolean;
documentDeepLink?: { requestId: number; documentKey: string } | null;
onRequestClose?: () => void;
+ streamlinedTabs?: boolean;
+ showSubtasksTab?: boolean;
}
const EMPTY_ISSUE_DOCUMENTS: IssueDocument[] = [];
@@ -95,6 +101,7 @@ const EMPTY_ISSUE_DOCUMENTS: IssueDocument[] = [];
function tabIcon(tab: SidePanelTabRecord<TaskSidePanelTabPayload>): ReactNode {
switch (tab.payload.kind) {
case "properties": return <SlidersHorizontal />;
+ case "subtasks": return <ListTree />;
case "artifacts": return <Box />;
case "files-browser": return <FolderOpen />;
case "workspace-file": return <FileCode2 />;
@@ -102,6 +109,16 @@ function tabIcon(tab: SidePanelTabRecord<TaskSidePanelTabPayload>): ReactNode {
}
}
+function insertSubtasksAfterProperties(
+ tabs: SidePanelTabRecord<TaskSidePanelTabPayload>[],
+) {
+ if (tabs.some((tab) => tab.id === "subtasks")) return tabs;
+ const propertiesIndex = tabs.findIndex((tab) => tab.id === "properties");
+ const next = [...tabs];
+ next.splice(propertiesIndex < 0 ? 0 : propertiesIndex + 1, 0, taskPanelSubtasksTab());
+ return next;
+}
+
function selectorForWorkspaceKind(kind: "execution_workspace" | "project_workspace") {
return kind === "execution_workspace" ? "execution" as const : "project" as const;
}
@@ -190,6 +207,7 @@ export function TaskSidePanel({
issue,
accountScope,
childIssues = [],
+ issueLinkState,
onAddSubIssue,
onUpdate,
inline = false,
@@ -203,6 +221,8 @@ export function TaskSidePanel({
fileTabsEnabled,
documentDeepLink,
onRequestClose,
+ streamlinedTabs = false,
+ showSubtasksTab = false,
}: TaskSidePanelProps) {
const handleScroll = useScrollbarWhileScrolling();
const viewer = useTaskSidePanelFileRouting();
@@ -212,16 +232,33 @@ export function TaskSidePanel({
const restoredRef = useRef(
readTaskSidePanelState(accountScope, issue.companyId, issue.id, fileTabsEnabled),
);
+ const initialSubtasksAvailableRef = useRef(showSubtasksTab && childIssues.length > 0);
+ const subtasksDismissedRef = useRef(
+ restoredRef.current?.userInteracted === true
+ && restoredRef.current.state.tabs.length === 0,
+ );
const [launcherOpen, setLauncherOpen] = useState(restoredRef.current?.launcherOpen ?? false);
const [paneHeaderSlot, setPaneHeaderSlot] = useState<HTMLElement | null>(null);
const bodyRef = useRef<HTMLDivElement>(null);
const scrollPositionsRef = useRef(new Map<string, number>());
const userInteractedRef = useRef(restoredRef.current?.userInteracted ?? false);
const autoPlanHandledRef = useRef(restoredRef.current?.autoPlanHandled ?? false);
- const initialState = useMemo(() => restoredRef.current?.state ?? ({
- tabs: [taskPanelPropertiesTab()],
- activeTabId: "properties",
- }), []);
+ const initialState = useMemo(() => {
+ const restored = restoredRef.current?.state;
+ let tabs = restored?.tabs ?? [taskPanelPropertiesTab()];
+ if (!initialSubtasksAvailableRef.current) {
+ tabs = tabs.filter((tab) => tab.payload.kind !== "subtasks");
+ } else if (!subtasksDismissedRef.current) {
+ tabs = insertSubtasksAfterProperties(tabs);
+ }
+ const requestedActive = restored?.activeTabId ?? "properties";
+ return {
+ tabs,
+ activeTabId: tabs.some((tab) => tab.id === requestedActive)
+ ? requestedActive
+ : tabs[0]?.id ?? null,
+ };
+ }, []);
const persist = useCallback((state: { tabs: SidePanelTabRecord<TaskSidePanelTabPayload>[]; activeTabId: string | null }) => {
writeTaskSidePanelState(accountScope, issue.companyId, issue.id, {
@@ -234,6 +271,29 @@ export function TaskSidePanel({
}, [accountScope, issue.companyId, issue.id, launcherOpen]);
const controller = useSidePanelTabs<TaskSidePanelTabPayload>({ initialState, onStateChange: persist });
const activeTab = controller.tabs.find((tab) => tab.id === controller.activeTabId) ?? null;
+ const subtasksAvailable = showSubtasksTab && childIssues.length > 0;
+ const hasSubtasksTab = controller.tabs.some((tab) => tab.id === "subtasks");
+
+ useEffect(() => {
+ if (!subtasksAvailable) {
+ subtasksDismissedRef.current = false;
+ if (hasSubtasksTab) controller.closeTab("subtasks");
+ return;
+ }
+ if (!hasSubtasksTab && !subtasksDismissedRef.current) {
+ controller.resetTabs({
+ tabs: insertSubtasksAfterProperties(controller.tabs),
+ activeTabId: controller.activeTabId,
+ });
+ }
+ }, [
+ controller.activeTabId,
+ controller.closeTab,
+ controller.resetTabs,
+ controller.tabs,
+ hasSubtasksTab,
+ subtasksAvailable,
+ ]);
useEffect(() => {
if (inline) {
@@ -353,6 +413,7 @@ export function TaskSidePanel({
function closeTab(tabId: string) {
markInteracted();
+ if (tabId === "subtasks") subtasksDismissedRef.current = true;
const tab = controller.tabs.find((candidate) => candidate.id === tabId);
controller.closeTab(tabId);
if (tabId === controller.activeTabId && (tab?.payload.kind === "workspace-file" || tab?.payload.kind === "files-browser")) {
@@ -392,7 +453,7 @@ export function TaskSidePanel({
id: tab.id,
type: tab.type,
label: document ? documentDisplayTitle(document) : tab.label,
- ariaLabel: tab.ariaLabel,
+ ariaLabel: tab.payload.kind === "subtasks" ? "Subtasks" : tab.ariaLabel,
closable: true,
contentMode: tab.contentMode,
icon: tabIcon(tab),
@@ -402,6 +463,7 @@ export function TaskSidePanel({
const launcherSections = useMemo<SidePanelLauncherSection[]>(() => {
const primary: SidePanelLauncherItem[] = [
{ id: "properties", label: "Properties", icon: <SlidersHorizontal />, alreadyOpen: controller.tabs.some((tab) => tab.id === "properties") },
+ ...(subtasksAvailable ? [{ id: "subtasks", label: "Subtasks", description: `${childIssues.length} total`, icon: <ListTree />, alreadyOpen: controller.tabs.some((tab) => tab.id === "subtasks") }] : []),
{ id: "artifacts", label: "Artifacts", icon: <Box />, alreadyOpen: controller.tabs.some((tab) => tab.id === "artifacts") },
];
if (fileTabsEnabled) {
@@ -451,11 +513,18 @@ export function TaskSidePanel({
});
}
return sections;
- }, [controller.tabs, documents, fileTabsEnabled, planDocument, recentFilesQuery.data, recentFilesQuery.isError, recentFilesQuery.isLoading]);
+ }, [childIssues.length, controller.tabs, documents, fileTabsEnabled, planDocument, recentFilesQuery.data, recentFilesQuery.isError, recentFilesQuery.isLoading, subtasksAvailable]);
function selectLauncherItem(item: SidePanelLauncherItem) {
markInteracted();
if (item.id === "properties") controller.openTab(taskPanelPropertiesTab());
+ else if (item.id === "subtasks") {
+ subtasksDismissedRef.current = false;
+ controller.resetTabs({
+ tabs: insertSubtasksAfterProperties(controller.tabs),
+ activeTabId: "subtasks",
+ });
+ }
else if (item.id === "artifacts") controller.openTab(taskPanelArtifactsTab());
else if (item.id === "files") {
controller.openTab(taskPanelFilesTab());
@@ -486,7 +555,18 @@ export function TaskSidePanel({
open={launcherOpen}
onOpenChange={setLauncherOpen}
trigger={(
- <Button type="button" variant="ghost" size="icon-sm" className="h-(--side-panel-tab-height) w-(--side-panel-tab-height) shrink-0 rounded-(--side-panel-control-radius) text-muted-foreground hover:text-foreground focus-visible:text-foreground" aria-label="Open a new tab">
+ <Button
+ type="button"
+ variant="ghost"
+ size="icon-sm"
+ className={cn(
+ "shrink-0 text-muted-foreground hover:text-foreground focus-visible:text-foreground",
+ streamlinedTabs
+ ? "h-(--side-panel-tab-height) w-(--side-panel-tab-height) rounded-md"
+ : "h-(--side-panel-tab-height) w-(--side-panel-tab-height) rounded-(--side-panel-control-radius)",
+ )}
+ aria-label="Open a new tab"
+ >
<Plus aria-hidden />
</Button>
)}
@@ -503,6 +583,7 @@ export function TaskSidePanel({
controller.reorderTabs(ordered);
}}
addControl={launcherControl}
+ appearance={streamlinedTabs ? "streamlined-task" : "default"}
/>
);
@@ -514,6 +595,7 @@ export function TaskSidePanel({
<IssueProperties
issue={issue}
childIssues={childIssues}
+ issueLinkState={issueLinkState}
onAddSubIssue={onAddSubIssue}
onUpdate={onUpdate}
inline={inline}
@@ -527,6 +609,14 @@ export function TaskSidePanel({
sidePanelContentOnly
/>
);
+ } else if (activeTab.payload.kind === "subtasks") {
+ content = (
+ <TaskDetailSubtasksPanel
+ items={childIssues}
+ onAddSubtask={onAddSubIssue}
+ issueLinkState={issueLinkState}
+ />
+ );
} else if (activeTab.payload.kind === "artifacts") {
content = <IssuePropertiesArtifactsTab issue={issue} onOpenDocument={openDocument} />;
} else if (activeTab.payload.kind === "issue-document") {
diff --git a/ui/src/hooks/useKeyboardShortcuts.test.tsx b/ui/src/hooks/useKeyboardShortcuts.test.tsx
index a309a46272..3e87fc57f4 100644
--- a/ui/src/hooks/useKeyboardShortcuts.test.tsx
+++ b/ui/src/hooks/useKeyboardShortcuts.test.tsx
@@ -11,19 +11,16 @@ import { useKeyboardShortcuts } from "./useKeyboardShortcuts";
function TestHarness({
onNewIssue,
onSearch,
- onToggleCollapse,
onGoToInbox,
}: {
onNewIssue: () => void;
onSearch?: () => void;
- onToggleCollapse?: () => void;
onGoToInbox?: () => void;
}) {
useKeyboardShortcuts({
enabled: true,
onNewIssue,
onSearch,
- onToggleCollapse,
onGoToInbox,
});
@@ -113,29 +110,30 @@ describe("useKeyboardShortcuts", () => {
});
});
- it("fires onToggleCollapse on Cmd/Ctrl+B", () => {
+ it("does not intercept the retired Cmd/Ctrl+B collapse shortcut", () => {
const root = createRoot(container);
- const onToggleCollapse = vi.fn();
act(() => {
- root.render(<TestHarness onNewIssue={vi.fn()} onToggleCollapse={onToggleCollapse} />);
+ root.render(<TestHarness onNewIssue={vi.fn()} />);
});
- document.dispatchEvent(new KeyboardEvent("keydown", {
+ const metaEvent = new KeyboardEvent("keydown", {
key: "b",
metaKey: true,
bubbles: true,
cancelable: true,
- }));
- expect(onToggleCollapse).toHaveBeenCalledTimes(1);
+ });
+ document.dispatchEvent(metaEvent);
+ expect(metaEvent.defaultPrevented).toBe(false);
- document.dispatchEvent(new KeyboardEvent("keydown", {
+ const ctrlEvent = new KeyboardEvent("keydown", {
key: "b",
ctrlKey: true,
bubbles: true,
cancelable: true,
- }));
- expect(onToggleCollapse).toHaveBeenCalledTimes(2);
+ });
+ document.dispatchEvent(ctrlEvent);
+ expect(ctrlEvent.defaultPrevented).toBe(false);
act(() => {
root.unmount();
@@ -201,23 +199,4 @@ describe("useKeyboardShortcuts", () => {
});
});
- it("does not fire onToggleCollapse for a bare 'b' keypress", () => {
- const root = createRoot(container);
- const onToggleCollapse = vi.fn();
-
- act(() => {
- root.render(<TestHarness onNewIssue={vi.fn()} onToggleCollapse={onToggleCollapse} />);
- });
-
- document.dispatchEvent(new KeyboardEvent("keydown", {
- key: "b",
- bubbles: true,
- cancelable: true,
- }));
- expect(onToggleCollapse).not.toHaveBeenCalled();
-
- act(() => {
- root.unmount();
- });
- });
});
diff --git a/ui/src/hooks/useKeyboardShortcuts.ts b/ui/src/hooks/useKeyboardShortcuts.ts
index 1f37a9630a..c246ba8cbf 100644
--- a/ui/src/hooks/useKeyboardShortcuts.ts
+++ b/ui/src/hooks/useKeyboardShortcuts.ts
@@ -11,7 +11,6 @@ interface ShortcutHandlers {
onNewIssue?: () => void;
onSearch?: () => void;
onToggleSidebar?: () => void;
- onToggleCollapse?: () => void;
onTogglePanel?: () => void;
onShowShortcuts?: () => void;
onGoToInbox?: () => void;
@@ -22,7 +21,6 @@ export function useKeyboardShortcuts({
onNewIssue,
onSearch,
onToggleSidebar,
- onToggleCollapse,
onTogglePanel,
onShowShortcuts,
onGoToInbox,
@@ -128,12 +126,6 @@ export function useKeyboardShortcuts({
onToggleSidebar?.();
}
- // Cmd/Ctrl+B → Collapse/expand sidebar (desktop) or toggle drawer (mobile)
- if ((e.key === "b" || e.key === "B") && (e.metaKey || e.ctrlKey) && !e.altKey) {
- e.preventDefault();
- onToggleCollapse?.();
- }
-
// ] → Toggle Panel
if (e.key === "]" && !e.metaKey && !e.ctrlKey) {
e.preventDefault();
@@ -155,5 +147,5 @@ export function useKeyboardShortcuts({
document.removeEventListener("focusin", handleFocusIn, true);
document.removeEventListener("keydown", handleKeyDown);
};
- }, [enabled, onNewIssue, onSearch, onToggleSidebar, onToggleCollapse, onTogglePanel, onShowShortcuts, onGoToInbox]);
+ }, [enabled, onNewIssue, onSearch, onToggleSidebar, onTogglePanel, onShowShortcuts, onGoToInbox]);
}
diff --git a/ui/src/lib/issue-filters.test.ts b/ui/src/lib/issue-filters.test.ts
index 0c860af84c..c17d2d1c50 100644
--- a/ui/src/lib/issue-filters.test.ts
+++ b/ui/src/lib/issue-filters.test.ts
@@ -7,6 +7,7 @@ import {
countActiveIssueFilters,
defaultIssueFilterState,
resolveIssueFilterWorkspaceId,
+ searchIssueFilterOptions,
shouldIncludeIssueFilterWorkspaceOption,
} from "./issue-filters";
@@ -68,6 +69,14 @@ function makeExternalObjectSummary(overrides: Partial<ExternalObjectSummary> = {
}
describe("issue filters", () => {
+ it("searches filter options case-insensitively without mutating the source", () => {
+ const options = [{ name: "Alpha Agent" }, { name: "Release QA" }];
+ expect(searchIssueFilterOptions(options, " qa ", (option) => option.name)).toEqual([
+ { name: "Release QA" },
+ ]);
+ expect(options).toHaveLength(2);
+ });
+
it("filters issues by creator across agents and users", () => {
const issues = [
makeIssue({ id: "agent-match", createdByAgentId: "agent-1" }),
diff --git a/ui/src/lib/issue-filters.ts b/ui/src/lib/issue-filters.ts
index a0576a5305..ce6178102a 100644
--- a/ui/src/lib/issue-filters.ts
+++ b/ui/src/lib/issue-filters.ts
@@ -123,6 +123,18 @@ export function toggleIssueFilterValue(values: string[], value: string): string[
return values.includes(value) ? values.filter((existing) => existing !== value) : [...values, value];
}
+export function searchIssueFilterOptions<T>(
+ options: readonly T[] | undefined,
+ search: string,
+ getSearchText: (option: T) => string,
+): T[] {
+ const normalizedSearch = search.trim().toLocaleLowerCase();
+ if (!normalizedSearch) return [...(options ?? [])];
+ return (options ?? []).filter((option) =>
+ getSearchText(option).toLocaleLowerCase().includes(normalizedSearch),
+ );
+}
+
export function resolveIssueFilterWorkspaceId(
issue: Pick<Issue, "executionWorkspaceId" | "projectId" | "projectWorkspaceId">,
context: IssueFilterWorkspaceContext = {},
diff --git a/ui/src/lib/task-collection-preferences.test.ts b/ui/src/lib/task-collection-preferences.test.ts
new file mode 100644
index 0000000000..74f27941a7
--- /dev/null
+++ b/ui/src/lib/task-collection-preferences.test.ts
@@ -0,0 +1,122 @@
+import { describe, expect, it } from "vitest";
+import {
+ loadTaskCollectionPreferences,
+ saveTaskCollectionPreferences,
+ taskCollectionPreferencesStorageKey,
+} from "./task-collection-preferences";
+
+class MemoryStorage {
+ private values = new Map<string, string>();
+ getItem(key: string) { return this.values.get(key) ?? null; }
+ setItem(key: string, value: string) { this.values.set(key, value); }
+}
+
+type ViewState = { sort: "updated" | "created"; filters: string[] };
+type Column = "status" | "id" | "updated";
+
+const defaults: ViewState = { sort: "updated", filters: [] };
+const columns: Column[] = ["status", "id", "updated"];
+const normalizeViewState = (value: unknown): ViewState => {
+ const candidate = value as Partial<ViewState> | null;
+ return {
+ sort: candidate?.sort === "created" ? "created" : "updated",
+ filters: Array.isArray(candidate?.filters)
+ ? candidate.filters.filter((entry): entry is string => typeof entry === "string")
+ : [],
+ };
+};
+const normalizeColumns = (value: unknown): Column[] => Array.isArray(value)
+ ? value.filter((entry): entry is Column => columns.includes(entry as Column))
+ : columns;
+
+describe("task collection preferences", () => {
+ it("migrates legacy view and column keys into a versioned company scope", () => {
+ const storage = new MemoryStorage();
+ storage.setItem("legacy:view", JSON.stringify({ sort: "created", filters: ["active"] }));
+ storage.setItem("legacy:columns", JSON.stringify(["status", "id"]));
+
+ const loaded = loadTaskCollectionPreferences<ViewState, Column>({
+ storage,
+ companyId: "company-a",
+ collectionKey: "tasks",
+ legacyViewStorageKey: "legacy:view",
+ legacyColumnsStorageKey: "legacy:columns",
+ defaultViewState: defaults,
+ defaultColumns: columns,
+ normalizeViewState,
+ normalizeColumns,
+ });
+
+ expect(loaded).toEqual({
+ viewState: { sort: "created", filters: ["active"] },
+ columns: ["status", "id"],
+ migrated: true,
+ source: "legacy",
+ });
+ const current = storage.getItem(taskCollectionPreferencesStorageKey({
+ companyId: "company-a",
+ collectionKey: "tasks",
+ }));
+ expect(JSON.parse(current ?? "{}")).toMatchObject({ version: 1, companyId: "company-a", collectionKey: "tasks" });
+ });
+
+ it("keeps preferences isolated between companies", () => {
+ const storage = new MemoryStorage();
+ saveTaskCollectionPreferences<ViewState, Column>(
+ { companyId: "company-a", collectionKey: "tasks" },
+ { viewState: { sort: "created", filters: [] }, columns: ["id"] },
+ storage,
+ );
+
+ const companyB = loadTaskCollectionPreferences<ViewState, Column>({
+ storage,
+ companyId: "company-b",
+ collectionKey: "tasks",
+ defaultViewState: defaults,
+ defaultColumns: columns,
+ normalizeViewState,
+ normalizeColumns,
+ });
+ expect(companyB.viewState).toEqual(defaults);
+ expect(companyB.columns).toEqual(columns);
+ });
+
+ it("dual-writes legacy keys for compatibility", () => {
+ const storage = new MemoryStorage();
+ saveTaskCollectionPreferences<ViewState, Column>(
+ {
+ companyId: "company-a",
+ collectionKey: "tasks",
+ legacyViewStorageKey: "legacy:view",
+ legacyColumnsStorageKey: "legacy:columns",
+ },
+ { viewState: { sort: "created", filters: ["active"] }, columns: ["status"] },
+ storage,
+ );
+
+ expect(JSON.parse(storage.getItem("legacy:view") ?? "{}")).toEqual({ sort: "created", filters: ["active"] });
+ expect(JSON.parse(storage.getItem("legacy:columns") ?? "[]")).toEqual(["status"]);
+ });
+
+ it("preserves a collection default when only legacy columns existed", () => {
+ const storage = new MemoryStorage();
+ storage.setItem("legacy:columns", JSON.stringify(["id"]));
+ const options = {
+ storage,
+ companyId: "company-a",
+ collectionKey: "tasks",
+ legacyViewStorageKey: "legacy:view",
+ legacyColumnsStorageKey: "legacy:columns",
+ defaultViewState: defaults,
+ defaultColumns: columns,
+ normalizeViewState,
+ normalizeColumns,
+ } as const;
+
+ const migrated = loadTaskCollectionPreferences<ViewState, Column>(options);
+ const reloaded = loadTaskCollectionPreferences<ViewState, Column>(options);
+ expect(migrated.source).toBe("default");
+ expect(reloaded.source).toBe("default");
+ expect(reloaded.columns).toEqual(["id"]);
+ });
+});
diff --git a/ui/src/lib/task-collection-preferences.ts b/ui/src/lib/task-collection-preferences.ts
new file mode 100644
index 0000000000..858d1cc44d
--- /dev/null
+++ b/ui/src/lib/task-collection-preferences.ts
@@ -0,0 +1,141 @@
+export const TASK_COLLECTION_PREFERENCES_VERSION = 1 as const;
+
+type StorageLike = Pick<Storage, "getItem" | "setItem">;
+
+export interface TaskCollectionPreferenceEnvelope<TViewState, TColumn extends string> {
+ version: typeof TASK_COLLECTION_PREFERENCES_VERSION;
+ companyId: string;
+ collectionKey: string;
+ viewState: TViewState;
+ viewStateSource?: "stored" | "default";
+ columns: TColumn[];
+}
+
+export interface TaskCollectionPreferenceLocation {
+ companyId: string;
+ collectionKey: string;
+ legacyViewStorageKey?: string;
+ legacyColumnsStorageKey?: string;
+}
+
+export interface LoadTaskCollectionPreferenceOptions<TViewState, TColumn extends string>
+ extends TaskCollectionPreferenceLocation {
+ storage?: StorageLike | null;
+ defaultViewState: TViewState;
+ defaultColumns: TColumn[];
+ normalizeViewState: (value: unknown) => TViewState;
+ normalizeColumns: (value: unknown) => TColumn[];
+}
+
+function browserStorage(): StorageLike | null {
+ if (typeof localStorage === "undefined") return null;
+ return localStorage;
+}
+
+function parseStoredJson(storage: StorageLike, key: string | undefined): unknown {
+ if (!key) return null;
+ try {
+ const value = storage.getItem(key);
+ return value == null ? null : JSON.parse(value);
+ } catch {
+ return null;
+ }
+}
+
+export function taskCollectionPreferencesStorageKey({
+ companyId,
+ collectionKey,
+}: Pick<TaskCollectionPreferenceLocation, "companyId" | "collectionKey">): string {
+ return `paperclip:task-collection:v${TASK_COLLECTION_PREFERENCES_VERSION}:${encodeURIComponent(companyId)}:${encodeURIComponent(collectionKey)}`;
+}
+
+function isCurrentEnvelope<TViewState, TColumn extends string>(
+ value: unknown,
+ location: TaskCollectionPreferenceLocation,
+): value is TaskCollectionPreferenceEnvelope<TViewState, TColumn> {
+ if (!value || typeof value !== "object") return false;
+ const candidate = value as Partial<TaskCollectionPreferenceEnvelope<TViewState, TColumn>>;
+ return candidate.version === TASK_COLLECTION_PREFERENCES_VERSION
+ && candidate.companyId === location.companyId
+ && candidate.collectionKey === location.collectionKey
+ && "viewState" in candidate
+ && Array.isArray(candidate.columns);
+}
+
+export function saveTaskCollectionPreferences<TViewState, TColumn extends string>(
+ location: TaskCollectionPreferenceLocation,
+ value: { viewState: TViewState; columns: TColumn[]; viewStateSource?: "stored" | "default" },
+ storage: StorageLike | null = browserStorage(),
+): void {
+ if (!storage) return;
+ const envelope: TaskCollectionPreferenceEnvelope<TViewState, TColumn> = {
+ version: TASK_COLLECTION_PREFERENCES_VERSION,
+ companyId: location.companyId,
+ collectionKey: location.collectionKey,
+ viewState: value.viewState,
+ viewStateSource: value.viewStateSource ?? "stored",
+ columns: value.columns,
+ };
+
+ try {
+ storage.setItem(taskCollectionPreferencesStorageKey(location), JSON.stringify(envelope));
+ // Dual-write during migration so older builds using the same worktree keep
+ // reading the latest presentation state.
+ if (location.legacyViewStorageKey) {
+ storage.setItem(location.legacyViewStorageKey, JSON.stringify(value.viewState));
+ }
+ if (location.legacyColumnsStorageKey) {
+ storage.setItem(location.legacyColumnsStorageKey, JSON.stringify(value.columns));
+ }
+ } catch {
+ // Preferences are an enhancement; storage denial must not break the list.
+ }
+}
+
+export function loadTaskCollectionPreferences<TViewState, TColumn extends string>({
+ storage = browserStorage(),
+ defaultViewState,
+ defaultColumns,
+ normalizeViewState,
+ normalizeColumns,
+ ...location
+}: LoadTaskCollectionPreferenceOptions<TViewState, TColumn>): {
+ viewState: TViewState;
+ columns: TColumn[];
+ migrated: boolean;
+ source: "current" | "legacy" | "default";
+} {
+ if (!storage) {
+ return { viewState: defaultViewState, columns: defaultColumns, migrated: false, source: "default" };
+ }
+
+ const current = parseStoredJson(storage, taskCollectionPreferencesStorageKey(location));
+ if (isCurrentEnvelope<TViewState, TColumn>(current, location)) {
+ return {
+ viewState: normalizeViewState(current.viewState),
+ columns: normalizeColumns(current.columns),
+ migrated: false,
+ source: current.viewStateSource === "default" ? "default" : "current",
+ };
+ }
+
+ const legacyView = parseStoredJson(storage, location.legacyViewStorageKey);
+ const legacyColumns = parseStoredJson(storage, location.legacyColumnsStorageKey);
+ const hasLegacyState = legacyView !== null || legacyColumns !== null;
+ const preferences = {
+ viewState: legacyView === null ? defaultViewState : normalizeViewState(legacyView),
+ columns: legacyColumns === null ? defaultColumns : normalizeColumns(legacyColumns),
+ };
+
+ if (hasLegacyState) {
+ saveTaskCollectionPreferences(location, {
+ ...preferences,
+ viewStateSource: legacyView === null ? "default" : "stored",
+ }, storage);
+ }
+ return {
+ ...preferences,
+ migrated: hasLegacyState,
+ source: legacyView !== null ? "legacy" : "default",
+ };
+}
diff --git a/ui/src/lib/task-date-groups.test.ts b/ui/src/lib/task-date-groups.test.ts
new file mode 100644
index 0000000000..b200058ee6
--- /dev/null
+++ b/ui/src/lib/task-date-groups.test.ts
@@ -0,0 +1,20 @@
+import { describe, expect, it } from "vitest";
+import { taskDateGroup, taskDateGroupSeparator } from "./task-date-groups";
+
+describe("task date groups", () => {
+ const now = new Date(2026, 7, 31, 9, 30);
+
+ it("uses local calendar boundaries instead of rolling 24-hour windows", () => {
+ expect(taskDateGroup(new Date(2026, 7, 31, 0, 1), now)).toBe("today");
+ expect(taskDateGroup(new Date(2026, 7, 30, 23, 59), now)).toBe("yesterday");
+ expect(taskDateGroup(new Date(2026, 7, 29, 23, 59), now)).toBe("earlier");
+ });
+
+ it("does not emit duplicate or leading Earlier separators", () => {
+ expect(taskDateGroupSeparator(null, "earlier")).toBeNull();
+ expect(taskDateGroupSeparator(null, "today")).toBe("Today");
+ expect(taskDateGroupSeparator("today", "today")).toBeNull();
+ expect(taskDateGroupSeparator("today", "yesterday")).toBe("Yesterday");
+ expect(taskDateGroupSeparator("yesterday", "earlier")).toBe("Earlier");
+ });
+});
diff --git a/ui/src/lib/task-date-groups.ts b/ui/src/lib/task-date-groups.ts
new file mode 100644
index 0000000000..df3795befb
--- /dev/null
+++ b/ui/src/lib/task-date-groups.ts
@@ -0,0 +1,37 @@
+export type TaskDateGroup = "today" | "yesterday" | "earlier";
+
+export const taskDateGroupLabels: Record<TaskDateGroup, string> = {
+ today: "Today",
+ yesterday: "Yesterday",
+ earlier: "Earlier",
+};
+
+function localCalendarOrdinal(date: Date): number {
+ return Date.UTC(date.getFullYear(), date.getMonth(), date.getDate());
+}
+
+/** Groups timestamps by the operator's local calendar, including across DST. */
+export function taskDateGroup(value: Date | string | number, now: Date = new Date()): TaskDateGroup {
+ const date = value instanceof Date ? value : new Date(value);
+ if (Number.isNaN(date.getTime())) return "earlier";
+
+ const dayDifference = Math.round(
+ (localCalendarOrdinal(now) - localCalendarOrdinal(date)) / (24 * 60 * 60 * 1000),
+ );
+ if (dayDifference <= 0) return "today";
+ if (dayDifference === 1) return "yesterday";
+ return "earlier";
+}
+
+/**
+ * Returns the label to insert before the current row. A list made entirely of
+ * older work does not begin with a redundant "Earlier" heading.
+ */
+export function taskDateGroupSeparator(
+ previous: TaskDateGroup | null,
+ current: TaskDateGroup,
+): string | null {
+ if (previous === current) return null;
+ if (previous === null && current === "earlier") return null;
+ return taskDateGroupLabels[current];
+}
diff --git a/ui/src/lib/task-side-panel-state.test.ts b/ui/src/lib/task-side-panel-state.test.ts
index 4e0dbf4ea5..efe4c30f8d 100644
--- a/ui/src/lib/task-side-panel-state.test.ts
+++ b/ui/src/lib/task-side-panel-state.test.ts
@@ -6,6 +6,7 @@ import {
taskPanelDocumentTab,
taskPanelFilesTab,
taskPanelPropertiesTab,
+ taskPanelSubtasksTab,
writeTaskSidePanelState,
} from "./task-side-panel-state";
@@ -54,6 +55,23 @@ describe("task side-panel persistence", () => {
expect(restored?.state.activeTabId).toBe("properties");
});
+ it("round-trips the Streamlined UI subtasks tab", () => {
+ writeTaskSidePanelState("user-1", "company-1", "task-1", {
+ state: {
+ tabs: [taskPanelPropertiesTab(), taskPanelSubtasksTab()],
+ activeTabId: "subtasks",
+ },
+ launcherOpen: false,
+ userInteracted: true,
+ autoPlanHandled: true,
+ updatedAt: 1,
+ });
+
+ const restored = readTaskSidePanelState("user-1", "company-1", "task-1", false);
+ expect(restored?.state.tabs.map((tab) => tab.id)).toEqual(["properties", "subtasks"]);
+ expect(restored?.state.activeTabId).toBe("subtasks");
+ });
+
it("retains only the 50 most recently written tasks", () => {
for (let index = 0; index < 52; index += 1) {
writeTaskSidePanelState("user-1", "company-1", `task-${index}`, {
diff --git a/ui/src/lib/task-side-panel-state.ts b/ui/src/lib/task-side-panel-state.ts
index 0a6f448e31..ce5eafb7c8 100644
--- a/ui/src/lib/task-side-panel-state.ts
+++ b/ui/src/lib/task-side-panel-state.ts
@@ -6,6 +6,7 @@ const MAX_TASK_STATES = 50;
export type TaskSidePanelTabPayload =
| { kind: "properties" }
+ | { kind: "subtasks" }
| { kind: "artifacts" }
| { kind: "issue-document"; documentKey: string }
| {
@@ -62,6 +63,7 @@ function parsePayload(value: unknown): TaskSidePanelTabPayload | null {
if (!input) return null;
const kind = input.kind;
if (kind === "properties") return { kind };
+ if (kind === "subtasks") return { kind };
if (kind === "artifacts") return { kind };
if (kind === "issue-document") {
return typeof input.documentKey === "string" && input.documentKey.length > 0
@@ -184,6 +186,10 @@ export function taskPanelPropertiesTab(): SidePanelTabRecord<TaskSidePanelTabPay
return { id: "properties", type: "properties", label: "Properties", closable: true, contentMode: "padded", payload: { kind: "properties" } };
}
+export function taskPanelSubtasksTab(): SidePanelTabRecord<TaskSidePanelTabPayload> {
+ return { id: "subtasks", type: "subtasks", label: "Subtasks", closable: true, contentMode: "padded", payload: { kind: "subtasks" } };
+}
+
export function taskPanelArtifactsTab(): SidePanelTabRecord<TaskSidePanelTabPayload> {
return { id: "artifacts", type: "artifacts", label: "Artifacts", closable: true, contentMode: "padded", payload: { kind: "artifacts" } };
}
diff --git a/ui/src/pages/Inbox.test.tsx b/ui/src/pages/Inbox.test.tsx
index b7445fa50e..7a9bf1e4a9 100644
--- a/ui/src/pages/Inbox.test.tsx
+++ b/ui/src/pages/Inbox.test.tsx
@@ -11,6 +11,7 @@ import {
clearLocalInboxArchive,
getLocalInboxArchiveIssueIds,
} from "../lib/inboxArchiveCache";
+import { taskCollectionPreferencesStorageKey } from "../lib/task-collection-preferences";
const routerMock = vi.hoisted(() => ({
location: { pathname: "/", search: "", hash: "" },
@@ -360,7 +361,10 @@ function resetInboxApiMocks() {
apiMocks.agentsList.mockResolvedValue([]);
apiMocks.heartbeatRunsList.mockResolvedValue([]);
apiMocks.liveRunsForCompany.mockResolvedValue([]);
- apiMocks.experimentalSettings.mockResolvedValue({ enableIsolatedWorkspaces: false });
+ apiMocks.experimentalSettings.mockResolvedValue({
+ enableIsolatedWorkspaces: false,
+ enableStreamlinedUi: true,
+ });
apiMocks.projectsList.mockResolvedValue([]);
}
@@ -368,6 +372,7 @@ describe("Inbox toolbar", () => {
let container: HTMLDivElement;
beforeEach(() => {
+ localStorage.clear();
resetInboxApiMocks();
container = document.createElement("div");
document.body.appendChild(container);
@@ -380,6 +385,52 @@ describe("Inbox toolbar", () => {
container.remove();
});
+ it("restores the legacy toolbar and issue-row presentation when Streamlined UI is off", async () => {
+ routerMock.location.pathname = "/inbox/mine";
+ apiMocks.experimentalSettings.mockResolvedValue({
+ enableIsolatedWorkspaces: false,
+ enableStreamlinedUi: false,
+ });
+ apiMocks.issuesList.mockResolvedValue([
+ createIssue({ id: "legacy-row", identifier: "PAP-1904", title: "Legacy inbox task" }),
+ ]);
+ localStorage.setItem(
+ taskCollectionPreferencesStorageKey({ companyId: "company-1", collectionKey: "inbox" }),
+ JSON.stringify({
+ version: 1,
+ companyId: "company-1",
+ collectionKey: "inbox",
+ viewState: {},
+ columns: [],
+ }),
+ );
+
+ const queryClient = new QueryClient({
+ defaultOptions: { queries: { retry: false, staleTime: 0, gcTime: 0 } },
+ });
+ const root = createRoot(container);
+
+ await act(async () => {
+ root.render(
+ <QueryClientProvider client={queryClient}>
+ <Inbox />
+ </QueryClientProvider>,
+ );
+ });
+ await vi.waitFor(() => expect(container.textContent).toContain("Legacy inbox task"));
+
+ expect(container.querySelector('[data-slot="collection-toolbar"]')).toBeNull();
+ expect(container.querySelector('[role="toolbar"][aria-label="Inbox controls"]')).toBeNull();
+ expect(container.textContent).toContain("Mine");
+ expect(container.querySelector('[data-slot="task-row"]')).toBeNull();
+ const issueLink = container.querySelector('[data-inbox-issue-link]');
+ // Production reads the legacy Inbox column key and must ignore the
+ // Streamlined collection envelope above when the experiment is disabled.
+ expect(issueLink?.parentElement?.textContent).toContain("PAP-1904");
+
+ act(() => root.unmount());
+ });
+
it("does not render external-object summaries in inbox rows", async () => {
routerMock.location.pathname = "/inbox/mine";
const issue = createIssue({ title: "Inbox row without external object column" });
@@ -452,6 +503,16 @@ describe("Inbox toolbar", () => {
expect(row?.querySelector("[data-inbox-row-surface]")).not.toBeNull();
}
+ const approvalRow = rowFor("Hire Agent: New teammate");
+ const approvalActions = [...(approvalRow?.querySelectorAll("button") ?? [])]
+ .filter((button) => button.textContent === "Approve" || button.textContent === "Reject");
+ expect(approvalActions.length).toBeGreaterThanOrEqual(2);
+ approvalActions.forEach((button) => {
+ expect(button.className).toContain("h-8");
+ expect(button.className).toContain("min-w-(--sz-64px)");
+ expect(button.className).toContain("justify-center");
+ });
+
act(() => root.unmount());
});
@@ -471,7 +532,13 @@ describe("Inbox toolbar", () => {
parentId: parent.id,
title: "Nested inbox task",
});
- apiMocks.issuesList.mockResolvedValue([parent, child]);
+ const grandchild = createIssue({
+ id: "grandchild-issue",
+ identifier: "PAP-1003",
+ parentId: child.id,
+ title: "Deeply nested inbox task",
+ });
+ apiMocks.issuesList.mockResolvedValue([parent, child, grandchild]);
const mountInbox = async () => {
const queryClient = new QueryClient({
@@ -499,12 +566,23 @@ describe("Inbox toolbar", () => {
let root = await mountInbox();
try {
expect(container.textContent).toContain(child.title);
+ expect(container.textContent).toContain(grandchild.title);
+ const taskRowFor = (title: string) =>
+ Array.from(container.querySelectorAll('[data-slot="task-row"]'))
+ .find((row) => row.textContent?.includes(title));
+ const childTaskRow = taskRowFor(child.title);
+ const grandchildTaskRow = taskRowFor(grandchild.title);
+ expect(childTaskRow?.querySelectorAll('[data-slot="task-row-tree-guide"]')).toHaveLength(1);
+ expect(childTaskRow?.querySelector('button[aria-label="Collapse sub-tasks"]')).not.toBeNull();
+ expect(grandchildTaskRow?.querySelectorAll('[data-slot="task-row-tree-guide"]')).toHaveLength(2);
+ expect(grandchildTaskRow?.querySelector('[data-slot="task-row-disclosure-spacer"]')).not.toBeNull();
await act(async () => {
parentToggle()?.dispatchEvent(new MouseEvent("click", { bubbles: true }));
});
await vi.waitFor(() => {
expect(container.textContent).not.toContain(child.title);
+ expect(container.textContent).not.toContain(grandchild.title);
});
expect(JSON.parse(localStorage.getItem(storageKey) ?? "[]")).toEqual([parent.id]);
@@ -517,12 +595,14 @@ describe("Inbox toolbar", () => {
});
await vi.waitFor(() => {
expect(container.textContent).toContain(child.title);
+ expect(container.textContent).toContain(grandchild.title);
});
expect(JSON.parse(localStorage.getItem(storageKey) ?? "[]")).toEqual([]);
act(() => root.unmount());
root = await mountInbox();
expect(container.textContent).toContain(child.title);
+ expect(container.textContent).toContain(grandchild.title);
} finally {
localStorage.removeItem(storageKey);
act(() => root.unmount());
@@ -558,6 +638,191 @@ describe("Inbox toolbar", () => {
});
});
+ it("keeps Mine, Recent, Unread, Blocked, and All in the shared toolbar geometry", async () => {
+ for (const tab of ["mine", "recent", "unread", "blocked", "all"] as const) {
+ routerMock.location.pathname = `/inbox/${tab}`;
+ const queryClient = new QueryClient({
+ defaultOptions: { queries: { retry: false, staleTime: 0, gcTime: 0 } },
+ });
+ const root = createRoot(container);
+
+ await act(async () => {
+ root.render(
+ <QueryClientProvider client={queryClient}>
+ <Inbox />
+ </QueryClientProvider>,
+ );
+ });
+
+ const toolbar = container.querySelector('[data-slot="collection-toolbar"]');
+ expect(toolbar?.getAttribute("aria-label")).toBe("Inbox controls");
+ expect(toolbar?.querySelector('[data-slot="collection-toolbar-context"]')).not.toBeNull();
+ expect(toolbar?.querySelector('[data-slot="collection-toolbar-search"] input[placeholder="Search inbox…"]')).not.toBeNull();
+ expect(toolbar?.querySelector('[data-slot="collection-toolbar-controls"]')).not.toBeNull();
+ expect(container.querySelectorAll('input[placeholder="Search inbox…"]')).toHaveLength(1);
+
+ act(() => root.unmount());
+ container.replaceChildren();
+ }
+ });
+
+ it("explains that live-run filtering is different from active task statuses", async () => {
+ routerMock.location.pathname = "/inbox/mine";
+ localStorage.setItem("paperclip:inbox:filters:company-1", JSON.stringify({
+ allCategoryFilter: "everything",
+ allApprovalFilter: "all",
+ issueFilters: { liveOnly: true },
+ }));
+ const queryClient = new QueryClient({
+ defaultOptions: { queries: { retry: false, staleTime: 0, gcTime: 0 } },
+ });
+ const root = createRoot(container);
+
+ await act(async () => {
+ root.render(
+ <QueryClientProvider client={queryClient}>
+ <Inbox />
+ </QueryClientProvider>,
+ );
+ });
+
+ expect(container.querySelector('[data-testid="inbox-filter-scope-feedback"]')?.textContent)
+ .toBe("Live runs only — tasks currently connected to an agent run.");
+ const migrated = JSON.parse(
+ localStorage.getItem("paperclip:task-collection:v1:company-1:inbox") ?? "null",
+ ) as { companyId?: string; collectionKey?: string } | null;
+ expect(migrated).toMatchObject({ companyId: "company-1", collectionKey: "inbox" });
+
+ act(() => root.unmount());
+ });
+
+ it("groups ungrouped attention items by Today, Yesterday, and Earlier", async () => {
+ routerMock.location.pathname = "/inbox/mine";
+ const now = new Date();
+ const localNoon = (daysAgo: number) =>
+ new Date(now.getFullYear(), now.getMonth(), now.getDate() - daysAgo, 12, 0, 0);
+ apiMocks.issuesList.mockResolvedValue([
+ createIssue({ id: "today", title: "Today task", lastActivityAt: localNoon(0) }),
+ createIssue({ id: "yesterday", title: "Yesterday task", lastActivityAt: localNoon(1) }),
+ createIssue({ id: "earlier", title: "Earlier task", lastActivityAt: localNoon(3) }),
+ ]);
+ const queryClient = new QueryClient({
+ defaultOptions: { queries: { retry: false, staleTime: 0, gcTime: 0 } },
+ });
+ const root = createRoot(container);
+
+ await act(async () => {
+ root.render(
+ <QueryClientProvider client={queryClient}>
+ <Inbox />
+ </QueryClientProvider>,
+ );
+ });
+ await vi.waitFor(() => expect(container.textContent).toContain("Earlier task"));
+
+ const separators = [...container.querySelectorAll('[data-testid="inbox-date-group"]')];
+ expect(separators.map((node) => node.textContent?.trim()))
+ .toEqual(["Today", "Yesterday", "Earlier"]);
+ expect(separators.every((separator) => (
+ separator.querySelectorAll("[data-date-group-rule]").length === 2
+ ))).toBe(true);
+ expect(separators.every((separator) => (
+ separator.querySelector("[data-date-group-label]")?.classList.contains("text-muted-foreground/70")
+ ))).toBe(true);
+
+ act(() => root.unmount());
+ });
+
+ it("honors the saved Columns option for hiding date group separators", async () => {
+ routerMock.location.pathname = "/inbox/mine";
+ localStorage.setItem(
+ taskCollectionPreferencesStorageKey({
+ companyId: "company-1",
+ collectionKey: "inbox",
+ }),
+ JSON.stringify({
+ version: 1,
+ companyId: "company-1",
+ collectionKey: "inbox",
+ viewState: { showDateGroupSeparators: false },
+ columns: ["status", "id", "updated"],
+ }),
+ );
+ const now = new Date();
+ const localNoon = (daysAgo: number) =>
+ new Date(now.getFullYear(), now.getMonth(), now.getDate() - daysAgo, 12, 0, 0);
+ apiMocks.issuesList.mockResolvedValue([
+ createIssue({ id: "today", title: "Today task", lastActivityAt: localNoon(0) }),
+ createIssue({ id: "earlier", title: "Earlier task", lastActivityAt: localNoon(3) }),
+ ]);
+ const queryClient = new QueryClient({
+ defaultOptions: { queries: { retry: false, staleTime: 0, gcTime: 0 } },
+ });
+ const root = createRoot(container);
+
+ await act(async () => {
+ root.render(
+ <QueryClientProvider client={queryClient}>
+ <Inbox />
+ </QueryClientProvider>,
+ );
+ });
+ await vi.waitFor(() => expect(container.textContent).toContain("Earlier task"));
+
+ expect(container.querySelector('[data-testid="inbox-date-group"]')).toBeNull();
+
+ act(() => root.unmount());
+ });
+
+ it("shows the resolved isolated workspace name in canonical task metadata", async () => {
+ routerMock.location.pathname = "/inbox/mine";
+ localStorage.setItem("paperclip:inbox:issue-columns", JSON.stringify(["status", "id", "workspace", "updated"]));
+ apiMocks.experimentalSettings.mockResolvedValue({ enableIsolatedWorkspaces: true });
+ apiMocks.executionWorkspaceSummaries.mockResolvedValue([{
+ id: "execution-workspace-1",
+ name: "Workspace Aurora",
+ mode: "isolated_workspace",
+ projectWorkspaceId: "project-workspace-1",
+ }]);
+ apiMocks.projectsList.mockResolvedValue([{
+ id: "project-1",
+ name: "Launch",
+ color: null,
+ workspaces: [{ id: "project-workspace-1", name: "Main" }],
+ executionWorkspacePolicy: { defaultProjectWorkspaceId: "project-workspace-1" },
+ primaryWorkspace: null,
+ }]);
+ apiMocks.issuesList.mockResolvedValue([createIssue({
+ projectId: "project-1",
+ executionWorkspaceId: "execution-workspace-1",
+ title: "Workspace-aware task",
+ })]);
+ const queryClient = new QueryClient({
+ defaultOptions: { queries: { retry: false, staleTime: 0, gcTime: 0 } },
+ });
+ const root = createRoot(container);
+
+ await act(async () => {
+ root.render(
+ <QueryClientProvider client={queryClient}>
+ <Inbox />
+ </QueryClientProvider>,
+ );
+ });
+ await vi.waitFor(() => expect(container.textContent).toContain("Workspace-aware task"));
+
+ const taskRow = container.querySelector('[data-slot="task-row"]');
+ const identifier = taskRow?.querySelector('[data-slot="task-row-identifier"]');
+ const timestamp = taskRow?.querySelector('[data-slot="task-row-timestamp"]');
+ expect(taskRow?.textContent).toContain("Workspace Aurora");
+ expect(identifier?.textContent).toBe("PAP-904");
+ expect(timestamp).not.toBeNull();
+ if (!identifier || !timestamp) throw new Error("Expected canonical identifier and timestamp columns");
+ expect(identifier.compareDocumentPosition(timestamp) & Node.DOCUMENT_POSITION_FOLLOWING).not.toBe(0);
+
+ act(() => root.unmount());
+ });
+
it("hides workspace grouping when isolated workspaces are disabled", async () => {
routerMock.location.pathname = "/inbox/mine";
apiMocks.experimentalSettings.mockResolvedValue({ enableIsolatedWorkspaces: false });
@@ -678,7 +943,7 @@ describe("Inbox toolbar", () => {
});
});
- it("does not indent unread rows: the mark-read dot sits in a reserved leading slot present on every row", async () => {
+ it("does not indent unread rows: the mark-read dot overlays the shared task-row gutter", async () => {
routerMock.location.pathname = "/inbox/mine";
// Two sibling leaf rows, one unread and one read, so their leading columns
// are directly comparable.
@@ -716,29 +981,25 @@ describe("Inbox toolbar", () => {
const rows = Array.from(container.querySelectorAll("[data-inbox-item]"));
const rowFor = (text: string) => rows.find((row) => row.textContent?.includes(text));
const markReadButton = (row: Element) => row.querySelector('button[aria-label="Mark as read"]');
- // The empty spacer that reserves the chevron column on every leaf row.
- // Excludes the tree-guide span (`.self-stretch`), which only renders on
- // nested rows.
+ // The canonical spacer reserves the disclosure column on every leaf row.
const hasLeadingSpacer = (row: Element) =>
- !!row.querySelector("span.hidden.w-4.shrink-0.sm\\:block:not(.self-stretch)");
- // The reserved leading dot slot, present on read AND unread rows.
+ !!row.querySelector('[data-slot="task-row-disclosure-spacer"]');
+ // The overlay anchor is present on read AND unread Inbox rows without
+ // consuming a layout column.
const dotSlot = (row: Element) =>
row.querySelector('[data-testid="issue-row-unread-slot"]');
const unreadRow = rowFor("Unread inbox row")!;
const readRow = rowFor("Read inbox row")!;
- // The dot lives in a fixed leading slot that is reserved on every inbox row
- // (in flow, NOT an absolute overlay). Because read and unread rows both
- // reserve it — and both keep the chevron spacer — their status icon + title
- // land at the same x (the bug this fix addresses: an unread-only dot column
- // used to push unread rows right).
+ // Both rows share the canonical task-row geometry. The dot is absolutely
+ // positioned in the row gutter, so Inbox does not gain a column that Tasks
+ // lacks and unread state cannot shift status/title alignment.
const unreadSlot = dotSlot(unreadRow);
const readSlot = dotSlot(readRow);
expect(unreadSlot).not.toBeNull();
expect(readSlot).not.toBeNull();
- // In flow, not an absolute overlay.
- expect(unreadSlot?.className).not.toContain("absolute");
+ expect(unreadSlot?.className).toContain("absolute");
// Only the unread row carries the dot button; the read slot is empty.
expect(markReadButton(unreadSlot!)).not.toBeNull();
expect(readSlot?.querySelector('button[aria-label="Mark as read"]')).toBeNull();
@@ -765,13 +1026,13 @@ describe("Inbox toolbar", () => {
});
const root = createRoot(container);
- // The keyboard-selected row swaps to `hover:bg-transparent` on its root
- // band (the overlay link's parent, where the wash now lives); find its index.
+ // Canonical task rows put the selected wash on the root band (the overlay
+ // link's parent); find the row with the standalone selected utility.
const bandOf = (row: Element): HTMLElement | null =>
row.querySelector<HTMLAnchorElement>("a[data-inbox-issue-link]")?.parentElement ?? null;
const selectedRowIndex = () =>
[...container.querySelectorAll("[data-inbox-item]")].findIndex((row) =>
- bandOf(row)?.className.includes("hover:bg-transparent"),
+ bandOf(row)?.className.split(/\s+/).includes("bg-accent/50"),
);
try {
diff --git a/ui/src/pages/Inbox.tsx b/ui/src/pages/Inbox.tsx
index 60799b7c4c..e2a581cd03 100644
--- a/ui/src/pages/Inbox.tsx
+++ b/ui/src/pages/Inbox.tsx
@@ -30,6 +30,8 @@ import { useIssueExternalObjectSummaries } from "../hooks/useIssueExternalObject
import {
applyIssueFilters,
countActiveIssueFilters,
+ defaultIssueFilterState,
+ normalizeIssueFilterState,
type IssueFilterState,
} from "../lib/issue-filters";
import { collectLiveIssueIds, collectSubtreeLiveCounts } from "../lib/liveIssueIds";
@@ -69,6 +71,7 @@ import {
useLocalInboxArchiveIssueIds,
} from "../lib/inboxArchiveCache";
import { EmptyState } from "../components/EmptyState";
+import { CollectionToolbar, type CollectionToolbarProps } from "../components/CollectionToolbar";
import { IssueGroupHeader } from "../components/IssueGroupHeader";
import { PageSkeleton } from "../components/PageSkeleton";
import {
@@ -76,12 +79,15 @@ import {
InboxIssueTrailingColumns,
IssueColumnPicker,
issueActivityText,
+ issueActivityTimestamp,
issueTrailingColumns,
} from "../components/IssueColumns";
import { IssueFiltersPopover } from "../components/IssueFiltersPopover";
import { InboxArchiveButton, IssueRow } from "../components/IssueRow";
import { BlockedInboxView } from "../components/BlockedInboxView";
import { SwipeToArchive } from "../components/SwipeToArchive";
+import { useStreamlinedUiEnabled } from "../hooks/useStreamlinedUiEnabled";
+import { Inbox as LegacyInbox } from "./LegacyInbox";
import { StatusIcon } from "../components/StatusIcon";
import { cn } from "../lib/utils";
@@ -99,13 +105,6 @@ import {
} from "@/components/ui/dialog";
import { Separator } from "@/components/ui/separator";
import { Tabs } from "@/components/ui/tabs";
-import {
- Select,
- SelectContent,
- SelectItem,
- SelectTrigger,
- SelectValue,
-} from "@/components/ui/select";
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
import {
Inbox as InboxIcon,
@@ -145,8 +144,6 @@ import {
isMineInboxTab,
loadCollapsedInboxGroupKeys,
loadCollapsedInboxParentIds,
- loadInboxFilterPreferences,
- loadInboxIssueColumns,
loadInboxNesting,
loadInboxWorkItemGroupBy,
normalizeInboxIssueColumns,
@@ -154,10 +151,8 @@ import {
shouldResetInboxWorkspaceGrouping,
resolveIssueWorkspaceName,
resolveInboxSelectionIndex,
- saveInboxFilterPreferences,
saveCollapsedInboxGroupKeys,
saveCollapsedInboxParentIds,
- saveInboxIssueColumns,
saveInboxNesting,
saveInboxWorkItemGroupBy,
type InboxWorkspaceGroupingOptions,
@@ -173,6 +168,8 @@ import {
type InboxTab,
type InboxWorkItem,
type InboxWorkItemGroupBy,
+ INBOX_FILTER_PREFERENCES_KEY_PREFIX,
+ INBOX_ISSUE_COLUMNS_KEY,
} from "../lib/inbox";
import { useDismissedInboxAlerts, useInboxDismissals, useReadInboxItems } from "../hooks/useInboxBadge";
import { useInboxSortAttention } from "../hooks/useInboxSortAttention";
@@ -181,10 +178,78 @@ import {
reconcileInboxOrderPin,
type InboxOrderPin,
} from "../lib/inboxOrderPin";
+import {
+ loadTaskCollectionPreferences,
+ saveTaskCollectionPreferences,
+ type TaskCollectionPreferenceLocation,
+} from "../lib/task-collection-preferences";
+import {
+ taskDateGroup,
+ taskDateGroupSeparator,
+ type TaskDateGroup,
+} from "../lib/task-date-groups";
const INBOX_HEARTBEAT_RUN_LIMIT = 200;
const INBOX_ISSUE_LIST_LIMIT = 500;
const INBOX_HOT_PATH_STALE_MS = 30_000;
+const INBOX_COLLECTION_KEY = "inbox";
+
+type StreamlinedInboxViewState = InboxFilterPreferences & {
+ showDateGroupSeparators: boolean;
+};
+
+const DEFAULT_INBOX_FILTER_PREFERENCES: StreamlinedInboxViewState = {
+ allCategoryFilter: "everything",
+ allApprovalFilter: "all",
+ issueFilters: { ...defaultIssueFilterState },
+ showDateGroupSeparators: true,
+};
+
+function normalizeInboxCollectionViewState(value: unknown): StreamlinedInboxViewState {
+ const candidate = value && typeof value === "object"
+ ? value as Partial<StreamlinedInboxViewState>
+ : {};
+ const category = candidate.allCategoryFilter;
+ const approval = candidate.allApprovalFilter;
+ return {
+ allCategoryFilter:
+ category === "issues_i_touched"
+ || category === "join_requests"
+ || category === "approvals"
+ || category === "failed_runs"
+ || category === "alerts"
+ ? category
+ : "everything",
+ allApprovalFilter: approval === "actionable" || approval === "resolved" ? approval : "all",
+ issueFilters: normalizeIssueFilterState(candidate.issueFilters),
+ showDateGroupSeparators: candidate.showDateGroupSeparators !== false,
+ };
+}
+
+function inboxCollectionPreferenceLocation(
+ companyId: string | null | undefined,
+): TaskCollectionPreferenceLocation {
+ return {
+ companyId: companyId ?? "__unscoped__",
+ collectionKey: INBOX_COLLECTION_KEY,
+ legacyViewStorageKey: companyId
+ ? `${INBOX_FILTER_PREFERENCES_KEY_PREFIX}:${companyId}`
+ : undefined,
+ legacyColumnsStorageKey: INBOX_ISSUE_COLUMNS_KEY,
+ };
+}
+
+function loadInboxCollectionPreferences(companyId: string | null | undefined) {
+ return loadTaskCollectionPreferences({
+ ...inboxCollectionPreferenceLocation(companyId),
+ defaultViewState: DEFAULT_INBOX_FILTER_PREFERENCES,
+ defaultColumns: DEFAULT_INBOX_ISSUE_COLUMNS,
+ normalizeViewState: normalizeInboxCollectionViewState,
+ normalizeColumns: (value) => Array.isArray(value)
+ ? normalizeInboxIssueColumns(value)
+ : DEFAULT_INBOX_ISSUE_COLUMNS,
+ });
+}
export { InboxIssueMetaLeading, InboxIssueTrailingColumns } from "../components/IssueColumns";
export { IssueGroupHeader as InboxGroupHeader } from "../components/IssueGroupHeader";
@@ -318,7 +383,7 @@ export function FailedRunInboxRow({
return (
<div className={cn(
- "group border-b border-border px-2 py-2.5 last:border-b-0 sm:px-1 sm:pr-3 sm:py-2",
+ "group py-2.5 pl-4 pr-2 sm:py-2",
className,
)}>
<div className="flex items-start gap-2 sm:items-center">
@@ -467,7 +532,7 @@ function ApprovalInboxRow({
return (
<div className={cn(
- "group border-b border-border px-2 py-2.5 last:border-b-0 sm:px-1 sm:pr-3 sm:py-2",
+ "group py-2.5 pl-4 pr-2 sm:py-2",
className,
)}>
<div className="flex items-start gap-2 sm:items-center">
@@ -526,7 +591,7 @@ function ApprovalInboxRow({
<>
<Button
size="sm"
- className="h-8 bg-green-700 px-3 text-white hover:bg-green-600"
+ className="h-8 min-w-(--sz-64px) justify-center bg-green-700 px-3 text-white hover:bg-green-600"
onClick={onApprove}
disabled={isPending}
>
@@ -535,7 +600,7 @@ function ApprovalInboxRow({
<Button
variant="destructive"
size="sm"
- className="h-8 px-3"
+ className="h-8 min-w-(--sz-64px) justify-center px-3"
onClick={onReject}
disabled={isPending}
>
@@ -550,7 +615,7 @@ function ApprovalInboxRow({
<div className="mt-3 flex gap-2 sm:hidden">
<Button
size="sm"
- className="h-8 bg-green-700 px-3 text-white hover:bg-green-600"
+ className="h-8 min-w-(--sz-64px) justify-center bg-green-700 px-3 text-white hover:bg-green-600"
onClick={onApprove}
disabled={isPending}
>
@@ -559,7 +624,7 @@ function ApprovalInboxRow({
<Button
variant="destructive"
size="sm"
- className="h-8 px-3"
+ className="h-8 min-w-(--sz-64px) justify-center px-3"
onClick={onReject}
disabled={isPending}
>
@@ -600,7 +665,7 @@ function JoinRequestInboxRow({
return (
<div className={cn(
- "group border-b border-border px-2 py-2.5 last:border-b-0 sm:px-1 sm:pr-3 sm:py-2",
+ "group py-2.5 pl-4 pr-2 sm:py-2",
className,
)}>
<div className="flex items-start gap-2 sm:items-center">
@@ -689,7 +754,48 @@ function JoinRequestInboxRow({
);
}
+function InboxCollectionToolbar({
+ streamlined,
+ context,
+ search,
+ controls,
+ feedback,
+ ariaLabel,
+}: CollectionToolbarProps & { streamlined: boolean }) {
+ if (streamlined) {
+ return (
+ <CollectionToolbar
+ ariaLabel={ariaLabel}
+ context={context}
+ search={search}
+ controls={controls}
+ feedback={feedback}
+ />
+ );
+ }
+
+ return (
+ <div role="toolbar" aria-label={ariaLabel} className="space-y-2">
+ {search ? <div className="sm:hidden">{search}</div> : null}
+ <div className="flex flex-wrap items-center justify-between gap-2">
+ {context}
+ <div className="flex items-center gap-2">
+ {search ? <div className="hidden sm:block">{search}</div> : null}
+ {controls}
+ </div>
+ </div>
+ {feedback}
+ </div>
+ );
+}
+
export function Inbox() {
+ const { enabled: streamlinedUiEnabled } = useStreamlinedUiEnabled();
+ return streamlinedUiEnabled ? <StreamlinedInbox /> : <LegacyInbox />;
+}
+
+function StreamlinedInbox() {
+ const streamlinedUiEnabled = true;
const { selectedCompanyId } = useCompany();
const { setBreadcrumbs } = useBreadcrumbs();
const { openNewIssue } = useDialogActions();
@@ -707,13 +813,15 @@ export function Inbox() {
const experimentalSettingsLoaded = experimentalSettings !== undefined;
const [searchQuery, setSearchQuery] = useState("");
const normalizedSearchQuery = searchQuery.trim();
- const [filterPreferences, setFilterPreferences] = useState<InboxFilterPreferences>(
- () => loadInboxFilterPreferences(selectedCompanyId),
+ const [filterPreferences, setFilterPreferences] = useState<StreamlinedInboxViewState>(
+ () => loadInboxCollectionPreferences(selectedCompanyId).viewState,
);
const [groupBy, setGroupBy] = useState<InboxWorkItemGroupBy>(() => loadInboxWorkItemGroupBy());
const [blockedGroupBy, setBlockedGroupBy] = useState<BlockedInboxGroupBy>("none");
const [blockedSortBy, setBlockedSortBy] = useState<BlockedInboxSort>("most_recent");
- const [visibleIssueColumns, setVisibleIssueColumns] = useState<InboxIssueColumn[]>(loadInboxIssueColumns);
+ const [visibleIssueColumns, setVisibleIssueColumns] = useState<InboxIssueColumn[]>(
+ () => loadInboxCollectionPreferences(selectedCompanyId).columns,
+ );
const { dismissed: dismissedAlerts, dismiss: dismissAlert } = useDismissedInboxAlerts();
const { dismissedAtByKey, dismiss: dismissInboxItem } = useInboxDismissals(selectedCompanyId);
const { readItems, markRead: markItemRead, markUnread: markItemUnread } = useReadInboxItems();
@@ -784,7 +892,9 @@ export function Inbox() {
useEffect(() => {
if (previousSelectedCompanyIdRef.current !== selectedCompanyId) {
previousSelectedCompanyIdRef.current = selectedCompanyId;
- setFilterPreferences(loadInboxFilterPreferences(selectedCompanyId));
+ const preferences = loadInboxCollectionPreferences(selectedCompanyId);
+ setFilterPreferences(preferences.viewState);
+ setVisibleIssueColumns(preferences.columns);
setCollapsedGroupKeys(loadCollapsedInboxGroupKeys(selectedCompanyId));
setCollapsedInboxParents(loadCollapsedInboxParentIds(selectedCompanyId));
}
@@ -1183,6 +1293,11 @@ export function Inbox() {
() => issueTrailingColumns.filter((column) => visibleIssueColumnSet.has(column) && availableIssueColumnSet.has(column)),
[availableIssueColumnSet, visibleIssueColumnSet],
);
+ const visibleTaskDataColumns = useMemo(
+ () => visibleTrailingIssueColumns.filter((column) => column !== "updated"),
+ [visibleTrailingIssueColumns],
+ );
+ const showTaskTimestamp = visibleIssueColumnSet.has("updated") && availableIssueColumnSet.has("updated");
const failedRuns = useMemo(
() =>
@@ -1568,8 +1683,11 @@ export function Inbox() {
const setIssueColumns = useCallback((next: InboxIssueColumn[]) => {
const normalized = normalizeInboxIssueColumns(next);
setVisibleIssueColumns(normalized);
- saveInboxIssueColumns(normalized);
- }, []);
+ saveTaskCollectionPreferences(inboxCollectionPreferenceLocation(selectedCompanyId), {
+ viewState: filterPreferences,
+ columns: normalized,
+ });
+ }, [filterPreferences, selectedCompanyId]);
const toggleIssueColumn = useCallback((column: InboxIssueColumn, enabled: boolean) => {
if (enabled) {
setIssueColumns([...visibleIssueColumns, column]);
@@ -1578,14 +1696,17 @@ export function Inbox() {
setIssueColumns(visibleIssueColumns.filter((value) => value !== column));
}, [setIssueColumns, visibleIssueColumns]);
const updateFilterPreferences = useCallback(
- (updater: (previous: InboxFilterPreferences) => InboxFilterPreferences) => {
+ (updater: (previous: StreamlinedInboxViewState) => StreamlinedInboxViewState) => {
setFilterPreferences((previous) => {
const next = updater(previous);
- saveInboxFilterPreferences(selectedCompanyId, next);
+ saveTaskCollectionPreferences(inboxCollectionPreferenceLocation(selectedCompanyId), {
+ viewState: next,
+ columns: visibleIssueColumns,
+ });
return next;
});
},
- [selectedCompanyId],
+ [selectedCompanyId, visibleIssueColumns],
);
const updateIssueFilters = useCallback((patch: Partial<IssueFilterState>) => {
updateFilterPreferences((previous) => ({
@@ -2259,60 +2380,42 @@ export function Inbox() {
.map((issue) => issue.id);
const canMarkAllRead = unreadIssueIds.length > 0;
const activeIssueFilterCount = countActiveIssueFilters(issueFilters, true);
+ const activeInboxScopeFilterCount = tab === "all"
+ ? Number(allCategoryFilter !== "everything")
+ + Number(showApprovalsCategory && allApprovalFilter !== "all")
+ : 0;
+ const activeFilterCount = activeIssueFilterCount + activeInboxScopeFilterCount;
const showGeneralIssueToolbarControls = tab !== "blocked";
+ const activeStatusFilterApplied =
+ issueFilters.statuses.length === 4
+ && ["todo", "in_progress", "in_review", "blocked"].every((status) =>
+ issueFilters.statuses.includes(status as IssueFilterState["statuses"][number]),
+ );
+ const issueFilterFeedback = issueFilters.liveOnly
+ ? "Live runs only — tasks currently connected to an agent run."
+ : activeStatusFilterApplied
+ ? "Active statuses — open tasks, whether or not an agent is running."
+ : null;
return (
<div className="space-y-6">
- <div className="space-y-2">
- {/* Search — full-width row on mobile, inline on desktop */}
- <div className="relative sm:hidden">
- <Search className="pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" />
- <Input
- type="search"
- placeholder="Search inbox…"
- value={searchQuery}
- onChange={(e) => setSearchQuery(e.target.value)}
- onKeyDown={(e) => {
- if (shouldBlurPageSearchOnEnter({
- key: e.key,
- isComposing: e.nativeEvent.isComposing,
- })) {
- e.currentTarget.blur();
- return;
- }
-
- if (shouldBlurPageSearchOnEscape({
- key: e.key,
- isComposing: e.nativeEvent.isComposing,
- currentValue: e.currentTarget.value,
- })) {
- e.currentTarget.blur();
- }
- }}
- className="h-8 w-full pl-8 text-xs"
- data-page-search-target="true"
- />
- </div>
- <div className="flex flex-wrap items-center justify-between gap-2">
- <Tabs value={tab} onValueChange={(value) => navigate(`/inbox/${value}`)}>
- <PageTabBar
- items={[
- {
- value: "mine",
- label: "Mine",
- },
- {
- value: "recent",
- label: "Recent",
- },
- { value: "unread", label: "Unread" },
- { value: "blocked", label: "Blocked" },
- { value: "all", label: "All" },
- ]}
- />
- </Tabs>
-
- <div className="flex items-center gap-2">
- <div className="relative hidden sm:block">
+ <InboxCollectionToolbar
+ streamlined={streamlinedUiEnabled}
+ ariaLabel="Inbox controls"
+ context={(
+ <Tabs value={tab} onValueChange={(value) => navigate(`/inbox/${value}`)}>
+ <PageTabBar
+ items={[
+ { value: "mine", label: "Mine" },
+ { value: "recent", label: "Recent" },
+ { value: "unread", label: "Unread" },
+ { value: "blocked", label: "Blocked" },
+ { value: "all", label: "All" },
+ ]}
+ />
+ </Tabs>
+ )}
+ search={(
+ <div className="relative ml-auto w-full sm:w-(--sz-220px)">
<Search className="pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" />
<Input
type="search"
@@ -2336,10 +2439,13 @@ export function Inbox() {
e.currentTarget.blur();
}
}}
- className="h-8 w-(--sz-220px) pl-8 text-xs"
+ className="h-8 w-full pl-8 text-xs"
data-page-search-target="true"
/>
</div>
+ )}
+ controls={(
+ <>
{tab === "blocked" ? (
<>
<IssueFiltersPopover
@@ -2356,6 +2462,7 @@ export function Inbox() {
buttonVariant="outline"
iconOnly
workspaces={isolatedWorkspacesEnabled ? executionWorkspaces.filter((w) => w.mode === "isolated_workspace").map((w) => ({ id: w.id, name: w.name })) : undefined}
+ presentation={streamlinedUiEnabled ? "streamlined" : "legacy"}
/>
<Popover>
<PopoverTrigger asChild>
@@ -2392,6 +2499,13 @@ export function Inbox() {
availableColumns={availableIssueColumns}
visibleColumnSet={visibleIssueColumnSet}
onToggleColumn={toggleIssueColumn}
+ showDateGroupSeparators={filterPreferences.showDateGroupSeparators}
+ onToggleDateGroupSeparators={(enabled) => {
+ updateFilterPreferences((previous) => ({
+ ...previous,
+ showDateGroupSeparators: enabled,
+ }));
+ }}
onResetColumns={() => setIssueColumns(DEFAULT_INBOX_ISSUE_COLUMNS)}
title="Choose which inbox columns stay visible"
iconOnly
@@ -2443,7 +2557,7 @@ export function Inbox() {
<IssueFiltersPopover
state={issueFilters}
onChange={updateIssueFilters}
- activeFilterCount={activeIssueFilterCount}
+ activeFilterCount={activeFilterCount}
agents={agents}
creators={creatorOptions}
projects={projects?.map((project) => ({ id: project.id, name: project.name }))}
@@ -2454,6 +2568,21 @@ export function Inbox() {
buttonVariant="outline"
iconOnly
workspaces={isolatedWorkspacesEnabled ? executionWorkspaces.filter((w) => w.mode === "isolated_workspace").map((w) => ({ id: w.id, name: w.name })) : undefined}
+ presentation={streamlinedUiEnabled ? "streamlined" : "legacy"}
+ inboxScopeFilters={tab === "all" ? {
+ category: allCategoryFilter,
+ approvalStatus: allApprovalFilter,
+ showApprovalStatus: showApprovalsCategory,
+ onCategoryChange: updateAllCategoryFilter,
+ onApprovalStatusChange: updateAllApprovalFilter,
+ onClear: () => {
+ updateFilterPreferences((previous) => ({
+ ...previous,
+ allCategoryFilter: "everything",
+ allApprovalFilter: "all",
+ }));
+ },
+ } : undefined}
/>
<Popover>
<PopoverTrigger asChild>
@@ -2496,9 +2625,17 @@ export function Inbox() {
availableColumns={availableIssueColumns}
visibleColumnSet={visibleIssueColumnSet}
onToggleColumn={toggleIssueColumn}
+ showDateGroupSeparators={filterPreferences.showDateGroupSeparators}
+ onToggleDateGroupSeparators={(enabled) => {
+ updateFilterPreferences((previous) => ({
+ ...previous,
+ showDateGroupSeparators: enabled,
+ }));
+ }}
onResetColumns={() => setIssueColumns(DEFAULT_INBOX_ISSUE_COLUMNS)}
title="Choose which inbox columns stay visible"
iconOnly
+ rowPresentation={streamlinedUiEnabled ? "task" : "legacy"}
/>
{canMarkAllRead && (
<>
@@ -2539,46 +2676,14 @@ export function Inbox() {
)}
</>
) : null}
- </div>
- </div>
- </div>
-
- {tab === "all" && (
- <div className="flex flex-wrap items-center gap-2">
- <Select
- value={allCategoryFilter}
- onValueChange={(value) => updateAllCategoryFilter(value as InboxCategoryFilter)}
- >
- <SelectTrigger className="h-8 w-(--sz-170px) text-xs">
- <SelectValue placeholder="Category" />
- </SelectTrigger>
- <SelectContent>
- <SelectItem value="everything">All categories</SelectItem>
- <SelectItem value="issues_i_touched">My recent tasks</SelectItem>
- <SelectItem value="join_requests">Join requests</SelectItem>
- <SelectItem value="approvals">Approvals</SelectItem>
- <SelectItem value="failed_runs">Failed runs</SelectItem>
- <SelectItem value="alerts">Alerts</SelectItem>
- </SelectContent>
- </Select>
-
- {showApprovalsCategory && (
- <Select
- value={allApprovalFilter}
- onValueChange={(value) => updateAllApprovalFilter(value as InboxApprovalFilter)}
- >
- <SelectTrigger className="h-8 w-(--sz-170px) text-xs">
- <SelectValue placeholder="Approval status" />
- </SelectTrigger>
- <SelectContent>
- <SelectItem value="all">All approval statuses</SelectItem>
- <SelectItem value="actionable">Needs action</SelectItem>
- <SelectItem value="resolved">Resolved</SelectItem>
- </SelectContent>
- </Select>
- )}
- </div>
- )}
+ </>
+ )}
+ feedback={issueFilterFeedback ? (
+ <p className="text-xs text-muted-foreground" data-testid="inbox-filter-scope-feedback">
+ {issueFilterFeedback}
+ </p>
+ ) : null}
+ />
{approvalsError && <p className="text-sm text-destructive">{approvalsError.message}</p>}
{actionError && <p className="text-sm text-destructive">{actionError}</p>}
@@ -2600,6 +2705,7 @@ export function Inbox() {
showStatusColumn={visibleIssueColumnSet.has("status") && availableIssueColumnSet.has("status")}
showIdentifierColumn={visibleIssueColumnSet.has("id") && availableIssueColumnSet.has("id")}
showUpdatedColumn={visibleIssueColumnSet.has("updated") && availableIssueColumnSet.has("updated")}
+ presentation={streamlinedUiEnabled ? "task" : "legacy"}
/>
) : null}
@@ -2685,15 +2791,48 @@ export function Inbox() {
<IssueRow
key={`issue:${issue.id}`}
issue={issue}
+ presentation={streamlinedUiEnabled ? "task" : "legacy"}
issueLinkState={issueLinkState}
treeGuides={depth}
+ chevronInGuide={streamlinedUiEnabled && depth > 0 && hasChildren}
selected={selected}
className={
isArchiving
? "pointer-events-none -translate-x-4 scale-(--s-0_98) opacity-0 transition-all duration-200 ease-out"
: "transition-all duration-200 ease-out"
}
- desktopMetaLeading={
+ leadingControl={streamlinedUiEnabled && nestingEnabled && hasChildren && collapseParentId ? (
+ <button
+ type="button"
+ data-slot="icon-button"
+ className="inline-flex h-4 w-4 shrink-0 items-center justify-center"
+ aria-label={isExpanded ? "Collapse sub-tasks" : "Expand sub-tasks"}
+ onClick={(event) => {
+ event.preventDefault();
+ event.stopPropagation();
+ toggleInboxParentCollapse(collapseParentId);
+ }}
+ >
+ <ChevronRight className={cn("h-3.5 w-3.5 transition-transform", isExpanded && "rotate-90")} />
+ </button>
+ ) : streamlinedUiEnabled ? (
+ <span data-slot="task-row-disclosure-spacer" className="h-4 w-4 shrink-0" aria-hidden="true" />
+ ) : undefined}
+ statusSlot={streamlinedUiEnabled ? rowStatusIcon : undefined}
+ metadata={streamlinedUiEnabled ? (
+ <InboxIssueMetaLeading
+ issue={issue}
+ isLive={isLive}
+ subtreeLiveCount={liveDescendantCount}
+ showSubtreeLiveChip={showSubtreeLiveChip}
+ showStatus={false}
+ showIdentifier={false}
+ />
+ ) : undefined}
+ showIdentifier={streamlinedUiEnabled
+ ? visibleIssueColumnSet.has("id") && availableIssueColumnSet.has("id")
+ : undefined}
+ desktopMetaLeading={!streamlinedUiEnabled ? (
<>
{nestingEnabled ? (
depth === 0 && hasChildren && collapseParentId ? (
@@ -2710,11 +2849,6 @@ export function Inbox() {
<ChevronRight className={cn("h-3.5 w-3.5 transition-transform", isExpanded && "rotate-90")} />
</button>
) : (
- // Every non-chevron row reserves this spacer so the
- // status column lines up under the parent rows'
- // collapse chevron. (The unread mark-read dot has
- // its own reserved leading slot in IssueRow, to the
- // left of this spacer.)
<span className="hidden w-4 shrink-0 sm:block" />
)
) : null}
@@ -2728,14 +2862,14 @@ export function Inbox() {
statusSlot={rowStatusIcon}
/>
</>
- }
- titleSuffix={hasChildren && !isExpanded && depth === 0 ? (
+ ) : undefined}
+ titleSuffix={hasChildren && !isExpanded ? (
<span className="ml-1.5 text-xs text-muted-foreground">
({childCount} sub-task{childCount !== 1 ? "s" : ""})
</span>
) : undefined}
mobileMeta={issueActivityText(issue).toLowerCase()}
- mobileLeading={
+ mobileLeading={!streamlinedUiEnabled ? (
depth === 0 && hasChildren && collapseParentId ? (
<button
type="button"
@@ -2751,16 +2885,16 @@ export function Inbox() {
) : (
<StatusIcon status={issue.status} blockerAttention={blockerAttention} size="md" />
)
- }
+ ) : undefined}
unreadState={isUnread ? "visible" : isFading ? "fading" : "hidden"}
onMarkRead={() => markReadMutation.mutate(issue.id)}
onArchive={allowArchive ? () => archiveIssueMutation.mutate(issue.id) : undefined}
archiveDisabled={isArchiving}
desktopTrailing={
- visibleTrailingIssueColumns.length > 0 ? (
+ (streamlinedUiEnabled ? visibleTaskDataColumns : visibleTrailingIssueColumns).length > 0 ? (
<InboxIssueTrailingColumns
issue={issue}
- columns={visibleTrailingIssueColumns}
+ columns={streamlinedUiEnabled ? visibleTaskDataColumns : visibleTrailingIssueColumns}
projectName={project?.name ?? null}
projectColor={project?.color ?? null}
workspaceName={resolveIssueWorkspaceName(issue, {
@@ -2785,11 +2919,14 @@ export function Inbox() {
/>
) : undefined
}
+ trailingMeta={streamlinedUiEnabled && showTaskTimestamp ? issueActivityTimestamp(issue) : null}
/>
);
};
+ let previousDateGroup: TaskDateGroup | null = null;
let previousTimestamp = Number.POSITIVE_INFINITY;
+ const legacyTodayCutoff = Date.now() - 24 * 60 * 60 * 1000;
return groupedSections.flatMap((group, groupIndex) => {
const elements: ReactNode[] = [];
const isGroupCollapsed = collapsedGroupKeys.has(group.key);
@@ -2872,18 +3009,46 @@ export function Inbox() {
{child}
</div>
);
- const todayCutoff = Date.now() - 24 * 60 * 60 * 1000;
- const showTodayDivider =
- groupBy === "none" &&
- item.timestamp > 0 &&
- item.timestamp < todayCutoff &&
- previousTimestamp >= todayCutoff;
+ const currentDateGroup = taskDateGroup(item.timestamp);
+ const dateGroupLabel = streamlinedUiEnabled
+ && filterPreferences.showDateGroupSeparators
+ && groupBy === "none"
+ ? taskDateGroupSeparator(previousDateGroup, currentDateGroup)
+ : null;
+ previousDateGroup = currentDateGroup;
+ const showLegacyEarlierDivider = !streamlinedUiEnabled
+ && groupBy === "none"
+ && item.timestamp > 0
+ && item.timestamp < legacyTodayCutoff
+ && previousTimestamp >= legacyTodayCutoff;
previousTimestamp = item.timestamp > 0 ? item.timestamp : previousTimestamp;
- if (showTodayDivider) {
+ if (dateGroupLabel) {
elements.push(
- <div key={`today-divider-${group.key}-${index}`} className="my-2 flex items-center gap-3 px-4">
- <div className="flex-1 border-t border-zinc-600" />
- <span className="shrink-0 text-(length:--text-micro) font-medium uppercase tracking-wider text-zinc-500">
+ <div
+ key={`date-divider-${group.key}-${currentDateGroup}-${index}`}
+ className="flex items-center gap-3 px-3 py-1.5 sm:pl-0 sm:pr-4"
+ data-testid="inbox-date-group"
+ role="separator"
+ aria-label={dateGroupLabel}
+ >
+ <span className="h-px min-w-0 flex-1 bg-border/80" aria-hidden="true" data-date-group-rule="" />
+ <span
+ className="shrink-0 text-(length:--text-nano) font-medium uppercase tracking-wider text-muted-foreground/70"
+ data-date-group-label=""
+ >
+ {dateGroupLabel}
+ </span>
+ <span className="h-px min-w-0 flex-1 bg-border/80" aria-hidden="true" data-date-group-rule="" />
+ </div>,
+ );
+ } else if (showLegacyEarlierDivider) {
+ elements.push(
+ <div key={`earlier-divider-${group.key}-${index}`} className="my-2 flex items-center gap-3 px-4">
+ <div className="flex-1 border-t border-border" />
+ <span
+ className="shrink-0 text-(length:--text-micro) font-medium uppercase tracking-wider text-muted-foreground/70"
+ data-date-group-label=""
+ >
Earlier
</span>
</div>,
diff --git a/ui/src/pages/IssueDetail.test.tsx b/ui/src/pages/IssueDetail.test.tsx
index 4696b47c0e..479cae38b7 100644
--- a/ui/src/pages/IssueDetail.test.tsx
+++ b/ui/src/pages/IssueDetail.test.tsx
@@ -31,7 +31,11 @@ import {
shouldScrollIssueDetailToTopOnNavigation,
} from "./IssueDetail";
import { queryKeys } from "../lib/queryKeys";
-import { createIssueDetailLocationState } from "../lib/issueDetailBreadcrumb";
+import {
+ armIssueDetailInboxQuickArchive,
+ createIssueDetailLocationState,
+} from "../lib/issueDetailBreadcrumb";
+import { getRecentTasksStorageKey, readRecentTasks } from "../lib/recent-tasks";
import { ApiError } from "../api/client";
const mockIssuesApi = vi.hoisted(() => ({
@@ -120,6 +124,7 @@ const mockIssuePropertiesRender = vi.hoisted(() => vi.fn());
const mockTaskSidePanelRender = vi.hoisted(() => vi.fn());
const mockSetBreadcrumbs = vi.hoisted(() => vi.fn());
const mockSetBreadcrumbToolbar = vi.hoisted(() => vi.fn());
+const mockSetBreadcrumbPanelControl = vi.hoisted(() => vi.fn());
const mockSetMobileToolbar = vi.hoisted(() => vi.fn());
const mockPushToast = vi.hoisted(() => vi.fn());
const mockIssuesListRender = vi.hoisted(() => vi.fn());
@@ -272,6 +277,7 @@ vi.mock("../context/BreadcrumbContext", () => ({
useBreadcrumbs: () => ({
setBreadcrumbs: mockSetBreadcrumbs,
setBreadcrumbToolbar: mockSetBreadcrumbToolbar,
+ setBreadcrumbPanelControl: mockSetBreadcrumbPanelControl,
setMobileToolbar: mockSetMobileToolbar,
}),
}));
@@ -1250,6 +1256,8 @@ describe("IssueDetail", () => {
let consoleErrorSpy: ReturnType<typeof vi.spyOn>;
beforeEach(() => {
+ localStorage.clear();
+ sessionStorage.clear();
mockPanelState.panelVisible = true;
mockSidebarState.isMobile = false;
container = document.createElement("div");
@@ -1332,12 +1340,15 @@ describe("IssueDetail", () => {
enableIssuePlanDecompositions: false,
enableExperimentalFileViewer: false,
enableExternalObjects: false,
+ enableStreamlinedUi: true,
});
mockIssuesApi.listAcceptedPlanDecompositions.mockResolvedValue([]);
mockIssuesApi.getDocument.mockResolvedValue(null);
mockOpenPanel.mockClear();
mockClosePanel.mockClear();
mockSetPanelVisible.mockClear();
+ mockSetBreadcrumbPanelControl.mockClear();
+ mockSetMobileToolbar.mockClear();
mockIssuePropertiesRender.mockClear();
mockTaskSidePanelRender.mockClear();
mockIssuesListRender.mockClear();
@@ -1362,6 +1373,8 @@ describe("IssueDetail", () => {
queryClient.clear();
container.remove();
document.body.innerHTML = "";
+ localStorage.clear();
+ sessionStorage.clear();
vi.restoreAllMocks();
});
@@ -1383,6 +1396,16 @@ describe("IssueDetail", () => {
expect(container.textContent).toContain("Issue detail smoke");
expect(container.textContent).toContain("Task chat thread");
+ const titleGroup = container.querySelector('[data-slot="task-detail-title"]');
+ const identifier = titleGroup?.querySelector('[data-slot="task-title-identifier"]');
+ const titleRow = titleGroup?.parentElement;
+ const titleActions = container.querySelector('[data-slot="task-title-actions"]');
+ expect(titleGroup?.textContent?.replace(/\s+/g, " ").trim()).toBe("Issue detail smokePAP-1");
+ expect(identifier?.textContent).toBe("PAP-1");
+ expect(titleRow?.className).toContain("pr-8");
+ expect(titleActions?.className).toContain("absolute");
+ expect(titleActions?.className).toContain("top-0");
+ expect(titleActions?.querySelector('button[aria-label="More task actions"]')).not.toBeNull();
expect(
consoleErrorSpy.mock.calls.some((call: unknown[]) =>
String(call[0]).includes(
@@ -1392,7 +1415,94 @@ describe("IssueDetail", () => {
).toBe(false);
});
+ it("keeps hierarchy breadcrumbs and label chips out of the Streamlined task header", async () => {
+ mockIssuesApi.get.mockResolvedValue(
+ createIssue({
+ ancestors: [
+ {
+ id: "parent-1",
+ identifier: "PAP-0",
+ title: "Parent task visible in Properties",
+ },
+ ] as Issue["ancestors"],
+ labels: [
+ {
+ id: "label-1",
+ companyId: "company-1",
+ name: "Quick win",
+ color: "#22c55e",
+ createdAt: new Date("2026-04-21T00:00:00.000Z"),
+ updatedAt: new Date("2026-04-21T00:00:00.000Z"),
+ },
+ ],
+ labelIds: ["label-1"],
+ }),
+ );
+
+ await act(async () => {
+ root.render(
+ <QueryClientProvider client={queryClient}>
+ <IssueDetail />
+ </QueryClientProvider>,
+ );
+ });
+ await flushReact();
+
+ expect(container.textContent).not.toContain("Parent task visible in Properties");
+ expect(container.textContent).not.toContain("Quick win");
+ expect(container.textContent).toContain("Issue detail smoke");
+ });
+
+ it("preserves hierarchy breadcrumbs and label chips when Streamlined UI is off", async () => {
+ mockInstanceSettingsApi.getExperimental.mockResolvedValue({
+ enableIssuePlanDecompositions: false,
+ enableExperimentalFileViewer: false,
+ enableExternalObjects: false,
+ enableStreamlinedUi: false,
+ });
+ mockIssuesApi.get.mockResolvedValue(
+ createIssue({
+ ancestors: [
+ {
+ id: "parent-1",
+ identifier: "PAP-0",
+ title: "Parent task breadcrumb",
+ },
+ ] as Issue["ancestors"],
+ labels: [
+ {
+ id: "label-1",
+ companyId: "company-1",
+ name: "Legacy label",
+ color: "#22c55e",
+ createdAt: new Date("2026-04-21T00:00:00.000Z"),
+ updatedAt: new Date("2026-04-21T00:00:00.000Z"),
+ },
+ ],
+ labelIds: ["label-1"],
+ }),
+ );
+
+ await act(async () => {
+ root.render(
+ <QueryClientProvider client={queryClient}>
+ <IssueDetail />
+ </QueryClientProvider>,
+ );
+ });
+ await flushReact();
+
+ expect(container.textContent).toContain("Parent task breadcrumb");
+ expect(container.textContent).toContain("Legacy label");
+ });
+
it("lifts the redesigned desktop thread into the side-panel header band", async () => {
+ mockInstanceSettingsApi.getExperimental.mockResolvedValue({
+ enableIssuePlanDecompositions: false,
+ enableExperimentalFileViewer: false,
+ enableExternalObjects: false,
+ enableStreamlinedUi: false,
+ });
mockIssuesApi.get.mockResolvedValue(createIssue());
await act(async () => {
@@ -1412,8 +1522,9 @@ describe("IssueDetail", () => {
});
});
- it("registers the persistent breadcrumb side-panel toggle only while the panel is closed", async () => {
+ it("does not register a redundant breadcrumb side-panel toggle in Streamlined UI", async () => {
mockIssuesApi.get.mockResolvedValue(createIssue());
+ mockPanelState.panelVisible = false;
await act(async () => {
root.render(
@@ -1423,13 +1534,19 @@ describe("IssueDetail", () => {
);
});
await flushReact();
- expect(
- container.querySelector('button[aria-label="Toggle side panel"]'),
- ).toBeNull();
- expect(mockSetBreadcrumbToolbar.mock.calls.at(-1)?.[0]).toBeNull();
+ expect(mockSetBreadcrumbToolbar.mock.calls.every(([node]) => node === null)).toBe(true);
+ });
- mockSetBreadcrumbToolbar.mockClear();
+ it("retains the production breadcrumb side-panel toggle when Streamlined UI is off", async () => {
+ mockIssuesApi.get.mockResolvedValue(createIssue());
mockPanelState.panelVisible = false;
+ mockInstanceSettingsApi.getExperimental.mockResolvedValue({
+ enableIssuePlanDecompositions: false,
+ enableExperimentalFileViewer: false,
+ enableExternalObjects: false,
+ enableStreamlinedUi: false,
+ });
+
await act(async () => {
root.render(
<QueryClientProvider client={queryClient}>
@@ -1438,9 +1555,6 @@ describe("IssueDetail", () => {
);
});
await flushReact();
- expect(
- container.querySelector('button[aria-label="Toggle side panel"]'),
- ).toBeNull();
const toolbar = mockSetBreadcrumbToolbar.mock.calls
.map(([node]) => node)
@@ -1452,6 +1566,80 @@ describe("IssueDetail", () => {
expect(mockSetPanelVisible).toHaveBeenCalledWith(true);
});
+ it("uses task activity for recency and ignores passive revisits", async () => {
+ const authRequest = createDeferred<{
+ session: { userId: string };
+ user: { id: string };
+ }>();
+ const issue = createIssue({
+ title: "Initial recent title",
+ status: "todo",
+ updatedAt: new Date(100),
+ });
+ mockAuthApi.getSession.mockReturnValue(authRequest.promise);
+ mockIssuesApi.get.mockResolvedValue(issue);
+
+ await act(async () => {
+ root.render(
+ <QueryClientProvider client={queryClient}>
+ <IssueDetail />
+ </QueryClientProvider>,
+ );
+ });
+ await flushReact();
+ await flushReact();
+
+ expect(
+ readRecentTasks(
+ getRecentTasksStorageKey("company-1", null),
+ "company-1",
+ ),
+ ).toEqual([]);
+
+ await act(async () => {
+ authRequest.resolve({
+ session: { userId: "user-1" },
+ user: { id: "user-1" },
+ });
+ });
+ await waitForAssertion(() => {
+ expect(
+ readRecentTasks(
+ getRecentTasksStorageKey("company-1", "user-1"),
+ "company-1",
+ ),
+ ).toEqual([
+ expect.objectContaining({
+ id: "issue-1",
+ title: "Initial recent title",
+ status: "todo",
+ recordedAt: 100,
+ }),
+ ]);
+ });
+
+ act(() => {
+ queryClient.setQueryData(queryKeys.issues.detail("PAP-1"), {
+ ...issue,
+ title: "Snapshot refresh title",
+ status: "in_progress",
+ updatedAt: new Date(200),
+ });
+ });
+ await flushReact();
+
+ expect(
+ readRecentTasks(
+ getRecentTasksStorageKey("company-1", "user-1"),
+ "company-1",
+ )[0],
+ ).toMatchObject({
+ title: "Snapshot refresh title",
+ status: "in_progress",
+ recordedAt: 200,
+ });
+ });
+
it("opens a closed desktop pane and routes an ordinary document to its own tab on direct load", async () => {
mockPanelState.panelVisible = false;
mockLocation.hash = "#document-qa-evidence";
@@ -1675,7 +1863,7 @@ describe("IssueDetail", () => {
expect(panel?.querySelector('[data-slot="sheet-close"]')).not.toBeNull();
});
- it("renders the full sub-task tree below the title in the chat center pane", async () => {
+ it("moves subtask data into the properties panel instead of the chat center pane", async () => {
mockIssuesApi.get.mockResolvedValue(createIssue());
mockIssuesApi.list.mockResolvedValue([
createIssue({
@@ -1697,24 +1885,13 @@ describe("IssueDetail", () => {
await flushReact();
await flushReact();
- const title = Array.from(container.querySelectorAll("div")).find(
- (element) => element.textContent === "Issue detail smoke",
- );
- const subTasks = Array.from(container.querySelectorAll("div")).find(
- (element) => element.textContent === "Sub-issues",
- );
- expect(title).toBeDefined();
- expect(subTasks).toBeDefined();
- expect(
- title!.compareDocumentPosition(subTasks!) &
- Node.DOCUMENT_POSITION_FOLLOWING,
- ).not.toBe(0);
- expect(mockIssuesListRender).toHaveBeenCalledWith(
- expect.objectContaining({
- createIssueLabel: "Sub-task",
- showProgressSummary: true,
- }),
- );
+ const panel = mockOpenPanel.mock.calls.at(-1)?.[0] as { props?: Record<string, unknown> } | undefined;
+ expect(panel?.props?.childIssues).toEqual([
+ expect.objectContaining({ id: "child-1", identifier: "PAP-2" }),
+ ]);
+ expect(panel?.props?.onAddSubIssue).toEqual(expect.any(Function));
+ expect(container.textContent).not.toContain("Sub-issues");
+ expect(mockIssuesListRender).not.toHaveBeenCalled();
});
it("hides the full sub-task tree when the task has no subtasks", async () => {
@@ -1988,9 +2165,10 @@ describe("IssueDetail", () => {
await flushReact();
await flushReact();
- const archiveButton = container.querySelector<HTMLButtonElement>(
- 'button[aria-label="Archive from inbox"]',
- );
+ const moreButton = container.querySelector<HTMLButtonElement>('button[aria-label="More task actions"]');
+ await act(async () => moreButton!.click());
+ const archiveButton = Array.from(document.body.querySelectorAll<HTMLButtonElement>("button"))
+ .find((button) => button.textContent?.trim() === "Archive from inbox") ?? null;
expect(archiveButton).not.toBeNull();
await act(async () => {
@@ -2112,9 +2290,10 @@ describe("IssueDetail", () => {
await flushReact();
await flushReact();
- const archiveButton = container.querySelector<HTMLButtonElement>(
- 'button[aria-label="Archive from inbox"]',
- );
+ const moreButton = container.querySelector<HTMLButtonElement>('button[aria-label="More task actions"]');
+ await act(async () => moreButton!.click());
+ const archiveButton = Array.from(document.body.querySelectorAll<HTMLButtonElement>("button"))
+ .find((button) => button.textContent?.trim() === "Archive from inbox") ?? null;
expect(archiveButton).not.toBeNull();
await act(async () => {
archiveButton!.dispatchEvent(
@@ -2145,6 +2324,131 @@ describe("IssueDetail", () => {
});
});
+ it("keeps inbox archive actions scoped to an inbox-origin task", async () => {
+ mockLocation.state = createIssueDetailLocationState("Tasks", "/issues/all", "issues");
+ mockIssuesApi.get.mockResolvedValue(createIssue());
+ mockInstanceSettingsApi.getGeneral.mockResolvedValue({
+ keyboardShortcuts: true,
+ feedbackDataSharingPreference: "prompt",
+ });
+
+ await act(async () => {
+ root.render(
+ <QueryClientProvider client={queryClient}>
+ <IssueDetail />
+ </QueryClientProvider>,
+ );
+ });
+ await flushReact();
+ await flushReact();
+
+ const moreButton = container.querySelector<HTMLButtonElement>('button[aria-label="More task actions"]');
+ await act(async () => moreButton!.click());
+ expect(Array.from(document.body.querySelectorAll("button"))
+ .some((button) => button.textContent?.trim() === "Archive from inbox")).toBe(false);
+
+ mockIssuesApi.archiveFromInbox.mockClear();
+ document.dispatchEvent(new KeyboardEvent("keydown", { key: "y", bubbles: true }));
+ expect(mockIssuesApi.archiveFromInbox).not.toHaveBeenCalled();
+ });
+
+ it("arms the inbox archive shortcut only for the selected inbox row", async () => {
+ mockLocation.state = armIssueDetailInboxQuickArchive(
+ createIssueDetailLocationState("Inbox", "/inbox/mine", "inbox"),
+ );
+ mockIssuesApi.get.mockResolvedValue(createIssue());
+ mockInstanceSettingsApi.getGeneral.mockResolvedValue({
+ keyboardShortcuts: true,
+ feedbackDataSharingPreference: "prompt",
+ });
+
+ await act(async () => {
+ root.render(
+ <QueryClientProvider client={queryClient}>
+ <IssueDetail />
+ </QueryClientProvider>,
+ );
+ });
+ await flushReact();
+ await flushReact();
+
+ const panel = mockOpenPanel.mock.calls.at(-1)?.[0] as { props?: Record<string, unknown> } | undefined;
+ expect(panel?.props?.issueLinkState).toEqual(expect.objectContaining({
+ issueDetailSource: "inbox",
+ issueDetailInboxQuickArchiveArmed: false,
+ }));
+
+ document.dispatchEvent(new KeyboardEvent("keydown", { key: "y", bubbles: true }));
+ await waitForAssertion(() => {
+ expect(mockIssuesApi.archiveFromInbox).toHaveBeenCalledWith("issue-1");
+ });
+ });
+
+ it("uses history Back for a live inbox origin and a route fallback for direct links", async () => {
+ mockSidebarState.isMobile = true;
+ mockLocation.state = createIssueDetailLocationState("Inbox", "/inbox/mine", "inbox");
+ mockIssuesApi.get.mockResolvedValue(createIssue());
+
+ await act(async () => {
+ root.render(
+ <QueryClientProvider client={queryClient}>
+ <IssueDetail />
+ </QueryClientProvider>,
+ );
+ });
+ await flushReact();
+ await flushReact();
+
+ const liveToolbar = [...mockSetMobileToolbar.mock.calls]
+ .map(([node]) => node)
+ .filter(Boolean)
+ .at(-1) as ReactNode;
+ const toolbarContainer = document.createElement("div");
+ document.body.appendChild(toolbarContainer);
+ const toolbarRoot = createRoot(toolbarContainer);
+ flushSync(() => toolbarRoot.render(liveToolbar));
+ const historyLengthSpy = vi.spyOn(window.history, "length", "get").mockReturnValue(2);
+ await act(async () => {
+ toolbarContainer.querySelector<HTMLButtonElement>('button[aria-label="Back to inbox"]')!.click();
+ });
+ expect(mockNavigate).toHaveBeenCalledWith(-1);
+ historyLengthSpy.mockRestore();
+
+ flushSync(() => toolbarRoot.unmount());
+ toolbarContainer.remove();
+ mockNavigate.mockClear();
+ mockSetMobileToolbar.mockClear();
+ mockLocation.state = null;
+ mockLocation.search = "?from=inbox&fromHref=%2Finbox%2Fmine";
+
+ await act(async () => {
+ root.render(
+ <QueryClientProvider client={queryClient}>
+ <IssueDetail />
+ </QueryClientProvider>,
+ );
+ });
+ await flushReact();
+ await flushReact();
+ mockNavigate.mockClear();
+
+ const directToolbar = [...mockSetMobileToolbar.mock.calls]
+ .map(([node]) => node)
+ .filter(Boolean)
+ .at(-1) as ReactNode;
+ const directToolbarContainer = document.createElement("div");
+ document.body.appendChild(directToolbarContainer);
+ const directToolbarRoot = createRoot(directToolbarContainer);
+ flushSync(() => directToolbarRoot.render(directToolbar));
+ await act(async () => {
+ directToolbarContainer.querySelector<HTMLButtonElement>('button[aria-label="Back to inbox"]')!.click();
+ });
+ expect(mockNavigate).toHaveBeenCalledWith("/inbox/mine");
+
+ flushSync(() => directToolbarRoot.unmount());
+ directToolbarContainer.remove();
+ });
+
it("shows assignee and originating avatars in the issue header metadata", async () => {
mockIssuesApi.get.mockResolvedValue(
createIssue({
@@ -2882,10 +3186,25 @@ describe("IssueDetail", () => {
expect(optimisticComment).toMatchObject({ clientStatus: "pending" });
expect(optimisticComment?.queueState).toBeUndefined();
+ const postedAt = new Date("2026-04-21T00:00:10.000Z");
await act(async () => {
- postedComment.resolve(createIssueComment({ body: "Fresh comment" }));
+ postedComment.resolve(createIssueComment({
+ body: "Fresh comment",
+ createdAt: postedAt,
+ updatedAt: postedAt,
+ }));
});
await flushReact();
+
+ expect(
+ readRecentTasks(
+ getRecentTasksStorageKey("company-1", null),
+ "company-1",
+ )[0],
+ ).toMatchObject({
+ id: "issue-1",
+ recordedAt: postedAt.getTime(),
+ });
});
it("hides the plan decomposition panel by default", async () => {
@@ -2979,6 +3298,7 @@ describe("IssueDetail", () => {
it("starts a planning-mode task as chat-only until its plan document exists", async () => {
mockSetBreadcrumbToolbar.mockClear();
+ mockSetBreadcrumbPanelControl.mockClear();
mockInstanceSettingsApi.getExperimental.mockResolvedValue({
enableIssuePlanDecompositions: false,
enableExperimentalFileViewer: false,
@@ -3010,7 +3330,12 @@ describe("IssueDetail", () => {
.reverse()
.map(([node]) => node)
.find((node) => node !== null);
- expect(toolbar).toBeDefined();
+ expect(toolbar).toBeUndefined();
+ const panelControl = [...mockSetBreadcrumbPanelControl.mock.calls]
+ .reverse()
+ .map(([control]) => control)
+ .find((control) => control !== null);
+ expect(panelControl).toMatchObject({ open: false });
});
it("reveals the planning-mode task sidebar when its plan document exists", async () => {
@@ -3040,6 +3365,7 @@ describe("IssueDetail", () => {
it("keeps the Show properties button clickable on the first task and reveals the sidebar on demand", async () => {
mockSetBreadcrumbToolbar.mockClear();
+ mockSetBreadcrumbPanelControl.mockClear();
mockInstanceSettingsApi.getExperimental.mockResolvedValue({
enableIssuePlanDecompositions: false,
enableExperimentalFileViewer: false,
@@ -3063,18 +3389,20 @@ describe("IssueDetail", () => {
await flushReact();
expect(mockOpenPanel).not.toHaveBeenCalled();
- // Even though panelVisible is true, the suppressed first task registers
- // the persistent top-row opt-in launcher.
- const toolbar = [...mockSetBreadcrumbToolbar.mock.calls]
+ // Even though panelVisible is true, the suppressed first task routes the
+ // single breadcrumb panel control through its per-task opt-in behavior.
+ const panelControl = [...mockSetBreadcrumbPanelControl.mock.calls]
.reverse()
- .map(([node]) => node)
- .find((node) => node !== null) as ReactElement<{
- children: ReactElement<{ onToggle: () => void }>;
- }>;
- expect(toolbar).toBeDefined();
+ .map(([control]) => control)
+ .find((control) => control !== null) as {
+ open: boolean;
+ onToggle: () => void;
+ };
+ expect(panelControl).toMatchObject({ open: false });
+ expect(mockSetBreadcrumbToolbar.mock.calls.every(([node]) => node === null)).toBe(true);
await act(async () => {
- toolbar.props.children.props.onToggle();
+ panelControl.onToggle();
});
await flushReact();
@@ -3655,9 +3983,13 @@ describe("IssueDetail", () => {
});
await flushReact();
- const copyButton = Array.from(container.querySelectorAll("button")).find(
- (button) => button.getAttribute("title") === "Copy task as markdown",
+ const moreButton = container.querySelector<HTMLButtonElement>(
+ 'button[aria-label="More task actions"]',
);
+ await act(async () => moreButton!.click());
+ const copyButton = Array.from(
+ document.body.querySelectorAll<HTMLButtonElement>("button"),
+ ).find((button) => button.textContent?.trim() === "Copy as markdown");
expect(copyButton).toBeTruthy();
await act(async () => {
@@ -3718,6 +4050,7 @@ describe("IssueDetail", () => {
enableIssuePlanDecompositions: false,
enableExperimentalFileViewer: false,
enableExternalObjects: false,
+ enableStreamlinedUi: true,
enableClassicTaskInterface: true,
});
mockIssuesApi.get.mockResolvedValue(createIssue());
@@ -3778,6 +4111,54 @@ describe("IssueDetail", () => {
).toBe(false);
});
+ it("restores master's task chat thread when Streamlined UI is off", async () => {
+ mockInstanceSettingsApi.getExperimental.mockResolvedValue({
+ enableIssuePlanDecompositions: false,
+ enableExperimentalFileViewer: false,
+ enableExternalObjects: false,
+ enableStreamlinedUi: false,
+ enableClassicTaskInterface: false,
+ });
+ mockIssuesApi.get.mockResolvedValue(createIssue());
+
+ await act(async () => {
+ root.render(
+ <QueryClientProvider client={queryClient}>
+ <IssueDetail />
+ </QueryClientProvider>,
+ );
+ });
+ await flushReact();
+ await flushReact();
+
+ expect(container.querySelector('[data-testid="issue-chat-thread"]')).toBeNull();
+ expect(container.querySelector('[data-testid="task-chat-thread"]')).not.toBeNull();
+ });
+
+ it("still honors Classic Task Interface when Streamlined UI is off", async () => {
+ mockInstanceSettingsApi.getExperimental.mockResolvedValue({
+ enableIssuePlanDecompositions: false,
+ enableExperimentalFileViewer: false,
+ enableExternalObjects: false,
+ enableStreamlinedUi: false,
+ enableClassicTaskInterface: true,
+ });
+ mockIssuesApi.get.mockResolvedValue(createIssue());
+
+ await act(async () => {
+ root.render(
+ <QueryClientProvider client={queryClient}>
+ <IssueDetail />
+ </QueryClientProvider>,
+ );
+ });
+ await flushReact();
+ await flushReact();
+
+ expect(container.querySelector('[data-testid="issue-chat-thread"]')).not.toBeNull();
+ expect(container.querySelector('[data-testid="task-chat-thread"]')).toBeNull();
+ });
+
it("passes @task mention options to the thread by default", async () => {
const mentionPoolIssue = {
...createIssue(),
diff --git a/ui/src/pages/IssueDetail.tsx b/ui/src/pages/IssueDetail.tsx
index dbf3ce482d..6a29babbe1 100644
--- a/ui/src/pages/IssueDetail.tsx
+++ b/ui/src/pages/IssueDetail.tsx
@@ -84,6 +84,7 @@ import {
readIssueDetailBreadcrumb,
readIssueDetailHeaderSeed,
rememberIssueDetailLocationState,
+ shouldArmIssueDetailInboxQuickArchive,
} from "../lib/issueDetailBreadcrumb";
import {
resolveIssueActiveRun,
@@ -143,6 +144,7 @@ import {
upsertInterruptedRun,
} from "../lib/optimistic-issue-runs";
import { useProjectOrder } from "../hooks/useProjectOrder";
+import { recordRecentTask } from "../lib/recent-tasks";
import {
relativeTime,
cn,
@@ -162,6 +164,7 @@ import {
import { TaskChatThread } from "../components/TaskChatThread";
import type { TaskChatIssueBrief } from "../components/task-chat/TaskChatDescriptionBubble";
import { useClassicTaskInterfaceEnabled } from "../hooks/useClassicTaskInterfaceEnabled";
+import { useStreamlinedUiEnabled } from "../hooks/useStreamlinedUiEnabled";
import { workModeMetaFor } from "../lib/work-mode-meta";
import { IssueContinuationHandoff } from "../components/IssueContinuationHandoff";
import { IssueAttachmentsSection } from "../components/IssueAttachmentsSection";
@@ -962,16 +965,34 @@ function IssueChatSkeleton() {
);
}
+function useTaskDetailInterfaceMode() {
+ const {
+ enabled: classicTaskInterfacePreferenceEnabled,
+ loaded: classicTaskInterfaceLoaded,
+ } = useClassicTaskInterfaceEnabled();
+ const {
+ enabled: streamlinedUiEnabled,
+ loaded: streamlinedUiLoaded,
+ } = useStreamlinedUiEnabled();
+ const classicTaskInterfaceEnabled = classicTaskInterfacePreferenceEnabled;
+ const taskChatShellEnabled = !classicTaskInterfaceEnabled;
+
+ return {
+ classicTaskInterfaceEnabled,
+ taskChatShellEnabled,
+ streamlinedTaskDetailEnabled: streamlinedUiEnabled && taskChatShellEnabled,
+ streamlinedUiEnabled,
+ loaded: classicTaskInterfaceLoaded && streamlinedUiLoaded,
+ };
+}
+
function IssueDetailLoadingState({
headerSeed,
}: {
headerSeed: ReturnType<typeof readIssueDetailHeaderSeed>;
}) {
- const identifier =
- headerSeed?.identifier ?? headerSeed?.id.slice(0, 8) ?? null;
- const { enabled: classicTaskInterfaceEnabled } =
- useClassicTaskInterfaceEnabled();
- const taskChatShellEnabled = !classicTaskInterfaceEnabled;
+ const identifier = headerSeed?.identifier ?? headerSeed?.id.slice(0, 8) ?? null;
+ const { taskChatShellEnabled } = useTaskDetailInterfaceMode();
return (
<div
@@ -1084,6 +1105,7 @@ function IssueDetailLoadingState({
interface InboxMobileToolbarProps {
backHref: string;
+ preferHistoryBack: boolean;
issueId: string | undefined;
issueHidden: boolean;
onArchive: () => void;
@@ -1095,6 +1117,7 @@ interface InboxMobileToolbarProps {
function InboxMobileToolbar({
backHref,
+ preferHistoryBack,
issueId: issueIdProp,
issueHidden,
onArchive,
@@ -1115,7 +1138,7 @@ function InboxMobileToolbar({
// Use browser back when we have real history so the inbox
// restores its scroll position. Fall back to a PUSH to
// backHref when there's no prior entry (e.g. deep-link).
- if (window.history.length > 1) {
+ if (preferHistoryBack && window.history.length > 1) {
navigate(-1);
} else {
navigate(backHref);
@@ -1405,15 +1428,10 @@ const IssueDetailChatTab = memo(function IssueDetailChatTab({
externalReferences,
linkCaseReferences,
}: IssueDetailChatTabProps) {
- // Seam for the Classic Task Interface (flag: enableClassicTaskInterface).
- // Flag ON renders the legacy IssueChatThread verbatim; flag OFF (the
- // default) renders the chat-style TaskChatThread. Both components share one
- // prop type, so no cast is needed.
- const { enabled: classicTaskInterfaceEnabled } =
- useClassicTaskInterfaceEnabled();
- const ThreadComponent = classicTaskInterfaceEnabled
- ? IssueChatThread
- : TaskChatThread;
+ // Preserve master's Classic Task Interface seam: Streamlined UI changes the
+ // TaskChatThread presentation but never swaps it for IssueChatThread.
+ const { classicTaskInterfaceEnabled, streamlinedTaskDetailEnabled } = useTaskDetailInterfaceMode();
+ const ThreadComponent = classicTaskInterfaceEnabled ? IssueChatThread : TaskChatThread;
const queryClient = useQueryClient();
const { pushToast } = useToastActions();
const { data: activity } = useQuery({
@@ -2132,7 +2150,10 @@ const IssueDetailChatTab = memo(function IssueDetailChatTab({
) : (
// Chat shell: center the bubbles at the thread cap (mirrors
// TaskChatThreadView) and dock a composer placeholder beneath them.
- <div className="mx-auto flex w-full max-w-(--tc-shell-max-w) flex-col gap-3 px-4 py-4">
+ <div className={cn(
+ "mx-auto flex w-full max-w-(--tc-shell-max-w) flex-col gap-3 px-4 py-4",
+ streamlinedTaskDetailEnabled && "md:px-0",
+ )}>
<IssueChatSkeleton />
<IssueChatComposerSkeleton className="mt-3" />
</div>
@@ -2632,16 +2653,16 @@ function IssueDetailActivityTab({
export function IssueDetail() {
const { issueId } = useParams<{ issueId: string }>();
const { selectedCompanyId } = useCompany();
- // Classic Task Interface (flag: enableClassicTaskInterface): with the flag
- // OFF (the default) the chat-style thread owns the center column — the
- // legacy title/description block, sub-tasks table, plan decompositions and
- // Documents section are gated off (plan lives in the properties-pane Plan
- // tab). Flag ON restores the legacy page.
+ // Classic Task Interface remains the sole task-chat-vs-pre-chat switch from
+ // master. Streamlined UI only layers the new task-detail presentation onto
+ // master's default task-chat shell.
const {
- enabled: classicTaskInterfaceEnabled,
- loaded: classicTaskInterfaceLoaded,
- } = useClassicTaskInterfaceEnabled();
- const taskChatShellEnabled = !classicTaskInterfaceEnabled;
+ classicTaskInterfaceEnabled,
+ taskChatShellEnabled,
+ streamlinedTaskDetailEnabled,
+ streamlinedUiEnabled,
+ loaded: taskInterfaceSettingsLoaded,
+ } = useTaskDetailInterfaceMode();
// Chat-style: the page wrapper spans the full center pane so the thread's
// scroll viewport (and its scrollbar) reaches the properties-pane border;
// every non-thread section re-centers itself at the 60rem shell cap instead.
@@ -2650,8 +2671,12 @@ export function IssueDetail() {
: undefined;
const { openNewIssue } = useDialogActions();
const { openPanel, closePanel, panelVisible, setPanelVisible } = usePanel();
- const { setBreadcrumbs, setBreadcrumbToolbar, setMobileToolbar } =
- useBreadcrumbs();
+ const {
+ setBreadcrumbs,
+ setBreadcrumbToolbar,
+ setBreadcrumbPanelControl,
+ setMobileToolbar,
+ } = useBreadcrumbs();
const queryClient = useQueryClient();
const navigate = useNavigate();
const navigationType = useNavigationType();
@@ -2704,6 +2729,22 @@ export function IssueDetail() {
readIssueDetailLocationState(issueId, location.state, location.search),
[issueId, location.state, location.search],
);
+ const relationIssueLinkState = useMemo(() => {
+ const sourceState = resolvedIssueDetailState ?? location.state;
+ if (!streamlinedTaskDetailEnabled) return sourceState;
+ if (typeof sourceState !== "object" || sourceState === null) return sourceState;
+ return {
+ ...sourceState,
+ // The inbox `y` shortcut is intentionally armed only for the selected
+ // inbox row. Preserve the origin/breadcrumb when opening a related task,
+ // but do not let that one-row archive affordance leak to the relation.
+ issueDetailInboxQuickArchiveArmed: false,
+ };
+ }, [location.state, resolvedIssueDetailState, streamlinedTaskDetailEnabled]);
+ const preferInboxHistoryBack = useMemo(
+ () => readIssueDetailLocationState(null, location.state)?.issueDetailSource === "inbox",
+ [location.state],
+ );
const issueHeaderSeed = useMemo(
() =>
readIssueDetailHeaderSeed(location.state) ??
@@ -2974,7 +3015,7 @@ export function IssueDetail() {
),
});
- const { data: session } = useQuery({
+ const { data: session, isFetched: sessionResolved } = useQuery({
queryKey: queryKeys.auth.session,
queryFn: () => authApi.getSession(),
});
@@ -2985,6 +3026,10 @@ export function IssueDetail() {
enabled: !!selectedCompanyId,
});
const currentUserId = session?.user?.id ?? session?.session?.userId ?? null;
+ useEffect(() => {
+ if (!streamlinedUiEnabled || !issue || !sessionResolved) return;
+ recordRecentTask(issue, currentUserId);
+ }, [issue, currentUserId, sessionResolved, streamlinedUiEnabled]);
const { data: boardAccess } = useQuery({
queryKey: queryKeys.access.currentBoardAccess,
queryFn: () => accessApi.getCurrentBoardAccess(),
@@ -3193,6 +3238,13 @@ export function IssueDetail() {
}
setPanelVisible(true);
}, [issue?.id, setPanelVisible, suppressPanelUntilPlan]);
+ const toggleTaskSidePanel = useCallback(() => {
+ if (!panelVisible || suppressPanelUntilPlan) {
+ openTaskSidePanel();
+ return;
+ }
+ setPanelVisible(false);
+ }, [openTaskSidePanel, panelVisible, setPanelVisible, suppressPanelUntilPlan]);
const showRichSubIssuesSection = shouldRenderRichSubIssuesSection(
childIssuesLoading,
childIssues.length,
@@ -3576,6 +3628,9 @@ export function IssueDetail() {
const issueRefs = new Set<string>([issueId!, nextIssue.id]);
if (nextIssue.identifier) issueRefs.add(nextIssue.identifier);
mergeIssueResponseIntoCaches(issueRefs, nextIssue);
+ if (streamlinedUiEnabled && sessionResolved) {
+ recordRecentTask(nextIssue, currentUserId);
+ }
queryClient.invalidateQueries({
queryKey: queryKeys.issues.activity(issueId!),
});
@@ -3944,13 +3999,9 @@ export function IssueDetail() {
[updateChildIssue.mutate],
);
- // PAP-496: the chat shell keeps the full sub-task tree directly below the
- // title in the center column. This is the tree's single chat-shell home; the
- // Properties pane does not duplicate it. Classic mode keeps its existing
- // center-column section below the header.
const subTasksTree = useMemo(
() =>
- taskChatShellEnabled && issue && showRichSubIssuesSection ? (
+ taskChatShellEnabled && !streamlinedTaskDetailEnabled && issue && showRichSubIssuesSection ? (
<IssuesList
issues={childIssues}
isLoading={childIssuesLoading}
@@ -3975,6 +4026,7 @@ export function IssueDetail() {
) : null,
[
taskChatShellEnabled,
+ streamlinedTaskDetailEnabled,
issue,
showRichSubIssuesSection,
childIssues,
@@ -4182,6 +4234,13 @@ export function IssueDetail() {
),
);
}
+ if (streamlinedUiEnabled && issue && sessionResolved) {
+ recordRecentTask(
+ issue,
+ currentUserId,
+ new Date(comment.createdAt).getTime(),
+ );
+ }
},
onError: (err, _variables, context) => {
if (context?.optimisticCommentId) {
@@ -5015,9 +5074,32 @@ export function IssueDetail() {
breadcrumbStatusKey,
]);
+ useEffect(() => {
+ if (!streamlinedTaskDetailEnabled || !taskChatShellEnabled || !issue?.id) {
+ setBreadcrumbPanelControl(null);
+ return;
+ }
+
+ setBreadcrumbPanelControl({
+ open: panelVisible && !suppressPanelUntilPlan,
+ onToggle: toggleTaskSidePanel,
+ });
+
+ return () => setBreadcrumbPanelControl(null);
+ }, [
+ issue?.id,
+ panelVisible,
+ setBreadcrumbPanelControl,
+ streamlinedTaskDetailEnabled,
+ suppressPanelUntilPlan,
+ taskChatShellEnabled,
+ toggleTaskSidePanel,
+ ]);
+
useEffect(() => {
const showTaskPanelLauncher =
taskChatShellEnabled &&
+ !streamlinedTaskDetailEnabled &&
!isMobile &&
Boolean(issue?.id) &&
(!panelVisible || suppressPanelUntilPlan);
@@ -5042,6 +5124,7 @@ export function IssueDetail() {
openTaskSidePanel,
panelVisible,
setBreadcrumbToolbar,
+ streamlinedTaskDetailEnabled,
suppressPanelUntilPlan,
taskChatShellEnabled,
]);
@@ -5113,6 +5196,7 @@ export function IssueDetail() {
const sharedProps = {
issue: panelIssue,
childIssues: panelChildIssues,
+ issueLinkState: streamlinedTaskDetailEnabled ? relationIssueLinkState : undefined,
onAddSubIssue: openNewSubIssue,
onUpdate: handleIssuePropertiesUpdate,
hasActiveRun: resolvedHasActiveRun,
@@ -5140,6 +5224,8 @@ export function IssueDetail() {
{...sharedProps}
accountScope={currentUserId ?? "anonymous"}
fileTabsEnabled={fileViewerEnabled}
+ streamlinedTabs={streamlinedTaskDetailEnabled}
+ showSubtasksTab={streamlinedTaskDetailEnabled}
/>,
{ contentMode: "full-bleed" },
);
@@ -5156,6 +5242,8 @@ export function IssueDetail() {
panelChildIssues,
panelIssue,
suppressPanelUntilPlan,
+ relationIssueLinkState,
+ streamlinedTaskDetailEnabled,
resolvedHasActiveRun,
checkIssueMonitorNow.isPending,
checkIssueMonitorNow.mutate,
@@ -5172,7 +5260,12 @@ export function IssueDetail() {
const goToInboxShortcutArmedRef = useRef(false);
const goToInboxShortcutTimeoutRef = useRef<number | null>(null);
- const canQuickArchiveFromInbox = keyboardShortcutsEnabled && !issue?.hiddenAt;
+ const canQuickArchiveFromInbox =
+ keyboardShortcutsEnabled &&
+ (!streamlinedUiEnabled || (
+ isFromInbox && shouldArmIssueDetailInboxQuickArchive(location.state)
+ )) &&
+ !issue?.hiddenAt;
useEffect(() => {
if (!issue?.id || !canQuickArchiveFromInbox) return;
@@ -5319,7 +5412,7 @@ export function IssueDetail() {
// The classic interface owns document links in its center-column
// Documents section. Do not open its tab-less properties panel.
- if (!classicTaskInterfaceLoaded || !taskChatShellEnabled) return false;
+ if (!taskInterfaceSettingsLoaded || !taskChatShellEnabled) return false;
if (isMobile) {
setMobilePropsOpen(true);
@@ -5340,7 +5433,7 @@ export function IssueDetail() {
return true;
},
[
- classicTaskInterfaceLoaded,
+ taskInterfaceSettingsLoaded,
isMobile,
issue?.id,
issueId,
@@ -5619,6 +5712,7 @@ export function IssueDetail() {
setMobileToolbar(
<InboxMobileToolbar
backHref={backHref}
+ preferHistoryBack={streamlinedUiEnabled ? preferInboxHistoryBack : true}
issueId={issue?.id}
issueHidden={issueHidden}
archivePending={archivePending}
@@ -5633,6 +5727,8 @@ export function IssueDetail() {
}, [
showInboxToolbar,
backHref,
+ preferInboxHistoryBack,
+ streamlinedUiEnabled,
issue?.id,
issueHidden,
archivePending,
@@ -6365,75 +6461,103 @@ export function IssueDetail() {
// scroll viewport, so they scroll away with the messages and the composer
// stays near the viewport bottom. Flag OFF renders the same nodes in the
// page flow, in their original order relative to the alert banners.
- const ancestorsNav = ancestors.length > 0 && (
- <nav
- className={cn(
- "flex items-center gap-1 text-xs text-muted-foreground flex-wrap",
- shellSectionClass,
- )}
- >
- {[...ancestors].reverse().map((ancestor, i) => (
- <span key={ancestor.id} className="flex items-center gap-1">
- {i > 0 && <ChevronRight className="h-3 w-3 shrink-0" />}
- <Link
- to={createIssueDetailPath(ancestor.identifier ?? ancestor.id)}
- state={resolvedIssueDetailState ?? location.state}
- onClickCapture={() =>
- rememberIssueDetailLocationState(
- ancestor.identifier ?? ancestor.id,
- resolvedIssueDetailState ?? location.state,
- location.search,
- )
- }
- className="hover:text-foreground transition-colors truncate max-w-(--sz-200px)"
- title={ancestor.title}
- >
- {ancestor.title}
- </Link>
+ const ancestorsNav =
+ !streamlinedTaskDetailEnabled && ancestors.length > 0 ? (
+ <nav
+ className={cn(
+ "flex items-center gap-1 text-xs text-muted-foreground flex-wrap",
+ shellSectionClass,
+ )}
+ >
+ {[...ancestors].reverse().map((ancestor, i) => (
+ <span key={ancestor.id} className="flex items-center gap-1">
+ {i > 0 && <ChevronRight className="h-3 w-3 shrink-0" />}
+ <Link
+ to={createIssueDetailPath(ancestor.identifier ?? ancestor.id)}
+ state={resolvedIssueDetailState ?? location.state}
+ onClickCapture={() =>
+ rememberIssueDetailLocationState(
+ ancestor.identifier ?? ancestor.id,
+ resolvedIssueDetailState ?? location.state,
+ location.search,
+ )
+ }
+ className="hover:text-foreground transition-colors truncate max-w-(--sz-200px)"
+ title={ancestor.title}
+ >
+ {ancestor.title}
+ </Link>
+ </span>
+ ))}
+ <ChevronRight className="h-3 w-3 shrink-0" />
+ <span className="text-foreground/60 truncate max-w-(--sz-200px)">
+ {issue.title}
</span>
- ))}
- <ChevronRight className="h-3 w-3 shrink-0" />
- <span className="text-foreground/60 truncate max-w-(--sz-200px)">
- {issue.title}
- </span>
- </nav>
+ </nav>
+ ) : null;
+
+ const issueStatusControl = (
+ <StatusIcon
+ status={issue.status}
+ size="lg"
+ blockerAttention={issue.blockerAttention}
+ onChange={(status) => updateIssue.mutate({ status })}
+ />
);
const issueHeaderBlock = (
- <div
- data-testid="issue-detail-header"
- className={cn("space-y-3", shellSectionClass)}
- >
- <div className="flex items-center gap-2 min-w-0 flex-wrap">
- <StatusIcon
- status={issue.status}
- size="lg"
- blockerAttention={issue.blockerAttention}
- onChange={(status) => updateIssue.mutate({ status })}
- />
- {/* PAP-411: priority UI hidden behind SHOW_TASK_PRIORITY_UI. */}
- {SHOW_TASK_PRIORITY_UI && (
- <PriorityIcon
- priority={issue.priority}
- onChange={(priority) => updateIssue.mutate({ priority })}
- />
- )}
- <span className="text-sm font-mono text-muted-foreground shrink-0">
- {issue.identifier ?? issue.id.slice(0, 8)}
- </span>
+ <div
+ data-testid="issue-detail-header"
+ className={cn(streamlinedTaskDetailEnabled ? "relative space-y-2" : "space-y-3", shellSectionClass)}
+ >
+ {streamlinedTaskDetailEnabled ? (
+ <div className="flex min-w-0 items-center gap-2 pr-8">
+ {issueStatusControl}
+ <div data-slot="task-detail-title" className="flex min-w-0 flex-1 items-baseline gap-2">
+ <InlineEditor
+ value={issue.title}
+ onSave={(title) => updateIssue.mutateAsync({ title })}
+ as="h2"
+ className="min-w-0 text-xl font-semibold leading-normal text-balance"
+ />
+ <span
+ data-slot="task-title-identifier"
+ className="shrink-0 font-mono text-sm text-muted-foreground"
+ >
+ {issue.identifier ?? issue.id.slice(0, 8)}
+ </span>
+ </div>
+ </div>
+ ) : null}
- {hasLiveRuns && (
- <Badge
- variant="outline"
- className={cn("gap-1.5 text-(length:--text-nano)", liveBlueBadge)}
- >
- <span className="relative flex h-1.5 w-1.5">
- <span className="animate-pulse absolute inline-flex h-full w-full rounded-full bg-blue-400 opacity-75" />
- <span className="relative inline-flex rounded-full h-1.5 w-1.5 bg-blue-500" />
+ <div
+ className={cn(
+ "flex min-w-0 flex-wrap items-center gap-2",
+ streamlinedTaskDetailEnabled && "gap-x-6 gap-y-2 pl-7",
+ )}
+ >
+ {!streamlinedTaskDetailEnabled ? issueStatusControl : null}
+ {/* PAP-411: priority UI hidden behind SHOW_TASK_PRIORITY_UI. */}
+ {SHOW_TASK_PRIORITY_UI && (
+ <PriorityIcon
+ priority={issue.priority}
+ onChange={(priority) => updateIssue.mutate({ priority })}
+ />
+ )}
+ {!streamlinedTaskDetailEnabled ? (
+ <span className="shrink-0 font-mono text-sm text-muted-foreground">
+ {issue.identifier ?? issue.id.slice(0, 8)}
</span>
- Live
- </Badge>
- )}
+ ) : null}
+ {hasLiveRuns && (
+ <Badge variant="outline" className={cn("gap-1.5 text-(length:--text-nano)", liveBlueBadge)}>
+ <span className="relative flex h-1.5 w-1.5">
+ <span className="animate-pulse absolute inline-flex h-full w-full rounded-full bg-blue-400 opacity-75" />
+ <span className="relative inline-flex rounded-full h-1.5 w-1.5 bg-blue-500" />
+ </span>
+ Live
+ </Badge>
+ )}
{issue.originKind === "routine_execution" && issue.originId && (
<Link
@@ -6545,7 +6669,7 @@ export function IssueDetail() {
userLabelMap={userLabelMap}
/>
- {(issue.labels ?? []).length > 0 && (
+ {!streamlinedTaskDetailEnabled && (issue.labels ?? []).length > 0 && (
<div className="hidden sm:flex items-center gap-1">
{(issue.labels ?? []).slice(0, 4).map((label) => (
<Badge
@@ -6569,7 +6693,7 @@ export function IssueDetail() {
</div>
)}
- {!(isMobile && isFromInbox) && (
+ {!streamlinedTaskDetailEnabled && !(isMobile && isFromInbox) && (
<div className="ml-auto flex items-center gap-0.5 md:hidden shrink-0">
<Button
variant="ghost"
@@ -6595,7 +6719,7 @@ export function IssueDetail() {
)}
<div className="hidden md:flex items-center md:ml-auto shrink-0">
- {canArchiveFromInbox && (
+ {!streamlinedTaskDetailEnabled && canArchiveFromInbox && (
<Button
variant="ghost"
size="icon-xs"
@@ -6621,20 +6745,23 @@ export function IssueDetail() {
<FileCode2 className="h-4 w-4" />
</Button>
) : null}
- <Button
- variant="ghost"
- size="icon-xs"
- onClick={copyIssueToClipboard}
- title="Copy task as markdown"
- >
- {copied ? (
- <Check className="h-4 w-4 text-green-500" />
- ) : (
- <Copy className="h-4 w-4" />
- )}
- </Button>
- {taskChatShellEnabled ||
- (panelVisible && !suppressPanelUntilPlan) ? null : (
+ {!streamlinedTaskDetailEnabled ? (
+ <Button
+ variant="ghost"
+ size="icon-xs"
+ onClick={copyIssueToClipboard}
+ title="Copy task as markdown"
+ >
+ {copied ? (
+ <Check className="h-4 w-4 text-green-500" />
+ ) : (
+ <Copy className="h-4 w-4" />
+ )}
+ </Button>
+ ) : null}
+ {!streamlinedTaskDetailEnabled &&
+ !taskChatShellEnabled &&
+ (!panelVisible || suppressPanelUntilPlan) ? (
<TooltipProvider>
<SidePanelToggleButton
open={false}
@@ -6643,27 +6770,69 @@ export function IssueDetail() {
className="shrink-0"
/>
</TooltipProvider>
- )}
-
- <Popover open={moreOpen} onOpenChange={setMoreOpen}>
- <PopoverTrigger asChild>
- <Button
- variant="ghost"
- size="icon-xs"
- className="shrink-0"
- aria-label="More task actions"
- title="More task actions"
- onKeyDown={(event) => {
- if (event.key === "Enter" || event.key === " ") {
- event.preventDefault();
- setMoreOpen(true);
- }
- }}
- >
- <MoreHorizontal className="h-4 w-4" />
- </Button>
- </PopoverTrigger>
- <PopoverContent className="w-52 p-1" align="end">
+ ) : null}
+ <div
+ data-slot="task-title-actions"
+ className={cn(
+ streamlinedTaskDetailEnabled && "absolute right-0 top-0 flex h-7 items-center",
+ )}
+ >
+ <Popover open={moreOpen} onOpenChange={setMoreOpen}>
+ <PopoverTrigger asChild>
+ <Button
+ variant="ghost"
+ size="icon-xs"
+ className="shrink-0"
+ aria-label="More task actions"
+ title="More task actions"
+ onKeyDown={(event) => {
+ if (event.key === "Enter" || event.key === " ") {
+ event.preventDefault();
+ setMoreOpen(true);
+ }
+ }}
+ >
+ <MoreHorizontal className="h-4 w-4" />
+ </Button>
+ </PopoverTrigger>
+ <PopoverContent className="w-52 p-1" align="end">
+ {streamlinedTaskDetailEnabled ? (
+ <>
+ <button
+ className="flex w-full items-center gap-2 rounded px-2 py-1.5 text-xs hover:bg-accent/50"
+ onClick={() => {
+ openNewSubIssue();
+ setMoreOpen(false);
+ }}
+ >
+ <Plus className="h-3 w-3" />
+ Add subtask
+ </button>
+ <button
+ className="flex w-full items-center gap-2 rounded px-2 py-1.5 text-xs hover:bg-accent/50"
+ onClick={() => {
+ void copyIssueToClipboard();
+ setMoreOpen(false);
+ }}
+ >
+ {copied ? <Check className="h-3 w-3" /> : <Copy className="h-3 w-3" />}
+ Copy as markdown
+ </button>
+ {canArchiveFromInbox ? (
+ <button
+ className="flex w-full items-center gap-2 rounded px-2 py-1.5 text-xs hover:bg-accent/50 disabled:opacity-50"
+ disabled={archivePending}
+ onClick={() => {
+ if (!archivePending && issue?.id) archiveFromInbox.mutate(issue.id);
+ setMoreOpen(false);
+ }}
+ >
+ <Archive className="h-3 w-3" />
+ Archive from inbox
+ </button>
+ ) : null}
+ </>
+ ) : null}
{canPauseLeafWork ? (
<button
className="flex items-center gap-2 w-full px-2 py-1.5 text-xs rounded hover:bg-accent/50"
@@ -6764,21 +6933,24 @@ export function IssueDetail() {
<EyeOff className="h-3 w-3" />
Hide this task
</button>
- </PopoverContent>
- </Popover>
+ </PopoverContent>
+ </Popover>
+ </div>
</div>
</div>
- <InlineEditor
- value={issue.title}
- onSave={(title) => updateIssue.mutateAsync({ title })}
- as="h2"
- className={
- taskChatShellEnabled ? "text-base font-semibold" : "text-xl font-bold"
- }
- />
+ {!streamlinedTaskDetailEnabled ? (
+ <InlineEditor
+ value={issue.title}
+ onSave={(title) => updateIssue.mutateAsync({ title })}
+ as="h2"
+ className={
+ taskChatShellEnabled ? "text-base font-semibold" : "text-xl font-bold"
+ }
+ />
+ ) : null}
- {taskChatShellEnabled ? subTasksTree : null}
+ {taskChatShellEnabled && !streamlinedTaskDetailEnabled ? subTasksTree : null}
<IssueMonitorBanner
issue={issue}
@@ -6975,548 +7147,433 @@ export function IssueDetail() {
) : null}
</div>
) : (
- <div className="text-xs">
- This task is paused by ancestor{" "}
- {activePauseHoldRoot?.identifier ? (
- <Link
- to={createIssueDetailPath(activePauseHoldRoot.identifier)}
- className="underline"
- >
- {activePauseHoldRoot.identifier}
- </Link>
- ) : (
- activePauseHold.rootIssueId.slice(0, 8)
- )}
- . Resume from the root task to deliver deferred work.
- </div>
- )}
- </div>
- )}
+ <div className="text-xs">
+ This task is paused by ancestor{" "}
+ {activePauseHoldRoot?.identifier ? (
+ <Link to={createIssueDetailPath(activePauseHoldRoot.identifier)} className="underline">
+ {activePauseHoldRoot.identifier}
+ </Link>
+ ) : (
+ activePauseHold.rootIssueId.slice(0, 8)
+ )}
+ . Resume from the root task to deliver deferred work.
+ </div>
+ )}
+ </div>
+ )}
- {taskChatShellEnabled ? null : issueHeaderBlock}
+ {taskChatShellEnabled ? null : issueHeaderBlock}
- {taskChatShellEnabled ? null : pluginOutletsBlock}
+ {taskChatShellEnabled ? null : pluginOutletsBlock}
- {taskChatShellEnabled ? null : showRichSubIssuesSection ? (
- <div className="space-y-3">
- <div className="flex items-center justify-between gap-2">
- <h3 className="text-sm font-medium text-muted-foreground">
- Sub-tasks
- </h3>
- </div>
- <IssuesList
- issues={childIssues}
- isLoading={childIssuesLoading}
- agents={agents}
- projects={projects}
- liveIssueIds={liveIssueIds}
- mutedIssueIds={mutedChildIssueIds}
- issueBadgeById={childPauseBadgeById}
- projectId={issue.projectId ?? undefined}
- viewStateKey={`paperclip:issue-detail:${issue.id}:subissues-view`}
- issueLinkState={resolvedIssueDetailState ?? location.state}
- searchFilters={{ descendantOf: issue.id, includeBlockedBy: true }}
- searchWithinLoadedIssues
- baseCreateIssueDefaults={buildSubIssueDefaultsForViewer(
- issue,
- currentUserId,
- )}
- createIssueLabel="Sub-task"
- defaultSortField="workflow"
- showProgressSummary
- parentIssueIdForCostSummary={issue.id}
- onUpdateIssue={handleChildIssueUpdate}
- />
+ {taskChatShellEnabled ? null : showRichSubIssuesSection ? (
+ <div className="space-y-3">
+ <div className="flex items-center justify-between gap-2">
+ <h3 className="text-sm font-medium text-muted-foreground">Sub-tasks</h3>
</div>
- ) : (
- <div className="flex flex-wrap items-center justify-end gap-2 min-w-0">
- <Button
- variant="outline"
- size="sm"
- onClick={openNewSubIssue}
- className="shrink-0 shadow-none"
- >
- <Plus className="mr-1.5 h-3.5 w-3.5" />
- New Sub-task
- </Button>
- </div>
- )}
-
- {!taskChatShellEnabled && showPlanDecompositionsSection ? (
- <IssuePlanDecompositionsSection
- issueId={issue.id}
- issueIdentifier={issue.identifier}
- agentMap={agentMap}
+ <IssuesList
+ issues={childIssues}
+ isLoading={childIssuesLoading}
+ agents={agents}
+ projects={projects}
+ liveIssueIds={liveIssueIds}
+ mutedIssueIds={mutedChildIssueIds}
+ issueBadgeById={childPauseBadgeById}
+ projectId={issue.projectId ?? undefined}
+ viewStateKey={`paperclip:issue-detail:${issue.id}:subissues-view`}
+ issueLinkState={resolvedIssueDetailState ?? location.state}
+ searchFilters={{ descendantOf: issue.id, includeBlockedBy: true }}
+ searchWithinLoadedIssues
+ baseCreateIssueDefaults={buildSubIssueDefaultsForViewer(issue, currentUserId)}
+ createIssueLabel="Sub-task"
+ defaultSortField="workflow"
+ showProgressSummary
+ parentIssueIdForCostSummary={issue.id}
+ onUpdateIssue={handleChildIssueUpdate}
/>
- ) : null}
+ </div>
+ ) : (
+ <div className="flex flex-wrap items-center justify-end gap-2 min-w-0">
+ <Button variant="outline" size="sm" onClick={openNewSubIssue} className="shrink-0 shadow-none">
+ <Plus className="mr-1.5 h-3.5 w-3.5" />
+ New Sub-task
+ </Button>
+ </div>
+ )}
- {/* Flag ON: attachments/work products/workspace live in the properties
- pane (Artifacts tab) — the center column belongs to the thread. */}
- {taskChatShellEnabled ? null : (
- <IssueDocumentsSection
- issue={issue}
- canDeleteDocuments={Boolean(session?.user?.id)}
- canManageDocumentLocks={Boolean(session?.user?.id)}
- feedbackVotes={feedbackVotes}
- feedbackDataSharingPreference={feedbackDataSharingPreference}
- feedbackTermsUrl={FEEDBACK_TERMS_URL}
- mentions={mentionOptions}
- externalReferences={
- externalObjectsState.isEnabled
- ? externalObjectsState.markdownReferences
- : undefined
- }
- imageUploadHandler={async (file) => {
- const attachment = await uploadAttachment.mutateAsync(file);
- return attachment.contentPath;
- }}
- onVote={async (revisionId, vote, options) => {
- await feedbackVoteMutation.mutateAsync({
- targetType: "issue_document_revision",
- targetId: revisionId,
- vote,
- reason: options?.reason,
- allowSharing: options?.allowSharing,
- sharingPreferenceAtSubmit: feedbackDataSharingPreference,
- });
- }}
- extraActions={!hasAttachments ? attachmentUploadButton : null}
- agentMap={agentMap}
- userProfileMap={userProfileMap}
- />
- )}
+ {!taskChatShellEnabled && showPlanDecompositionsSection ? (
+ <IssuePlanDecompositionsSection
+ issueId={issue.id}
+ issueIdentifier={issue.identifier}
+ agentMap={agentMap}
+ />
+ ) : null}
- {taskChatShellEnabled ? null : (
- <IssueOutputSection
- workProducts={workProducts}
- onMediaClick={(item) => {
- const meta = item.metadata;
- if (!meta) return;
- const idx = mediaGalleryItems.findIndex(
- (galleryItem) =>
- galleryItem.contentPath === meta.contentPath ||
- galleryItem.id === `work-product-${item.id}` ||
- galleryItem.id === meta.attachmentId,
- );
- setGalleryIndex(idx >= 0 ? idx : 0);
- setGalleryOpen(true);
- }}
- />
- )}
+ {/* Flag ON: attachments/work products/workspace live in the properties
+ pane (Artifacts tab) — the center column belongs to the thread. */}
+ {taskChatShellEnabled ? null : (
+ <IssueDocumentsSection
+ issue={issue}
+ canDeleteDocuments={Boolean(session?.user?.id)}
+ canManageDocumentLocks={Boolean(session?.user?.id)}
+ feedbackVotes={feedbackVotes}
+ feedbackDataSharingPreference={feedbackDataSharingPreference}
+ feedbackTermsUrl={FEEDBACK_TERMS_URL}
+ mentions={mentionOptions}
+ externalReferences={externalObjectsState.isEnabled ? externalObjectsState.markdownReferences : undefined}
+ imageUploadHandler={async (file) => {
+ const attachment = await uploadAttachment.mutateAsync(file);
+ return attachment.contentPath;
+ }}
+ onVote={async (revisionId, vote, options) => {
+ await feedbackVoteMutation.mutateAsync({
+ targetType: "issue_document_revision",
+ targetId: revisionId,
+ vote,
+ reason: options?.reason,
+ allowSharing: options?.allowSharing,
+ sharingPreferenceAtSubmit: feedbackDataSharingPreference,
+ });
+ }}
+ extraActions={!hasAttachments ? attachmentUploadButton : null}
+ agentMap={agentMap}
+ userProfileMap={userProfileMap}
+ />
+ )}
- {taskChatShellEnabled ? null : attachmentsInitialLoading ? (
- <IssueSectionSkeleton titleWidth="w-24" rows={2} />
- ) : hasAttachments ? (
- <IssueAttachmentsSection
- attachments={attachmentList}
- uploadButton={attachmentUploadButton}
- error={attachmentError}
- dragActive={attachmentDragActive}
- deletePending={deleteAttachment.isPending}
- onDelete={(attachmentId) => deleteAttachment.mutate(attachmentId)}
- onImageClick={(attachment) => {
- const idx = mediaGalleryItems.findIndex(
- (a) => a.id === attachment.id,
- );
- setGalleryIndex(idx >= 0 ? idx : 0);
- setGalleryOpen(true);
- }}
- onDragEnter={(evt) => {
- evt.preventDefault();
- setAttachmentDragActive(true);
- }}
- onDragOver={(evt) => {
- evt.preventDefault();
- setAttachmentDragActive(true);
- }}
- onDragLeave={(evt) => {
- if (evt.currentTarget.contains(evt.relatedTarget as Node | null))
- return;
- setAttachmentDragActive(false);
- }}
- onDrop={(evt) => void handleAttachmentDrop(evt)}
- />
- ) : null}
+ {taskChatShellEnabled ? null : (
+ <IssueOutputSection
+ workProducts={workProducts}
+ onMediaClick={(item) => {
+ const meta = item.metadata;
+ if (!meta) return;
+ const idx = mediaGalleryItems.findIndex((galleryItem) => (
+ galleryItem.contentPath === meta.contentPath ||
+ galleryItem.id === `work-product-${item.id}` ||
+ galleryItem.id === meta.attachmentId
+ ));
+ setGalleryIndex(idx >= 0 ? idx : 0);
+ setGalleryOpen(true);
+ }}
+ />
+ )}
- <ImageGalleryModal
- items={mediaGalleryItems}
- initialIndex={galleryIndex}
- open={galleryOpen}
- onOpenChange={setGalleryOpen}
+ {taskChatShellEnabled ? null : attachmentsInitialLoading ? (
+ <IssueSectionSkeleton titleWidth="w-24" rows={2} />
+ ) : hasAttachments ? (
+ <IssueAttachmentsSection
+ attachments={attachmentList}
+ uploadButton={attachmentUploadButton}
+ error={attachmentError}
+ dragActive={attachmentDragActive}
+ deletePending={deleteAttachment.isPending}
+ onDelete={(attachmentId) => deleteAttachment.mutate(attachmentId)}
+ onImageClick={(attachment) => {
+ const idx = mediaGalleryItems.findIndex((a) => a.id === attachment.id);
+ setGalleryIndex(idx >= 0 ? idx : 0);
+ setGalleryOpen(true);
+ }}
+ onDragEnter={(evt) => {
+ evt.preventDefault();
+ setAttachmentDragActive(true);
+ }}
+ onDragOver={(evt) => {
+ evt.preventDefault();
+ setAttachmentDragActive(true);
+ }}
+ onDragLeave={(evt) => {
+ if (evt.currentTarget.contains(evt.relatedTarget as Node | null)) return;
+ setAttachmentDragActive(false);
+ }}
+ onDrop={(evt) => void handleAttachmentDrop(evt)}
/>
+ ) : null}
- {taskChatShellEnabled ? null : (
- <IssueWorkspaceCard
- issue={issue}
- project={resolvedProject}
- onUpdate={(data) => updateIssue.mutate(data)}
- onBrowseFiles={
- fileViewerEnabled
- ? () => setFileViewerPromptOpen(true)
- : undefined
- }
- onOpenFileByPath={
- fileViewerEnabled
- ? () => setFileViewerPromptOpen(true)
- : undefined
- }
- />
- )}
+ <ImageGalleryModal
+ items={mediaGalleryItems}
+ initialIndex={galleryIndex}
+ open={galleryOpen}
+ onOpenChange={setGalleryOpen}
+ />
- {!taskChatShellEnabled &&
- fileViewerEnabled &&
- issue.workProducts &&
- issue.workProducts.length > 0 &&
- (() => {
- const workProductsWithFileRefs = issue.workProducts
- .map((product) => ({
- product,
- fileRef: extractWorkspaceFileRefFromWorkProduct(product),
- }))
- .filter(({ fileRef }) => fileRef !== null);
-
- if (workProductsWithFileRefs.length === 0) return null;
+ {taskChatShellEnabled ? null : (
+ <IssueWorkspaceCard
+ issue={issue}
+ project={resolvedProject}
+ onUpdate={(data) => updateIssue.mutate(data)}
+ onBrowseFiles={fileViewerEnabled ? () => setFileViewerPromptOpen(true) : undefined}
+ onOpenFileByPath={fileViewerEnabled ? () => setFileViewerPromptOpen(true) : undefined}
+ />
+ )}
- return (
- <div className="space-y-3">
- <div className="flex items-center justify-between gap-2">
- <h3 className="text-sm font-medium text-muted-foreground">
- Artifacts
- </h3>
- </div>
- <div className="flex flex-wrap gap-2">
- {workProductsWithFileRefs.map(({ product, fileRef }) => (
- <ArtifactFileChip
- key={product.id}
- workspaceFileRef={fileRef!}
- title={product.title}
- />
- ))}
- </div>
- </div>
- );
- })()}
+ {!taskChatShellEnabled && fileViewerEnabled && issue.workProducts && issue.workProducts.length > 0 && (() => {
+ const workProductsWithFileRefs = issue.workProducts
+ .map((product) => ({ product, fileRef: extractWorkspaceFileRefFromWorkProduct(product) }))
+ .filter(({ fileRef }) => fileRef !== null);
+
+ if (workProductsWithFileRefs.length === 0) return null;
+ return (
+ <div className="space-y-3">
+ <div className="flex items-center justify-between gap-2">
+ <h3 className="text-sm font-medium text-muted-foreground">Artifacts</h3>
+ </div>
+ <div className="flex flex-wrap gap-2">
+ {workProductsWithFileRefs.map(({ product, fileRef }) => (
+ <ArtifactFileChip
+ key={product.id}
+ workspaceFileRef={fileRef!}
+ title={product.title}
+ />
+ ))}
+ </div>
+ </div>
+ );
+ })()}
+
+ {taskChatShellEnabled ? null : <Separator className={shellSectionClass} />}
+
+ <Tabs
+ value={resolvedDetailTab}
+ onValueChange={setDetailTab}
+ className={taskChatShellEnabled ? (isMobile ? undefined : "min-h-0 flex-1") : "space-y-3"}
+ >
+ {/* Redesign: the chat IS the page — the Chat/Activity/Related-work tab
+ strip is hidden and the thread renders as the only surface. */}
{taskChatShellEnabled ? null : (
- <Separator className={shellSectionClass} />
+ <TabsList variant="line" className={cn("w-full justify-start gap-1", shellSectionClass)}>
+ <TabsTrigger value="chat" className="gap-1.5">
+ <MessageSquare className="h-3.5 w-3.5" />
+ Chat
+ </TabsTrigger>
+ <TabsTrigger value="activity" className="gap-1.5">
+ <ActivityIcon className="h-3.5 w-3.5" />
+ Activity
+ </TabsTrigger>
+ <TabsTrigger value="related-work" className="gap-1.5">
+ <ListTree className="h-3.5 w-3.5" />
+ Related work
+ </TabsTrigger>
+ {issuePluginTabItems.map((item) => (
+ <TabsTrigger key={item.value} value={item.value}>
+ {item.label}
+ </TabsTrigger>
+ ))}
+ </TabsList>
)}
- <Tabs
- value={resolvedDetailTab}
- onValueChange={setDetailTab}
+ {/* The chat shell keeps the page's responsive 16px/24px gutters so
+ thread content and the composer do not touch either sidebar. */}
+ <TabsContent
+ data-testid="issue-detail-content"
+ value="chat"
className={
taskChatShellEnabled
? isMobile
- ? undefined
- : "min-h-0 flex-1"
- : "space-y-3"
+ ? streamlinedTaskDetailEnabled ? undefined : "-mx-4"
+ : streamlinedTaskDetailEnabled
+ ? "flex min-h-0 flex-col"
+ : "-mx-4 -mt-4 md:-mx-6 md:-mt-6 flex min-h-0 flex-col"
+ : undefined
}
>
- {/* Redesign: the chat IS the page — the Chat/Activity/Related-work tab
- strip is hidden and the thread renders as the only surface. */}
- {taskChatShellEnabled ? null : (
- <TabsList
- variant="line"
- className={cn("w-full justify-start gap-1", shellSectionClass)}
- >
- <TabsTrigger value="chat" className="gap-1.5">
- <MessageSquare className="h-3.5 w-3.5" />
- Chat
- </TabsTrigger>
- <TabsTrigger value="activity" className="gap-1.5">
- <ActivityIcon className="h-3.5 w-3.5" />
- Activity
- </TabsTrigger>
- <TabsTrigger value="related-work" className="gap-1.5">
- <ListTree className="h-3.5 w-3.5" />
- Related work
- </TabsTrigger>
- {issuePluginTabItems.map((item) => (
- <TabsTrigger key={item.value} value={item.value}>
- {item.label}
- </TabsTrigger>
- ))}
- </TabsList>
- )}
-
- {/* Flag ON the thread viewport extends under main's horizontal padding
- (symmetric, so the centered column keeps the same axis) and its top
- padding, placing task metadata in the side-panel tab header band. */}
- <TabsContent
- data-testid="issue-detail-content"
- value="chat"
- className={
- taskChatShellEnabled
- ? isMobile
- ? "-mx-4"
- : "-mx-4 -mt-4 md:-mx-6 md:-mt-6 flex min-h-0 flex-col"
- : undefined
- }
- >
- {resolvedDetailTab === "chat" ? (
- <IssueDetailChatTab
- threadHeader={taskChatThreadHeader}
- issueBrief={
- // Suppress the seeded-description bubble for the onboarding first
- // task: its description is agent instructions, not something the
- // user typed. The user lands on a seeded agent greeting instead.
- taskChatShellEnabled &&
- issue.originKind !== ONBOARDING_FIRST_TASK_ORIGIN_KIND
- ? {
- description: issue.description ?? "",
- author: issue.createdByAgentId ? "agent" : "human",
- authorName: issue.createdByAgentId
- ? (agentMap.get(issue.createdByAgentId)?.name ??
- "Agent")
- : undefined,
- agentIcon: issue.createdByAgentId
- ? agentMap.get(issue.createdByAgentId)?.icon
- : undefined,
- createdAt: issue.createdAt,
- onSave: (description) =>
- updateIssue.mutateAsync({ description }),
- mentions: mentionOptions,
- externalReferences: externalObjectsState.isEnabled
- ? externalObjectsState.markdownReferences
- : undefined,
- imageUploadHandler: async (file) => {
- const attachment =
- await uploadAttachment.mutateAsync(file);
- return attachment.contentPath;
- },
- onDropFile: async (file) => {
- await uploadAttachment.mutateAsync(file);
- },
- }
- : undefined
- }
- issueId={issue.id}
- companyId={issue.companyId}
- projectId={issue.projectId ?? null}
- issueStatus={issue.status}
- issueAssigneeAgentId={issue.assigneeAgentId}
- issueWorkMode={issue.workMode ?? "standard"}
- executionRunId={issue.executionRunId ?? null}
- blockedBy={issue.blockedBy ?? []}
- liveIssueIds={liveIssueIds}
- blockerAttention={issue.blockerAttention ?? null}
- successfulRunHandoff={issue.successfulRunHandoff ?? null}
- scheduledRetry={issue.scheduledRetry ?? null}
- recoveryAction={issue.activeRecoveryAction ?? null}
- onResolveRecoveryAction={handleResolveRecoveryAction}
- onReissueIsolatedRecoveryAction={
- handleReissueIsolatedRecoveryAction
- }
- reissueIsolatedRecoveryActionPending={
- reissueIsolatedRecoveryAction.isPending
- }
- onReconcileForwardRecoveryAction={
- handleReconcileForwardRecoveryAction
- }
- onBreakGlassOverrideRecoveryAction={
- handleBreakGlassOverrideRecoveryAction
- }
- onQuarantineRestoreRecoveryAction={
- handleQuarantineRestoreRecoveryAction
- }
- quarantineRestoreRecoveryActionPending={
- reconcileRecoveryAction.isPending
- }
- canBreakGlassRecoveryAction={canManageBoardRuntime}
- reconcileRecoveryActionPending={
- reconcileRecoveryAction.isPending
- }
- canFalsePositiveRecoveryAction={canResolveBoardRecoveryAction}
- legacyRecoverySourceIssue={legacyRecoverySourceIssue}
- comments={threadComments}
- commentsInitialLoading={commentsLoading}
- locallyQueuedCommentRunIds={locallyQueuedCommentRunIds}
- interactions={interactions}
- documents={issue.documentSummaries ?? []}
- workProducts={workProducts ?? []}
- attachments={attachments ?? []}
- hasOlderComments={hasOlderComments}
- commentsLoadingOlder={commentsLoadingOlder}
- onLoadOlderComments={loadOlderComments}
- onRefreshLatestComments={refetchLatestComments}
- composerRef={commentComposerRef}
- composerAccessory={
- hasVisibleMonitorSurface(issue) ? (
- <IssueMonitorComposerStrip
- issue={issue}
- onCheckNow={() => checkIssueMonitorNow.mutate()}
- checkingNow={checkIssueMonitorNow.isPending}
- />
- ) : null
- }
- footer={
- !taskChatShellEnabled && siblingNavigation ? (
- <IssueSiblingNavigation
- navigation={siblingNavigation}
- linkState={resolvedIssueDetailState ?? location.state}
- />
- ) : null
- }
- feedbackVotes={feedbackVotes}
- feedbackDataSharingPreference={feedbackDataSharingPreference}
- feedbackTermsUrl={FEEDBACK_TERMS_URL}
- agentMap={agentMap}
- currentUserId={currentUserId}
- userLabelMap={userLabelMap}
- userProfileMap={userProfileMap}
- draftKey={`paperclip:issue-comment-draft:${issue.id}`}
- reassignOptions={commentReassignOptions}
- currentAssigneeValue={actualAssigneeValue}
- suggestedAssigneeValue={suggestedAssigneeValue}
- mentions={mentionOptions}
- composerDisabledReason={null}
- composerHint={composerHint}
- queuedCommentReason={queuedCommentReason}
- onVote={handleCommentVote}
- onAdd={handleChatAdd}
- onImageUpload={handleCommentImageUpload}
- onAttachImage={handleCommentAttachImage}
- onInterruptQueued={handleInterruptQueuedRun}
- onDeleteComment={(commentId) =>
- deleteComment.mutateAsync({ commentId }).then(() => undefined)
- }
- onPauseWorkRun={
- canManageTreeControl
- ? (runId) =>
- pauseIssueWorkRun
- .mutateAsync({ runId, scope: treeControlScope })
- .then(() => undefined)
- : undefined
- }
- runFinalizationActions={runFinalizationActions}
- onWorkModeChange={(nextMode) => {
- const currentMode: IssueWorkMode =
- issue.workMode ?? "standard";
- if (currentMode === nextMode) return;
- return updateIssue
- .mutateAsync({ workMode: nextMode })
- .then(() => undefined);
- }}
- onCancelQueued={handleCancelQueuedComment}
- interruptingQueuedRunId={
- interruptQueuedComment.isPending
- ? (interruptQueuedComment.variables ?? null)
- : null
- }
- pausingWorkRunId={
- pauseIssueWorkRun.isPending
- ? (pauseIssueWorkRun.variables?.runId ?? null)
- : null
- }
- onImageClick={handleChatImageClick}
- onAcceptInteraction={handleAcceptInteraction}
- onRejectInteraction={handleRejectInteraction}
- onSubmitInteractionAnswers={handleSubmitInteractionAnswers}
- onCancelInteraction={handleCancelInteraction}
- onSkipInteraction={handleSkipInteraction}
- onSubmitInteractionVerdicts={handleSubmitInteractionVerdicts}
- assigneeUserId={issue.assigneeUserId ?? null}
- onResumeFromBacklog={
- canResumeFromBacklog ? handleResumeFromBacklog : undefined
- }
- resumeFromBacklogPending={
- updateIssue.isPending &&
- updateIssue.variables?.status === "todo"
- }
- onResumeAssignee={
- issue.assigneeAgentId ? handleResumeAssignee : undefined
- }
- resumeAssigneePending={resumeAssigneeAgent.isPending}
- onTryAgainNoLiveExecutionPath={
- issue.status === "blocked" && issue.activeRecoveryAction
- ? handleTryAgainNoLiveExecutionPath
- : undefined
- }
- tryAgainNoLiveExecutionPathPending={
- resolveRecoveryAction.isPending &&
- resolveRecoveryAction.variables?.sourceIssueStatus === "todo"
- }
- externalReferences={
- externalObjectsState.isEnabled
- ? externalObjectsState.markdownReferences
- : undefined
- }
- linkCaseReferences={casesChipsEnabled}
- />
- ) : null}
- </TabsContent>
-
- <TabsContent value="activity" className={shellSectionClass}>
- {detailTab === "activity" ? (
- <IssueDetailActivityTab
- issue={issue}
- issueId={issue.id}
- companyId={issue.companyId}
- issueStatus={issue.status}
- childIssues={childIssues}
- agentMap={agentMap}
- hasLiveRuns={hasLiveRuns}
- currentUserId={currentUserId}
- userProfileMap={userProfileMap}
- pendingApprovalAction={pendingApprovalAction}
- handoffFocusSignal={handoffFocusSignal}
- onApprovalAction={(approvalId, action) => {
- approvalDecision.mutate({ approvalId, action });
- }}
- externalReferences={
- externalObjectsState.isEnabled
- ? externalObjectsState.markdownReferences
- : undefined
- }
- />
- ) : null}
- </TabsContent>
-
- <TabsContent value="related-work" className={shellSectionClass}>
- <IssueRelatedWorkPanel
- relatedWork={issue.relatedWork}
- externalObjectsEnabled={externalObjectsState.isEnabled}
- externalObjects={
- externalObjectsState.isEnabled
- ? externalObjectsState.groups
+ {resolvedDetailTab === "chat" ? (
+ <IssueDetailChatTab
+ threadHeader={taskChatThreadHeader}
+ issueBrief={
+ // Suppress the seeded-description bubble for the onboarding first
+ // task: its description is agent instructions, not something the
+ // user typed. The user lands on a seeded agent greeting instead.
+ taskChatShellEnabled &&
+ issue.originKind !== ONBOARDING_FIRST_TASK_ORIGIN_KIND
+ ? {
+ description: issue.description ?? "",
+ author: issue.createdByAgentId ? "agent" : "human",
+ authorName: issue.createdByAgentId
+ ? agentMap.get(issue.createdByAgentId)?.name ?? "Agent"
+ : undefined,
+ agentIcon: issue.createdByAgentId
+ ? agentMap.get(issue.createdByAgentId)?.icon
+ : undefined,
+ createdAt: issue.createdAt,
+ onSave: (description) => updateIssue.mutateAsync({ description }),
+ mentions: mentionOptions,
+ externalReferences: externalObjectsState.isEnabled
+ ? externalObjectsState.markdownReferences
+ : undefined,
+ imageUploadHandler: async (file) => {
+ const attachment = await uploadAttachment.mutateAsync(file);
+ return attachment.contentPath;
+ },
+ onDropFile: async (file) => {
+ await uploadAttachment.mutateAsync(file);
+ },
+ }
: undefined
}
- externalObjectsLoading={
- externalObjectsState.isEnabled
- ? externalObjectsState.isLoading
- : undefined
+ issueId={issue.id}
+ companyId={issue.companyId}
+ projectId={issue.projectId ?? null}
+ issueStatus={issue.status}
+ issueAssigneeAgentId={issue.assigneeAgentId}
+ issueWorkMode={issue.workMode ?? "standard"}
+ executionRunId={issue.executionRunId ?? null}
+ blockedBy={issue.blockedBy ?? []}
+ liveIssueIds={liveIssueIds}
+ blockerAttention={issue.blockerAttention ?? null}
+ successfulRunHandoff={issue.successfulRunHandoff ?? null}
+ scheduledRetry={issue.scheduledRetry ?? null}
+ recoveryAction={issue.activeRecoveryAction ?? null}
+ onResolveRecoveryAction={handleResolveRecoveryAction}
+ onReissueIsolatedRecoveryAction={handleReissueIsolatedRecoveryAction}
+ reissueIsolatedRecoveryActionPending={reissueIsolatedRecoveryAction.isPending}
+ onReconcileForwardRecoveryAction={handleReconcileForwardRecoveryAction}
+ onBreakGlassOverrideRecoveryAction={handleBreakGlassOverrideRecoveryAction}
+ onQuarantineRestoreRecoveryAction={handleQuarantineRestoreRecoveryAction}
+ quarantineRestoreRecoveryActionPending={reconcileRecoveryAction.isPending}
+ canBreakGlassRecoveryAction={canManageBoardRuntime}
+ reconcileRecoveryActionPending={reconcileRecoveryAction.isPending}
+ canFalsePositiveRecoveryAction={canResolveBoardRecoveryAction}
+ legacyRecoverySourceIssue={legacyRecoverySourceIssue}
+ comments={threadComments}
+ commentsInitialLoading={commentsLoading}
+ locallyQueuedCommentRunIds={locallyQueuedCommentRunIds}
+ interactions={interactions}
+ documents={issue.documentSummaries ?? []}
+ workProducts={workProducts ?? []}
+ attachments={attachments ?? []}
+ hasOlderComments={hasOlderComments}
+ commentsLoadingOlder={commentsLoadingOlder}
+ onLoadOlderComments={loadOlderComments}
+ onRefreshLatestComments={refetchLatestComments}
+ composerRef={commentComposerRef}
+ composerAccessory={
+ hasVisibleMonitorSurface(issue) ? (
+ <IssueMonitorComposerStrip
+ issue={issue}
+ onCheckNow={() => checkIssueMonitorNow.mutate()}
+ checkingNow={checkIssueMonitorNow.isPending}
+ />
+ ) : null
}
- externalObjectsError={
- externalObjectsState.isEnabled
- ? externalObjectsState.isError
- : undefined
+ footer={
+ !taskChatShellEnabled && siblingNavigation ? (
+ <IssueSiblingNavigation
+ navigation={siblingNavigation}
+ linkState={resolvedIssueDetailState ?? location.state}
+ />
+ ) : null
}
- onRetryExternalObjects={
- externalObjectsState.isEnabled
- ? externalObjectsState.refetch
+ feedbackVotes={feedbackVotes}
+ feedbackDataSharingPreference={feedbackDataSharingPreference}
+ feedbackTermsUrl={FEEDBACK_TERMS_URL}
+ agentMap={agentMap}
+ currentUserId={currentUserId}
+ userLabelMap={userLabelMap}
+ userProfileMap={userProfileMap}
+ draftKey={`paperclip:issue-comment-draft:${issue.id}`}
+ reassignOptions={commentReassignOptions}
+ currentAssigneeValue={actualAssigneeValue}
+ suggestedAssigneeValue={suggestedAssigneeValue}
+ mentions={mentionOptions}
+ composerDisabledReason={null}
+ composerHint={composerHint}
+ queuedCommentReason={queuedCommentReason}
+ onVote={handleCommentVote}
+ onAdd={handleChatAdd}
+ onImageUpload={handleCommentImageUpload}
+ onAttachImage={handleCommentAttachImage}
+ onInterruptQueued={handleInterruptQueuedRun}
+ onDeleteComment={(commentId) => deleteComment.mutateAsync({ commentId }).then(() => undefined)}
+ onPauseWorkRun={canManageTreeControl
+ ? (runId) => pauseIssueWorkRun.mutateAsync({ runId, scope: treeControlScope }).then(() => undefined)
+ : undefined}
+ runFinalizationActions={runFinalizationActions}
+ onWorkModeChange={(nextMode) => {
+ const currentMode: IssueWorkMode = issue.workMode ?? "standard";
+ if (currentMode === nextMode) return;
+ return updateIssue.mutateAsync({ workMode: nextMode }).then(() => undefined);
+ }}
+ onCancelQueued={handleCancelQueuedComment}
+ interruptingQueuedRunId={interruptQueuedComment.isPending ? interruptQueuedComment.variables ?? null : null}
+ pausingWorkRunId={pauseIssueWorkRun.isPending ? pauseIssueWorkRun.variables?.runId ?? null : null}
+ onImageClick={handleChatImageClick}
+ onAcceptInteraction={handleAcceptInteraction}
+ onRejectInteraction={handleRejectInteraction}
+ onSubmitInteractionAnswers={handleSubmitInteractionAnswers}
+ onCancelInteraction={handleCancelInteraction}
+ onSkipInteraction={handleSkipInteraction}
+ onSubmitInteractionVerdicts={handleSubmitInteractionVerdicts}
+ assigneeUserId={issue.assigneeUserId ?? null}
+ onResumeFromBacklog={canResumeFromBacklog ? handleResumeFromBacklog : undefined}
+ resumeFromBacklogPending={
+ updateIssue.isPending && updateIssue.variables?.status === "todo"
+ }
+ onResumeAssignee={issue.assigneeAgentId ? handleResumeAssignee : undefined}
+ resumeAssigneePending={resumeAssigneeAgent.isPending}
+ onTryAgainNoLiveExecutionPath={
+ issue.status === "blocked" && issue.activeRecoveryAction
+ ? handleTryAgainNoLiveExecutionPath
: undefined
}
+ tryAgainNoLiveExecutionPathPending={
+ resolveRecoveryAction.isPending &&
+ resolveRecoveryAction.variables?.sourceIssueStatus === "todo"
+ }
+ externalReferences={externalObjectsState.isEnabled ? externalObjectsState.markdownReferences : undefined}
+ linkCaseReferences={casesChipsEnabled}
+ />
+ ) : null}
+ </TabsContent>
+
+ <TabsContent value="activity" className={shellSectionClass}>
+ {detailTab === "activity" ? (
+ <IssueDetailActivityTab
+ issue={issue}
+ issueId={issue.id}
+ companyId={issue.companyId}
+ issueStatus={issue.status}
+ childIssues={childIssues}
+ agentMap={agentMap}
+ hasLiveRuns={hasLiveRuns}
+ currentUserId={currentUserId}
+ userProfileMap={userProfileMap}
+ pendingApprovalAction={pendingApprovalAction}
+ handoffFocusSignal={handoffFocusSignal}
+ onApprovalAction={(approvalId, action) => {
+ approvalDecision.mutate({ approvalId, action });
+ }}
+ externalReferences={externalObjectsState.isEnabled ? externalObjectsState.markdownReferences : undefined}
+ />
+ ) : null}
+ </TabsContent>
+
+ <TabsContent value="related-work" className={shellSectionClass}>
+ <IssueRelatedWorkPanel
+ relatedWork={issue.relatedWork}
+ externalObjectsEnabled={externalObjectsState.isEnabled}
+ externalObjects={externalObjectsState.isEnabled ? externalObjectsState.groups : undefined}
+ externalObjectsLoading={externalObjectsState.isEnabled ? externalObjectsState.isLoading : undefined}
+ externalObjectsError={externalObjectsState.isEnabled ? externalObjectsState.isError : undefined}
+ onRetryExternalObjects={externalObjectsState.isEnabled ? externalObjectsState.refetch : undefined}
+ />
+ </TabsContent>
+
+ {activePluginTab && (
+ <TabsContent value={activePluginTab.value} className={shellSectionClass}>
+ <PluginSlotMount
+ slot={activePluginTab.slot}
+ context={{
+ companyId: issue.companyId,
+ projectId: issue.projectId ?? null,
+ entityId: issue.id,
+ entityType: "issue",
+ }}
+ missingBehavior="placeholder"
/>
</TabsContent>
-
- {activePluginTab && (
- <TabsContent
- value={activePluginTab.value}
- className={shellSectionClass}
- >
- <PluginSlotMount
- slot={activePluginTab.slot}
- context={{
- companyId: issue.companyId,
- projectId: issue.projectId ?? null,
- entityId: issue.id,
- entityType: "issue",
- }}
- missingBehavior="placeholder"
- />
- </TabsContent>
- )}
- </Tabs>
+ )}
+ </Tabs>
<Dialog open={treeControlOpen} onOpenChange={setTreeControlOpen}>
<DialogContent className="flex max-h-(--sz-calc-18) flex-col gap-0 overflow-hidden p-0 sm:max-w-(--sz-560px)">
@@ -7766,6 +7823,11 @@ export function IssueDetail() {
issue={issue}
accountScope={currentUserId ?? "anonymous"}
childIssues={childIssues}
+ issueLinkState={
+ streamlinedTaskDetailEnabled
+ ? relationIssueLinkState
+ : undefined
+ }
onAddSubIssue={openNewSubIssue}
onUpdate={(data) => updateIssue.mutate(data)}
inline
@@ -7793,6 +7855,8 @@ export function IssueDetail() {
onCheckMonitorNow={() => checkIssueMonitorNow.mutate()}
checkingMonitorNow={checkIssueMonitorNow.isPending}
fileTabsEnabled={fileViewerEnabled}
+ streamlinedTabs={streamlinedTaskDetailEnabled}
+ showSubtasksTab={streamlinedTaskDetailEnabled}
documentDeepLink={
documentDeepLink?.issueId === issue.id
? documentDeepLink
@@ -7815,6 +7879,11 @@ export function IssueDetail() {
<IssueProperties
issue={issue}
childIssues={childIssues}
+ issueLinkState={
+ streamlinedTaskDetailEnabled
+ ? relationIssueLinkState
+ : undefined
+ }
onAddSubIssue={openNewSubIssue}
onUpdate={(data) => updateIssue.mutate(data)}
inline
diff --git a/ui/src/pages/Issues.test.tsx b/ui/src/pages/Issues.test.tsx
index 576a03b765..808963864f 100644
--- a/ui/src/pages/Issues.test.tsx
+++ b/ui/src/pages/Issues.test.tsx
@@ -1,6 +1,13 @@
import { describe, expect, it } from "vitest";
import type { Issue } from "@paperclipai/shared";
-import { buildIssuesSearchUrl, getNextIssuesPageOffset, mergeIssuePagesStable } from "./Issues";
+import {
+ ISSUES_ROW_PRESENTATION,
+ ISSUES_TOOLBAR_PRESENTATION,
+ buildIssuesSearchUrl,
+ getNextIssuesPageOffset,
+ mergeIssuePagesStable,
+ resolveIssuesPresentation,
+} from "./Issues";
function createIssue(id: string, title: string): Issue {
return { id, title } as Issue;
@@ -21,6 +28,25 @@ describe("buildIssuesSearchUrl", () => {
});
describe("issues page pagination helpers", () => {
+ it("opts the Tasks route into the canonical shared task-row presentation", () => {
+ expect(ISSUES_ROW_PRESENTATION).toBe("task");
+ });
+
+ it("opts the Tasks route into the shared collection toolbar", () => {
+ expect(ISSUES_TOOLBAR_PRESENTATION).toBe("collection");
+ });
+
+ it("restores the retained legacy list and toolbar when Streamlined UI is off", () => {
+ expect(resolveIssuesPresentation(false)).toEqual({
+ rowPresentation: "legacy",
+ toolbarPresentation: "legacy",
+ });
+ expect(resolveIssuesPresentation(true)).toEqual({
+ rowPresentation: "task",
+ toolbarPresentation: "collection",
+ });
+ });
+
it("advances to the next offset when the current page is full", () => {
expect(getNextIssuesPageOffset(100, 0)).toBe(100);
expect(getNextIssuesPageOffset(100, 100)).toBe(200);
diff --git a/ui/src/pages/Issues.tsx b/ui/src/pages/Issues.tsx
index 86fca351c1..06872ac197 100644
--- a/ui/src/pages/Issues.tsx
+++ b/ui/src/pages/Issues.tsx
@@ -15,9 +15,18 @@ import { EmptyState } from "../components/EmptyState";
import { IssuesList } from "../components/IssuesList";
import { CircleDot } from "lucide-react";
import type { Issue } from "@paperclipai/shared";
+import { useStreamlinedUiEnabled } from "../hooks/useStreamlinedUiEnabled";
const WORKSPACE_FILTER_ISSUE_LIMIT = 1000;
const ISSUES_PAGE_SIZE = 100;
+export const ISSUES_ROW_PRESENTATION = "task" as const;
+export const ISSUES_TOOLBAR_PRESENTATION = "collection" as const;
+
+export function resolveIssuesPresentation(streamlinedUiEnabled: boolean) {
+ return streamlinedUiEnabled
+ ? { rowPresentation: ISSUES_ROW_PRESENTATION, toolbarPresentation: ISSUES_TOOLBAR_PRESENTATION }
+ : { rowPresentation: "legacy" as const, toolbarPresentation: "legacy" as const };
+}
export function getNextIssuesPageOffset(
loadedPageSize: number,
@@ -57,6 +66,8 @@ export function buildIssuesSearchUrl(currentHref: string, search: string): strin
}
export function Issues() {
+ const { enabled: streamlinedUiEnabled } = useStreamlinedUiEnabled();
+ const issuesPresentation = resolveIssuesPresentation(streamlinedUiEnabled);
const { selectedCompanyId } = useCompany();
const { setBreadcrumbs } = useBreadcrumbs();
const location = useLocation();
@@ -187,7 +198,14 @@ export function Issues() {
});
if (!selectedCompanyId) {
- return <EmptyState icon={CircleDot} message="Select an organization to view tasks." />;
+ return (
+ <EmptyState
+ icon={CircleDot}
+ message={streamlinedUiEnabled
+ ? "Select an organization to view tasks."
+ : "Select a company to view tasks."}
+ />
+ );
}
return (
@@ -200,6 +218,8 @@ export function Issues() {
projects={projects}
liveIssueIds={liveIssueIds}
viewStateKey="paperclip:issues-view"
+ rowPresentation={issuesPresentation.rowPresentation}
+ toolbarPresentation={issuesPresentation.toolbarPresentation}
issueLinkState={issueLinkState}
initialAssignees={searchParams.get("assignee") ? [searchParams.get("assignee")!] : undefined}
initialWorkspaces={initialWorkspaces.length > 0 ? initialWorkspaces : undefined}
diff --git a/ui/src/pages/LegacyInbox.tsx b/ui/src/pages/LegacyInbox.tsx
new file mode 100644
index 0000000000..711279504f
--- /dev/null
+++ b/ui/src/pages/LegacyInbox.tsx
@@ -0,0 +1,3160 @@
+import { type ReactNode, useCallback, useEffect, useMemo, useRef, useState } from "react";
+import { Link, useLocation, useNavigate } from "@/lib/router";
+import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
+import { deriveOriginatingActor, INBOX_MINE_ISSUE_STATUS_FILTER } from "@paperclipai/shared";
+import { usePublishSharedQueryData, useSharedPollingQuery } from "@/hooks/useSharedPolling";
+import { approvalsApi } from "../api/approvals";
+import { accessApi } from "../api/access";
+import { authApi } from "../api/auth";
+import { ApiError } from "../api/client";
+import { dashboardApi } from "../api/dashboard";
+import { executionWorkspacesApi } from "../api/execution-workspaces";
+import { issuesApi } from "../api/issues";
+import { agentsApi } from "../api/agents";
+import { heartbeatsApi } from "../api/heartbeats";
+import { instanceSettingsApi } from "../api/instanceSettings";
+import { projectsApi } from "../api/projects";
+import {
+ BLOCKED_GROUP_OPTIONS,
+ BLOCKED_SORT_OPTIONS,
+ type BlockedInboxGroupBy,
+ type BlockedInboxSort,
+} from "../lib/blockedInbox";
+import { useCompany } from "../context/CompanyContext";
+import { useBreadcrumbs } from "../context/BreadcrumbContext";
+import { useGeneralSettings } from "../context/GeneralSettingsContext";
+import { useSidebar } from "../context/SidebarContext";
+import { queryKeys } from "../lib/queryKeys";
+import { useDialogActions } from "../context/DialogContext";
+import { useIssueExternalObjectSummaries } from "../hooks/useIssueExternalObjects";
+import {
+ applyIssueFilters,
+ countActiveIssueFilters,
+ type IssueFilterState,
+} from "../lib/issue-filters";
+import { collectLiveIssueIds, collectSubtreeLiveCounts } from "../lib/liveIssueIds";
+import { formatAssigneeUserLabel } from "../lib/assignees";
+import { buildCompanyUserLabelMap, buildCompanyUserProfileMap } from "../lib/company-members";
+import {
+ armIssueDetailInboxQuickArchive,
+ createIssueDetailLocationState,
+ createIssueDetailPath,
+ rememberIssueDetailLocationState,
+ withIssueDetailHeaderSeed,
+} from "../lib/issueDetailBreadcrumb";
+import { prefetchIssueDetailForNavigation } from "../lib/issueDetailCache";
+import {
+ hasBlockingShortcutDialog,
+ isKeyboardShortcutTextInputTarget,
+ resolveInboxUndoArchiveKeyAction,
+ shouldBlurPageSearchOnEnter,
+ shouldBlurPageSearchOnEscape,
+} from "../lib/keyboardShortcuts";
+import {
+ resolveInboxIssueBlockerAttention,
+ resolveIssueLiveDescendantCount,
+} from "../lib/inbox-live-descendants";
+import {
+ beginLocalInboxArchive,
+ boundLocalInboxArchive,
+ cancelInboxIssueQueries,
+ clearLocalInboxArchive,
+ confirmLocalInboxArchive,
+ invalidateInboxIssueQueries,
+ getIssuePresenceInActiveInboxCaches,
+ removeIssueFromInboxCaches,
+ restoreIssueToInboxCaches,
+ snapshotInboxIssueCaches,
+ type InboxIssueCacheSnapshot,
+ useLocalInboxArchiveIssueIds,
+} from "../lib/inboxArchiveCache";
+import { EmptyState } from "../components/EmptyState";
+import { IssueGroupHeader } from "../components/IssueGroupHeader";
+import { PageSkeleton } from "../components/PageSkeleton";
+import {
+ InboxIssueMetaLeading,
+ InboxIssueTrailingColumns,
+ IssueColumnPicker,
+ issueActivityText,
+ issueTrailingColumns,
+} from "../components/IssueColumns";
+import { IssueFiltersPopover } from "../components/IssueFiltersPopover";
+import { InboxArchiveButton, IssueRow } from "../components/IssueRow";
+import { BlockedInboxView } from "../components/BlockedInboxView";
+import { SwipeToArchive } from "../components/SwipeToArchive";
+
+import { StatusIcon } from "../components/StatusIcon";
+import { cn } from "../lib/utils";
+import { StatusBadge } from "../components/StatusBadge";
+import { approvalLabel, defaultTypeIcon, typeIcon } from "../components/ApprovalPayload";
+import { timeAgo } from "../lib/timeAgo";
+import { Button } from "@/components/ui/button";
+import {
+ Dialog,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from "@/components/ui/dialog";
+import { Separator } from "@/components/ui/separator";
+import { Tabs } from "@/components/ui/tabs";
+import {
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue,
+} from "@/components/ui/select";
+import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
+import {
+ Inbox as InboxIcon,
+ AlertTriangle,
+ Check,
+ ChevronRight,
+ ArrowUpDown,
+ Layers,
+ Plus,
+ XCircle,
+ X,
+ RotateCcw,
+ UserPlus,
+ Search,
+ ListTree,
+} from "lucide-react";
+import { Input } from "@/components/ui/input";
+import { PageTabBar } from "../components/PageTabBar";
+import type { Approval, HeartbeatRun, Issue, JoinRequest } from "@paperclipai/shared";
+import {
+ ACTIONABLE_APPROVAL_STATUSES,
+ DEFAULT_INBOX_ISSUE_COLUMNS,
+ buildGroupedInboxSections,
+ buildInboxIssueGroupCreateDefaults,
+ buildInboxKeyboardNavEntries,
+ getAvailableInboxIssueColumns,
+ getInboxWorkItemKey,
+ getApprovalsForTab,
+ getArchivedInboxSearchIssues,
+ getInboxKeyboardSelectionIndex,
+ getInboxWorkItems,
+ getInboxSearchSupplementIssues,
+ getLatestFailedRunsByAgent,
+ matchesInboxIssueSearch,
+ getRecentTouchedIssues,
+ isInboxEntityDismissed,
+ isMineInboxTab,
+ loadCollapsedInboxGroupKeys,
+ loadCollapsedInboxParentIds,
+ loadInboxFilterPreferences,
+ loadInboxIssueColumns,
+ loadInboxNesting,
+ loadInboxWorkItemGroupBy,
+ normalizeInboxIssueColumns,
+ resolveInboxNestingEnabled,
+ shouldResetInboxWorkspaceGrouping,
+ resolveIssueWorkspaceName,
+ resolveInboxSelectionIndex,
+ saveInboxFilterPreferences,
+ saveCollapsedInboxGroupKeys,
+ saveCollapsedInboxParentIds,
+ saveInboxIssueColumns,
+ saveInboxNesting,
+ saveInboxWorkItemGroupBy,
+ type InboxWorkspaceGroupingOptions,
+ type InboxApprovalFilter,
+ type InboxCategoryFilter,
+ type InboxFilterPreferences,
+ type InboxIssueColumn,
+ type InboxKeyboardNavEntry,
+ saveLastInboxTab,
+ shouldShowCompanyAlerts,
+ shouldShowInboxSection,
+ type InboxGroupedSection,
+ type InboxTab,
+ type InboxWorkItem,
+ type InboxWorkItemGroupBy,
+} from "../lib/inbox";
+import { useDismissedInboxAlerts, useInboxDismissals, useReadInboxItems } from "../hooks/useInboxBadge";
+import { useInboxSortAttention } from "../hooks/useInboxSortAttention";
+import {
+ captureInboxOrderPin,
+ reconcileInboxOrderPin,
+ type InboxOrderPin,
+} from "../lib/inboxOrderPin";
+
+const INBOX_HEARTBEAT_RUN_LIMIT = 200;
+const INBOX_ISSUE_LIST_LIMIT = 500;
+const INBOX_HOT_PATH_STALE_MS = 30_000;
+
+export { InboxIssueMetaLeading, InboxIssueTrailingColumns } from "../components/IssueColumns";
+export { IssueGroupHeader as InboxGroupHeader } from "../components/IssueGroupHeader";
+type SectionKey =
+ | "work_items"
+ | "alerts";
+
+/** A flat navigation entry for keyboard j/k traversal that includes expanded children. */
+type NavEntry = InboxKeyboardNavEntry;
+// Stable identity for a nav row, resilient to the numeric index shifting when
+// the inbox reshapes (archive/poll). Used to re-anchor both the keyboard
+// selection and the hovered row across list refreshes.
+const navEntryKey = (entry: NavEntry | undefined): string | null =>
+ !entry
+ ? null
+ : entry.type === "top"
+ ? `top:${entry.itemKey}`
+ : entry.type === "child"
+ ? `child:${entry.issueId}`
+ : `group:${entry.groupKey}`;
+type CreatorOption = {
+ id: string;
+ label: string;
+ kind: "agent" | "user";
+ searchText?: string;
+};
+
+function firstNonEmptyLine(value: string | null | undefined): string | null {
+ if (!value) return null;
+ const line = value.split("\n").map((chunk) => chunk.trim()).find(Boolean);
+ return line ?? null;
+}
+
+function runFailureMessage(run: HeartbeatRun): string {
+ return firstNonEmptyLine(run.error) ?? firstNonEmptyLine(run.stderrExcerpt) ?? "Run exited with an error.";
+}
+
+function approvalStatusLabel(status: Approval["status"]): string {
+ return status.replaceAll("_", " ");
+}
+
+function readIssueIdFromRun(run: HeartbeatRun): string | null {
+ const context = run.contextSnapshot;
+ if (!context) return null;
+
+ const issueId = context["issueId"];
+ if (typeof issueId === "string" && issueId.length > 0) return issueId;
+
+ const taskId = context["taskId"];
+ if (typeof taskId === "string" && taskId.length > 0) return taskId;
+
+ return null;
+}
+
+function nonEmptyLabel(value: string | null | undefined): string | null {
+ const trimmed = value?.trim();
+ return trimmed ? trimmed : null;
+}
+
+export function formatJoinRequestInboxLabel(
+ joinRequest: Pick<
+ JoinRequest,
+ "requestType" | "agentName" | "requestEmailSnapshot" | "requestingUserId"
+ > & {
+ requesterUser?: {
+ name: string | null;
+ email: string | null;
+ } | null;
+ },
+) {
+ if (joinRequest.requestType !== "human") {
+ return `Agent join request${joinRequest.agentName ? `: ${joinRequest.agentName}` : ""}`;
+ }
+
+ const requesterName = nonEmptyLabel(joinRequest.requesterUser?.name);
+ const requesterEmail =
+ nonEmptyLabel(joinRequest.requesterUser?.email) ??
+ nonEmptyLabel(joinRequest.requestEmailSnapshot);
+ const requesterId = nonEmptyLabel(joinRequest.requestingUserId);
+
+ if (requesterName && requesterEmail) return `${requesterName} (${requesterEmail})`;
+ if (requesterEmail) return requesterEmail;
+ if (requesterName) return requesterName;
+ if (requesterId) return requesterId;
+ return "Human join request";
+}
+
+
+type NonIssueUnreadState = "visible" | "fading" | "hidden" | null;
+
+// Rows outside SwipeToArchive (non-archivable tabs/sections) still need the
+// hover-follows-selection band that SwipeToArchive's surface normally paints.
+function InboxRowSurface({ selected, children }: { selected: boolean; children: ReactNode }) {
+ return <div className={cn(selected && "rounded-lg bg-accent/50")}>{children}</div>;
+}
+
+export function FailedRunInboxRow({
+ run,
+ issueById,
+ agentName: linkedAgentName,
+ issueLinkState,
+ onDismiss,
+ onRetry,
+ isRetrying,
+ unreadState = null,
+ onMarkRead,
+ onArchive,
+ archiveDisabled,
+ selected = false,
+ className,
+}: {
+ run: HeartbeatRun;
+ issueById: Map<string, Issue>;
+ agentName: string | null;
+ issueLinkState: unknown;
+ onDismiss: () => void;
+ onRetry: () => void;
+ isRetrying: boolean;
+ unreadState?: NonIssueUnreadState;
+ onMarkRead?: () => void;
+ onArchive?: () => void;
+ archiveDisabled?: boolean;
+ selected?: boolean;
+ className?: string;
+}) {
+ const issueId = readIssueIdFromRun(run);
+ const issue = issueId ? issueById.get(issueId) ?? null : null;
+ const displayError = runFailureMessage(run);
+ const showUnreadSlot = unreadState !== null;
+ const showUnreadDot = unreadState === "visible" || unreadState === "fading";
+
+ return (
+ <div className={cn(
+ "group border-b border-border px-2 py-2.5 last:border-b-0 sm:px-1 sm:pr-3 sm:py-2",
+ className,
+ )}>
+ <div className="flex items-start gap-2 sm:items-center">
+ {showUnreadSlot ? (
+ <span className="hidden sm:inline-flex h-4 w-4 shrink-0 items-center justify-center self-center">
+ {showUnreadDot ? (
+ <button
+ type="button"
+ onClick={onMarkRead}
+ className={cn(
+ "inline-flex h-4 w-4 items-center justify-center rounded-full transition-colors",
+ "hover:bg-(--status-task-in_progress)/20",
+ )}
+ aria-label="Mark as read"
+ >
+ <span className={cn(
+ "block h-2 w-2 rounded-full transition-opacity duration-300",
+ "bg-(--status-task-in_progress)",
+ unreadState === "fading" ? "opacity-0" : "opacity-100",
+ )} />
+ </button>
+ ) : (
+ <span className="inline-flex h-4 w-4" aria-hidden="true" />
+ )}
+ </span>
+ ) : null}
+ <Link
+ to={`/agents/${run.agentId}/runs/${run.id}`}
+ className={cn(
+ "flex min-w-0 flex-1 items-start gap-2 no-underline text-inherit transition-colors",
+ selected ? "hover:bg-transparent" : "hover:bg-accent/50",
+ )}
+ >
+ {!showUnreadSlot && <span className="hidden h-2 w-2 shrink-0 sm:inline-flex" aria-hidden="true" />}
+ <span className="hidden h-3.5 w-3.5 shrink-0 sm:inline-flex" aria-hidden="true" />
+ <span className="mt-0.5 shrink-0 rounded-md bg-red-500/20 p-1.5 sm:mt-0">
+ <XCircle className="h-4 w-4 text-red-600 dark:text-red-400" />
+ </span>
+ <span className="min-w-0 flex-1">
+ <span className="line-clamp-2 text-sm font-medium sm:truncate sm:line-clamp-none">
+ {issue ? (
+ <>
+ <span className="font-mono text-muted-foreground mr-1.5">
+ {issue.identifier ?? issue.id.slice(0, 8)}
+ </span>
+ {issue.title}
+ </>
+ ) : (
+ <>Failed run{linkedAgentName ? ` — ${linkedAgentName}` : ""}</>
+ )}
+ </span>
+ <span className="mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground">
+ <StatusBadge status={run.status} />
+ {linkedAgentName && issue ? <span>{linkedAgentName}</span> : null}
+ <span className="truncate max-w-(--sz-300px)">{displayError}</span>
+ <span>{timeAgo(run.createdAt)}</span>
+ </span>
+ </span>
+ </Link>
+ <div className="hidden shrink-0 items-center gap-2 sm:flex">
+ {onArchive ? (
+ <InboxArchiveButton onArchive={onArchive} disabled={archiveDisabled} />
+ ) : null}
+ <Button
+ type="button"
+ variant="outline"
+ size="sm"
+ className="h-8 shrink-0 px-2.5"
+ onClick={onRetry}
+ disabled={isRetrying}
+ >
+ <RotateCcw className="mr-1.5 h-3.5 w-3.5" />
+ {isRetrying ? "Retrying…" : "Retry"}
+ </Button>
+ {!showUnreadSlot && (
+ <button
+ type="button"
+ onClick={onDismiss}
+ className="rounded-md p-1 text-muted-foreground opacity-0 transition-opacity hover:bg-accent hover:text-foreground group-hover:opacity-100"
+ aria-label="Dismiss"
+ >
+ <X className="h-4 w-4" />
+ </button>
+ )}
+ </div>
+ </div>
+ <div className="mt-3 flex gap-2 sm:hidden">
+ <Button
+ type="button"
+ variant="outline"
+ size="sm"
+ className="h-8 shrink-0 px-2.5"
+ onClick={onRetry}
+ disabled={isRetrying}
+ >
+ <RotateCcw className="mr-1.5 h-3.5 w-3.5" />
+ {isRetrying ? "Retrying…" : "Retry"}
+ </Button>
+ {!showUnreadSlot && (
+ <button
+ type="button"
+ onClick={onDismiss}
+ className="rounded-md p-1 text-muted-foreground hover:bg-accent hover:text-foreground"
+ aria-label="Dismiss"
+ >
+ <X className="h-4 w-4" />
+ </button>
+ )}
+ </div>
+ </div>
+ );
+}
+
+function ApprovalInboxRow({
+ approval,
+ requesterName,
+ onApprove,
+ onReject,
+ isPending,
+ unreadState = null,
+ onMarkRead,
+ onArchive,
+ archiveDisabled,
+ selected = false,
+ className,
+}: {
+ approval: Approval;
+ requesterName: string | null;
+ onApprove: () => void;
+ onReject: () => void;
+ isPending: boolean;
+ unreadState?: NonIssueUnreadState;
+ onMarkRead?: () => void;
+ onArchive?: () => void;
+ archiveDisabled?: boolean;
+ selected?: boolean;
+ className?: string;
+}) {
+ const Icon = typeIcon[approval.type] ?? defaultTypeIcon;
+ const label = approvalLabel(approval.type, approval.payload as Record<string, unknown> | null);
+ const showResolutionButtons =
+ approval.type !== "budget_override_required" &&
+ ACTIONABLE_APPROVAL_STATUSES.has(approval.status);
+ const showUnreadSlot = unreadState !== null;
+ const showUnreadDot = unreadState === "visible" || unreadState === "fading";
+
+ return (
+ <div className={cn(
+ "group border-b border-border px-2 py-2.5 last:border-b-0 sm:px-1 sm:pr-3 sm:py-2",
+ className,
+ )}>
+ <div className="flex items-start gap-2 sm:items-center">
+ {showUnreadSlot ? (
+ <span className="hidden sm:inline-flex h-4 w-4 shrink-0 items-center justify-center self-center">
+ {showUnreadDot ? (
+ <button
+ type="button"
+ onClick={onMarkRead}
+ className={cn(
+ "inline-flex h-4 w-4 items-center justify-center rounded-full transition-colors",
+ "hover:bg-(--status-task-in_progress)/20",
+ )}
+ aria-label="Mark as read"
+ >
+ <span className={cn(
+ "block h-2 w-2 rounded-full transition-opacity duration-300",
+ "bg-(--status-task-in_progress)",
+ unreadState === "fading" ? "opacity-0" : "opacity-100",
+ )} />
+ </button>
+ ) : (
+ <span className="inline-flex h-4 w-4" aria-hidden="true" />
+ )}
+ </span>
+ ) : null}
+ <Link
+ to={`/approvals/${approval.id}`}
+ className={cn(
+ "flex min-w-0 flex-1 items-start gap-2 no-underline text-inherit transition-colors",
+ selected ? "hover:bg-transparent" : "hover:bg-accent/50",
+ )}
+ >
+ {!showUnreadSlot && <span className="hidden h-2 w-2 shrink-0 sm:inline-flex" aria-hidden="true" />}
+ <span className="hidden h-3.5 w-3.5 shrink-0 sm:inline-flex" aria-hidden="true" />
+ <span className="mt-0.5 shrink-0 rounded-md bg-muted p-1.5 sm:mt-0">
+ <Icon className="h-4 w-4 text-muted-foreground" />
+ </span>
+ <span className="min-w-0 flex-1">
+ <span className="line-clamp-2 text-sm font-medium sm:truncate sm:line-clamp-none">
+ {label}
+ </span>
+ <span className="mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground">
+ <span className="capitalize">{approvalStatusLabel(approval.status)}</span>
+ {requesterName ? <span>requested by {requesterName}</span> : null}
+ <span>updated {timeAgo(approval.updatedAt)}</span>
+ </span>
+ </span>
+ </Link>
+ {(onArchive || showResolutionButtons) ? (
+ <div className="hidden shrink-0 items-center gap-2 sm:flex">
+ {onArchive ? (
+ <InboxArchiveButton onArchive={onArchive} disabled={archiveDisabled} />
+ ) : null}
+ {showResolutionButtons ? (
+ <>
+ <Button
+ size="sm"
+ className="h-8 bg-(--status-task-icon-done) px-3 text-white hover:bg-(--status-task-done)"
+ onClick={onApprove}
+ disabled={isPending}
+ >
+ Approve
+ </Button>
+ <Button
+ variant="destructive"
+ size="sm"
+ className="h-8 px-3"
+ onClick={onReject}
+ disabled={isPending}
+ >
+ Reject
+ </Button>
+ </>
+ ) : null}
+ </div>
+ ) : null}
+ </div>
+ {showResolutionButtons ? (
+ <div className="mt-3 flex gap-2 sm:hidden">
+ <Button
+ size="sm"
+ className="h-8 bg-(--status-task-icon-done) px-3 text-white hover:bg-(--status-task-done)"
+ onClick={onApprove}
+ disabled={isPending}
+ >
+ Approve
+ </Button>
+ <Button
+ variant="destructive"
+ size="sm"
+ className="h-8 px-3"
+ onClick={onReject}
+ disabled={isPending}
+ >
+ Reject
+ </Button>
+ </div>
+ ) : null}
+ </div>
+ );
+}
+
+function JoinRequestInboxRow({
+ joinRequest,
+ onApprove,
+ onReject,
+ isPending,
+ unreadState = null,
+ onMarkRead,
+ onArchive,
+ archiveDisabled,
+ selected = false,
+ className,
+}: {
+ joinRequest: JoinRequest;
+ onApprove: () => void;
+ onReject: () => void;
+ isPending: boolean;
+ unreadState?: NonIssueUnreadState;
+ onMarkRead?: () => void;
+ onArchive?: () => void;
+ archiveDisabled?: boolean;
+ selected?: boolean;
+ className?: string;
+}) {
+ const label = formatJoinRequestInboxLabel(joinRequest);
+ const showUnreadSlot = unreadState !== null;
+ const showUnreadDot = unreadState === "visible" || unreadState === "fading";
+
+ return (
+ <div className={cn(
+ "group border-b border-border px-2 py-2.5 last:border-b-0 sm:px-1 sm:pr-3 sm:py-2",
+ className,
+ )}>
+ <div className="flex items-start gap-2 sm:items-center">
+ {showUnreadSlot ? (
+ <span className="hidden sm:inline-flex h-4 w-4 shrink-0 items-center justify-center self-center">
+ {showUnreadDot ? (
+ <button
+ type="button"
+ onClick={onMarkRead}
+ className={cn(
+ "inline-flex h-4 w-4 items-center justify-center rounded-full transition-colors",
+ "hover:bg-(--status-task-in_progress)/20",
+ )}
+ aria-label="Mark as read"
+ >
+ <span className={cn(
+ "block h-2 w-2 rounded-full transition-opacity duration-300",
+ "bg-(--status-task-in_progress)",
+ unreadState === "fading" ? "opacity-0" : "opacity-100",
+ )} />
+ </button>
+ ) : (
+ <span className="inline-flex h-4 w-4" aria-hidden="true" />
+ )}
+ </span>
+ ) : null}
+ <div className="flex min-w-0 flex-1 items-start gap-2">
+ {!showUnreadSlot && <span className="hidden h-2 w-2 shrink-0 sm:inline-flex" aria-hidden="true" />}
+ <span className="hidden h-3.5 w-3.5 shrink-0 sm:inline-flex" aria-hidden="true" />
+ <span className="mt-0.5 shrink-0 rounded-md bg-muted p-1.5 sm:mt-0">
+ <UserPlus className="h-4 w-4 text-muted-foreground" />
+ </span>
+ <span className="min-w-0 flex-1">
+ <span className="line-clamp-2 text-sm font-medium sm:truncate sm:line-clamp-none">
+ {label}
+ </span>
+ <span className="mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground">
+ <span>requested {timeAgo(joinRequest.createdAt)} from IP {joinRequest.requestIp}</span>
+ {joinRequest.adapterType && <span>adapter: {joinRequest.adapterType}</span>}
+ </span>
+ </span>
+ </div>
+ <div className="hidden shrink-0 items-center gap-2 sm:flex">
+ {onArchive ? (
+ <InboxArchiveButton onArchive={onArchive} disabled={archiveDisabled} />
+ ) : null}
+ <Button
+ size="sm"
+ className="h-8 bg-(--status-task-icon-done) px-3 text-white hover:bg-(--status-task-done)"
+ onClick={onApprove}
+ disabled={isPending}
+ >
+ Approve
+ </Button>
+ <Button
+ variant="destructive"
+ size="sm"
+ className="h-8 px-3"
+ onClick={onReject}
+ disabled={isPending}
+ >
+ Reject
+ </Button>
+ </div>
+ </div>
+ <div className="mt-3 flex gap-2 sm:hidden">
+ <Button
+ size="sm"
+ className="h-8 bg-(--status-task-icon-done) px-3 text-white hover:bg-(--status-task-done)"
+ onClick={onApprove}
+ disabled={isPending}
+ >
+ Approve
+ </Button>
+ <Button
+ variant="destructive"
+ size="sm"
+ className="h-8 px-3"
+ onClick={onReject}
+ disabled={isPending}
+ >
+ Reject
+ </Button>
+ </div>
+ </div>
+ );
+}
+
+export function Inbox() {
+ const { selectedCompanyId } = useCompany();
+ const { setBreadcrumbs } = useBreadcrumbs();
+ const { openNewIssue } = useDialogActions();
+ const { isMobile } = useSidebar();
+ const navigate = useNavigate();
+ const location = useLocation();
+ const queryClient = useQueryClient();
+ const [actionError, setActionError] = useState<string | null>(null);
+ const { keyboardShortcutsEnabled } = useGeneralSettings();
+ const { data: experimentalSettings } = useQuery({
+ queryKey: queryKeys.instance.experimentalSettings,
+ queryFn: () => instanceSettingsApi.getExperimental(),
+ retry: false,
+ });
+ const experimentalSettingsLoaded = experimentalSettings !== undefined;
+ const [searchQuery, setSearchQuery] = useState("");
+ const normalizedSearchQuery = searchQuery.trim();
+ const [filterPreferences, setFilterPreferences] = useState<InboxFilterPreferences>(
+ () => loadInboxFilterPreferences(selectedCompanyId),
+ );
+ const [groupBy, setGroupBy] = useState<InboxWorkItemGroupBy>(() => loadInboxWorkItemGroupBy());
+ const [blockedGroupBy, setBlockedGroupBy] = useState<BlockedInboxGroupBy>("none");
+ const [blockedSortBy, setBlockedSortBy] = useState<BlockedInboxSort>("most_recent");
+ const [visibleIssueColumns, setVisibleIssueColumns] = useState<InboxIssueColumn[]>(loadInboxIssueColumns);
+ const { dismissed: dismissedAlerts, dismiss: dismissAlert } = useDismissedInboxAlerts();
+ const { dismissedAtByKey, dismiss: dismissInboxItem } = useInboxDismissals(selectedCompanyId);
+ const { readItems, markRead: markItemRead, markUnread: markItemUnread } = useReadInboxItems();
+ const { allCategoryFilter, allApprovalFilter, issueFilters } = filterPreferences;
+
+ const pathSegment = location.pathname.split("/").pop() ?? "mine";
+ const tab: InboxTab =
+ pathSegment === "mine"
+ || pathSegment === "recent"
+ || pathSegment === "all"
+ || pathSegment === "unread"
+ || pathSegment === "blocked"
+ ? pathSegment
+ : "mine";
+ const canArchiveFromTab = isMineInboxTab(tab);
+ const issueLinkState = useMemo(
+ () =>
+ createIssueDetailLocationState(
+ "Inbox",
+ `${location.pathname}${location.search}${location.hash}`,
+ "inbox",
+ ),
+ [location.pathname, location.search, location.hash],
+ );
+
+ const { data: session } = useQuery({
+ queryKey: queryKeys.auth.session,
+ queryFn: () => authApi.getSession(),
+ });
+
+ const { data: agents } = useQuery({
+ queryKey: queryKeys.agents.list(selectedCompanyId!),
+ queryFn: () => agentsApi.list(selectedCompanyId!),
+ enabled: !!selectedCompanyId,
+ });
+
+ const { data: projects } = useQuery({
+ queryKey: queryKeys.projects.list(selectedCompanyId!, { includeArchived: true }),
+ queryFn: () => projectsApi.list(selectedCompanyId!, { includeArchived: true }),
+ enabled: !!selectedCompanyId,
+ });
+ const { data: labels } = useQuery({
+ queryKey: queryKeys.issues.labels(selectedCompanyId!),
+ queryFn: () => issuesApi.listLabels(selectedCompanyId!),
+ enabled: !!selectedCompanyId,
+ });
+ const isolatedWorkspacesEnabled = experimentalSettings?.enableIsolatedWorkspaces === true;
+ const externalObjectsEnabled = experimentalSettings?.enableExternalObjects === true;
+ const { data: executionWorkspaces = [] } = useQuery({
+ queryKey: selectedCompanyId
+ ? queryKeys.executionWorkspaces.summaryList(selectedCompanyId)
+ : ["execution-workspaces", "__disabled__"],
+ queryFn: () => executionWorkspacesApi.listSummaries(selectedCompanyId!),
+ enabled: !!selectedCompanyId && isolatedWorkspacesEnabled,
+ });
+
+ useEffect(() => {
+ setBreadcrumbs([{ label: "Inbox" }]);
+ }, [setBreadcrumbs]);
+
+ useEffect(() => {
+ saveLastInboxTab(tab);
+ setSelectedIndex(-1);
+ setSearchQuery("");
+ }, [tab]);
+
+ const previousSelectedCompanyIdRef = useRef<string | null>(selectedCompanyId);
+ useEffect(() => {
+ if (previousSelectedCompanyIdRef.current !== selectedCompanyId) {
+ previousSelectedCompanyIdRef.current = selectedCompanyId;
+ setFilterPreferences(loadInboxFilterPreferences(selectedCompanyId));
+ setCollapsedGroupKeys(loadCollapsedInboxGroupKeys(selectedCompanyId));
+ setCollapsedInboxParents(loadCollapsedInboxParentIds(selectedCompanyId));
+ }
+ }, [selectedCompanyId]);
+
+ const {
+ data: approvals,
+ isLoading: isApprovalsLoading,
+ error: approvalsError,
+ } = useQuery({
+ queryKey: queryKeys.approvals.list(selectedCompanyId!),
+ queryFn: () => approvalsApi.list(selectedCompanyId!),
+ enabled: !!selectedCompanyId,
+ });
+
+ const {
+ data: joinRequests = [],
+ isLoading: isJoinRequestsLoading,
+ } = useQuery({
+ queryKey: queryKeys.access.joinRequests(selectedCompanyId!),
+ queryFn: async () => {
+ try {
+ return await accessApi.listJoinRequests(selectedCompanyId!, "pending_approval");
+ } catch (err) {
+ if (err instanceof ApiError && (err.status === 403 || err.status === 401)) {
+ return [];
+ }
+ throw err;
+ }
+ },
+ enabled: !!selectedCompanyId,
+ retry: false,
+ });
+
+ const dashboardQueryKey = queryKeys.dashboard(selectedCompanyId!);
+ const sharedDashboard = useSharedPollingQuery({
+ companyId: selectedCompanyId,
+ resourceKey: "dashboard",
+ queryKey: dashboardQueryKey,
+ enabled: !!selectedCompanyId,
+ });
+ const { data: dashboard, isLoading: isDashboardLoading, dataUpdatedAt: dashboardUpdatedAt } = useQuery({
+ queryKey: dashboardQueryKey,
+ queryFn: () => dashboardApi.summary(selectedCompanyId!),
+ enabled: !!selectedCompanyId,
+ });
+ usePublishSharedQueryData(sharedDashboard, dashboard, dashboardUpdatedAt);
+
+ const inboxIssuesQueryKey = [...queryKeys.issues.list(selectedCompanyId!), "compact", "with-routine-executions", "live-descendant-summary", INBOX_ISSUE_LIST_LIMIT] as const;
+ const sharedInboxIssues = useSharedPollingQuery<Issue[]>({
+ companyId: selectedCompanyId,
+ resourceKey: "inbox:issues",
+ queryKey: inboxIssuesQueryKey,
+ enabled: !!selectedCompanyId,
+ });
+ const { data: issues, isLoading: isIssuesLoading, dataUpdatedAt: issuesUpdatedAt } = useQuery({
+ queryKey: inboxIssuesQueryKey,
+ queryFn: () =>
+ issuesApi.listCompact(selectedCompanyId!, {
+ includeRoutineExecutions: true,
+ includeLiveDescendantSummary: true,
+ limit: INBOX_ISSUE_LIST_LIMIT,
+ }).then((rows) => rows as Issue[]),
+ enabled: !!selectedCompanyId,
+ refetchOnWindowFocus: false,
+ staleTime: INBOX_HOT_PATH_STALE_MS,
+ });
+ usePublishSharedQueryData(sharedInboxIssues, issues, issuesUpdatedAt);
+ const {
+ data: mineIssuesRaw = [],
+ isLoading: isMineIssuesLoading,
+ dataUpdatedAt: mineIssuesUpdatedAt,
+ } = useQuery({
+ queryKey: [...queryKeys.issues.listMineByMe(selectedCompanyId!), "compact", "with-routine-executions", "live-descendant-summary", INBOX_ISSUE_LIST_LIMIT] as const,
+ queryFn: () =>
+ issuesApi.listCompact(selectedCompanyId!, {
+ touchedByUserId: "me",
+ inboxArchivedByUserId: "me",
+ status: INBOX_MINE_ISSUE_STATUS_FILTER,
+ includeRoutineExecutions: true,
+ includeLiveDescendantSummary: true,
+ limit: INBOX_ISSUE_LIST_LIMIT,
+ }).then((rows) => rows as Issue[]),
+ enabled: !!selectedCompanyId,
+ refetchOnWindowFocus: false,
+ staleTime: INBOX_HOT_PATH_STALE_MS,
+ });
+ const mineIssuesQueryKey = [...queryKeys.issues.listMineByMe(selectedCompanyId!), "compact", "with-routine-executions", "live-descendant-summary", INBOX_ISSUE_LIST_LIMIT] as const;
+ const sharedMineIssues = useSharedPollingQuery<Issue[]>({
+ companyId: selectedCompanyId,
+ resourceKey: "inbox:mine-issues",
+ queryKey: mineIssuesQueryKey,
+ enabled: !!selectedCompanyId,
+ });
+ usePublishSharedQueryData(sharedMineIssues, mineIssuesRaw, mineIssuesUpdatedAt);
+ const {
+ data: touchedIssuesRaw = [],
+ isLoading: isTouchedIssuesLoading,
+ dataUpdatedAt: touchedIssuesUpdatedAt,
+ } = useQuery({
+ queryKey: [...queryKeys.issues.listTouchedByMe(selectedCompanyId!), "compact", "with-routine-executions", "live-descendant-summary", INBOX_ISSUE_LIST_LIMIT] as const,
+ queryFn: () =>
+ issuesApi.listCompact(selectedCompanyId!, {
+ touchedByUserId: "me",
+ status: INBOX_MINE_ISSUE_STATUS_FILTER,
+ includeRoutineExecutions: true,
+ includeLiveDescendantSummary: true,
+ limit: INBOX_ISSUE_LIST_LIMIT,
+ }).then((rows) => rows as Issue[]),
+ enabled: !!selectedCompanyId,
+ refetchOnWindowFocus: false,
+ staleTime: INBOX_HOT_PATH_STALE_MS,
+ });
+ const touchedIssuesQueryKey = [...queryKeys.issues.listTouchedByMe(selectedCompanyId!), "compact", "with-routine-executions", "live-descendant-summary", INBOX_ISSUE_LIST_LIMIT] as const;
+ const sharedTouchedIssues = useSharedPollingQuery<Issue[]>({
+ companyId: selectedCompanyId,
+ resourceKey: "inbox:touched-issues",
+ queryKey: touchedIssuesQueryKey,
+ enabled: !!selectedCompanyId,
+ });
+ usePublishSharedQueryData(sharedTouchedIssues, touchedIssuesRaw, touchedIssuesUpdatedAt);
+
+ const { data: heartbeatRuns, isLoading: isRunsLoading } = useQuery({
+ queryKey: [...queryKeys.heartbeats(selectedCompanyId!), "limit", INBOX_HEARTBEAT_RUN_LIMIT],
+ queryFn: () => heartbeatsApi.list(selectedCompanyId!, undefined, INBOX_HEARTBEAT_RUN_LIMIT, { summary: true }),
+ enabled: !!selectedCompanyId,
+ refetchOnWindowFocus: false,
+ staleTime: INBOX_HOT_PATH_STALE_MS,
+ });
+ const liveRunsQueryKey = queryKeys.liveRuns(selectedCompanyId!);
+ const sharedLiveRuns = useSharedPollingQuery({
+ companyId: selectedCompanyId,
+ resourceKey: "live-runs",
+ queryKey: liveRunsQueryKey,
+ enabled: !!selectedCompanyId,
+ // Event-sourced via LiveUpdatesProvider (GitHub issue 9627); no interval poll needed.
+ refetchInterval: false,
+ leaderOnly: true,
+ });
+ const { data: liveRuns, dataUpdatedAt: liveRunsUpdatedAt } = useQuery({
+ queryKey: liveRunsQueryKey,
+ queryFn: () => heartbeatsApi.liveRunsForCompany(selectedCompanyId!),
+ enabled: sharedLiveRuns.enabled,
+ refetchInterval: sharedLiveRuns.refetchInterval,
+ });
+ usePublishSharedQueryData(sharedLiveRuns, liveRuns, liveRunsUpdatedAt);
+ const { data: companyMembers } = useQuery({
+ queryKey: queryKeys.access.companyUserDirectory(selectedCompanyId!),
+ queryFn: () => accessApi.listUserDirectory(selectedCompanyId!),
+ enabled: !!selectedCompanyId,
+ });
+ const currentUserId = session?.user.id ?? session?.session.userId ?? null;
+ const [archivingIssueIds, setArchivingIssueIds] = useState<Set<string>>(new Set());
+ const [undoableArchiveIssueIds, setUndoableArchiveIssueIds] = useState<string[]>([]);
+ const [unarchivingIssueIds, setUnarchivingIssueIds] = useState<Set<string>>(new Set());
+ const guardedArchiveIssueIds = useLocalInboxArchiveIssueIds(selectedCompanyId);
+ const locallyArchivedIssueIds = useMemo(() => {
+ const issueIds = new Set(guardedArchiveIssueIds);
+ for (const issueId of undoableArchiveIssueIds) issueIds.add(issueId);
+ for (const issueId of archivingIssueIds) issueIds.add(issueId);
+ for (const issueId of unarchivingIssueIds) issueIds.delete(issueId);
+ return issueIds;
+ }, [archivingIssueIds, guardedArchiveIssueIds, undoableArchiveIssueIds, unarchivingIssueIds]);
+
+ const companyUserLabelMap = useMemo(
+ () => buildCompanyUserLabelMap(companyMembers?.users),
+ [companyMembers?.users],
+ );
+ const companyUserProfileMap = useMemo(
+ () => buildCompanyUserProfileMap(companyMembers?.users),
+ [companyMembers?.users],
+ );
+
+ const mineIssues = useMemo(
+ () => getRecentTouchedIssues(mineIssuesRaw).filter((issue) => !locallyArchivedIssueIds.has(issue.id)),
+ [locallyArchivedIssueIds, mineIssuesRaw],
+ );
+ const touchedIssues = useMemo(
+ () => getRecentTouchedIssues(touchedIssuesRaw).filter((issue) => !locallyArchivedIssueIds.has(issue.id)),
+ [locallyArchivedIssueIds, touchedIssuesRaw],
+ );
+ const shouldUseIssueSearchSupplement =
+ !!selectedCompanyId
+ && normalizedSearchQuery.length > 0;
+ const { data: remoteIssueSearchResults = [] } = useQuery({
+ queryKey: [
+ ...queryKeys.issues.search(selectedCompanyId!, normalizedSearchQuery, undefined, 25),
+ "compact",
+ "inbox-supplement",
+ "live-descendant-summary",
+ ],
+ queryFn: () =>
+ issuesApi.listCompact(selectedCompanyId!, {
+ q: normalizedSearchQuery,
+ limit: 25,
+ includeRoutineExecutions: true,
+ includeLiveDescendantSummary: true,
+ }).then((rows) => rows as Issue[]),
+ enabled: shouldUseIssueSearchSupplement,
+ placeholderData: (previousData) => previousData,
+ });
+ const liveIssueIds = useMemo(
+ () => collectLiveIssueIds(liveRuns, [
+ ...(issues ?? []),
+ ...mineIssuesRaw,
+ ...touchedIssuesRaw,
+ ...remoteIssueSearchResults,
+ ]),
+ [issues, liveRuns, mineIssuesRaw, remoteIssueSearchResults, touchedIssuesRaw],
+ );
+ const inboxIssueIdsForExternalObjectSummaries = useMemo(() => {
+ const issueIds = new Set<string>();
+ for (const issue of mineIssues) issueIds.add(issue.id);
+ for (const issue of touchedIssues) issueIds.add(issue.id);
+ for (const issue of remoteIssueSearchResults) issueIds.add(issue.id);
+ return [...issueIds];
+ }, [mineIssues, remoteIssueSearchResults, touchedIssues]);
+ const {
+ summaries: externalObjectSummaryByIssueId,
+ isLoading: externalObjectSummariesLoading,
+ isReady: externalObjectSummariesReady,
+ } = useIssueExternalObjectSummaries(
+ selectedCompanyId,
+ inboxIssueIdsForExternalObjectSummaries,
+ );
+ const issueFilterContext = useMemo(() => ({
+ externalObjectSummaryByIssueId,
+ externalObjectSummariesReady: externalObjectSummariesReady && !externalObjectSummariesLoading,
+ }), [externalObjectSummariesLoading, externalObjectSummariesReady, externalObjectSummaryByIssueId]);
+ const visibleMineIssues = useMemo(
+ () => applyIssueFilters(mineIssues, issueFilters, currentUserId, true, liveIssueIds, issueFilterContext),
+ [mineIssues, issueFilters, currentUserId, liveIssueIds, issueFilterContext],
+ );
+ const visibleTouchedIssues = useMemo(
+ () => applyIssueFilters(touchedIssues, issueFilters, currentUserId, true, liveIssueIds, issueFilterContext),
+ [touchedIssues, issueFilters, currentUserId, liveIssueIds, issueFilterContext],
+ );
+ const unreadTouchedIssues = useMemo(
+ () => visibleTouchedIssues.filter((issue) => issue.isUnreadForMe),
+ [visibleTouchedIssues],
+ );
+ const creatorOptions = useMemo<CreatorOption[]>(() => {
+ const options = new Map<string, CreatorOption>();
+ const sourceIssues = [...mineIssues, ...touchedIssues];
+
+ if (currentUserId) {
+ options.set(`user:${currentUserId}`, {
+ id: `user:${currentUserId}`,
+ label: currentUserId === "local-board" ? "Board" : "Me",
+ kind: "user",
+ searchText: currentUserId === "local-board" ? "board me human local-board" : `me board human ${currentUserId}`,
+ });
+ }
+
+ for (const issue of sourceIssues) {
+ if (issue.createdByUserId) {
+ const id = `user:${issue.createdByUserId}`;
+ if (!options.has(id)) {
+ options.set(id, {
+ id,
+ label: formatAssigneeUserLabel(issue.createdByUserId, currentUserId) ?? issue.createdByUserId.slice(0, 5),
+ kind: "user",
+ searchText: `${issue.createdByUserId} board user human`,
+ });
+ }
+ }
+ }
+
+ const knownAgentIds = new Set<string>();
+ for (const agent of agents ?? []) {
+ knownAgentIds.add(agent.id);
+ const id = `agent:${agent.id}`;
+ if (!options.has(id)) {
+ options.set(id, {
+ id,
+ label: agent.name,
+ kind: "agent",
+ searchText: `${agent.name} ${agent.id} agent`,
+ });
+ }
+ }
+
+ for (const issue of sourceIssues) {
+ if (issue.createdByAgentId && !knownAgentIds.has(issue.createdByAgentId)) {
+ const id = `agent:${issue.createdByAgentId}`;
+ if (!options.has(id)) {
+ options.set(id, {
+ id,
+ label: issue.createdByAgentId.slice(0, 8),
+ kind: "agent",
+ searchText: `${issue.createdByAgentId} agent`,
+ });
+ }
+ }
+ }
+
+ return [...options.values()].sort((a, b) => {
+ if (a.kind !== b.kind) return a.kind === "user" ? -1 : 1;
+ return a.label.localeCompare(b.label);
+ });
+ }, [agents, currentUserId, mineIssues, touchedIssues]);
+ const issuesToRender = useMemo(
+ () => {
+ if (tab === "mine") return visibleMineIssues;
+ if (tab === "unread") return unreadTouchedIssues;
+ return visibleTouchedIssues;
+ },
+ [tab, visibleMineIssues, visibleTouchedIssues, unreadTouchedIssues],
+ );
+
+ const agentById = useMemo(() => {
+ const map = new Map<string, string>();
+ for (const agent of agents ?? []) map.set(agent.id, agent.name);
+ return map;
+ }, [agents]);
+
+ const issueById = useMemo(() => {
+ const map = new Map<string, Issue>();
+ for (const issue of issues ?? []) map.set(issue.id, issue);
+ return map;
+ }, [issues]);
+ const projectById = useMemo(() => {
+ const map = new Map<string, { name: string; color: string | null }>();
+ for (const project of projects ?? []) {
+ map.set(project.id, { name: project.name, color: project.color });
+ }
+ return map;
+ }, [projects]);
+ const projectWorkspaceById = useMemo(() => {
+ const map = new Map<string, { name: string; projectId: string }>();
+ for (const project of projects ?? []) {
+ for (const workspace of project.workspaces ?? []) {
+ map.set(workspace.id, { name: workspace.name, projectId: project.id });
+ }
+ }
+ return map;
+ }, [projects]);
+ const defaultProjectWorkspaceIdByProjectId = useMemo(() => {
+ const map = new Map<string, string>();
+ for (const project of projects ?? []) {
+ const defaultWorkspaceId =
+ project.executionWorkspacePolicy?.defaultProjectWorkspaceId
+ ?? project.primaryWorkspace?.id
+ ?? null;
+ if (defaultWorkspaceId) map.set(project.id, defaultWorkspaceId);
+ }
+ return map;
+ }, [projects]);
+ const executionWorkspaceById = useMemo(() => {
+ const map = new Map<string, {
+ name: string;
+ mode: "shared_workspace" | "isolated_workspace" | "operator_branch" | "adapter_managed" | "cloud_sandbox";
+ projectWorkspaceId: string | null;
+ projectId: string | null;
+ }>();
+ for (const workspace of executionWorkspaces) {
+ const projectWorkspace = workspace.projectWorkspaceId
+ ? projectWorkspaceById.get(workspace.projectWorkspaceId) ?? null
+ : null;
+ map.set(workspace.id, {
+ name: workspace.name,
+ mode: workspace.mode,
+ projectWorkspaceId: workspace.projectWorkspaceId ?? null,
+ projectId: projectWorkspace?.projectId ?? null,
+ });
+ }
+ return map;
+ }, [executionWorkspaces, projectWorkspaceById]);
+ const inboxWorkspaceGrouping = useMemo<InboxWorkspaceGroupingOptions>(
+ () => ({
+ agentById,
+ executionWorkspaceById,
+ projectWorkspaceById,
+ defaultProjectWorkspaceIdByProjectId,
+ projectById,
+ userLabelById: companyUserLabelMap,
+ currentUserId,
+ }),
+ [
+ agentById,
+ companyUserLabelMap,
+ currentUserId,
+ defaultProjectWorkspaceIdByProjectId,
+ executionWorkspaceById,
+ projectById,
+ projectWorkspaceById,
+ ],
+ );
+ const visibleIssueColumnSet = useMemo(() => new Set(visibleIssueColumns), [visibleIssueColumns]);
+ const availableIssueColumns = useMemo(
+ () => getAvailableInboxIssueColumns(isolatedWorkspacesEnabled),
+ [isolatedWorkspacesEnabled],
+ );
+ const availableIssueColumnSet = useMemo(() => new Set(availableIssueColumns), [availableIssueColumns]);
+ const visibleTrailingIssueColumns = useMemo(
+ () => issueTrailingColumns.filter((column) => visibleIssueColumnSet.has(column) && availableIssueColumnSet.has(column)),
+ [availableIssueColumnSet, visibleIssueColumnSet],
+ );
+
+ const failedRuns = useMemo(
+ () =>
+ getLatestFailedRunsByAgent(heartbeatRuns ?? []).filter(
+ (r) => !isInboxEntityDismissed(dismissedAtByKey, `run:${r.id}`, r.createdAt),
+ ),
+ [heartbeatRuns, dismissedAtByKey],
+ );
+ const approvalsToRender = useMemo(() => {
+ let filtered = getApprovalsForTab(approvals ?? [], tab, allApprovalFilter, currentUserId);
+ if (tab === "mine") {
+ filtered = filtered.filter(
+ (a) => !isInboxEntityDismissed(dismissedAtByKey, `approval:${a.id}`, a.updatedAt),
+ );
+ }
+ return filtered;
+ }, [approvals, tab, allApprovalFilter, currentUserId, dismissedAtByKey]);
+ const showJoinRequestsCategory =
+ allCategoryFilter === "everything" || allCategoryFilter === "join_requests";
+ const showTouchedCategory =
+ allCategoryFilter === "everything" || allCategoryFilter === "issues_i_touched";
+ const showApprovalsCategory =
+ allCategoryFilter === "everything" || allCategoryFilter === "approvals";
+ const showFailedRunsCategory =
+ allCategoryFilter === "everything" || allCategoryFilter === "failed_runs";
+ const showAlertsCategory = allCategoryFilter === "everything" || allCategoryFilter === "alerts";
+ const failedRunsForTab = useMemo(() => {
+ if (tab === "all" && !showFailedRunsCategory) return [];
+ return failedRuns;
+ }, [failedRuns, tab, showFailedRunsCategory]);
+
+ const joinRequestsForTab = useMemo(() => {
+ if (tab === "all" && !showJoinRequestsCategory) return [];
+ if (tab === "mine") {
+ return joinRequests.filter(
+ (jr) => !isInboxEntityDismissed(dismissedAtByKey, `join:${jr.id}`, jr.updatedAt ?? jr.createdAt),
+ );
+ }
+ return joinRequests;
+ }, [joinRequests, tab, showJoinRequestsCategory, dismissedAtByKey]);
+
+ const workItemsToRender = useMemo(
+ () =>
+ getInboxWorkItems({
+ issues: tab === "all" && !showTouchedCategory ? [] : issuesToRender,
+ approvals: tab === "all" && !showApprovalsCategory ? [] : approvalsToRender,
+ failedRuns: failedRunsForTab,
+ joinRequests: joinRequestsForTab,
+ }),
+ [approvalsToRender, issuesToRender, showApprovalsCategory, showTouchedCategory, tab, failedRunsForTab, joinRequestsForTab],
+ );
+
+ const filteredWorkItems = useMemo(() => {
+ const q = normalizedSearchQuery.toLowerCase();
+ if (!q) return workItemsToRender;
+ return workItemsToRender.filter((item) => {
+ if (item.kind === "issue") {
+ return matchesInboxIssueSearch(item.issue, q, {
+ isolatedWorkspacesEnabled,
+ executionWorkspaceById,
+ projectWorkspaceById,
+ defaultProjectWorkspaceIdByProjectId,
+ });
+ }
+ if (item.kind === "approval") {
+ const a = item.approval;
+ const label = approvalLabel(a.type, a.payload as Record<string, unknown> | null);
+ if (label.toLowerCase().includes(q)) return true;
+ if (a.type.toLowerCase().includes(q)) return true;
+ return false;
+ }
+ if (item.kind === "failed_run") {
+ const run = item.run;
+ const name = agentById.get(run.agentId);
+ if (name?.toLowerCase().includes(q)) return true;
+ const msg = runFailureMessage(run);
+ if (msg.toLowerCase().includes(q)) return true;
+ const issueId = readIssueIdFromRun(run);
+ if (issueId) {
+ const issue = issueById.get(issueId);
+ if (issue?.title.toLowerCase().includes(q)) return true;
+ if (issue?.identifier?.toLowerCase().includes(q)) return true;
+ }
+ return false;
+ }
+ if (item.kind === "join_request") {
+ const jr = item.joinRequest;
+ if (jr.agentName?.toLowerCase().includes(q)) return true;
+ if (jr.capabilities?.toLowerCase().includes(q)) return true;
+ return false;
+ }
+ return false;
+ });
+ }, [
+ workItemsToRender,
+ agentById,
+ defaultProjectWorkspaceIdByProjectId,
+ executionWorkspaceById,
+ issueById,
+ isolatedWorkspacesEnabled,
+ normalizedSearchQuery,
+ projectWorkspaceById,
+ ]);
+
+ const archivedSearchIssues = useMemo(
+ () =>
+ tab === "mine"
+ ? getArchivedInboxSearchIssues({
+ visibleIssues: visibleMineIssues,
+ searchableIssues: visibleTouchedIssues,
+ query: normalizedSearchQuery,
+ isolatedWorkspacesEnabled,
+ executionWorkspaceById,
+ projectWorkspaceById,
+ defaultProjectWorkspaceIdByProjectId,
+ })
+ : [],
+ [
+ defaultProjectWorkspaceIdByProjectId,
+ executionWorkspaceById,
+ isolatedWorkspacesEnabled,
+ normalizedSearchQuery,
+ projectWorkspaceById,
+ tab,
+ visibleMineIssues,
+ visibleTouchedIssues,
+ ],
+ );
+ const issueSearchSupplementResults = useMemo(
+ () =>
+ getInboxSearchSupplementIssues({
+ query: normalizedSearchQuery,
+ filteredWorkItems,
+ archivedSearchIssues,
+ remoteIssues: remoteIssueSearchResults,
+ issueFilters,
+ currentUserId,
+ enableRoutineVisibilityFilter: true,
+ liveIssueIds,
+ issueFilterContext,
+ }),
+ [
+ archivedSearchIssues,
+ currentUserId,
+ filteredWorkItems,
+ issueFilterContext,
+ issueFilters,
+ liveIssueIds,
+ normalizedSearchQuery,
+ remoteIssueSearchResults,
+ ],
+ );
+ const nonInboxSearchIssueIds = useMemo(
+ () => new Set([
+ ...archivedSearchIssues.map((issue) => issue.id),
+ ...issueSearchSupplementResults.map((issue) => issue.id),
+ ]),
+ [archivedSearchIssues, issueSearchSupplementResults],
+ );
+
+ // --- Parent-child nesting for inbox issues ---
+ const [nestingPreferenceEnabled, setNestingPreferenceEnabled] = useState(() => loadInboxNesting());
+ const nestingEnabled = resolveInboxNestingEnabled(nestingPreferenceEnabled, isMobile);
+ useEffect(() => {
+ if (!shouldResetInboxWorkspaceGrouping(groupBy, isolatedWorkspacesEnabled, experimentalSettingsLoaded)) return;
+ setGroupBy("none");
+ saveInboxWorkItemGroupBy("none");
+ }, [experimentalSettingsLoaded, groupBy, isolatedWorkspacesEnabled]);
+ const toggleNesting = useCallback(() => {
+ setNestingPreferenceEnabled((prev) => {
+ const next = !prev;
+ saveInboxNesting(next);
+ return next;
+ });
+ }, []);
+ const [collapsedInboxParents, setCollapsedInboxParents] = useState<Set<string>>(
+ () => loadCollapsedInboxParentIds(selectedCompanyId),
+ );
+ const [collapsedGroupKeys, setCollapsedGroupKeys] = useState<Set<string>>(() => loadCollapsedInboxGroupKeys(selectedCompanyId));
+ const toggleGroupCollapse = useCallback((groupKey: string) => {
+ setCollapsedGroupKeys((prev) => {
+ const next = new Set(prev);
+ if (next.has(groupKey)) next.delete(groupKey);
+ else next.add(groupKey);
+ saveCollapsedInboxGroupKeys(selectedCompanyId, next);
+ return next;
+ });
+ }, [selectedCompanyId]);
+ const setGroupCollapsed = useCallback((groupKey: string, collapsed: boolean) => {
+ setCollapsedGroupKeys((prev) => {
+ if (collapsed ? prev.has(groupKey) : !prev.has(groupKey)) return prev;
+ const next = new Set(prev);
+ if (collapsed) next.add(groupKey);
+ else next.delete(groupKey);
+ saveCollapsedInboxGroupKeys(selectedCompanyId, next);
+ return next;
+ });
+ }, [selectedCompanyId]);
+ const freshGroupedSections = useMemo<InboxGroupedSection[]>(() => [
+ ...buildGroupedInboxSections(filteredWorkItems, groupBy, inboxWorkspaceGrouping, { nestingEnabled }),
+ ...buildGroupedInboxSections(
+ getInboxWorkItems({ issues: archivedSearchIssues, approvals: [] }),
+ groupBy,
+ inboxWorkspaceGrouping,
+ { keyPrefix: "archived-search:", searchSection: "archived", nestingEnabled },
+ ),
+ ...buildGroupedInboxSections(
+ getInboxWorkItems({ issues: issueSearchSupplementResults, approvals: [] }),
+ groupBy,
+ inboxWorkspaceGrouping,
+ { keyPrefix: "other-search:", searchSection: "other", nestingEnabled },
+ ),
+ ], [
+ archivedSearchIssues,
+ filteredWorkItems,
+ groupBy,
+ inboxWorkspaceGrouping,
+ issueSearchSupplementResults,
+ nestingEnabled,
+ ]);
+
+ // --- Order pinning (PAP-16015) ---
+ // The freshly computed sort is only *displayed* at attention boundaries. Between
+ // them we reconcile the fresh sections against the last committed order so that
+ // archiving mid-engagement (which drops rows from the caches, and can lower a
+ // parent's subtree-max sort ts) can no longer reshuffle the list under the
+ // cursor. New items still land at their algorithmic position; archived rows hold
+ // their slot for the 5s undo grace before collapsing. See `inboxOrderPin.ts`.
+ const orderPinRef = useRef<InboxOrderPin>({ sections: [] });
+ // Bumped by an attention commit to force `groupedSections` to adopt the fresh order.
+ const [orderCommitToken, setOrderCommitToken] = useState(0);
+ const orderCommitRequestedRef = useRef(false);
+ const commitInboxOrder = useCallback(() => {
+ orderCommitRequestedRef.current = true;
+ setOrderCommitToken((token) => token + 1);
+ }, []);
+
+ // Distinct view = distinct pin. Switching tab/filter/search/grouping resets the
+ // held order so we never carry one view's layout into another.
+ const inboxSortViewIdentity = useMemo(
+ () =>
+ JSON.stringify([
+ selectedCompanyId,
+ tab,
+ groupBy,
+ nestingEnabled,
+ normalizedSearchQuery,
+ allCategoryFilter,
+ allApprovalFilter,
+ issueFilters,
+ ]),
+ [
+ allApprovalFilter,
+ allCategoryFilter,
+ groupBy,
+ issueFilters,
+ nestingEnabled,
+ normalizedSearchQuery,
+ selectedCompanyId,
+ tab,
+ ],
+ );
+ // Adopt the fresh order in the SAME render the view identity changes, so a
+ // section key shared between the two views never briefly shows the previous
+ // view's order before the hook's passive commit effect runs.
+ const previousInboxSortViewIdentityRef = useRef(inboxSortViewIdentity);
+ if (previousInboxSortViewIdentityRef.current !== inboxSortViewIdentity) {
+ previousInboxSortViewIdentityRef.current = inboxSortViewIdentity;
+ orderCommitRequestedRef.current = true;
+ }
+
+ const groupedSections = useMemo<InboxGroupedSection[]>(() => {
+ const nowMs = Date.now();
+ // An attention boundary (or a view change) fired: adopt the fresh order
+ // wholesale and re-pin it.
+ if (orderCommitRequestedRef.current) {
+ orderCommitRequestedRef.current = false;
+ orderPinRef.current = captureInboxOrderPin(freshGroupedSections);
+ return freshGroupedSections;
+ }
+ const { sections, pin } = reconcileInboxOrderPin(orderPinRef.current, freshGroupedSections, nowMs);
+ orderPinRef.current = pin;
+ return sections;
+ // orderCommitToken forces re-adoption at a commit boundary; inboxSortViewIdentity
+ // forces it on a view change even when the fresh sections keep their identity.
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [freshGroupedSections, inboxSortViewIdentity, orderCommitToken]);
+
+ const inboxSortAttention = useInboxSortAttention({
+ viewIdentity: inboxSortViewIdentity,
+ onCommit: commitInboxOrder,
+ });
+ const noteInboxSortInteraction = inboxSortAttention.noteInteraction;
+
+ const openCreateIssueForGroup = useCallback((group: InboxGroupedSection) => {
+ const defaults = buildInboxIssueGroupCreateDefaults(
+ group.key,
+ groupBy,
+ group.displayItems,
+ inboxWorkspaceGrouping,
+ );
+ if (!defaults) return;
+ openNewIssue(defaults);
+ }, [groupBy, inboxWorkspaceGrouping, openNewIssue]);
+ const totalVisibleWorkItems = useMemo(
+ () => groupedSections.reduce((count, group) => count + group.displayItems.length, 0),
+ [groupedSections],
+ );
+ const toggleInboxParentCollapse = useCallback((parentId: string) => {
+ setCollapsedInboxParents((prev) => {
+ const next = new Set(prev);
+ if (next.has(parentId)) next.delete(parentId);
+ else next.add(parentId);
+ saveCollapsedInboxParentIds(selectedCompanyId, next);
+ return next;
+ });
+ }, [selectedCompanyId]);
+ const setInboxParentCollapsed = useCallback((parentId: string, collapsed: boolean) => {
+ setCollapsedInboxParents((prev) => {
+ if (prev.has(parentId) === collapsed) return prev;
+ const next = new Set(prev);
+ if (collapsed) next.add(parentId);
+ else next.delete(parentId);
+ saveCollapsedInboxParentIds(selectedCompanyId, next);
+ return next;
+ });
+ }, [selectedCompanyId]);
+
+ // Build flat navigation list from visible rows so keyboard traversal respects collapsed groups.
+ const flatNavItems = useMemo((): NavEntry[] => {
+ return buildInboxKeyboardNavEntries(groupedSections, collapsedGroupKeys, collapsedInboxParents);
+ }, [collapsedGroupKeys, collapsedInboxParents, groupedSections]);
+ // Read the current nav list from event handlers without recreating them (and
+ // without capturing a stale array), so hover can resolve the row's key.
+ const flatNavItemsRef = useRef(flatNavItems);
+ flatNavItemsRef.current = flatNavItems;
+ // Roll live descendant runs up to their ancestors across the loaded inbox tree
+ // so a parent that is not itself live can still surface "n live below".
+ const subtreeLiveCounts = useMemo(() => {
+ const nodes: { id: string; parentId: string | null }[] = [];
+ const seen = new Set<string>();
+ const pushIssue = (issue: Issue) => {
+ if (seen.has(issue.id)) return;
+ seen.add(issue.id);
+ nodes.push({ id: issue.id, parentId: issue.parentId });
+ };
+ for (const group of groupedSections) {
+ for (const item of group.displayItems) {
+ if (item.kind === "issue") pushIssue(item.issue);
+ }
+ for (const children of group.childrenByIssueId.values()) {
+ for (const child of children) pushIssue(child);
+ }
+ }
+ return collectSubtreeLiveCounts(nodes, liveIssueIds);
+ }, [groupedSections, liveIssueIds]);
+ const topFlatIndex = useMemo(() => {
+ const map = new Map<string, number>();
+ flatNavItems.forEach((entry, index) => {
+ if (entry.type === "top") map.set(entry.itemKey, index);
+ });
+ return map;
+ }, [flatNavItems]);
+ const childFlatIndex = useMemo(() => {
+ const map = new Map<string, number>();
+ flatNavItems.forEach((entry, index) => {
+ if (entry.type === "child") map.set(entry.issueId, index);
+ });
+ return map;
+ }, [flatNavItems]);
+ const groupFlatIndex = useMemo(() => {
+ const map = new Map<string, number>();
+ flatNavItems.forEach((entry, index) => {
+ if (entry.type === "group") map.set(entry.groupKey, index);
+ });
+ return map;
+ }, [flatNavItems]);
+
+ const agentName = (id: string | null) => {
+ if (!id) return null;
+ return agentById.get(id) ?? null;
+ };
+ const setIssueColumns = useCallback((next: InboxIssueColumn[]) => {
+ const normalized = normalizeInboxIssueColumns(next);
+ setVisibleIssueColumns(normalized);
+ saveInboxIssueColumns(normalized);
+ }, []);
+ const toggleIssueColumn = useCallback((column: InboxIssueColumn, enabled: boolean) => {
+ if (enabled) {
+ setIssueColumns([...visibleIssueColumns, column]);
+ return;
+ }
+ setIssueColumns(visibleIssueColumns.filter((value) => value !== column));
+ }, [setIssueColumns, visibleIssueColumns]);
+ const updateFilterPreferences = useCallback(
+ (updater: (previous: InboxFilterPreferences) => InboxFilterPreferences) => {
+ setFilterPreferences((previous) => {
+ const next = updater(previous);
+ saveInboxFilterPreferences(selectedCompanyId, next);
+ return next;
+ });
+ },
+ [selectedCompanyId],
+ );
+ const updateIssueFilters = useCallback((patch: Partial<IssueFilterState>) => {
+ updateFilterPreferences((previous) => ({
+ ...previous,
+ issueFilters: { ...previous.issueFilters, ...patch },
+ }));
+ }, [updateFilterPreferences]);
+ useEffect(() => {
+ if (!experimentalSettingsLoaded || externalObjectsEnabled || issueFilters.externalObjectStatuses.length === 0) return;
+ updateIssueFilters({ externalObjectStatuses: [] });
+ }, [
+ experimentalSettingsLoaded,
+ externalObjectsEnabled,
+ issueFilters.externalObjectStatuses.length,
+ updateIssueFilters,
+ ]);
+ const updateAllCategoryFilter = useCallback((value: InboxCategoryFilter) => {
+ updateFilterPreferences((previous) => ({ ...previous, allCategoryFilter: value }));
+ }, [updateFilterPreferences]);
+ const updateAllApprovalFilter = useCallback((value: InboxApprovalFilter) => {
+ updateFilterPreferences((previous) => ({ ...previous, allApprovalFilter: value }));
+ }, [updateFilterPreferences]);
+ const updateGroupBy = useCallback((nextGroupBy: InboxWorkItemGroupBy) => {
+ setGroupBy(nextGroupBy);
+ saveInboxWorkItemGroupBy(nextGroupBy);
+ }, []);
+
+ const approveMutation = useMutation({
+ mutationFn: (id: string) => approvalsApi.approve(id),
+ onSuccess: (_approval, id) => {
+ setActionError(null);
+ queryClient.invalidateQueries({ queryKey: queryKeys.approvals.list(selectedCompanyId!) });
+ navigate(`/approvals/${id}?resolved=approved`);
+ },
+ onError: (err) => {
+ setActionError(err instanceof Error ? err.message : "Failed to approve");
+ },
+ });
+
+ const rejectMutation = useMutation({
+ mutationFn: (id: string) => approvalsApi.reject(id),
+ onSuccess: () => {
+ setActionError(null);
+ queryClient.invalidateQueries({ queryKey: queryKeys.approvals.list(selectedCompanyId!) });
+ },
+ onError: (err) => {
+ setActionError(err instanceof Error ? err.message : "Failed to reject");
+ },
+ });
+
+ const approveJoinMutation = useMutation({
+ mutationFn: (joinRequest: JoinRequest) =>
+ accessApi.approveJoinRequest(selectedCompanyId!, joinRequest.id),
+ onSuccess: () => {
+ setActionError(null);
+ queryClient.invalidateQueries({ queryKey: queryKeys.access.joinRequests(selectedCompanyId!) });
+ queryClient.invalidateQueries({ queryKey: queryKeys.sidebarBadges(selectedCompanyId!) });
+ queryClient.invalidateQueries({ queryKey: queryKeys.agents.list(selectedCompanyId!) });
+ queryClient.invalidateQueries({ queryKey: queryKeys.companies.all });
+ },
+ onError: (err) => {
+ setActionError(err instanceof Error ? err.message : "Failed to approve join request");
+ },
+ });
+
+ const rejectJoinMutation = useMutation({
+ mutationFn: (joinRequest: JoinRequest) =>
+ accessApi.rejectJoinRequest(selectedCompanyId!, joinRequest.id),
+ onSuccess: () => {
+ setActionError(null);
+ queryClient.invalidateQueries({ queryKey: queryKeys.access.joinRequests(selectedCompanyId!) });
+ queryClient.invalidateQueries({ queryKey: queryKeys.sidebarBadges(selectedCompanyId!) });
+ },
+ onError: (err) => {
+ setActionError(err instanceof Error ? err.message : "Failed to reject join request");
+ },
+ });
+
+ const [retryingRunIds, setRetryingRunIds] = useState<Set<string>>(new Set());
+
+ const retryRunMutation = useMutation({
+ mutationFn: async (run: HeartbeatRun) => {
+ const payload: Record<string, unknown> = {};
+ const context = run.contextSnapshot as Record<string, unknown> | null;
+ if (context) {
+ if (typeof context.issueId === "string" && context.issueId) payload.issueId = context.issueId;
+ if (typeof context.taskId === "string" && context.taskId) payload.taskId = context.taskId;
+ if (typeof context.taskKey === "string" && context.taskKey) payload.taskKey = context.taskKey;
+ }
+ const result = await agentsApi.wakeup(run.agentId, {
+ source: "on_demand",
+ triggerDetail: "manual",
+ reason: "retry_failed_run",
+ payload,
+ });
+ if (!("id" in result)) {
+ throw new Error(result.message ?? "Retry was skipped.");
+ }
+ return { newRun: result, originalRun: run };
+ },
+ onMutate: (run) => {
+ setRetryingRunIds((prev) => new Set(prev).add(run.id));
+ },
+ onSuccess: ({ newRun, originalRun }) => {
+ queryClient.invalidateQueries({ queryKey: queryKeys.heartbeats(originalRun.companyId) });
+ queryClient.invalidateQueries({ queryKey: queryKeys.heartbeats(originalRun.companyId, originalRun.agentId) });
+ navigate(`/agents/${originalRun.agentId}/runs/${newRun.id}`);
+ },
+ onSettled: (_data, _error, run) => {
+ if (!run) return;
+ setRetryingRunIds((prev) => {
+ const next = new Set(prev);
+ next.delete(run.id);
+ return next;
+ });
+ },
+ });
+
+ const [fadingOutIssues, setFadingOutIssues] = useState<Set<string>>(new Set());
+ const [showMarkAllReadConfirm, setShowMarkAllReadConfirm] = useState(false);
+ const [fadingNonIssueItems, setFadingNonIssueItems] = useState<Set<string>>(new Set());
+ const [archivingNonIssueIds, setArchivingNonIssueIds] = useState<Set<string>>(new Set());
+ const [selectedIndex, setSelectedIndex] = useState<number>(-1);
+ const listRef = useRef<HTMLDivElement>(null);
+ // Keyboard nav scrolls the list, which fires mouseenter on whatever row lands
+ // under the stationary cursor — that must not steal the selection. Hover only
+ // selects after the pointer has physically moved since the last key nav.
+ const pointerMovedSinceKeyNavRef = useRef(true);
+ useEffect(() => {
+ const handlePointerMove = () => {
+ pointerMovedSinceKeyNavRef.current = true;
+ };
+ window.addEventListener("mousemove", handlePointerMove, { passive: true });
+ return () => window.removeEventListener("mousemove", handlePointerMove);
+ }, []);
+ // Which row the cursor is over, tracked WITHOUT React state so scrubbing the
+ // list costs zero re-renders (hover paints via CSS `:hover`, see IssueRow).
+ // Keyboard nav reads this to continue from the hovered row.
+ const hoveredIndexRef = useRef<number | null>(null);
+ // The hovered row's stable key, kept alongside the numeric index so a poll
+ // that reshapes the list can re-anchor the hover to the same row instead of
+ // dropping it (which stranded j/k back at the top — PAP-9679 regression).
+ const hoveredNavKeyRef = useRef<string | null>(null);
+ const setSelectedIndexFromPointer = useCallback((idx: number) => {
+ if (!pointerMovedSinceKeyNavRef.current) return;
+ noteInboxSortInteraction();
+ hoveredIndexRef.current = idx;
+ hoveredNavKeyRef.current = navEntryKey(flatNavItemsRef.current[idx]);
+ // Drop any keyboard selection band the moment the mouse takes over, so we
+ // never show two identical highlights at once. React bails out when the
+ // value is already -1, so continuous hovering triggers no re-render.
+ setSelectedIndex((prev) => (prev < 0 ? prev : -1));
+ }, [noteInboxSortInteraction]);
+
+ const invalidateInboxIssueQueryCaches = () => {
+ if (!selectedCompanyId) return;
+ invalidateInboxIssueQueries(queryClient, selectedCompanyId);
+ };
+
+ const archiveIssueMutation = useMutation({
+ mutationFn: (id: string) => issuesApi.archiveFromInbox(id),
+ onMutate: async (id) => {
+ // Keep the sort pinned: archiving is engagement, so defer any idle re-sort.
+ noteInboxSortInteraction();
+ setActionError(null);
+ setArchivingIssueIds((prev) => new Set(prev).add(id));
+
+ if (!selectedCompanyId) return { previousData: [] as InboxIssueCacheSnapshot };
+ beginLocalInboxArchive(selectedCompanyId, id);
+
+ await cancelInboxIssueQueries(queryClient, selectedCompanyId);
+ const previousData = snapshotInboxIssueCaches(queryClient, selectedCompanyId);
+ removeIssueFromInboxCaches(queryClient, selectedCompanyId, id);
+
+ return { companyId: selectedCompanyId, previousData };
+ },
+ onError: (err, id, context) => {
+ setActionError(err instanceof Error ? err.message : "Failed to archive task");
+ if (context?.companyId) clearLocalInboxArchive(context.companyId, id);
+ setArchivingIssueIds((prev) => {
+ const next = new Set(prev);
+ next.delete(id);
+ return next;
+ });
+ // Restore only this failed archive so overlapping archive mutations stay removed.
+ if (context?.previousData) {
+ restoreIssueToInboxCaches(queryClient, context.previousData, id);
+ }
+ },
+ onSettled: async (_data, error, id, context) => {
+ // Clean up archiving state and refetch to sync with server
+ setArchivingIssueIds((prev) => {
+ const next = new Set(prev);
+ next.delete(id);
+ return next;
+ });
+ if (!context?.companyId) return;
+ if (!error) boundLocalInboxArchive(context.companyId, id);
+ await invalidateInboxIssueQueries(queryClient, context.companyId);
+ if (!error) {
+ const presence = getIssuePresenceInActiveInboxCaches(queryClient, context.companyId, id);
+ if (presence !== "unknown") confirmLocalInboxArchive(context.companyId, id);
+ }
+ },
+ onSuccess: (_data, id) => {
+ setUndoableArchiveIssueIds((prev) => [...prev.filter((issueId) => issueId !== id), id]);
+ },
+ });
+
+ const unarchiveIssueMutation = useMutation({
+ mutationFn: (id: string) => issuesApi.unarchiveFromInbox(id),
+ onMutate: (id) => {
+ setActionError(null);
+ setUnarchivingIssueIds((prev) => new Set(prev).add(id));
+ if (selectedCompanyId) clearLocalInboxArchive(selectedCompanyId, id);
+ return { companyId: selectedCompanyId };
+ },
+ onError: (err, id, context) => {
+ setActionError(err instanceof Error ? err.message : "Failed to undo inbox archive");
+ if (context?.companyId) {
+ beginLocalInboxArchive(context.companyId, id);
+ boundLocalInboxArchive(context.companyId, id);
+ }
+ },
+ onSuccess: (_data, id) => {
+ setUndoableArchiveIssueIds((prev) => {
+ const next = prev.filter((issueId) => issueId !== id);
+ return next;
+ });
+ },
+ onSettled: (_data, _error, id) => {
+ setUnarchivingIssueIds((prev) => {
+ const next = new Set(prev);
+ next.delete(id);
+ return next;
+ });
+ invalidateInboxIssueQueryCaches();
+ },
+ });
+
+ const markReadMutation = useMutation({
+ mutationFn: (id: string) => issuesApi.markRead(id),
+ onMutate: (id) => {
+ setFadingOutIssues((prev) => new Set(prev).add(id));
+ },
+ onSuccess: () => {
+ invalidateInboxIssueQueryCaches();
+ },
+ onSettled: (_data, _error, id) => {
+ setTimeout(() => {
+ setFadingOutIssues((prev) => {
+ const next = new Set(prev);
+ next.delete(id);
+ return next;
+ });
+ }, 300);
+ },
+ });
+
+ const markAllReadMutation = useMutation({
+ mutationFn: async (issueIds: string[]) => {
+ await Promise.all(issueIds.map((issueId) => issuesApi.markRead(issueId)));
+ },
+ onMutate: (issueIds) => {
+ setFadingOutIssues((prev) => {
+ const next = new Set(prev);
+ for (const issueId of issueIds) next.add(issueId);
+ return next;
+ });
+ },
+ onSuccess: () => {
+ invalidateInboxIssueQueryCaches();
+ },
+ onSettled: (_data, _error, issueIds) => {
+ setTimeout(() => {
+ setFadingOutIssues((prev) => {
+ const next = new Set(prev);
+ for (const issueId of issueIds) next.delete(issueId);
+ return next;
+ });
+ }, 300);
+ },
+ });
+
+ const markUnreadMutation = useMutation({
+ mutationFn: (id: string) => issuesApi.markUnread(id),
+ onSuccess: () => {
+ invalidateInboxIssueQueryCaches();
+ },
+ });
+
+ const handleMarkNonIssueRead = useCallback((key: string) => {
+ setFadingNonIssueItems((prev) => new Set(prev).add(key));
+ markItemRead(key);
+ setTimeout(() => {
+ setFadingNonIssueItems((prev) => {
+ const next = new Set(prev);
+ next.delete(key);
+ return next;
+ });
+ }, 300);
+ }, [markItemRead]);
+
+ const handleArchiveNonIssue = useCallback((key: string) => {
+ noteInboxSortInteraction();
+ setArchivingNonIssueIds((prev) => new Set(prev).add(key));
+ setTimeout(() => {
+ if (key.startsWith("alert:")) {
+ dismissAlert(key);
+ } else {
+ dismissInboxItem(key);
+ }
+ setArchivingNonIssueIds((prev) => {
+ const next = new Set(prev);
+ next.delete(key);
+ return next;
+ });
+ }, 200);
+ }, [dismissAlert, dismissInboxItem, noteInboxSortInteraction]);
+
+ const nonIssueUnreadState = (key: string): NonIssueUnreadState => {
+ if (!canArchiveFromTab) return null;
+ const isRead = readItems.has(key);
+ const isFading = fadingNonIssueItems.has(key);
+ if (isFading) return "fading";
+ if (!isRead) return "visible";
+ return "hidden";
+ };
+
+ // Keep selection on the same logical item when the list shape changes —
+ // rows archived/refreshed above the selection would otherwise shift the
+ // numeric index onto a neighboring row (and Enter would open the wrong
+ // task). Falls back to clamping when the item is gone; never auto-selects
+ // on initial load.
+ const selectedNavKeyRef = useRef<string | null>(null);
+ useEffect(() => {
+ // A reshaped list invalidates the numeric hover index. Re-anchor it to the
+ // same row by key (the inbox polls constantly, so nulling it here silently
+ // broke hover→j/k sync — PAP-9679). Drop it only when the row is gone.
+ const hoveredKey = hoveredNavKeyRef.current;
+ const nextHovered =
+ hoveredKey === null ? -1 : flatNavItems.findIndex((entry) => navEntryKey(entry) === hoveredKey);
+ hoveredIndexRef.current = nextHovered >= 0 ? nextHovered : null;
+ if (nextHovered < 0) hoveredNavKeyRef.current = null;
+ setSelectedIndex((prev) => {
+ if (prev < 0) return resolveInboxSelectionIndex(prev, flatNavItems.length);
+ const prevKey = selectedNavKeyRef.current;
+ const keyIndex = prevKey === null
+ ? -1
+ : flatNavItems.findIndex((entry) => navEntryKey(entry) === prevKey);
+ return keyIndex >= 0 ? keyIndex : resolveInboxSelectionIndex(prev, flatNavItems.length);
+ });
+ }, [flatNavItems]);
+ useEffect(() => {
+ selectedNavKeyRef.current = selectedIndex >= 0 ? navEntryKey(flatNavItems[selectedIndex]) : null;
+ }, [flatNavItems, selectedIndex]);
+
+ useEffect(() => {
+ setUndoableArchiveIssueIds((prev) =>
+ prev.filter((issueId) => guardedArchiveIssueIds.has(issueId) || unarchivingIssueIds.has(issueId)),
+ );
+ }, [guardedArchiveIssueIds, unarchivingIssueIds]);
+
+ useEffect(() => {
+ setUndoableArchiveIssueIds([]);
+ setUnarchivingIssueIds(new Set());
+ }, [selectedCompanyId]);
+
+ // Use refs for keyboard handler to avoid stale closures
+ const kbStateRef = useRef({
+ workItems: groupedSections,
+ flatNavItems,
+ selectedIndex,
+ canArchive: canArchiveFromTab,
+ nonInboxSearchIssueIds,
+ archivingIssueIds,
+ undoableArchiveIssueIds,
+ unarchivingIssueIds,
+ archivingNonIssueIds,
+ fadingOutIssues,
+ readItems,
+ });
+ kbStateRef.current = {
+ workItems: groupedSections,
+ flatNavItems,
+ selectedIndex,
+ canArchive: canArchiveFromTab,
+ nonInboxSearchIssueIds,
+ archivingIssueIds,
+ undoableArchiveIssueIds,
+ unarchivingIssueIds,
+ archivingNonIssueIds,
+ fadingOutIssues,
+ readItems,
+ };
+
+ const kbActionsRef = useRef({
+ archiveIssue: (id: string) => archiveIssueMutation.mutate(id),
+ undoArchiveIssue: (id: string) => unarchiveIssueMutation.mutate(id),
+ archiveNonIssue: handleArchiveNonIssue,
+ markRead: (id: string) => markReadMutation.mutate(id),
+ markUnreadIssue: (id: string) => markUnreadMutation.mutate(id),
+ markNonIssueRead: handleMarkNonIssueRead,
+ markNonIssueUnread: markItemUnread,
+ setGroupCollapsed,
+ setInboxParentCollapsed,
+ navigate,
+ });
+ kbActionsRef.current = {
+ archiveIssue: (id: string) => archiveIssueMutation.mutate(id),
+ undoArchiveIssue: (id: string) => unarchiveIssueMutation.mutate(id),
+ archiveNonIssue: handleArchiveNonIssue,
+ markRead: (id: string) => markReadMutation.mutate(id),
+ markUnreadIssue: (id: string) => markUnreadMutation.mutate(id),
+ markNonIssueRead: handleMarkNonIssueRead,
+ markNonIssueUnread: markItemUnread,
+ setGroupCollapsed,
+ setInboxParentCollapsed,
+ navigate,
+ };
+
+ // Keyboard shortcuts (mail-client style) — single stable listener using refs
+ useEffect(() => {
+ if (!keyboardShortcutsEnabled) return;
+
+ const handleKeyDown = (e: KeyboardEvent) => {
+ if (e.defaultPrevented) return;
+
+ // Don't capture when typing in inputs/textareas or with modifier keys
+ const target = e.target;
+ if (
+ !(target instanceof HTMLElement) ||
+ isKeyboardShortcutTextInputTarget(target) ||
+ hasBlockingShortcutDialog(document) ||
+ e.metaKey ||
+ e.ctrlKey ||
+ e.altKey
+ ) {
+ return;
+ }
+
+ const st = kbStateRef.current;
+ const act = kbActionsRef.current;
+
+ // Navigation works on every tab; archive/undo (and a/y below) stay
+ // scoped to the "mine" tab, the only place items are archivable.
+ const undoArchiveAction = !st.canArchive ? "none" : resolveInboxUndoArchiveKeyAction({
+ hasUndoableArchive: st.undoableArchiveIssueIds.length > 0,
+ defaultPrevented: e.defaultPrevented,
+ key: e.key,
+ metaKey: e.metaKey,
+ ctrlKey: e.ctrlKey,
+ altKey: e.altKey,
+ target,
+ hasOpenDialog: hasBlockingShortcutDialog(document),
+ });
+ if (undoArchiveAction === "undo_archive") {
+ const issueId = st.undoableArchiveIssueIds[st.undoableArchiveIssueIds.length - 1];
+ if (!issueId || st.unarchivingIssueIds.has(issueId)) return;
+ e.preventDefault();
+ act.undoArchiveIssue(issueId);
+ return;
+ }
+
+ const navItems = st.flatNavItems;
+ const navCount = navItems.length;
+ if (navCount === 0) return;
+
+ // Any inbox keystroke (nav, archive, undo) is engagement: hold the sort.
+ noteInboxSortInteraction();
+
+ /** Resolve the nav entry at an index to an issue (for child entries) or work item. */
+ const resolveNavEntry = (idx: number): { issue?: Issue; item?: InboxWorkItem } => {
+ const entry = navItems[idx];
+ if (!entry) return {};
+ if (entry.type === "child") return { issue: entry.issue };
+ if (entry.type === "top") return { item: entry.item };
+ return {};
+ };
+
+ // The row a keystroke acts on: the hovered row when the mouse has moved
+ // since the last key nav (so "hover a row → press a/r/Enter/Arrow" acts on
+ // it), otherwise the keyboard selection. Hover no longer writes selection
+ // state, so this is what threads the pointer position into every handler.
+ const rawHovered = hoveredIndexRef.current;
+ const hoveredIndex = rawHovered != null && rawHovered >= 0 && rawHovered < navCount ? rawHovered : -1;
+ const fromHover = pointerMovedSinceKeyNavRef.current && hoveredIndex >= 0;
+ const effectiveIndex = fromHover ? hoveredIndex : st.selectedIndex;
+
+ switch (e.key) {
+ case "j":
+ case "ArrowDown": {
+ e.preventDefault();
+ pointerMovedSinceKeyNavRef.current = false;
+ setSelectedIndex(getInboxKeyboardSelectionIndex(effectiveIndex, navCount, "next"));
+ break;
+ }
+ case "k":
+ case "ArrowUp": {
+ e.preventDefault();
+ pointerMovedSinceKeyNavRef.current = false;
+ setSelectedIndex(getInboxKeyboardSelectionIndex(effectiveIndex, navCount, "previous"));
+ break;
+ }
+ case "ArrowLeft":
+ case "ArrowRight": {
+ if (effectiveIndex < 0 || effectiveIndex >= navCount) return;
+ const entry = navItems[effectiveIndex];
+ if (!entry) return;
+ if (entry.type === "group") {
+ e.preventDefault();
+ pointerMovedSinceKeyNavRef.current = false;
+ setSelectedIndex(effectiveIndex);
+ act.setGroupCollapsed(entry.groupKey, e.key === "ArrowLeft");
+ break;
+ }
+ // Parent tasks collapse/expand with the same keys as groups.
+ const { issue, item } = resolveNavEntry(effectiveIndex);
+ const targetIssue = issue ?? (item?.kind === "issue" ? item.issue : null);
+ if (!targetIssue) return;
+ const hasChildren = st.workItems.some(
+ (group) => (group.childrenByIssueId.get(targetIssue.id)?.length ?? 0) > 0,
+ );
+ if (!hasChildren) return;
+ e.preventDefault();
+ pointerMovedSinceKeyNavRef.current = false;
+ setSelectedIndex(effectiveIndex);
+ act.setInboxParentCollapsed(targetIssue.id, e.key === "ArrowLeft");
+ break;
+ }
+ case "a":
+ case "y": {
+ if (!st.canArchive) return;
+ if (effectiveIndex < 0 || effectiveIndex >= navCount) return;
+ e.preventDefault();
+ const { issue, item } = resolveNavEntry(effectiveIndex);
+ if (issue) {
+ if (!st.nonInboxSearchIssueIds.has(issue.id) && !st.archivingIssueIds.has(issue.id)) act.archiveIssue(issue.id);
+ } else if (item) {
+ if (item.kind === "issue") {
+ if (!st.nonInboxSearchIssueIds.has(item.issue.id) && !st.archivingIssueIds.has(item.issue.id)) {
+ act.archiveIssue(item.issue.id);
+ }
+ } else {
+ const key = getInboxWorkItemKey(item);
+ if (!st.archivingNonIssueIds.has(key)) act.archiveNonIssue(key);
+ }
+ }
+ break;
+ }
+ case "U": {
+ if (!st.canArchive) return;
+ if (effectiveIndex < 0 || effectiveIndex >= navCount) return;
+ e.preventDefault();
+ const { issue, item } = resolveNavEntry(effectiveIndex);
+ if (issue) {
+ act.markUnreadIssue(issue.id);
+ } else if (item) {
+ if (item.kind === "issue") act.markUnreadIssue(item.issue.id);
+ else act.markNonIssueUnread(getInboxWorkItemKey(item));
+ }
+ break;
+ }
+ case "r": {
+ if (!st.canArchive) return;
+ if (effectiveIndex < 0 || effectiveIndex >= navCount) return;
+ e.preventDefault();
+ const { issue, item } = resolveNavEntry(effectiveIndex);
+ if (issue) {
+ if (issue.isUnreadForMe && !st.fadingOutIssues.has(issue.id)) act.markRead(issue.id);
+ } else if (item) {
+ if (item.kind === "issue") {
+ if (item.issue.isUnreadForMe && !st.fadingOutIssues.has(item.issue.id)) act.markRead(item.issue.id);
+ } else {
+ const key = getInboxWorkItemKey(item);
+ if (!st.readItems.has(key)) act.markNonIssueRead(key);
+ }
+ }
+ break;
+ }
+ case "Enter": {
+ if (effectiveIndex < 0 || effectiveIndex >= navCount) return;
+ e.preventDefault();
+ const { issue, item } = resolveNavEntry(effectiveIndex);
+ if (issue) {
+ const pathId = issue.identifier ?? issue.id;
+ const detailState = armIssueDetailInboxQuickArchive(withIssueDetailHeaderSeed(issueLinkState, issue));
+ rememberIssueDetailLocationState(pathId, detailState);
+ void prefetchIssueDetailForNavigation(queryClient, pathId, { issue });
+ act.navigate(createIssueDetailPath(pathId), { state: detailState });
+ } else if (item) {
+ if (item.kind === "issue") {
+ const pathId = item.issue.identifier ?? item.issue.id;
+ const detailState = armIssueDetailInboxQuickArchive(
+ withIssueDetailHeaderSeed(issueLinkState, item.issue),
+ );
+ rememberIssueDetailLocationState(pathId, detailState);
+ void prefetchIssueDetailForNavigation(queryClient, pathId, { issue: item.issue });
+ act.navigate(createIssueDetailPath(pathId), { state: detailState });
+ } else if (item.kind === "approval") {
+ act.navigate(`/approvals/${item.approval.id}`);
+ } else if (item.kind === "failed_run") {
+ act.navigate(`/agents/${item.run.agentId}/runs/${item.run.id}`);
+ }
+ }
+ break;
+ }
+ default:
+ return;
+ }
+ };
+ window.addEventListener("keydown", handleKeyDown);
+ return () => window.removeEventListener("keydown", handleKeyDown);
+ }, [issueLinkState, keyboardShortcutsEnabled, noteInboxSortInteraction]);
+
+ // Scroll selected item into view
+ useEffect(() => {
+ if (selectedIndex < 0 || !listRef.current) return;
+ const rows = listRef.current.querySelectorAll("[data-inbox-item]");
+ const row = rows[selectedIndex];
+ if (row) row.scrollIntoView({ block: "nearest" });
+ }, [selectedIndex]);
+
+ if (!selectedCompanyId) {
+ return <EmptyState icon={InboxIcon} message="Select a company to view inbox." />;
+ }
+
+ const hasRunFailures = failedRuns.length > 0;
+ const showCompanyAlerts = shouldShowCompanyAlerts(tab) && showAlertsCategory;
+ const showAggregateAgentError =
+ showCompanyAlerts &&
+ !!dashboard &&
+ dashboard.agents.error > 0 &&
+ !hasRunFailures &&
+ !dismissedAlerts.has("alert:agent-errors");
+ const showBudgetAlert =
+ showCompanyAlerts &&
+ !!dashboard &&
+ dashboard.costs.monthBudgetCents > 0 &&
+ dashboard.costs.monthUtilizationPercent >= 80 &&
+ !dismissedAlerts.has("alert:budget");
+ const hasAlerts = showAggregateAgentError || showBudgetAlert;
+ const showWorkItemsSection = totalVisibleWorkItems > 0;
+ const showAlertsSection = shouldShowInboxSection({
+ tab,
+ hasItems: hasAlerts,
+ showOnMine: false,
+ showOnRecent: false,
+ showOnUnread: false,
+ showOnAll: hasAlerts,
+ });
+
+ const visibleSections = [
+ showAlertsSection ? "alerts" : null,
+ showWorkItemsSection ? "work_items" : null,
+ ].filter((key): key is SectionKey => key !== null);
+
+ const allLoaded =
+ !isJoinRequestsLoading &&
+ !isApprovalsLoading &&
+ !isDashboardLoading &&
+ !isIssuesLoading &&
+ !isMineIssuesLoading &&
+ !isTouchedIssuesLoading &&
+ !isRunsLoading;
+
+ const showSeparatorBefore = (key: SectionKey) => visibleSections.indexOf(key) > 0;
+ const markAllReadIssues = (tab === "mine" ? visibleMineIssues : unreadTouchedIssues)
+ .filter((issue) => issue.isUnreadForMe && !fadingOutIssues.has(issue.id) && !archivingIssueIds.has(issue.id));
+ const unreadIssueIds = markAllReadIssues
+ .map((issue) => issue.id);
+ const canMarkAllRead = unreadIssueIds.length > 0;
+ const activeIssueFilterCount = countActiveIssueFilters(issueFilters, true);
+ const showGeneralIssueToolbarControls = tab !== "blocked";
+ return (
+ <div className="space-y-6">
+ <div className="space-y-2">
+ {/* Search — full-width row on mobile, inline on desktop */}
+ <div className="relative sm:hidden">
+ <Search className="pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" />
+ <Input
+ type="search"
+ placeholder="Search inbox…"
+ value={searchQuery}
+ onChange={(e) => setSearchQuery(e.target.value)}
+ onKeyDown={(e) => {
+ if (shouldBlurPageSearchOnEnter({
+ key: e.key,
+ isComposing: e.nativeEvent.isComposing,
+ })) {
+ e.currentTarget.blur();
+ return;
+ }
+
+ if (shouldBlurPageSearchOnEscape({
+ key: e.key,
+ isComposing: e.nativeEvent.isComposing,
+ currentValue: e.currentTarget.value,
+ })) {
+ e.currentTarget.blur();
+ }
+ }}
+ className="h-8 w-full pl-8 text-xs"
+ data-page-search-target="true"
+ />
+ </div>
+ <div className="flex flex-wrap items-center justify-between gap-2">
+ <Tabs value={tab} onValueChange={(value) => navigate(`/inbox/${value}`)}>
+ <PageTabBar
+ items={[
+ {
+ value: "mine",
+ label: "Mine",
+ },
+ {
+ value: "recent",
+ label: "Recent",
+ },
+ { value: "unread", label: "Unread" },
+ { value: "blocked", label: "Blocked" },
+ { value: "all", label: "All" },
+ ]}
+ />
+ </Tabs>
+
+ <div className="flex items-center gap-2">
+ <div className="relative hidden sm:block">
+ <Search className="pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" />
+ <Input
+ type="search"
+ placeholder="Search inbox…"
+ value={searchQuery}
+ onChange={(e) => setSearchQuery(e.target.value)}
+ onKeyDown={(e) => {
+ if (shouldBlurPageSearchOnEnter({
+ key: e.key,
+ isComposing: e.nativeEvent.isComposing,
+ })) {
+ e.currentTarget.blur();
+ return;
+ }
+
+ if (shouldBlurPageSearchOnEscape({
+ key: e.key,
+ isComposing: e.nativeEvent.isComposing,
+ currentValue: e.currentTarget.value,
+ })) {
+ e.currentTarget.blur();
+ }
+ }}
+ className="h-8 w-(--sz-220px) pl-8 text-xs"
+ data-page-search-target="true"
+ />
+ </div>
+ {tab === "blocked" ? (
+ <>
+ <IssueFiltersPopover
+ presentation="legacy"
+ state={issueFilters}
+ onChange={updateIssueFilters}
+ activeFilterCount={activeIssueFilterCount}
+ agents={agents}
+ creators={creatorOptions}
+ projects={projects?.map((project) => ({ id: project.id, name: project.name }))}
+ labels={labels?.map((label) => ({ id: label.id, name: label.name, color: label.color }))}
+ currentUserId={currentUserId}
+ enableExternalObjectFilters={externalObjectsEnabled}
+ enableRoutineVisibilityFilter
+ buttonVariant="outline"
+ iconOnly
+ workspaces={isolatedWorkspacesEnabled ? executionWorkspaces.filter((w) => w.mode === "isolated_workspace").map((w) => ({ id: w.id, name: w.name })) : undefined}
+ />
+ <Popover>
+ <PopoverTrigger asChild>
+ <Button
+ type="button"
+ variant="outline"
+ size="icon"
+ className={cn("h-8 w-8 shrink-0", blockedGroupBy !== "none" && "bg-accent")}
+ title="Group"
+ >
+ <Layers className="h-3.5 w-3.5" />
+ </Button>
+ </PopoverTrigger>
+ <PopoverContent align="end" className="w-44 p-0">
+ <div className="space-y-0.5 p-2">
+ {BLOCKED_GROUP_OPTIONS.map(([value, label]) => (
+ <button
+ key={value}
+ type="button"
+ className={cn(
+ "flex w-full items-center justify-between rounded-sm px-2 py-1.5 text-sm",
+ blockedGroupBy === value ? "bg-accent/50 text-foreground" : "text-muted-foreground hover:bg-accent/50",
+ )}
+ onClick={() => setBlockedGroupBy(value)}
+ >
+ <span>{label}</span>
+ {blockedGroupBy === value ? <Check className="h-3.5 w-3.5" /> : null}
+ </button>
+ ))}
+ </div>
+ </PopoverContent>
+ </Popover>
+ <IssueColumnPicker
+ availableColumns={availableIssueColumns}
+ visibleColumnSet={visibleIssueColumnSet}
+ onToggleColumn={toggleIssueColumn}
+ onResetColumns={() => setIssueColumns(DEFAULT_INBOX_ISSUE_COLUMNS)}
+ title="Choose which inbox columns stay visible"
+ iconOnly
+ />
+ <Popover>
+ <PopoverTrigger asChild>
+ <Button
+ type="button"
+ variant="outline"
+ size="icon"
+ className="h-8 w-8 shrink-0"
+ title="Sort"
+ >
+ <ArrowUpDown className="h-3.5 w-3.5" />
+ </Button>
+ </PopoverTrigger>
+ <PopoverContent align="end" className="w-48 p-0">
+ <div className="space-y-0.5 p-2">
+ {BLOCKED_SORT_OPTIONS.map(([value, label]) => (
+ <button
+ key={value}
+ type="button"
+ className={cn(
+ "flex w-full items-center justify-between rounded-sm px-2 py-1.5 text-sm",
+ blockedSortBy === value ? "bg-accent/50 text-foreground" : "text-muted-foreground hover:bg-accent/50",
+ )}
+ onClick={() => setBlockedSortBy(value)}
+ >
+ <span>{label}</span>
+ {blockedSortBy === value ? <Check className="h-3.5 w-3.5" /> : null}
+ </button>
+ ))}
+ </div>
+ </PopoverContent>
+ </Popover>
+ </>
+ ) : showGeneralIssueToolbarControls ? (
+ <>
+ <Button
+ type="button"
+ variant="outline"
+ size="icon"
+ className={cn("hidden h-8 w-8 shrink-0 sm:inline-flex", nestingEnabled && "bg-accent")}
+ onClick={toggleNesting}
+ title={nestingEnabled ? "Disable parent-child nesting" : "Enable parent-child nesting"}
+ >
+ <ListTree className="h-3.5 w-3.5" />
+ </Button>
+ <IssueFiltersPopover
+ presentation="legacy"
+ state={issueFilters}
+ onChange={updateIssueFilters}
+ activeFilterCount={activeIssueFilterCount}
+ agents={agents}
+ creators={creatorOptions}
+ projects={projects?.map((project) => ({ id: project.id, name: project.name }))}
+ labels={labels?.map((label) => ({ id: label.id, name: label.name, color: label.color }))}
+ currentUserId={currentUserId}
+ enableExternalObjectFilters={externalObjectsEnabled}
+ enableRoutineVisibilityFilter
+ buttonVariant="outline"
+ iconOnly
+ workspaces={isolatedWorkspacesEnabled ? executionWorkspaces.filter((w) => w.mode === "isolated_workspace").map((w) => ({ id: w.id, name: w.name })) : undefined}
+ />
+ <Popover>
+ <PopoverTrigger asChild>
+ <Button
+ type="button"
+ variant="outline"
+ size="icon"
+ className={cn("h-8 w-8 shrink-0", groupBy !== "none" && "bg-accent")}
+ title="Group"
+ >
+ <Layers className="h-3.5 w-3.5" />
+ </Button>
+ </PopoverTrigger>
+ <PopoverContent align="end" className="w-40 p-2">
+ <div className="space-y-0.5">
+ {([
+ ["none", "None"],
+ ["type", "Type"],
+ ["assignee", "Responsible"],
+ ["project", "Project"],
+ ...(isolatedWorkspacesEnabled ? ([["workspace", "Workspace"]] as const) : []),
+ ] as const).map(([value, label]) => (
+ <button
+ key={value}
+ type="button"
+ className={cn(
+ "flex w-full items-center justify-between rounded-sm px-2 py-1.5 text-sm",
+ groupBy === value ? "bg-accent/50 text-foreground" : "text-muted-foreground hover:bg-accent/50",
+ )}
+ onClick={() => updateGroupBy(value)}
+ >
+ <span>{label}</span>
+ {groupBy === value ? <Check className="h-3.5 w-3.5" /> : null}
+ </button>
+ ))}
+ </div>
+ </PopoverContent>
+ </Popover>
+ <IssueColumnPicker
+ availableColumns={availableIssueColumns}
+ visibleColumnSet={visibleIssueColumnSet}
+ onToggleColumn={toggleIssueColumn}
+ onResetColumns={() => setIssueColumns(DEFAULT_INBOX_ISSUE_COLUMNS)}
+ title="Choose which inbox columns stay visible"
+ iconOnly
+ />
+ {canMarkAllRead && (
+ <>
+ <Button
+ type="button"
+ variant="outline"
+ size="sm"
+ className="h-8 shrink-0"
+ onClick={() => setShowMarkAllReadConfirm(true)}
+ disabled={markAllReadMutation.isPending}
+ >
+ {markAllReadMutation.isPending ? "Marking…" : "Mark all as read"}
+ </Button>
+ <Dialog open={showMarkAllReadConfirm} onOpenChange={setShowMarkAllReadConfirm}>
+ <DialogContent className="sm:max-w-md">
+ <DialogHeader>
+ <DialogTitle>Mark all as read?</DialogTitle>
+ <DialogDescription>
+ This will mark {unreadIssueIds.length} unread {unreadIssueIds.length === 1 ? "item" : "items"} as read.
+ </DialogDescription>
+ </DialogHeader>
+ <DialogFooter>
+ <Button variant="outline" onClick={() => setShowMarkAllReadConfirm(false)}>
+ Cancel
+ </Button>
+ <Button
+ onClick={() => {
+ setShowMarkAllReadConfirm(false);
+ markAllReadMutation.mutate(unreadIssueIds);
+ }}
+ >
+ Mark all as read
+ </Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
+ </>
+ )}
+ </>
+ ) : null}
+ </div>
+ </div>
+ </div>
+
+ {tab === "all" && (
+ <div className="flex flex-wrap items-center gap-2">
+ <Select
+ value={allCategoryFilter}
+ onValueChange={(value) => updateAllCategoryFilter(value as InboxCategoryFilter)}
+ >
+ <SelectTrigger className="h-8 w-(--sz-170px) text-xs">
+ <SelectValue placeholder="Category" />
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem value="everything">All categories</SelectItem>
+ <SelectItem value="issues_i_touched">My recent tasks</SelectItem>
+ <SelectItem value="join_requests">Join requests</SelectItem>
+ <SelectItem value="approvals">Approvals</SelectItem>
+ <SelectItem value="failed_runs">Failed runs</SelectItem>
+ <SelectItem value="alerts">Alerts</SelectItem>
+ </SelectContent>
+ </Select>
+
+ {showApprovalsCategory && (
+ <Select
+ value={allApprovalFilter}
+ onValueChange={(value) => updateAllApprovalFilter(value as InboxApprovalFilter)}
+ >
+ <SelectTrigger className="h-8 w-(--sz-170px) text-xs">
+ <SelectValue placeholder="Approval status" />
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem value="all">All approval statuses</SelectItem>
+ <SelectItem value="actionable">Needs action</SelectItem>
+ <SelectItem value="resolved">Resolved</SelectItem>
+ </SelectContent>
+ </Select>
+ )}
+ </div>
+ )}
+
+ {approvalsError && <p className="text-sm text-destructive">{approvalsError.message}</p>}
+ {actionError && <p className="text-sm text-destructive">{actionError}</p>}
+
+ {tab === "blocked" ? (
+ <BlockedInboxView
+ presentation="legacy"
+ companyId={selectedCompanyId!}
+ searchQuery={searchQuery}
+ agentNameById={agentById}
+ userLabelById={companyUserLabelMap}
+ issueLinkState={issueLinkState}
+ groupBy={blockedGroupBy}
+ sortBy={blockedSortBy}
+ issueFilters={issueFilters}
+ currentUserId={currentUserId}
+ liveIssueIds={liveIssueIds}
+ subtreeLiveCounts={subtreeLiveCounts}
+ workspaceFilterContext={inboxWorkspaceGrouping}
+ showStatusColumn={visibleIssueColumnSet.has("status") && availableIssueColumnSet.has("status")}
+ showIdentifierColumn={visibleIssueColumnSet.has("id") && availableIssueColumnSet.has("id")}
+ showUpdatedColumn={visibleIssueColumnSet.has("updated") && availableIssueColumnSet.has("updated")}
+ />
+ ) : null}
+
+ {tab !== "blocked" && !allLoaded && visibleSections.length === 0 && (
+ <PageSkeleton variant="inbox" />
+ )}
+
+ {tab !== "blocked" && allLoaded && visibleSections.length === 0 && (
+ <EmptyState
+ icon={searchQuery.trim() ? Search : InboxIcon}
+ message={
+ searchQuery.trim()
+ ? "No inbox items match your search."
+ : tab === "mine"
+ ? "Inbox zero."
+ : tab === "unread"
+ ? "No new inbox items."
+ : tab === "recent"
+ ? "No recent inbox items."
+ : "No inbox items match these filters."
+ }
+ />
+ )}
+
+ {tab !== "blocked" && showWorkItemsSection && (
+ <>
+ {showSeparatorBefore("work_items") && <Separator />}
+ <div>
+ <div
+ ref={listRef}
+ className="overflow-hidden"
+ onPointerDownCapture={noteInboxSortInteraction}
+ onWheelCapture={noteInboxSortInteraction}
+ >
+ {(() => {
+ const renderInboxIssue = ({
+ issue,
+ depth,
+ selected,
+ hasChildren = false,
+ isExpanded = false,
+ childCount = 0,
+ collapseParentId = null,
+ allowArchive = canArchiveFromTab,
+ }: {
+ issue: Issue;
+ depth: number;
+ selected: boolean;
+ hasChildren?: boolean;
+ isExpanded?: boolean;
+ childCount?: number;
+ collapseParentId?: string | null;
+ allowArchive?: boolean;
+ }) => {
+ const isUnread = issue.isUnreadForMe && !fadingOutIssues.has(issue.id);
+ const isFading = fadingOutIssues.has(issue.id);
+ const isArchiving = archivingIssueIds.has(issue.id);
+ const project = issue.projectId ? projectById.get(issue.projectId) ?? null : null;
+ const assigneeUserProfile = issue.assigneeUserId
+ ? companyUserProfileMap.get(issue.assigneeUserId) ?? null
+ : null;
+ const originatingActor = deriveOriginatingActor(issue);
+ const originatingUserId = originatingActor?.kind === "user" ? originatingActor.id : null;
+ const originatingViaAgentId =
+ originatingActor?.kind === "user" ? originatingActor.viaAgentId ?? null : null;
+ const isLive = liveIssueIds.has(issue.id);
+ const loadedSubtreeLiveCount = subtreeLiveCounts.get(issue.id) ?? 0;
+ const liveDescendantCount = resolveIssueLiveDescendantCount(issue, loadedSubtreeLiveCount);
+ const blockerAttention = resolveInboxIssueBlockerAttention(issue, {
+ isLive,
+ loadedSubtreeLiveCount,
+ });
+ const showStatus = visibleIssueColumnSet.has("status") && availableIssueColumnSet.has("status");
+ const showSubtreeLiveChip = !(
+ showStatus
+ && issue.status === "blocked"
+ && blockerAttention?.state === "covered"
+ );
+ const rowStatusIcon = (
+ <StatusIcon status={issue.status} blockerAttention={blockerAttention} size="md" />
+ );
+ return (
+ <IssueRow
+ key={`issue:${issue.id}`}
+ issue={issue}
+ issueLinkState={issueLinkState}
+ treeGuides={depth}
+ selected={selected}
+ className={
+ isArchiving
+ ? "pointer-events-none -translate-x-4 scale-(--s-0_98) opacity-0 transition-all duration-200 ease-out"
+ : "transition-all duration-200 ease-out"
+ }
+ desktopMetaLeading={
+ <>
+ {nestingEnabled ? (
+ depth === 0 && hasChildren && collapseParentId ? (
+ <button
+ type="button"
+ data-slot="icon-button"
+ className="hidden w-4 shrink-0 items-center justify-center sm:inline-flex"
+ onClick={(event) => {
+ event.preventDefault();
+ event.stopPropagation();
+ toggleInboxParentCollapse(collapseParentId);
+ }}
+ >
+ <ChevronRight className={cn("h-3.5 w-3.5 transition-transform", isExpanded && "rotate-90")} />
+ </button>
+ ) : (
+ // Every non-chevron row reserves this spacer so the
+ // status column lines up under the parent rows'
+ // collapse chevron. (The unread mark-read dot has
+ // its own reserved leading slot in IssueRow, to the
+ // left of this spacer.)
+ <span className="hidden w-4 shrink-0 sm:block" />
+ )
+ ) : null}
+ <InboxIssueMetaLeading
+ issue={issue}
+ isLive={isLive}
+ subtreeLiveCount={liveDescendantCount}
+ showSubtreeLiveChip={showSubtreeLiveChip}
+ showStatus={showStatus}
+ showIdentifier={visibleIssueColumnSet.has("id") && availableIssueColumnSet.has("id")}
+ statusSlot={rowStatusIcon}
+ />
+ </>
+ }
+ titleSuffix={hasChildren && !isExpanded && depth === 0 ? (
+ <span className="ml-1.5 text-xs text-muted-foreground">
+ ({childCount} sub-task{childCount !== 1 ? "s" : ""})
+ </span>
+ ) : undefined}
+ mobileMeta={issueActivityText(issue).toLowerCase()}
+ mobileLeading={
+ depth === 0 && hasChildren && collapseParentId ? (
+ <button
+ type="button"
+ data-slot="icon-button"
+ onClick={(event) => {
+ event.preventDefault();
+ event.stopPropagation();
+ toggleInboxParentCollapse(collapseParentId);
+ }}
+ >
+ <ChevronRight className={cn("h-3.5 w-3.5 transition-transform", isExpanded && "rotate-90")} />
+ </button>
+ ) : (
+ <StatusIcon status={issue.status} blockerAttention={blockerAttention} size="md" />
+ )
+ }
+ unreadState={isUnread ? "visible" : isFading ? "fading" : "hidden"}
+ onMarkRead={() => markReadMutation.mutate(issue.id)}
+ onArchive={allowArchive ? () => archiveIssueMutation.mutate(issue.id) : undefined}
+ archiveDisabled={isArchiving}
+ desktopTrailing={
+ visibleTrailingIssueColumns.length > 0 ? (
+ <InboxIssueTrailingColumns
+ issue={issue}
+ columns={visibleTrailingIssueColumns}
+ projectName={project?.name ?? null}
+ projectColor={project?.color ?? null}
+ workspaceName={resolveIssueWorkspaceName(issue, {
+ executionWorkspaceById,
+ projectWorkspaceById,
+ defaultProjectWorkspaceIdByProjectId,
+ })}
+ assigneeName={agentName(issue.assigneeAgentId)}
+ assigneeUserName={
+ formatAssigneeUserLabel(issue.assigneeUserId, currentUserId, companyUserLabelMap)
+ ?? assigneeUserProfile?.label
+ ?? null
+ }
+ assigneeUserAvatarUrl={assigneeUserProfile?.image ?? null}
+ creatorAgentName={agentName(issue.createdByAgentId)}
+ creatorUserName={originatingUserId ? (companyUserProfileMap.get(originatingUserId)?.label ?? null) : null}
+ creatorUserAvatarUrl={originatingUserId ? (companyUserProfileMap.get(originatingUserId)?.image ?? null) : null}
+ viaAgentName={originatingViaAgentId ? agentName(originatingViaAgentId) : null}
+ currentUserId={currentUserId}
+ parentIdentifier={issue.parentId ? (issueById.get(issue.parentId)?.identifier ?? null) : null}
+ parentTitle={issue.parentId ? (issueById.get(issue.parentId)?.title ?? null) : null}
+ />
+ ) : undefined
+ }
+ />
+ );
+ };
+
+ let previousTimestamp = Number.POSITIVE_INFINITY;
+ return groupedSections.flatMap((group, groupIndex) => {
+ const elements: ReactNode[] = [];
+ const isGroupCollapsed = collapsedGroupKeys.has(group.key);
+ if (
+ group.searchSection !== "none"
+ && group.searchSection !== groupedSections[groupIndex - 1]?.searchSection
+ ) {
+ elements.push(
+ <div
+ key={`${group.searchSection}-search-divider`}
+ className="flex items-center gap-3 border-y border-border/70 bg-muted/30 px-4 py-2"
+ >
+ <div className="h-px flex-1 bg-border/80" />
+ <span className="shrink-0 text-(length:--text-micro) font-semibold uppercase tracking-wide text-muted-foreground">
+ {group.searchSection === "archived" ? "Archived" : "Other results"}
+ </span>
+ <div className="h-px flex-1 bg-border/80" />
+ </div>,
+ );
+ }
+ if (group.label) {
+ const groupNavIdx = groupFlatIndex.get(group.key) ?? -1;
+ const isGroupSelected = groupNavIdx >= 0 && selectedIndex === groupNavIdx;
+ const canCreateIssueInGroup = group.displayItems.some((item) => item.kind === "issue");
+ elements.push(
+ <div
+ key={`group-${group.key}`}
+ data-inbox-item
+ className={cn(groupIndex > 0 && "pt-2")}
+ onClick={() => {
+ if (groupNavIdx >= 0) setSelectedIndex(groupNavIdx);
+ }}
+ onMouseEnter={() => {
+ if (groupNavIdx >= 0) setSelectedIndexFromPointer(groupNavIdx);
+ }}
+ >
+ {/* Left inset aligns the header chevron with the nested
+ task chevrons. Read rows no longer reserve a
+ mark-read column, so inbox rows sit at pl-1 before
+ their chevron — same as the tasks list. */}
+ <div className={cn("rounded-lg px-3 sm:pl-0 sm:pr-4", isGroupSelected ? "bg-accent/50" : "hover:bg-accent/50")}>
+ <IssueGroupHeader
+ label={group.label}
+ collapsible
+ collapsed={isGroupCollapsed}
+ onToggle={() => toggleGroupCollapse(group.key)}
+ trailing={canCreateIssueInGroup ? (
+ <Button
+ variant="ghost"
+ size="icon-xs"
+ className="-mr-2 text-muted-foreground"
+ title={`New task in ${group.label}`}
+ aria-label={`New task in ${group.label}`}
+ onClick={(event) => {
+ event.stopPropagation();
+ openCreateIssueForGroup(group);
+ }}
+ >
+ <Plus className="h-3 w-3" />
+ </Button>
+ ) : null}
+ />
+ </div>
+ </div>,
+ );
+ }
+ if (isGroupCollapsed) return elements;
+
+ for (let index = 0; index < group.displayItems.length; index += 1) {
+ const item = group.displayItems[index]!;
+ const navIdx = topFlatIndex.get(`${group.key}:${getInboxWorkItemKey(item)}`) ?? 0;
+ const wrapItem = (key: string, isSelected: boolean, child: ReactNode) => (
+ <div
+ key={`sel-${key}`}
+ data-inbox-item
+ className="relative"
+ onClick={() => setSelectedIndex(navIdx)}
+ onMouseEnter={() => setSelectedIndexFromPointer(navIdx)}
+ >
+ {child}
+ </div>
+ );
+ const todayCutoff = Date.now() - 24 * 60 * 60 * 1000;
+ const showTodayDivider =
+ groupBy === "none" &&
+ item.timestamp > 0 &&
+ item.timestamp < todayCutoff &&
+ previousTimestamp >= todayCutoff;
+ previousTimestamp = item.timestamp > 0 ? item.timestamp : previousTimestamp;
+ if (showTodayDivider) {
+ elements.push(
+ <div key={`today-divider-${group.key}-${index}`} className="my-2 flex items-center gap-3 px-4">
+ <div className="flex-1 border-t border-zinc-600" />
+ <span className="shrink-0 text-(length:--text-micro) font-medium uppercase tracking-wider text-zinc-500">
+ Earlier
+ </span>
+ </div>,
+ );
+ }
+ const isSelected = selectedIndex === navIdx;
+
+ if (item.kind === "approval") {
+ const approvalKey = `approval:${item.approval.id}`;
+ const isArchiving = archivingNonIssueIds.has(approvalKey);
+ const row = (
+ <ApprovalInboxRow
+ key={approvalKey}
+ approval={item.approval}
+ selected={isSelected}
+ requesterName={agentName(item.approval.requestedByAgentId)}
+ onApprove={() => approveMutation.mutate(item.approval.id)}
+ onReject={() => rejectMutation.mutate(item.approval.id)}
+ isPending={approveMutation.isPending || rejectMutation.isPending}
+ unreadState={nonIssueUnreadState(approvalKey)}
+ onMarkRead={() => handleMarkNonIssueRead(approvalKey)}
+ onArchive={canArchiveFromTab ? () => handleArchiveNonIssue(approvalKey) : undefined}
+ archiveDisabled={isArchiving}
+ className={
+ isArchiving
+ ? "pointer-events-none -translate-x-4 scale-(--s-0_98) opacity-0 transition-all duration-200 ease-out"
+ : "transition-all duration-200 ease-out"
+ }
+ />
+ );
+ elements.push(wrapItem(approvalKey, isSelected, canArchiveFromTab ? (
+ <SwipeToArchive
+ key={approvalKey}
+ selected={isSelected}
+ disabled={isArchiving}
+ onArchive={() => handleArchiveNonIssue(approvalKey)}
+ >
+ {row}
+ </SwipeToArchive>
+ ) : <InboxRowSurface selected={isSelected}>{row}</InboxRowSurface>));
+ continue;
+ }
+
+ if (item.kind === "failed_run") {
+ const runKey = `run:${item.run.id}`;
+ const isArchiving = archivingNonIssueIds.has(runKey);
+ const row = (
+ <FailedRunInboxRow
+ key={runKey}
+ run={item.run}
+ selected={isSelected}
+ issueById={issueById}
+ agentName={agentName(item.run.agentId)}
+ issueLinkState={issueLinkState}
+ onDismiss={() => dismissInboxItem(runKey)}
+ onRetry={() => retryRunMutation.mutate(item.run)}
+ isRetrying={retryingRunIds.has(item.run.id)}
+ unreadState={nonIssueUnreadState(runKey)}
+ onMarkRead={() => handleMarkNonIssueRead(runKey)}
+ onArchive={canArchiveFromTab ? () => handleArchiveNonIssue(runKey) : undefined}
+ archiveDisabled={isArchiving}
+ className={
+ isArchiving
+ ? "pointer-events-none -translate-x-4 scale-(--s-0_98) opacity-0 transition-all duration-200 ease-out"
+ : "transition-all duration-200 ease-out"
+ }
+ />
+ );
+ elements.push(wrapItem(runKey, isSelected, canArchiveFromTab ? (
+ <SwipeToArchive
+ key={runKey}
+ selected={isSelected}
+ disabled={isArchiving}
+ onArchive={() => handleArchiveNonIssue(runKey)}
+ >
+ {row}
+ </SwipeToArchive>
+ ) : <InboxRowSurface selected={isSelected}>{row}</InboxRowSurface>));
+ continue;
+ }
+
+ if (item.kind === "join_request") {
+ const joinKey = `join:${item.joinRequest.id}`;
+ const isArchiving = archivingNonIssueIds.has(joinKey);
+ const row = (
+ <JoinRequestInboxRow
+ key={joinKey}
+ joinRequest={item.joinRequest}
+ selected={isSelected}
+ onApprove={() => approveJoinMutation.mutate(item.joinRequest)}
+ onReject={() => rejectJoinMutation.mutate(item.joinRequest)}
+ isPending={approveJoinMutation.isPending || rejectJoinMutation.isPending}
+ unreadState={nonIssueUnreadState(joinKey)}
+ onMarkRead={() => handleMarkNonIssueRead(joinKey)}
+ onArchive={canArchiveFromTab ? () => handleArchiveNonIssue(joinKey) : undefined}
+ archiveDisabled={isArchiving}
+ className={
+ isArchiving
+ ? "pointer-events-none -translate-x-4 scale-(--s-0_98) opacity-0 transition-all duration-200 ease-out"
+ : "transition-all duration-200 ease-out"
+ }
+ />
+ );
+ elements.push(wrapItem(joinKey, isSelected, canArchiveFromTab ? (
+ <SwipeToArchive
+ key={joinKey}
+ selected={isSelected}
+ disabled={isArchiving}
+ onArchive={() => handleArchiveNonIssue(joinKey)}
+ >
+ {row}
+ </SwipeToArchive>
+ ) : <InboxRowSurface selected={isSelected}>{row}</InboxRowSurface>));
+ continue;
+ }
+
+ const issue = item.issue;
+ const childIssues = group.childrenByIssueId.get(issue.id) ?? [];
+ const hasChildren = childIssues.length > 0;
+ const isExpanded = hasChildren && !collapsedInboxParents.has(issue.id);
+ const canArchiveIssue = canArchiveFromTab && group.searchSection === "none";
+ const renderChildIssueRows = (
+ children: Issue[],
+ depth: number,
+ seen: ReadonlySet<string>,
+ ): ReactNode[] =>
+ children.flatMap((child) => {
+ if (seen.has(child.id)) return [];
+ const nextSeen = new Set(seen);
+ nextSeen.add(child.id);
+ const childNavIdx = childFlatIndex.get(child.id) ?? -1;
+ const isChildSelected = selectedIndex === childNavIdx;
+ const grandchildIssues = group.childrenByIssueId.get(child.id) ?? [];
+ const childHasChildren = grandchildIssues.length > 0;
+ const childIsExpanded = childHasChildren && !collapsedInboxParents.has(child.id);
+ const childRow = renderInboxIssue({
+ issue: child,
+ depth,
+ selected: isChildSelected,
+ hasChildren: childHasChildren,
+ isExpanded: childIsExpanded,
+ childCount: grandchildIssues.length,
+ collapseParentId: child.id,
+ allowArchive: canArchiveIssue,
+ });
+ const isChildArchiving = archivingIssueIds.has(child.id);
+ const row = (
+ <div
+ key={`sel-issue:${child.id}`}
+ data-inbox-item
+ className="relative"
+ onClick={() => {
+ if (childNavIdx >= 0) setSelectedIndex(childNavIdx);
+ }}
+ onMouseEnter={() => {
+ if (childNavIdx >= 0) setSelectedIndexFromPointer(childNavIdx);
+ }}
+ >
+ {canArchiveIssue ? (
+ <SwipeToArchive
+ key={`issue:${child.id}`}
+ selected={isChildSelected}
+ disabled={isChildArchiving}
+ onArchive={() => archiveIssueMutation.mutate(child.id)}
+ >
+ {childRow}
+ </SwipeToArchive>
+ ) : <InboxRowSurface selected={isChildSelected}>{childRow}</InboxRowSurface>}
+ </div>
+ );
+
+ return childIsExpanded
+ ? [row, ...renderChildIssueRows(grandchildIssues, depth + 1, nextSeen)]
+ : [row];
+ });
+ const parentRow = renderInboxIssue({
+ issue,
+ depth: 0,
+ selected: isSelected,
+ hasChildren,
+ isExpanded,
+ childCount: childIssues.length,
+ collapseParentId: issue.id,
+ allowArchive: canArchiveIssue,
+ });
+
+ elements.push(wrapItem(`issue:${issue.id}`, isSelected, canArchiveIssue ? (
+ <SwipeToArchive
+ key={`issue:${issue.id}`}
+ selected={isSelected}
+ disabled={archivingIssueIds.has(issue.id)}
+ onArchive={() => archiveIssueMutation.mutate(issue.id)}
+ >
+ {parentRow}
+ </SwipeToArchive>
+ ) : <InboxRowSurface selected={isSelected}>{parentRow}</InboxRowSurface>));
+
+ if (isExpanded) {
+ elements.push(...renderChildIssueRows(childIssues, 1, new Set([issue.id])));
+ }
+ }
+
+ return elements;
+ });
+ })()}
+ </div>
+ </div>
+ </>
+ )}
+
+ {showAlertsSection && (
+ <>
+ {showSeparatorBefore("alerts") && <Separator />}
+ <div>
+ <h3 className="mb-3 text-sm font-semibold uppercase tracking-wide text-muted-foreground">
+ Alerts
+ </h3>
+ <div className="divide-y divide-border border border-border">
+ {showAggregateAgentError && (
+ <div className="group/alert relative flex items-center gap-3 px-4 py-3 transition-colors hover:bg-accent/50">
+ <Link
+ to="/agents"
+ className="flex flex-1 cursor-pointer items-center gap-3 no-underline text-inherit"
+ >
+ <AlertTriangle className="h-4 w-4 shrink-0 text-red-600 dark:text-red-400" />
+ <span className="text-sm">
+ <span className="font-medium">{dashboard!.agents.error}</span>{" "}
+ {dashboard!.agents.error === 1 ? "agent has" : "agents have"} errors
+ </span>
+ </Link>
+ <button
+ type="button"
+ onClick={() => dismissAlert("alert:agent-errors")}
+ className="rounded-md p-1 text-muted-foreground opacity-0 transition-opacity hover:bg-accent hover:text-foreground group-hover/alert:opacity-100"
+ aria-label="Dismiss"
+ >
+ <X className="h-3.5 w-3.5" />
+ </button>
+ </div>
+ )}
+ {showBudgetAlert && (
+ <div className="group/alert relative flex items-center gap-3 px-4 py-3 transition-colors hover:bg-accent/50">
+ <Link
+ to="/costs"
+ className="flex flex-1 cursor-pointer items-center gap-3 no-underline text-inherit"
+ >
+ <AlertTriangle className="h-4 w-4 shrink-0 text-yellow-400" />
+ <span className="text-sm">
+ Budget at{" "}
+ <span className="font-medium">{dashboard!.costs.monthUtilizationPercent}%</span>{" "}
+ utilization this month
+ </span>
+ </Link>
+ <button
+ type="button"
+ onClick={() => dismissAlert("alert:budget")}
+ className="rounded-md p-1 text-muted-foreground opacity-0 transition-opacity hover:bg-accent hover:text-foreground group-hover/alert:opacity-100"
+ aria-label="Dismiss"
+ >
+ <X className="h-3.5 w-3.5" />
+ </button>
+ </div>
+ )}
+ </div>
+ </div>
+ </>
+ )}
+
+ </div>
+ );
+}
diff --git a/ui/src/pages/MyIssues.tsx b/ui/src/pages/MyIssues.tsx
index 0388ba11c9..019ce8ce80 100644
--- a/ui/src/pages/MyIssues.tsx
+++ b/ui/src/pages/MyIssues.tsx
@@ -11,8 +11,10 @@ import { EmptyState } from "../components/EmptyState";
import { PageSkeleton } from "../components/PageSkeleton";
import { formatDate } from "../lib/utils";
import { ListTodo } from "lucide-react";
+import { useStreamlinedUiEnabled } from "../hooks/useStreamlinedUiEnabled";
export function MyIssues() {
+ const { enabled: streamlinedUiEnabled } = useStreamlinedUiEnabled();
const { selectedCompanyId } = useCompany();
const { setBreadcrumbs } = useBreadcrumbs();
@@ -27,7 +29,14 @@ export function MyIssues() {
});
if (!selectedCompanyId) {
- return <EmptyState icon={ListTodo} message="Select an organization to view your tasks." />;
+ return (
+ <EmptyState
+ icon={ListTodo}
+ message={streamlinedUiEnabled
+ ? "Select an organization to view your tasks."
+ : "Select a company to view your tasks."}
+ />
+ );
}
if (isLoading) {