GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(gitlab): a watch reports a pipeline retry that fails again (#33671) · ryush00/t3code@dcb5003

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • apps/server/src/orchestration-v2
    • pullRequestWatch.test.ts
    • pullRequestWatch.ts
  • packages
    • contracts/src
      • pullRequest.ts
    • source-control-gitlab/src/server
      • gitLabMergeRequestJson.test.ts
      • gitLabMergeRequestJson.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎apps/server/src/orchestration-v2/pullRequestWatch.test.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/orchestration-v2/pullRequestWatch.test.ts
+23Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,29 @@ describe("evaluatePullRequestWatch", () => {
510510
}
511511
});
512512

513+
it("reports a retry that fails again where the run keeps its URL", () => {
514+
// GitLab retries failed jobs inside the same pipeline, so only the run ID moves.
515+
const pipeline = (finishedAt: string): PullRequestCheck => ({
516+
...check("Pipeline", "failure"),
517+
url: "https://gitlab.example/o/r/-/pipelines/7",
518+
runId: `7@${finishedAt}`,
519+
});
520+
const first = pipeline("2026-11-10T00:28:57.000Z");
521+
const again = pipeline("2026-11-10T00:39:53.000Z");
522+
const told = evaluatePullRequestWatch(watch(), detail({ checks: [first] }), noRemarks);
523+
assert.deepEqual(told.changes, [{ kind: "checks-failed", failed: [first] }]);
524+
assert.deepEqual(
525+
evaluatePullRequestWatch(told.next, detail({ checks: [first] }), noRemarks).changes,
526+
[],
527+
);
528+
const retried = evaluatePullRequestWatch(told.next, detail({ checks: [again] }), noRemarks);
529+
assert.deepEqual(retried.changes, [{ kind: "checks-failed", failed: [again] }]);
530+
assert.deepEqual(
531+
evaluatePullRequestWatch(retried.next, detail({ checks: [again] }), noRemarks).changes,
532+
[],
533+
);
534+
});
535+
513536
it("does not repeat a failure an older watch told by name", () => {
514537
const older = watch({ headSha: "aaaaaaaaaa", failedChecks: ["lint"] });
515538
const failed = detail({ checks: [check("lint", "failure")] });
Collapse file

‎apps/server/src/orchestration-v2/pullRequestWatch.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/orchestration-v2/pullRequestWatch.ts
+6-3Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,13 @@ export function evaluatePullRequestWatch(
7878
if (checks.length > 0) {
7979
// A run awaiting approval waits on a person, like a review, so only running checks count.
8080
checksPending = checks.some((check) => check.status === "pending");
81-
// A new run URL under a failing name is a rerun that failed again between reads.
81+
// A new run under a failing name is a rerun that failed again between reads. A run is its
82+
// URL, or the host's run ID where the URL stays the same across reruns.
8283
const toldRuns = failedRuns;
83-
const runOf = (check: PullRequestCheck) =>
84-
check.url === null ? null : JSON.stringify([check.name, check.url]);
84+
const runOf = (check: PullRequestCheck) => {
85+
const run = check.runId ?? check.url;
86+
return run === null ? null : JSON.stringify([check.name, run]);
87+
};
8588
const newlyFailed = failed.filter((check) => {
8689
const run = runOf(check);
8790
return (
Collapse file

‎packages/contracts/src/pullRequest.ts‎

Copy file name to clipboardExpand all lines: packages/contracts/src/pullRequest.ts
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,11 @@ export const PullRequestCheck = Schema.Struct({
121121
* approval when that read fails, so nothing waits on it or counts it as passing.
122122
*/
123123
placeholder: Schema.optional(Schema.Boolean),
124+
/**
125+
* Tells this run of the check apart from earlier ones where its URL does not change on a
126+
* rerun, such as a GitLab pipeline whose failed jobs were retried in place.
127+
*/
128+
runId: Schema.optional(TrimmedNonEmptyString),
124129
});
125130
export type PullRequestCheck = typeof PullRequestCheck.Type;
126131

Collapse file

‎packages/source-control-gitlab/src/server/gitLabMergeRequestJson.test.ts‎

Copy file name to clipboardExpand all lines: packages/source-control-gitlab/src/server/gitLabMergeRequestJson.test.ts
+26Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,32 @@ describe("decodeMergeRequestDetailJson", () => {
186186
]);
187187
});
188188

189+
it("tells each finish of a pipeline apart, since a job retry keeps its URL", () => {
190+
const pipelineCheck = (pipeline: Record<string, unknown>) =>
191+
expectSuccess(decodeMergeRequestDetailJson(detailJson({ head_pipeline: pipeline })))
192+
.checks[0];
193+
const failed = (finishedAt: string) =>
194+
pipelineCheck({
195+
id: 3047545127,
196+
status: "failed",
197+
web_url: "https://gitlab.com/acme/web/-/pipelines/3047545127",
198+
finished_at: finishedAt,
199+
});
200+
201+
const first = failed("2026-11-10T00:28:57.753Z");
202+
const retried = failed("2026-11-10T00:39:53.753Z");
203+
expect(first?.url).toBe(retried?.url);
204+
expect(first?.runId).toBe("3047545127@2026-11-10T00:28:57.753Z");
205+
expect(retried?.runId).toBe("3047545127@2026-11-10T00:39:53.753Z");
206+
// A running pipeline has no finish time yet, and one without an ID has nothing to key on.
207+
expect(pipelineCheck({ id: 3047545127, status: "running", finished_at: null })?.runId).toBe(
208+
undefined,
209+
);
210+
expect(
211+
pipelineCheck({ status: "failed", finished_at: "2026-11-10T00:39:53.753Z" })?.runId,
212+
).toBe(undefined);
213+
});
214+
189215
it.each(["canceled", "canceling"])("maps a %s pipeline to cancelled", (status) => {
190216
const detail = expectSuccess(
191217
decodeMergeRequestDetailJson(detailJson({ head_pipeline: { status } })),
Collapse file

‎packages/source-control-gitlab/src/server/gitLabMergeRequestJson.ts‎

Copy file name to clipboardExpand all lines: packages/source-control-gitlab/src/server/gitLabMergeRequestJson.ts
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ const RawPipelineSchema = Schema.Struct({
4141
status: Schema.optional(Schema.NullOr(Schema.String)),
4242
web_url: Schema.optional(Schema.NullOr(Schema.String)),
4343
source: Schema.optional(Schema.NullOr(Schema.String)),
44+
finished_at: Schema.optional(Schema.NullOr(Schema.String)),
4445
});
4546

4647
const RawTriggerJobSchema = Schema.Struct({
@@ -317,12 +318,18 @@ function toChecks(
317318
): ReadonlyArray<PullRequestCheck> {
318319
const pipeline = raw.head_pipeline;
319320
if (!pipeline) return [];
321+
// Retrying jobs reruns them inside the same pipeline, so its URL stays the same. Each time it
322+
// finishes again, its finish time moves, and that tells a retry that failed again apart.
323+
const finishedAt = trimmed(pipeline.finished_at);
320324
return [
321325
{
322326
name: "Pipeline",
323327
status: toPipelineStatus(pipeline.status),
324328
description: trimmed(pipeline.source),
325329
url: trimmed(pipeline.web_url),
330+
...(pipeline.id == null || finishedAt === null
331+
? {}
332+
: { runId: `${pipeline.id}@${finishedAt}` }),
326333
},
327334
];
328335
}

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.