fix(ssh): suppress cascading DNS error when sign mode fails - #2430
Draft
brollb wants to merge 1 commit into
Draft
Conversation
When the SSH sign step fails (e.g. job not in RUNNING state), the proxy command was exiting with code 1. This caused SSH to skip the Match block entirely, so instead of running ProxyCommand it tried to resolve the hostname via DNS, producing a confusing secondary error: "Could not resolve hostname ... nodename nor servname provided" Fix by making main_sign() always exit 0: - error() in sign mode suppresses stderr output and saves the message to a per-hostname sign-error cache file - main_proxy() checks that cache first and surfaces the error cleanly, so users see only the relevant message (e.g. API 400 state error) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Brian Broll seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
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
When SSHing into a training job that isn't in RUNNING state, users were seeing two error messages:
baseten-ssh: API error (400): Training job must be in RUNNING state ...← the relevant onessh: Could not resolve hostname ...: nodename nor servname provided, or not known← confusing noiseThis PR removes the second spurious error.
💻 How
The SSH config uses a
Match execblock that runsproxy-command.py --signbefore the connection. SSH only applies theMatchblock (and thusProxyCommand) if the exec command exits 0. Previously, any sign failure callederror()→sys.exit(1), causing SSH to skipProxyCommandand attempt direct DNS resolution of the*.ssh.baseten.cohostname — which fails with the confusing secondary error.Fix:
main_sign()now always exits 0. In sign mode,error()suppresses stderr output and saves the message to a per-hostname sign-error cache file (~/.ssh/baseten/.jwt-cache/<hostname>.sign-error).main_proxy()checks the cache at startup. If a sign error is present, it clears the file, prints the message, and exits 1 — so users see exactly one, actionable error message.🔬 Testing
Manually verified the two-error scenario is reduced to one. Existing unit tests in
truss/tests/cli/test_ssh.pyall pass (43/43).