@diffci.com/diffci 0.3.43 → 0.3.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-client/src/client/agent-setup.d.ts +18 -4
- package/dist-client/src/client/agent-setup.js +32 -13
- package/dist-client/src/client/agent-stop.d.ts +6 -4
- package/dist-client/src/client/agent-stop.js +4 -3
- package/dist-client/src/client/cli.js +10 -7
- package/dist-client/src/client/red-builds.d.ts +7 -1
- package/dist-client/src/client/red-builds.js +13 -4
- package/package.json +1 -1
|
@@ -15,9 +15,17 @@ export declare function ignoredWrites(repoPath: string, results: readonly string
|
|
|
15
15
|
* instruction. Growth depends on the agent finding DiffCI's tools in the repository without anyone
|
|
16
16
|
* installing a plugin, so one `diffci init` now registers them. Each write keeps files and servers
|
|
17
17
|
* DiffCI did not write.
|
|
18
|
+
*
|
|
19
|
+
* 2026-11-14: also the hyperscalers' coding agents. Kiro gets `.kiro/settings/mcp.json` (the read-only
|
|
20
|
+
* tools auto-approved; it still asks before tests run) and `.kiro/skills`; Antigravity CLI gets
|
|
21
|
+
* `.agents/mcp_config.json` and `.agents/skills`, which Codex reads too. GitHub Copilot needs no file of
|
|
22
|
+
* its own for these: VS Code reads the root `.mcp.json`, and Copilot reads `.claude/skills`.
|
|
18
23
|
*/
|
|
19
|
-
export declare const MCP_CONFIG_PATHS: readonly [".mcp.json", ".cursor/mcp.json"];
|
|
24
|
+
export declare const MCP_CONFIG_PATHS: readonly [".mcp.json", ".cursor/mcp.json", ".kiro/settings/mcp.json", ".agents/mcp_config.json"];
|
|
20
25
|
export declare const SKILL_PATH = ".claude/skills/diffci-verify/SKILL.md";
|
|
26
|
+
export declare const SKILL_PATHS: readonly [".claude/skills/diffci-verify/SKILL.md", ".agents/skills/diffci-verify/SKILL.md", ".kiro/skills/diffci-verify/SKILL.md"];
|
|
27
|
+
/** MCP tools that only read the checkout; Kiro runs them without asking. */
|
|
28
|
+
export declare const KIRO_AUTO_APPROVE: readonly ["diffci_changed_files", "diffci_select_tests", "diffci_explain_selection"];
|
|
21
29
|
/** Same launcher as the portable agent plugin: `npx` through cmd.exe on Windows, where agents cannot spawn `npx.cmd` directly. */
|
|
22
30
|
export declare function mcpServerEntry(version: string): {
|
|
23
31
|
command: string;
|
|
@@ -32,10 +40,16 @@ export declare const DIFFCI_VERIFY_SKILL = "---\nname: diffci-verify\ndescriptio
|
|
|
32
40
|
* agent's project hook file. Claude Code and Codex share one shape (`Stop` > group > handlers); Cursor has
|
|
33
41
|
* its own (`version: 1`, `stop` > handlers). A hook is DiffCI's when its command runs `agent-stop` from
|
|
34
42
|
* the DiffCI package; those are replaced, every other hook is kept.
|
|
43
|
+
*
|
|
44
|
+
* GitHub Copilot (2026-11-14): `agentStop` in `.github/hooks/diffci.json` (`version: 1`, handlers with
|
|
45
|
+
* `bash` and `powershell` commands), read by Copilot CLI, the cloud agent and VS Code. Its documented
|
|
46
|
+
* `{"decision": "block", "reason"}` output forces another turn. Kiro has no hook here: its `Stop`
|
|
47
|
+
* trigger is documented as unable to block, so it could not make the agent fix a failure.
|
|
35
48
|
*/
|
|
36
|
-
export
|
|
49
|
+
export type SetupHookAgent = "claude" | "codex" | "cursor" | "copilot";
|
|
50
|
+
export declare const AGENT_HOOK_PATHS: Record<SetupHookAgent, string>;
|
|
37
51
|
/** Seconds the agent waits for the hook; verify's own timeout stays below it (cli.ts, agent-stop). */
|
|
38
52
|
export declare const AGENT_HOOK_TIMEOUT_SECONDS = 1200;
|
|
39
|
-
export declare function writeAgentStopHook(repoPath: string, agent:
|
|
53
|
+
export declare function writeAgentStopHook(repoPath: string, agent: SetupHookAgent, launcher: string): string;
|
|
40
54
|
/** A skill file DiffCI wrote is recognised by its frontmatter name and updated; any other file is kept. */
|
|
41
|
-
export declare function writeSkill(repoPath: string, force: boolean): string;
|
|
55
|
+
export declare function writeSkill(repoPath: string, force: boolean, relativePath?: string): string;
|
|
@@ -32,9 +32,22 @@ export function ignoredWrites(repoPath, results) {
|
|
|
32
32
|
* instruction. Growth depends on the agent finding DiffCI's tools in the repository without anyone
|
|
33
33
|
* installing a plugin, so one `diffci init` now registers them. Each write keeps files and servers
|
|
34
34
|
* DiffCI did not write.
|
|
35
|
+
*
|
|
36
|
+
* 2026-11-14: also the hyperscalers' coding agents. Kiro gets `.kiro/settings/mcp.json` (the read-only
|
|
37
|
+
* tools auto-approved; it still asks before tests run) and `.kiro/skills`; Antigravity CLI gets
|
|
38
|
+
* `.agents/mcp_config.json` and `.agents/skills`, which Codex reads too. GitHub Copilot needs no file of
|
|
39
|
+
* its own for these: VS Code reads the root `.mcp.json`, and Copilot reads `.claude/skills`.
|
|
35
40
|
*/
|
|
36
|
-
export const MCP_CONFIG_PATHS = [".mcp.json", ".cursor/mcp.json"];
|
|
41
|
+
export const MCP_CONFIG_PATHS = [".mcp.json", ".cursor/mcp.json", ".kiro/settings/mcp.json", ".agents/mcp_config.json"];
|
|
37
42
|
export const SKILL_PATH = ".claude/skills/diffci-verify/SKILL.md";
|
|
43
|
+
export const SKILL_PATHS = [SKILL_PATH, ".agents/skills/diffci-verify/SKILL.md", ".kiro/skills/diffci-verify/SKILL.md"];
|
|
44
|
+
const SKILL_AGENTS = {
|
|
45
|
+
[SKILL_PATH]: "Claude Code and Copilot skill",
|
|
46
|
+
".agents/skills/diffci-verify/SKILL.md": "Antigravity CLI and Codex skill",
|
|
47
|
+
".kiro/skills/diffci-verify/SKILL.md": "Kiro skill",
|
|
48
|
+
};
|
|
49
|
+
/** MCP tools that only read the checkout; Kiro runs them without asking. */
|
|
50
|
+
export const KIRO_AUTO_APPROVE = ["diffci_changed_files", "diffci_select_tests", "diffci_explain_selection"];
|
|
38
51
|
/** Same launcher as the portable agent plugin: `npx` through cmd.exe on Windows, where agents cannot spawn `npx.cmd` directly. */
|
|
39
52
|
export function mcpServerEntry(version) {
|
|
40
53
|
return {
|
|
@@ -52,6 +65,8 @@ function isDiffciEntry(entry) {
|
|
|
52
65
|
export function writeMcpConfig(repoPath, relativePath, version, force) {
|
|
53
66
|
const absolutePath = join(repoPath, relativePath);
|
|
54
67
|
const entry = mcpServerEntry(version);
|
|
68
|
+
if (relativePath === ".kiro/settings/mcp.json")
|
|
69
|
+
entry.autoApprove = [...KIRO_AUTO_APPROVE];
|
|
55
70
|
let config = {};
|
|
56
71
|
let existing;
|
|
57
72
|
if (existsSync(absolutePath)) {
|
|
@@ -115,16 +130,11 @@ counts, outcome, and any outstanding required checks. Never infer passed suites,
|
|
|
115
130
|
test cases, skipped CI jobs, or measured savings from selection counts. Required
|
|
116
131
|
project CI stays authoritative.
|
|
117
132
|
`;
|
|
118
|
-
/**
|
|
119
|
-
* Stop hooks that run `diffci agent-stop` when the agent ends a turn (agent-stop.ts, 2026-11-06), in each
|
|
120
|
-
* agent's project hook file. Claude Code and Codex share one shape (`Stop` > group > handlers); Cursor has
|
|
121
|
-
* its own (`version: 1`, `stop` > handlers). A hook is DiffCI's when its command runs `agent-stop` from
|
|
122
|
-
* the DiffCI package; those are replaced, every other hook is kept.
|
|
123
|
-
*/
|
|
124
133
|
export const AGENT_HOOK_PATHS = {
|
|
125
134
|
claude: ".claude/settings.json",
|
|
126
135
|
codex: ".codex/hooks.json",
|
|
127
136
|
cursor: ".cursor/hooks.json",
|
|
137
|
+
copilot: ".github/hooks/diffci.json",
|
|
128
138
|
};
|
|
129
139
|
/** Seconds the agent waits for the hook; verify's own timeout stays below it (cli.ts, agent-stop). */
|
|
130
140
|
export const AGENT_HOOK_TIMEOUT_SECONDS = 1200;
|
|
@@ -154,6 +164,15 @@ export function writeAgentStopHook(repoPath, agent, launcher) {
|
|
|
154
164
|
const stop = Array.isArray(hooks.stop) ? hooks.stop.filter((entry) => !isDiffciHook(entry?.command)) : [];
|
|
155
165
|
config = { ...config, version: typeof config.version === "number" ? config.version : 1, hooks: { ...hooks, stop: [...stop, { command, loop_limit: 3 }] } };
|
|
156
166
|
}
|
|
167
|
+
else if (agent === "copilot") {
|
|
168
|
+
const ours = (entry) => ["bash", "powershell", "command"].some((key) => isDiffciHook(entry?.[key]));
|
|
169
|
+
const stop = Array.isArray(hooks.agentStop) ? hooks.agentStop.filter((entry) => !ours(entry)) : [];
|
|
170
|
+
config = {
|
|
171
|
+
...config,
|
|
172
|
+
version: typeof config.version === "number" ? config.version : 1,
|
|
173
|
+
hooks: { ...hooks, agentStop: [...stop, { type: "command", bash: command, powershell: command, timeoutSec: AGENT_HOOK_TIMEOUT_SECONDS }] },
|
|
174
|
+
};
|
|
175
|
+
}
|
|
157
176
|
else {
|
|
158
177
|
const groups = (Array.isArray(hooks.Stop) ? hooks.Stop : []).flatMap((group) => {
|
|
159
178
|
const handlers = Array.isArray(group?.hooks) ? group.hooks : [];
|
|
@@ -170,19 +189,19 @@ export function writeAgentStopHook(repoPath, agent, launcher) {
|
|
|
170
189
|
return `${existing === undefined ? "wrote" : "updated"} ${relativePath} (DiffCI stop hook)`;
|
|
171
190
|
}
|
|
172
191
|
/** A skill file DiffCI wrote is recognised by its frontmatter name and updated; any other file is kept. */
|
|
173
|
-
export function writeSkill(repoPath, force) {
|
|
174
|
-
const absolutePath = join(repoPath,
|
|
192
|
+
export function writeSkill(repoPath, force, relativePath = SKILL_PATH) {
|
|
193
|
+
const absolutePath = join(repoPath, relativePath);
|
|
175
194
|
if (existsSync(absolutePath)) {
|
|
176
195
|
const existing = readFileSync(absolutePath, "utf8");
|
|
177
196
|
if (existing.replace(/\r\n/g, "\n") === DIFFCI_VERIFY_SKILL)
|
|
178
|
-
return `kept ${
|
|
197
|
+
return `kept ${relativePath} (current)`;
|
|
179
198
|
if (!/^---\r?\nname: diffci-verify\r?\n/.test(existing) && !force) {
|
|
180
|
-
return `kept ${
|
|
199
|
+
return `kept ${relativePath} (existing file not written by DiffCI; pass --force to replace it)`;
|
|
181
200
|
}
|
|
182
201
|
writeFileSync(absolutePath, DIFFCI_VERIFY_SKILL, "utf8");
|
|
183
|
-
return `updated ${
|
|
202
|
+
return `updated ${relativePath}`;
|
|
184
203
|
}
|
|
185
204
|
mkdirSync(dirname(absolutePath), { recursive: true });
|
|
186
205
|
writeFileSync(absolutePath, DIFFCI_VERIFY_SKILL, "utf8");
|
|
187
|
-
return `wrote ${
|
|
206
|
+
return `wrote ${relativePath} (${SKILL_AGENTS[relativePath] ?? "skill"})`;
|
|
188
207
|
}
|
|
@@ -6,24 +6,26 @@ import type { VerificationReport } from "./verify.js";
|
|
|
6
6
|
* verify is advice an agent can skip; a hook on the end of its turn is not. The agent finds out what its
|
|
7
7
|
* change broke before it tells anyone the work is done.
|
|
8
8
|
*
|
|
9
|
-
* WHAT. `diffci agent-stop --agent claude|codex|cursor` is the command the agent's stop hook runs
|
|
9
|
+
* WHAT. `diffci agent-stop --agent claude|codex|cursor|copilot` is the command the agent's stop hook runs
|
|
10
10
|
* (Claude Code `Stop` in .claude/settings.json, Codex `Stop` in .codex/hooks.json, Cursor `stop` in
|
|
11
|
-
* .cursor/hooks.json; `diffci init` installs them). It reads the hook's JSON from stdin, verifies the
|
|
11
|
+
* .cursor/hooks.json, GitHub Copilot `agentStop` in .github/hooks/diffci.json; `diffci init` installs them). It reads the hook's JSON from stdin, verifies the
|
|
12
12
|
* uncommitted changes, and:
|
|
13
13
|
* - passes quietly when nothing changed or verification passed;
|
|
14
14
|
* - when tests or checks fail, asks the agent to continue with the failures as the reason (Claude Code
|
|
15
|
-
* and
|
|
15
|
+
* Codex and Copilot: `{"decision": "block", "reason"}`; Cursor: `{"followup_message"}`);
|
|
16
16
|
* - never holds the agent when verification could not run (blocked analysis, no command): that is
|
|
17
17
|
* reported to the person, not turned into work for the agent;
|
|
18
18
|
* - hands back to the person after DIFFCI_AGENT_HOOK_MAX failed attempts in one session (default 3),
|
|
19
19
|
* counted in .git/diffci/agent-hook.json and reset by a pass, on top of the agents' own loop limits.
|
|
20
20
|
* DIFFCI_AGENT_HOOK=0 turns it off. Repeats on an unchanged tree are instant through result reuse.
|
|
21
21
|
*/
|
|
22
|
-
export type HookAgent = "claude" | "codex" | "cursor";
|
|
22
|
+
export type HookAgent = "claude" | "codex" | "cursor" | "copilot";
|
|
23
23
|
export declare const HOOK_AGENTS: readonly HookAgent[];
|
|
24
24
|
export declare const DEFAULT_MAX_ATTEMPTS = 3;
|
|
25
25
|
export interface StopPayload {
|
|
26
26
|
session_id?: string;
|
|
27
|
+
/** GitHub Copilot's `agentStop` payload. */
|
|
28
|
+
sessionId?: string;
|
|
27
29
|
conversation_id?: string;
|
|
28
30
|
cwd?: string;
|
|
29
31
|
workspace_roots?: string[];
|
|
@@ -2,7 +2,7 @@ import { execFileSync } from "node:child_process";
|
|
|
2
2
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { dirname, join } from "node:path";
|
|
4
4
|
import { outcomeLogPath } from "./outcome-log.js";
|
|
5
|
-
export const HOOK_AGENTS = ["claude", "codex", "cursor"];
|
|
5
|
+
export const HOOK_AGENTS = ["claude", "codex", "cursor", "copilot"];
|
|
6
6
|
export const DEFAULT_MAX_ATTEMPTS = 3;
|
|
7
7
|
export function parseStopPayload(text) {
|
|
8
8
|
try {
|
|
@@ -24,7 +24,7 @@ export function stopRepoPath(payload, env, fallback) {
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
function sessionKey(payload) {
|
|
27
|
-
return payload.session_id ?? payload.conversation_id ?? "unknown";
|
|
27
|
+
return payload.session_id ?? payload.sessionId ?? payload.conversation_id ?? "unknown";
|
|
28
28
|
}
|
|
29
29
|
function attemptsPath(repoPath) {
|
|
30
30
|
const log = outcomeLogPath(repoPath);
|
|
@@ -76,7 +76,8 @@ function failureReason(report, attempt, max) {
|
|
|
76
76
|
*/
|
|
77
77
|
export function decideStop(agent, report, failuresSoFar, max) {
|
|
78
78
|
const allow = (message) => ({
|
|
79
|
-
|
|
79
|
+
// Cursor and Copilot document no field for a message to the person.
|
|
80
|
+
stdout: JSON.stringify(message && agent !== "cursor" && agent !== "copilot" ? { systemMessage: message } : {}),
|
|
80
81
|
failures: 0,
|
|
81
82
|
});
|
|
82
83
|
if (!report)
|
|
@@ -47,7 +47,7 @@ import { resolveObservationAgent } from "./agent-identity.js";
|
|
|
47
47
|
import { inferFullCommand, inferComparableSelectedCommand, inferWorkspaceComparison } from "./full-command.js";
|
|
48
48
|
import { addDiffciPackageScripts, detectPackageManager, installDiffci } from "./install.js";
|
|
49
49
|
import { hookCommand, installPrePushHook, isGitRepository } from "./hook.js";
|
|
50
|
-
import { AGENT_HOOK_TIMEOUT_SECONDS, ignoredWrites, MCP_CONFIG_PATHS,
|
|
50
|
+
import { AGENT_HOOK_TIMEOUT_SECONDS, ignoredWrites, MCP_CONFIG_PATHS, SKILL_PATHS, writeAgentStopHook, writeMcpConfig, writeSkill } from "./agent-setup.js";
|
|
51
51
|
import { submitObservation } from "./submit.js";
|
|
52
52
|
import { configureGraphCache } from "./shared-graph-cache.js";
|
|
53
53
|
import { GraphCache } from "@diffci.com/core/cache/graph-cache";
|
|
@@ -422,9 +422,10 @@ function runInit(flags, env) {
|
|
|
422
422
|
for (const path of MCP_CONFIG_PATHS)
|
|
423
423
|
writes.push(writeMcpConfig(repoPath, path, identity.version, force));
|
|
424
424
|
if (flags["no-skill"] === true)
|
|
425
|
-
skipped.push(
|
|
425
|
+
skipped.push("skipped the diffci-verify skills (--no-skill)");
|
|
426
426
|
else
|
|
427
|
-
|
|
427
|
+
for (const path of SKILL_PATHS)
|
|
428
|
+
writes.push(writeSkill(repoPath, force, path));
|
|
428
429
|
if (flags["no-agent-hooks"] === true)
|
|
429
430
|
skipped.push("skipped the agent stop hooks (--no-agent-hooks)");
|
|
430
431
|
else
|
|
@@ -1421,7 +1422,7 @@ Usage:
|
|
|
1421
1422
|
diffci init [--repo <path>] [--workflow] [--verification-workflow] [--install] [--no-hook] [--no-mcp] [--no-skill]
|
|
1422
1423
|
[--no-agent-hooks] [--force]
|
|
1423
1424
|
diffci watch [--repo <path>] [--checks] [--debounce-ms <ms>] [--no-log]
|
|
1424
|
-
diffci agent-stop --agent claude|codex|cursor (run by the agent stop hooks init installs; reads the hook JSON on stdin)
|
|
1425
|
+
diffci agent-stop --agent claude|codex|cursor|copilot (run by the agent stop hooks init installs; reads the hook JSON on stdin)
|
|
1425
1426
|
diffci mcp
|
|
1426
1427
|
diffci verify [--changed | --base <sha> --head <sha>] [--policy enforce] [--repo <path>] [--out <file>] [--json]
|
|
1427
1428
|
[--redact-paths] [--timeout-ms <ms>] [--baseline-on-failure] [--no-checks | --checks]
|
|
@@ -1459,9 +1460,11 @@ Usage:
|
|
|
1459
1460
|
diffci version
|
|
1460
1461
|
|
|
1461
1462
|
init writes AGENTS.md, CLAUDE.md, Cursor rules, Copilot instructions, and diffci.config.json. It also
|
|
1462
|
-
registers the DiffCI MCP server in .mcp.json (Claude Code)
|
|
1463
|
-
|
|
1464
|
-
|
|
1463
|
+
registers the DiffCI MCP server in .mcp.json (Claude Code, VS Code), .cursor/mcp.json (Cursor),
|
|
1464
|
+
.kiro/settings/mcp.json (Kiro) and .agents/mcp_config.json (Antigravity CLI), keeping other servers, adds the
|
|
1465
|
+
diffci-verify skill to .claude/skills, .agents/skills and .kiro/skills, installs the pre-push hook, and adds stop
|
|
1466
|
+
hooks (.claude/settings.json, .codex/hooks.json, .cursor/hooks.json, .github/hooks/diffci.json for GitHub
|
|
1467
|
+
Copilot) that run diffci agent-stop when an agent ends a
|
|
1465
1468
|
turn: it verifies the uncommitted changes and, when tests or checks fail, asks the agent to fix them before
|
|
1466
1469
|
finishing, at most DIFFCI_AGENT_HOOK_MAX times a session (default 3; DIFFCI_AGENT_HOOK=0 turns it off).
|
|
1467
1470
|
--no-mcp, --no-skill, --no-hook and --no-agent-hooks leave each out. --workflow adds a separate non-blocking observation workflow. --install detects npm, pnpm, Yarn,
|
|
@@ -36,6 +36,9 @@ export declare function bucketJob(job: JobSummary, patterns?: Patterns): JobBuck
|
|
|
36
36
|
export declare function isAggregateJob(job: JobSummary): boolean;
|
|
37
37
|
/** Failure signatures of one job: annotation path, title and first message line, with volatile parts blurred. */
|
|
38
38
|
export declare function signatures(annotations: Annotation[]): Set<string>;
|
|
39
|
+
/** A red run where no job started (zero jobs, or all skipped): a workflow that failed to start, typically a fork
|
|
40
|
+
* PR's run that GitHub rejected. Nothing was checked, so it is not a red build of the change. */
|
|
41
|
+
export declare function nothingRan(jobs: JobSummary[]): boolean;
|
|
39
42
|
export interface RedRun {
|
|
40
43
|
run: number;
|
|
41
44
|
workflow: string;
|
|
@@ -79,7 +82,10 @@ export interface RedBuildsReport {
|
|
|
79
82
|
to: string;
|
|
80
83
|
} | null;
|
|
81
84
|
pullRequestRuns: number;
|
|
85
|
+
/** Red runs where at least one job ran. */
|
|
82
86
|
redRuns: number;
|
|
87
|
+
/** Runs GitHub marked failed although no job started (workflow startup failures); left out of redRuns. */
|
|
88
|
+
neverStarted: number;
|
|
83
89
|
analysed: number;
|
|
84
90
|
unreadable: number;
|
|
85
91
|
verdicts: Record<Verdict, {
|
|
@@ -90,7 +96,7 @@ export interface RedBuildsReport {
|
|
|
90
96
|
stoppedEarly: string | null;
|
|
91
97
|
rows: RedRun[];
|
|
92
98
|
}
|
|
93
|
-
export declare function summarise(repository: string, runs: RunSummary[], rows: RedRun[], stoppedEarly: string | null): RedBuildsReport;
|
|
99
|
+
export declare function summarise(repository: string, runs: RunSummary[], rows: RedRun[], stoppedEarly: string | null, neverStarted?: number): RedBuildsReport;
|
|
94
100
|
export declare function formatReport(report: RedBuildsReport): string;
|
|
95
101
|
export type GitHubGet = (path: string) => Promise<{
|
|
96
102
|
status: number;
|
|
@@ -82,6 +82,11 @@ export function signatures(annotations) {
|
|
|
82
82
|
}
|
|
83
83
|
return out;
|
|
84
84
|
}
|
|
85
|
+
/** A red run where no job started (zero jobs, or all skipped): a workflow that failed to start, typically a fork
|
|
86
|
+
* PR's run that GitHub rejected. Nothing was checked, so it is not a red build of the change. */
|
|
87
|
+
export function nothingRan(jobs) {
|
|
88
|
+
return jobs.every((job) => !job.startedAt || job.conclusion === "skipped");
|
|
89
|
+
}
|
|
85
90
|
function minutes(job) {
|
|
86
91
|
if (!job.startedAt || !job.completedAt)
|
|
87
92
|
return 0;
|
|
@@ -112,7 +117,7 @@ export function classify(input) {
|
|
|
112
117
|
const rows = [];
|
|
113
118
|
for (const run of input.runs) {
|
|
114
119
|
const jobs = input.jobs.get(run.id);
|
|
115
|
-
if (run.conclusion !== "failure" || !jobs)
|
|
120
|
+
if (run.conclusion !== "failure" || !jobs || nothingRan(jobs))
|
|
116
121
|
continue;
|
|
117
122
|
const allFailing = failingOf(jobs);
|
|
118
123
|
// A gate job that only reports "something else failed" says nothing on its own.
|
|
@@ -174,7 +179,7 @@ export function agentMarker(message, branch) {
|
|
|
174
179
|
return { written: true, marker: "branch prefix" };
|
|
175
180
|
return { written: false, marker: "" };
|
|
176
181
|
}
|
|
177
|
-
export function summarise(repository, runs, rows, stoppedEarly) {
|
|
182
|
+
export function summarise(repository, runs, rows, stoppedEarly, neverStarted = 0) {
|
|
178
183
|
const verdicts = Object.fromEntries(VERDICTS.map((v) => [v, { runs: 0, runnerMinutes: 0 }]));
|
|
179
184
|
for (const row of rows) {
|
|
180
185
|
verdicts[row.verdict].runs++;
|
|
@@ -183,7 +188,7 @@ export function summarise(repository, runs, rows, stoppedEarly) {
|
|
|
183
188
|
for (const v of VERDICTS)
|
|
184
189
|
verdicts[v].runnerMinutes = Math.round(verdicts[v].runnerMinutes);
|
|
185
190
|
const times = runs.map((r) => r.createdAt).sort();
|
|
186
|
-
const red = runs.filter((r) => r.conclusion === "failure").length;
|
|
191
|
+
const red = runs.filter((r) => r.conclusion === "failure").length - neverStarted;
|
|
187
192
|
return {
|
|
188
193
|
schemaVersion: RED_BUILDS_SCHEMA,
|
|
189
194
|
repository,
|
|
@@ -191,6 +196,7 @@ export function summarise(repository, runs, rows, stoppedEarly) {
|
|
|
191
196
|
window: times.length ? { from: times[0], to: times.at(-1) } : null,
|
|
192
197
|
pullRequestRuns: runs.length,
|
|
193
198
|
redRuns: red,
|
|
199
|
+
neverStarted,
|
|
194
200
|
analysed: rows.length,
|
|
195
201
|
unreadable: red - rows.length,
|
|
196
202
|
verdicts,
|
|
@@ -223,6 +229,8 @@ export function formatReport(report) {
|
|
|
223
229
|
return lines.join("\n");
|
|
224
230
|
}
|
|
225
231
|
lines.push(`${report.window.from.slice(0, 16).replace("T", " ")} to ${report.window.to.slice(0, 16).replace("T", " ")} UTC · ${report.pullRequestRuns} pull request runs, ${report.redRuns} red (${pct(report.redRuns, report.pullRequestRuns)})`);
|
|
232
|
+
if (report.neverStarted > 0)
|
|
233
|
+
lines.push(`${report.neverStarted} more runs were marked failed although no job started (the workflow failed to start); they are not counted as red.`);
|
|
226
234
|
if (report.unreadable > 0)
|
|
227
235
|
lines.push(`${report.unreadable} red runs could not be read and are left out.`);
|
|
228
236
|
if (report.analysed === 0) {
|
|
@@ -416,7 +424,8 @@ export async function collectRedBuilds(options) {
|
|
|
416
424
|
stoppedEarly = error.message;
|
|
417
425
|
}
|
|
418
426
|
}
|
|
419
|
-
const
|
|
427
|
+
const neverStarted = runs.filter((r) => r.conclusion === "failure" && jobs.has(r.id) && nothingRan(jobs.get(r.id))).length;
|
|
428
|
+
const report = summarise(repository, runs, rows, stoppedEarly, neverStarted);
|
|
420
429
|
report.workflow = workflowLabel || runs[0]?.workflowName || null;
|
|
421
430
|
return report;
|
|
422
431
|
}
|