Repository navigation
perf(security): fetch once per run instead of once per item - #1443
Merged
Merged
Conversation
The security skills re-ran the same reads per candidate, per tracker or per finding. They now fetch each shared set once and reuse it, without changing which items are processed or how each one is decided. Every batched list call keeps an explicit --limit and says what to do when the cap is hit. - security-issue-import: each mail thread is read in full once (Step 2a) and reused by Steps 3-4. Step 7 keeps one fresh read, because a draft or reporter reply can land between scan and apply (4 reads per candidate -> 2). The semantic-sweep list, the collaborator list and the rejections-ledger number are fetched once per run. Thread-id dedup searches run 6 ids per query. - security-issue-import-from-md sets labels at creation (one call per finding instead of two). security-issue-import-from-pr's two duplicate searches are one. security-issue-import-from-scan fetches the open-tracker list once for all findings. - security-issue-triage gathers body, comments and linked PRs for up to 20 trackers per GraphQL query instead of one `gh issue view` each. - security-issue-invalidate `invalidate proposed`: one GraphQL query per 20 matches replaces a reactions call plus an issue view per tracker. The list limit is aligned with triage (1000, stop when capped). - security-issue-sync reads each surface once per run: linked PRs in one query, PR authors from that result, and the hand-off comment and milestone bullet from the first issue read (3 calls -> 1 and 4 calls -> 0). - security-issue-fix: one collaborator list per run. security-issue-deduplicate: no redundant existence probes. security-cve-allocate: no title re-fetch. security-model-verify: one query for every repository's AGENTS.md and SECURITY.md. workflow-security-audit: zizmor runs over up to 50 repositories per invocation, and a failed batch is re-run per repository so a failure is never reported as clean. - security-tracker-stats-dashboard takes issue bodies and linked PRs from the one list call instead of one `gh issue view` per issue, and warns when the list hits its cap. Along the way, several `gh` calls wrapped in `$(…)` or piped were made plain commands, which the secure setup needs. import Step 2c also asked `gh search prs` for a `mergedAt` field that does not exist, and used GNU-only `date -d`. Generated-by: Claude Code (Opus 5.5)
…on budget (#1447) Eight security skills spent 203-291 tokens on `description` + `when_to_use`, which load in every session whether the skill runs or not. Each now states its purpose, its main trigger phrases and where to route instead, in about 100-130 tokens, leaving the procedure and the rationale to the body. security-issue-fix no longer says public PR content must not link back to the tracker, in its description or its golden rules: tracker identifiers are public-safe per AGENTS.md, as long as no security framing surrounds them, and the skill's own 5c rule already says so. The family's always-on total drops from ~1.6k to ~1.1k tokens (docs/setup/marketplace.md updated). Generated-by: Claude Code (Opus 5.5)
potiuk
force-pushed
the
perf/security-batch-fetches
branch
from
September 28, 2026 08:56
2e29d5b to
0866825
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Seventh PR in the security family stack (#1344): the optimize-skill fetch-upfront pass.
Summary
The security skills re-ran the same reads per candidate, per tracker or per finding. They now fetch each shared set once per run and reuse it. The set of items processed and the per-item decisions are unchanged. Every batched list keeps an explicit
--limitand says what to do when the cap is hit.gh issue view→ one GraphQL query per 20 trackers (body, comments, linked PRs)proposedAGENTS.md+SECURITY.mdfor every repository in one querygh issue viewper issue → 0. Warns at the list cap.Deliberately kept per item:
Along the way:
ghcalls wrapped in$(…), piped intojq, or redirected are now plain commands. Under the secure setup a wrappedghstays sandboxed and fails.gh search prsfor amergedAtfield it does not have, and computed its date with GNU-onlydate -d.Test plan
prek run --all-files, including lychee;skill-and-tool-validate(--limitrule);check-placeholderstools/security-tracker-stats-dashboard: 142 testsstep-2a/case-3-same-reporterflipped to failing on the first after-run. Its output spec said a reporter-identity hit needs the address to match, while the skill matches on the local-part. The fixture's addresses share a local-part across different domains, so small wording changes flipped the verdict. The spec now states the skill's local-part rule, and the case passes 3/3.step-3/case-2flipped once and passed 3/3 on re-run: noise.Part of #1344.
Generated-by: Claude Code (Opus 5.5)
🤖 Generated with Claude Code