From 24b81e3db8ad11aafaf795e2de404d749207dae9 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Sat, 21 Nov 2026 04:39:34 +0000 Subject: [PATCH 1/2] test(github): ci_logs shows why a check that never started has no log Reproduces #40121: a job whose log GitHub does not have reports only the generic not-found text, not its check run's annotations. Co-Authored-By: Claude Opus 5.5 --- .../src/server/GitHubPullRequestApi.test.ts | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/packages/source-control-github/src/server/GitHubPullRequestApi.test.ts b/packages/source-control-github/src/server/GitHubPullRequestApi.test.ts index aff9f9c627a1a..c3cc15097dfd5 100644 --- a/packages/source-control-github/src/server/GitHubPullRequestApi.test.ts +++ b/packages/source-control-github/src/server/GitHubPullRequestApi.test.ts @@ -838,6 +838,27 @@ layer("GitHubPullRequestApi.layer", (it) => { }), ); } + // Job 16 never started, so GitHub holds no log; its check run explains why. + if (log?.[1] === "16") { + return Effect.fail( + new GitHubRequestPolicy.GitHubApiNotFoundError({ + host: "github.com", + operation: "readCheckLog", + }), + ); + } + if (/check-runs\/16\/annotations/.test(call.path)) { + return Effect.succeed( + output( + encodeJson([ + { + annotation_level: "failure", + message: "The job was not started because of a billing problem.", + }, + ]), + ), + ); + } if (log) return Effect.succeed(output("setup\nbuild\nError: boom\n")); const job = /actions\/jobs\/(\d+)$/.exec(call.path); if (job) return Effect.succeed(output(encodeJson({ run_id: runOf[job[1]!] }))); @@ -871,6 +892,8 @@ layer("GitHubPullRequestApi.layer", (it) => { { log: "one long line", truncated: true }, ]); const refused = yield* Effect.flip(api.readCheckLogs({ ...capped, checks: [job(14, 30)] })); + const [unstarted] = yield* api.readCheckLogs({ ...capped, checks: [job(16, 30)] }); + expect(unstarted?.detail).toContain("The job was not started because of a billing problem."); const [huge] = yield* api.readCheckLogs({ ...capped, checks: [job(15, 30)] }); expect(huge?.log?.length).toBe(32_000); expect(huge?.truncated).toBe(true); From b1248e686d910341570769a0e867e7db7e549fab Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Sat, 21 Nov 2026 05:15:39 +0000 Subject: [PATCH 2/2] fix(github): ci_logs explains why a check has no log When GitHub has no log for an Actions job (it never started, was skipped, or its log expired), read the job's check run and annotations and report its conclusion, output and annotation messages instead of the generic not-found or server error, which read like a credential problem. If the check run cannot be read either, the original error is kept. Fixes pingdotgg/t3code#40121 Co-Authored-By: Claude Opus 5.5 --- .../src/server/GitHubPullRequestApi.ts | 66 +++++++++++++++++-- 1 file changed, 62 insertions(+), 4 deletions(-) diff --git a/packages/source-control-github/src/server/GitHubPullRequestApi.ts b/packages/source-control-github/src/server/GitHubPullRequestApi.ts index e3a5483261610..0f6b76dd5040c 100644 --- a/packages/source-control-github/src/server/GitHubPullRequestApi.ts +++ b/packages/source-control-github/src/server/GitHubPullRequestApi.ts @@ -876,6 +876,29 @@ const decodeRunJobs = Schema.decodeEffect( }), ), ); +const decodeCheckRun = Schema.decodeEffect( + Schema.fromJsonString( + Schema.Struct({ + conclusion: Schema.optional(Schema.NullOr(Schema.String)), + output: Schema.optional( + Schema.Struct({ + title: Schema.optional(Schema.NullOr(Schema.String)), + summary: Schema.optional(Schema.NullOr(Schema.String)), + }), + ), + }), + ), +); +const decodeCheckRunAnnotations = Schema.decodeEffect( + Schema.fromJsonString( + Schema.Array( + Schema.Struct({ + annotation_level: Schema.optional(Schema.NullOr(Schema.String)), + message: Schema.String, + }), + ), + ), +); const FAILED_CONCLUSIONS = new Set(["failure", "cancelled", "timed_out", "startup_failure"]); const ONE_JOB_AT_A_TIME = "GitHub re-runs one job of a run at a time. Re-run this one after the other finishes."; @@ -2912,6 +2935,43 @@ export const make = Effect.gen(function* () { readCheckLogs: Effect.fn("GitHubPullRequestApi.readCheckLogs")(function* (input) { const { owner, name } = parseRepositorySelector(input.repository); + const readCheckRun = (path: string, decode: (body: string) => Effect.Effect) => + api + .rest({ host: input.host, operation: "readCheckRun", path }) + .pipe(Effect.flatMap((response) => decode(response.body))); + // A job that never started (billing block, skipped) or whose log expired has no log; + // its check run (an Actions job id is its check run id) says why. + const missingLog = (check: ProviderCheckReference, jobId: string, fallback: string) => + Effect.all( + [ + readCheckRun(`repos/${owner}/${name}/check-runs/${jobId}`, decodeCheckRun), + readCheckRun( + `repos/${owner}/${name}/check-runs/${jobId}/annotations?per_page=50`, + decodeCheckRunAnnotations, + ), + ], + { concurrency: 2 }, + ).pipe( + Effect.map(([run, annotations]) => + [ + `GitHub returned no log for this job${run.conclusion ? `; it concluded ${run.conclusion}` : ""}.`, + run.output?.title, + run.output?.summary, + ...annotations.map( + (annotation) => + `${annotation.annotation_level ? `${annotation.annotation_level}: ` : ""}${annotation.message}`, + ), + ] + .filter((line) => typeof line === "string" && line.trim() !== "") + .join("\n"), + ), + Effect.catchTags({ + GitHubApiNotFoundError: () => Effect.succeed(fallback), + GitHubApiResponseError: () => Effect.succeed(fallback), + SchemaError: () => Effect.succeed(fallback), + }), + Effect.map((detail) => ({ ...check, log: null, truncated: false, detail })), + ); return yield* Effect.forEach( input.checks, (check) => { @@ -2947,10 +3007,8 @@ export const make = Effect.gen(function* () { }), // Sign-in and rate-limit failures fail the call; the rest are this check's. Effect.catchTags({ - GitHubApiNotFoundError: (error) => - Effect.succeed({ ...check, log: null, truncated: false, detail: error.message }), - GitHubApiResponseError: (error) => - Effect.succeed({ ...check, log: null, truncated: false, detail: error.message }), + GitHubApiNotFoundError: (error) => missingLog(check, jobId, error.message), + GitHubApiResponseError: (error) => missingLog(check, jobId, error.message), }), ); },