Fix Metrics Collector zeroing safe-output metrics on logs tool timeout - #50576
Merged
Merged
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix metrics collector safe-output fields zeroed by recurring log-tool timeout
Fix Metrics Collector zeroing safe-output metrics on logs tool timeout
Aug 5, 2026
pelikhan
approved these changes
Aug 5, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Updates Metrics Collector to avoid false-zero safe-output metrics when log retrieval is truncated.
Changes:
- Adds bounded, 20-run log pagination.
- Adds GitHub API fallback collection for safe outputs and engagement.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/metrics-collector.md |
Defines pagination and fallback behavior. |
.github/workflows/metrics-collector.lock.yml |
Updates generated workflow metadata. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 3
- Review effort level: Balanced
Comment on lines
+113
to
+116
| - **If the accumulated log batches still do not cover the full 24h window** (i.e. the last batch | ||
| returned a `continuation` field or the oldest run collected is newer than 24h ago), do **not** | ||
| report `safe_outputs` as zero. Instead compute safe-output counts from the GitHub API fallback | ||
| described below and mark the source accordingly. |
| - Issues created: search issues created in the window that carry a | ||
| `gh-aw-workflow-call-id: <owner>/<repo>/<workflow-id>` marker in the body | ||
| (e.g. `search_issues` with `repo:<owner>/<repo> is:issue created:>=<window start>`) | ||
| - PRs created: same search with `is:pr` |
Comment on lines
+129
to
+131
| Attribute each result to a workflow via its `gh-aw-workflow-call-id` footer marker, aggregate the | ||
| counts per workflow, and set `"safe_outputs_source": "github_api_fallback"` alongside a | ||
| `collection_note` explaining the truncation. The same fallback applies to `engagement` fields. |
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.
The Metrics Collector issues a single large
logsrequest for the-1dwindow, which repeatedly exceeds the 60s tool timeout and returns only the most recent ~50 runs. The agent then reportedsafe_outputsandengagementas0for all workflows — false negatives that break downstream scoring in Agent Performance Analyzer, Campaign Manager, and Workflow Health Manager.Changes are confined to
.github/workflows/metrics-collector.md(plus its recompiled.lock.yml):Paginated log collection
count: 20batches and follow thecontinuationfield thelogstool already emits on early stop, using itsbefore_run_id, accumulating across batches.count >= 100requests for the full window.Safe-output fallback instead of silent zeros
safe_outputs/engagementfrom GitHub API searches (issues/PRs/comments/discussions in the window), attributing results to workflows via theirgh-aw-workflow-call-idfooter marker."safe_outputs_source": "github_api_fallback"plus acollection_note.0is now only valid when the data source actually covered the window.