Skip to content

Make environment host labels responsive - #2056

Merged
ymichael merged 1 commit into
mainfrom
bb/environment-host-labels-responsive
Aug 20, 2026
Merged

Make environment host labels responsive#2056
ymichael merged 1 commit into
mainfrom
bb/environment-host-labels-responsive

Conversation

@ymichael

Copy link
Copy Markdown
Collaborator

What was wrong

The environment label treated the primary host as implicit even when a server had multiple hosts, so large-screen composers did not consistently identify where a thread would run. The follow-up summary also rendered its compact label at every width, which let a secondary host remain visible on narrow screens instead of switching to a host-free compact label.

What changed

  • Prefix full-size new-thread and follow-up environment labels with the selected host whenever the server knows multiple hosts.
  • Keep compact web labels host-free, including offline states.
  • Render distinct full and compact values in the follow-up environment summary.
  • Keep the native-mobile environment pill host-free; the separate host picker still identifies and changes the selected machine.
  • Add focused web and mobile coverage for the host-count and responsive-label behavior.
  • No server/daemon wire contract changed, so HOST_DAEMON_PROTOCOL_VERSION is unchanged.

How you verified

  • pnpm exec turbo run test --filter=@bb/app --force -- src/components/pickers/EnvironmentPicker.test.tsx src/components/promptbox/ThreadEnvironmentSummary.test.tsx — 12 tests passed.

  • pnpm exec turbo run test --filter=@bb/mobile --force -- src/screens/pickers/environment-picker-model.test.ts — 1 test passed.

  • pnpm exec turbo run typecheck --filter=@bb/app

  • pnpm exec turbo run typecheck --filter=@bb/mobile

  • pnpm exec turbo run lint --filter=@bb/app --filter=@bb/mobile — 0 errors; 144 pre-existing app warnings.

  • Dev-browser comparison against origin/main, using the same two-host fixture at 1280px and 390px:

    Surface Before After
    New thread, desktop, primary host Work locally Michael-M4 · Work locally
    New thread, phone Local Local
    Follow-up, desktop, primary host Local Michael-M4 · Working locally
    Follow-up, desktop, secondary host Mac Studio · Remote Mac Studio · Working remotely
    Follow-up, phone, secondary host Mac Studio · Remote Remote

Fixes: N/A (no issue filed).

AGENT GENERATED: by GPT-5

@bb-slop-cop bb-slop-cop Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 SLOP COP 🚨 · review

Plain English summary: This PR changes environment labels so wide screens show host names and narrow screens show shorter labels.

I am the Slop Cop. I am reviewing this PR for security, code quality, performance, architecture, and end-to-end behavior.

@ymichael
ymichael merged commit 0056109 into main Aug 20, 2026
22 of 23 checks passed
@ymichael
ymichael deleted the bb/environment-host-labels-responsive branch August 20, 2026 18:33
label="Environment"
value={visibleEnvironmentLabel}
compactValue={visibleEnvironmentLabel}
value={environmentLabel}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 slopcop/review — The wide follow-up label truncates.

value now receives a host-prefixed label. The chip still has a 10-rem maximum width.

In the two-host browser test, the text needed 189 pixels but received 130 pixels. The compact label displayed correctly at 390 pixels.

Please allow more width or preserve the mode when the host name truncates. The new unit test checks text nodes only.

value={visibleEnvironmentLabel}
compactValue={visibleEnvironmentLabel}
value={environmentLabel}
compactValue={environmentCompactLabel}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 slopcop/review — The optional compact label can disappear.

environmentCompactLabel remains optional. When a caller omits it, OptionDisplay omits the compact span.

The container CSS hides the full span below 34 rem. The environment label then becomes empty.

Restore environmentCompactLabel ?? environmentLabel, or require the compact label.


describe("describeEnvironmentSelection", () => {
it("omits the machine name from the mobile environment label", () => {
expect(describeEnvironmentSelection(worktreeSelection, host, []).label).toBe(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 slopcop/review — Prettier rejects this new test file.

pnpm exec prettier --check apps/mobile/src/screens/pickers/environment-picker-model.test.ts reports a style error here.

Please format this test.

@bb-slop-cop bb-slop-cop Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 SLOP COP 🚨 · review

Plain English summary: Wide web views now show the computer name. Narrow web views and mobile show shorter environment labels.

I found one visible layout issue and two smaller issues.

  • Medium: The wide follow-up label still uses a 10-rem limit. The browser clipped a 189-pixel label into a 130-pixel text area.
  • Low: An omitted compact label creates an empty environment label below 34 rem. The public component prop still permits this omission.
  • Low: Prettier rejects the new mobile test file.

I found no security defect. React renders host names as text, and this change gives no host data to a new user.

I found no material performance problem. The new host lookup uses a memoized, linear search and adds no network request.

I scanned the related label code. The new-thread picker and the follow-up summary use different domain inputs, so a shared formatter would not simplify them.

The mobile model split follows the existing folder pattern. The primaryHostId field remains necessary for the projectless machine picker.

All GitHub CI checks pass. The focused web tests passed 12 tests. The full mobile suite passed 826 tests, and both type checks passed.

The doobie test used two hosts. At 1280 pixels, web showed the host-prefixed labels. At 390 pixels, it showed Local and Worktree.

An extra full web run ended without a final summary during concurrent local QA. The passing CI app shards provide the complete web test result.

I posted this review as a comment only.

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