Skip to content

Custom sidebars: project PR context from per-panel state, not the focused-panel mirror - #5823

Merged
azooz2003-bit merged 3 commits into
mainfrom
fix-custom-sidebar-pr-context
Jun 10, 2026
Merged

azooz2003-bit merged 3 commits into
mainfrom
fix-custom-sidebar-pr-context

Conversation

@azooz2003-bit

@azooz2003-bit azooz2003-bit commented Jun 10, 2026 •

Copy link
Copy Markdown
Collaborator

Custom-sidebar templates read workspaces[i].pr to know a workspace's pull-request state, but the interpreter context projected it from Workspace.pullRequest, a focused-panel mirror that only refreshes while its panel is focused. In live sessions the mirror is routinely nil for background workspaces whose panelPullRequests hold a known open PR, so status-style sidebars (e.g. a review-lane board) silently miss workspaces that are in review. The native sidebar pills and cmux sidebar-state already read the per-panel list and disagree with the interpreter context on the same workspace.

Fix: project the context from sidebarPullRequestsInDisplayOrder() (the same per-panel, display-ordered, branch-validated list the native pills use). pr stays the first entry for backward compatibility, and a new prs array exposes every PR cmux knows for the workspace. The projection lives in a new Workspace.customSidebarPullRequestValues() seam so it is unit-testable; the validator's representative context and docs/custom-sidebars.md are updated for prs.

Two-commit structure: the first commit adds the extraction seam (behavior unchanged, still mirror-based) plus the regression test, which fails red on CI; the second commit switches the seam to the per-panel list and goes green.

Localization audit: no user-facing strings changed (interpreter data fields, validator sample context, and an engineering doc only).

🤖 Generated with Claude Code


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.


Summary by cubic

Fixes custom sidebar PR and branch context to use per-panel state in display order, matching the native sidebar and preventing missed PRs or stale branch info in background workspaces. Adds prs to the interpreter context while keeping pr as the first entry for compatibility.

  • Bug Fixes
    • Project PRs from sidebarPullRequestsInDisplayOrder() instead of the focused-panel mirror.
    • Read git branch from sidebarGitBranchesInDisplayOrder().first for custom-sidebar branch/dirty, provider branchSummary, and v2 branch_summary.
    • Add Workspace.customSidebarPullRequestValues() seam with tests; update validator sample context and docs/custom-sidebars.md.

Written for commit 0c264c6. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • New Features

    • Sidebar now exposes an ordered list of pull requests (prs) and a primary pr for display, including number, status, URL, branch when present, and staleness.
  • Tests

    • Added tests covering sidebar pull-request values, including focused-panel nil and no-pull-request scenarios.
  • Documentation

    • Clarified workspace pr and prs data shape.
  • Chores

    • Validation defaults now include an empty prs array.
  • Bug Fixes

    • Workspace branch summary and serialized payload now derive from sidebar branch ordering.

Verification note: the hosted tests job cannot prove the red/green structure: its full-suite step hits the 900s CMUX_UNIT_TEST_TIMEOUT_SECONDS around the alphabetically-early suites and passes anyway, so cmuxTests/Workspace* classes (including this PR's regression test) never execute there. The red/green proof for WorkspaceCustomSidebarPullRequestContextTests was run as targeted xcodebuild test -only-testing: invocations on the AWS M4 Pro builder against both commits; results posted in a PR comment. The suite-truncation gap itself is being filed separately.

…d on the focused-panel mirror

The interpreter context for custom sidebars projects workspaces[i].pr from
Workspace.pullRequest, a focused-panel mirror that only refreshes while its
panel is focused. Live sessions routinely hold open PRs in panelPullRequests
with a nil mirror, so status templates miss workspaces that are in review.

This commit extracts the projection seam (still mirror-based, behavior
unchanged) and adds the regression test, which fails until the next commit
switches the seam to sidebarPullRequestsInDisplayOrder().

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 10, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cmux Ready Ready Preview, Comment Jun 10, 2026 9:42pm
cmux-staging Building Building Preview, Comment Jun 10, 2026 9:42pm

@coderabbitai

coderabbitai Bot commented Jun 10, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 3db373c6-1f0c-40c0-88e7-81a83ced3b89

📥 Commits

Reviewing files that changed from the base of the PR and between 1af4932 and 0c264c6.

📒 Files selected for processing (2)
  • Sources/ContentView.swift
  • Sources/TerminalController.swift

📝 Walkthrough

Walkthrough

Adds Workspace.customSidebarPullRequestValues(), uses it in ContentView and TerminalController to populate pr/prs and branch summary, updates validator sample data, adds tests validating projection and empty state, updates docs, and wires new source/test files into the Xcode project.

Custom Sidebar Pull Request Values

Layer / File(s) Summary
Implementation: Workspace and UI integration
Sources/Workspace+CustomSidebarPullRequests.swift, Sources/ContentView.swift, Sources/TerminalController.swift, Packages/CmuxSwiftRenderUI/.../CustomSidebarValidator.swift
Adds customSidebarPullRequestValues() mapping sidebar pull requests into SwiftValue objects; ContentView sets fields["pr"] to the first entry and fields["prs"] to the array; branch and branchSummary now come from sidebarGitBranchesInDisplayOrder().first; validator sample gains a "prs" key.
Tests
cmuxTests/WorkspaceCustomSidebarPullRequestContextTests.swift
Adds two @MainActor XCTest cases: one ensures per-panel PR data projects when focused-panel mirror is nil, the other ensures an empty array when no PRs exist.
Xcode project wiring
cmux.xcodeproj/project.pbxproj
Registers the new source and test files as PBXBuildFile/PBXFileReference entries, includes them in the Sources group and cmux/test targets' PBXSourcesBuildPhase.
Documentation
docs/custom-sidebars.md
Documents pr (first PR) and prs (array of PR objects) in the workspaces live-data shape.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • manaflow-ai/cmux#2797: Related changes to cached PR metadata and panel PR state that this PR reads when building pr/prs.

Poem

A rabbit peeks at sidebar rows,
Numbers, labels — how the data flows.
Branches tucked where needed be,
Tests hop through logic, safe and free.
Build lines wired; the sidebar knows. 🐰


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (2 errors, 1 warning)

Check name Status Explanation Resolution
Cmux Algorithmic Complexity ❌ Error PR introduces repeated calls to sidebarGitBranchesInDisplayOrder() in hot UI paths: extensionWorkspaceSnapshot (line 11871 & 11884) and v2ExtensionSidebarWorkspacePayload (line 4375 & 4389), each c... Cache sidebarGitBranchesInDisplayOrder() result once per workspace in extensionWorkspaceSnapshot and v2ExtensionSidebarWorkspacePayload, reusing for both branchSummary and gitBranches fields.
Cmux Source Artifacts ❌ Error Pull request violates source-control-artifacts.md by committing 26 files under .claude/ and .agents/ directories. These hidden scratch directories (.claude/commands/.md, .claude/skills/, .claude/... Remove .claude/ and .agents/ directory contents from the commit, or add them to .gitignore (not just .claude/worktrees/) to prevent accidental commits of tool artifacts.
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (18 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and specifically describes the main change: switching custom sidebar PR context from the focused-panel mirror to per-panel state, which is the primary fix addressed across all modified files.
Description check ✅ Passed The description comprehensively covers the problem (focused-panel mirror causing missed PRs), the solution (using per-panel state), implementation details, testing approach, and notes the absence of user-facing string changes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Cmux Swift Actor Isolation ✅ Passed All production changes properly maintain Swift actor isolation. The new Workspace.customSidebarPullRequestValues() method on the @MainActor class inherits proper isolation, returns Sendable values,...
Cmux Swift Blocking Runtime ✅ Passed PR introduces no blocking runtime patterns; new code uses non-blocking data projection via map() without semaphores, locks, sleeps, or sync dispatch.
Cmux Expensive Synchronous Load ✅ Passed PR adds lightweight data projection methods (customSidebarPullRequestValues, sidebarGitBranchesInDisplayOrder) with no expensive synchronous loaders (no RestorableAgentSessionIndex.load, file I/O,...
Cmux Cache Substitution Correctness ✅ Passed Both old and new code read from @Published mirrors (focused-panel vs per-panel) rather than fresh reads. The snapshots are built fresh on each UI render (not persisted/archived), so no cache-substi...
Cmux No Hacky Sleeps ✅ Passed The check applies only to TypeScript, JavaScript, shell, and non-Swift build/runtime scripts. This PR contains only Swift code, Xcode configuration, and documentation—no applicable file types are m...
Cmux Swift Concurrency ✅ Passed PR introduces only synchronous data-projection functions and field assignments; no legacy async patterns (DispatchQueue, fire-and-forget Tasks, Combine, completion handlers) are introduced or expan...
Cmux Swift @Concurrent ✅ Passed All Swift changes are synchronous data transformations with proper @MainActor isolation; no missing/invalid @concurrent annotations, no heavy I/O without actor hops.
Cmux Swift File And Package Boundaries ✅ Passed PR adds only a 24-line focused extension (pure data projection, single responsibility), makes net -6 and -34 line changes to existing oversized files, and includes proper unit tests. No file/respon...
Cmux Swift Logging ✅ Passed PR contains no logging violations: no print/debugPrint/dump/NSLog added; no ad hoc logging; no MainActor+Logger issues; no secrets exposed. New code follows Swift logging rules.
Cmux User-Facing Error Privacy ✅ Passed PR adds PR projection method and sidebar data shape changes with no new user-facing error messages or sensitive information exposure; only public PR metadata displayed in native UI is exposed.
Cmux Full Internationalization ✅ Passed PR adds data field keys for template binding and developer documentation only; no user-facing strings, UI text, or localization keys added or modified. Changes include tests (excluded per guideline...
Cmux Swiftui State Layout ✅ Passed PR contains no SwiftUI state layout violations: all changes are pure data projection methods and model extensions without new @State/@Published/@StateObject/@EnvironmentObject, GeometryReader, lazy...
Cmux Architecture Rethink ✅ Passed PR migrates custom-sidebar PR context from a problematic focused-panel mirror to the existing per-panel state source. No timing, observers, locks, caches, duplicate wiring, or new state owners intr...
Cmux Swift Auxiliary Window Close Shortcuts ✅ Passed PR adds Workspace+CustomSidebarPullRequests.swift and updates sidebar data projections in ContentView.swift and TerminalController.swift, but contains no new or modified standalone cmux-owned windo...
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-custom-sidebar-pr-context

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps

greptile-apps Bot commented Jun 10, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes custom-sidebar templates reading stale workspace PR data. The focused-panel pullRequest mirror is only refreshed while its panel is active, so background workspaces with known open PRs appeared PR-less to the interpreter. The fix routes the context through sidebarPullRequestsInDisplayOrder() (the same per-panel, display-ordered list the native pills use) via a new Workspace.customSidebarPullRequestValues() seam. The same focused-panel mirror issue was also addressed for git branch_summary in TerminalController and the extension sidebar snapshot.

  • New customSidebarPullRequestValues() reads sidebarPullRequestsInDisplayOrder() instead of workspace.pullRequest; ContentView.customSidebarWorkspaceValue() is updated to call it, adding a prs array field alongside the existing pr field for backward compatibility.
  • branch_summary in both TerminalController and extensionWorkspaceSnapshot is switched from workspace.gitBranch?.branch (focused-panel mirror) to workspace.sidebarGitBranchesInDisplayOrder().first?.branch, applying the same consistency fix to git branch reporting.
  • Tests cover the nil-mirror regression case and the zero-PR case; the validator representative context and docs/custom-sidebars.md are updated for prs.

Confidence Score: 5/5

Safe to merge — the fix correctly routes all three consumer paths through the per-panel authoritative store, the seam is unit-tested against the exact nil-mirror regression, and no actor isolation or behavioral regressions were found.

The change is narrowly scoped: a new 24-line extension, two targeted call-site swaps, and matching doc/validator updates. The two previously flagged concerns (missing second commit and dead-code seam) are both resolved in the final state. Actor isolation is sound — all call sites are on @mainactor. The template interpreter handles absent keys gracefully (returns [] for for-loop sequences when the key is missing), so the absent-prs-when-no-PRs design is safe.

No files require special attention.

Important Files Changed

Filename Overview
Sources/Workspace+CustomSidebarPullRequests.swift New seam that correctly reads sidebarPullRequestsInDisplayOrder() — the per-panel, display-ordered list — rather than the stale focused-panel pullRequest mirror.
Sources/ContentView.swift customSidebarWorkspaceValue() wired to the new seam (pr + prs fields); gitBranch mirror replaced with sidebarGitBranchesInDisplayOrder() in both customSidebarWorkspaceValue() and extensionWorkspaceSnapshot().
Sources/TerminalController.swift branch_summary field aligned to sidebarGitBranchesInDisplayOrder().first?.branch, consistent with how pull_request_urls already used the per-panel list.
cmuxTests/WorkspaceCustomSidebarPullRequestContextTests.swift Two targeted tests: nil-mirror regression (sets panelPullRequest then clears the mirror, expects seam to return the panel data) and zero-PR baseline. Both cover the critical divergence path.
Packages/CmuxSwiftRenderUI/Sources/CmuxSwiftRenderUI/Sidebar/CustomSidebarValidator.swift Adds prs: .array([]) to the representative validator context so templates referencing prs can be validated.
docs/custom-sidebars.md Documents pr as first PR in display order and adds prs (same shape, all known PRs) under the existing conditional-fields paragraph.
cmux.xcodeproj/project.pbxproj Registers Workspace+CustomSidebarPullRequests.swift in the app target and WorkspaceCustomSidebarPullRequestContextTests.swift in the test target.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    subgraph PerPanel["Per-panel store (always authoritative)"]
        PP[panelPullRequests\n UUID → SidebarPullRequestState]
        PG[panelGitBranches\n UUID → SidebarGitBranchState]
    end

    subgraph Mirror["Focused-panel mirror (stale for background workspaces)"]
        WPR[workspace.pullRequest\n refreshes only while panel is focused]
        WGB[workspace.gitBranch\n refreshes only while panel is focused]
    end

    subgraph Seam["New seam — Workspace+CustomSidebarPullRequests"]
        SPR[sidebarPullRequestsInDisplayOrder\n branch-validated, ordered]
        SGB[sidebarGitBranchesInDisplayOrder\n ordered, falls back to mirror]
        CSV[customSidebarPullRequestValues\n → SwiftValue objects]
    end

    subgraph Consumers["Consumers"]
        CV[ContentView\ncustomSidebarWorkspaceValue\npr + prs fields]
        EW[ContentView\nextensionWorkspaceSnapshot\nbranchSummary]
        TC[TerminalController\ncmux sidebar-state\nbranch_summary]
    end

    PP --> SPR
    PG --> SPR
    PG --> SGB
    WGB -.->|fallback only| SGB

    SPR --> CSV
    CSV --> CV
    SGB --> CV
    SGB --> EW
    SGB --> TC

    WPR -.->|OLD — removed| CV

    style WPR fill:#f99,stroke:#c00
    style WGB fill:#f99,stroke:#c00
    style CSV fill:#9f9,stroke:#090
    style SPR fill:#9f9,stroke:#090
    style SGB fill:#9f9,stroke:#090
Loading

Reviews (3): Last reviewed commit: "Fix remaining gitBranch mirror reads in ..." | Re-trigger Greptile

Comment on lines +7 to +10
func customSidebarPullRequestValues() -> [SwiftValue] {
guard let pullRequest else { return [] }
return [Self.customSidebarPullRequestValue(pullRequest)]
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Fix commit is missing — seam still reads the stale mirror

customSidebarPullRequestValues() guards on pullRequest (the focused-panel mirror) and returns [] when it is nil. The PR description explicitly states that commit 1 leaves this in the "old mirror-based" state and that commit 2 switches it to sidebarPullRequestsInDisplayOrder() — but git log for this branch shows only one commit (b21f7cebb). The regression test (testValuesIncludePanelPullRequestWhenFocusedPanelMirrorIsNil) deliberately sets workspace.pullRequest = nil after populating a panel PR, and expects values.count == 1. With the current implementation that test will always return [] and fail. The second commit that wires the seam to sidebarPullRequestsInDisplayOrder() is absent.

Comment on lines +7 to +10
func customSidebarPullRequestValues() -> [SwiftValue] {
guard let pullRequest else { return [] }
return [Self.customSidebarPullRequestValue(pullRequest)]
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Seam is dead code — interpreter context is not wired to it

ContentView.customSidebarWorkspaceValue() (line 10740 in ContentView.swift) still builds the "pr" field inline with if let pr = workspace.pullRequest { ... }. customSidebarPullRequestValues() is defined but never called from any production code path, so even once the seam is fixed to read sidebarPullRequestsInDisplayOrder(), the interpreter context will continue to reflect the stale mirror. The call site in ContentView.swift needs to be updated to use the new seam, and the current inline projection needs to be removed.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Sources/Workspace`+CustomSidebarPullRequests.swift:
- Around line 7-10: customSidebarPullRequestValues currently returns [] whenever
Workspace.pullRequest is nil; instead, when pullRequest is nil read the
authoritative per-panel, display-ordered PR source and map all entries to
SwiftValue using Self.customSidebarPullRequestValue. Concretely, update
customSidebarPullRequestValues() to: if let pullRequest { return
[Self.customSidebarPullRequestValue(pullRequest)] } else fetch the panel's
display-ordered PR collection (the per-panel PR source), iterate that collection
in display order and return map { Self.customSidebarPullRequestValue($0) } so
background/cold workspaces still emit PR context rather than an empty array.
Ensure you reference the same display ordering used by the UI.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 2133febc-15d8-46f6-aa07-6f46d1164204

📥 Commits

Reviewing files that changed from the base of the PR and between 4967768 and b21f7ce.

📒 Files selected for processing (3)
  • Sources/Workspace+CustomSidebarPullRequests.swift
  • cmux.xcodeproj/project.pbxproj
  • cmuxTests/WorkspaceCustomSidebarPullRequestContextTests.swift

Comment thread Sources/Workspace+CustomSidebarPullRequests.swift Outdated
Switch Workspace.customSidebarPullRequestValues() from the focused-panel
pullRequest mirror to sidebarPullRequestsInDisplayOrder(), the same
per-panel, branch-validated list the native sidebar pills use. ContentView
now feeds workspaces[i].pr from its first entry and exposes the full list
as workspaces[i].prs; the validator sample context and custom-sidebar docs
document the new field.

Fixes the green half of the regression test added in the previous commit.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Sources/ContentView.swift`:
- Around line 10741-10744: The current block only sets fields["prs"] when
pullRequestValues.first exists, which omits an empty prs array for workspaces
with no PRs; modify the logic in the block around
pullRequestValues/firstPullRequest so that fields["pr"] remains conditional (set
only if firstPullRequest exists) but fields["prs"] is always assigned (set
fields["prs"] = .array(pullRequestValues) unconditionally regardless of
firstPullRequest). Ensure you update the code that references pullRequestValues
and firstPullRequest to reflect this change.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 1010324e-ba5b-48f6-8c03-4d8513c103dc

📥 Commits

Reviewing files that changed from the base of the PR and between b21f7ce and 1af4932.

📒 Files selected for processing (4)
  • Packages/CmuxSwiftRenderUI/Sources/CmuxSwiftRenderUI/Sidebar/CustomSidebarValidator.swift
  • Sources/ContentView.swift
  • Sources/Workspace+CustomSidebarPullRequests.swift
  • docs/custom-sidebars.md

Comment thread Sources/ContentView.swift
Comment on lines +10741 to 10744
if let firstPullRequest = pullRequestValues.first {
fields["pr"] = firstPullRequest
fields["prs"] = .array(pullRequestValues)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Always emit prs; keep only pr conditional.

On Line 10743, fields["prs"] is currently gated by the first check. That drops workspaces[i].prs entirely for no-PR workspaces, which breaks the new context shape for empty state. Keep backward compatibility by leaving pr conditional, but set prs unconditionally.

Proposed fix
 let pullRequestValues = workspace.customSidebarPullRequestValues()
+fields["prs"] = .array(pullRequestValues)
 if let firstPullRequest = pullRequestValues.first {
     fields["pr"] = firstPullRequest
-    fields["prs"] = .array(pullRequestValues)
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if let firstPullRequest = pullRequestValues.first {
fields["pr"] = firstPullRequest
fields["prs"] = .array(pullRequestValues)
}
fields["prs"] = .array(pullRequestValues)
if let firstPullRequest = pullRequestValues.first {
fields["pr"] = firstPullRequest
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Sources/ContentView.swift` around lines 10741 - 10744, The current block only
sets fields["prs"] when pullRequestValues.first exists, which omits an empty prs
array for workspaces with no PRs; modify the logic in the block around
pullRequestValues/firstPullRequest so that fields["pr"] remains conditional (set
only if firstPullRequest exists) but fields["prs"] is always assigned (set
fields["prs"] = .array(pullRequestValues) unconditionally regardless of
firstPullRequest). Ensure you update the code that references pullRequestValues
and firstPullRequest to reflect this change.

Audit of all Workspace.pullRequest / Workspace.gitBranch mirror readers
found three more sites projecting whole-workspace state from the
focused-panel gitBranch mirror: the custom-sidebar context's branch/dirty
fields, the provider snapshot's branchSummary, and the v2 extension
sidebar payload's branch_summary. All three now read
sidebarGitBranchesInDisplayOrder().first, the same per-panel display-order
source the native sidebar uses. Focused-panel reads that are intentional
(command palette search metadata, probe fallback, restore fingerprint)
were audited and left as-is.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

This branch was successfully deployed

1 active deployment
Preview – cmux — 0c264c6e Deployed Jun 10, 2026 by vercel[bot]
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