Skip to content

feat(agentics): add daily performance-scan agentic workflow#2125

Open
sergio-sisternes-epam wants to merge 1 commit into
sergio-sisternes-epam-perf-audit-and-fixesfrom
sergio-sisternes-epam-daily-perf-scan-workflow
Open

feat(agentics): add daily performance-scan agentic workflow#2125
sergio-sisternes-epam wants to merge 1 commit into
sergio-sisternes-epam-perf-audit-and-fixesfrom
sergio-sisternes-epam-daily-perf-scan-workflow

Conversation

@sergio-sisternes-epam

@sergio-sisternes-epam sergio-sisternes-epam commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

TL;DR

Adds a daily agentic workflow (perf-scan) that scans src/apm_cli/ for
algorithmic performance anti-patterns and opens a GitHub Issue with findings
every morning at 01:00 UTC.

Stacked on #2124 -- do not merge until #2124 merges first.
Depends on .github/agents/performance-expert.agent.md and
.github/agents/algorithmic-patterns.agent.md introduced in that PR.

Problem (WHY)

PR #2124 landed four algorithmic perf fixes and a performance-expert agent
with a full algorithmic lens. Without a recurring automated scan, new regressions
will silently accumulate between manual audits.

Approach (WHAT)

A GitHub Agentic Workflow that:

  • Runs daily at 01:00 UTC (results ready before 6-7am UK/CET) and on workflow_dispatch.
  • Scans six anti-pattern categories in src/apm_cli/.
  • Always creates a GitHub Issue (findings or clean) so the run is always visible.

Implementation (HOW)

Files added

File Purpose
.github/workflows/perf-scan.md Agentic workflow: frontmatter + agent instructions
.github/workflows/perf-scan.lock.yml Compiled YAML (generated by gh aw compile v0.80.9)
.github/agents/workflows/perf-scan.md Companion reference: scope, output contract, finding format

Anti-patterns scanned (A-F)

ID Pattern Typical impact
A Quadratic loop nesting O(n) -> O(n^2) as package count grows
B Linear scan in loop (x in list) O(n) per iteration vs. O(1) with set/dict
C Unconditional expensive ops on hot paths Avoidable I/O per call
D Redundant env-var / config parsing Repeated syscalls per invocation
E Heavy top-level imports in command modules Startup latency regardless of sub-command
F Sequential independent I/O Wall-time parallelism opportunity

Schedule and output

  • Schedule: 0 1 * * * (01:00 UTC daily) + workflow_dispatch.
  • Issue titles: [perf-scan] YYYY-MM-DD -- performance opportunities found or -- no issues found
  • Labels: performance, automated. ASCII-only body.

Security

Issue creation via safe-outputs: create-issue only. No issues: write direct permission.

Validation

gh aw compile perf-scan
[+] .github/workflows/perf-scan.md (53.9 KB)
[!] Compiled 1 workflow(s): 0 error(s), 1 warning(s)

One expected warning: fixed 01:00 UTC cron (intentional -- daily fuzzy schedule fires at a random time).

How to test

  1. Actions > Daily Performance Scanner > Run workflow (manual dispatch).
  2. Confirm a new issue labelled performance + automated appears in the tracker.

Copilot AI review requested due to automatic review settings July 10, 2026 14:40
Add perf-scan.md agentic workflow that runs daily at 01:00 UTC and scans
src/apm_cli/ for six algorithmic performance anti-patterns:

  A. Quadratic or worse loop nesting
  B. Linear scan inside a loop (set/dict opportunity)
  C. Unconditional expensive operations on hot paths
  D. Redundant env-var / config parsing in sequence
  E. Heavy top-level imports on CLI command modules
  F. Sequential I/O with no data dependency (parallelism opportunity)

Each run creates a GitHub Issue titled:
  [perf-scan] YYYY-MM-DD -- performance opportunities found
  [perf-scan] YYYY-MM-DD -- no issues found  (when clean)

Issues are labelled 'performance' and 'automated'. Output is ASCII-only
per the repository encoding rule.

The companion instructions file at .github/agents/workflows/perf-scan.md
documents the agent prompt, scan scope, and output contract for reference.

The .lock.yml was generated with gh aw compile (v0.80.9).

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@sergio-sisternes-epam sergio-sisternes-epam force-pushed the sergio-sisternes-epam-daily-perf-scan-workflow branch from 294959c to 28f2b29 Compare July 10, 2026 14:41
@sergio-sisternes-epam sergio-sisternes-epam changed the base branch from main to sergio-sisternes-epam-perf-audit-and-fixes July 10, 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

Adds a new gh-aw agentic workflow (perf-scan) scheduled daily at 01:00 UTC to scan src/apm_cli/ for algorithmic performance anti-patterns and open a tracking issue per run, plus a companion reference doc.

Changes:

  • Introduces .github/workflows/perf-scan.md with the scan procedure and issue-format contract.
  • Adds the compiled workflow .github/workflows/perf-scan.lock.yml.
  • Adds .github/agents/workflows/perf-scan.md as a standalone reference for scope and output contract.

Reviewed changes

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

File Description
.github/workflows/perf-scan.md Defines the scheduled agent instructions + safe-output issue creation contract.
.github/workflows/perf-scan.lock.yml Generated workflow YAML used by GitHub Actions to execute the agentic workflow.
.github/agents/workflows/perf-scan.md Companion reference describing scope, output contract, and finding format.

Comment on lines +190 to +193
(The `[perf-scan] ` prefix is added automatically by the safe-output.)

Create the issue using the `create-issue` safe-output tool with the body below.
All text must be ASCII-only.
Comment on lines +15 to +26
# This file was automatically generated by gh-aw (v0.65.6). DO NOT EDIT.
#
# To update this file, edit the corresponding .md file and run:
# gh aw compile
# Not all edits will cause changes to this file.
#
# For more information: https://github.github.com/gh-aw/introduction/overview/
#
# Scans src/apm_cli/ daily for algorithmic performance anti-patterns and opens a GitHub Issue with findings
#
# gh-aw-metadata: {"schema_version":"v3","frontmatter_hash":"9540b93dbcfcc84ddf0ca18c81b0a736840a9a6517bfc634c0258941a709831e","compiler_version":"v0.65.6","strict":true,"agent_id":"copilot"}

Comment on lines +99 to +100
grep -rn --include="*.py" -E "if .+ in \[|\.count\(|\.index\(" src/apm_cli/ | \
grep -v "test_\|#\|isinstance" | head -60
Comment on lines +15 to +18
create-issue:
expires: 7d
title-prefix: "[perf-scan] "
labels: [performance, automated]
Comment on lines +985 to +989
runs-on: ubuntu-slim
permissions:
contents: read
issues: write
timeout-minutes: 15
Comment on lines +40 to +45
Every run creates exactly one GitHub Issue:
- Found findings: `[perf-scan] YYYY-MM-DD -- performance opportunities found`
- No findings: `[perf-scan] YYYY-MM-DD -- no issues found`

Labels applied: `performance`, `automated`.

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.

2 participants