@devries-cameron20 / t3code Mirror · read-only / commits / b14ae647a3
Fork 0

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 22, 22:00 UTC

fix(ci): recover from transient download and stale report failures (#22232)

Theo Browne committed Oct 20, 2026 at 01:58 UTC b14ae647a311b3e5be0487fe3f6bae217cd88ff5
3 files changed +68 -4
.github/scripts/thread-transfer-report.cjs
+20 -4
@@ -244,10 +244,26 @@ async function resolve({ github, context, core }) {
244
245 let pullNumber = source.pull_requests?.[0]?.number;
246 if (!pullNumber) {
247 - const associated = await github.paginate(
248 - github.rest.repos.listPullRequestsAssociatedWithCommit,
249 - { owner, repo, commit_sha: source.head_sha, per_page: 100 },
250 - );
247 + let associated;
248 + try {
249 + associated = await github.paginate(github.rest.repos.listPullRequestsAssociatedWithCommit, {
250 + owner,
251 + repo,
252 + commit_sha: source.head_sha,
253 + per_page: 100,
254 + });
255 + } catch (error) {
256 + // A force-pushed or deleted PR head can disappear before this workflow runs.
257 + if (
258 + error.status === 422 &&
259 + error.response?.data?.message === `No commit found for SHA: ${source.head_sha}`
260 + ) {
261 + core.info(`Skipping CI result for unavailable commit ${source.head_sha}.`);
262 + core.setOutput("publish", "false");
263 + return;
264 + }
265 + throw error;
266 + }
267 const matchingPulls = associated.filter(
268 (pull) =>
269 pull.state === "open" &&
.github/scripts/thread-transfer-report.test.cjs
+41
@@ -216,6 +216,47 @@ test("does not guess when a fallback commit belongs to multiple PRs", async () =
216 assert.equal(fetchedPull, false);
217 });
218
219 +test("skips a missing PR commit but preserves other lookup failures", async () => {
220 + for (const [status, message, shouldSkip] of [
221 + [422, "No commit found for SHA: old-head", true],
222 + [422, "Validation Failed", false],
223 + [403, "API rate limit exceeded", false],
224 + ]) {
225 + const outputs = {};
226 + const error = Object.assign(new Error(message), {
227 + status,
228 + response: { data: { message } },
229 + });
230 + const run = resolve({
231 + github: {
232 + paginate: async () => {
233 + throw error;
234 + },
235 + rest: { repos: { listPullRequestsAssociatedWithCommit: () => {} } },
236 + },
237 + context: {
238 + repo: { owner: "pingdotgg", repo: "t3code" },
239 + payload: {
240 + workflow_run: { event: "pull_request", head_sha: "old-head", pull_requests: [] },
241 + },
242 + },
243 + core: {
244 + info: () => {},
245 + setOutput: (key, value) => {
246 + outputs[key] = value;
247 + },
248 + },
249 + });
250 + if (shouldSkip) {
251 + await run;
252 + assert.equal(outputs.publish, "false");
253 + } else {
254 + await assert.rejects(run, (caught) => caught === error);
255 + assert.deepEqual(outputs, {});
256 + }
257 + }
258 +});
259 +
260 test("does not report a passing run that skipped the server tests", async () => {
261 const outputs = {};
262 const listWorkflowRunArtifacts = () => {};
apps/desktop/scripts/ensure-electron-runtime.mjs
+7
@@ -123,6 +123,13 @@ function installElectronRuntime(electronDir, version) {
123 try {
124 runChecked("curl", [
125 "-fsSL",
126 + "--retry",
127 + "3",
128 + "--retry-all-errors",
129 + "--connect-timeout",
130 + "30",
131 + "--max-time",
132 + "300",
133 `https://github.com/electron/electron/releases/download/v${version}/electron-v${version}-${hostPlatform}-${hostArch}.zip`,
134 "-o",
135 zipPath,