Revert "Claude/update prod runner script lq2g s (#62)" - #63
Revert "Claude/update prod runner script lq2g s (#62)"#63gamblecodezcom wants to merge 1 commit into
Conversation
This reverts commit 5168fb7.
|
CodeAnt AI is reviewing your PR. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Accidentally hit revert |
Nitpicks 🔍
|
| say "Pulling latest code from origin main..." | ||
| if git -C "$PROJECT_DIR" pull origin main 2>&1; then | ||
| say "Git pull successful" | ||
| else | ||
| warn "Git fetch/reset failed — continuing with local copy" | ||
| warn "Git pull failed — continuing with local copy" |
There was a problem hiding this comment.
Suggestion: Using git pull in this unattended script means that if the remote main branch diverges and a merge conflict occurs, the command will leave the working tree in a conflicted/partially-updated state but the script only logs a warning and continues to restart the service, so the app may run with broken files containing merge markers. A safer pattern is to use git fetch plus git reset --hard origin/main (like the deploy script) and abort on failure so the service never runs against a conflicted tree. [logic error]
Severity Level: Major ⚠️
- ❌ prod-run.sh may restart bot with conflicted source files.
- ❌ Telegram bot downtime if Node fails to start.
- ⚠️ /health and /metrics endpoints unavailable during failure.
- ⚠️ Divergent prod repo state harder to recover reliably.| say "Pulling latest code from origin main..." | |
| if git -C "$PROJECT_DIR" pull origin main 2>&1; then | |
| say "Git pull successful" | |
| else | |
| warn "Git fetch/reset failed — continuing with local copy" | |
| warn "Git pull failed — continuing with local copy" | |
| say "Pulling latest code from origin/main..." | |
| if git -C "$PROJECT_DIR" fetch origin main 2>&1 && \ | |
| git -C "$PROJECT_DIR" reset --hard origin/main 2>&1; then | |
| say "Git update successful" | |
| else | |
| err "Git update failed — aborting to avoid running with a conflicted or partial checkout" | |
| exit 1 |
Steps of Reproduction ✅
1. On the production host, ensure the bot is deployed under `/var/www/html/Runewager` as
described in `README.md:102-124`, and that `prod-run.sh` is present (verified at
`/workspace/Runewager/prod-run.sh:1-365`).
2. From the project directory, create a local change that will conflict with an upcoming
remote change (e.g., edit `index.js` and commit it locally), so the local branch diverges
from `origin/main` while still using the same repo (any normal git workflow on this
directory, since `prod-run.sh` uses `$PROJECT_DIR` as resolved at `prod-run.sh:16-23`).
3. Push a conflicting change to `origin/main` from another environment so that a
subsequent `git pull origin main` from the server will produce merge conflicts (standard
git behavior when local and remote modify overlapping sections).
4. On the server, run `npm run prod` (entrypoint defined in `package.json:10-13` as
`./prod-run.sh`) or execute `./prod-run.sh` directly; when `prod-run.sh` reaches the block
at `prod-run.sh:43-48`, `git -C "$PROJECT_DIR" pull origin main` attempts the merge, fails
with conflicts, returns non-zero, and leaves the working tree with conflict markers, but
because the command is used in an `if ... then` test (exempt from `set -e` at
`prod-run.sh:9`), the script only logs `warn "Git pull failed — continuing with local
copy"` and continues into the restart logic at `prod-run.sh:313-340`, attempting to
restart `node index.js` against a conflicted/partially-updated tree, which can cause
runtime syntax errors or a failed start.Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** prod-run.sh
**Line:** 43:47
**Comment:**
*Logic Error: Using `git pull` in this unattended script means that if the remote `main` branch diverges and a merge conflict occurs, the command will leave the working tree in a conflicted/partially-updated state but the script only logs a warning and continues to restart the service, so the app may run with broken files containing merge markers. A safer pattern is to use `git fetch` plus `git reset --hard origin/main` (like the deploy script) and abort on failure so the service never runs against a conflicted tree.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.|
CodeAnt AI finished reviewing your PR. |
User description
This reverts commit 5168fb7.
CodeAnt-AI Description
Use git pull for automated deploys and avoid stopping the service beforehand
What Changed
Impact
✅ Shorter deploy downtime✅ Preserves local untracked files during deploy✅ Avoids forcibly discarding local changes when using bot/prod-run💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.