Skip to content

Enforce consistent workflow run metrics - #77994

Merged
pelikhan merged 3 commits into
mainfrom
copilot/workflow-health-dashboard-2026-11-15
Nov 15, 2026
Merged

pelikhan merged 3 commits into
mainfrom
copilot/workflow-health-dashboard-2026-11-15

Conversation

@gh-aw-bot

@gh-aw-bot gh-aw-bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

The workflow health snapshot showed totals that didn’t reconcile with outcome counts, weakening confidence in its critical-tier metrics. The collector now enforces a consistent count contract before publishing snapshots.

  • Collection contract: Define total as successful + failed + skipped + action_required; exclude queued and in-progress runs. Unknown completed conclusions make the snapshot partial and are documented.
  • Persistence validation: Reject negative or non-integer counts, inconsistent totals, and mismatched executed counts or success rates.
  • Regression coverage: Add a test confirming snapshots with unreconciled totals are rejected.
total = successful + failed + skipped + action_required
executed = successful + failed
success_rate = executed == 0 ? null : successful / executed

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
@gh-aw-bot gh-aw-bot changed the title [WIP] Update workflow health dashboard metrics for 2026-11-15 Enforce consistent workflow run metrics Nov 15, 2026
@pelikhan
pelikhan marked this pull request as ready for review November 15, 2026 08:15
Copilot AI adaptive review requested due to automatic review settings November 15, 2026 08:15
@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

PR Code Quality Reviewer

Outcome: reported_action

The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt56 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.5K · ◷

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft.

Design Decision Gate 🏗️

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · pi · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ⊞ 8.6K · ◷

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Specification Reviewer completed successfully!

PR Specification Reviewer

Outcome: reported_action

The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated by PR Specification Reviewer for #77994 · copilot · gpt56 · ~3 AIC · ⌖ ~2 AIC · ⊞ 1.6K · ◷

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Ponytail Reviewer

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated by Ponytail Reviewer for #77994 · codex · routed: gpt61 medium · ~3 AIC · ⌖ ~1 AIC · ⊞ 185 · ◷

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~9 AIC · ⌖ ~2 AIC · ⊞ 6.6K · ◷

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

🧪 Test quality analysis by Test Quality Sentinel · copilot · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ⊞ 7.2K · ◷

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (pr-code-quality-reviewer)
reviewed_at: 2026-11-15T08:20:00Z
review_event: COMMENT
top_themes:
  - embedded validator coverage for independent invariants
files_reviewed:
  - .github/workflows/metrics-collector.md
  - actions/setup/js/metrics_collector_workflow.test.cjs
comment_count: 1
History

Note

This comment is managed by comment memory.

Expand the saved memory block to view or edit the persistent context for this thread.
Edit only the text inside the backtick fences; workflow metadata and the footer are regenerated automatically.

Learn more about comment memory

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.5K · ◷
Comment /review to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found one non-blocking coverage gap: the new validator has multiple independent invariants, but the regression suite exercises only the total mismatch. I left an inline comment requesting table-driven coverage for the remaining rejection paths. Static review only; tests were not run per review instructions.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.5K
Comment /review to run again

data.workflows["workflow-0"].workflow_runs.total++;
writeSnapshot(root, JSON.stringify(data, null, 2) + "\n");

expect(() => runGate(root)).toThrow("Workflow run total does not match outcome counts: workflow-0.");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new regression test covers only the total invariant, but this change also adds several independent rejection paths (unsafe/non-integer counts, executed mismatch, zero-executed rate semantics, and rate tolerance). Those are easy to regress while editing the embedded validator and currently have no coverage. Please add table-driven cases for the remaining contract rules so the persistence gate is tested as a whole.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added regression cases for invalid counts, executed/rate mismatches, and zero executions with null or numeric rates in d14fd25.

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (review-history)
{"id":"ldg-5b6e49f7-574b-417d-84bd-315cd4299110","parents":[],"payload":{"id":"ldg-008fb2f7-fed2-4b18-bade-f4cb65ff555d","operation":"append","value":{"finding_count":1,"head_sha":"afc18a8abd1e50dd81a719bb62b8e5d36c8eb476","outcome":"findings"}},"sha":"sha256:d76b2d4ee391ad0191999aaf9be60f7a671b20e3f293ce111cb7efcc41463142","timestamp":"2026-11-15T08:22:00.724Z","type":"ledger_append","version":1}
History

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (spec-review-history)
{"id":"ldg-7e5ebe1e-f395-483e-b97e-d166e64e7cbe","parents":[],"payload":{"id":"ldg-cf2a3535-b4c1-418e-8390-3212ddfcbd54","operation":"append","value":{"finding_count":0,"head_sha":"afc18a8abd1e50dd81a719bb62b8e5d36c8eb476","outcome":"aligned"}},"sha":"sha256:fcc25e4edb01c3fedb3a43dffeaa72f5a45579e97f81fa084cb7b39467917724","timestamp":"2026-11-15T08:22:52.050Z","type":"ledger_append","version":1}
History

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The workflow guidance contains conflicting rules for partial snapshots, and regression tests omit new count-validation and zero-execution rate cases.

2 open issues
What changed in this PR

This PR strengthens the metrics collector’s count contract to address the workflow-health discrepancies reported in #77985.

Changes:

  • Defines totals using classified completed runs, excludes active runs, and marks unknown conclusions as partial data.
  • Adds persistence checks for valid counts, reconciled totals, executed counts, and success rates.
  • Regenerates the compiled workflow and adds a regression test for mismatched totals.
File Description
actions/​setup/​js/​metrics_collector_workflow.test.cjs Tests rejection of totals that do not match outcome counts.
.github/​workflows/​metrics-collector.md Defines collection semantics and adds metrics validation.
.github/​workflows/​metrics-collector.lock.yml Updates generated validators and workflow hashes.

Review effort: Balanced (dynamic)

Comment on lines +127 to +134
it("rejects workflow totals that do not match outcome counts", () => {
const root = temporaryDirectory();
const data = JSON.parse(snapshot());
data.workflows["workflow-0"].workflow_runs.total++;
writeSnapshot(root, JSON.stringify(data, null, 2) + "\n");

expect(() => runGate(root)).toThrow("Workflow run total does not match outcome counts: workflow-0.");
});
Comment thread .github/workflows/metrics-collector.md Outdated
Comment on lines +265 to +266
- If any completed run has a conclusion not covered above, set `collection_status` to `partial`
and explain its conclusion and count in `collection_note`; do not silently include it in `total`.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skills-Based Review 🧠

Applied /tdd, /diagnosing-bugs, and /grill-with-docs to the committed HEAD (afc18a8). Requesting changes on the jq gate gap and the missing test coverage.

📋 Key Themes and Highlights

Key Themes

  • Gate parity: the jq gate uses has() and accepts null counts, while the Node validator rejects them.
  • Test coverage: only the total-mismatch branch is tested. Negative, non-integer, executed, rate, and null-entry branches have no tests.
  • Contract clarity: the rate tolerance is loose, startup_failure changes the metric, and the unknown-conclusion rule is prompt-only.

Positive Highlights

  • ✅ The example fixture is internally consistent (7 = 6 + 1 + 0 + 0; rate 0.857).
  • ✅ The validator uses Number.isSafeInteger and handles executed === 0 with a null rate.
  • ✅ The gate fails closed on every malformed input I tried.

Verification Limits

  • Vitest did not run here (npm proxy certificate error), so I checked the Node validator with a standalone harness covering 14 fixtures.
  • The compiled .lock.yml was not reviewed for freshness. Run make recompile and confirm it matches the .md.
  • The working tree has uncommitted edits, so I reviewed committed HEAD only.

@copilot please address the review comments above.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~9 AIC · ⌖ ~2 AIC · ⊞ 6.6K
Comment /matt to run again

Comment thread .github/workflows/metrics-collector.md Outdated
or in-progress runs in `total`.
- Successful runs (conclusion: "success")
- Failed runs (conclusion: "failure", "cancelled", "timed_out")
- Failed runs (conclusion: "failure", "cancelled", "timed_out", "startup_failure")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/grill-with-docs] startup_failure now counts as failed. That changes success rates for any workflow that hits it, and no test pins this mapping. Explain the choice in the PR description and add a test case for it.

@copilot please address this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pinned startup_failure as failed in the workflow guidance and regression test. It is counted as failed because it is a completed run that did not succeed. Updated in d14fd25.

Comment thread .github/workflows/metrics-collector.md Outdated
throw new Error("Latest metrics must contain workflow records.");
}
for (const [name, workflow] of Object.entries(snapshot.workflows)) {
const runs = workflow.workflow_runs;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/diagnosing-bugs] If a workflows entry is null, line 48 throws a raw TypeError (Cannot read properties of null) before the explicit !runs message can run. The gate still fails closed, but the error is unclear. Use workflow?.workflow_runs so the explicit check reports it.

@copilot please address this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Used optional chaining for workflow?.workflow_runs and added null/missing workflow-run regression cases in d14fd25.

Comment thread .github/workflows/metrics-collector.md Outdated
(runs.executed === 0
? runs.success_rate !== null
: !Number.isFinite(runs.success_rate) ||
Math.abs(runs.success_rate - runs.successful / runs.executed) >= 0.001)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/tdd] The rate check accepts a stored success_rate that is up to just under 0.001 away from successful / executed. The PR body gives the exact formula, and the example uses 3 decimals. Pick one contract and test its boundary, for example by rounding to 3 decimals and comparing for equality.

💡 Suggested test

Add boundary cases for the chosen contract, such as an offset of 0.0009 and an offset of 0.001.

@copilot please address this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made the success-rate comparison exact to match the documented ratio and added 0.0009/0.001 mismatch cases in d14fd25.

expect(fs.readFileSync(path.join(root, "daily/2026-10-14.json"), "utf8")).toBe(content);
});

it("rejects workflow totals that do not match outcome counts", () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/tdd] Only the total-mismatch case is tested. The new branches for negative or non-integer counts, an executed mismatch, a success_rate mismatch, a null or missing workflow_runs, and the executed === 0 case have no tests, though the PR text describes them as rejected. Make these table-driven cases so each rule stays pinned.

💡 Suggested cases
  • negative failed
  • non-integer skipped
  • executed off by one
  • success_rate off by 0.01
  • executed is 0 with a non-null rate

@copilot please address this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added tests for negative, fractional, and null counts; executed/rate mismatches; and zero-execution rate behavior in d14fd25.

Comment thread .github/workflows/metrics-collector.md Outdated
jq -e '
all(.workflows[]?.workflow_runs;
has("total") and
has("successful") and

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/diagnosing-bugs] has("successful") only checks that the key exists, so a null count passes. jq treats null as 0 in arithmetic, so a fixture with "successful": null, "total": 3, "failed": 1, "skipped": 1, and "action_required": 1 passes this gate. The Node validator rejects the same input, so the two gates disagree.

💡 Suggested fix

Require a number for each count, for example (.successful | type) == "number", and apply the same check to total, failed, skipped, action_required, and executed. Add a regression case for a null count.

@copilot please address this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the jq validator to require non-negative integer counts, including executed; the regression suite also covers null counts. d14fd25.

Comment thread .github/workflows/metrics-collector.md Outdated
- Approval-gated runs (conclusion: "action_required")
- Executed runs: `successful + failed`
- Calculate success rate: `successful / executed`; use `null` when `executed` is 0
- If any completed run has a conclusion not covered above, set `collection_status` to `partial`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/diagnosing-bugs] This unknown-conclusion rule exists only in the prompt. The validator does not check collection_status or collection_note, so a run that skips this step still passes the validation gate. Enforce it in the validator, or document it as advisory.

@copilot please address this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added snapshot checks tying non-empty unclassified_conclusions to collection_status: partial and a note naming each workflow/conclusion/count; the guidance permits partial status even with full time coverage. d14fd25.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator Author

@copilot

🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (actions/setup/js/metrics_collector_workflow.test.cjs:133): address unresolved feedback - Review comment
  3. Review (.github/workflows/metrics-collector.md:260): address unresolved feedback - Review comment
  4. Review (.github/workflows/metrics-collector.md:48): address unresolved feedback - Review comment
  5. Review (.github/workflows/metrics-collector.md:61): address unresolved feedback - Review comment
  6. Review (actions/setup/js/metrics_collector_workflow.test.cjs:127): address unresolved feedback - Review comment
  7. Review (.github/workflows/metrics-collector.md:708): address unresolved feedback - Review comment
  8. Review (.github/workflows/metrics-collector.md:265): address unresolved feedback - Review comment

Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering.

Structured data
{
  "completed_task": 0,
  "head": "afc18a8abd1e50dd81a719bb62b8e5d36c8eb476",
  "kind": "requested",
  "schema_version": "1",
  "state": "117d3f6d4dad0c42059ebc87784e94626ed99cc6d4218dd2bcf93c2d1882c217",
  "work": [
    "1d9e9e08ea19bf2d5e3184d20a84cafc8d64c4b718ff65485aad12aa8bd08d2e",
    "6e1bdfb310ab1c24fbf4dc75c22586dc9bdc7bfdb3e44799e4b367059c77797c",
    "a90a886eef8cf68b246e436d84b381a5e2c9cd420348f3a2bfebab41e8e9ee37",
    "c94709e609fcc1e9db375b8df0dac55bbfafa9fe518c2b72ecd9ddeca2ffe6a6",
    "dfec7fb39415a00f8dafe4148446c5123458500b0d13101b2ccfefb6c62d174a",
    "e42bda1c5122d0e2c193c6f386ff2225f5dbea82a3d89c60d0866d3399517881",
    "fea1107f7f2de0184e4a41210b0a4305c9a3f222e25ce62a39692ab2b6d09fae"
  ],
  "workflow": "pr-sous-chef"
}

Generated by 👨🍳 PR Sous Chef · pi · routed: haiku55 xhigh · ~3 AIC · ⌖ ~2 AIC · ⊞ 7K · ◷
Comment /souschef to run again

…th-dashboard-2026-11-15

# Conflicts:
#	.github/workflows/metrics-collector.lock.yml

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

Category: bug
Risk: medium
Total score: 66 (impact 34 + urgency 20 + quality 12)
Recommended action: batch_review
Batch: runtime-ops
Reason: workflow-health fix is important but still a medium-risk runtime validation change with open review feedback and no green merge signal.

Generated by 🔧 PR Triage Agent · copilot · mai11 · ~5 AIC · ⌖ ~2 AIC · ⊞ 15.3K · ◷

@github-actions

Copy link
Copy Markdown
Contributor

✅ Great work on the workflow metrics validation! This PR strengthens the reliability of the metrics collection system by enforcing a consistent count contract across snapshots.

The implementation is solid:

  • Clear contract definition — total = successful + failed + skipped + action_required with proper documentation
  • Comprehensive validation — Catches negative counts, inconsistent totals, and mismatched executed counts
  • Regression coverage — Test case confirms snapshots with unreconciled totals are properly rejected
  • Focused changes — Updates to metrics collector validation script in the workflow lock file

This PR is ready for review and merge. The changes maintain backward compatibility while improving data integrity at the persistence layer.

Generated by ✅ Contribution Check · copilot · routed: haiku55 xhigh · ~26 AIC · ⌖ ~2 AIC · ⊞ 5.4K · ◷

@pelikhan
pelikhan merged commit 531fc4b into main Nov 15, 2026
114 checks passed
@pelikhan
pelikhan deleted the copilot/workflow-health-dashboard-2026-11-15 branch November 15, 2026 15:38
@github-actions

Copy link
Copy Markdown
Contributor

Triage

  • Category: bug
  • Risk: medium
  • Priority score: 66/100 (impact 32 + urgency 18 + quality 16)
  • Recommended action: batch_review (runtime-ops)
  • Notes: workflow/runtime bug fix with moderate impact and clear batching opportunity.

Generated by 🔧 PR Triage Agent · copilot · mai11 · ~4 AIC · ⌖ ~1 AIC · ⊞ 14.4K · ◷

@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v1.3.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Workflow Health Dashboard - 2026-11-15

4 participants