Repository navigation
Ready a Spinbox workspace before Remote-SSH connects to it - #27
Merged
Merged
Conversation
aledbf
force-pushed
the
ssh-remote-hook
branch
from
November 12, 2026 21:50
de9d234 to
eccd143
Compare
Spinbox activates on onResolveRemoteAuthority:ssh-remote, which VS Code waits for before Remote-SSH resolves, as Coder's extension does. For a window whose folder is ssh-remote+spin.<workspace> - a reload, a reconnect, a recent folder - it runs `spin code --start` under a progress notification: the workspace started, this VS Code's server attached, the ssh config written, and one connection made through it, which runs ssh-prepare and its launch-claim check. A failure is the CLI's error with its action (add a key, sign in, start); unless its retry succeeds, the window leaves the remote (workbench.action.remote.close), so Remote-SSH does not fail its own way. Then it reads spin ssh-proxy's status file of the connection while Remote-SSH connects: each step in the status bar, and a failure shown with its action, closing the remote. The file is being built in spin; its layout here is provisional, behind ProxyStatusSource, and tested with fixtures. The authority is read from the window's folder: env.remoteAuthority is the resolvers proposal's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
~/.spin/ssh/status/<ssh pid>.json, version 1 (any other refused): phase resolving, connecting, connected, refused or failed, the host, and on a refusal the CLI's error envelope. Of the files there, the one last updated for the window's spin.<ws> whose connection began after spin code returned is this window's: spin code's own ssh, and the shared connection it leaves, began before. Resolving and connecting are said in the status bar once each; refused and failed are shown and close the remote - with the CLI's action when the contract knows the code, and otherwise its message and the page it names. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
aledbf
force-pushed
the
ssh-remote-hook
branch
from
November 12, 2026 21:55
eccd143 to
6487290
Compare
aledbf
added a commit
that referenced
this pull request
Nov 12, 2026
#27 and #29 merged from the same base, so main ran #27's tests against #29's contract: connect.test failed with no_key_held, which the fake spin no longer writes, and proxy.test still held key_not_enrolled to be a code the contract does not know. The refusal is key_not_enrolled now, shown with its Add Key; the unknown code is one no release writes yet. 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.
Part of #24. This makes Remote-SSH the default path in Spinbox's hands, following Coder's pattern (coder/vscode-coder ARCHITECTURE.md). It is based on
mainand does not depend on #26.onResolveRemoteAuthority:ssh-remoteis in activationEvents, andactivateawaitsconnectWindow(src/remote/index.ts,src/remote/connect.ts). VS Code waits for that activation before Remote-SSH resolves. For a window whose folder isssh-remote+spin.<ws>, it runsspin code <ws> --no-open --start --vscode-commit …under a cancellable progress notification. That starts the workspace, attaches this VS Code's server, writes the ssh config, and connects once through it, which runsspin ssh-prepareand its launch-claim check. So no separatessh-preparecall is needed. Run from the extension host, it would also key its session to the wrong pid and go unused.showCliError, with its action: add key, sign in, start, sign, retry. Unless its retry succeeds, or when the person cancels, the window runsworkbench.action.remote.close(what Coder does), so Remote-SSH never shows its own error.src/remote/proxy.ts), as spin-stack/spin#1180 writes it:~/.spin/ssh/status/<ssh pid>.json, version 1 (any other is refused).spin.<ws>host whosestarted_atis afterspin codereturned.spin code's own ssh, and the shared connection it leaves, began before that.socksPortlog line. Two windows connecting to the same workspace at the same moment could read each other's file.resolvingandconnectingare said once each in the status bar.refusedandfailedare shown, and the remote is closed. If the contract knows the code, the error is shown throughshowCliErrorwith its action; otherwise its message is shown with an Open button for itsurl.spin code/spin ssh-configwrite~/.spin/ssh/configand keep anIncludeof it at the top of~/.ssh/config(cmd/cli/cmd/sshconfig.goensureInclude)./root/.vscode-server/cli/servers/Stable-<commit>/server(internal/controlplane/vscodeserver/tree.golinks). So Remote-SSH downloads nothing, andremote.SSH.serverInstallPathwould only repeat the default.The authority comes from the window's folder URI, the same way the status bar reads it.
env.remoteAuthoritybelongs to theresolversproposal, which Coder reaches by loadingvscodeas Remote-SSH's module. That is not copied here.Tests
test/unit/connect.test.tsruns against the fake spin: the hook's command, the authorities it leaves alone, a refusal shown and then the remote closed, a retry that succeeds, and cancel.test/unit/proxy.test.tsruns on fixtures in exactly spin#1180's shape: version, phase, host and time checks, a shared connection, the file picked (other host, older connection, other version), envelope or message plus URL, each phase said once, refused/failed/connected answered, and a quiet timeout. The manifest test checks the activation event. Nine planted bugs each turned a test red and were reverted with Edit:ssh-remotecheck dropped;sincefilter dropped;refusednot treated as the end;Found: the extension's error codes are behind its pinned spin
spin v20261110.01, the release versions.yaml pins, writes
key_not_enrolled(actionadd_key) andno_extension_release. It no longer writesaccess_needs_signature,keyring_needs_signatureorno_key_held(spin 22c480b66).src/cli/contract.ts, the errors module and the fake spin still have the old codes.So today
key_not_enrolledis not in the contract:spin code's refusal shows as internal, and here a proxy refusal shows its message and the keys page rather than an Add Key action. Fixing that is its own PR, against the contract.Not tested in a real VS Code: that activation really blocks Remote-SSH's resolve on 1.146. It needs a real Remote-SSH and a stack.
🤖 Generated with Claude Code