feat(remote): direct SSH targets without a gateway or scheduler - #18
Merged
Merged
Conversation
A `remote.host` target connects straight to one Linux box: no gateway hop, no DTN, no Slurm. Execution, Git transport, tunnels, and attach all ride the configured host or ~/.ssh/config alias, as does reconnecting after a connection expires. Resolve the destination with `ssh -G` before choosing a ControlMaster socket, so editing an alias or an Include file can never reuse a master connected to the previous account or host; fail closed when resolution fails rather than falling back to a stale socket. An explicit `remote_user` overrides any `User` option regardless of capitalization. `host` cannot be combined with gateway, transfer_host, slurm, or the BRC-specific cert_file. `--node` is refused by collaborate, attach, and tunnel forward alike: a direct target has one host and no scheduler to request a node from, and `_direct_control` clears `compute_node` on connect, so a pin would silently vanish rather than take effect. Tests: 791 pass (27 new covering validation, socket identity, Git transport, tunnel commands, and the --node refusal). GitNexus detect-changes reports critical risk, driven by the breadth of the change (34 symbols, 44 execution flows) rather than a defect: every direct-target branch is gated on `remote.host`, which is None for all cluster targets. The one shared edit, executor.py's `or not self.gateway`, is inert when gateway is non-empty, which the parser requires for cluster targets. Not yet smoke-tested against a real SSH host; all coverage is mocked. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AGhbys9tXLm9kDHGhxqLN6
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.
What
Adds a
remote.hosttarget so an ordinary Linux box can be a SuCoder target — no gateway hop, no DTN, no Slurm. Execution, Git transport, tunnels, andattachall ride the configured host or~/.ssh/configalias, including after a connection expires.Notable design points
ssh -Gevaluates the destination before a ControlMaster socket is chosen, so editing an alias or anIncludefile can't reuse a master still connected to the previous account or host. Resolution failure fails closed rather than falling back to a stale socket, and is deliberately uncached since SSH config can change between commands.remote_userwins over anyUseroption, regardless of capitalization.hostis mutually exclusive withgateway,transfer_host,slurm, and the BRC-specificcert_file; validation also rejects empty, whitespace-bearing, and--prefixed values (option injection).--nodeis refused consistently bycollaborate,attach, andtunnel forward. A direct target has one host and no scheduler;_direct_controlclearscompute_nodeon connect, so a pin would silently vanish rather than take effect.releaseremains Slurm-only, andtunnel upwarms the single connection without writing cluster aliases to~/.ssh/config.Testing
791 tests pass (763 pre-existing + 28 new). New coverage: config validation and mutual exclusion, socket identity separation by user/port/alias-resolution, Git transport option preservation, the full set of
tunnelsubcommands, and the--noderefusal. The--nodetest is mutation-verified — it fails without the guard.Reviewer notes — please read
detect_changesreports CRITICAL risk: 34 symbols across 8 files, 44 affected execution flows (Collaborate,Attach,Tunnel_down,Push,Agents_clone). This is driven by breadth, not a detected defect — the feature necessarily touches every tunnel entry point. Every direct-target branch is gated onremote.host, which isNonefor all cluster targets. The one genuinely shared edit isexecutor.py'sif self.control_socket_path or not self.gateway:;not self.gatewayis alwaysFalsefor cluster targets because the parser requires a non-emptygateway.sucoder -T <host> collaborateagainst a real box is worth doing before merge.ssh -Gruns once perssh_control_kwargs()call (local-only, 10s timeout). The fail-closed reasoning justifies it, but it is per-invocation rather than per-session.🤖 Generated with Claude Code
https://claude.ai/code/session_01AGhbys9tXLm9kDHGhxqLN6