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@0d1f688

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
@@ -616,6 +616,29 @@ describe("evaluatePullRequestWatch", () => {
616616
}
617617
});
618618

619+
it("reports a retry that fails again where the run keeps its URL", () => {
620+
// GitLab retries failed jobs inside the same pipeline, so only the run ID moves.
621+
const pipeline = (finishedAt: string): PullRequestCheck => ({
622+
...check("Pipeline", "failure"),
623+
url: "https://gitlab.example/o/r/-/pipelines/7",
624+
runId: `7@${finishedAt}`,
625+
});
626+
const first = pipeline("2026-11-10T00:28:57.000Z");
627+
const again = pipeline("2026-11-10T00:39:53.000Z");
628+
const told = evaluatePullRequestWatch(watch(), detail({ checks: [first] }), noRemarks);
629+
assert.deepEqual(told.changes, [{ kind: "checks-failed", failed: [first] }]);
630+
assert.deepEqual(
631+
evaluatePullRequestWatch(told.next, detail({ checks: [first] }), noRemarks).changes,
632+
[],
633+
);
634+
const retried = evaluatePullRequestWatch(told.next, detail({ checks: [again] }), noRemarks);
635+
assert.deepEqual(retried.changes, [{ kind: "checks-failed", failed: [again] }]);
636+
assert.deepEqual(
637+
evaluatePullRequestWatch(retried.next, detail({ checks: [again] }), noRemarks).changes,
638+
[],
639+
);
640+
});
641+
619642
it("does not repeat a failure an older watch told by name", () => {
620643
const older = watch({ headSha: "aaaaaaaaaa", failedChecks: ["lint"] });
621644
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
@@ -91,10 +91,13 @@ export function evaluatePullRequestWatch(
9191
const failed = checks.filter(isFailedCheck);
9292
const awaiting = checks.filter((check) => check.status === "action-required");
9393
const failedBefore = failedChecks;
94-
// A new run URL under a failing name is a rerun that failed again between reads.
94+
// A new run under a failing name is a rerun that failed again between reads. A run is its
95+
// URL, or the host's run ID where the URL stays the same across reruns.
9596
const toldRuns = failedRuns;
96-
const runOf = (check: PullRequestCheck) =>
97-
check.url === null ? null : JSON.stringify([check.name, check.url]);
97+
const runOf = (check: PullRequestCheck) => {
98+
const run = check.runId ?? check.url;
99+
return run === null ? null : JSON.stringify([check.name, run]);
100+
};
98101
const newlyFailed = failed.filter((check) => {
99102
const run = runOf(check);
100103
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
@@ -122,6 +122,11 @@ export const PullRequestCheck = Schema.Struct({
122122
* approval when that read fails, so nothing waits on it or counts it as passing.
123123
*/
124124
placeholder: Schema.optional(Schema.Boolean),
125+
/**
126+
* Tells this run of the check apart from earlier ones where its URL does not change on a
127+
* rerun, such as a GitLab pipeline whose failed jobs were retried in place.
128+
*/
129+
runId: Schema.optional(TrimmedNonEmptyString),
125130
});
126131
export type PullRequestCheck = typeof PullRequestCheck.Type;
127132

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
@@ -196,6 +196,32 @@ describe("decodeMergeRequestDetailJson", () => {
196196
]);
197197
});
198198

199+
it("tells each finish of a pipeline apart, since a job retry keeps its URL", () => {
200+
const pipelineCheck = (pipeline: Record<string, unknown>) =>
201+
expectSuccess(decodeMergeRequestDetailJson(detailJson({ head_pipeline: pipeline })))
202+
.checks[0];
203+
const failed = (finishedAt: string) =>
204+
pipelineCheck({
205+
id: 3047545127,
206+
status: "failed",
207+
web_url: "https://gitlab.com/acme/web/-/pipelines/3047545127",
208+
finished_at: finishedAt,
209+
});
210+
211+
const first = failed("2026-11-10T00:28:57.753Z");
212+
const retried = failed("2026-11-10T00:39:53.753Z");
213+
expect(first?.url).toBe(retried?.url);
214+
expect(first?.runId).toBe("3047545127@2026-11-10T00:28:57.753Z");
215+
expect(retried?.runId).toBe("3047545127@2026-11-10T00:39:53.753Z");
216+
// A running pipeline has no finish time yet, and one without an ID has nothing to key on.
217+
expect(pipelineCheck({ id: 3047545127, status: "running", finished_at: null })?.runId).toBe(
218+
undefined,
219+
);
220+
expect(
221+
pipelineCheck({ status: "failed", finished_at: "2026-11-10T00:39:53.753Z" })?.runId,
222+
).toBe(undefined);
223+
});
224+
199225
it.each(["canceled", "canceling"])("maps a %s pipeline to cancelled", (status) => {
200226
const detail = expectSuccess(
201227
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({
@@ -335,12 +336,18 @@ function toChecks(
335336
): ReadonlyArray<PullRequestCheck> {
336337
const pipeline = raw.head_pipeline;
337338
if (!pipeline) return [];
339+
// Retrying jobs reruns them inside the same pipeline, so its URL stays the same. Each time it
340+
// finishes again, its finish time moves, and that tells a retry that failed again apart.
341+
const finishedAt = trimmed(pipeline.finished_at);
338342
return [
339343
{
340344
name: "Pipeline",
341345
status: toPipelineStatus(pipeline.status),
342346
description: trimmed(pipeline.source),
343347
url: trimmed(pipeline.web_url),
348+
...(pipeline.id == null || finishedAt === null
349+
? {}
350+
: { runId: `${pipeline.id}@${finishedAt}` }),
344351
},
345352
];
346353
}

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.