opencode_env: don't retry the install when version resolution fails - #1074
opencode_env: don't retry the install when version resolution fails#1074jayzuccarelli wants to merge 3 commits into
Conversation
The upstream installer resolves opencode_version='latest' through api.github.com (60 req/hr unauthenticated) and reports a failed lookup on stdout with an empty stderr — the exact signature _exec_with_retry treats as transient. Each sandbox bootstrap then burns 3 API calls instead of 1, and the raised error hides the cause in stdout_tail. Teach _exec_with_retry a fatal_markers escape hatch, mark the installer's version-resolution failure as fatal at the install call site, and raise an actionable error pointing at pinning opencode_version (the pinned branch of the installer never touches the API). Addresses the retry-amplification half of huggingface#1072; avoiding the API lookup entirely (prebaked template / pinned default) is left as a design call on the issue.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit d26c957. Configure here.
OPENCODE_VERSION= prefixed onto curl never reaches the bash side of the curl | bash pipeline, and the upstream installer reads VERSION / --version anyway — so pinning silently tracked latest. Pass --version via bash -s -- instead, per the installer's own usage text.
|
@sergiopaniego you've been shipping the recent |
There was a problem hiding this comment.
Reviewed exact head 3b122d74dbc232e5ac456857e7b16164e497bbcd against current main f8433a56f2fde5a6f20765b491b8365fc123f7fa. The fatal version-lookup classification and bash -s -- --version propagation are correct; the prior Bugbot concern is resolved, all 9 focused tests pass locally, the changed scope is lint-clean, and the merge-tree is conflict-free. No Tier-1 or alignment defect remains.
This is not merge-ready yet because the standard workflows never executed (action_required at this exact head), and the branch is behind current main. A maintainer must approve the external-branch workflows, refresh the branch, and require all exact-head checks to pass. burtenshaw is already requested; no code change is otherwise required.
Sent by Cursor Automation: Release
|
@burtenshaw you're the requested reviewer here, so pinging you directly. Small change to |



Summary
_bootstrap_sandboxinstalls opencode per sandbox, and with the defaultopencode_version="latest"the upstream installer resolves the version throughapi.github.com(60 req/hr unauthenticated). When that lookup fails it printsFailed to fetch version informationon stdout and exits 1 with an empty stderr — exactly the signature_exec_with_retryclassifies as transient. So every rate-limited bootstrap burns 3 API calls instead of 1, and the finalRuntimeErrorburies the actual cause instdout_tail.This PR takes the retry-amplification half of #1072:
_exec_with_retrygains afatal_markersescape hatch: a failure whose stdout matches a marker is deterministic and not retried, even with empty stderr.opencode_versionto a release tag (the pinned branch of the installer resolves via a plaincurl -sIto github.com, no API quota involved).The larger direction — prebaking the binary into the template or moving the default off
"latest"— is a design call better made on the issue.Test plan
Red-green: the three new tests in
tests/envs/test_opencode_factory_lifecycle.pyfail onmain(install retries all 3 attempts, no actionable message) and pass with the fix. Full suite:PYTHONPATH=src:envs pytest tests/→ 1532 passed, 133 skipped; the one failure (test_push_count_deploys_multiple_spaces) reproduces identically on cleanmain.Note
Low Risk
Sandbox bootstrap and install-command construction only; behavior change is fewer retries and clearer errors on deterministic install failures.
Overview
Fixes sandbox bootstrap wasting three GitHub API calls when the OpenCode installer fails to resolve
latest(rate limit): that failure prints on stdout with empty stderr, which_exec_with_retrytreated as transient._exec_with_retrynow accepts optionalfatal_markers; if failed stdout contains a marker, it stops retrying immediately (silent SIGKILL-style failures still retry).Install path passes
fatal_markersfor the installer’s version-fetch error and maps it to a clearRuntimeErrorsuggesting users pinopencode_versionto avoid theapi.github.comlookup.build_install_cmdpins versions viacurl … | bash -s -- --version <tag>instead of aOPENCODE_VERSIONprefix oncurl, so the version actually reaches the bash installer.Reviewed by Cursor Bugbot for commit 3b122d7. Bugbot is set up for automated code reviews on this repo. Configure here.