Skip to content

feat: add daily workflow runtime auditor and optimizer - #11058

Merged
lpcox merged 10 commits into
mainfrom
lpcox-workflow-runtime-pr
Nov 3, 2026
Merged

lpcox merged 10 commits into
mainfrom
lpcox-workflow-runtime-pr

Conversation

@lpcox

@lpcox lpcox commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

Add a daily runtime auditor and an evidence-driven optimizer covering all GitHub Actions workflow types and engines.

  • The auditor samples up to 500 completed runs from the preceding seven days and ranks the ten slowest workflows by successful elapsed runtime, measured from first executed job start to last executed job completion. Failures, initial queue time, missing measurements, and low sample sizes are reported separately. Each daily report supersedes previous audit reports.
  • The optimizer runs after a successful auditor run on main, or by manual dispatch, and uses the exact triggering audit's report. It skips workflows already tracked by open recommendations and creates at most one implementation-ready issue, preserving independent older recommendations.
  • The optimizer reads GitHub data through the read-only gh-proxy and creates issues through safe outputs. It never implements changes or assigns agents.
  • Include Usage documentation, compiled locks, and a focused regression suite.

Validation

  • npx --no-install jest --runInBand scripts/ci/workflow-runtime-workflows.test.ts — 12 tests passed, including repository postprocessing idempotence for both locks.
  • Targeted Markdown lint and git diff --check passed.
  • Both workflows were strictly compiled with gh-aw v0.91.6 and scoped postprocessing before transfer; all five files were copied verbatim and verified byte-for-byte in an isolated worktree based on current main.

Scope

Exactly five new files: two workflow sources, their two generated locks, and scripts/ci/workflow-runtime-workflows.test.ts. No unrelated commits or dirty source-checkout changes are included.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI adaptive review requested due to automatic review settings November 3, 2026 21:31
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@@ -0,0 +1,195 @@
---

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.

🟡 Changes recommended

Unresolved issues can let the optimizer bypass safe-output restrictions with write-capable tokens, expose telemetry credentials to sandboxes, and break report deduplication and lookups.

3 open issues
What changed in this PR

Adds a daily runtime audit and an evidence-driven optimizer to help maintainers reduce GitHub Actions execution time across workflow types and engines.

Changes:

  • Samples up to 500 completed runs over seven days and reports the ten slowest workflows by successful elapsed runtime.
  • Uses the triggering audit report to propose at most one untracked optimization issue, without implementing changes or assigning agents.
  • Adds usage documentation, compiled workflow configuration, and focused regression coverage.
File Description
scripts/​ci/​workflow-runtime-workflows.test.ts Tests measurement, sampling, deduplication, report handoff, and postprocessing.
.github/​workflows/​workflow-runtime-optimizer.md Defines target selection, evidence requirements, and recommendation issue creation.
.github/​workflows/​workflow-runtime-auditor.md Defines daily collection, runtime ranking, and audit reporting.
.github/​workflows/​workflow-runtime-auditor.lock.yml Compiles the auditor into executable GitHub Actions jobs.

Review effort: Balanced (auto)

OTEL_SERVICE_NAME: gh-aw.workflow-runtime-auditor
OTEL_RESOURCE_ATTRIBUTES: 'gh-aw.workflow.name=Daily%20Workflow%20Runtime%20Auditor,gh-aw.repository=${{ github.repository }},gh-aw.run.id=${{ github.run_id }},github.run_id=${{ github.run_id }},gh-aw.engine.id=copilot'
OTEL_EXPORTER_OTLP_HEADERS: ${{ secrets.GH_AW_DEFAULT_OTLP_HEADERS }}
GH_AW_OTLP_ENDPOINTS: '[{"url":"${{ secrets.GH_AW_DEFAULT_OTLP_ENDPOINT || vars.GH_AW_DEFAULT_OTLP_ENDPOINT }}","headers":"${{ secrets.GH_AW_DEFAULT_OTLP_HEADERS }}"}]'
Comment on lines +27 to +29
github:
mode: gh-proxy
toolsets: [actions, issues, pull_requests, repos]
Even an empty window gets a short report stating that no measurable successful
runs were found; missing measurements are unknown, not zero.

Include these exact markers, substituting values from the JSON:
@lpcox

lpcox commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator Author

@copilot address all review feedback

@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 93.65% 93.66% ➡️ +0.01%
Statements 92.18% 92.19% ➡️ +0.01%
Functions 91.42% 91.42% ➡️ +0.00%
Branches 86.38% 86.39% 📈 +0.01%
📁 Per-file Coverage Changes (2 files)
File Lines (Before → After) Statements (Before → After)
src/enclave/host-executor-server.ts 91.2% → 91.2% (+0.00%) 89.8% → 90.1% (+0.29%)
src/nvx/one-shot-process.ts 81.5% → 84.0% (+2.47%) 74.7% → 76.8% (+2.11%)

Coverage comparison generated by scripts/ci/compare-coverage.ts

Copilot AI commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

@copilot address all review feedback

Addressed the review feedback in commit fb5d9aa: the optimizer now receives only validated structured metadata, the auditor uses visible identifiers, OTLP credentials are excluded from both auditor sandboxes, and the gh-proxy is bound to the workflow token.

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

✅ Copilot review passed with no inline comments.

@lpcox Add the ready-for-aw label to this PR to trigger agentic CI smoke tests.

…racter sanitization'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
lpcox and others added 2 commits November 3, 2026 14:50
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
const first = Math.min(...executed.map(job => Date.parse(job.started_at)));
const last = Math.max(...executed.map(job => Date.parse(job.completed_at)));
measured.push({
workflow_id: run.workflow_id, workflow_path: safeWorkflowPath, name: sanitizeText(run.name, 200),
lpcox and others added 2 commits November 3, 2026 15:17
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@lpcox
lpcox merged commit 2ac33d6 into main Nov 3, 2026
36 checks passed
@lpcox
lpcox deleted the lpcox-workflow-runtime-pr branch November 3, 2026 23:57
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.

4 participants