Skip to content

fix(status-bar): re-measure collapsing levels when only the collapsed width moves - #23773

Merged
AmethystLiang merged 1 commit into
mainfrom
fix/status-bar-density-fit-invalidation
Sep 29, 2026
Merged

AmethystLiang merged 1 commit into
mainfrom
fix/status-bar-density-fit-invalidation

Conversation

@AmethystLiang

@AmethystLiang AmethystLiang commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​9 $\color{#cf222e}{\Huge{\mathbf{−}}}$​6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​3
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​10 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​8

ELI5

When the bar is tight, calm usage chips fold into a "+N" chip. The bar remembers how wide each layout was so it can pick the roomiest one that fits. If a provider stopped being urgent, that remembered width could go stale, and the bar stayed icon-only even though the labels would fit again.

What Changed

Before: after a usage provider went from urgent back to calm, the status bar could stay in its tightest, icon-only layout even with room for labels.
After: it steps back up to the labelled layout as soon as that fits.

Mechanism: recordStatusBarDensityWidth caches two widths per density level — the full ("natural") width and the "fit" width with calm chips folded into "+N". The cache was cleared only when the natural width changed. Urgency changes which chips stay pinned, which moves the fit width without touching the natural width. Now, when only the fit width moves, the other collapsing levels' cached widths are dropped so they get re-measured. Non-collapsing levels keep their cache, since their fit always equals their natural width.

Why

Follow-up to review feedback on #23689 (CodeRabbit). Dropping only the collapsing levels avoids re-probing every level on each urgency flip, while still guaranteeing the picker never compares against a stale fit width.

Linked Issue

Follow-up to #23689

Visual Proof

N/A — edge-case fix in width-cache invalidation; covered by a unit test.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

status-bar-density.test.ts now covers a fit-only change on a collapsing level. pnpm tc:web and oxlint are clean.

Review

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Renderer-only, pure function change. No platform, SSH, or wire impact.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@pullfrog

pullfrog Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

This run was cancelled 🛑

The workflow was cancelled before completion. Please check the link below for details.

Pullfrog  | View workflow run | via Pullfrog | 𝕏

@AmethystLiang
AmethystLiang merged commit 85ad292 into main Sep 29, 2026
2 of 6 checks passed
@greptile-apps

greptile-apps Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 4/5

[Medium risk] Changes how status bar density levels are recalculated.

The PR appears safe to merge, with a non-blocking gap in regression coverage.

Findings

  1. P2 Test misses the relevant level ▶

Summary

The PR invalidates cached collapsing-level widths when a re-measurement changes only the collapsed fit width, while retaining non-collapsing widths.

  • Adds a unit test for fit-only invalidation, though it does not exercise the level the picker needs to re-probe.

Reviews (1) · Last reviewed commit: "fix(status-bar): re-measure collapsing l..."

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