Repository navigation
fix(coder-client): surface real stderr on coder templates push failure - #361
Merged
Merged
Conversation
When the coder CLI is missing from PATH, push_template reported only 'Failed to run coder templates push', masking the real cause and bootstrap conflated it with missing template-management permissions. Handle a NotFound spawn error with an actionable install hint, and return the actual CLI stderr/exit code on non-zero template push.
…-push-error # Conflicts: # crates/coder-client/src/lib.rs
Collaborator
|
@greptileai review |
Collaborator
|
@greptileai review |
Christiantyemele
approved these changes
Oct 6, 2026
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.
Problem
During
./scripts/prod.sh bootstrap, pushing the 5 workspace templates (forge, sentinel, nexus, vessel, lore) failed with only:The token was valid and the user had template-management permissions, yet the real cause was invisible.
Root cause
CoderClient::push_templateshells out to thecoderCLI (coder templates push) to create/update templates, because Coder v2 does not support template version updates over REST. The actual failure was masked:coderCLI: when thecoderbinary is not onPATH(or not discoverable in the workspace), spawning the command returns anio::ErrorKind::NotFound, which the code mapped to the generic.context("Failed to run coder templates push"). It never said the CLI was missing, and bootstrap wrongly attributed the failure to template-management permissions.WARN;push_templatethen continued and returned whatever template it found, so the underlying reason never reached the caller.Change
crates/coder-client/src/lib.rs— reworked the command-run and error path inpush_template:NotFounderror (CLI not found) fails fast with a clear message telling the operator to install thecoderCLI (curl -fsSL https://coder.com/install.sh | sh) and re-run bootstrap. Any other spawn error carries the underlyingio::Error.check_template_push_output, which returns an error carrying the template name, the exit code, and the CLI's stderr/stdout — instead of logging a warning and continuing.develop'sresolve_coder_cli()so the CLI is found viaCODER_CLI_PATH,PATH,CODER_SCRIPT_BIN_DIR, or the workspace/tmp/coder.*/coderhelper before falling back to a plaincoderlookup.Why it matters
Bootstrap is the first-run setup gate for OpenFlows. When it fails, operators must be able to tell instantly whether it is an environment problem (missing CLI) or a permissions problem (token lacking template-management permissions). This change makes the two causes distinguishable and actionable, and prevents a silent "success" when a template push is actually rejected.
Testing
cargo build -p coder-client— clean.cargo test -p coder-client— 18/18 tests pass (includingcoder_cli_path_override_takes_precedence,template_push_success_allows_warnings,template_push_failure_preserves_terraform_diagnostics)../scripts/prod.sh bootstrapwith thecoderCLI installed — all 5 templates pushed successfully and✓ Coder bootstrappedreported.The PR appears safe to merge, though the quick start should retain a model-response check.
Findings
Fix with agent prompt
Summary
The PR makes CLI spawn failures more descriptive and cleans up template files before checking a completed push’s result. It also changes two quick-start instructions.
Reviews (1) · Last reviewed commit: "fix(ci): fix pipeline"