Repository navigation
fix(swe_agents): fix exit-code capture and final-failure exit in openhands.sh make-build retry - #2446
Merged
marta-sd merged 2 commits intoAug 11, 2026
Conversation
michal2409
force-pushed
the
mfutrega/fix-openhands-make-build-retry
branch
from
August 10, 2026 18:23
d3d7c1a to
e2c0772
Compare
…hands.sh make-build retry The retry loop around 'make build' in setup_scripts/openhands.sh has three bugs: 1. 'exit_code=$?' runs after the 'if' statement has completed, so it captures the if-statement's status (always 0), not make's. Timeouts are therefore reported as 'failed with exit code 0' and never detected as exit 124. 2. On the final attempt, a failure neither increments 'attempt' nor exits, so the loop re-runs 'make build' forever instead of failing the setup. 3. A first-attempt timeout leaves a partially-built .venv behind; 'make clean' does not remove it, and the retry can trip over the half-installed environment. Fix: capture the exit code in an 'else' branch (while it is still make's), 'exit' with it on the final failure, and remove .venv before retrying. Also make the first-attempt timeout env-overridable (MAKE_BUILD_TIMEOUT_SECONDS, default unchanged at 2 minutes) so hosts where a healthy build takes longer can raise it without editing the script. Signed-off-by: Michal Futrega <mfutrega@nvidia.com>
michal2409
force-pushed
the
mfutrega/fix-openhands-make-build-retry
branch
from
August 10, 2026 18:32
e2c0772 to
828cee7
Compare
marta-sd
approved these changes
Aug 11, 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.
The retry loop around
make buildinsetup_scripts/openhands.shhas three bugs:exit_code=$?runs after theifstatement has completed, so it captures the if-statement's status (always 0), not make's. Timeouts are reported as "failed with exit code 0" and exit 124 is never detected.attemptnor exits, so the loop re-runsmake buildforever instead of failing the setup. In a Docker build this hangs until the CI job times out; worse, if a late retry "succeeds" against a half-broken tree, the failure is deferred to runtime..venvbetween retries. A first-attempt timeout leaves a partially-built in-project.venvbehind (POETRY_VIRTUALENVS_IN_PROJECT=trueis set just above);make cleandoes not remove it. The script has alreadycd'd into$openhands_dirat this point, so the removal only targets the OpenHands checkout.This PR captures the exit code in an
elsebranch (while it is still make's),exits with it on the final failure, and removes.venvbefore retrying.It also makes the first-attempt timeout env-overridable (
MAKE_BUILD_TIMEOUT_SECONDS, default unchanged at 2 minutes), so hosts where a healthymake buildlegitimately takes longer can raise it without editing the script — on such hosts the 2-minute guard otherwise kills every healthy first attempt and forces the fallback path above.