Skip to content

fix: replace physical tab sort with virtual display-only sort - #4

Merged
rhuss merged 45 commits into
mainfrom
074-virtual-sort-fix
Jun 28, 2026
Merged

rhuss merged 45 commits into
mainfrom
074-virtual-sort-fix

Conversation

@rhuss

@rhuss rhuss commented Jun 28, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Replaces the broken physical tab reorder sort (which races with Zellij's async MoveTab API) with a virtual display-only sort
  • When the user presses S in navigate mode, the controller toggles a sort_active flag and the render broadcast sorts sessions by activity tier instead of tab index
  • Zellij tab positions remain unchanged; the sidebar shows the sorted view with a purple ↕ indicator
  • Pressing S again toggles the sort off; sort auto-clears when tab count changes

Test plan

  • 352 Rust plugin tests pass (11 new tests added)
  • 0 clippy warnings
  • Deep review: 5 agents (correctness, architecture, security, production, tests) — 0 Critical/Important findings
  • Manual smoke test: press S in navigate mode with mixed activity sessions, verify tier grouping
  • Verify sort indicator (↕) appears/disappears in header
  • Verify cursor follows session after sort
  • Verify sort clears when opening/closing a tab

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added a virtual sort mode in the sidebar (toggle with S), including a visual sort indicator and stable tier-based session ordering.
    • Improved OpenShell cloning by automatically converting SSH git URLs to HTTPS where applicable.
    • Updated Vertex auth guidance/behavior to use the claude-vertex naming and native-style google-cloud provider flow.
  • Bug Fixes

    • Prevented sorting from changing physical tab positions; sorting auto-disables when the tab set changes.
  • Documentation

    • Updated build/workspace guidance and expanded specs/plans for upcoming build-skill reliability, SSH-to-HTTPS, and related enhancements.

Open in Devin Review

rhuss added 30 commits June 20, 2026 16:22
…roach

All 5 open questions decided: dual-phase asset verification, refresh-time
snippet validation, native+npm fallback for Claude Code, post_install
dry-run at capture, single spec for all 13 changes.

Assisted-By: 🤖 Claude Code
Assisted-By: 🤖 Claude Code
Assisted-By: 🤖 Claude Code
Build skill (cc-deck.build.md):
- Add USER root after header for OpenShell builds (non-root base images)
- Add GitHub release asset verification protocol (A2 + C2)
- Change snippet handling to allow modification of broken download commands
- Add Claude Code npm fallback on OOM (exit 137)
- Add exact jq merge command for settings.json (A2 + C2)
- Add post_install sandboxing protocol (A2 + C2)
- Add marketplace setup before plugin installs (A2)
- Add shell config dependency scanning to C2 base image probing
- Add OpenShell base image documentation to Key Rules

Capture skill (cc-deck.capture.md):
- Add compinit preamble rule when stripping plugin managers (Step 5c)
- Add shell config dependency scanning for implicit tools (Step 5c)
- Add fzf GitHub release detection for version compatibility (Step 5c)
- Add GitHub release asset verification at capture time (Step 11)
- Add post_install dry-run validation at capture time (Step 11)
- Add build refresh URL verification note (Key Rules)

Templates:
- Guard starship init with TERM!=dumb check (05-shell-finalize.tmpl)
- Fix cache dir ownership to parent directory (03-mandatory-stack.tmpl)
- Add Claude Code npm fallback (03-mandatory-stack.tmpl)
- Add marketplace setup (03-mandatory-stack.tmpl)

Resolves: brainstorm/072-build-skill-iteration-reduction.md

Assisted-By: 🤖 Claude Code
Assisted-By: 🤖 Claude Code
The OpenShell base image tool list is dynamic. Rely on the base image
probe and shell config scanning rather than listing specific missing
tools that will drift as the base image evolves.

Assisted-By: 🤖 Claude Code
Build skill iteration reduction: 13 fixes to eliminate 8-9 build
iterations in OpenShell builds. Skill markdown + template edits only.

Assisted-By: 🤖 Claude Code
The Write tool requires reading a file before overwriting it, which
fails silently when re-running capture on an existing setup directory.
Using cp via Bash ensures config files are always updated with current
local versions.

Assisted-By: 🤖 Claude Code
SSH git clones fail in OpenShell sandboxes because DNS queries (UDP)
bypass the HTTP CONNECT proxy. HTTPS works because DNS resolves inside
the CONNECT tunnel. Fix: convert SSH URLs to HTTPS + git insteadOf.

Assisted-By: 🤖 Claude Code
OpenShell's HTTP CONNECT proxy cannot resolve DNS for SSH connections
(UDP bypasses proxy). Add sshToHTTPS() conversion in buildCloneCommand()
for OpenShell workspaces, plus git insteadOf config in OpenShell images
for submodules and other in-sandbox git operations.

Assisted-By: 🤖 Claude Code
Convert SSH git URLs to HTTPS for OpenShell sandboxes. DNS resolution
fails for SSH because UDP bypasses the HTTP CONNECT proxy.

Assisted-By: 🤖 Claude Code
lsd's auto color detection fails inside Zellij panes (isatty returns
false). The capture skill now patches copied config files to force
color and icon output, since sandboxes always run inside a multiplexer.

Assisted-By: 🤖 Claude Code
Stale config copies in openshell/context/ from previous builds caused
lsd color settings to not take effect. The build skill now explicitly
requires overwriting existing context files.

Assisted-By: 🤖 Claude Code
Delete non-binary files from openshell/context/ before copying fresh
configs from setup/config/. Preserves cc-deck-linux-* binaries which
are expensive to re-download. Prevents config staleness permanently.

Assisted-By: 🤖 Claude Code
OpenShell defaults to 2 vCPU / 2 GB RAM, insufficient for Rust/Java
builds. Add --cpu and --memory to ws new, plus manifest defaults with
capture-time detection for heavy projects.

Assisted-By: 🤖 Claude Code
When ls is aliased to lsd, zsh still uses _ls for completion, causing
stem duplication. Add compdef _files overrides after alias definitions
so tab completion uses simple file completion instead of the original
command's completer.

Assisted-By: 🤖 Claude Code
The OpenShell base image defaults to POSIX locale (LC_CTYPE=POSIX).
With POSIX locale, zsh miscalculates the display width of multi-byte
characters in the starship prompt, causing a 2-character cursor offset
on every tab completion. Setting LANG=C.UTF-8 fixes the width
calculation.

Assisted-By: 🤖 Claude Code
The stem duplication was caused by LC_CTYPE=POSIX miscounting
multi-byte prompt characters, not by _ls completing for the lsd alias.
The UTF-8 locale fix in 05-shell-finalize.tmpl resolves the actual
root cause.

Assisted-By: 🤖 Claude Code
Add explanations for why LANG=C.UTF-8 is needed (POSIX locale breaks
zsh tab completion with multi-byte prompt chars) to Key Rules and
capture Step 5c. The template handles it automatically, but the skills
document the requirement for manual config scenarios.

Assisted-By: 🤖 Claude Code
OpenShell's filesystem policy only grants read access to /usr, /lib,
and /sandbox. Binaries installed to /opt or left in extracted
subdirectories fail with permission denied at runtime. Both build and
capture skills now document that install_path must be /usr/local/bin/.

Assisted-By: 🤖 Claude Code
Without LS_COLORS, lsd only colors directories. The OpenShell base
image has dircolors available but it is not invoked during shell init.
Adding eval dircolors to bashrc/zshrc provides file extension colors
for archives, executables, images, etc.

Assisted-By: 🤖 Claude Code
Previously, init --force replaced the manifest with a fresh template
where all targets are commented out. This caused build refresh to skip
snippet regeneration for previously configured targets (e.g., openshell).
Now reads the existing manifest's targets before overwriting and carries
them forward into the new template.

Assisted-By: 🤖 Claude Code
Previously --force overwrote build.yaml with a fresh template, wiping
all tools, plugins, settings, and target configuration. Now --force
only re-extracts embedded artifacts (skills, templates, snippets,
scripts) and leaves the manifest untouched. Use /cc-deck.capture
--fresh to reset the manifest if needed.

Assisted-By: 🤖 Claude Code
Ubuntu 24.04's dircolors ships without a database file, producing
empty LS_COLORS. Embed a standard color scheme directly covering
archives, executables, images, media, and common source file types.

Assisted-By: 🤖 Claude Code
Revert LS_COLORS hardcoding (not maintainable). Strengthen the install
path rule to explicitly forbid symlinks from /opt, and document the
pattern for tools with runtime data directories (copy binary to
/usr/local/bin, runtime to /usr/share, set env var).

Assisted-By: 🤖 Claude Code
rhuss added 13 commits June 26, 2026 06:46
Assisted-By: 🤖 Claude Code
Assisted-By: 🤖 Claude Code
Replace cc-deck's homegrown Vertex credential handling for OpenShell
workspaces with OpenShell's native google-cloud provider type (GCE
metadata emulator, ai-openshell/openshell#1763).

Changes:
- Update claude-vertex profile to type "google-cloud" (was "claude")
- Remove FileVar and Endpoints from claude-vertex (OpenShell handles it)
- Remove standalone "vertex" provider profile (dead code)
- Rewrite ResolveCredentials claude-vertex path: creates google-cloud
  provider with --from-gcloud-adc and --config instead of SkipProvider
  with file upload
- Update CreateProvider to use --from-gcloud-adc and --config flags
  for google-cloud provider type
- Skip file upload for google-cloud providers in ws/openshell.go
- Keep env var injection for CLAUDE_CODE_USE_VERTEX=1 and companions
- Non-OpenShell workspace types unchanged

Assisted-By: 🤖 Claude Code
Compliance: 9/9 FRs satisfied. Deep review: 0 Critical, 0 Important.
Gate: PASS.

Assisted-By: 🤖 Claude Code
UpdateProvider was passing --from-existing + --credential for
google-cloud providers, which the OpenShell CLI rejects. Use
--from-existing + --config instead, matching CreateProvider behavior.

Assisted-By: 🤖 Claude Code
The OpenShell CLI's provider update command doesn't support
--from-gcloud-adc, so EnsureProvider now deletes and recreates
google-cloud providers when they already exist.

Assisted-By: 🤖 Claude Code
Revisited after Vertex provider migration exposed three runtime CLI
flag incompatibilities. Research shows CLI is not needed for SSH or
file transfer (corrects original assumption). Decision: full gRPC
client replacing CLI wrapping entirely.

Assisted-By: 🤖 Claude Code
Assisted-By: 🤖 Claude Code
@coderabbitai

coderabbitai Bot commented Jun 28, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7583ee26-e5c0-4f5f-9be0-67e5bffd9203

📥 Commits

Reviewing files that changed from the base of the PR and between 4318ead and 159c49c.

📒 Files selected for processing (28)
  • .specify/memory/constitution.md
  • CLAUDE.md
  • brainstorm/049-openshell-grpc-vs-cli.md
  • cc-deck/internal/build/commands/cc-deck.build.md
  • cc-deck/internal/build/commands/cc-deck.capture.md
  • cc-deck/internal/build/containerfile_test.go
  • cc-deck/internal/integration/k8s_deploy_test.go
  • cc-deck/internal/openshell/credentials.go
  • cc-deck/internal/ws/channel_pipe_test.go
  • cc-zellij-plugin/src/controller/actions.rs
  • cc-zellij-plugin/src/controller/events.rs
  • cc-zellij-plugin/src/controller/render_broadcast.rs
  • cc-zellij-plugin/src/controller/state.rs
  • cc-zellij-plugin/src/debug.rs
  • cc-zellij-plugin/src/lib.rs
  • cc-zellij-plugin/src/perf.rs
  • cc-zellij-plugin/src/sidebar_plugin/input.rs
  • cc-zellij-plugin/src/sidebar_plugin/integration_tests.rs
  • cc-zellij-plugin/src/sidebar_plugin/render.rs
  • cc-zellij-plugin/src/sidebar_plugin/test_helpers.rs
  • specs/074-virtual-sort-fix/REVIEW-CODE.md
  • specs/074-virtual-sort-fix/checklists/requirements.md
  • specs/074-virtual-sort-fix/data-model.md
  • specs/074-virtual-sort-fix/plan.md
  • specs/074-virtual-sort-fix/research.md
  • specs/074-virtual-sort-fix/review-findings.md
  • specs/074-virtual-sort-fix/spec.md
  • specs/074-virtual-sort-fix/tasks.md

📝 Walkthrough

Walkthrough

This PR adds a virtual sidebar sort, migrates OpenShell Vertex handling to google-cloud, rewrites OpenShell SSH clone URLs to HTTPS, and expands build-skill templates and docs to cover OpenShell build behavior.

Changes

Virtual Sort Fix

Layer / File(s) Summary
State and payload shape
cc-zellij-plugin/src/controller/state.rs, cc-zellij-plugin/src/lib.rs, cc-zellij-plugin/src/sidebar_plugin/test_helpers.rs, cc-zellij-plugin/src/sidebar_plugin/integration_tests.rs
sort_active is added to controller state and render payloads, and test payload builders set it explicitly.
Virtual sort toggle and render ordering
cc-zellij-plugin/src/controller/actions.rs, cc-zellij-plugin/src/controller/render_broadcast.rs, cc-zellij-plugin/src/controller/events.rs
Sort handling now toggles sort_active, render payloads sort by tier when active, and tab-count changes clear the flag; tests were updated.
Sidebar input and header indicator
cc-zellij-plugin/src/sidebar_plugin/input.rs, cc-zellij-plugin/src/sidebar_plugin/render.rs
The S-key path keeps cursor tracking without resetting navigate timing, and the sidebar header renders a sort indicator alongside the voice indicator.
Virtual sort docs
brainstorm/076-virtual-sort-fix.md, specs/074-virtual-sort-fix/*
Matching spec, checklist, review, tasks, and brainstorm documents were added for the virtual sort behavior.

OpenShell Native Vertex Provider

Layer / File(s) Summary
Profiles, resolution, and detection
cc-deck/internal/openshell/credentials.go, cc-deck/internal/openshell/credentials_test.go
claude-vertex now resolves to google-cloud, vertex is removed, and credential detection tests were updated.
Provider flags and workspace guard
cc-deck/internal/openshell/client.go, cc-deck/internal/ws/openshell.go
google-cloud provider creation uses --from-gcloud-adc and --config, and workspace startup skips file upload for google-cloud.
Native Vertex docs
README.md, cc-deck/CLAUDE.md, brainstorm/075-openshell-native-vertex-provider.md, specs/073-openshell-native-vertex/*
README and the full spec/documentation set were updated for the native Vertex migration.

OpenShell SSH-to-HTTPS Git Clone

Layer / File(s) Summary
URL conversion and clone wiring
cc-deck/internal/ws/repos.go, cc-deck/internal/ws/openshell.go
SSH clone URLs can now be rewritten to HTTPS, and the OpenShell workspace clone path enables the conversion.
Clone command tests
cc-deck/internal/ws/repos_test.go
Clone command tests now cover the new conversion flag and SSH-to-HTTPS behavior.
SSH-to-HTTPS docs
brainstorm/073-openshell-ssh-to-https.md, specs/072-openshell-ssh-to-https/*
Brainstorm, spec, plan, tasks, and checklist docs were added for the clone conversion behavior.

OpenShell Build Skill Iteration Reduction

Layer / File(s) Summary
Containerfile templates
cc-deck/internal/build/templates/containerfile/03-mandatory-stack.tmpl, cc-deck/internal/build/templates/containerfile/05-shell-finalize.tmpl
The templates add Claude Code fallback install behavior, marketplace setup, UTF-8 locale setup, and revised Starship initialization.
Manifest preservation on init
cc-deck/internal/build/init.go
InitSetupDir preserves an existing build.yaml during --force and only writes a new manifest when needed.
Build and capture command files
cc-deck/internal/build/commands/cc-deck.build.md, cc-deck/internal/build/commands/cc-deck.capture.md
The build/capture instructions add asset verification, shell dependency scanning, config overwrite rules, shell init rules, and snippet refresh checks.
Build-skill docs and overview
brainstorm/00-overview.md, brainstorm/049-*, brainstorm/072-*, brainstorm/074-*, cc-deck-catalog, .specify/memory/constitution.md, specs/071-build-skill-fixes/*
The build-skill branch adds the overview update, brainstorms, catalog bump, constitution rule, and the full 071 spec/task/review suite.

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

Poem

🐇 I hopped through sorts both old and new,
With Vertex clouds and HTTPS too.
The build path learned a gentler way,
And docs grew roots to guide the day.
Hooray! 🌱

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: switching from physical tab reordering to a virtual display-only sort.
Docstring Coverage ✅ Passed Docstring coverage is 93.85% which is sufficient. The required threshold is 80.00%.
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.
✨ 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 074-virtual-sort-fix

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies"


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.

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

rhuss added a commit that referenced this pull request Jun 28, 2026
Applied fixes from bot review comments:
- Comment #3487427870: guard sort toggle against < 2 sortable sessions
- Comment #3487427878: fix misleading comment about ANSI character counting
- Comment #3487432102: update spec edge case to describe live re-sorting

Assisted-By: 🤖 Claude Code
rhuss added a commit that referenced this pull request Jun 28, 2026
Applied fixes from bot review comments:
- Comment #3487432072: expand contractions in brainstorm/049 for voice compliance
- Comment #3487432074: expand contractions in brainstorm/072 for voice compliance
- Comment #3487432075: expand contractions in brainstorm/074 for voice compliance
- Comment #3487432079: use shell-specific RC filename in capture.md
- Comment #3487432080: reorder build refresh after asset verification in capture.md
- Comment #3487432090: force CLAUDE_CODE_USE_VERTEX=1 for claude-vertex entries

Assisted-By: 🤖 Claude Code
devin-ai-integration[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

rhuss added a commit that referenced this pull request Jun 28, 2026
- Comment #3487736995: allow sort deactivation with < 2 sessions
- Comment #3487736990: guard nil InfraState before dereferencing

Assisted-By: 🤖 Claude Code
The sidebar session sort (S key in navigate mode) used async MoveTab API
calls to physically reorder Zellij tabs. This caused a race condition
where TabUpdate events overwrote the proactive state updates, reverting
the sort on every sidebar refresh.

Replace with a virtual display-only sort: the controller toggles a
sort_active flag, and the render broadcast sorts sessions by activity
tier (Active > Inactive > Paused) without moving Zellij tabs. The sort
is instant, race-free, and toggles on/off with repeated S presses.

Additional fixes included in this change:
- Fix credential dedup when claude-vertex type diverges from base
- Fix pre-existing Go test failures (containerfile, pipe channel, integration)
- Fix clippy 1.96 warnings (checked_div, sort_by_key, const thread_local)
- Add zip format handling to build asset verification
- Amend constitution to v1.3 (command files are executable code)

353 Rust tests pass, 0 clippy warnings.

Assisted-By: 🤖 Claude Code
@rhuss
rhuss force-pushed the 074-virtual-sort-fix branch from c0fcef1 to 159c49c Compare June 28, 2026 12:26
@rhuss
rhuss merged commit 8e85529 into main Jun 28, 2026
4 of 6 checks passed
@rhuss
rhuss deleted the 074-virtual-sort-fix branch June 28, 2026 12:26

@devin-ai-integration devin-ai-integration 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.

Devin Review found 1 new potential issue.

Open in Devin Review

Comment on lines +365 to +372
if providerType == "google-cloud" {
// The update command doesn't support --from-gcloud-adc,
// so delete and recreate for google-cloud providers.
if delErr := c.DeleteProvider(ctx, name); delErr != nil {
return delErr
}
return c.CreateProvider(ctx, name, providerType, fromExisting, credentials)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🚩 EnsureProvider delete+recreate for google-cloud may fail if provider is attached to stale sandboxes

The EnsureProvider at cc-deck/internal/openshell/client.go:362-375 does delete+recreate for google-cloud when the provider already exists. If the provider is attached to running or stale sandboxes, the delete call may fail with an error other than "not found" (e.g., "provider in use"). The error propagates correctly (line 368-370 returns delErr), but the user would see a cryptic error. Brainstorm 049 documents this as a known issue ("EnsureProvider failed when deleting a provider attached to stale sandboxes"). This is a pre-existing concern, not introduced by this PR, but the delete+recreate pattern makes it more likely to trigger for google-cloud providers specifically.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

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.

2 participants