Skip to content

feat(thread-info): show the branch's GitHub pull request - #86

Merged
brsbl merged 15 commits into
mainfrom
bb/show-prs-in-thread-info-page-thr_7nws88uvej
Jun 11, 2026
Merged

brsbl merged 15 commits into
mainfrom
bb/show-prs-in-thread-info-page-thr_7nws88uvej

Conversation

@brsbl

@brsbl brsbl commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds a "Pull request" section to the thread Info page showing the GitHub PR for the thread's branch. bb had no prior GitHub/PR integration — this builds a minimal one.

Architecture follows AGENTS.md server/daemon ownership:

  • Host daemon (workspace.pull_request RPC): derives the branch from HEAD, runs gh pr view <branch> --json number,title,state,url,isDraft, returns raw data. Every failure mode (gh missing / not authed / no remote / no PR / malformed / unresolvable workspace) collapses to null with no error spam. Protocol bumped 33 → 34.
  • Server (GET /environments/:id/pull-request): maps raw OPEN/CLOSED/MERGED + isDraft → product draft|open|merged|closed, fills the default once at the boundary. Response { pullRequest: ThreadPullRequest | null } (required+nullable; null = no PR). Non-git environments short-circuit without a daemon call.
  • UI: useEnvironmentPullRequest → a PullRequestRow (DetailRow, consistent with sibling rows) showing PR #N · <state> with a colored state dot + external link, beside Branch / Merge base / Git status.

Spec: plans/show-prs-in-info-page.md.

v1 scope / deferred

v1: detect + show the branch's PR (number, title, state, link). Deferred: checks/reviews, multiple PRs per branch.

Validation

  • Typecheck green: @bb/domain, @bb/host-daemon-contract, @bb/host-workspace, @bb/server-contract, @bb/host-daemon, @bb/server, @bb/app.
  • Tests green: git-host parsing 12/12, server assembly 5/5, contract round-trip 25/25, app rows (incl. PullRequestRow) 24/24.
  • Mock discipline: only the gh raw-output boundary is exercised; nothing of ours is mocked.

Built by a spawned bb worker (thr_7nws88uvej); pushed + opened on its behalf since its sandbox blocked network egress.

🤖 Generated with Claude Code

brsbl and others added 15 commits June 10, 2026 15:54
Adds a minimal, read-only "Pull request" row to the thread Info tab that
surfaces the GitHub PR for the thread's current branch.

bb had no GitHub/PR integration. This adds one that mirrors the existing
workspace-status flow but splits the daemon/server boundary the way
AGENTS.md prescribes: the host daemon shells out to `gh` and returns the
raw PR data, and the server owns the product policy (mapping the raw
state + isDraft onto draft/open/merged/closed).

- domain: gitHostPullRequestSchema (raw gh shape) and threadPullRequestSchema
  (assembled product shape, required+nullable).
- host daemon: new workspace.pull_request online RPC; the daemon derives the
  branch from HEAD and runs `gh pr view <branch> --json ...`. Every failure
  mode (gh missing / not authed / no remote / no PR / malformed output /
  unresolvable workspace) collapses to null with no error spam.
- server: GET /environments/:id/pull-request assembles the typed field once
  at the boundary; non-git environments short-circuit to null.
- app: useEnvironmentPullRequest feeds a PullRequestRow that renders
  "PR #N - <state>" with a colored state dot and an external link, placed
  next to the Branch / Merge base / Git status group.

Deferred (out of scope): checks/CI, review state, mergeability, multiple PRs
per branch, non-GitHub hosts, and any write actions.

Tests: raw gh JSON parsing, server state assembly, the PR row across all
states, and the RPC contract round-trip (PR + no-PR).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
- git-host.ts: pass an explicit maxBuffer to the `gh pr view` exec instead of
  inheriting Node's 1MB execFile default (latent, and inconsistent with the
  package's git buffer); add a `--` separator before the branch arg so a
  leading-dash branch can never be parsed as a flag.
- Remove the completed plan file per AGENTS.md (feature is implemented).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…-info-page-thr_7nws88uvej

# Conflicts:
#	apps/app/src/components/secondary-panel/ThreadMetadataContent.test.tsx
#	apps/app/src/components/secondary-panel/ThreadMetadataContent.tsx
#	apps/app/src/hooks/queries/environment-queries.ts
#	apps/app/src/lib/api.ts
#	packages/host-daemon-contract/src/commands.ts
#	packages/server-contract/src/public-api.ts
Replace the round button + typing dots shown when an active thread is scrolled
up with a DownloadCircle icon that shimmers like the "Thinking..." indicator.
Since `animate-shine` is a `background-clip:text` effect that only shimmers
glyphs, add a mask-based `animate-shine-icon` (+ `shine-mask` keyframe) that
sweeps the same bright band across an SVG. Drop the now-unused TypingDots and
its dead `animate-typing-dot` / `typing-dot` CSS.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…oreground)

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…store foreground

Add an optional strokeWidth passthrough to Icon (hugeicons thickness control)
and use it to thin the active download-circle; revert the earlier dimming.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
… scroll-button story

- Add the inherited-from-main optional field to the host-daemon contract-test
  allowlist so the guardrail test passes.
- Add an in-thread Ladle story showing the scroll-to-bottom button overlaying a
  mock conversation (idle vs active) for in-context review.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…el story

- Scroll-to-bottom button now keeps the round scrim button + arrow in both
  states and just shimmers the arrow when active (one control, the shimmer is
  the only state change). Drop the now-unused DownloadCircle icon + Icon
  strokeWidth passthrough.
- Add a PullRequest story to the full Info panel showing each PR state
  (open/draft/merged/closed + none) in its real position among the rows.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…5 -> 0.15)

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…n Overview story

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
… Dirty state)

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Add a --pr-merged token (light/dark) matching GitHub's merged-PR purple and use
it for the merged state dot instead of bg-primary, so the PR state dots follow
the universal PR color language (open green / merged purple / closed red).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
- [P3] PullRequestRow: reuse DetailRowIconLabel primitive instead of a
  hand-rolled icon+label span (consistency with the other Info rows)
- [P3] Add dispatch-level test coverage for the workspace.pull_request
  command (PR-present, PR-absent, and non-git resolution-failure paths)

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
brsbl added a commit that referenced this pull request Jun 11, 2026
…e path)

The sidebar worktree icon was GitBranch, which reads as "branch" (the same glyph
used for the branch name in env summaries) and doesn't match the info page. Point
getEnvironmentWorkspaceDisplayIconName at FolderGit (FolderGitTwoIcon): a worktree
is a git-backed folder, it matches the convention PR #86 adds to the info-page
workspace-path row, and it's clearly distinct from the fork glyph. The registry
entry is placed to match PR #86 exactly so the two branches merge cleanly.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@brsbl
brsbl merged commit e08ad30 into main Jun 11, 2026
6 checks passed
@brsbl
brsbl deleted the bb/show-prs-in-thread-info-page-thr_7nws88uvej branch June 11, 2026 21:50
SawyerHood added a commit that referenced this pull request Sep 18, 2026
…me (#3906)

## Human comments

## What was wrong

With an agent working and the user doing nothing, the app kept roughly
one CPU core busy. The cause is the working shimmer: `.animate-shine`
animates `background-position` and `.animate-shine-icon` animates
`mask-position`. The compositor cannot run either, so every frame at 60
fps is a full main-thread style, paint, layerize, and commit pass, and
the cost of that pass grows with the weight of the page around the
label.

A DevTools trace of an idle app with one working thread showed 804
main-thread frames in 13.6 s with about 1% of the time in JavaScript.
Every frame repainted the same four nodes (two title spans, two status
icons). By OS thread: renderer main 47% of a core, GPU 28%, browser 13%,
compositor 8.5%, Viz 7%.

There is no single regressing commit. The text sweep dates from the
initial commit, the icon mask from #86, and `will-change: transform`
from #1880 measured neutral (52.6% vs 50.7%). What grew is the page: on
a synthetic timeline the same animation costs 41%, 52%, and 76% of a
core at 300, 2,500, and 8,000 rows. The sweep also kept costing CPU
while hidden, which is what #768 worked around with
`animation-play-state`.

## What changed

The sweep is now an animated image used as a mask, with the same look.

- `apps/app/src/components/ui/shine-sweep.png`: a 2.6 KB, 128x2 APNG
whose alpha band (50% to 100% to 50%) travels left to right once a
second. `theme.css` stretches it over the element with `mask-size: 100%
100%`. The mask carries alpha only, so one file serves every theme,
label, and icon; the text stays real DOM text.
- Chromium advances animated images on the compositor, so the page's
main thread does no work for the shimmer, and a hidden mask is not drawn
at all.
- `apps/app/scripts/generate-shine-sweep.mjs` writes the APNG with no
dependencies (`pnpm --filter @bb/app generate:shine-sweep`). The file
stays under Vite's 4 KB inline limit, so production CSS embeds it as a
data URI and no separate request is made.
- `.animate-shine` and `.animate-shine-icon` share one rule; the `shine`
and `shine-mask` keyframes are gone. Reduced motion and `inert` /
`aria-hidden` hosts set `mask-image: none`.
- `ThreadStatusGlyph`: removed the `animation-duration: 1.5s` override
on the plugin status icon, which no longer has any effect.

Behavior differences from the CSS sweep:

- Icons sweep once a second like labels, instead of on their own 2.6 s
cycle, and their edge alpha is 0.5 instead of 0.45.
- The sweep redraws 20 to 30 times a second instead of 60.
- All shimmering elements share the image's clock, so they sweep in
phase.
- The cadence lives in the file, so `animation-duration` /
`animation-play-state` no longer affect it.

No wire, CLI, config, or plugin API change. Plugins that use the classes
get the new behavior from the host CSS.

## How you verified

- New tests in `theme.test.ts` (fail before, pass after): the shared
mask rule and absence of a CSS animation, the reduced-motion and
hidden-host rules, and the APNG itself (frame count matches its control
chunk, loops forever, runs 1 s, under 4 KB).
- `pnpm exec turbo run test --filter=@bb/app --
src/components/ui/theme.test.ts
src/components/sidebar/ThreadRow.test.tsx
src/components/ui/height-transition.test.tsx
src/components/ui/scroll-to-bottom-button.test.tsx`: 127 tests pass.
- `pnpm exec turbo run typecheck lint --filter=@bb/app`: pass, 0 lint
errors.
- Other readers of `theme.css`: `pnpm exec turbo run test
--filter=@bb/mobile` (307 tests) and `pnpm exec turbo run generate
--filter=@bb/plugin-build` pass.
- `pnpm exec turbo run build --filter=@bb/app`: the PNG is inlined into
the main CSS byte-for-byte, no separate asset is emitted, and
`check-bundle-budget.mjs` passes.
- Measured in headless Chromium (per-process CPU from `/proc`, frame and
paint counts from a trace):

| | main-thread frames/s | paints/s | draws/s | CPU (% of a core) |
|---|---|---|---|---|
| Ladle streaming story, before | 60 | 240 | 60 | 13.3 |
| Ladle streaming story, after | 0 | 0 | 20 | 4.6 |
| Synthetic 2,500-row page, before | 60 | 300 | 60 | 53 |
| Synthetic 2,500-row page, after | 0 | 0 | 20 | 8 to 9 |
| Same page, shimmer inside a collapsed container, before | 60 | 60 | 0
| 32 |
| Same page, shimmer inside a collapsed container, after | 0 | 0 | 0 |
0.8 (idle) |

- Look: the mask frames use the same triangle profile as the CSS
gradient, a side-by-side real-time capture of the Ladle stories shows
the same sweep in Chromium, and the owner compared it with the old sweep
on an iPhone.
- Not verified: Firefox, and the CPU cost in WebKit (only the look was
checked there).

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

> AGENT GENERATED

Co-authored-by: Claude Code <[email protected]>
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