Repository navigation
fix: 🐛 sbx up uses logged-in control plane - #912
Merged
Merged
Conversation
Signed-off-by: Evaline Ju <[email protected]>
ingpaolodettori-dev
approved these changes
Nov 19, 2026
ingpaolodettori-dev
left a comment
There was a problem hiding this comment.
Review — fix: sbx up uses the logged-in control plane
When a repository is bound to a control plane this machine has no login for, up now uses the control plane it is logged in to and rebinds, instead of failing; and it never asks a control plane for the bound sandbox id when the flag or MOCACTL_SBX_URL names a different one.
Verified
- Scope: the whole block is inside
if (command === 'up')(cli.ts:1210-1232), sorun/push/pull/execbehaviour is unchanged.upis not inTAKES_SANDBOX_FLAG, so the later binding read at :1281 cannot undo the fallback by re-settingboundUrl. - The fallback's conditions are the right ones: no flag, no
MOCACTL_SBX_URL, a bound URL, a cached login for the fallback URL and none for the bound one.loadAuthmatches throughsameControlPlane/canonicalControlPlaneUrl(config.ts:184-205), so a trailing-slash or spelling variant of the same endpoint still counts as logged in and does not trigger a rebind. - There is no other credential source: mocactl has no env/flag token, so "no
loadAuthentry" really does mean "this machine cannot reach that control plane". - The second guard is a real fix: with
--control-plane-url(or the env var) naming another control plane,upBoundis cleared, so the bound id is never requested from a control plane that never issued it — the new test asserts no/v1/sandboxes/<id>call. - Tests cover the four paths (rebind + one create, keep the binding when the login is for it, flag case, no login for either with no
sbx uphint) and the hint added inopenSbx; CI is 18/18 green. The new docs paragraph and the embeddedSBX_USAGEtext incli.tssay the same thing.
One suggestion inline (cli.ts:1224) about what the rebind warning tells the user.
Author: evaline-ju (MEMBER — maintainer). Agent/IDE config: none. Commits: 1, signed off.
Signed-off-by: Evaline Ju <[email protected]>
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
After
mocactl sbx loginto a new control plane,mocactl sbx upin a repo bound to the old one now uses the control plane you logged in to and rebinds, instead of failing with exit 3.Fixes #889
Testing
E2E against a real control plane, in a scratch repo bound to an old control plane this machine has no login for:
mocactl sbx upexits 3 with "not logged in … (from .sbx/sandbox.json)".pushstill refuses, and now suggestsmocactl sbx up.upwarns that it is moving from the old control plane to the logged-in one, then creates a sandbox there, pushes and rebinds.pushuses the new binding with no flag orMOCACTL_SBX_URL.rmcleaned up the sandbox and the binding.Assisted-By: Claude Code
Checklist
git commit -s).make lintand the tests for the touched packages pass.docs/page, with the right maturity label (seedocs/CONTRIBUTING-DOCS.md).make check-linkspasses if any Markdown changed.docs/specs/README.mdordocs/adrs/README.md. - N/A