Skip to content

fix(tui): cycle workspace scope to a known workspace, not a hardcoded "default" - #4126

Merged
TaylorMutch merged 1 commit into
NVIDIA:mainfrom
udsy19:fix/tui-workspace-cycle-default
Nov 10, 2026
Merged

TaylorMutch merged 1 commit into
NVIDIA:mainfrom
udsy19:fix/tui-workspace-cycle-default

Conversation

@udsy19

@udsy19 udsy19 commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The dashboard workspace-scope shortcut (w) permanently breaks for any principal whose visible workspace list does not contain "default": after one cycle it oscillates between the all scope and a nonexistent "default" workspace, and the named workspaces can never be selected again.

Root cause

App::cycle_workspace (crates/openshell-tui/src/app.rs) leaves the all scope by hardcoding self.current_workspace = "default", then walks forward via position(current) + 1. But workspace_names comes from the server's ListWorkspaces, which is membership-scoped per principal (openshell-server/src/grpc/workspace.rs::membership_filter_subject) — a non-admin only sees workspaces they belong to. If that list omits "default" (e.g. ["team-a","team-b"]), the next press has position("default") == None, hitting the wrap-to-all arm, so the selector is stuck between all and a phantom forever and the follow-up refresh queries a workspace the user isn't in.

Fix

Leave the all scope by returning to the first known workspace (workspace_names.first()), only entering named scope when at least one workspace is known. The stale current_workspace = "default" assignments in the all-scope branches are removed (unused while all_workspaces is set; workspace_display() returns "all").

Tests

cycle_workspace_without_default_stays_on_real_workspaces (app.rs): with ["team-a","team-b"], every named-scope landing must be a real workspace and both must be reachable. Fails before (cycled to 'default', which is not a known workspace), passes after. cargo test -p openshell-tui: 88 passed (the sibling default-first test still passes).

Related Issue

Closes #5464

`cycle_workspace` hardcoded "default" when entering the named-workspace
scope from the "all" scope (and when wrapping around). This assumed the
server-provided `workspace_names` list always contains "default" and lists
it first.

That assumption does not hold: the TUI populates `workspace_names` from
`ListWorkspaces`, which is membership-scoped per principal. A non-admin
user who is not a member of the "default" workspace receives a list that
omits it entirely. In that case, after one full cycle the scope indicator
lands on "default" — a workspace that does not exist in the list — and the
next cycle finds no match, flipping straight back to "all". The user can
never return to any of their real workspaces by cycling.

Enter the named scope at `workspace_names.first()` instead, and only when
at least one workspace is known. The stale `current_workspace = "default"`
writes in the "all" branches are dropped since `current_workspace` is
unused while `all_workspaces` is set.

Signed-off-by: Udaya Tejas <udayatejas2004@gmail.com>
@copy-pr-bot

copy-pr-bot Bot commented Oct 2, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@udsy19
udsy19 requested review from a team, derekwaynecarr, mrunalp and sjenning as code owners October 2, 2026 15:15
@github-actions

github-actions Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

All contributors have signed the DCO ✍️ ✅
Posted by the DCO Assistant Lite bot.

@udsy19

udsy19 commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

I have read the DCO document and I hereby sign the DCO.

@udsy19

udsy19 commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

recheck

@github-actions

Copy link
Copy Markdown

This pull request has had no activity for 14 days and is now marked stale.

@github-actions github-actions Bot added the state:stale Inactive item at risk of automatic closure. label Oct 19, 2026
@TaylorMutch

Copy link
Copy Markdown
Collaborator

/ok to test a459858

@TaylorMutch TaylorMutch left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The fix selects a discovered workspace when leaving all-workspaces scope and preserves cycling through default when it is visible. The regression is covered by the added test; isolated checks also confirmed singleton, empty-list and removed-workspace recovery plus selection resets. Required CI gates and issue acceptance pass. No blocking findings.

@TaylorMutch
TaylorMutch added this pull request to the merge queue Nov 10, 2026
Merged via the queue into NVIDIA:main with commit 31f230e Nov 10, 2026
89 of 91 checks passed
jgarciao pushed a commit to jgarciao/OpenShell that referenced this pull request Nov 11, 2026
…IDIA#4126)

`cycle_workspace` hardcoded "default" when entering the named-workspace
scope from the "all" scope (and when wrapping around). This assumed the
server-provided `workspace_names` list always contains "default" and lists
it first.

That assumption does not hold: the TUI populates `workspace_names` from
`ListWorkspaces`, which is membership-scoped per principal. A non-admin
user who is not a member of the "default" workspace receives a list that
omits it entirely. In that case, after one full cycle the scope indicator
lands on "default" — a workspace that does not exist in the list — and the
next cycle finds no match, flipping straight back to "all". The user can
never return to any of their real workspaces by cycling.

Enter the named scope at `workspace_names.first()` instead, and only when
at least one workspace is known. The stale `current_workspace = "default"`
writes in the "all" branches are dropped since `current_workspace` is
unused while `all_workspaces` is set.

Signed-off-by: Udaya Tejas <udayatejas2004@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state:stale Inactive item at risk of automatic closure.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(tui): workspace cycling gets stuck when default is not visible

2 participants