perf(security-scan): scan concurrently and reuse unchanged results

Scans were sequential at ~29s per skill: 72 minutes for 150 skills against a
120-minute workflow timeout. Each scan is blocked on LLM network I/O rather
than local CPU, so the work parallelizes.

- Run skills through a thread pool (SKILL_SCAN_WORKERS, default 8), building
  one scanner per worker thread rather than sharing one, since the analyzers
  carry mutable per-scan state. Rate-limit retry with backoff already exists
  inside cisco-ai-skill-scanner, so concurrency is bounded, not retried here.
- Reuse findings for skills whose package contents are unchanged, keyed on a
  SHA-256 over file paths and bytes. Invalidate on scanner version change,
  model change, --full, or a 30-day backstop from the last full scan.
- Record per-skill content_hash and last_scanned in the JSON report, and
  disclose carried-forward findings in the markdown header, so a reused
  finding always shows when it was actually produced.
- Sort report entries by skill name so worker completion order does not churn
  the committed JSON.
- Lower the workflow timeout to 60 minutes; add a full_scan dispatch input.

Also fixes skills/genomic-intelligence/SKILL.md, whose unquoted description
contained a colon-space that made its YAML frontmatter invalid. The loader had
been rejecting it silently, so every scan covered 149 of 150 skills.
This commit is contained in:
Timothy Kassis committed 2026-07-25 15:11:47 -07:00
1 parent d77f819637
commit 665663cac1
5 files changed
+379 -46

No files matched your search

+15 -1
View File
@@ -4,6 +4,11 @@ on:
schedule:
- cron: "0 9 * * 1" # Every Monday at 09:00 UTC
workflow_dispatch: # Allow manual trigger
inputs:
full_scan:
description: "Rescan every skill, ignoring cached findings"
type: boolean
default: false
permissions:
contents: write
@@ -11,7 +16,11 @@ permissions:
jobs:
scan:
runs-on: ubuntu-latest
timeout-minutes: 120
# Scans run concurrently and reuse findings for unchanged skills, so a
# typical incremental run is minutes. The headroom is for a full rescan
# (triggered by a scanner/model change or the 30-day backstop) plus the
# scanner's own rate-limit retries.
timeout-minutes: 60
steps:
- uses: actions/checkout@v6
@@ -29,6 +38,11 @@ jobs:
env:
SKILL_SCANNER_LLM_API_KEY: ${{ secrets.SKILL_SCANNER_LLM_API_KEY }}
SKILL_SCANNER_LLM_MODEL: ${{ vars.SKILL_SCANNER_LLM_MODEL || 'claude-sonnet-5' }}
# Each skill scan is blocked on LLM network I/O, so concurrency is
# bounded by API rate limits rather than by the runner. Lower this if
# runs start hitting sustained 429s.
SKILL_SCAN_WORKERS: ${{ vars.SKILL_SCAN_WORKERS || '8' }}
SKILL_SCAN_FULL: ${{ inputs.full_scan && '1' || '' }}
run: uv run python scan_skills.py
# Gate: a scan that contradicts the contents of skills/ must not be