Skip to content

Fix Metrics Collector zeroing safe-output metrics on logs tool timeout - #50576

Merged
pelikhan merged 2 commits into
mainfrom
copilot/agent-performance-fix-metrics-collector
Aug 5, 2026
Merged

pelikhan merged 2 commits into
mainfrom
copilot/agent-performance-fix-metrics-collector

Conversation

Copilot AI commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

The Metrics Collector issues a single large logs request for the -1d window, which repeatedly exceeds the 60s tool timeout and returns only the most recent ~50 runs. The agent then reported safe_outputs and engagement as 0 for 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

  • Fetch runs in count: 20 batches and follow the continuation field the logs tool already emits on early stop, using its before_run_id, accumulating across batches.
  • Cap at 10 batches (~200 runs) so the step stays within the 15-minute workflow timeout.
  • Explicitly prohibit single count >= 100 requests for the full window.

Safe-output fallback instead of silent zeros

  • When batches still don't cover 24h, derive safe_outputs/engagement from GitHub API searches (issues/PRs/comments/discussions in the window), attributing results to workflows via their gh-aw-workflow-call-id footer marker.
  • Record "safe_outputs_source": "github_api_fallback" plus a collection_note.
  • Reporting 0 is now only valid when the data source actually covered the window.
Parameters (first call):
- start_date: "-1d"
- count: 20

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
Copilot AI requested a review from pelikhan August 5, 2026 14:38
@pelikhan
pelikhan marked this pull request as ready for review August 5, 2026 14:40
Copilot AI balanced review requested due to automatic review settings August 5, 2026 14:40
@pelikhan
pelikhan merged commit e50151e into main Aug 5, 2026
@pelikhan
pelikhan deleted the copilot/agent-performance-fix-metrics-collector branch August 5, 2026 14:41

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.

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.
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.85.1

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[agent-performance] Metrics Collector safe-output/engagement fields zeroed by recurring log-tool timeout (2 consecutive days)

3 participants