Repository navigation
Commit dfe0364
fix(install): resilient latest-version fetch (both installers) (#946)
* fix(install): don't hard-fail when the GitHub releases API blips
Reported on #930: a transient 504 from api.github.com/.../releases/latest (or
the 60/hr/IP unauthenticated rate limit) aborted the whole install with
"Failed to fetch version information" — even though the download itself uses
releases/latest/download/<file>, which GitHub resolves server-side with no API
call. The API response only feeds the version-string display and the
already-installed short-circuit.
Both installers now, in the latest path:
- retry the API call up to 3x with linear backoff (bash uses curl --fail so a
504 retries instead of parsing an error body);
- on continued failure, print a muted notice and proceed to install latest
anyway (version string shown as "latest");
- only short-circuit as "already installed" on a real version match — never
treat empty==empty (unresolved version + unreadable binary) as installed.
Pinned-version installs (-Version / --version) are unchanged: a genuine 404
still hard-fails.
Tests: version-fetch-resilience.test.ts pins the retry + graceful-degrade
behavior in both installers. bash -n clean; install.ps1 parses clean and the
Pester suite (6/6) still passes on PowerShell 7.6.2.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(install): address latest-version-fetch review
- install: append `|| true` to the retry's curl|sed assignment. Under
`set -euo pipefail` a failing `curl --fail` propagated through the pipeline
and aborted the script at attempt 1, before the loop could retry or degrade
(sahrizvi; reproduced: exit 22 without the fix, all 3 attempts + degrade with
it). Also add `--max-time 10` to bound a dead-air socket.
- install.ps1: reset $specificVersion to $null (not "") on the degrade path, so
the already-installed short-circuit can't false-match "" -eq "" when the
version probe of a missing/corrupt binary also yields "" (dev-punia, sahrizvi).
- install.ps1: add -TimeoutSec 10 to Invoke-RestMethod (defaults to 100s on
PS 5.1, unbounded on PS 7+) to bound retries on dead air (sahrizvi).
- tests: TS guards for `|| true`, --max-time/-TimeoutSec, and the $null reset.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019M7GkS3bYZaFhEbBhVTecG
* fix(install.ps1): ASCII-only so it parses on Windows PowerShell 5.1
install.ps1 had no BOM and used a few non-ASCII characters (em dash, ellipsis,
right arrow) in comments and messages. Windows PowerShell 5.1 - the default
shell on Windows 10 and preinstalled on Windows 11 - reads a BOM-less file as
the system ANSI codepage, not UTF-8, so those multi-byte characters corrupt the
token stream and the whole script fails to parse (verified on real PS 5.1).
This is a pre-existing issue (the characters predate this PR) that CI doesn't
catch because the Pester job runs under pwsh (PowerShell 7, UTF-8 by default).
Replacing the three characters with ASCII equivalents (-, ..., ->) makes the
installer parse and run on PS 5.1 while keeping pwsh behavior identical.
Also removes the now-obsolete "integrity verification deferred" NOTE comment:
the sibling PR #942 implements that verification and removes the same block, so
deleting it here too keeps the two PRs mergeable in either order with no
conflict. Same transliteration is applied verbatim in #942.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019M7GkS3bYZaFhEbBhVTecG
* test: update #930 release-validation for resilient version fetch
The #952 release-validation suite asserted the latest path hard-fails with
"Failed to fetch version information" (>=2) and that exit 1 appears >=3 times.
This PR makes the latest path retry then degrade gracefully instead of aborting,
so update those assertions: the latest path no longer hard-fails (the unsupported
-arch and pinned-404 paths still exit 1, hence >=2).
(This test never ran on this PR until it was retargeted from the merged
feat/windows-powershell-installer branch to main.)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019M7GkS3bYZaFhEbBhVTecG
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: ralphstodomingo <ralphstodomingo@users.noreply.github.com>1 parent 31e73d0 commit dfe0364
4 files changed
Lines changed: 129 additions & 21 deletions
File tree
- packages/opencode/test
- install
- release-validation
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
205 | 205 | | |
206 | 206 | | |
207 | 207 | | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
213 | 228 | | |
214 | 229 | | |
215 | 230 | | |
| |||
255 | 270 | | |
256 | 271 | | |
257 | 272 | | |
258 | | - | |
259 | | - | |
260 | | - | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
261 | 277 | | |
262 | 278 | | |
| 279 | + | |
| 280 | + | |
263 | 281 | | |
264 | 282 | | |
265 | 283 | | |
| |||
410 | 428 | | |
411 | 429 | | |
412 | 430 | | |
413 | | - | |
| 431 | + | |
414 | 432 | | |
415 | 433 | | |
416 | 434 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
161 | 171 | | |
162 | 172 | | |
163 | | - | |
164 | | - | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
165 | 181 | | |
166 | 182 | | |
167 | 183 | | |
| |||
225 | 241 | | |
226 | 242 | | |
227 | 243 | | |
228 | | - | |
| 244 | + | |
229 | 245 | | |
230 | 246 | | |
231 | 247 | | |
| |||
Lines changed: 67 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
Lines changed: 10 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
| 58 | + | |
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
65 | 69 | | |
66 | 70 | | |
67 | 71 | | |
| |||
110 | 114 | | |
111 | 115 | | |
112 | 116 | | |
113 | | - | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
114 | 121 | | |
115 | 122 | | |
116 | 123 | | |
| |||
0 commit comments