Repository navigation
fix(CLN-3684): print the API's reason for a refused cloud copy - #522
Merged
Merged
Conversation
…it non-zero Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
sammy-vastai
approved these changes
Oct 2, 2026
Contributor
|
Hi Elias, #522 only changed What the installed CLI does now:
|
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.
Companion to vastai/vast PR #6069 (CLN-3684), which makes the cloud copy endpoint refuse with a named, structured
4xxinstead of a200carryingsuccess: false.Why
cloud copyhad two failure modes, and both hid what went wrong:r.raise_for_status()turned any4xxinto a Python traceback, replacing a sentence written for the user with a stack dump.r.status_code == 200, so a refusal carried in a200body printed "Cloud Copy Started" and exited0. A copy that was rejected looked like a copy that had begun.The second one survives the backend change on its own, which is why this is a fix rather than an adaptation.
What changes
exit_on_copy_refusal(response)checks both the status and the body, prints the API'smsgto stderr, and exits non-zero. A copy only reports as started when the API actually accepted it.Verified against four shapes: a named
400, the409guard refusal, a legacy200withsuccess: false, and a500with no JSON body (falls back to the response text, then the status). All four print the message and exit1; a real200success proceeds untouched.Note for reviewers
This works against the current backend too. Today every refusal is a
200, so thesuccess: falsepath is the one that fires; once #6069 ships, the4xxpath takes over. Either way the user gets a sentence and a non-zero exit, so there is no ordering constraint between the two merges.🤖 Generated with Claude Code