Repository navigation
[CLI] Bulk selectors act on the active workspace and confirm others' resources - #11440
Merged
Merged
Conversation
…resources -a, -u and glob selectors of down/stop/autostop/start, storage delete, volumes delete, jobs cancel, serve down and pool down act on the active workspace only. The confirmation lists other users' targets by owner and then defaults to no; jobs cancel -a/-u cancels exactly the jobs it listed. cancel CLUSTER -u defaults to no. pool down --all cancels only the jobs of the pools it tears down. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Volume names are the table's primary key, so one name cannot be in two workspaces. This reverts commit 42ad858. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
After a -a or pattern preview, serve down and pool down send the listed names instead of -a or the patterns, so the server cannot reach more than the user confirmed. Exact names that matched nothing are still sent so the server reports them. The pool prompt now comes before the question about cancelling the pools' jobs, and the workspace label comes from a record in the target workspace. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Records from a serve or pool controller older than the workspace field carry none, and the server leaves such a down unscoped, so the preview does too instead of reporting nothing to terminate. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Such a server answers the workspace lookup with 401, which aborted every bulk command, -y included. Treat it like a server too old to answer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Declining the job question in pool down aborts again instead of falling through to the teardown. - Records without a workspace field (storage before it had one) are not narrowed. - Serve and pool down without a known workspace keep the old prompt and let the server pick. - The preview names services whose workspace is unknown. - A workspace name that is not unique is reported as a usage error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The storage response model defaults the workspace to None, so the key is always present and an older server's storage was still narrowed to nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`sky volumes delete -a` and patterns now confirm through the grouped bulk prompt, which dropped the k8s-hostpath cleanup warning that the named-volume prompt shows. Pass it through, and default to no with it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The in-process test server cannot answer GET /users/me/workspace on Python 3.9: the sync handler's request context creates an asyncio.Event in a worker thread without an event loop. These tests are about the controllers, so mock the lookup as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
aylei
approved these changes
Nov 20, 2026
| return info['workspace'] | ||
|
|
||
|
|
||
| def _in_workspace(records: List[Any], workspace_id: Optional[str]) -> List[Any]: |
Collaborator
There was a problem hiding this comment.
Resources in other workspaces are now dropped silently. sky status still lists clusters from every workspace, but sky down -a / sky stop -a (and storage, volumes) now act on the active workspace only and say nothing about the rest, so a user can leave running clusters in another workspace without noticing. Also, sky jobs cancel -a without -y filters the ids here before they reach the server, so the "skipped, not in the active workspace" hint that #11439 keeps for -a never shows on this path.
Collaborator
Author
There was a problem hiding this comment.
Good catch on both. Fixed in b179bec + 8e99f1b.
Wherever the CLI drops matches for being in another workspace, it now prints one line before acting:
Skipped 4 clusters in other workspaces: 3 yours (own-b, own-c and 1 more), 1 of other users. Switch the active workspace to act on them.
- It covers
down/stop/autostop/startwith-a/-u/glob,storage delete,volumes deleteandjobs pool down, with or without-y. - It also covers the
serve downandjobs cancel -a/-upreviews. Those previews run only without-y. With-ythe server does the selection, and forjobs cancel -a -yit still prints its own "skipped" hint. - Your own resources are named, up to 2 and then "and N more". Other users' are only counted, which keeps admin
-ushort across many workspaces. sky jobs cancel -awithout-ynow names your jobs left in other workspaces.- Nothing is printed when nothing is skipped, when the server cannot scope (older server or no auth), or for records with no workspace (for example legacy storage).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
-a,-uand glob selectors that change resources now act on the active workspace only. Their confirmation now says whose resources are affected.Scope. The bulk selectors of these commands pick from the active workspace only, admins included:
sky down/stop/autostop/startsky storage deletesky volumes deletesky jobs cancelsky serve downsky jobs pool downBefore, they picked from every workspace the caller can read; for an admin, that was every workspace. For example,
sky down -uas an admin tore down every cluster on the server.GET /users/me/workspace. It honoursactive_workspacefrom the config files and from--config.Confirmation. When a bulk target belongs to another user, the prompt lists the targets by owner and defaults to
[y/N]:[Y/n].-ystill skips the prompt.sky jobs cancel -a/-uwithout-ylists the jobs first, then cancels exactly the listed ids. A job submitted while the prompt is open is never cancelled unseen. With-y, the request is unchanged.sky cancel CLUSTER -udefaults to[y/N], even when every job on the cluster is yours. Checking ownership would need an extra queue call per cluster.sky serve down/sky jobs pool downwith--allor a pattern preview what the server will tear down, using the caller's role fromGET /users/role. An admin whose targets include other users' services gets the grouped[y/N]prompt. If the listing fails, the prompt is today's. The server still decides the actual set.sky jobs pool down --allused to cancel the running jobs of every visible pool before tearing down, including pools it would not tear down. It now cancels only the jobs of the pools it tears down.Test plan
tests/unit_tests/test_sky/test_cli_bulk_selectors.py, covering:-a,-uand patterns (exact names not narrowed);[Y/n];-y, an old server, and an ambiguous workspace;jobs cancel -ucancelling exactly the listed ids (deduped per job), and-yunchanged;cancel -udefaulting to no;--allcancelling only the reached pools' jobs.tests/test_cli.py,tests/test_jobs_and_serve.pyandtests/unit_tests/**/test_cli*.py).sky down -u, then press Enter: lists alice's and bob's ws-a clusters by owner and aborts; ws-b is not listed.sky down -u -y: tears down only the ws-a clusters.sky stop -a, then press Enter: stops alice's ws-a clusters only.sky jobs cancel -u: lists the ws-a jobs by owner and cancels only those ids.🤖 Generated with Claude Code