Fix/fail closed remote mode - #4
Draft
santiagocasas wants to merge 2 commits into
Draft
santiagocasas wants to merge 2 commits into
santiagocasas wants to merge 2 commits into
Conversation
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.
Important
This PR depends on #1 and should not be merged until that PR has been merged.
While PR #1 is still open, this PR's diff also includes its commits. I will rebase this branch onto
masterafter PR #1 is merged.Fixes issue #2.
What this changes
This is a follow-up to #1 and is intended to address #2.
Remote mode used to depend only on in-memory session state. If that state disappeared, or
if the SSH control connection died, a Bash command could fall through and run locally.
That is a risky failure mode because the user asked to work on another machine.
This PR makes remote mode fail closed:
connecting,connected, orunavailable;localexplicitly clears the persisted state and closes the control connection.It also reuses an already authenticated control socket. Automatic connection attempts use
SSH batch mode, so OpenCode does not get stuck waiting for a password or TOTP prompt it
cannot display. If interactive authentication is needed, the tool returns the exact
control-socket command to run in a normal terminal.
The remote system prompt now also makes it clear that OpenCode's platform and working
directory metadata describe the local machine, not the connected host.
Checks
git diff --cached --check.hook logic.
runtime testing against a real OpenCode session.
AI assistance
The code and this PR description were generated with help from GPT-5.6-Sol.