Skip to content

Handle transient mobile read failures - #401

Merged
ymichael merged 1 commit into
mainfrom
bb/mobile-background-browser-issue-thr_u7qgtzgiqc
Jun 25, 2026
Merged

ymichael merged 1 commit into
mainfrom
bb/mobile-background-browser-issue-thr_u7qgtzgiqc

Conversation

@ymichael

@ymichael ymichael commented Jun 25, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • retry transient browser read failures globally without retrying HTTP failures
  • keep thread, timeline, and sidebar initial-load transport errors in loading/recovery UI instead of terminal error UI
  • add regression coverage for transient read classification, connection-aware query state, and timeline refetch rendering

Validation

  • pnpm exec turbo run test --filter=@bb/app -- src/lib/query-client.test.ts src/hooks/queries/thread-queries.test.tsx src/hooks/queries/connection-aware-query-state.test.ts src/hooks/queries/query-helpers.test.ts src/components/thread/timeline/useThreadTimelineController.test.tsx
  • pnpm exec turbo run typecheck --filter=@bb/app
  • pnpm exec turbo run lint --filter=@bb/app

Note: lint exits successfully and still reports the existing app warning set.

@ymichael
ymichael force-pushed the bb/mobile-background-browser-issue-thr_u7qgtzgiqc branch from 910b6c1 to 578eefb Compare June 25, 2026 21:22
@ymichael
ymichael merged commit a578dc1 into main Jun 25, 2026
6 checks passed
@ymichael
ymichael deleted the bb/mobile-background-browser-issue-thr_u7qgtzgiqc branch June 25, 2026 21:26
ymichael added a commit that referenced this pull request Oct 9, 2026
…hat, and palette (#5264)

## Human comments

## What was wrong

One user action stepped through several different loading placeholders because every layer of a lazily loaded surface drew its own placeholder and only started its async work after the layer above it mounted. Expanding a settled edit row showed "Loading details..." (the deferred-content fetch from #5240), then the diff block chunk skeleton, then the card header with a viewport-gated skeleton, then the bb-diff chunk skeleton, then the Pierre worker pool skeleton, then a plain diff, then the highlighted diff. Opening a thread, a file preview, the diff panel, side chat, and the Cmd+K thread search had the same pattern. Some placeholders also showed wrong data while loading: the diff toolbar said "No changes", the info tab said "No thread details available.", and the side chat composer showed the provider's default model before the thread's own model.

## What changed

Timeline rows (`ThreadTimelineRows.tsx`, `timeline-row-body-preload.ts`, `ExpandableTimelineRow.tsx`, `disclosure.tsx`):
- Rows preload their body on hover (80 ms dwell), press, or focus: the deferred detail query (`prefetchThreadTimelineTurnSummaryDetails`), the renderer chunks, and the diff worker pool.
- An expanded row body shows one bordered placeholder (`TimelineRowBodyPlaceholder`, fades in after 150 ms) until its content and renderers are ready. "Loading turn details..." and "Loading subagent activity..." are unchanged.
- The worker pool gate (`ThreadDetailWorkerPoolProvider`) now waits for `pool.initialize()`; Pierre renders nothing before that.
- The timeline diff card renders without waiting for an intersection callback (`renderBeforeVisible`).
- `defineSplit` exposes `isLoaded()`; `useRequirePierreWorkerPool(required)` and `useRequestPierreWorkerPool()` added.

Thread open (`route-loading-skeleton.tsx`, `ThreadTimelineLoadingSkeleton.tsx`, `ThreadTimelineSurface.tsx`, `App.tsx`, `LazyThreadDetailView.tsx`, `ThreadDetailView.tsx`):
- Thread route skeletons include the timeline skeleton, and the timeline shows its skeleton immediately when it replaces a route skeleton instead of going blank for 200 ms.
- The info tab shows its metadata skeleton until the thread bootstrap settles.

File preview (`FilePreviewChrome.tsx`, `lazySecondaryPanelComponents.tsx`, `ThreadStorageFilePreview.tsx`):
- Chunk fallbacks and the cold panel placeholder draw the same header and source skeleton as the loading preview. Preview tab chunks preload with the panel, and opening a preview starts the source renderer chunk and code workers alongside the file request.

Diff panel (`ThreadSecondaryPanelTabContent.tsx`, `ThreadSecondaryPanel.tsx`, `GitDiffToolbar.tsx`, `GitDiffCardBody.tsx`):
- "Checking Git support…" and the file-list wait show the same skeleton cards, now shaped like the real cards. The toolbar shows a skeleton instead of "No changes" while files load. The automatic context prefetch no longer flashes "Expand context" / "Loading context…" (a user-requested expansion still shows it). The diff renderer chunk and workers start when the panel opens.

Code hosts (`DiffHost.tsx`, `SourceCodeHost.tsx`): the `fallback` prop is removed; both always show their own skeleton while the renderer chunk loads, so the plugin SDK `Diff` and `SourceCode` components show a skeleton instead of rendering nothing first.

Side chat (`ThreadChatLoading.tsx`, `LazyPluginThreadChat.tsx`, `PluginThreadChat.tsx`, `PluginPanelActions.tsx`, `EmbeddedThreadChat.tsx`):
- The chat chunk fallback and the thread wait render the leading content (the "Replying to" anchor) with the same timeline skeleton the loaded chat uses.
- Plugin panel tabs render nothing instead of "This plugin tab is not available…" until plugin frontends settle.
- The composer shows the model picker's loading state until the thread's default execution options resolve. Sending was already blocked in that window, so this only removes the wrong label.
- The timeline controller (`useThreadTimelineController.ts`) no longer puts an already-loaded empty timeline back into the loading state on background refetches; only a timeline with no data yet (first load, or the retry after a failed read from #401) reports loading. New side chats are empty, so each refetch while the thread provisioned brought the skeleton back.
- `FollowUpPromptBox` starts expanded when its editor will autofocus on mount (fine pointers), instead of mounting compact and animating open one frame later.
- Short-lived status in empty chats: the working indicator on an empty timeline (`ThreadTimelineSurface`) and the embedded composer's "Provisioning thread..." placeholder (`EmbeddedThreadChat`) appear only once that state has lasted 1.5 s (`useSustainedFlag`). A new side chat used to flash "Provisioning thread..." then "Working..." for about a second. Timelines with rows still show the working indicator immediately.

Command palette (`CommandPalette.tsx`, `ThreadSearchPalettePlaceholder.tsx`): thread search preloads, and its fallback is the real search shell instead of a bare "Loading threads" line.

No server, daemon wire, CLI, or plugin SDK source changes; `HOST_DAEMON_PROTOCOL_VERSION` is untouched.

Remaining: diffs still render plain text before syntax colours arrive (Pierre's worker flow; changing it affects every diff surface), and the diff panel shows one ~24 ms frame where only the first card has mounted.

## How you verified

- `pnpm exec turbo run typecheck lint test --filter='...[origin/main]'`: 14/14 tasks pass (`@bb/app` 5577 tests).
- New tests, each failing before the change:
  - `ThreadTimelineRows.deferred-details.test.tsx`: pressing a collapsed deferred row starts its detail request before expansion.
  - `ThreadDetailWorkerPoolProvider.test.tsx`: consumers stay waiting until the pool's highlighter has initialized.
  - `GitDiffToolbar.test.tsx`: the summary does not say "No changes" while the file list is loading.
- `useThreadTimelineController.test.tsx`: "still reports timelineLoading while refetching an empty timeline" now asserts the opposite (a loaded empty timeline stays out of the loading state while refetching); the #401 error-retry test still passes unchanged.
- `useSustainedFlag.test.tsx`: the flag turns on only after the full delay and restarts the delay each time it turns on again.
- `FollowUpPromptBox.test.tsx`: the composer starts expanded on fine pointers and compact on coarse pointers; mobile tests now use a coarse pointer.
- Updated tests for the changed placeholders: `LazyTerminalOutputBlock`, `CodeHosts.cold-load`, `DiffFileCard`, `plugin-slot-mounts`, `ThreadSecondaryPanel.collapseControl`.
- Manual, on a `pnpm start:worktree` instance with a Claude Code fixture thread: recorded painted frames with CDP screencast at 300 ms network latency before and after, and screenshotted every new loading state by holding its request open. Time until content: edit row diff 2.4 s → 1.5 s, file preview 0.70 s → 0.37 s, diff panel 2.1 s → 0.4 s; thread open, side chat, and Cmd+K go from 2–4 visually different placeholders to one.

> AGENT GENERATED

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant