fix(metrics-collector): restore metrics/latest.json updates broken since Jan 2026 - #49767
Merged
Merged
Conversation
…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
Contributor
PR Triage
Automated triage — see full report issue for details. Structured data: {
"action": "defer",
"category": "bug",
"pr_number": 49767,
"risk": "low"
}
|
Contributor
There was a problem hiding this comment.
🟡 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" |
Contributor
|
🎉 This pull request is included in a new release. Release: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
metrics/latest.jsonhas been stale since January 2026 because the agent was writing to the wrong path in repo-memory, causing theFILE_GLOB_FILTER: "metrics/**"push filter to silently drop everything on every run.Root causes (confirmed via job logs)
agent-performance-latest.mdto the repo-memory root instead of JSON undermetrics/. 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.{"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, corruptingGH_AW_WORKFLOW_NAMEand OTEL attributes across the compiled YAML.find /tmp/gh-aw/repo-memory/default -maxdepth 1 -type f -deleteremoves any root-level stale files (e.g.agent-performance-latest.md) before collection begins.metrics/daily/YYYY-MM-DD.jsonandmetrics/latest.jsonwithjqvalidation inline.metrics/latest.jsonexists with valid JSON and no root-level files remain before callingnoop.{"status":"no-data"}stubs; requires a minimal valid JSON structure with zeros and acollection_notewhen the agentic-workflows logs tool is unavailable.YOU ARE THE METRICS COLLECTOR, NOT THE AGENT-PERFORMANCE WORKFLOWguard in Important Notes to prevent cross-workflow confusion.