Skip to content

feat: install script to check for hard stops - #4489

Open
aldy505 wants to merge 5 commits into
masterfrom
aldy505/feat/check-hard-stop
Open

feat: install script to check for hard stops#4489
aldy505 wants to merge 5 commits into
masterfrom
aldy505/feat/check-hard-stop

Conversation

@aldy505

@aldy505 aldy505 commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

The idea came from Discord, and Alex (stayalive) lay out a very good approach on this: https://discord.com/channels/621778831602221064/796028405833007104/1541789134006259814

The idea came from Discord, and Alex (stayalive) lay out a very good approach on this: https://discord.com/channels/621778831602221064/796028405833007104/1541789134006259814
Comment thread install/check-hard-stop.sh Outdated
Comment thread install/check-hard-stop.sh Outdated
Comment thread install/check-hard-stop.sh Outdated
Comment thread install/check-hard-stop.sh Outdated
Comment thread install/check-hard-stop.sh Outdated
Comment thread install/check-hard-stop.sh Outdated
Comment thread install/check-hard-stop.sh
Comment thread install/check-hard-stop.sh Outdated
Comment thread install/check-hard-stop.sh Outdated
@aldy505

aldy505 commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator Author

@aminvakil apparently, exit 0 terminates the install script. do you have any other suggestion for this? I want to avoid hadouken pattern.

EDIT; nevermind I just read this #4489 (comment), sorry about that

Comment thread install/check-hard-stop.sh Outdated
Comment thread install/check-hard-stop.sh Outdated
@BYK

BYK commented Aug 25, 2026

Copy link
Copy Markdown
Member

Just dropping this here: #3878 (review)

Overall, I think this is pretty good but we need a shared place and format to have the hard-stops so docs and the repo does not diverge. I'd propose JSON in a well-known location like the docs repo or this repo, and reading it with jq in the install script

@aldy505

aldy505 commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator Author

Just dropping this here: #3878 (review)

Overall, I think this is pretty good but we need a shared place and format to have the hard-stops so docs and the repo does not diverge. I'd propose JSON in a well-known location like the docs repo or this repo, and reading it with jq in the install script

@BYK Yeah I remember about your comment. I don't know where the "shared place" should be. I don't want to have it on sentry, because I don't want to pull any image first, just for doing this. At the end of the day, I would think having these two separate would be good.

And yes, there will always be a maintenance burden for this one.

Comment thread install/check-hard-stop.sh
Comment thread install/check-hard-stop.sh
Comment thread install/check-hard-stop.sh
Comment thread install/check-hard-stop.sh
Comment thread install/check-hard-stop.sh Outdated
Comment thread install/check-hard-stop.sh
@BYK

BYK commented Aug 26, 2026

Copy link
Copy Markdown
Member

I don't want to have it on sentry, because I don't want to pull any image first, just for doing this

Not sure we are on the same page. My proposal is having this information in a separate, dedicated JSON file in this repo and then the docs repo fetching it at build time.

@aldy505

aldy505 commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator Author

I don't want to have it on sentry, because I don't want to pull any image first, just for doing this

Not sure we are on the same page. My proposal is having this information in a separate, dedicated JSON file in this repo and then the docs repo fetching it at build time.

Aaaaaahhhhhh, that makes sense. I dunno how to do it on the docs repo, but making a JSON file here would be doable.

if [[ -n "$current_version" ]]; then
# We iterate over the list of hard stops, and check whether the current
# version is below any of them.
local _wrote_version=0

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The installation script will fail because local is used outside a function in install/check-hard-stop.sh. The script runs with set -e, causing it to exit on this error.
Severity: CRITICAL

Suggested Fix

Remove the local keyword from the declaration of _wrote_version on line 149. The line should be changed from local _wrote_version=0 to _wrote_version=0 to correctly declare it as a script-level variable.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: install/check-hard-stop.sh#L149

Potential issue: In `install/check-hard-stop.sh`, the `local` keyword is used to declare
the `_wrote_version` variable at the top level, outside of any function. In bash,
`local` is only valid inside a function and will return a non-zero exit code when used
in the global scope. Because the parent `install.sh` script executes with `set -e`, this
error will cause the entire installation/upgrade process to abort prematurely. This bug
is triggered during a standard upgrade for any existing user who has a
`.sentry-hard-stop` file from a previous installation, which is a common scenario.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 2b942d2. Configure here.

if [[ -n "$current_version" ]]; then
# We iterate over the list of hard stops, and check whether the current
# version is below any of them.
local _wrote_version=0

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Top-level local crashes upgrade installs

High Severity

local _wrote_version=0 runs at script scope in a sourced file, which bash rejects. Combined with set -e in install.sh, any upgrade that already has a tracking file aborts immediately, so the hard-stop check never runs and the install cleanup trap can stop a live stack.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 2b942d2. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants