Skip to content

Commit d30aa62

Browse files
jeprecatedclaude
andcommitted
fix(ssh): say which release file the remote runtime could not download
When the SSH runner cannot download the t3 release, curl reports only "The requested URL returned error: 404" and wget -q prints nothing, so the connection error never says which release or URL failed. A failed download now names the file, version, and URL it tried. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 9ba6143 commit d30aa62

2 files changed

Lines changed: 45 additions & 2 deletions

File tree

‎packages/ssh/src/tunnel.test.ts‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -925,6 +925,44 @@ describe("archive runner script", () => {
925925
}).pipe(Effect.provide(NodeServices.layer)),
926926
60_000,
927927
);
928+
it.effect.skipIf(windowsHost)("names the release file it could not download", () =>
929+
Effect.gen(function* () {
930+
const fs = yield* FileSystem.FileSystem;
931+
const root = yield* fs.makeTempDirectoryScoped({ prefix: "t3-archive-runner-" });
932+
const releaseBaseUrl = yield* makeMirror(root);
933+
const home = `${root}/home`;
934+
yield* fs.makeDirectory(home, { recursive: true });
935+
const versionsDir = `${home}/.t3/runtime/versions`;
936+
937+
const missingRelease = `${root}/run-missing-release.sh`;
938+
yield* fs.writeFileString(
939+
missingRelease,
940+
SshTunnel.buildRemoteT3RunnerScript({ archiveVersion: "9.9.9", releaseBaseUrl }),
941+
);
942+
const noRelease = yield* runRunner(home, missingRelease);
943+
assert.equal(noRelease.exitCode, 1);
944+
assert.include(
945+
noRelease.stderr,
946+
`Could not download SHA256SUMS for t3 9.9.9 from ${releaseBaseUrl}/v9.9.9.`,
947+
);
948+
949+
const tarball = (yield* fs.readDirectory(`${root}/mirror/v${archiveVersion}`)).find((name) =>
950+
name.endsWith(".tar.gz"),
951+
);
952+
assert.isDefined(tarball);
953+
yield* fs.remove(`${root}/mirror/v${archiveVersion}/${tarball}`);
954+
const missingArchive = `${root}/run-missing-archive.sh`;
955+
yield* fs.writeFileString(
956+
missingArchive,
957+
SshTunnel.buildRemoteT3RunnerScript({ archiveVersion, releaseBaseUrl }),
958+
);
959+
const noArchive = yield* runRunner(home, missingArchive);
960+
assert.equal(noArchive.exitCode, 1);
961+
assert.include(noArchive.stderr, `Could not download ${tarball} for t3 ${archiveVersion}`);
962+
assert.isFalse(yield* fs.exists(`${versionsDir}/.${archiveVersion}.install.lock`));
963+
assert.isFalse(yield* fs.exists(`${versionsDir}/${archiveVersion}`));
964+
}).pipe(Effect.provide(NodeServices.layer)),
965+
);
928966
});
929967

930968
describe("launch script", () => {

‎packages/ssh/src/tunnel.ts‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -518,8 +518,13 @@ if ! t3_runtime_ready; then
518518
else printf 'Remote host needs curl or wget to download %s.\\n' "$T3_ARCHIVE" >&2; exit 1
519519
fi
520520
}
521-
t3_fetch "$T3_RELEASE_BASE_URL/v$T3_ARCHIVE_VERSION/SHA256SUMS" "$T3_STAGING/SHA256SUMS" @@T3_ARCHIVE_CHECKSUMS_SECONDS@@
522-
t3_fetch "$T3_RELEASE_BASE_URL/v$T3_ARCHIVE_VERSION/$T3_ARCHIVE" "$T3_STAGING/$T3_ARCHIVE" @@T3_ARCHIVE_DOWNLOAD_SECONDS@@
521+
# curl's HTTP error omits the URL and wget -q prints nothing, so name what was not fetched.
522+
t3_fetch_failed() {
523+
printf 'Could not download %s for t3 %s from %s/v%s. Check that this release exists and the host can reach it.\\n' "$1" "$T3_ARCHIVE_VERSION" "$T3_RELEASE_BASE_URL" "$T3_ARCHIVE_VERSION" >&2
524+
exit 1
525+
}
526+
t3_fetch "$T3_RELEASE_BASE_URL/v$T3_ARCHIVE_VERSION/SHA256SUMS" "$T3_STAGING/SHA256SUMS" @@T3_ARCHIVE_CHECKSUMS_SECONDS@@ || t3_fetch_failed SHA256SUMS
527+
t3_fetch "$T3_RELEASE_BASE_URL/v$T3_ARCHIVE_VERSION/$T3_ARCHIVE" "$T3_STAGING/$T3_ARCHIVE" @@T3_ARCHIVE_DOWNLOAD_SECONDS@@ || t3_fetch_failed "$T3_ARCHIVE"
523528
T3_EXPECTED="$(grep " \\*\\{0,1\\}$T3_ARCHIVE$" "$T3_STAGING/SHA256SUMS" | cut -d' ' -f1)"
524529
if command -v sha256sum >/dev/null 2>&1; then
525530
T3_ACTUAL="$(sha256sum "$T3_STAGING/$T3_ARCHIVE" | cut -d' ' -f1)"

0 commit comments

Comments
 (0)