Skip to content

feat(sidebar): color tags on workspace cards for visual grouping - #18676

Open
Lowanski wants to merge 46 commits into
stablyai:mainfrom
Lowanski:feat/workspace-color-tags
Open

Lowanski wants to merge 46 commits into
stablyai:mainfrom
Lowanski:feat/workspace-color-tags

Conversation

@Lowanski

@Lowanski Lowanski commented Sep 4, 2026 •

Copy link
Copy Markdown

ELI5

Right-click a workspace and pick a color at the top of the menu. The card gets a thin colored line down its left edge. Give related workspaces the same color and you can see which ones belong together without reading their titles.

What Changed

  • A colorTag on workspace metadata (a normalized #rrggbb, or null), persisted, projected onto worktrees and folder workspaces, and sent over the RPC wire as a new optional field.
  • A 3px strip on the left edge of the workspace card, in the sidebar and on the workspace board.
  • A swatch row at the top of the workspace context menu: an empty slot, the seven preset repository colors, and a color wheel that opens the existing custom picker. Clicking the color a workspace already has clears it, and a multi-selection is tagged as a whole.
  • The custom picker previews on the card while you drag, saves on Enter or when you leave it, and Escape backs out.
  • Writes are serialized per workspace, pinned to the exact row (canonical identity, runtime owner, or host), fenced against refreshes that predate them, and gated on a new workspace.color-tag.v1 runtime capability so an older host refuses instead of silently dropping the field.

Why

Several worktrees of one project look alike in the sidebar, and telling them apart means reading titles or opening chats. A color the user chooses is the fastest visual grouping, and it reuses the repository badge palette and picker, so there is nothing new to learn.

Linked Issue

Fixes #18543

Visual Proof

Before, on main: no color controls in the workspace menu and no strip on the cards.

Workspace context menu on main, without color controls

After: the swatch row leads the menu, the wheel at the end opens the custom picker, and each tagged card carries its strip.

Workspace context menu with the color swatch row at the top

Testing

  • pnpm typecheck, oxlint, the changed-code quality gate, and pnpm test pass locally. On the head commit the full suite reports 71,427 passed and 294 skipped, with one failure in one file this diff does not touch, tests/e2e/cross-version-wire/release-checkout.unit.test.ts, an order-dependent flake that passes in isolation on the same commit. One earlier commit's full run was completely clean; the only other failure ever seen, structured-tui-transcript-catchup.test.ts, fails the same way on a clean main at 98e77ef.
  • Unit and store tests cover normalization, the swatch row, the picker, the write coordinator, identity and owner pinning, folder workspaces, the refresh fences, the runtime capability gate, and the main-process identity guard.
  • The rendered UI was verified on the dev build over Playwright CDP: assign from the menu, persist across a reload, clear by re-clicking, live preview in the picker, Enter saves, Escape restores.
  • Forty-one codex review passes were run against the branch across the feature and the review fixes; every finding was verified and fixed, and the last pass returned no findings on the head commit.

Author

GitHub: @Lowanski. No X account, so there is no handle for the @orca_build shout-out; please credit the GitHub handle if this ships.

AI Disclosure

Implemented with Claude Opus 5 via Claude Code. Design decisions (palette source, strip geometry, clear-by-empty-slot, menu placement) were made by me; the model did the codebase research, implementation, and test authoring.

Review

  • Cross-platform: no new shortcuts, paths, or platform branches. The strip is a positioned span with an inline background color.
  • Remote / SSH: colorTag is an optional field, so reads are Rule 1 safe per docs/reference/remote-wire-compatibility.md. Writes to a remote runtime require workspace.color-tag.v1. Each write is pinned to the exact row, by canonical identity or by runtime owner (null for a row the desktop lists itself), so two rows for one checkout never share a write, a fence, or a preview; a failed write rolls back only its own optimistic color, and the pinned identity also travels over local IPC where main verifies the occupant. The RPC schema keeps null on purpose so a clear survives the round trip.
  • Folder workspaces: carried through the type, normalization, projection, both schemas, the preload contract, the update whitelist, and the persistence operation. Folder color writes arm the same refresh fence the git rows use, since the folder catalog merges wholesale and has no optimistic apply.
  • Security: the value is re-validated as #rrggbb at every boundary, so a hand-edited data file cannot inject a CSS value.
  • Performance: one conditional span per card and no new store subscription on the card.
  • UI quality: follows docs/STYLEGUIDE.md. The palette and the picker are the existing repository-color primitives, the swatch row is one menu stop with arrow-key navigation, the picker is a popover rather than a submenu so its hex field stays keyboard-reachable, and the strip is decorative while the tag is also named in the card's accessible text.

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

Out of scope for this first pass: filtering or sorting by color, and grouping board lanes by color. The board already tints lanes by workspace status, so a tagged board shows status on the lane background and the tag on the card's edge; they sit in different positions and read as distinct.

Checklist

  • This PR is small and focused
  • I explained what changed and why (including ELI5)
  • 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)

Lowan Steinmetz and others added 30 commits September 3, 2026 16:07
Adds a user-assigned grouping color to each workspace, shown as a 3px
strip down the left edge of its card and assigned from the top of the
workspace context menu.

Parallel workspaces on one project are hard to tell apart when their
titles are similar - you end up opening each one to remember which is
which. A color assigned by hand groups them at a glance.

The strip renders in WorktreeCardSurface, so both the sidebar list and
the workspace board pick it up from one place. The palette reuses
REPO_COLORS and the custom picker reuses react-colorful, so presets and
custom values share one hex storage shape. The neutral swatch clears the
tag. Assignment applies to every workspace in a multi-selection, each on
its own execution host.

Extracts hex parsing out of repo-badge-color into shared/hex-color so
the two color features share one normalizer, and moves the context
menu's close-auto-focus handler next to the parent-picker handoff it
coordinates with (keeps the menu model under the max-lines limit).

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Two fixes to the color-tag row.

The "no tag" slot was the palette's neutral gray, so absence rendered as
a gray chip that looked like just another color choice. It is now an
explicit empty slot: an outlined circle with a slash, leading the row.
Neutral drops out of the assignable swatches, and "no tag" stops
borrowing a color to mean the absence of one.

Clicking the color a workspace already carries now removes it, so one
swatch both sets and clears without moving the pointer. The rule lives
in resolveWorkspaceColorTagSelection and compares normalized values, so
shorthand and mixed case still toggle. The custom picker deliberately
does not toggle - re-picking mid-drag must not clear what the drag just
set.

Because neutral is no longer a magic clear value, normalizeWorkspaceColorTag
stops special-casing it and gray becomes assignable through the custom
picker like any other hex.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…e whole selection, move the picker to a popover

Folder workspaces could never be tagged. updateWorktreeMeta routes
folder workspaces through getFolderWorkspaceMetaUpdates, a whitelist
rather than a spread, so colorTag was dropped and the write still
reported success. Carries the field through the FolderWorkspace type,
raw normalization, the worktree projection, the RPC schema, and the
persistence operation.

Toggle-off now keys off the whole selection. Passing only the
right-clicked workspace's color meant that on a mixed multi-selection,
picking a color that one card already had cleared every selected
workspace instead of unifying them. getSharedWorkspaceColorTag reports
a color only when the selection carries it uniformly.

The custom picker moved out of a menu submenu into an anchored Popover.
Radix menus manage their own focus and swallow Tab, so the hex field and
the picker's arrow keys were keyboard-dead inside a submenu. Its trigger
is now the last swatch in the row - a color wheel - so the whole palette
including "any color" reads as one strip.

The picker also no longer writes on every pointer move. react-colorful
emits a color per pixel of drag, which issued one metadata write per
selected workspace per move, and slow hosts could land an intermediate
color after the final one. The drag drives local state; the commit
happens on release, on blur, or on Enter.

Opening the picker is deferred one handoff past the menu teardown. The
click that picks the swatch also closes the menu, and a popover opened
in that tick read the tail of that click as an outside press and
dismissed itself, so both surfaces vanished. Same handoff the parent
picker performs.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The custom swatch opened the picker and both surfaces vanished. The
menu plays an exit animation, and Radix fires onCloseAutoFocus only
once it finishes - after the picker had already opened on a timer. The
menu's focus restore then sent focus to the sidebar, which is a
focus-outside for the popover, and Radix dismissed it on arrival.

Deferring the open by a longer delay could not fix this: the race is
against the menu's focus restore, not against the closing click. The
picker now takes ownership of onCloseAutoFocus while pending, skips the
focus restore, and opens on the next tick. This is the same handoff the
parent picker performs, and the reason its early return does not focus
the sidebar.

A fallback timer still opens the picker if a teardown never reports
close-auto-focus, and both paths are idempotent.

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

The custom picker saved nothing. It committed on the wrapper's pointerup
and blur, but react-colorful drives its drag with window-level mouse
events, so a release outside the wheel never reached the wrapper, and a
div does not blur. Closing the popover then unmounted it with the color
still uncommitted.

The picker now forwards every change. The store applies metadata
optimistically, so the card previews the color live as the user drags.
Closing the popover or pressing Enter forwards the final value once
more so what the user last saw is what settles. Opening and closing
without touching anything commits nothing - an earlier build stamped
the wheel's seed color onto an untagged workspace on dismiss.

Persistence is coalesced in the command: one write set is in flight
per card, and when it settles only the newest pending value is written.
That bounds writes by round trip rather than by pointer move and keeps
a slow host from landing an intermediate color after the final one.

Writes to a remote runtime are gated on workspace.color-tag.v1. Older
hosts strip colorTag from worktree.set and still report success, which
would paint a strip the next refresh silently erased; the client now
fails with a clear update prompt instead, matching the existing
worktree.github-pr-suppression.v1 gate.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…acts, preview off the store

Six findings, all verified against source.

Folder workspaces on the local path were still silently dropped: the
renderer whitelist forwarded colorTag, but the local IPC schema
(FolderWorkspaceUpdateArgs), the preload FolderWorkspacesApi.update
contract, and the renderer FolderWorkspaceUpdates type all omitted it,
so zod stripped the field and returned the unchanged row as a success.
All three now carry it. Remote folder writes are gated on
workspace.color-tag.v1 inside the folder mutation, mirroring its
existing Jira gate, since the worktree-meta gate never ran for folder
targets. The folder route now forwards executionHostId (single and
batch) so a folder id present on two hosts writes to the selected one.

Live preview no longer rides on the store. The coalescer's optimistic
apply was also its only store update, so on a slow host the card froze
on the first color for the whole round trip. Dragging now paints
through a transient preview channel keyed by host-qualified identity;
nothing is written until close or Enter, and an untouched open-and-close
still writes nothing.

The coalescer carries the target selection with each queued value - the
menu can reopen on a different multi-selection mid-flight - and a write
refused by an older remote host is surfaced as a toast instead of
disappearing on the next refresh.

The CLI transport test's expected pairing capabilities gain the new
entry; it asserts the literal list.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…d row a11y, broadcast host color changes

Six findings, all verified against source.

The picker acted on the wrong selection. The menu's multi-selection only
exists while the menu is open; once it closes the model falls back to the
clicked row, and a folder row passes no selection at all. The picker now
snapshots the context selection when it opens and previews and commits
against that snapshot. The command takes explicit targets for the same
reason, and the swatch row is bound to the live context selection.

Mixed selections read honestly. getSharedWorkspaceColorTag returns null
for both "all untagged" and "mixed", which marked the empty slot as
checked for a mixed selection. A separate isMixedWorkspaceColorTagSelection
now suppresses every checked state while picking a color still unifies.

The row is disabled on deletingContext rather than isDeleting, so a
selection with any deleting member cannot write into a half-failing
batch - matching the adjacent multi-workspace controls.

Keyboard users can hear what Enter will do. Focus stays on the row while
arrows move between swatches, so the row's accessible name now names the
active swatch.

Host-side color changes reach paired clients. The local updateMeta
handler only broadcast worktreesChanged for displayName; colorTag rides
the same gate, being a rare explicit action like rename.

The custom swatch is a symbol rather than a string literal: 'custom' was
absorbed into string and the type-aware lint gate rejected the union.

The color-tag hook now owns both of its render slots (row and picker),
which removes the plumbing from WorktreeContextMenuView and keeps it
under max-lines without a suppression.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…r, commit Enter from the wheel, accept shorthand hex

Twelve findings across two passes, all verified against source; two of
the fifth pass's findings had already been fixed by the fourth.

Escape now backs out. Radix routed it through onOpenChange(false), the
same path as leaving the popover, so it persisted the edit the user was
dismissing. onEscapeKeyDown clears the preview and closes without a
write.

A stored custom color lands the keyboard cursor on the wheel. indexOf
returned -1 for any non-preset tag and fell to the empty slot, so Enter
on the row cleared the tag the user was looking at. The wheel also reads
as selected for a non-preset tag.

Enter commits from anywhere inside the popover. Radix focuses the wheel
first, and the handler lived on the hex field alone.

The hex field accepts the shorthand the model does. A six-digit-only
pattern meant #abc never previewed or persisted; validity now comes from
the shared normalizer. The wheel is only ever fed a complete color, so a
partial draft like stablyai#1 no longer makes it jump; a half-edited field on
close commits the last complete color the card showed.

Only the open picker registers preview cleanup. Every card mounts a
popover, and a closed bystander scrolling out of a virtualized list
cleared the previews an open picker on another card was driving.

Preview writes are batched: one broadcast per pointer move across the
selection instead of selected times rendered.

Focus returns to the sidebar on close through the menu's own restore
path instead of falling to the document body.

The menu model tracks the picker in its lifecycle guard. An Agent Map
host completes the lifecycle on a 0 ms timer once the menu closes, which
tore the host down before the picker's handoff could open it. The model
now holds while the picker is pending, open, or animating out, exactly
as it does for the parent picker.

The runtime folder-workspace controller's update type carries colorTag,
matching the RPC schema that already forwarded it.

Draft state lives in a fields component mounted fresh per open, so there
is no reset-on-prop-change effect and no stale first render.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…ve the wheel from the palette

Three findings, all verified against source.

The write queue could drop a workspace's color. Pending state was a
single "latest batch" slot, so with a write for A in flight, "blue for
A+B" followed by "green for A+C" replaced the first wholesale and B never
got blue. Pending colors are now keyed by host-qualified target: when the
in-flight write lands, the newest color for each workspace is written.

A stale refresh could undo a color. mergeFetchedWorktrees preserved
concurrent manualOrder and displayName changes but not colorTag, and
color writes deliberately emit no local invalidation, so a fetch that
began before an assignment answered with the old tag and won until an
unrelated refresh. preserveConcurrentColorTag now mirrors the manualOrder
fence, and a store-level test races an optimistic write against an
in-flight fetch through both the worktree list and the detected list.

The custom wheel's gradient is derived from WORKSPACE_COLOR_TAG_SWATCHES
instead of a hand-copied hex list that had already drifted (it omitted
orange), so palette edits reach the wheel.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The renderer's useRef ratchet forbids work in the initializer, and the
per-target coalescer introduced useRef({ inFlight: false, pending:
new Map() }), which allocates a Map on every render and discards it
after the first. The ref now starts null and the queue is created on
first use inside the handler.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…il landing, fence pending writes

Three findings, all verified against source.

Color writes are now ordered by a single module-level coordinator with
one queue per host-qualified identity. A per-menu queue let A's menu and
B's menu write the same workspace concurrently, so an older request that
settled last could overwrite the user's final color. The coordinator
also subsumes the per-target coalescing and removes the useRef queue
entirely. Its promise resolves only once the write has landed.

The picker holds its preview until that promise settles. Clearing it the
instant the popover closed made a folder workspace, or a git write queued
behind another, snap back to the old strip for the whole round trip.

The fetched-worktree merge consults a pending-write tracker for colorTag,
as it already does for displayName. Comparing the fetch-start snapshot to
the current store misses a fetch that started after the assignment but
joined a listing captured before it - both already show the new color -
and color writes emit no local invalidation, so the stale answer stuck.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Two live findings, verified against source; the pass's P1 (an untyped
commit mock) had already been fixed by the seventh round.

Preview entries now remember which picker session set them, and a clear
removes only its owner's entries. A picker that had closed but was still
holding its preview for a slow write cleared the card identity-wide when
that write landed, erasing a newer live preview another picker had set on
the same card. Each open session mints its own owner in the per-open
fields component; the outer popover captures it at commit time so the
delayed clear targets exactly that session.

Focus restore on close now depends on why the popover closed. Every close
ran the sidebar focus restore, so a click onto another control - a
freshly opened menu, say - had its focus stolen after the exit animation
and was dismissed. A pointer dismiss leaves focus on the outside target;
keyboard and programmatic closes still return it to the sidebar.

The open-gated cleanup reads the closing session's owner through a stable
callback rather than inline in the effect cleanup, per react-hooks.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…elds, add the color write fence

Three findings, all verified against source.

Color-tag preview and write queues are keyed by canonical worktree
identity when the row carries one, falling back to host-qualified
identity. One nested-SSH worktree published through two paired runtimes
yields two rows with the same id and host; keying on host identity alone
previewed and queued them as one. The store's updateWorktreeMeta cannot
yet address a row by runtime owner - the adjacent status, pin, and unread
commands share that limit - so this change stops merging such rows
itself and leaves widening the store API as a separate change.

The wheel and validated hex field are now a shared ColorPickerFields,
extracted from ui/color-picker.tsx and used by both the repository badge
picker and the workspace color picker. The color-tag popover had
reimplemented the stack and lost the focus-ring treatment and the
invalid-input feedback along the way.

The color-tag write fence outlives the write. Releasing it the moment the
write settled let a fetch that had started after the assignment but
joined a listing captured before it merge its stale answer: its start
snapshot already showed the new color, so snapshot-vs-current saw no
change. Each fetch now records when it started, and MetaWriteFence stays
armed for any fetch that began before the write landed. Released entries
expire after twice the runtime RPC timeout.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…ity, record scan start times

Three findings, all verified against source.

A failed color write no longer fences out its own recovery. The fence
recorded a rejected write as landed, and the authoritative recovery fetch
that updateWorktreeMeta starts on failure begins within the same
millisecond, so it was fenced out and the failed optimistic color stayed
on the card with nothing left to revert it. MetaWriteFence now
distinguishes landed from failed and drops a failed entry outright.

updateWorktreeMeta gains an additive identityKey option. When one nested-
SSH checkout is published through two paired runtimes, the rows share id
and physical host but differ in canonical identity; addressing by id and
host recolored both and could route persistence through the wrong
runtime. A caller that knows the exact row pins it, and lookup, the
optimistic apply in both lists, and persistence all honour it. Color
writes pass the key; sibling commands are unchanged.

The merge fences on the scan's real start. A caller joining an in-flight
coalesced scan stamped its own, later start time, so a write that landed
between the scan's start and the join looked older than the fence and the
pre-write result undid it. The coalescer now records when the underlying
scan began, on both the runtime path and the lease path, and the merge
fences on the earlier of scan start and caller start.

The folder-workspace leg of updateWorktreeMeta and the color-tag fence
helpers move into their own modules, which is what keeps both files under
max-lines without a suppression.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…ect SSH, route pinned writes to their owner

Three findings, all verified against source, all in the two-HUB and
direct-SSH corner.

An identity-pinned write now persists through the pinned row's own
runtime. The identity key disambiguated the selector, but the transport
was still chosen by settingsForWorktreeOwner from id and physical host,
which with two runtime owners could pick the sibling HUB or local - and
the local IPC path carries no identity - so the pinned HUB never received
the write and a later refresh reverted it. The identity-matched row names
its runtimeOwnerEnvironmentId; settingsForRuntimeEnvironmentOwner routes
through exactly that.

The direct-SSH refresh path carries the shared lease's start time. It
built its own refresh without startedAt, so a caller that joined an
existing provider lease after a color landed was fenced by its own, later
start and the pre-write provider data overwrote the color.

The color-tag write fence is scoped by canonical identity when both the
writer and the merged row know it. Keyed by id and host, a write for HUB
A's row fenced HUB B's refresh of the same checkout and replaced B's fresh
tag with its stale local value. A side without an identity still matches
on id and host.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
… fence TTL to the pipeline

Two findings, both verified against source.

The direct-SSH refresh path recorded the shared scan's start inside
merge, which runs after the provider completes. The first owner therefore
stamped completion time, and a caller joining the lease after a color
write had landed inherited a start later than the write - its snapshot
already showed the new tag, so both fence checks missed and the pre-write
result restored the old one. The start is now captured immediately after
the lease is acquired and reused in merge.

Released fence entries now live for 120 s instead of 30 s. A stale
refresh can remain mergeable for far longer than the runtime RPC timeout
the old bound was derived from: a local listing has a 30 s budget, and
best-effort terminal teardown can hold the merge for another 30 s. A
fence pruned inside that window removed the only guard against the stale
merge restoring the old color.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…missing identity as not-found

Two findings, both verified against source.

A failed identity-pinned write now recovers through the pinned runtime.
The write itself already routed through the pinned row's owner, but both
failure paths refetched without one, so recovery followed the focused HUB
or was rejected as ambiguous and the failed optimistic color stayed
visible. The pinned owner is hoisted above the persist attempt and reused
for the recovery fetch as a runtime execution host.

An explicit identity that matches no row now returns not-found. It used
to fall back to the mutable id-and-host locator; the identity-filtered
optimistic apply changed nothing, but local and direct-SSH persistence
carry no identity, so the color could land on whatever now occupied the
path, or recreate metadata for a deleted workspace.

The hosted-review push-target resolution moves into its own module, which
keeps updateWorktreeMeta under max-lines without a suppression.

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

Two findings, both verified against source.

The pinned identity is re-resolved after the awaited push-target
preflight. It was resolved once, before the await, and reused after it;
catalog reconciliation can remove or replace the row during that yield,
and the identity-filtered reducers then updated nothing while persistence
still wrote through the mutable locator - local IPC carries no identity,
so a replacement at the same path received the stale row's color. A row
that vanished mid-flight now returns not-found.

Recovery after a failed remote write is awaited, and when it cannot
refresh the color is rolled back locally. The refetch was fire-and-forget
and, when the same host was away, failed too - fetchWorktrees merely
returned false - so the optimistic color stayed on the card after the
picker had already reported the failure. The rollback is scoped to
colorTag; other fields keep their existing semantics.

The post-update hosted-review refetch moves into its own module, which
keeps updateWorktreeMeta under max-lines without a suppression.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
One finding, verified against source.

The awaited recovery introduced for color rollback applied to every
failed metadata write, so a failed rename, comment, or link on a
disconnected host waited out a second remote-listing timeout before
updateWorktreeMeta could report the original failure. Recovery now
branches before the await: only a color write, which is the only field
that rolls back locally, waits to learn whether the refresh happened;
every other field keeps its original fire-and-forget reconciliation.

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

Two findings, both verified against source, both the same blind spot:
the fence maps and the identity lookup still keyed by the path-derived
id, which is exactly what changes when a checkout is recreated or a
folder is renamed.

The color fence now requires the incoming, start-snapshot, and current
rows to describe the same occupant. A checkout deleted and recreated at
the same path mid-refresh put a new occupant under the old id, and the
fence copied the previous occupant's optimistic color onto it. Rows
without identities keep the pre-identity behaviour.

findKnownWorktreeByIdentityKey no longer requires the requested id to
match; the requested id only picks the repository. A local first-work
folder rename retires the path-derived locator while the old row is still
visible, and a color write from that row persisted under the retired
locator - or, once the renamed row had arrived, was reported missing.
updateWorktreeMeta now resolves the identity's current id and applies,
persists, and recovers under that.

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

Two findings, both verified against source.

An identity-pinned row without a paired-runtime owner now routes through
the desktop's own provider. When the same SSH checkout is listed directly
by the desktop and through one HUB, the direct row carries an identity
but no runtime owner, so routing fell back to the id-and-host resolver,
which selected the HUB and sent it the desktop row's identity selector;
the HUB rejected the write and the equally unscoped recovery refreshed
the HUB, leaving the direct row's optimistic color behind. Such rows now
persist with no active runtime and recover against their own execution
host. The routing decision lives in pinned-worktree-owner-routing.ts,
which also keeps updateWorktreeMeta under max-lines.

The color fence now sees detected-only workspaces. Both snapshots it
received came from worktreesByRepo, so a workspace present only in the
detected catalog - a hidden external worktree colored from the Agent Map
- could not be found and a listing already in flight reverted its
successful assignment. The fetch-start detected rows are captured beside
the visible ones and merged in for the color fence alone.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…for identity-less rows

Two of three findings, both verified against source; the third (forwarding
the pinned identity through local IPC) follows separately.

Detected-only rows are merged into the color fence by color-tag identity
rather than bare path id. A visible row on host A and a detected-only row
on host B can share a path-derived id, and deduplicating by id dropped B
before the host filter ran, so a B refresh that began before B's color
write lacked the snapshot it needed and reverted the successful tag.

Rows without a canonical identity now carry their paired-runtime owner
end to end. A detected-only nested-SSH row exposed through two HUBs, or
through a HUB and directly, passed only its physical host, so owner
resolution could not identify the clicked row: the optimistic apply hit
sibling same-id rows and persistence could route to the desktop or the
wrong HUB. The coordinator passes runtimeOwnerEnvironmentId, the color-tag
identity key includes it, updateWorktreeMeta accepts it as an additive
option, the optimistic apply narrows on it, and routing persists and
recovers through that runtime.

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

The previous commit's message described the coordinator passing
runtimeOwnerEnvironmentId and updateWorktreeMeta threading it; the part
of its script that wrote those edits stopped at an assertion first, and
the optional-typed additions let the gates pass on the partial state.
This commit lands exactly that: the coordinator carries the row's
runtime owner, updateWorktreeMeta reads the option and passes it to
routing, both optimistic applies, and both rollback applies, and the two
tests that exercise it exist.

It also closes the third finding of the pass. Local and direct-SSH
persistence carried no identity selector, so a checkout replaced at the
same path between the renderer's lookup and the main-process write
inherited the pinned color. The renderer now forwards identityKey over
local IPC, the preload contract declares it, and main rebuilds the
occupant's canonical identity from its stored instance and host and
refuses the write when it differs - the same check the runtime selector
path already performs. A folder rename changes the locator but not the
identity, so it still passes.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…or identity-less rows

Three findings, all in the identity-less nested-SSH case where two paired
runtimes publish one checkout as rows sharing id and host:

- updateWorktreeMeta resolved the row by id and host even when the caller
  pinned a runtime owner, so existingWorktree could be the sibling row or
  nothing, and a failed write whose recovery could not run rolled the
  selected row back to the sibling's color or cleared it. findPinnedWorktreeRow
  now resolves by identity, else by id, host, and runtime owner, for both the
  initial lookup and the post-preflight re-resolve; a pinned owner with no
  such row reports not-found instead of touching the sibling.
- MetaWriteFence matched identity-less entries on id and host only, so HUB A's
  pending color write fenced HUB B's refresh of its own row and could swallow
  B's only invalidation. Entries and queries now carry the runtime owner and a
  mismatch between two known owners never matches; sides that know no owner
  fall back to id and host as before. The merge forwards the row's owner.
- getWorkspaceColorTagIdentity joined host identity and owner with '@', which
  SSH aliases and paths can contain, so a direct row could share a preview and
  write-queue key with a runtime-owned row. The fallback is now a serialized
  pair.

Tests: fence owner scoping and its fallback; an owner-scoped rollback keeps
the sibling's color and restores the owner's own; a missing owner row is
not-found with no write; the merge forwards the row's owner to the fence; a
delimiter inside an id no longer collides with a runtime-owned key.
A folder workspace published by a paired runtime projects that runtime as its
runtimeOwnerEnvironmentId, and the color writer forwards it as a pin. Round
nineteen made an owner pin with no matching row report not-found, but
findPinnedWorktreeRow searched only the git catalogs, so every color write to
a runtime-owned folder workspace failed before reaching the folder route. The
finder now resolves a folder scope through its projection and holds it to the
same owner and host check, so the pin still guards against a vanished or
re-owned row without rejecting folders.

Tests: a runtime-owned folder workspace colors through updateFolderWorkspace
with its host; a folder pinned to an owner it no longer has is not-found with
no write.
Three findings, one theme: a folder rename retires the path-derived id while
the row keeps its canonical identity, and three places still let the id win.

- updateWorktreeMeta re-resolved the pinned row after the awaited preflight
  but kept applying, persisting, recovering, and rolling back under the id it
  had before the yield; the reducers match ids exactly and local IPC rejects a
  retired locator, so a rename during that yield no-oped or failed the write.
  The write now adopts the re-resolved row's id.
- preserveConcurrentColorTag keyed its snapshot and current maps by id, so a
  rename between a refresh's snapshot and its merge missed both the delta and
  the fence check and let the stale answer land. Rows are matched by identity
  first and by id only when they have none; sameOccupant still guards the
  fallback.
- MetaWriteFence.matches rejected on id before comparing identities, so a
  write begun under the old id could not fence a stale refresh merged under the
  new one. Identity is compared first; the id applies only when a side has none.

Tests: a pinned row renamed during the preflight yield is applied and
persisted under its new id; the merge follows an identity-preserving rename;
the fence matches a renamed row by identity and still rejects a different
identity or an identity-less query under the new id.
… twice, guard the rollback

Three findings, all about a newer color losing to an older one under
concurrency:

- The write fence held every listing that started before the write landed,
  so a fetch produced by a peer's later change was discarded as stale and,
  since that notification is not repeated, the newer color stayed hidden
  until an unrelated refresh. Fence entries now record the written value (a
  listing already showing it is never held) and, when a fence does hold a
  listing, ask for exactly one refresh after landing (deferred out of the
  reducer) so the host settles which value is newer.
- The color-write coordinator keyed its queue by the row's current identity,
  so a refresh that promoted an identity-less row mid-flight opened a second
  queue and two RPCs could land out of order. Queues are registered under the
  canonical identity and the host-and-owner key; a queue already serving
  another identity is never adopted, so two HUBs' rows stay separate.
- Rollback after a failed color write used the value captured before the
  preflight yield and applied it unconditionally, so it could restore a value
  the row no longer had or overwrite a newer color that did not belong to the
  failed write. It now uses the row's color immediately before the optimistic
  apply and rolls back only while the row still shows this write's color.
  Recovery moved to failed-persist-recovery.ts; persistWorktreeMeta takes the
  pin as one object.

Tests: fence value awareness and the single reconcile in each timing; queue
continuity across identity promotion in both directions; rollback to the
immediate prior and non-rollback over a newer color.
An identity-pinned row can be renamed after the optimistic apply and before
its failing persist settles. The rollback located that row by identity under
its new id, then handed both reducers the id the write started with, so they
matched nothing and, when the recovery refresh could not run either, the
unsaved color stayed on the card after the picker had reported failure. The
rollback now uses the located row's current id, and skips entirely when no
row is found.

Test: a pinned write whose row is renamed while the write is failing is
rolled back under the new id once recovery returns false.
Two findings, one gap: the desktop can list a checkout directly (local or
direct SSH) while a paired HUB publishes the same checkout as an identity-less
sibling with the same id and physical host, and nothing said "the direct one".

- The color writer sent neither an identity nor a positive owner for such a
  row, so the optimistic reducers recolored both rows and the id-and-host
  owner guess could persist the tag through the HUB. runtimeOwnerEnvironmentId
  now accepts null, meaning the desktop-listed row: the coordinator sends it
  for owner-less rows, findPinnedWorktreeRow and both apply matchers compare
  the row's owner ?? null, and resolvePinnedOwnerRouting routes null through
  the desktop provider with host-scoped recovery, never the owner guess.
- MetaWriteFence only told owners apart when both sides carried one, so a
  direct write and a HUB listing shared a fence and one could hold the other's
  incoming color. Entries and queries now carry null for a known owner-less
  row (updateWorktreeMeta derives it from the resolved row; the merge from the
  merged row), so the existing mismatch rule separates them; an unknown row
  still falls back to id and host.

Tests: the coordinator pins a desktop-listed row with null; the fence keeps a
direct write apart from a HUB sibling's listing; the merge reports a
desktop-listed row as null; a null pin colors only the direct row and persists
through the desktop while a HUB is focused, and is not-found when only a HUB
still publishes the row.
Lowan Steinmetz added 2 commits September 4, 2026 05:20
… picker on close-all, fence folder colors

Three findings:

- When a replacement checkout's queue finished before its predecessor's, the
  drain handed the pre-identity alias to the only survivor, the older occupant,
  and a later identity-less write was pinned to a row on its way out. Queues
  carry a creation sequence and an alias is only ever handed to a newer one.
- Once the custom picker was open, a later close-all was ignored. A keyboard or
  synthetic context-menu open has no pointer-down outside, so Radix would later
  commit the draft and restore focus under the new menu. The hook now cancels
  an open picker on that event and suppresses the focus restore for that
  superseded close on both the menu's and the popover's paths.
- The folder catalog merges wholesale and folder writes have no optimistic
  apply, so a listing captured before a color write and merged after it
  restored the old color. Folder color writes now arm the same MetaWriteFence
  the git rows use, keyed by folder id and owner host, both folder catalog
  fetches consult it with their start time, and a held listing earns one
  refetch after the write lands.

Tests: the alias is never handed back to an older occupant; an open picker
closes on close-all with no focus restore; the folder fence holds a listing
that started before landing and accepts one that started after, and the
mutation arms and releases it.
…lias to the latest claimant, keep the folder merge stable

Two findings and one regression from the previous round:

- A checkout replaced at the same path while its predecessor's color write
  was pending read the predecessor's pre-identity preview layer and showed its
  pending color until that request settled. Fallback layers now record the
  canonical identity they were set on behalf of, and a row with its own
  identity ignores layers set for another; a row without one cannot tell and
  keeps reading them. The coordinator sets its fallback layer with that scope.
- With three successive occupants of one path, the newest queue draining first
  and then the oldest let the superseded intermediate queue reclaim the
  pre-identity alias, so a later identity-less write was pinned to it. The
  alias now returns only to the latest queue ever to claim the key; when that
  queue is gone, the key stays unbound until a new occupant claims it.
- preserveFencedFolderColorTags returned a fresh array even when it held
  nothing, which the catalog actions read as a changed catalog on every
  refetch and which broke the catalog merge's referential-stability test. It
  now returns the merged array itself unless a row was actually held.

Tests: a fallback layer set for another identity is hidden from a row with
its own and visible to an identity-less copy; only the latest claimant takes
the alias back; a predecessor's pending preview stays off a replacement row;
the folder fence returns the merged array by reference when nothing is held.
@coderabbitai

coderabbitai Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This change adds normalized workspace color tags to shared worktree and folder-workspace models, runtime APIs, IPC handlers, and persistence. It adds identity-pinned metadata routing and recovery for duplicate or renamed worktree rows. Listing fences preserve color writes during stale refreshes. The sidebar adds preset and custom color controls, transient previews, queued writes, card indicators, focus handling, translations, and regression tests.

Merge Risk: 🔵 Low · up to d6b49

Workspace color tags add persisted visual grouping and concurrent update handling. Remaining risk is limited to asynchronous test-state leakage, which can cause unreliable test behavior but does not establish a production persistence defect.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 32.58% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 89 functions across 59 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The description links the related issue with Fixes #18543``, and the stated objectives match that issue's workspace color-tag feature.
Out of Scope Changes check ✅ Passed The changes support the stated color-tag feature, including persistence, UI behavior, remote handling, concurrency, and tests. No unrelated scope is evident.
Title check ✅ Passed The title clearly summarizes the main change: adding color tags to workspace cards for visual grouping.
Description check ✅ Passed The description is complete and follows the repository template. It explains the feature, motivation, linked issue, visual changes, testing, AI use, remote and security considerations, scope, and chec…
  • Fix all pre-merge checks with AI

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.

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/renderer/src/store/slices/worktrees/metadata/worktree-meta-persist.ts (1)

41-41: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Reset colorTagWriteFence between renderer tests.

MetaWriteFence.landed() retains released entries for 120 seconds. isPending() can hold a matching listing when its fetchStartedAt is at or before the release time. Since resetWorktreeSliceModuleMemory() does not clear colorTagWriteFence, a later test can inherit this state. Add a test-only reset and call it from resetWorktreeSliceModuleMemory().


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 8eab3b19-f021-4224-8ad5-61fe78caccaf

📥 Commits

Reviewing files that changed from the base of the PR and between 0d2375a and f2661eafbdb44bf3991783ed83b94cdc81b78b52.

📒 Files selected for processing (87)
  • src/cli/runtime/websocket-transport.test.ts
  • src/main/ipc/repos/repo-ipc-arg-schemas.ts
  • src/main/ipc/worktree-logic.test.ts
  • src/main/ipc/worktree-metadata-merge.test.ts
  • src/main/ipc/worktree-metadata-merge.ts
  • src/main/ipc/worktrees/folder-workspace-model.ts
  • src/main/ipc/worktrees/metadata/register-worktree-metadata-handlers.ts
  • src/main/ipc/worktrees/metadata/worktree-meta-identity-guard.test.ts
  • src/main/ipc/worktrees/metadata/worktree-meta-identity-guard.ts
  • src/main/persistence/restoring-sessions/folder-workspace-operations.ts
  • src/main/runtime/rpc/methods/folder-workspace.ts
  • src/main/runtime/rpc/methods/worktree-schemas.ts
  • src/main/runtime/rpc/methods/worktree.ts
  • src/main/runtime/runtime-folder-workspace.test.ts
  • src/main/runtime/runtime-folder-workspace.ts
  • src/main/runtime/runtime-managed-worktree-metadata.test.ts
  • src/main/runtime/runtime-managed-worktree-metadata.ts
  • src/main/runtime/runtime-project-group-controller.ts
  • src/preload/api/worktree-api.ts
  • src/renderer/src/components/sidebar/WorktreeCard.color-tag-strip.test.tsx
  • src/renderer/src/components/sidebar/WorktreeColorTagMenuItems.test.tsx
  • src/renderer/src/components/sidebar/WorktreeColorTagMenuItems.tsx
  • src/renderer/src/components/sidebar/WorktreeColorTagPickerPopover.test.tsx
  • src/renderer/src/components/sidebar/WorktreeColorTagPickerPopover.tsx
  • src/renderer/src/components/sidebar/WorktreeContextMenuView.tsx
  • src/renderer/src/components/sidebar/use-worktree-color-tag-picker.test.tsx
  • src/renderer/src/components/sidebar/use-worktree-color-tag-picker.tsx
  • src/renderer/src/components/sidebar/use-worktree-context-menu-commands.ts
  • src/renderer/src/components/sidebar/use-worktree-context-menu-model.tsx
  • src/renderer/src/components/sidebar/use-worktree-parent-picker-transition.ts
  • src/renderer/src/components/sidebar/workspace-color-tag-preview.test.tsx
  • src/renderer/src/components/sidebar/workspace-color-tag-preview.ts
  • src/renderer/src/components/sidebar/workspace-color-tag-writes.test.ts
  • src/renderer/src/components/sidebar/workspace-color-tag-writes.ts
  • src/renderer/src/components/sidebar/worktree-card-surface.tsx
  • src/renderer/src/components/sidebar/worktree-color-tag-assignment.test.tsx
  • src/renderer/src/components/ui/color-picker.tsx
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/store/folder-workspaces/folder-workspace-catalog-actions.ts
  • src/renderer/src/store/folder-workspaces/folder-workspace-color-tag-fence.test.ts
  • src/renderer/src/store/folder-workspaces/folder-workspace-color-tag-fence.ts
  • src/renderer/src/store/folder-workspaces/folder-workspace-mutations.ts
  • src/renderer/src/store/repos/repo-state.ts
  • src/renderer/src/store/slices/folder-workspace-owner-routed-mutations.test.ts
  • src/renderer/src/store/slices/worktree-helpers.ts
  • src/renderer/src/store/slices/worktree-meta-update-application.identity.test.ts
  • src/renderer/src/store/slices/worktree-meta-update-application.ts
  • src/renderer/src/store/slices/worktrees-fetch-listing-merge.test.ts
  • src/renderer/src/store/slices/worktrees-metadata-persistence.row-pinning.test.ts
  • src/renderer/src/store/slices/worktrees-metadata-persistence.test.ts
  • src/renderer/src/store/slices/worktrees/listing/detected-worktree-meta.ts
  • src/renderer/src/store/slices/worktrees/listing/detected-worktree-refresh.lease-start.test.ts
  • src/renderer/src/store/slices/worktrees/listing/detected-worktree-refresh.ts
  • src/renderer/src/store/slices/worktrees/listing/fetch-all-worktrees.ts
  • src/renderer/src/store/slices/worktrees/listing/fetch-worktrees.ts
  • src/renderer/src/store/slices/worktrees/listing/fetched-worktree-color-tag-fence.owner-query.test.ts
  • src/renderer/src/store/slices/worktrees/listing/fetched-worktree-color-tag-fence.started-at.test.ts
  • src/renderer/src/store/slices/worktrees/listing/fetched-worktree-color-tag-fence.ts
  • src/renderer/src/store/slices/worktrees/listing/fetched-worktree-merge.color-tag-pending.test.ts
  • src/renderer/src/store/slices/worktrees/listing/fetched-worktree-merge.color-tag.test.ts
  • src/renderer/src/store/slices/worktrees/listing/fetched-worktree-merge.ts
  • src/renderer/src/store/slices/worktrees/listing/folder-workspace-color-tag.test.ts
  • src/renderer/src/store/slices/worktrees/listing/known-ssh-worktree-fetch.ts
  • src/renderer/src/store/slices/worktrees/listing/worktree-owner-settings.ts
  • src/renderer/src/store/slices/worktrees/listing/worktree-slice-types.ts
  • src/renderer/src/store/slices/worktrees/metadata/failed-persist-recovery.ts
  • src/renderer/src/store/slices/worktrees/metadata/hosted-review-push-target-resolution.ts
  • src/renderer/src/store/slices/worktrees/metadata/hosted-review-refresh-after-meta-update.ts
  • src/renderer/src/store/slices/worktrees/metadata/pinned-worktree-owner-routing.ts
  • src/renderer/src/store/slices/worktrees/metadata/update-folder-workspace-meta.ts
  • src/renderer/src/store/slices/worktrees/metadata/update-worktree-meta.ts
  • src/renderer/src/store/slices/worktrees/metadata/update-worktrees-meta.ts
  • src/renderer/src/store/slices/worktrees/metadata/worktree-meta-persist.ts
  • src/renderer/src/store/slices/worktrees/metadata/worktree-meta-write-fence.test.ts
  • src/renderer/src/store/slices/worktrees/metadata/worktree-meta-write-fence.ts
  • src/shared/folder-workspace-types.ts
  • src/shared/folder-workspace-worktree.test.ts
  • src/shared/folder-workspace-worktree.ts
  • src/shared/folder-workspaces.ts
  • src/shared/hex-color.ts
  • src/shared/protocol-version.ts
  • src/shared/remote-runtime-client-capabilities.ts
  • src/shared/repo-badge-color.ts
  • src/shared/workspace-color-tag.test.ts
  • src/shared/workspace-color-tag.ts
  • src/shared/worktree/meta-types.ts
  • src/shared/worktree/types.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@pullfrog pullfrog Bot left a comment

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.

ℹ️ No critical issues — one minor suggestion inline.

Reviewed changes

Reviewed the full color-tag feature end to end: the colorTag metadata field and its wire/persistence projection, the swatch-row and custom picker UI, the per-workspace write coordinator and transient preview channel, and the write fence plus fetched-worktree merge that preserves a concurrent color against a stale listing.

  • Metadata + wire: colorTag added as an optional WorktreeMeta/Worktree/FolderWorkspace field, normalized to #rrggbb at every boundary, serialized as z.union([string, null]).optional() so a clear survives the round trip, and gated behind the workspace.color-tag.v1 capability.
  • UI: a 3px grouping strip on WorktreeCardSurface, a swatch row (empty slot + REPO_COLORS minus neutral + custom wheel) leading the context menu, and a Popover-based custom picker reusing the extracted ColorPickerFields.
  • Write ordering + preview: a module-level, per-identity queue serializes writes and holds a transient preview until the write lands; layered, owner-scoped previews prevent a slow write from clobbering a newer one.
  • Concurrency fence: MetaWriteFence outlives the write promise, and preserveConcurrentColorTag scopes it by identity/owner so a stale listing never reverts a color assigned mid-refresh while sibling HUB rows stay independent.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

Comment thread src/shared/folder-workspaces.ts Resolved
Lowanski pushed a commit to Lowanski/orca that referenced this pull request Sep 4, 2026
…lly, reset fences between tests

- The scan-start registry expired entries by wall clock after 60 s, so a
  joiner of a provider request still running past that recorded a later start
  and a stale listing could outrank a color written mid-scan. Entries are now
  reference-counted per holder and forgotten when the last holder releases the
  lease, on both the runtime and the direct-SSH path; a ten-minute TTL remains
  only as a leak guard.
- The batch metadata path pinned only the identity, so an identity-less row's
  fence fell back to id and host and could hold a sibling runtime's refresh,
  and a held listing was never reconciled. It now sends the runtime owner
  (null for a row the desktop lists itself) and the held-listing refetch, the
  same pin the single-row path sends.
- MetaWriteFence.clear() and a test-only reset of the write trackers, called
  from the slice test harness for both the worktree and the folder color
  fences, so a write landed in one test cannot hold a listing in the next.
- normalizeWorkspaceColorTag runs once per raw folder workspace.

Tests: the lease clock survives a late joiner and is forgotten on the last
release; the fence clears; a batch color write is fenced by owner and
refetches once a listing is held.
@Lowanski

Lowanski commented Sep 4, 2026

Copy link
Copy Markdown
Author

Addressed the review in df2ea9ecda: lease clocks are released on settlement rather than by TTL, the batch metadata path carries the runtime owner and the held-listing refetch, and both color write fences are reset between renderer tests through the slice test harness (the nitpick on colorTagWriteFence). The pullfrog duplicate normalization is hoisted. I left the docstring-coverage check as is: the repo's AGENTS.md asks for concise non-obvious comments only, so I did not add descriptive docstrings to functions whose names already say what they do.

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 88101548-a5be-4e53-b0dc-2f686b119d72

📥 Commits

Reviewing files that changed from the base of the PR and between f2661eafbdb44bf3991783ed83b94cdc81b78b52 and df2ea9ecda8711c7e8d2987cfb2982119cd395f0.

📒 Files selected for processing (10)
  • src/renderer/src/store/slices/worktrees-metadata-persistence.row-pinning.test.ts
  • src/renderer/src/store/slices/worktrees-slice-test-harness.ts
  • src/renderer/src/store/slices/worktrees/listing/detected-worktree-refresh.lease-start.test.ts
  • src/renderer/src/store/slices/worktrees/listing/detected-worktree-refresh.ts
  • src/renderer/src/store/slices/worktrees/listing/known-ssh-worktree-fetch.ts
  • src/renderer/src/store/slices/worktrees/metadata/update-worktrees-meta.ts
  • src/renderer/src/store/slices/worktrees/metadata/worktree-meta-persist.ts
  • src/renderer/src/store/slices/worktrees/metadata/worktree-meta-write-fence.test.ts
  • src/renderer/src/store/slices/worktrees/metadata/worktree-meta-write-fence.ts
  • src/shared/folder-workspaces.ts
🚧 Files skipped from review as they are similar to previous changes (7)
  • src/shared/folder-workspaces.ts
  • src/renderer/src/store/slices/worktrees/listing/known-ssh-worktree-fetch.ts
  • src/renderer/src/store/slices/worktrees/listing/detected-worktree-refresh.lease-start.test.ts
  • src/renderer/src/store/slices/worktrees/metadata/update-worktrees-meta.ts
  • src/renderer/src/store/slices/worktrees/metadata/worktree-meta-persist.ts
  • src/renderer/src/store/slices/worktrees-metadata-persistence.row-pinning.test.ts
  • src/renderer/src/store/slices/worktrees/listing/detected-worktree-refresh.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@pullfrog pullfrog Bot left a comment

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.

✅ No new issues found.

Reviewed changes

Reviewed the single new commit (df2ea9ecda) since the prior review, which resolves the hoist nit, fixes the lease-start clock for late joiners of a long scan, and brings the batch write path's pin up to parity with single-row writes.

  • Lease-start holder tracking: rememberLeaseStart/forgetLeaseStart now count holders and release on settlement, so a joiner arriving late in a still-running scan inherits the original clock instead of stamping a later one that would let a stale listing outrank a color written mid-scan.
  • Batch write pin parity: updateWorktreesMeta now forwards identityKey, runtimeOwnerEnvironmentId, and onHeldColorTagListing per owner host, so an identity-less row's fence is owner-scoped and a held listing triggers a host-scoped refetch — matching the single-row path.
  • Test isolation: resetWorktreeMetaWriteTrackingForTests clears the color-tag fence and the harness clears the folder fence, so a landed write no longer leaks across cases.
  • Normalization hoist: normalizeWorkspaceColorTag is computed once and reused in normalizeFolderWorkspaces.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

…y on release

The direct-SSH lease bridge decremented the scan-start holder only from its
release wrapper, but the scheduler calls release only to cancel, invalidate,
or shut down; a scan that completes normally is only awaited. Every successful
scan therefore left its entry in the registry until a later acquisition pruned
it by TTL. The holder is now forgotten exactly once, on result settlement or
on release, whichever comes first.

@pullfrog pullfrog Bot left a comment

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.

✅ No new issues found.

Reviewed changes

Reviewed the single new commit (ebf9efe435) since the prior review, which closes the direct-SSH scan-clock holder leak that review had flagged as bounded-but-unfixed.

  • Scan-clock holder forgotten on settlement: acquireDirectSshDetectedWorktreeRefresh now decrements its rememberLeaseStart holder via lease.result.then(forgetClock, forgetClock), so a scan that completes normally (awaited, never released) releases its holder instead of lingering in the registry until a later acquisition prunes it by TTL. The release wrapper still forgets, and the idempotent clockForgotten flag guarantees exactly one decrement across the settlement and release paths.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@Lowanski
Lowanski force-pushed the feat/workspace-color-tags branch from ebf9efe to d6f6493 Compare September 4, 2026 18:05
@Lowanski Lowanski changed the title [Feature]: Color tags on workspace cards for visual grouping feat(sidebar): color tags on workspace cards for visual grouping Sep 4, 2026
The strip is aria-hidden, so a screen reader moving through the sidebar had
no evidence of a workspace's grouping tag short of opening its context menu.
A visually hidden text node inside the card now names the tag, the same
sr-only pattern the SSH host control on the card already uses.

@pullfrog pullfrog Bot left a comment

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.

✅ No new issues found.

Reviewed changes

Reviewed the single new commit (fdfaad94c8) since the prior review, which surfaces the workspace's color tag in the card's accessible text for assistive tech.

  • Accessible color-tag text: WorktreeCardSurface now renders an sr-only span reading Color tag #rrggbb (new auto.components.sidebar.WorktreeCardSurface.colorTag i18n key with a Color tag {{value0}} fallback) alongside the aria-hidden strip, so the decorative 3px bar is represented in the card's accessible name instead of being silently dropped for screen-reader users.
  • Test coverage: the strip test now asserts the accessible text is present for a tagged card and absent for untagged/invalid values.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

…sentations agree

A workspace can be represented twice while a refresh is in flight: the row
that already carries its canonical identity and a copy that does not yet.
Two paths previewed under only one of the row's keys, so the two showed
different colors.

- The write coordinator previewed a newer color enqueued from the identity-less
  copy under the pre-identity key alone, so the canonical card kept the older
  color until the next write started. The queue now remembers every
  representation that enqueued and re-applies the newest color to all of them.
- The custom picker previewed under canonical keys only, so the copy did not
  follow the wheel until the write landed. The popover now previews rows, not
  keys, through one shared helper.

The helper publishes a row's canonical key unscoped and its pre-identity key
scoped to the occupant, in a single broadcast, so a checkout that replaced the
row at the same path still never shows its color. Tests cover the coordinator,
the helper, and the popover with a real identity key.

@pullfrog pullfrog Bot left a comment

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.

✅ No new issues found.

Reviewed changes

Reviewed the single new commit (d6b4944d79) since the prior review, which makes the preview channel paint both representations of a row so a not-yet-refreshed copy follows the wheel and in-flight writes immediately instead of after the next round trip.

  • Dual-key preview: the picker and the write queue now preview under both a row's canonical identity key and its pre-identity fallback key. The fallback layer is scoped via forIdentity (the occupant's identity.key), so a copy that has not refreshed yet shows the pending color at once while a checkout replaced at the same path never inherits its predecessor's preview. setWorkspaceColorTagPreviews is generalized into applyPreviewEntries, with new previewWorkspaceColorTagsFor / clearWorkspaceColorTagPreviewsFor / workspaceColorTagPreviewKeysFor helpers.
  • Queue preview rows: IdentityQueue keeps a previewRows map keyed by canonical identity, so whichever representation enqueues the newest color, every representation shows it in one broadcast, and the drain still clears every previewed key.
  • Tests: regression coverage for dual-key reach, occupant scoping, and the newest-pending-color broadcast; all 69 affected tests pass locally.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: d6208678-6dd7-46d2-bfc1-7b0aac8ec94e

📥 Commits

Reviewing files that changed from the base of the PR and between fdfaad9 and d6b4944.

📒 Files selected for processing (7)
  • src/renderer/src/components/sidebar/WorktreeColorTagPickerPopover.test.tsx
  • src/renderer/src/components/sidebar/WorktreeColorTagPickerPopover.tsx
  • src/renderer/src/components/sidebar/use-worktree-color-tag-picker.tsx
  • src/renderer/src/components/sidebar/workspace-color-tag-preview.test.tsx
  • src/renderer/src/components/sidebar/workspace-color-tag-preview.ts
  • src/renderer/src/components/sidebar/workspace-color-tag-writes.test.ts
  • src/renderer/src/components/sidebar/workspace-color-tag-writes.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.

…coordinator test fully

- MetaWriteFence.clear() dropped entries but not the callbacks begin() had
  handed out, so a write held in one test could land after the reset and queue
  its refresh into the next. landed() and the reconcile request now no-op for
  an entry that is no longer registered.
- The newest coordinator test resolved only the first writer and left the
  queued second write pending in module state. It now settles both writes and
  awaits both assignments.

@pullfrog pullfrog Bot left a comment

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.

✅ No new issues found.

Reviewed changes

Reviewed the single new commit (47a93b76) since the prior review, which hardens the metadata-write fence against late callbacks after a test reset and fully settles the write-coordinator regression test.

  • Late-landing fence guard: MetaWriteFence.landed() now returns early when clear() has already dropped the entry, and requestReconcile() carries the same membership check, so a write that settles after a test resets the fence can no longer revive the entry or fire its onHeldListing refresh into the next test.
  • Coordinator test settles fully: the dual-key preview regression test awaits both queued writes and drains the queue before asserting, so no queue or preview state outlives the case.

The guards are production no-ops — clear() is only reachable from resetWorktreeMetaWriteTrackingForTests(), and in-flight entries are never pruned — so behavior outside tests is unchanged. Both affected suites pass (42 tests).

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

… pre-identity keys

The preview reader returned the canonical key's top layer whenever one
existed, so an older pending write's preview there hid a newer picker preview
that an identity-less copy of the same row had published under the
pre-identity key; the canonical card kept the old color while the copy showed
the new one until commit. Layers now carry a set order, and a row reads the
newest applicable layer across both of its keys.

@pullfrog pullfrog Bot left a comment

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.

✅ No new issues found.

Reviewed changes

Reviewed the single new commit (73e45f7738) since the prior review, which makes the preview reader pick the newest layer across a row's canonical and pre-identity keys instead of always preferring the canonical key.

  • Sequence-ordered cross-key read: PreviewLayer gains a module-level monotonic sequence, and readWorkspaceColorTagPreview now compares the canonical key's top layer against the fallback key's top applicable layer by that sequence. A newer picker preview published from an identity-less copy of a row can no longer be hidden by an older pending write sitting under the canonical key, and both representations of the row show the same newest color.
  • Coverage: a regression test drives the exact interleaving (pending write under the canonical key, newer picker preview under the pre-identity key, clear, then re-assignment) and asserts both the promoted and identity-less copies agree at each step. All 12 tests in the preview suite pass.

Both production readers (useWorkspaceColorTagPreviewForWorktree, useWorkspaceColorTagPreviewsForWorktrees) route through the sequence-aware read; the single-identity useWorkspaceColorTagPreview is a test-only helper unaffected by the change.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

…rdinator's comments

- A queue found by its canonical key returned early, so a row renamed while
  its write was in flight kept the pre-rename row as its pin and never
  registered the renamed row's pre-identity key. A copy of the renamed row that
  had not refreshed yet then opened a second queue and two RPCs raced. Reusing
  a queue by canonical key now refreshes its row and claims the current
  pre-identity key under the same recency rule as creation.
- The module's comments are cut down to their invariants, per AGENTS.md.

@pullfrog pullfrog Bot left a comment

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.

✅ No new issues found.

Reviewed changes

Reviewed the single new commit (fe3522188d) since the prior review, which makes the write coordinator follow a row across a rename and trims its comments.

  • Rename followed in the queue: queueFor now re-registers an existing queue under the renamed row's pre-identity key (via the extracted claimFallback) and repoints its canonicalRow, so a not-yet-promoted copy of the renamed row joins the existing queue and is pinned to the new row instead of opening a second queue and racing a second RPC.
  • Coordinator comments condensed: the multi-line "why" blocks on IdentityQueue fields, queueFor, and the latestClaim invariant were trimmed to single-line rationales without changing behavior.

Traced the new regression test end-to-end: it exercises the exact interleaving (write to the pre-rename row, then to the renamed row, then to an identity-less copy of the renamed row) and asserts a single serialized second write pinned to identityKey: 'k-ren'. The claimFallback extraction preserves the prior latestClaim invariants for a brand-new queue.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

This branch has not been deployed

No deployments
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.

[Feature]: Color tags on workspace cards for visual grouping

1 participant