The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 06:00 UTC
fix(ssh): report missing tar or gzip before downloading remote runtime (#35307)
Signed-off-by: bettercallcaleb <121191527+bettercallcaleb@users.noreply.github.com> Co-authored-by: maria-rcks <maria@kuuro.net> Co-authored-by: Julius Marminge <julius0216@outlook.com>
Your Open Source Tooling Specialist committed
Nov 19, 2026 at 14:49 UTC
031dd1a818c348353ff96dc42b81b6697701ecc7
2 files changed
+43
packages/ssh/src/tunnel.test.ts
+39
@@ -448,6 +448,45 @@ describe("ssh tunnel scripts", () => {
448
}
449
});
450
451
+ it("names missing tar before downloading the release archive", () => {
452
+ const root = NodeFS.mkdtempSync(NodePath.join(NodeOS.tmpdir(), "t3-ssh-runner-"));
453
+ try {
454
+ const bin = NodePath.join(root, "bin");
455
+ const home = NodePath.join(root, "home");
456
+ NodeFS.mkdirSync(bin);
457
+ NodeFS.mkdirSync(home);
458
+ for (const tool of ["sh", "mkdir", "mktemp", "cat", "rm"]) {
459
+ NodeFS.symlinkSync(
460
+ NodeChildProcess.execFileSync("sh", ["-c", `command -v ${tool}`], {
461
+ encoding: "utf8",
462
+ }).trim(),
463
+ NodePath.join(bin, tool),
464
+ );
465
+ }
466
+ NodeFS.writeFileSync(
467
+ NodePath.join(bin, "uname"),
468
+ '#!/bin/sh\ncase "$1" in -s) echo Linux ;; -m) echo x86_64 ;; esac\n',
469
+ { mode: 0o755 },
470
+ );
471
+ NodeFS.writeFileSync(
472
+ NodePath.join(bin, "curl"),
473
+ '#!/bin/sh\necho "download attempt" >&2\nexit 1\n',
474
+ { mode: 0o755 },
475
+ );
476
+ const runner = NodePath.join(root, "run-t3.sh");
477
+ NodeFS.writeFileSync(runner, SshTunnel.buildRemoteT3RunnerScript(ARCHIVE));
478
+ const result = NodeChildProcess.spawnSync(NodePath.join(bin, "sh"), [runner, "--version"], {
479
+ encoding: "utf8",
480
+ env: { HOME: home, PATH: bin },
481
+ });
482
+ assert.notEqual(result.status, 0);
483
+ assert.include(result.stderr, "needs tar");
484
+ assert.notInclude(result.stderr, "download attempt");
485
+ } finally {
486
+ NodeFS.rmSync(root, { recursive: true, force: true });
487
+ }
488
+ });
489
+
490
it.effect("accepts launch JSON after remote shell startup noise", () => {
491
const target = {
492
alias: "devbox",
packages/ssh/src/tunnel.ts
+4
@@ -533,6 +533,10 @@ if ! t3_runtime_ready; then
533
*) printf 'Remote host %s has no t3 release archive.\\n' "$(uname -s) $(uname -m)" >&2; exit 1 ;;
534
esac
535
T3_ARCHIVE="t3-$T3_ARCHIVE_VERSION-$T3_PLATFORM_KEY.tar.gz"
536
+ if ! command -v tar >/dev/null 2>&1; then
537
+ printf 'Remote host needs tar to unpack %s. Install tar on it and try again.\\n' "$T3_ARCHIVE" >&2
538
+ exit 1
539
+ fi
540
T3_STAGING="$(mktemp -d "$HOME/.t3/runtime/versions/.staging-XXXXXX")"
541
trap 'rm -rf "$T3_STAGING" "$T3_LOCK"' EXIT
542
t3_fetch() {