The best way to control Claude Code, Codex and more from any computer or phone
fix(install): stable installs no longer fail behind a page of nightlies (#22907)
Co-authored-by: Victor Vogel <satsdev@only21mil.xyz> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Theo Browne committed
Oct 25, 2026 at 14:18 UTC
03d1a909153d593805a80b4c691eda31ac3f3c46
3 files changed
+109
-6
scripts/install.ps1
+13
-2
@@ -133,8 +133,19 @@ if (-not $version) {
133
"preview" { '^v\d+\.\d+\.\d+-preview\.\d+\.\d+$' }
134
default { Fail "T3CODE_CHANNEL must be stable, nightly, or preview" }
135
}
136
- $releases = Invoke-RestMethod -Uri "https://api.github.com/repos/$repo/releases?per_page=100" -Headers @{ "User-Agent" = "t3-install" }
137
- $tag = ($releases | Where-Object { -not $_.draft -and $_.tag_name -match $tagPattern } | Select-Object -First 1).tag_name
136
+ if ($channel -eq "stable") {
137
+ # release.yml marks only plain stable releases latest. This is a github.com
138
+ # page, so it is not cut off by a page of newer nightlies or the API quota.
139
+ $release = Invoke-RestMethod -Uri "https://github.com/$repo/releases/latest" -Headers @{ "User-Agent" = "t3-install"; "Accept" = "application/json" }
140
+ $tag = ($release | Where-Object { $_.tag_name -match $tagPattern }).tag_name
141
+ } else {
142
+ $tag = $null
143
+ for ($page = 1; -not $tag -and $page -le 10; $page++) {
144
+ $releases = Invoke-RestMethod -Uri "https://api.github.com/repos/$repo/releases?per_page=100&page=$page" -Headers @{ "User-Agent" = "t3-install" }
145
+ $tag = ($releases | Where-Object { -not $_.draft -and $_.tag_name -match $tagPattern } | Select-Object -First 1).tag_name
146
+ if (-not $releases) { break }
147
+ }
148
+ }
149
if (-not $tag) { Fail "could not find a $channel release; set T3CODE_VERSION" }
150
$version = $tag.Substring(1)
151
}
scripts/install.sh
+16
-4
@@ -53,14 +53,14 @@ step "Finding your release..."
53
# Exit 44 on a 404 so callers can tell "no such asset" from a network failure.
54
fetch() {
55
if command -v curl >/dev/null 2>&1; then
56
- status="$(curl -sSL -w '%{http_code}' "$1" -o "$2")" || return 1
56
+ status="$(curl -sSL -H "Accept: ${3:-*/*}" -w '%{http_code}' "$1" -o "$2")" || return 1
57
case "$status" in
58
2??) return 0 ;;
59
404) return 44 ;;
60
*) printf 'GET %s returned HTTP %s\n' "$1" "$status" >&2; return 1 ;;
61
esac
62
elif command -v wget >/dev/null 2>&1; then
63
- wget -q --server-response "$1" -O "$2" 2>"$2.headers" && rm -f "$2.headers" && return 0
63
+ wget -q --server-response --header="Accept: ${3:-*/*}" "$1" -O "$2" 2>"$2.headers" && rm -f "$2.headers" && return 0
64
if grep -q ' 404 ' "$2.headers" 2>/dev/null; then rm -f "$2.headers"; return 44; fi
65
cat "$2.headers" >&2; rm -f "$2.headers"; return 1
66
else
@@ -151,8 +151,20 @@ if [ -z "$version" ]; then
151
*) fail "T3CODE_CHANNEL must be stable, nightly, or preview" ;;
152
esac
153
tmp_index="$(mktemp)"
154
- fetch "https://api.github.com/repos/${repo}/releases?per_page=100" "$tmp_index"
155
- version="$(sed -n "s/.*\"tag_name\": *\"${tag_pattern}\".*/\1/p" "$tmp_index" | head -n 1)"
154
+ if [ "$channel" = stable ]; then
155
+ # release.yml marks only plain stable releases latest. This is a github.com
156
+ # page, so it is not cut off by a page of newer nightlies or the API quota.
157
+ fetch "https://github.com/${repo}/releases/latest" "$tmp_index" application/json
158
+ version="$(sed -n "s/.*\"tag_name\": *\"${tag_pattern}\".*/\1/p" "$tmp_index" | head -n 1)"
159
+ else
160
+ page=1
161
+ while [ -z "$version" ] && [ "$page" -le 10 ]; do
162
+ fetch "https://api.github.com/repos/${repo}/releases?per_page=100&page=${page}" "$tmp_index"
163
+ version="$(sed -n "s/.*\"tag_name\": *\"${tag_pattern}\".*/\1/p" "$tmp_index" | head -n 1)"
164
+ grep -q '"tag_name"' "$tmp_index" || break
165
+ page=$((page + 1))
166
+ done
167
+ fi
168
rm -f "$tmp_index"
169
[ -n "$version" ] || fail "could not find a ${channel} release; set T3CODE_VERSION"
170
fi
scripts/install.test.ts
new
+80
@@ -0,0 +1,80 @@
1
+// @effect-diagnostics nodeBuiltinImport:off - Drives the real shell installer against a local GitHub fixture.
2
+import * as HostProcess from "@t3tools/shared/HostProcess";
3
+import * as NodeChildProcess from "node:child_process";
4
+import * as NodeFSP from "node:fs/promises";
5
+import * as NodeHttp from "node:http";
6
+import * as NodeOS from "node:os";
7
+import * as NodePath from "node:path";
8
+import { describe, expect, it } from "vite-plus/test";
9
+
10
+const nightlies = Array.from({ length: 100 }, (_, index) => ({
11
+ tag_name: `v1.2.4-nightly.20261020.${200 - index}`,
12
+}));
13
+
14
+// regression: #22490
15
+describe.skipIf(HostProcess.Platform.defaultValue() !== "linux")("installer channel lookup", () => {
16
+ it.each([
17
+ ["stable", "1.2.3"],
18
+ ["preview", "1.2.4-preview.20261019.50"],
19
+ ])("finds the newest %s release behind a full page of nightlies", async (channel, version) => {
20
+ const root = await NodeFSP.mkdtemp(NodePath.join(NodeOS.tmpdir(), "t3-install-index-"));
21
+ const target = NodePath.join(root, "home/runtime/versions", version);
22
+ const server = NodeHttp.createServer((request, response) => {
23
+ const url = new URL(request.url ?? "/", "http://fixture");
24
+ const body =
25
+ url.pathname === "/pingdotgg/t3code/releases/latest" &&
26
+ request.headers.accept === "application/json"
27
+ ? { tag_name: "v1.2.3" }
28
+ : url.pathname === "/repos/pingdotgg/t3code/releases"
29
+ ? { "1": nightlies, "2": [{ tag_name: `v${version}` }, { tag_name: "v1.2.3" }] }[
30
+ url.searchParams.get("page") ?? ""
31
+ ]
32
+ : undefined;
33
+ if (body === undefined) response.statusCode = 404;
34
+ // The API pretty-prints and the installer reads it line by line.
35
+ response.end(JSON.stringify(body ?? [], null, 2));
36
+ });
37
+ try {
38
+ // An existing completed install isolates release resolution from archive downloads.
39
+ await NodeFSP.mkdir(target, { recursive: true });
40
+ await NodeFSP.writeFile(NodePath.join(target, ".install-complete"), `${version}\n`);
41
+ await new Promise<void>((resolve) => server.listen(0, "127.0.0.1", resolve));
42
+ const address = server.address();
43
+ if (!address || typeof address === "string") throw new Error("Expected a TCP listener");
44
+ const origin = `http://127.0.0.1:${address.port}`;
45
+ const source = await NodeFSP.readFile(
46
+ NodePath.resolve(import.meta.dirname, "install.sh"),
47
+ "utf8",
48
+ );
49
+ const installer = NodePath.join(root, "install.sh");
50
+ await NodeFSP.writeFile(installer, source.replace(/https:\/\/(api\.)?github\.com/g, origin));
51
+ const { code, output } = await new Promise<{ code: number | null; output: string }>(
52
+ (resolve, reject) => {
53
+ const child = NodeChildProcess.spawn("sh", [installer], {
54
+ env: {
55
+ ...process.env,
56
+ T3CODE_VERSION: "",
57
+ T3CODE_CHANNEL: channel,
58
+ T3CODE_HOME: NodePath.join(root, "home"),
59
+ T3CODE_INSTALL_BIN_DIR: NodePath.join(root, "bin"),
60
+ // A wrong version must fail here instead of downloading a real release.
61
+ T3CODE_RELEASE_BASE_URL: origin,
62
+ },
63
+ stdio: ["ignore", "pipe", "pipe"],
64
+ });
65
+ let output = "";
66
+ child.stdout.on("data", (chunk: Buffer) => (output += chunk.toString()));
67
+ child.stderr.on("data", (chunk: Buffer) => (output += chunk.toString()));
68
+ child.on("error", reject);
69
+ child.on("close", (code) => resolve({ code, output }));
70
+ },
71
+ );
72
+ expect(code, output).toBe(0);
73
+ expect(output).toContain(`Installed T3 Code ${version}`);
74
+ } finally {
75
+ server.closeAllConnections();
76
+ await new Promise<void>((resolve) => server.close(() => resolve()));
77
+ await NodeFSP.rm(root, { recursive: true, force: true });
78
+ }
79
+ });
80
+});