Repository navigation
Conversation
The dev deploy fed its script to `ssh ec2-deploy` with no command, so it ran in a login shell. On exit a login shell runs ~/.bash_logout, whose clear_console fails without a tty, and under `set -e` that turned the script's `exit 0` into exit 1 even though backend-dev was healthy. Run the script with `bash -s` instead (this also drops the MOTD from the log), and stop printing the expected connection-refused while uvicorn starts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
The first dev-slot deploy (Oct 28) worked, but the job still failed. backend-dev passed its health check, the log printed "✅ Dev deployment completed", and then the step exited with code 1.
Cause
The deploy script was sent to
ssh ec2-deploywithout a command, so the server ran it in a login shell. When a login shell exits, it runs~/.bash_logout. On Ubuntu that file callsclear_console, which fails when there's no terminal. Because the script usesset -e, that failure turned the script'sexit 0into exit code 1.The prod deploy doesn't hit this because its script never calls
exit; it just runs to the end. I reproduced both cases locally with Ubuntu's.bash_logout:bash -sset -e+exit 0(dev)Fix
ssh ec2-deploy bash -s << 'DEPLOY_EOF': the script now runs in a plain shell, so~/.bash_logoutnever runs, and a real failure still gives exit code 1. As a side effect, the Ubuntu welcome banner no longer appears in the log.curl -fs, so the expected "connection refused" while uvicorn starts no longer shows up in the log.Testing
To check before merging: go to Actions → Deploy dev slot to EC2 → Run workflow, choose
fix/dev-deploy-exit-codein "Use workflow from", and enterfix/dev-deploy-exit-codeas the branch. That branch pins the same web-client and cloud-services commits asmain. The run should finish green.Merging this into
mainalso redeploys prod, as every merge does. Prod deploys the same commits it's already running.🤖 Generated with Claude Code