perf(inbox): stop optional reads from holding Mine rows hidden (#20407)

> Follows #20388, which merged to `master` as `50df9a19b9`. This branch
now includes `origin/master`, so its diff carries only this PR's change:
`ui/src/pages/Inbox.tsx`, `ui/src/pages/Inbox.test.tsx`,
`ui/src/api/approvals.ts` and `ui/src/api/access.ts`.

## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - The Mine inbox is the first page a board user opens to see the tasks
that need them
> - The page hides task rows until every inbox read finishes, including
reads that do not change the rows
> - A slow user directory, approvals or join-request read therefore
delays every task row, and a stalled read keeps the skeleton up
> - Loading is also a layout contract: content that arrives late must
not push visible rows down or reset keyboard selection
> - This pull request removes the user-directory gate where names only
fill row text, and bounds the approvals and join-request gates so a
failure or stall cannot hold rows hidden
> - The benefit is that a slow optional read no longer hides task rows,
and the rows still do not move when late data arrives

## Linked Issues or Issue Description

Refs #20388

**What existing behavior does this improve?**
The Mine inbox reveal gate waits for every source, including the user
directory, approvals and join requests.

**Subsystem affected**
Board UI inbox (`ui/src/pages/Inbox.tsx`).

**Current behavior**
If the user directory is slow, every task row waits for it, although
user names only fill text in the rows. If approvals or join requests
stall, the skeleton stays up until the request ends.

**Proposed behavior**
Rows reveal on session, experimental settings, `inbox/mine`, dismissals,
agents and projects. The user directory fills names in place. Approvals
and join requests can delay rows for one attempt of at most 10 s.

**Reason and benefit**
A slow optional read no longer hides the task list. A failed read shows
the existing "Some inbox items couldn’t load" banner with a retry
instead of a skeleton.

**Breaking changes**
None.

## What Changed

- User directory: it no longer gates task rows. It still gates rows when
they are grouped by assignee, because user names name and order those
groups.
- Approvals and join requests: they still gate rows (see "Kept gates"
below). The gate now covers only the first attempt (`isLoading &&
failureCount === 0`). That attempt uses a 10 s request timeout
(`INBOX_OPTIONAL_READ_TIMEOUT_MS`). After a failure or timeout, rows
reveal and the query retries in the background.
- Timeout notice: a timed-out approvals or join-request read is a
transient error, which the inbox hides. Once the app's retries end, the
inbox now shows the "Some inbox items couldn’t load" notice and "Retry
missing items" button for a `TIMEOUT` on those reads. Other transient
errors stay hidden as before.
- `approvalsApi.list`, `accessApi.listJoinRequests` and
`accessApi.listUserDirectory` accept optional `RequestOptions` (signal
and timeout). Other callers do not change.
- Tests in `ui/src/pages/Inbox.test.tsx` ("optional reads and the reveal
gate"):
- rows reveal while the user directory is pending, and keep their order,
their DOM nodes and the keyboard selection when it arrives;
  - assignee grouping still waits for the user directory;
  - a delayed approvals read holds rows (the kept layout guarantee);
- a failed approvals or join-request read reveals rows with the retry
banner and no skeleton;
- after one failed attempt, rows reveal while the approvals read
retries;
  - a stalled approvals read times out and reveals rows;
- approvals or join requests that keep timing out under the app retry
policy (`shouldRetryRequest`) show the missing-items notice and retry
button.

### Kept gates

Approvals and join requests stay in the gate. On Mine they sort in among
the task rows by time (`getInboxWorkItems`). A pending approval is
usually recent, so it sorts near the top. If it arrived after the rows
were visible, it would push every task row down by one row. I could not
reserve space for it, because the count is unknown until the read
returns, and an empty reserved slot would collapse and shift the rows
the other way. So I kept these two gates, and I bounded them so they
cannot hold rows hidden on failure or stall.

Keyboard selection already follows the selected row by key, so late data
does not reset it. The user-directory test checks this.

## Verification

Focused checks on this revision:
- `cd ui && npx vitest run src/pages/Inbox.test.tsx
src/api/access.test.ts`: all passed (91 Inbox tests).
- Red/green: with the #20388 versions of `Inbox.tsx`, `approvals.ts` and
`access.ts`, three new tests fail (user directory pending, retry after
first failure, stalled approvals). They pass with this change. The other
four pin guarantees that already held.
- Review fixes: the timeout-notice tests fail without `eb5d55da86` and
pass with it. `cd ui && npx vitest run src/pages/Inbox.test.tsx`: 94
passed.
- After merging `origin/master` (`54d73aef19`): `cd ui && npx vitest run
src/pages/Inbox.test.tsx src/api/execution-workspaces.test.ts`: 101
passed. `pnpm --filter @paperclipai/ui typecheck`: passed.
- CI note: on head `e438e16c80`, `ci / e2e shard (3/8)` failed in
`planning-mode-visual-verification.spec.ts` (the first task's
`task-chat-composer-mode` did not appear within 30 s). That journey runs
onboarding into the first task chat. It does not open the inbox or use
the changed reads, so I treat it as unrelated. The other 33 tests in the
shard passed. The new head reruns it. `pnpm check:token-gates`: clean.
- `pnpm verify --base perf/inbox-referenced-workspaces` selected 2,219
Vitest files because `ui/src/api/access.ts` is imported widely. I did
not run that broad set locally (the shared host was under heavy load).
Required CI supplies that coverage.

Performance (same local fixture as #20388: authenticated mode, non-admin
member, 8,750 execution workspaces, 38,750 tasks, production UI bundle,
headless Chromium, new context per run). The host load average was about
30–48 from other work, so I used alternating pairs.

| Scenario | #20388 | This PR | Median paired saving |
| --- | --- | --- | --- |
| No injected delay, 6 pairs | median 870 ms (747–1,922) | median 1,046
ms (795–2,002) | mixed signs, no measurable change |
| User directory delayed 3 s, 5 pairs | median 3,980 ms (3,852–6,048) |
median 1,096 ms (698–1,263) | 2,814 ms |
| Approvals stalled 20 s, 1 run each | 20,829 ms | 10,737 ms | — |

On this fixture the optional reads finish before `inbox/mine`, so this
PR does not change the normal cold load. It helps when an optional read
is slower than `inbox/mine`, for example under server load.

## Risks

- Low risk. The change only removes or bounds waits for reads that do
not decide row order.
- Assignee names can appear a moment after the rows on a slow user
directory. The rows keep their height and position.
- If approvals or join requests time out on every retry, the notice and
retry button appear. If they time out and later succeed, they insert
into the list after the rows are visible. This happens only in that
failure path.
- The 10 s timeout applies to these inbox reads only. Other pages that
read the same data do not change.

## Model Used

- Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, via Claude Code with
tool use (shell, file edit, headless browser). Extended reasoning on.

## Checklist

- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [x] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [x] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [x] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [ ] All Paperclip CI gates are green
- [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
DottaandClaude Opus 5.5 authored and GitHub committed 2026-11-09 20:29:47 -06:00
1 parent 99a6daf5bc
commit 9a4a5066fa
4 files changed
+209 -15

No files matched your search

+5 -3
View File
@@ -1,5 +1,5 @@
import type { AgentAdapterType, JoinRequest, PermissionKey } from "@paperclipai/shared";
import { api } from "./client";
import { api, type RequestOptions } from "./client";
export type HumanCompanyRole = "owner" | "admin" | "operator" | "viewer";
@@ -311,16 +311,18 @@ export const accessApi = {
companyId: string,
status: "pending_approval" | "approved" | "rejected" = "pending_approval",
requestType?: "human" | "agent",
options?: RequestOptions,
) =>
api.get<CompanyJoinRequest[]>(
`/companies/${companyId}/join-requests?status=${status}${requestType ? `&requestType=${requestType}` : ""}`,
options,
),
listMembers: (companyId: string) =>
api.get<CompanyMembersResponse>(`/companies/${companyId}/members`),
listUserDirectory: (companyId: string) =>
api.get<CompanyUserDirectoryResponse>(`/companies/${companyId}/user-directory`),
listUserDirectory: (companyId: string, options?: RequestOptions) =>
api.get<CompanyUserDirectoryResponse>(`/companies/${companyId}/user-directory`, options),
updateMember: (
companyId: string,
+3 -2
View File
@@ -1,10 +1,11 @@
import type { Approval, ApprovalComment, Issue } from "@paperclipai/shared";
import { api } from "./client";
import { api, type RequestOptions } from "./client";
export const approvalsApi = {
list: (companyId: string, status?: string) =>
list: (companyId: string, status?: string, options?: RequestOptions) =>
api.get<Approval[]>(
`/companies/${companyId}/approvals${status ? `?status=${encodeURIComponent(status)}` : ""}`,
options,
),
create: (companyId: string, data: Record<string, unknown>) =>
api.post<Approval>(`/companies/${companyId}/approvals`, data),
+163
View File
@@ -10,6 +10,7 @@ import type { Approval, CompactIssue, HeartbeatRun, InboxMineSnapshot, Issue } f
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import type { CompanyJoinRequest } from "../api/access";
import { ApiError } from "../api/client";
import { shouldRetryRequest } from "../lib/query-client";
import {
clearLocalInboxArchive,
getLocalInboxArchiveIssueIds,
@@ -1893,6 +1894,168 @@ describe("Inbox toolbar", () => {
});
});
describe("optional reads and the reveal gate", () => {
const renderInbox = async (client: QueryClient, root: ReturnType<typeof createRoot>) => {
await act(async () => {
root.render(<QueryClientProvider client={client}><Inbox /></QueryClientProvider>);
});
};
const rowKeys = () => [...container.querySelectorAll("[data-inbox-item]")]
.map((row) => row.querySelector('[data-slot="task-row-identifier"]')?.textContent ?? "");
const selectedRowIndex = () => [...container.querySelectorAll("[data-inbox-item]")].findIndex((row) =>
row.querySelector<HTMLAnchorElement>("a[data-inbox-issue-link]")?.parentElement
?.className.split(/\s+/).includes("bg-accent/50"));
const twoRows = () => {
const base = new Date("2026-03-11T00:00:00.000Z").getTime();
setIssueRows([
createIssue({ id: "issue-a", identifier: "PAP-4001", title: "Directory row A", assigneeUserId: "user-2", lastActivityAt: new Date(base + 2000) }),
createIssue({ id: "issue-b", identifier: "PAP-4002", title: "Directory row B", assigneeUserId: "user-2", lastActivityAt: new Date(base + 1000) }),
]);
};
it("reveals rows while the user directory is pending and keeps their order and selection when it arrives", async () => {
routerMock.location.pathname = "/inbox/mine";
twoRows();
let resolveDirectory: (value: unknown) => void = () => {};
apiMocks.userDirectoryList.mockReturnValue(new Promise((resolve) => { resolveDirectory = resolve; }));
const client = new QueryClient({ defaultOptions: { queries: { retry: false, gcTime: 0 } } });
const root = createRoot(container);
try {
await renderInbox(client, root);
await vi.waitFor(() => expect(rowKeys()).toEqual(["PAP-4001", "PAP-4002"]));
for (let press = 0; press < 2; press += 1) {
await act(async () => {
document.body.dispatchEvent(new KeyboardEvent("keydown", { key: "j", bubbles: true }));
});
}
expect(selectedRowIndex()).toBe(1);
const rowNodes = [...container.querySelectorAll("[data-inbox-item]")];
await act(async () => {
resolveDirectory({ users: [{ principalId: "user-2", user: { id: "user-2", name: "Robin Directory", email: "robin@example.test", image: null } }] });
});
expect(rowKeys()).toEqual(["PAP-4001", "PAP-4002"]);
expect([...container.querySelectorAll("[data-inbox-item]")]).toEqual(rowNodes);
expect(selectedRowIndex()).toBe(1);
} finally { await act(() => root.unmount()); client.clear(); }
});
it("waits for the user directory when rows are grouped by assignee", async () => {
routerMock.location.pathname = "/inbox/mine";
localStorage.setItem("paperclip:inbox:group-by", "assignee");
twoRows();
let resolveDirectory: (value: unknown) => void = () => {};
apiMocks.userDirectoryList.mockReturnValue(new Promise((resolve) => { resolveDirectory = resolve; }));
const client = new QueryClient({ defaultOptions: { queries: { retry: false, gcTime: 0 } } });
const root = createRoot(container);
try {
await renderInbox(client, root);
await vi.waitFor(() => expect(apiMocks.userDirectoryList).toHaveBeenCalled());
expect(container.querySelector("[data-inbox-item]")).toBeNull();
await act(async () => { resolveDirectory({ users: [] }); });
await vi.waitFor(() => expect(container.textContent).toContain("Directory row A"));
} finally { await act(() => root.unmount()); client.clear(); }
});
it("holds rows for a delayed approvals read so a late approval cannot push them down", async () => {
routerMock.location.pathname = "/inbox/mine";
twoRows();
let resolveApprovals: (value: Approval[]) => void = () => {};
apiMocks.approvalsList.mockReturnValue(new Promise((resolve) => { resolveApprovals = resolve; }));
const client = new QueryClient({ defaultOptions: { queries: { retry: false, gcTime: 0 } } });
const root = createRoot(container);
try {
await renderInbox(client, root);
await vi.waitFor(() => {
const mineQueries = client.getQueryCache().findAll({ queryKey: queryKeys.issues.listMineByMe("company-1") });
expect(mineQueries.some((query) => query.state.status === "success")).toBe(true);
});
expect(container.querySelector("[data-inbox-item]")).toBeNull();
await act(async () => { resolveApprovals([]); });
await vi.waitFor(() => expect(rowKeys()).toEqual(["PAP-4001", "PAP-4002"]));
} finally { await act(() => root.unmount()); client.clear(); }
});
it.each([
["approvals", () => apiMocks.approvalsList],
["join requests", () => apiMocks.joinRequestsList],
] as const)("reveals rows and offers a retry when the %s read fails", async (_label, mock) => {
routerMock.location.pathname = "/inbox/mine";
twoRows();
mock().mockRejectedValue(new ApiError("Optional read failed", 500, null));
const client = new QueryClient({ defaultOptions: { queries: { retry: false, gcTime: 0 } } });
const root = createRoot(container);
try {
await renderInbox(client, root);
await vi.waitFor(() => expect(rowKeys()).toEqual(["PAP-4001", "PAP-4002"]));
await vi.waitFor(() => expect(document.body.textContent).toContain("Some inbox items couldn’t load."));
expect(container.querySelector('[aria-label="Loading tasks"]')).toBeNull();
} finally { await act(() => root.unmount()); client.clear(); }
});
it("stops waiting for an approvals read after its first failed attempt while it retries", async () => {
routerMock.location.pathname = "/inbox/mine";
twoRows();
apiMocks.approvalsList
.mockRejectedValueOnce(new ApiError("Busy", 503, null))
.mockReturnValue(new Promise(() => {}));
const client = new QueryClient({ defaultOptions: { queries: { retry: 3, retryDelay: 0, gcTime: 0 } } });
const root = createRoot(container);
try {
await renderInbox(client, root);
await vi.waitFor(() => expect(apiMocks.approvalsList).toHaveBeenCalledTimes(2));
await vi.waitFor(() => expect(rowKeys()).toEqual(["PAP-4001", "PAP-4002"]));
} finally { await act(() => root.unmount()); client.clear(); }
});
it.each([
["approvals", () => apiMocks.approvalsList],
["join requests", () => apiMocks.joinRequestsList],
] as const)("shows the missing-items notice when %s keep timing out under the app retry policy", async (_label, mock) => {
routerMock.location.pathname = "/inbox/mine";
twoRows();
mock().mockRejectedValue(new ApiError("Timed out", 408, { error: "TIMEOUT" }));
const client = new QueryClient({ defaultOptions: { queries: { retry: shouldRetryRequest, retryDelay: 0, gcTime: 0 } } });
const root = createRoot(container);
try {
await renderInbox(client, root);
await vi.waitFor(() => expect(rowKeys()).toEqual(["PAP-4001", "PAP-4002"]));
await vi.waitFor(() => expect(document.body.textContent).toContain("Some inbox items couldn’t load."));
expect(mock().mock.calls.length).toBeGreaterThan(1);
expect(document.body.textContent).toContain("Retry missing items");
expect(document.body.textContent).not.toContain("Inbox zero.");
} finally { await act(() => root.unmount()); client.clear(); }
});
it("bounds a stalled approvals read so rows do not stay behind a skeleton", async () => {
routerMock.location.pathname = "/inbox/mine";
twoRows();
vi.useFakeTimers({ shouldAdvanceTime: true });
// The API client turns `timeoutMs` into a 408 TIMEOUT error; model that for the stalled read.
apiMocks.approvalsList.mockImplementation((_companyId: string, _status: unknown, options?: { timeoutMs?: number }) =>
new Promise((_resolve, reject) => {
if (options?.timeoutMs === undefined) return;
setTimeout(() => reject(new ApiError("Timed out", 408, { error: "TIMEOUT" })), options.timeoutMs);
}));
const client = new QueryClient({ defaultOptions: { queries: { retry: false, gcTime: 0 } } });
const root = createRoot(container);
try {
await renderInbox(client, root);
await vi.waitFor(() => expect(apiMocks.approvalsList).toHaveBeenCalled());
const options = apiMocks.approvalsList.mock.calls[0]?.[2] as { timeoutMs?: number } | undefined;
expect(options?.timeoutMs).toBeGreaterThan(0);
expect(container.querySelector("[data-inbox-item]")).toBeNull();
await act(async () => { vi.advanceTimersByTime(options?.timeoutMs ?? 0); });
await vi.waitFor(() => expect(rowKeys()).toEqual(["PAP-4001", "PAP-4002"]));
} finally {
vi.useRealTimers();
await act(() => root.unmount());
client.clear();
}
});
});
it.each([true, false])("uses bold titles without unread dots (Streamlined UI=%s)", async streamlined => {
apiMocks.experimentalSettings.mockResolvedValue({ enableIsolatedWorkspaces: false, enableStreamlinedUi: streamlined });
routerMock.location.pathname = "/inbox/mine";
+38 -10
View File
@@ -1,4 +1,4 @@
import { isTransientError } from "@/api/errors";
import { errorCodes, isTransientError } from "@/api/errors";
import { useQueryView } from "@/components/QueryView";
import { useCoordinatorPresentation } from "@/components/coordinator/CoordinatorPresentation";
import { useWarmTaskDetailCode } from "@/hooks/useWarmTaskDetailCode";
@@ -205,6 +205,8 @@ const INBOX_ISSUE_LIST_LIMIT = 100;
const INBOX_HOT_PATH_STALE_MS = 30_000;
// Stable fallback so memos over unloaded or disabled issue reads do not rerun on every render.
const NO_ISSUES: Issue[] = [];
/** Bounds an optional read that can hold task rows hidden; a timeout reveals rows and retries in the background. */
const INBOX_OPTIONAL_READ_TIMEOUT_MS = 10_000;
const INBOX_COLLECTION_KEY = "inbox";
type StreamlinedInboxViewState = InboxFilterPreferences & {
@@ -959,22 +961,28 @@ function StreamlinedInbox({
const {
data: approvals,
isLoading: isApprovalsLoading,
failureCount: approvalsFailureCount,
error: approvalsError,
} = useQuery({
queryKey: queryKeys.approvals.list(selectedCompanyId!),
queryFn: () => approvalsApi.list(selectedCompanyId!),
queryFn: ({ signal }) =>
approvalsApi.list(selectedCompanyId!, undefined, { signal, timeoutMs: INBOX_OPTIONAL_READ_TIMEOUT_MS }),
enabled: !!selectedCompanyId,
});
const {
data: joinRequests = [],
isLoading: isJoinRequestsLoading,
failureCount: joinRequestsFailureCount,
error: joinRequestsError,
} = useQuery({
queryKey: queryKeys.access.joinRequests(selectedCompanyId!),
queryFn: async () => {
queryFn: async ({ signal }) => {
try {
return await accessApi.listJoinRequests(selectedCompanyId!, "pending_approval");
return await accessApi.listJoinRequests(selectedCompanyId!, "pending_approval", undefined, {
signal,
timeoutMs: INBOX_OPTIONAL_READ_TIMEOUT_MS,
});
} catch (err) {
if (err instanceof ApiError && (err.status === 403 || err.status === 401)) {
return [];
@@ -1160,9 +1168,14 @@ function StreamlinedInbox({
refetchInterval: sharedLiveRuns.refetchInterval,
});
usePublishSharedQueryData(sharedLiveRuns, liveRuns, liveRunsUpdatedAt);
const { data: companyMembers, isLoading: isMembersLoading } = useQuery({
const {
data: companyMembers,
isLoading: isMembersLoading,
failureCount: membersFailureCount,
} = useQuery({
queryKey: queryKeys.access.companyUserDirectory(selectedCompanyId!),
queryFn: () => accessApi.listUserDirectory(selectedCompanyId!),
queryFn: ({ signal }) =>
accessApi.listUserDirectory(selectedCompanyId!, { signal, timeoutMs: INBOX_OPTIONAL_READ_TIMEOUT_MS }),
enabled: !!selectedCompanyId,
});
const [archivingIssueIds, setArchivingIssueIds] = useState<Set<string>>(new Set());
@@ -2557,13 +2570,23 @@ function StreamlinedInbox({
const workspaceDataAffectsRows = groupBy === "workspace"
|| (visibleIssueColumnSet.has("workspace") && availableIssueColumnSet.has("workspace"))
|| normalizedSearchQuery.length > 0;
// Approvals and join requests sort in among task rows by time, so a late arrival would push
// rows down. Wait for their first bounded attempt only; a failure or timeout reveals rows.
const approvalsAffectRows = tab !== "blocked" && (tab !== "all" || showApprovalsCategory);
const joinRequestsAffectRows = tab !== "blocked" && (tab !== "all" || showJoinRequestsCategory);
const isApprovalsFirstAttemptPending = isApprovalsLoading && approvalsFailureCount === 0;
const isJoinRequestsFirstAttemptPending = isJoinRequestsLoading && joinRequestsFailureCount === 0;
// User names only fill row text, except when they name and order assignee groups.
const userLabelsAffectRows = groupBy === "assignee";
const isMembersFirstAttemptPending = isMembersLoading && membersFailureCount === 0;
const initialSourcesSettled =
![sourceSearchView, mineIssuesView, touchedIssuesView].some(view => view.kind === "reconnecting") &&
!isSourceSearchLoading && !isSessionLoading && !isSettingsLoading && !isDismissalsLoading && !isAgentsLoading && !isProjectsLoading && !isMembersLoading &&
!isSourceSearchLoading && !isSessionLoading && !isSettingsLoading && !isDismissalsLoading && !isAgentsLoading && !isProjectsLoading &&
!(userLabelsAffectRows && isMembersFirstAttemptPending) &&
// Previous summaries stand in while a new id set loads; they may lack the new view's workspaces.
!(workspaceDataAffectsRows && workspaceLookupEnabled && (isWorkspacesLoading || isWorkspacesPlaceholder)) &&
!isJoinRequestsLoading &&
!isApprovalsLoading &&
!(joinRequestsAffectRows && isJoinRequestsFirstAttemptPending) &&
!(approvalsAffectRows && isApprovalsFirstAttemptPending) &&
!isDashboardLoading &&
!isContextIssuesLoading &&
!isContextIssuesPlaceholder &&
@@ -2578,7 +2601,12 @@ function StreamlinedInbox({
?? (issueFilters.externalObjectStatuses.length > 0 ? externalObjectSummariesError : null);
const rawOptionalSourceError = dismissalsError ?? approvalsError ?? joinRequestsError ?? runsError ?? contextIssuesError
?? (tab === "mine" ? mineIssuesError : touchedIssuesError);
const optionalSourceError = isTransientError(rawOptionalSourceError) ? null : rawOptionalSourceError;
// A query error means retries are over. Transient errors usually clear on their own, but a read
// that keeps hitting the inbox timeout leaves items missing, so say so and offer a retry.
const optionalReadTimeoutError = [approvalsError, joinRequestsError]
.find((error) => errorCodes(error).includes("TIMEOUT")) ?? null;
const optionalSourceError = optionalReadTimeoutError
?? (isTransientError(rawOptionalSourceError) ? null : rawOptionalSourceError);
const retryFailedSources = () => {
// Optional failures belong to the aggregate read, whose task rows stay usable.
if (tab === "mine" && (mineSnapshot?.failureError || mineSnapshot?.contextError)) {