Repository navigation
fix(cli): gate studio ssh and ssh configure on the studio-ssh flag - #232
Merged
Merged
Conversation
k223kim
marked this pull request as ready for review
November 4, 2026 18:05
k223kim
requested review from
ethanwharris,
justusschock,
rusenask and
tejapulagam
as code owners
November 4, 2026 18:05
justusschock
approved these changes
Nov 4, 2026
tejapulagam
approved these changes
Nov 4, 2026
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.
Why
The control plane reports whether Studio SSH is available through a new boolean flag in
/v1/config,apiLockdownStudioSSH. Until now the CLI listedlightning studio sshandlightning ssh configureinUNAVAILABLE_COMMANDS, so they were refused whenever the other gated commands were, and would have stayed refused even once the server enables Studio SSH.What
STUDIO_SSH_FLAG = "apiLockdownStudioSSH"is added next to the other flag constants inlockdown_status.py.studio sshandssh configuremove fromUNAVAILABLE_COMMANDStoGATED_COMMANDS, gated onSTUDIO_SSH_FLAGonly.job ssh,mmt ssh,vm ssh,sandbox connectand every other command are unchanged.Nothing changes for users until a server reports the flag as true. A server that doesn't send the flag at all keeps both commands closed, because a missing flag counts as closed. So this can ship before or after the server change. The CLI caches the flags for 5 minutes, so turning Studio SSH on or off reaches CLIs within minutes.
If
/v1/configcan't be read, gated commands are allowed to run, and while Studio SSH is off the server refusesPOST /v1/ssh-keys; the CLI turns that refusal into the same "temporarily unavailable" notice. This is the same behaviourstudio starthas today.#231 (local SSH key creation) shipped in
v2026.11.04.post0. That release still lists both commands as unavailable, so this change needs to be released before the server enables Studio SSH.Legacy forwards
The hidden legacy forwards
lightning configure sshandlightning connect studiofollow the same gate, and no separate change was needed. Incli/entrypoint.pythey are built after the gates are applied tomain_cli, fromssh.commands["configure"]andstudio.commands["ssh"], so they hold the marked copies.DeprecatedForwardCommandcopies the target'scallback, which on a marked copy is the gated callback that re-checks the flag on every run. The new tests run both forwards through the real CLI to confirm this.The older
configure sshandconnect studiocommands incli/legacy/configure.pyandcli/legacy/connect.pyare only registered bycli/legacy/entrypoint.py. That entrypoint is not thelightningconsole script and nothing else imports it, so users can't reach those commands and they were never gated.Tests
python/tests/cli/test_temporarily_unavailable.pyrunstudio ssh,ssh configure,connect studioandconfigure sshthroughmain_cli:apiLockdownStudioSSHmissing, false, or missing while the other Studio flags are open, all four print the notice and never reach the command's code.apiLockdownStudioSSHtrue, all four run past the gate.GATED_COMMANDSnow cover the two commands as well.pytest tests/cli/test_temporarily_unavailable.py tests/cli/ssh tests/cli/studio/test_ssh.py tests/cli/test_legacy_redirects.py tests/cli/test_entrypoint.py: 266 passed. With the gating change reverted, the four "runs once open" cases fail, as expected.pre-commit run --fileson the changed files passes, including ruff, ruff-format and mypy.No docs, help text or changelog list these commands as unavailable, so there was nothing else to update.
— Claude Opus 5.5, on direct instruction; text not reviewed