From d129b982a7dfeea89c6b28b4beac26edfff03a56 Mon Sep 17 00:00:00 2001 From: ScriptedAlchemy Date: Mon, 16 Nov 2026 00:56:17 -0800 Subject: [PATCH 01/13] test(client-runtime): an MCP result reads the same with the SDK's _meta Co-Authored-By: Claude Opus 5.5 --- .../client-runtime/src/work-log/itemDetail.test.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/client-runtime/src/work-log/itemDetail.test.ts b/packages/client-runtime/src/work-log/itemDetail.test.ts index c7a6f043a3bb9..2b93d570e7bb2 100644 --- a/packages/client-runtime/src/work-log/itemDetail.test.ts +++ b/packages/client-runtime/src/work-log/itemDetail.test.ts @@ -79,6 +79,17 @@ describe("tool image output parsing", () => { ).toBe("File contents"); }, ); + it("reads an MCP result the same with or without the SDK's _meta", () => { + const structuredContent = { + check: "Server tests 7", + message: "expected [ 60 ]\nto equal [ 59 ]", + }; + const result = { content: JSON.stringify(structuredContent), structuredContent }; + const meta = { "io.modelcontextprotocol/serverInfo": { name: "T3 Code", version: "1" } }; + const plain = turnItemOutputText(toolItem(result)); + expect(plain).toContain('"check": "Server tests 7"'); + expect(turnItemOutputText(toolItem({ ...result, _meta: meta }))).toBe(plain); + }); it.each(["array", "content", "structured"] as const)( "keeps markers for images beyond the served positions in %s output", (shape) => { From 2c21c531f6278495920102c1100fa724de2e1343 Mon Sep 17 00:00:00 2001 From: ScriptedAlchemy Date: Mon, 16 Nov 2026 00:57:12 -0800 Subject: [PATCH 02/13] fix(client-runtime): tool results with _meta show as formatted output MCP SDKs add _meta server info to every result. The work log then failed to unwrap content and showed the raw result, with the payload JSON-encoded inside it. Co-Authored-By: Claude Opus 5.5 --- packages/client-runtime/src/work-log/itemDetail.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/client-runtime/src/work-log/itemDetail.ts b/packages/client-runtime/src/work-log/itemDetail.ts index 2630f89dc2ef9..67aef9b0e9d3a 100644 --- a/packages/client-runtime/src/work-log/itemDetail.ts +++ b/packages/client-runtime/src/work-log/itemDetail.ts @@ -40,7 +40,10 @@ function textFromBlocks( if (typeof resource.text === "string") return resource.text; if (typeof resource.uri === "string") return resource.uri; } - const keys = Object.keys(value).filter((key) => key !== "isError" && key !== "is_error"); + // MCP SDKs stamp `_meta` with server info on every result; it is never the tool's output. + const keys = Object.keys(value).filter( + (key) => key !== "isError" && key !== "is_error" && key !== "_meta", + ); if (keys.length === 1 && keys[0] === "content") return textFromBlocks(value.content, depth + 1, imageBlocks); if (keys.length === 2 && keys.includes("content") && keys.includes("structuredContent")) { From e027aa5b002c99578fe6a6dfa7b7548644ee8a68 Mon Sep 17 00:00:00 2001 From: ScriptedAlchemy Date: Mon, 16 Nov 2026 01:05:47 -0800 Subject: [PATCH 03/13] test(source-control): cover CI failure noise filtering --- .../src/server/pullRequestChecks.test.ts | 68 +++++++++++++++++-- .../src/server/GitHubRest.test.ts | 6 ++ 2 files changed, 67 insertions(+), 7 deletions(-) diff --git a/packages/source-control-core/src/server/pullRequestChecks.test.ts b/packages/source-control-core/src/server/pullRequestChecks.test.ts index 583f3fa7a012d..ecbc33dbb4a81 100644 --- a/packages/source-control-core/src/server/pullRequestChecks.test.ts +++ b/packages/source-control-core/src/server/pullRequestChecks.test.ts @@ -227,13 +227,67 @@ describe("check log excerpts", () => { lines: 1, }, { chunks: ["one\ntw", "o\nthree"], text: "one\ntwo\nthree", lines: 3 }, - ])("strips formatting and counts lines across chunks %#", ({ chunks, text, lines }) => { - expect(excerptCheckLog(chunks)).toEqual({ - _tag: "excerpt", - text, - totalLines: lines, - truncated: false, - }); + { + chunks: [ + [ + " ❯ ~effect/Effect/successCont ../../node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/esm/Effect.js:1:1", + " ❯ FiberImpl.runLoop ../../node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/esm/internal/fiberRuntime.js:1:1", + "##[start-action 123", + "##[end-action 123", + "Post job cleanup.", + "Cleaning up orphan processes", + " ❯ runAssertion src/example.test.ts:10:5", + ].join("\n"), + ], + text: " ❯ runAssertion src/example.test.ts:10:5", + lines: 7, + truncated: true, + }, + ])( + "strips formatting and counts lines across chunks %#", + ({ chunks, text, lines, truncated = false }) => { + expect(excerptCheckLog(chunks)).toEqual({ + _tag: "excerpt", + text, + totalLines: lines, + truncated, + }); + }, + ); + + it("does not let noise consume error context or tail slots", () => { + const noise = [ + " ❯ FiberImpl.runLoop ../../node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/esm/internal/fiberRuntime.js:1:1", + "##[start-action 123", + "##[end-action 123", + "Post job cleanup.", + "Cleaning up orphan processes", + ]; + const expected = [ + "##[group]Run vp test", + "before 1", + "before 2", + "before 3", + "##[error]Assertion failed", + "after 1", + "after 2", + "after 3", + ...Array.from({ length: 20 }, (_, i) => `tail ${i}`), + ]; + const result = excerptCheckLog([ + [ + ...expected.slice(0, 4), + ...noise, + ...expected.slice(4, 5), + ...noise, + ...expected.slice(5), + ...noise, + ].join("\n"), + ]); + + expect(result.text).toBe(expected.join("\n")); + expect(result.totalLines).toBe(expected.length + noise.length * 3); + expect(result.truncated).toBe(true); }); it("keeps error context, its Run header and the tail within both budgets", () => { diff --git a/packages/source-control-github/src/server/GitHubRest.test.ts b/packages/source-control-github/src/server/GitHubRest.test.ts index 48d49199eb85f..95f3cf3811552 100644 --- a/packages/source-control-github/src/server/GitHubRest.test.ts +++ b/packages/source-control-github/src/server/GitHubRest.test.ts @@ -727,6 +727,12 @@ describe("GitHub check failures", () => { const { layer, calls, fetch } = fetchHarness((url) => { if (url.includes("/annotations")) return json([ + { + path: ".github", + start_line: 0, + annotation_level: "failure", + message: "Process completed with exit code 1.", + }, { path: "a.ts", start_line: 4, annotation_level: "failure", message: "bad code" }, { path: "budget.json", start_line: 0, annotation_level: "failure", message: "grew" }, ]); From cd9029d2a6a909fe157f1b3b65858b4dd4eed16a Mon Sep 17 00:00:00 2001 From: ScriptedAlchemy Date: Mon, 16 Nov 2026 01:08:08 -0800 Subject: [PATCH 04/13] fix(source-control): remove noise from CI failure excerpts --- .../src/server/pullRequestChecks.ts | 5 +++++ .../src/server/gitHubCheckFailures.ts | 19 +++++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/packages/source-control-core/src/server/pullRequestChecks.ts b/packages/source-control-core/src/server/pullRequestChecks.ts index b0fb3e45ed65a..a46d2a58115a9 100644 --- a/packages/source-control-core/src/server/pullRequestChecks.ts +++ b/packages/source-control-core/src/server/pullRequestChecks.ts @@ -117,6 +117,10 @@ export const CHECK_LOG_EXCERPT_BUDGET = { } as const; type Line = { index: number; text: string }; +const isLogNoise = (text: string) => + (text.trimStart().startsWith("❯") && text.includes("node_modules")) || + /^(?:##\[(?:start|end)-action |Post job cleanup\.|Cleaning up orphan processes)/.test(text); + export class CheckLogExcerpt { private pending = ""; private totalLines = 0; @@ -150,6 +154,7 @@ export class CheckLogExcerpt { .replace(/^\d{4}-\d\d-\d\dT[\d:.]+Z\s?/, "") .replace(/\r$/, ""), }; + if (isLogNoise(line.text)) return; // Step names do not appear in the log; a section failed when it carries ##[error]. if (line.text.startsWith("##[group]Run ")) { if (this.failedSection) this.failedTail = this.tail; diff --git a/packages/source-control-github/src/server/gitHubCheckFailures.ts b/packages/source-control-github/src/server/gitHubCheckFailures.ts index e673988115bae..288e9c2a0e3a2 100644 --- a/packages/source-control-github/src/server/gitHubCheckFailures.ts +++ b/packages/source-control-github/src/server/gitHubCheckFailures.ts @@ -165,12 +165,19 @@ export const makeGitHubCheckFailureReader = Effect.gen(function* () { status: JOB_CONCLUSIONS[job.conclusion ?? ""] ?? "neutral", attempt: job.run_attempt, failedSteps: failedSteps.slice(0, 20).map((name) => name.slice(0, 300)), - annotations: annotations.slice(0, 20).map((annotation) => ({ - path: annotation.path.slice(0, 1024), - startLine: annotation.start_line, - level: annotation.annotation_level, - message: annotation.message.slice(0, 300), - })), + annotations: annotations + .filter( + (annotation) => + annotation.path !== ".github" || + annotation.message !== "Process completed with exit code 1.", + ) + .slice(0, 20) + .map((annotation) => ({ + path: annotation.path.slice(0, 1024), + startLine: annotation.start_line, + level: annotation.annotation_level, + message: annotation.message.slice(0, 300), + })), log, } satisfies PullRequestCheckFailure; }); From 44bb827f2a7175c148d893987e4263687fe26463 Mon Sep 17 00:00:00 2001 From: ScriptedAlchemy Date: Mon, 16 Nov 2026 01:14:28 -0800 Subject: [PATCH 05/13] fix(source-control): drop the runner's exit annotation for any exit code GitHub writes the same generic annotation for every failing exit code, not only 1. Co-Authored-By: Claude Opus 5.5 --- .../source-control-github/src/server/GitHubRest.test.ts | 6 ++++++ .../source-control-github/src/server/gitHubCheckFailures.ts | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/source-control-github/src/server/GitHubRest.test.ts b/packages/source-control-github/src/server/GitHubRest.test.ts index 95f3cf3811552..3b43b4ac3a083 100644 --- a/packages/source-control-github/src/server/GitHubRest.test.ts +++ b/packages/source-control-github/src/server/GitHubRest.test.ts @@ -733,6 +733,12 @@ describe("GitHub check failures", () => { annotation_level: "failure", message: "Process completed with exit code 1.", }, + { + path: ".github", + start_line: 0, + annotation_level: "failure", + message: "Process completed with exit code 137.", + }, { path: "a.ts", start_line: 4, annotation_level: "failure", message: "bad code" }, { path: "budget.json", start_line: 0, annotation_level: "failure", message: "grew" }, ]); diff --git a/packages/source-control-github/src/server/gitHubCheckFailures.ts b/packages/source-control-github/src/server/gitHubCheckFailures.ts index 288e9c2a0e3a2..6c2b51c79982a 100644 --- a/packages/source-control-github/src/server/gitHubCheckFailures.ts +++ b/packages/source-control-github/src/server/gitHubCheckFailures.ts @@ -169,7 +169,7 @@ export const makeGitHubCheckFailureReader = Effect.gen(function* () { .filter( (annotation) => annotation.path !== ".github" || - annotation.message !== "Process completed with exit code 1.", + !/^Process completed with exit code \d+\.$/.test(annotation.message), ) .slice(0, 20) .map((annotation) => ({ From 0856a63064fba82925d0d8997f74aaa078916e9d Mon Sep 17 00:00:00 2001 From: ScriptedAlchemy Date: Mon, 16 Nov 2026 03:02:42 -0800 Subject: [PATCH 06/13] test(source-control): keep kill exit codes and drop Node dependency frames Co-Authored-By: Claude Opus 5.5 --- .../src/server/pullRequestChecks.test.ts | 12 ++++++++++++ .../src/server/GitHubRest.test.ts | 1 + 2 files changed, 13 insertions(+) diff --git a/packages/source-control-core/src/server/pullRequestChecks.test.ts b/packages/source-control-core/src/server/pullRequestChecks.test.ts index ecbc33dbb4a81..2f3df307d4050 100644 --- a/packages/source-control-core/src/server/pullRequestChecks.test.ts +++ b/packages/source-control-core/src/server/pullRequestChecks.test.ts @@ -243,6 +243,18 @@ describe("check log excerpts", () => { lines: 7, truncated: true, }, + { + chunks: [ + [ + "##[error]TypeError: boom", + " at Object. (/home/runner/work/app/node_modules/foo/index.js:1:1)", + " at Object. (/home/runner/work/app/src/build.js:2:2)", + ].join("\n"), + ], + text: "##[error]TypeError: boom\n at Object. (/home/runner/work/app/src/build.js:2:2)", + lines: 3, + truncated: true, + }, ])( "strips formatting and counts lines across chunks %#", ({ chunks, text, lines, truncated = false }) => { diff --git a/packages/source-control-github/src/server/GitHubRest.test.ts b/packages/source-control-github/src/server/GitHubRest.test.ts index 3b43b4ac3a083..a9052491cb75e 100644 --- a/packages/source-control-github/src/server/GitHubRest.test.ts +++ b/packages/source-control-github/src/server/GitHubRest.test.ts @@ -758,6 +758,7 @@ describe("GitHub check failures", () => { attempt: 1, failedSteps: ["Run lint"], annotations: [ + { path: ".github", startLine: 0, message: "Process completed with exit code 137." }, { path: "a.ts", startLine: 4, message: "bad code" }, { path: "budget.json", startLine: 0, message: "grew" }, ], From e5b434213245a417bd77e70668a24fbe11bcb299 Mon Sep 17 00:00:00 2001 From: ScriptedAlchemy Date: Mon, 16 Nov 2026 03:04:25 -0800 Subject: [PATCH 07/13] fix(source-control): keep kill exit codes and drop Node dependency frames Exit 137 or 143 may be the only sign of an OOM kill or timeout when the log is unreadable, so only the generic exit 1 annotation is dropped. Node's 'at' frames inside node_modules are dropped like vitest's. Co-Authored-By: Claude Opus 5.5 --- packages/source-control-core/src/server/pullRequestChecks.ts | 2 +- .../source-control-github/src/server/gitHubCheckFailures.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/source-control-core/src/server/pullRequestChecks.ts b/packages/source-control-core/src/server/pullRequestChecks.ts index a46d2a58115a9..7f4401eac1260 100644 --- a/packages/source-control-core/src/server/pullRequestChecks.ts +++ b/packages/source-control-core/src/server/pullRequestChecks.ts @@ -118,7 +118,7 @@ export const CHECK_LOG_EXCERPT_BUDGET = { type Line = { index: number; text: string }; const isLogNoise = (text: string) => - (text.trimStart().startsWith("❯") && text.includes("node_modules")) || + (/^\s*(?:❯|at)\s/.test(text) && /node_modules[\\/]/.test(text)) || /^(?:##\[(?:start|end)-action |Post job cleanup\.|Cleaning up orphan processes)/.test(text); export class CheckLogExcerpt { diff --git a/packages/source-control-github/src/server/gitHubCheckFailures.ts b/packages/source-control-github/src/server/gitHubCheckFailures.ts index 6c2b51c79982a..b0102b50264bd 100644 --- a/packages/source-control-github/src/server/gitHubCheckFailures.ts +++ b/packages/source-control-github/src/server/gitHubCheckFailures.ts @@ -169,7 +169,8 @@ export const makeGitHubCheckFailureReader = Effect.gen(function* () { .filter( (annotation) => annotation.path !== ".github" || - !/^Process completed with exit code \d+\.$/.test(annotation.message), + // Exit 1 repeats the log's own error line; 137 or 143 may be the only sign of a kill. + annotation.message !== "Process completed with exit code 1.", ) .slice(0, 20) .map((annotation) => ({ From c8a1be9f908503cc61591cc82b51606a43a1bb76 Mon Sep 17 00:00:00 2001 From: ScriptedAlchemy Date: Mon, 16 Nov 2026 03:05:03 -0800 Subject: [PATCH 08/13] test(client-runtime): _meta never shows, for block and structured results Co-Authored-By: Claude Opus 5.5 --- .../src/work-log/itemDetail.test.ts | 31 ++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/packages/client-runtime/src/work-log/itemDetail.test.ts b/packages/client-runtime/src/work-log/itemDetail.test.ts index 2b93d570e7bb2..219e264ced595 100644 --- a/packages/client-runtime/src/work-log/itemDetail.test.ts +++ b/packages/client-runtime/src/work-log/itemDetail.test.ts @@ -79,17 +79,6 @@ describe("tool image output parsing", () => { ).toBe("File contents"); }, ); - it("reads an MCP result the same with or without the SDK's _meta", () => { - const structuredContent = { - check: "Server tests 7", - message: "expected [ 60 ]\nto equal [ 59 ]", - }; - const result = { content: JSON.stringify(structuredContent), structuredContent }; - const meta = { "io.modelcontextprotocol/serverInfo": { name: "T3 Code", version: "1" } }; - const plain = turnItemOutputText(toolItem(result)); - expect(plain).toContain('"check": "Server tests 7"'); - expect(turnItemOutputText(toolItem({ ...result, _meta: meta }))).toBe(plain); - }); it.each(["array", "content", "structured"] as const)( "keeps markers for images beyond the served positions in %s output", (shape) => { @@ -193,3 +182,23 @@ describe("MCP app tool output", () => { expect(turnItemOutputText(bounded)).toBe("chart\n[image]"); }); }); + +describe("MCP results with the SDK's _meta", () => { + const meta = { "io.modelcontextprotocol/serverInfo": { name: "T3 Code", version: "1" } }; + const structuredContent = { + check: "Server tests 7", + message: "expected [ 60 ]\nto equal [ 59 ]", + }; + it.each([ + [ + "text and structured content", + { content: JSON.stringify(structuredContent), structuredContent }, + ], + ["text blocks only", { content: [{ type: "text", text: "Server tests: 7 passed" }] }], + ])("reads %s the same with or without _meta", (_shape, result) => { + const plain = turnItemOutputText(toolItem(result)); + const withMeta = turnItemOutputText(toolItem({ ...result, _meta: meta })); + expect(withMeta).toBe(plain); + expect(withMeta).not.toContain("serverInfo"); + }); +}); From 166f7452bd0d1e14837dc5b838028edb94ddede0 Mon Sep 17 00:00:00 2001 From: ScriptedAlchemy Date: Mon, 16 Nov 2026 07:03:33 -0800 Subject: [PATCH 09/13] test(source-control): keep a failed composite step, and report truncation by real lines Co-Authored-By: Claude Opus 5.5 --- .../src/work-log/itemDetail.test.ts | 4 ++++ .../src/server/pullRequestChecks.test.ts | 18 +++++++++++++++--- .../src/server/GitHubRest.test.ts | 6 ++++++ 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/packages/client-runtime/src/work-log/itemDetail.test.ts b/packages/client-runtime/src/work-log/itemDetail.test.ts index 219e264ced595..3b19c7f644c45 100644 --- a/packages/client-runtime/src/work-log/itemDetail.test.ts +++ b/packages/client-runtime/src/work-log/itemDetail.test.ts @@ -195,6 +195,10 @@ describe("MCP results with the SDK's _meta", () => { { content: JSON.stringify(structuredContent), structuredContent }, ], ["text blocks only", { content: [{ type: "text", text: "Server tests: 7 passed" }] }], + [ + "text blocks and structured content", + { content: [{ type: "text", text: JSON.stringify(structuredContent) }], structuredContent }, + ], ])("reads %s the same with or without _meta", (_shape, result) => { const plain = turnItemOutputText(toolItem(result)); const withMeta = turnItemOutputText(toolItem({ ...result, _meta: meta })); diff --git a/packages/source-control-core/src/server/pullRequestChecks.test.ts b/packages/source-control-core/src/server/pullRequestChecks.test.ts index 2f3df307d4050..69bea62906ed1 100644 --- a/packages/source-control-core/src/server/pullRequestChecks.test.ts +++ b/packages/source-control-core/src/server/pullRequestChecks.test.ts @@ -241,7 +241,6 @@ describe("check log excerpts", () => { ], text: " ❯ runAssertion src/example.test.ts:10:5", lines: 7, - truncated: true, }, { chunks: [ @@ -253,7 +252,19 @@ describe("check log excerpts", () => { ], text: "##[error]TypeError: boom\n at Object. (/home/runner/work/app/src/build.js:2:2)", lines: 3, - truncated: true, + }, + { + chunks: [ + [ + "##[start-action display=Install dependencies;id=install]", + "##[end-action id=install;outcome=success;conclusion=success;duration_ms=900]", + "##[start-action display=Build;id=build]", + "##[error]The action has timed out.", + "##[end-action id=build;outcome=failure;conclusion=failure;duration_ms=1250]", + ].join("\n"), + ], + text: "##[error]The action has timed out.\n##[end-action id=build;outcome=failure;conclusion=failure;duration_ms=1250]", + lines: 5, }, ])( "strips formatting and counts lines across chunks %#", @@ -299,7 +310,8 @@ describe("check log excerpts", () => { expect(result.text).toBe(expected.join("\n")); expect(result.totalLines).toBe(expected.length + noise.length * 3); - expect(result.truncated).toBe(true); + // Every real line is present, so dropped noise alone does not mark the excerpt truncated. + expect(result.truncated).toBe(false); }); it("keeps error context, its Run header and the tail within both budgets", () => { diff --git a/packages/source-control-github/src/server/GitHubRest.test.ts b/packages/source-control-github/src/server/GitHubRest.test.ts index a9052491cb75e..e99e9e69021a3 100644 --- a/packages/source-control-github/src/server/GitHubRest.test.ts +++ b/packages/source-control-github/src/server/GitHubRest.test.ts @@ -739,6 +739,12 @@ describe("GitHub check failures", () => { annotation_level: "failure", message: "Process completed with exit code 137.", }, + { + path: ".github/workflows/ci.yml", + start_line: 0, + annotation_level: "failure", + message: "Process completed with exit code 1.", + }, { path: "a.ts", start_line: 4, annotation_level: "failure", message: "bad code" }, { path: "budget.json", start_line: 0, annotation_level: "failure", message: "grew" }, ]); From da4d90e9483b402adf7417e3997e330f9f80c16f Mon Sep 17 00:00:00 2001 From: ScriptedAlchemy Date: Mon, 16 Nov 2026 07:05:20 -0800 Subject: [PATCH 10/13] fix(source-control): keep failed composite steps and report truncation by real lines A failed end-action marker is the only record of which nested composite step failed, so only successful or skipped ones are dropped. Dropped noise no longer marks a complete excerpt truncated, and the exit-1 annotation is dropped whatever its path. Fixtures use the runner's real marker format. Co-Authored-By: Claude Opus 5.5 --- .../src/server/pullRequestChecks.test.ts | 8 ++++---- .../src/server/pullRequestChecks.ts | 13 ++++++++++--- .../src/server/gitHubCheckFailures.ts | 6 ++---- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/packages/source-control-core/src/server/pullRequestChecks.test.ts b/packages/source-control-core/src/server/pullRequestChecks.test.ts index 69bea62906ed1..0c77e20e1a92f 100644 --- a/packages/source-control-core/src/server/pullRequestChecks.test.ts +++ b/packages/source-control-core/src/server/pullRequestChecks.test.ts @@ -232,8 +232,8 @@ describe("check log excerpts", () => { [ " ❯ ~effect/Effect/successCont ../../node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/esm/Effect.js:1:1", " ❯ FiberImpl.runLoop ../../node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/esm/internal/fiberRuntime.js:1:1", - "##[start-action 123", - "##[end-action 123", + "##[start-action display=Install dependencies;id=install]", + "##[end-action id=install;outcome=success;conclusion=success;duration_ms=900]", "Post job cleanup.", "Cleaning up orphan processes", " ❯ runAssertion src/example.test.ts:10:5", @@ -281,8 +281,8 @@ describe("check log excerpts", () => { it("does not let noise consume error context or tail slots", () => { const noise = [ " ❯ FiberImpl.runLoop ../../node_modules/.pnpm/effect@4.1.3/node_modules/effect/dist/esm/internal/fiberRuntime.js:1:1", - "##[start-action 123", - "##[end-action 123", + "##[start-action display=Install dependencies;id=install]", + "##[end-action id=install;outcome=success;conclusion=success;duration_ms=900]", "Post job cleanup.", "Cleaning up orphan processes", ]; diff --git a/packages/source-control-core/src/server/pullRequestChecks.ts b/packages/source-control-core/src/server/pullRequestChecks.ts index 7f4401eac1260..32cce0f2823e6 100644 --- a/packages/source-control-core/src/server/pullRequestChecks.ts +++ b/packages/source-control-core/src/server/pullRequestChecks.ts @@ -117,13 +117,17 @@ export const CHECK_LOG_EXCERPT_BUDGET = { } as const; type Line = { index: number; text: string }; +// A failed composite step's end marker is the only record of which nested step failed. const isLogNoise = (text: string) => (/^\s*(?:❯|at)\s/.test(text) && /node_modules[\\/]/.test(text)) || - /^(?:##\[(?:start|end)-action |Post job cleanup\.|Cleaning up orphan processes)/.test(text); + /^##\[start-action /.test(text) || + /^##\[end-action .*outcome=(?:success|skipped)\b/.test(text) || + /^(?:Post job cleanup\.|Cleaning up orphan processes)/.test(text); export class CheckLogExcerpt { private pending = ""; private totalLines = 0; + private noiseLines = 0; private clipped = false; private afterError = 0; private header: Line | undefined; @@ -154,7 +158,10 @@ export class CheckLogExcerpt { .replace(/^\d{4}-\d\d-\d\dT[\d:.]+Z\s?/, "") .replace(/\r$/, ""), }; - if (isLogNoise(line.text)) return; + if (isLogNoise(line.text)) { + this.noiseLines++; + return; + } // Step names do not appear in the log; a section failed when it carries ##[error]. if (line.text.startsWith("##[group]Run ")) { if (this.failedSection) this.failedTail = this.tail; @@ -213,7 +220,7 @@ export class CheckLogExcerpt { _tag: "excerpt", text: lines.join("\n"), totalLines: this.totalLines, - truncated: this.clipped || lines.length < this.totalLines, + truncated: this.clipped || lines.length < this.totalLines - this.noiseLines, }; } } diff --git a/packages/source-control-github/src/server/gitHubCheckFailures.ts b/packages/source-control-github/src/server/gitHubCheckFailures.ts index b0102b50264bd..0a5be8fd9e4ef 100644 --- a/packages/source-control-github/src/server/gitHubCheckFailures.ts +++ b/packages/source-control-github/src/server/gitHubCheckFailures.ts @@ -167,10 +167,8 @@ export const makeGitHubCheckFailureReader = Effect.gen(function* () { failedSteps: failedSteps.slice(0, 20).map((name) => name.slice(0, 300)), annotations: annotations .filter( - (annotation) => - annotation.path !== ".github" || - // Exit 1 repeats the log's own error line; 137 or 143 may be the only sign of a kill. - annotation.message !== "Process completed with exit code 1.", + // Exit 1 repeats the log's own error line; 137 or 143 may be the only sign of a kill. + (annotation) => annotation.message !== "Process completed with exit code 1.", ) .slice(0, 20) .map((annotation) => ({ From a254fdba09e193f5bed847bf6b6d4bcb568b2a03 Mon Sep 17 00:00:00 2001 From: ScriptedAlchemy Date: Mon, 16 Nov 2026 07:08:45 -0800 Subject: [PATCH 11/13] test(source-control): every excerpt row now expects a complete excerpt Co-Authored-By: Claude Opus 5.5 --- .../src/server/pullRequestChecks.test.ts | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/packages/source-control-core/src/server/pullRequestChecks.test.ts b/packages/source-control-core/src/server/pullRequestChecks.test.ts index 0c77e20e1a92f..4d320389cc5b5 100644 --- a/packages/source-control-core/src/server/pullRequestChecks.test.ts +++ b/packages/source-control-core/src/server/pullRequestChecks.test.ts @@ -266,17 +266,14 @@ describe("check log excerpts", () => { text: "##[error]The action has timed out.\n##[end-action id=build;outcome=failure;conclusion=failure;duration_ms=1250]", lines: 5, }, - ])( - "strips formatting and counts lines across chunks %#", - ({ chunks, text, lines, truncated = false }) => { - expect(excerptCheckLog(chunks)).toEqual({ - _tag: "excerpt", - text, - totalLines: lines, - truncated, - }); - }, - ); + ])("strips formatting and counts lines across chunks %#", ({ chunks, text, lines }) => { + expect(excerptCheckLog(chunks)).toEqual({ + _tag: "excerpt", + text, + totalLines: lines, + truncated: false, + }); + }); it("does not let noise consume error context or tail slots", () => { const noise = [ From 66290f87bc0b33ad6aa077d4203416f02e282a4d Mon Sep 17 00:00:00 2001 From: Zack Jackson <25274700+ScriptedAlchemy@users.noreply.github.com> Date: Mon, 16 Nov 2026 11:24:17 -0800 Subject: [PATCH 12/13] fix(source-control): retain exit failures missing from log excerpts --- .../src/server/GitHubRest.test.ts | 39 ++++++++++++++++--- .../src/server/gitHubCheckFailures.ts | 7 +++- 2 files changed, 39 insertions(+), 7 deletions(-) diff --git a/packages/source-control-github/src/server/GitHubRest.test.ts b/packages/source-control-github/src/server/GitHubRest.test.ts index e99e9e69021a3..b664991adc72b 100644 --- a/packages/source-control-github/src/server/GitHubRest.test.ts +++ b/packages/source-control-github/src/server/GitHubRest.test.ts @@ -722,6 +722,12 @@ describe("GitHub check failures", () => { check_run_url: "https://api.github.com/repos/acme/web/check-runs/123", steps: [{ name: "Run lint", conclusion: "failure" }], }; + const exitOneAnnotation = { + path: ".github", + start_line: 0, + annotation_level: "failure", + message: "Process completed with exit code 1.", + }; it.effect("sees the signed log redirect itself and follows it without Authorization", () => { const { layer, calls, fetch } = fetchHarness((url) => { @@ -754,7 +760,9 @@ describe("GitHub check failures", () => { headers: { location: "https://blob.example/log?signature=secret" }, }); if (url.startsWith("https://blob.example/")) - return new Response("2026-10-30T12:00:00Z ##[error]bad code\n"); + return new Response( + "2026-10-30T12:00:00Z ##[error]bad code\n##[error]Process completed with exit code 1.\n", + ); return json(job); }); return Effect.gen(function* () { @@ -768,7 +776,12 @@ describe("GitHub check failures", () => { { path: "a.ts", startLine: 4, message: "bad code" }, { path: "budget.json", startLine: 0, message: "grew" }, ], - log: { _tag: "excerpt", text: "##[error]bad code", totalLines: 1, truncated: false }, + log: { + _tag: "excerpt", + text: "##[error]bad code\n##[error]Process completed with exit code 1.", + totalLines: 2, + truncated: false, + }, }); expect(result).not.toHaveProperty("required"); const authorization = (call: (typeof calls)[number]) => @@ -789,7 +802,7 @@ describe("GitHub check failures", () => { it.effect("reads an untouched job from an earlier attempt after a rerun", () => { const { layer } = harness((request) => request.url.includes("/annotations") - ? json([]) + ? json([exitOneAnnotation]) : request.url.endsWith("/logs") ? new Response("##[error]bad code\n") : json(job), @@ -802,6 +815,9 @@ describe("GitHub check failures", () => { }); expect(result).toMatchObject({ attempt: 1, + annotations: [ + { path: ".github", startLine: 0, message: "Process completed with exit code 1." }, + ], log: { _tag: "excerpt", text: "##[error]bad code" }, }); }).pipe(Effect.provide(layer)); @@ -835,14 +851,27 @@ describe("GitHub check failures", () => { ])("returns $reason for $name without extra reads", (test) => { const { layer, requests } = harness((request) => request.url.includes("/annotations") - ? json([]) + ? json([exitOneAnnotation]) : request.url.endsWith("/logs") ? json({ message: "Unavailable" }, { status: test.logStatus }) : json(test.job), ); return Effect.gen(function* () { const read = yield* makeGitHubCheckFailureReader; - expect((yield* read(input)).log).toEqual({ _tag: "unavailable", reason: test.reason }); + const result = yield* read(input); + expect(result.log).toEqual({ _tag: "unavailable", reason: test.reason }); + expect(result.annotations).toEqual( + test.requests === 3 + ? [ + { + path: ".github", + startLine: 0, + level: "failure", + message: exitOneAnnotation.message, + }, + ] + : [], + ); expect(requests).toHaveLength(test.requests); }).pipe(Effect.provide(layer)); }); diff --git a/packages/source-control-github/src/server/gitHubCheckFailures.ts b/packages/source-control-github/src/server/gitHubCheckFailures.ts index 0a5be8fd9e4ef..873bf394ad458 100644 --- a/packages/source-control-github/src/server/gitHubCheckFailures.ts +++ b/packages/source-control-github/src/server/gitHubCheckFailures.ts @@ -167,8 +167,11 @@ export const makeGitHubCheckFailureReader = Effect.gen(function* () { failedSteps: failedSteps.slice(0, 20).map((name) => name.slice(0, 300)), annotations: annotations .filter( - // Exit 1 repeats the log's own error line; 137 or 143 may be the only sign of a kill. - (annotation) => annotation.message !== "Process completed with exit code 1.", + // Only drop exit 1 when the delivered excerpt already contains it. + (annotation) => + annotation.message !== "Process completed with exit code 1." || + log._tag !== "excerpt" || + !log.text.includes(annotation.message), ) .slice(0, 20) .map((annotation) => ({ From 5f4ff6a9010dfe8b837de0ace6d5030dba3cc669 Mon Sep 17 00:00:00 2001 From: Zack Jackson <25274700+ScriptedAlchemy@users.noreply.github.com> Date: Mon, 16 Nov 2026 12:40:12 -0800 Subject: [PATCH 13/13] test(web): wait for pasted image preparation before sending --- apps/web/src/components/ChatView.browser.test.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/web/src/components/ChatView.browser.test.tsx b/apps/web/src/components/ChatView.browser.test.tsx index a0458f9e80280..7e1274543e6d1 100644 --- a/apps/web/src/components/ChatView.browser.test.tsx +++ b/apps/web/src/components/ChatView.browser.test.tsx @@ -284,6 +284,8 @@ it("an interrupted image-only first send of a new thread says it may not have be .element() .dispatchEvent(new ClipboardEvent("paste", { clipboardData, bubbles: true, cancelable: true })); await expect.element(page.getByRole("img", { name: "shot.png" })).toBeVisible(); + // The thumbnail is visible while compression still blocks sending. + await expect.element(page.getByRole("button", { name: "Preview shot.png" })).toBeEnabled(); await userEvent.keyboard("{Enter}"); await vi.waitFor(() => expect(launch.calls).toHaveLength(1)); await userEvent.keyboard("next draft");