Skip to content

fix(metrics-collector): restore metrics/latest.json updates broken since Jan 2026 - #49767

Merged
pelikhan merged 2 commits into
mainfrom
copilot/deep-report-fix-shared-metrics-collector
Aug 2, 2026
Merged

fix(metrics-collector): restore metrics/latest.json updates broken since Jan 2026#49767
pelikhan merged 2 commits into
mainfrom
copilot/deep-report-fix-shared-metrics-collector

Conversation

Copilot AI commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

metrics/latest.json has been stale since January 2026 because the agent was writing to the wrong path in repo-memory, causing the FILE_GLOB_FILTER: "metrics/**" push filter to silently drop everything on every run.

Root causes (confirmed via job logs)

  • Wrong output path: Agent wrote agent-performance-latest.md to the repo-memory root instead of JSON under metrics/. Push job log: Scan complete: 0 file(s) accepted, 1 file(s) filtered out — agent-performance-latest.md (no pattern matched). This has been happening since ~Feb 2026; memory branch last updated July 8, 2026.
  • No-data stubs: During the brief Jan 2026 window when files landed in the right path, the agent produced {"date":"...","status":"no-data"} instead of real metrics due to GitHub API access failures.

Changes to metrics-collector.md (lock file recompiled)

  • name: "Metrics Collector" added to frontmatter — the compiler was deriving the workflow name from the first # bash comment in the body, corrupting GH_AW_WORKFLOW_NAME and OTEL attributes across the compiled YAML.
  • Pre-flight cleanup step — mandatory first action: find /tmp/gh-aw/repo-memory/default -maxdepth 1 -type f -delete removes any root-level stale files (e.g. agent-performance-latest.md) before collection begins.
  • Explicit write/validate commands — concrete bash snippets for writing metrics/daily/YYYY-MM-DD.json and metrics/latest.json with jq validation inline.
  • Pre-noop validation gate — agent must verify metrics/latest.json exists with valid JSON and no root-level files remain before calling noop.
  • Missing-data fallback tightened — bans {"status":"no-data"} stubs; requires a minimal valid JSON structure with zeros and a collection_note when the agentic-workflows logs tool is unavailable.
  • Identity reminder — explicit YOU ARE THE METRICS COLLECTOR, NOT THE AGENT-PERFORMANCE WORKFLOW guard in Important Notes to prevent cross-workflow confusion.

…rong-path writes

Root causes:
1. Agent wrote `agent-performance-latest.md` to repo-memory root instead
   of JSON files under `metrics/`. The FILE_GLOB_FILTER `metrics/**`
   silently filtered it out, so nothing was committed since ~Feb 2026.
2. When data collection failed, agent wrote stub `{"status":"no-data"}`
   entries instead of minimal valid metrics JSON.

Fixes:
- Add `name: "Metrics Collector"` to frontmatter to prevent compiler
  from deriving workflow name from bash comment in body
- Add Pre-flight step: mandatory bash command to delete any root-level
  non-metrics files (e.g. agent-performance-latest.md) before writing
- Strengthen the CRITICAL file-path warning to be unambiguous
- Add explicit write/validate bash commands for the metrics files
- Add Pre-noop Validation section: agent MUST verify metrics/latest.json
  exists with valid JSON before calling noop
- Improve Handling Missing Data: forbid stub no-data files, require
  minimal valid JSON with zeros as the fallback
- Add identity reminder: "YOU ARE THE METRICS COLLECTOR, NOT THE
  AGENT-PERFORMANCE WORKFLOW"
- Recompile lock file (body_hash updated)

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix shared metrics collector to restore trend reports fix(metrics-collector): restore metrics/latest.json updates broken since Jan 2026 Aug 2, 2026
Copilot AI requested a review from pelikhan August 2, 2026 12:01
@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

PR Triage

  • Category:
  • Risk:
  • Priority: (score: 49/100)
    • Impact: 30/50, Urgency: 10/30, Quality: 9/20
  • Recommended action:
  • OpenTelemetry: flagged — requires label and assignment to @mnkeifer per triage policy.

Automated triage — see full report issue for details.

Structured data:

{
  "action": "defer",
  "category": "bug",
  "pr_number": 49767,
  "risk": "low"
}

Generated by 🔧 PR Triage Agent · auto · 73.4 AIC · ⌖ 3.47 AIC · ⊞ 8K ·

@pelikhan
pelikhan marked this pull request as ready for review August 2, 2026 12:56
Copilot AI review requested due to automatic review settings August 2, 2026 12:56
@pelikhan
pelikhan merged commit 8015865 into main Aug 2, 2026
1 check passed
@pelikhan
pelikhan deleted the copilot/deep-report-fix-shared-metrics-collector branch August 2, 2026 12:56

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.

🟡 Not ready to approve

The validation gate currently permits a stale metrics/latest.json to pass.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.

Pull request overview

Restores daily metrics persistence by enforcing valid JSON output under metrics/**.

Changes:

  • Adds explicit workflow naming and memory cleanup.
  • Adds JSON write, fallback, and validation guidance.
  • Regenerates workflow metadata.
File summaries
File Description
.github/workflows/metrics-collector.md Strengthens metrics collection and persistence safeguards.
.github/workflows/metrics-collector.lock.yml Updates compiled workflow hashes.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Balanced

We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.

Comment on lines +369 to +372
# Step 4: Confirm the timestamp is recent (today)
STORED_DATE=$(jq -r '.timestamp' /tmp/gh-aw/repo-memory/default/metrics/latest.json | cut -c1-10)
TODAY=$(date +%Y-%m-%d)
echo "Stored date: $STORED_DATE | Today: $TODAY"
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.84.3

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.

[deep-report] Shared metrics collector broken since Jan 2026 — metrics/latest.json stale/partial, blocking trend reports

3 participants