Skip to content

chore: sync workflow templates - #5191

Closed
stranske wants to merge 1 commit into
phase-3from
sync/workflows-76ebdcce08bb
Closed

chore: sync workflow templates#5191
stranske wants to merge 1 commit into
phase-3from
sync/workflows-76ebdcce08bb

Conversation

@stranske

Copy link
Copy Markdown
Owner

Sync Summary

Files Updated

  • aggregate_agent_metrics.py: Aggregates downloaded weekly agent metrics - required by agents-weekly-metrics.yml
  • source_context.js: Classifies PR workflow source context for issue, local, automation, sync, Dependabot, review follow-up, and direct GitHub work
  • coverage_monitor_summary.js: Machine-readable weekly coverage monitor checkpoint
  • weekly_metrics_artifacts.js: Bounded weekly metrics artifact selection contract
  • agents_pr_meta_keepalive.js: PR metadata handling for keepalive
  • agents_pr_meta_update_body.js: Updates PR body with agent metadata

Files Skipped

  • pr-00-gate.yml: File exists and sync_mode is create_only
  • ci.yml: File exists and sync_mode is create_only
  • dependabot.yml: File exists and sync_mode is create_only
  • AGENTS.md: Repo keeps historical Agents.md casing to avoid case-only path conflicts
  • llm_slots.json: None

Review Checklist

  • CI passes with updated workflows
  • No repo-specific customizations were overwritten

Source: stranske/Workflows
Source SHA: 070765783f4b6e6598f86787bcb556d788335077
Template hash: 76ebdcce08bb
Sync branch: sync/workflows-76ebdcce08bb
Consumer repo: stranske/Trend_Model_Project
Manifest: .github/sync-manifest.yml

Automated sync from stranske/Workflows
Template hash: 76ebdcce08bb

Changes synced from sync-manifest.yml
Copilot AI review requested due to automatic review settings April 27, 2026 06:38
@stranske stranske added sync Automated sync from Workflows automated Automated sync from Workflows labels Apr 27, 2026

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

Syncs workflow template scripts from stranske/Workflows into the consumer repo to keep weekly metrics aggregation and PR-metadata automation behavior consistent.

Changes:

  • Improves weekly metrics artifact selection by adding “priority producer” workflow scanning and configurable limits.
  • Adds explicit “no automation” source-context detection and uses it to skip keepalive dispatch and PR-body automation.
  • Hardens metrics/coverage reporting contracts (typing improvements; safer filesystem probing).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
scripts/aggregate_agent_metrics.py Adds stronger typing for counters and tightens the artifact selection JSON contract handling.
.github/scripts/weekly_metrics_artifacts.js Adds priority-workflow artifact collection, deduping, and new config knobs for bounded scanning.
.github/scripts/source_context.js Adds noAutomation detection across markers/labels/templates and threads it through source context resolution.
.github/scripts/coverage_monitor_summary.js Wraps statSync in a try/catch to avoid crashing on transient filesystem issues.
.github/scripts/agents_pr_meta_update_body.js Skips PR-body automation when noAutomation is set; improves workflow-source repair comment handling and issue-sync heuristics.
.github/scripts/agents_pr_meta_keepalive.js Prevents keepalive dispatch when the PR opts out of automation via source context.

parseDateMs(run.updated_at ?? run.updatedAt)
);
if (runTimestamp > 0 && runTimestamp < config.cutoff_ms) {
continue;

Copilot AI Apr 27, 2026

Copy link

Choose a reason for hiding this comment

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

In the workflow-runs scan, once runTimestamp is older than config.cutoff_ms, remaining runs will typically also be older (GitHub returns runs in descending created/updated order). Using break instead of continue here would avoid unnecessary API calls and reduce rate-limit pressure.

Suggested change
continue;
break;

Copilot uses AI. Check for mistakes.
Comment on lines +1511 to +1524
const comments = await github.paginate(github.rest.issues.listComments, {
owner,
repo,
issue_number: pr.number,
});
await resolveSourceContextRepairComment({
github,
owner,
repo,
prNumber: pr.number,
comments,
sourceContext,
core,
});

Copilot AI Apr 27, 2026

Copy link

Choose a reason for hiding this comment

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

In the issue-backed path, PR comments are fetched via github.paginate(...listComments...) here to resolve the workflow-source repair comment, and then fetched again later via fetchIssueComments(...). To reduce duplicate API calls (and rate-limit risk), consider reusing a single fetched issueComments array for both resolveSourceContextRepairComment and the later connector/authorization logic.

Copilot uses AI. Check for mistakes.
Comment on lines +528 to +546
let artifactResponse;
try {
artifactResponse = await withRetry((client) =>
client.rest.actions.listWorkflowRunArtifacts({
owner,
repo,
run_id: run.id,
per_page: config.per_page,
})
);
} catch (error) {
if (isNotFoundError(error)) continue;
throw error;
}
const matchingArtifacts = (artifactResponse?.data?.artifacts || []).filter((artifact) =>
families.includes(artifactFamily(artifact.name))
);
sourceArtifacts.push(...matchingArtifacts);
artifacts.push(...matchingArtifacts);

Copilot AI Apr 27, 2026

Copy link

Choose a reason for hiding this comment

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

listWorkflowRunArtifacts is only fetched for a single page (via per_page), so if a workflow run has more artifacts than config.per_page the selection may miss matching metrics artifacts that fall on later pages. Consider paginating actions.listWorkflowRunArtifacts (looping page until fewer than per_page results) so priority families are reliably discovered.

Suggested change
let artifactResponse;
try {
artifactResponse = await withRetry((client) =>
client.rest.actions.listWorkflowRunArtifacts({
owner,
repo,
run_id: run.id,
per_page: config.per_page,
})
);
} catch (error) {
if (isNotFoundError(error)) continue;
throw error;
}
const matchingArtifacts = (artifactResponse?.data?.artifacts || []).filter((artifact) =>
families.includes(artifactFamily(artifact.name))
);
sourceArtifacts.push(...matchingArtifacts);
artifacts.push(...matchingArtifacts);
let page = 1;
while (true) {
let artifactResponse;
try {
artifactResponse = await withRetry((client) =>
client.rest.actions.listWorkflowRunArtifacts({
owner,
repo,
run_id: run.id,
per_page: config.per_page,
page,
})
);
} catch (error) {
if (isNotFoundError(error)) continue;
throw error;
}
const pageArtifacts = artifactResponse?.data?.artifacts || [];
const matchingArtifacts = pageArtifacts.filter((artifact) =>
families.includes(artifactFamily(artifact.name))
);
sourceArtifacts.push(...matchingArtifacts);
artifacts.push(...matchingArtifacts);
if (familiesSatisfied(sourceArtifacts, families, config)) {
break;
}
if (pageArtifacts.length < config.per_page) {
break;
}
page += 1;
}

Copilot uses AI. Check for mistakes.
@stranske stranske closed this Apr 29, 2026
@stranske
stranske deleted the sync/workflows-76ebdcce08bb branch May 14, 2026 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automated Automated sync from Workflows sync Automated sync from Workflows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants