Skip to content

feat(pr-pipeline): add a daily lane sweep that files lane-run findings - #7857

Merged
kyle-sexton merged 5 commits into
mainfrom
feat/maintenance-audit-lane-runs
Oct 18, 2026
Merged

kyle-sexton merged 5 commits into
mainfrom
feat/maintenance-audit-lane-runs

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

No related issue: the owner approved a recurring lane sweep on 2026-10-17, after a manual pilot sweep filed #7833-#7839.

Summary

This PR adds maintenance-audit-lane-runs.yml, a daily lane sweep that turns the last 24 hours of lane runs and open PRs into needs-triage issues. It never labels an issue agent-ready, so nothing it files starts work. Auto-admission was dropped: in the pilot, 0 of 10 findings would have passed the protected-path rule.

Fix

The sweep runs as three jobs:

  • collect is a script that uses the job's read-only token. It writes at most 8 units of model work, within 350 REST calls:

    • slice A: failed runs from the 4 workflows that fail most, with failed jobs, annotations and log tails;
    • slice D: every run of the 2 busiest lane workflows, successes included;
    • slice C: open PRs by listed authors, 10 per unit.

    Runs from forks are excluded.

  • judge runs one sonnet leg per unit, on the triage-issue route's profile. The legs have read permissions only and run with --setting-sources user and --permission-mode dontAsk. They can read only their data directory and the main checkout, both in the workspace, and have no shell. Read access to /proc, /sys, dot files in the home directory and the runner's temp directory is denied. The output is structured JSON, at most 3 findings per leg, and each finding cites path, line and quote from main.

  • file is a script with no model that holds issues: write on the job's own GITHUB_TOKEN, so no broker or lanes App change is needed. It:

    • drops any finding whose quote is not on its cited line;
    • de-duplicates by fingerprint. The fingerprint hashes the slice, workflow, job and the error signature with numbers, SHAs and times removed. An open match gets a "seen again" comment, a match closed as not planned is skipped, and a match fixed in the last 14 days is filed again with a link to the fix;
    • files at most 5 issues per run, 1 s apart, within 50 calls.

    Model-written text renders inside code fences, and titles have links, mentions and references defused.

The org and repo kill switches stop every job.

Docs: docs/conventions/pr-pipeline/README.md has a new section, "The lane sweep", and CHANGELOG 2.6.0 records the change.

Verification

  • npm test in .github/scripts/maintenance-audit-lane-runs: 19 pass, 0 fail. Before the code existed the suites failed: the three modules were missing, and two security tests failed before their fixes. To confirm the tests can fail, I broke the fork filter, the < escaping and the judge permissions on purpose; the matching tests failed, then passed again once the code was restored.
  • actionlint and zizmor (offline) on the workflow found nothing. runner-policy.mjs --root . reports "Runner policy passed", so no runner-policy contract is needed: this lane calls no cross-repo reusable workflow.
  • Local hygiene gates all pass: killswitch-hoist, lane-coverage, read-caller-keys, app-key-references, silent-skips, line-citations, test-tmp-cleanup, purged-em-dashes, changelog-parity, docs-naming and convention-yaml.
  • A review:security-reviewer pass found 1 High, 1 Medium and 2 Low. Its verdict was safe to open as a draft, with merge blocked until the High is fixed.
    • High, fixed: bare Grep/Glob allow rules let the judge read outside its paths. They are dropped, the data moved into the workspace, and /proc, /sys, ~/.* and RUNNER_TEMP are denied, with a test.
    • Medium, fixed: model text could carry links or mentions into the issue. It is now fenced and the title defused, with a test.
    • Low, fixed: the dedup lookback is widened to 1,000 issues.
    • Low, accepted: the model can steer dedup or coverage and hide a finding. This affects availability only.

Related

  • The source: lane-sweep label does not exist yet. Labels are managed as code in github-iac Labels.cs, so until someone adds it there the filer applies only needs-triage.
  • Issues filed with GITHUB_TOKEN trigger no workflow, so intake triage does not run on them.
  • Slice B (ci-workflows, standards) is not included: the job token is scoped to this repository.
  • The sweep reuses the triage-issue route because a dedicated route would need a resolve-config code change.

🤖 Generated with Claude Code

kyle-sexton and others added 2 commits October 17, 2026 19:58
maintenance-audit-lane-runs.yml audits the last day of lane runs and
open PRs in three jobs: a collect script with a read-only token writes
at most 8 units within 350 REST calls; one read-only model leg per unit
returns structured findings that cite main by path, line and quote; a
file script with issues: write drops any finding whose quote is not on
its line, de-duplicates by fingerprint and files at most 5 needs-triage
issues within 50 calls. Model text renders inside fences. Nothing is
labeled agent-ready.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…t-lane-runs

# Conflicts:
#	docs/conventions/pr-pipeline/CHANGELOG.md
@kyle-sexton
kyle-sexton marked this pull request as ready for review October 18, 2026 00:00
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-18T00:02:04.362926Z 2031ea7 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2031ea7933

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 748aa2a47238c766dae24514188a800af10fd050: 0 finding(s), 0 as inline comments.

Security review (incremental, 827c401 → 748aa2a)

Scope: .github/scripts/maintenance-audit-lane-runs/file-findings.mjs and its test. I read .claude-lane/incremental.diff and the surrounding code. The protected-class register was not consulted because the diff changes no instruction surface.

Findings: 0.

The change moves the filing and commenting loop into an exported writeAll. Each write is now its own try/catch, and a failed write is recorded and the rest still run. main reports the failures in the step summary and sets a non-zero exit code.

  • Untrusted text in the step summary or ::error::: The new - failed ${f.target}: ${f.error} lines carry only a fingerprint (a hash) or #<issue number>. The error text comes from the thrown messages at file-findings.mjs:119 (${method} ${path}: HTTP ${status}) and collect.mjs:26 (the call-budget message). None of these include the model-authored title or body or the response body. The ::error:: line prints only a count. Model text still goes through inertTitle and inertLine as before, so there is no new markdown, mention or workflow-command injection path.
  • Failure handling: Continuing after a failed write cannot widen what is written. Writes use the same token, endpoints, 1 s pacing and call budget. Once the budget is exhausted, the later attempts throw before any request is made and are recorded as failures.
  • Comment and filing paths: The comment body and the issue title and body are built exactly as before.
  • Tests: The new test only injects a fake call.

@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed 748aa2a47238c766dae24514188a800af10fd050: 0 finding(s), 0 as inline comments.

Incremental review of file-findings.mjs and file-findings.test.mjs (changes since 827c401): no findings.

I checked the diff against the full file and createBudget in collect.mjs. I could not run the test file, because the sandbox denied node --test. The notes below come from reading the code.

  • Per-write error handling: writeAll wraps each issue POST and each comment POST in its own try/catch. A rejected write is recorded in failed and the loop continues.
  • Call budget: budget.spend() runs before the fetch inside call. If the budget runs out, each remaining write is recorded as failed without another network call, so the cap still holds.
  • Failure reporting: main reports commented from the comments that succeeded, not from the plan. It lists failed in the step summary, and when any write failed it logs ::error:: and sets process.exitCode = 1. The job turns red but the summary is still written.
  • Step summary: the failed lines hold a fingerprint or #number plus an error message that call builds from the method, path and HTTP status. No model text reaches them, so the inert-text handling that applies to titles does not apply here.
  • Test: writeAll takes wait as an injected argument, so the test needs no 1 s delay. By my trace, call 1 is the rejected title and throws. Call 2 files issue 102, call 3 is the comment on #7, and calls.length is 3. The asserted result matches. The check on body?.title assumes inertTitle("fix: rejected") leaves that title unchanged, which I did not confirm.

@melodic-automation-lanes melodic-automation-lanes Bot added the needs-human Human-in-the-loop required; autonomous sessions must not resolve items carrying this. label Oct 18, 2026
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor

The pr-unblock lane stopped on this pull request and needs a person: the merge stages a change under .github/workflows/, which the lane does not push.

  • Reason: workflow-staged
  • Resume key: 2031ea7933c1beeee18b80d6277df8d828bf2122 (the head the lane stopped on)

To resume, deal with the reason above, remove the needs-human label (and do-not-merge, if set), then dispatch the pr-unblock workflow with pr-number=7857 and activity=resolve-conflicts:

gh workflow run pr-unblock.yml -R melodic-software/claude-code-plugins -f pr-number=7857 -f activity=resolve-conflicts

kyle-sexton and others added 2 commits October 17, 2026 20:22
# Conflicts:
#	scripts/outside-node-packages.txt
…er dropped reasons inert

The judge prompt now carries the untrusted-content spine and citation and
says where an embedded imperative is reported. The step summary renders each
dropped finding's title and reason through one helper: one line, no code
spans, links, mentions or HTML.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each issue and comment write is caught on its own, recorded in the step
summary, and the remaining writes still run. The step exits non-zero at the
end when any write failed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kyle-sexton
kyle-sexton added this pull request to the merge queue Oct 18, 2026
Merged via the queue into main with commit 8af85ab Oct 18, 2026
29 checks passed
@kyle-sexton
kyle-sexton deleted the feat/maintenance-audit-lane-runs branch October 18, 2026 00:35
kyle-sexton added a commit to melodic-software/ci-workflows that referenced this pull request Oct 18, 2026
Refs: #772

## Summary

Events created with a job's `GITHUB_TOKEN` start no workflow run, except
`workflow_dispatch` and `repository_dispatch` ([GitHub docs,
GITHUB_TOKEN](https://docs.github.com/en/actions/concepts/security/github_token):
"`workflow_dispatch` and `repository_dispatch` events always create
workflow runs"). The claude-code-plugins lane sweep files `needs-triage`
issues with that token, so those issues never reach intake. This lets a
caller dispatch the lane for one issue.

Stacked on #773 (base `fix/intake-author-id-gate`); retarget to `main`
after it merges.

## Fix

Input shape (stable; the sweep-side dispatch will be written against
it):

- Caller trigger: `workflow_dispatch` with one input, `issue-number`
(string, decimal digits), passed through as the reusable's
`issue-number` input. Nothing else is read from the dispatch.
- Gate: a dispatch run starts only when `inputs.issue-number` is
non-empty and the dispatching actor's numeric id (`github.actor_id`) is
in `allowed-author-ids` (non-bot actor) or `allowed-bot-sender-ids`
(actor ending `[bot]`), with the same malformed-list guards. Dispatching
already needs write access; a stranger still cannot start a run. For a
sweep that dispatches with its `GITHUB_TOKEN`, the caller lists
`github-actions[bot]`'s id `41898282` (or the lanes App's id) in
`allowed-bot-sender-ids`; only that bot's login reaches `allowed_bots`.
- A new `Resolve the issue` step reads the issue from the API
(`issues.get`) by the event's number or the validated input
(`^[1-9][0-9]{0,9}$`), refuses a pull request, and supplies the number
and node id every later step uses, in place of `github.event.issue.*`.
- The reject step now accepts `issues` and `workflow_dispatch`; the
skipped job also reports a rejected dispatch (notice and summary only,
no label).

## Verification

- `node --test .github/scripts/*.test.cjs`: 437 pass, 0 fail. New cases:
a listed person or `github-actions[bot]` dispatch starts a run; an
unlisted actor, a person's id in the bot list (and the reverse), a
missing actor id, an empty issue number and malformed lists start
nothing; the issue is resolved by a validated number.
- `actionlint` clean; `zizmor --offline`: no findings.
- Left out: a live dispatch run. Unverified: that `github.actor` is
`github-actions[bot]` when a `GITHUB_TOKEN` sends the dispatch, and that
claude-code-action's agent mode runs on `workflow_dispatch` with
`allowed_bots` set this way. Both need one live dispatch before the
sweep relies on it.

## Related

- #773, the author-id gate this builds on.
- melodic-software/claude-code-plugins#7857, the sweep that files issues
with a `GITHUB_TOKEN`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_019bQ8pL7fJgVy7YjQ7wK1Zw

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-human Human-in-the-loop required; autonomous sessions must not resolve items carrying this.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant