Skip to content

Make the CVE fix bot behave like the old kumo-ai bot - #590

Draft
anle2024 wants to merge 3 commits into
mainfrom
anle/cve-fix-bot-batch
Draft

anle2024 wants to merge 3 commits into
mainfrom
anle/cve-fix-bot-batch

Conversation

@anle2024

@anle2024 anle2024 commented Dec 3, 2026 •

Copy link
Copy Markdown
Collaborator

Design discussion or issue: none. This PR follows the request to make the CVE fix bot behave like the old kumo-ai fix bot.

Old bot: kumo-ai/.github/.github/workflows/fix-dependabot-alerts.yml

The first commit in this PR gave each run one dependency file. The second commit replaces that change. The third commit adds the daily replace. The PR diff has only the changes below.

Summary

This PR makes the CVE fix bot behave like the old kumo-ai fix bot. Claude gets the old bot's instructions and fixes all open Dependabot alerts, Trivy findings and code scanning alerts in one run, with no turn limit. Each daily run rebuilds the bot PR from the latest main and replaces it, as the old bot did.

Why

The old bot is the reference design for this bot. Our bot used different prompt wording, a 100-turn limit and the npm 5-day wait. It also skipped the daily run while a bot PR was open. A skipped day leaves the bot PR on an old main, so its fixes can go stale and new alerts wait. The old bot rebuilt its PR every day instead.

Before and now

Part Before (main) Now (this PR)
Prompt text Our own wording The old bot's wording for the fix prompt and the CI fix prompt
Turn limit 100 turns No turn limit. The 45-minute step timeout still applies.
npm wait for new releases 5 days, from the repo .npmrc Off for the Claude step (NPM_CONFIG_MIN_RELEASE_AGE=0), as in the old bot
Code scanning input Alert number, severity and link. Claude reads each alert with an API call. Also the rule, file, lines and message, as in the old bot
PR body Fixed findings and findings not fixed, with the reason Fixed alerts only, as in the old bot
Daily run with an open bot PR The run does nothing The run fixes all alerts again from the latest main and replaces the bot branch with one signed commit. It updates the PR title, body and change map, and starts new CI fix rounds.
Bot PR merges or closes during the daily run Not possible, because the run did nothing while a bot PR was open The run stops and opens no PR. The next daily run starts from the new main.
Bot PR that people changed Not checked The daily run does not replace a draft bot PR or a PR that a person opened. It also keeps a PR that has a commit from a person, written or rewritten. The bot then posts one comment that says so, and it posts that comment only once for each PR.
CI fix rounds from an older run Keep running Each round carries the head commit that it expects and reads the branch head from git. If a newer bot run replaced the PR, the round stops without any comment, push or auto-merge.
Jobs that change the PR Run in parallel The publish, merge-or-comment and report-failure jobs share one concurrency group with queue: max, so they wait for each other and none is dropped. Each job reads the branch head before it changes the PR. Publish also reads the PR state right before its push.
Auto-merge Turned on after all checks pass Turned on only for the head commit that passed (--match-head-commit). The daily replace turns off auto-merge from the day before, before and after its push.
Failure comment Any failed run comments "A human needs to finish this PR" on the open bot PR Only a run that pushed to the PR or still owns its head commit posts it

What stays from our flow

Some parts of the old bot cannot work in this repo, so they stay as they are:

  • The workflow commits through the GitHub App, so the commits are signed. copy-pr-bot holds back unsigned commits until someone comments /ok to test.
  • The PR opens as ready, because copy-pr-bot does not run CI on draft PRs here.
  • The CI fix rounds run as separate workflow runs. GitHub stops a job after 6 hours at most, and one job with 5 fix rounds can need more than that. Each new run also gets a new App token, which lasts 1 hour.
  • Claude writes the change map, because the PR change table check fails without it.
  • The daily run does not replace commits that people pushed to the bot PR. The old bot overwrote them.
  • The CI fix rounds and the daily run can overlap, so they check the branch head before each change. The old bot ran as one job and did not need this.

Trade-off

  • A run makes one large PR. The last successful run made a PR with 18 files and about 8,000 changed lines.
  • Each daily replace removes approvals and restarts CI. A reviewer must approve the PR on the same day, after its CI passes and before the next run at 00:17 UTC.
  • The daily run calls Claude every day while a bot PR is open. The last three runs cost $4.99, $5.42 and $7.58.
  • If a person clicks "Update branch" or pushes to the bot PR, the bot stops working on that PR. A person must finish it or close it.
  • The daily run reads the branch again right before its push. A person's push in the short time between that read and the push can still be lost. GitHub has an atomic call for this, GraphQL updateRefs. I found no documentation that it starts CI like a normal push, so the bot does not use it.
  • With no turn limit, the 45-minute step timeout is the only limit. The last successful run took 40 minutes. If Claude needs more than 45 minutes, the run loses its work.
  • With the npm wait off, Claude can install an npm release that is minutes old. The uv 7-day wait in pyproject.toml still applies.
  • The PR body no longer lists the alerts that Claude did not fix.

Change map

See the change-map comment on this PR.

Testing Done

  • node --check and yamllint with .yamllint.yml: no findings.
  • actionlint 1.7.12, the latest release, with shellcheck: no findings except unexpected key "queue". GitHub documented queue for concurrency groups on 2026-05-06, after that actionlint release.
  • workflow-security.cjs: 0 new findings.
  • A local script ran plan with mock API calls, the 195 open Dependabot alerts and the 26 open code scanning alerts. plan wrote 221 findings. All 26 code scanning findings have the rule, file, lines and message. The rendered task.md has the old bot's wording.
  • A local test ran plan and publish against a fake GitHub API and a real git repository in 35 cases. The cases cover the first run, the daily replace, a PR that merges or closes during the run, drafts, and changes from people. They also cover rounds from an older run, a branch that moves right before the push, and the one-time comment. The rest cover a deleted branch, merge, fix, and the change-map-only round. All 35 pass.
  • The shell steps of merge-or-comment and report-failure ran with a stub gh in 14 cases, including a missing branch (404) and an API error. All 14 behave as intended.
  • A review with 5 independent reviewers found 9 defects in the first version of the daily replace. For each defect, at least 2 of 3 separate checkers agreed that it is real. A second review found 13 smaller ones in the fixes. This version fixes all 22, and a third review looked at the last fixes.
  • Not tested: a live run. The workflow runs only on main, so the next run after merge is the test.

Hotfix Context

Not a hotfix.

Checklist

  • I listed all the breaking changes introduced by the PR (none)
  • I made sure to update examples and documentation with my changes (if necessary)
  • I have added and modified unit tests required to cover changes made by this PR.

🤖 Generated with Claude Code

The bot gave one Claude run all 403 open findings: 57 package upgrades in
10 dependency files and 26 CodeQL alerts. Claude has 100 turns, so the
first run stopped at 53 turns and the second run hit the turn limit. Both
runs opened no PR.

Each run now fixes at most 10 packages in one dependency file, with the
highest severity first. Dependabot and Trivy findings for the same package
and file become one item. CodeQL alerts are no longer bot input, because
they are code issues and not CVEs.

If Claude stops early, the workflow now keeps the part that Claude
finished when the change map exists. Claude updates the change map after
each package.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@copy-pr-bot

copy-pr-bot Bot commented Dec 3, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@anle2024
anle2024 temporarily deployed to gha-kumo-workflow-tests December 3, 2026 01:38 — with GitHub Actions Inactive
@coderabbitai

coderabbitai Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

Parsing warnings: 1

Validation error: Unrecognized key: "tone_instructions" at "reviews"
Configuration instructions

  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
Pre-merge checks: Passed 2 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Change Map Design Review Warning ## Summary I read the change-map comment (id 7364563983, marker <!-- kumo-pr-change-map -->). I checked its rows against commits 0253216, bd4130d and 61fb8d7 (.github/scripts/cve-fix-bot.cjs and `… Revise the change map and, where needed, the design. Each item is a concrete correction. 1. npm wait. Either (a) cite the observed failure that requires the wait to be off, and scope the change to the packages that need it. Or (b) keep …
Passed Passed checks: 2 passed

Check name Status Explanation
Pr Size Passed The PR size check passes. This PR changes 2 files, which is at or below the threshold of 40. Evidence: - The PR head is 61fb8d7 on anle/cve-fix-bot-batch. The provider-reported PR is NVIDIA/kumo-engin…
Public Resource Access Passed The check passes because this pull request adds or changes no external resource reference (no URL, public repository location, or package source location). Scope: The PR's own commits are 0253216, bd4…
Full details: Pr Size

Explanation

The PR size check passes. This PR changes 2 files, which is at or below the threshold of 40. Evidence: - The PR head is 61fb8d7 on anle/cve-fix-bot-batch. The provider-reported PR is NVIDIA/kumo-engine #590, and its author is anle2024. - The PR adds three commits: 0253216, bd4130d and 61fb8d7. Each commit changes the same two files: .github/scripts/cve-fix-bot.cjs and .github/workflows/cve-fix-bot.yml. The combined diff 0253216^..HEAD shows 2 files changed (241 insertions, 67 deletions). - A three-dot diff against the local origin/main (868c074) shows 155 files. I do not count that result. The local origin/main ref is stale. The PR head contains 10 commits that are not in that ref. Those commits are dated earlier than the bot commits and have squash-merge subjects such as "(#586)" and "(#588)". They are merged work from other PRs, not changes made by this PR. The PR description also says the PR diff has only the bot changes. Limitation: I could not query the GitHub PR diff directly. The file count of 2 comes from the commit history. The PR base is assumed to include the #585 to #588 merges. If the provider reported a different count, the provider value should replace this one. The threshold is still far from the 2-file result. No split recommendation is needed because the check passes.

Full details: Public Resource Access

Explanation

The check passes because this pull request adds or changes no external resource reference (no URL, public repository location, or package source location). Scope: The PR's own commits are 0253216, bd4130d and 61fb8d7, on top of base f73f29e (git diff --name-status f73f29e HEAD). They modify only .github/scripts/cve-fix-bot.cjs and .github/workflows/cve-fix-bot.yml. I checked all 231 added lines in those files for http(s)://, github.com, pypi, npm, uses:, curl/wget, registry and package-manager references, and domain-like strings. None were found. Existing references were not changed. The Trivy install URL (raw.githubusercontent.com/aquasecurity/trivy/...), the actions/* pins and the anthropics/claude-code-action pin already existed before this PR. They are not added or modified in this range. Added gh api, gh pr and gh workflow run calls use $GITHUB_REPOSITORY and branch variables. They are runtime API calls on the repository that runs the workflow, not static public references. The PR description's links to kumo-ai and PR #530 appear only in prose, not in changed code. Scope caveat: git diff 868c074 HEAD shows 155 changed files. Those come from 10 commits that the local branch carries above origin/main, which are not part of this PR's three commits. The PR description also says the PR diff has only the listed changes. I did not evaluate those other commits, because the check covers only references this PR adds or changes.

Full details: Change Map Design Review

Explanation

Summary I read the change-map comment (id 7364563983, marker &lt;!-- kumo-pr-change-map --&gt;). I checked its rows against commits 0253216, bd4130d and 61fb8d7 (.github/scripts/cve-fix-bot.cjs and .github/workflows/cve-fix-bot.yml). The map covers the file list. It does not state several material behaviors that the diff creates. It also has no verification or stopping-condition statement, and it removes a supply-chain control with no observed failure cited. The check fails on these omissions. ## Proven issues 1. npm release-age control removed without a cited failure. The workflow sets NPM_CONFIG_MIN_RELEASE_AGE: "0" on the Claude step (fix job, about line 179). The repo has ui/.npmrc and packages/kumo-ui-catalog/.npmrc, and both set min-release-age=5. The env override therefore disables the 5-day wait for every npm lockfile edit in those packages. The map's workflow row says only that the step must "match the old bot's limits." It does not name the risk. It also does not name the observed failure that the wait blocked, such as a patched version younger than 5 days. Without that evidence, the map does not show necessity or preserved behavior. 2. Step timeout and lost work are omitted. The map removes --max-turns 100. The Claude step still has timeout-minutes: 45, and the fix job has no turn limit. The PR description says a run that exceeds 45 minutes loses its work, and that the last successful run took 40 minutes. The map does not state this limit or its consequence. 3. PR body reporting change is omitted. The fixTask diff now asks only for a list of fixed alerts. The earlier prompt also required a list of unfixed findings with reasons. The map row says only "use the old kumo-ai bot's wording." Reviewers cannot see that open findings are no longer reported in the PR body. 4. Daily replace trade-offs are omitted from the map. The map says publish "force-replaces the branch" and turns off auto-merge. It does not say that each daily replace removes approvals and restarts CI. The PR description states both effects, and they change review workflow. 5. No verification or stopping condition in the map. The map lists changes and reasons. It does not list the tests or local checks used for the daily replace, the race handling, or the notify path. The PR description has a 35-case fake-API test and a 14-case stub test. Neither appears in the map. 6. Minor inaccuracy. The map says later rounds "read the head from git." The code uses process.env.HEAD_SHA || branchHead, so the head comes from the round input. Git is read only to detect movement (moved). ## Uncertain design questions (not proven defects) - Overlap guards may be avoidable. The old skip-while-open rule prevented overlap between the daily run and CI fix rounds. Removing it adds about 200 lines of guards (botOwns, branchHead checks, the notify path, the shared concurrency group). The map does not compare a smaller option, such as keeping the skip while a round is active. The map should justify this complexity against that option. - No-findings case leaves a stale bot PR. In plan, round 0 returns skip when count is 0, before it touches an open bot PR. An open bot PR stays on an old main, which conflicts with the "rebuild every day" design the map cites. The map does not say whether that is intended. ## What checks out - queue: max is documented for concurrency (checked against the GitHub Actions syntax page). The actionlint note in the PR description does not indicate a defect. - The shared group cve-fix-bot-pr-writes appears on merge-or-comment, publish and report-failure, as the map states. - botOwns, the once-only reportOthersChanged comment, --match-head-commit, and the 404 handling in report-failure match the map. - codeScanningFindings adds the rule, file, lines and message, as the map states.

Resolution

Revise the change map and, where needed, the design. Each item is a concrete correction. 1. npm wait. Either (a) cite the observed failure that requires the wait to be off, and scope the change to the packages that need it. Or (b) keep min-release-age in force and add a narrow exception. In either case, state in the map that the env override disables ui/.npmrc and packages/kumo-ui-catalog/.npmrc min-release-age=5 for the Claude step, and name the supply-chain risk. The uv 7-day wait is unaffected and should be noted. 2. Timeout. Add a row or note: the 45-minute Claude step timeout is the only limit, and a timeout loses the run's work. Give the observed run time (40 minutes) as evidence. 3. PR body. State that the PR body now lists only fixed alerts. Note that unfixed findings are no longer reported there, and say whether that is intended. 4. Daily replace effects. State that each daily replace removes approvals and restarts CI, and that auto-merge is turned off before and after the push. 5. Verification. Add a short verification section: the local tests run, their case counts, and the stub gh tests. Add an explicit stopping condition for the daily run and for CI rounds. 6. Wording. Change "read the head from git" to "use the head input, then compare it with git." 7. Design questions. Answer both uncertain items above in the map: why the overlap guards are needed instead of a smaller option, and what happens to an open bot PR when a run finds no alerts.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@anle2024

anle2024 commented Dec 3, 2026 •

Copy link
Copy Markdown
Collaborator Author

Change map

File Function / scope What changed Why
.github/scripts/cve-fix-bot.cjs fixTask, ciTask, codeScanningFindings, botOwns, reportOthersChanged, disableAutoMerge, plan, publish, branchHead, OTHERS_CHANGED fixTask and ciTask use the old kumo-ai bot's wording, and codeScanningFindings adds the rule, file, lines and message. botOwns checks that the bot opened the PR, that it is not a draft, and that every commit in main...head is the bot's. reportOthersChanged posts the "someone else changed this PR" comment once for each PR. plan round 0 now rebuilds an open bot PR that the bot owns and passes the PR number on. Later rounds read the head from git. If a newer bot run replaced the PR, they stop silently. If someone else changed it, plan returns the notify action. If the open PR differs from the one plan saw, publish stops. Right before the push, it reads the branch and the PR again. In round 0 it force-replaces the branch, turns off auto-merge before and after the push, and updates the open PR. It sets the pushed and next_head outputs. The bot must behave like the old kumo-ai bot, which rebuilt its PR every day. Rounds from an older run, a merge during the run, and changes from people must not lead to a wrong push, comment or auto-merge.
.github/workflows/cve-fix-bot.yml workflow_dispatch inputs, concurrency, env, plan, merge-or-comment, fix, publish and report-failure jobs Adds the head input and uses it in the run concurrency group for rounds above 0. Adds BOT_LOGIN. Moves auto-merge and the stop comment from plan into the new merge-or-comment job, which also posts the notify comment once. That job checks the branch head first and uses --match-head-commit. publish, merge-or-comment and report-failure share the concurrency group cve-fix-bot-pr-writes with queue: max. If the run did not push and does not own the branch head, report-failure posts no comment. A 404 on the branch ref means that the branch is gone, and other read errors fail the step. Passes next_head to the next round. Removes --max-turns 100 and sets NPM_CONFIG_MIN_RELEASE_AGE to 0 for the Claude step. Each round must know which head it works on, and jobs that change the PR must not interleave or be dropped. The Claude step must match the old bot's limits.

This replaces the batching in the previous commit. The CVE fix bot now
gives Claude the same instructions as the old kumo-ai fix bot
(fix-dependabot-alerts.yml). Claude gets all open Dependabot alerts,
Trivy findings and code scanning alerts in one run, with no turn limit.
The npm wait period for new releases is off for the Claude step, as in
the old bot.

The workflow still commits through the GitHub App, so commits stay
signed and copy-pr-bot runs CI without /ok to test. The PR still opens
as ready, the CI fix rounds stay, and Claude still writes the change map.

Code scanning findings now include the rule, file, lines and message,
because the old prompt reads them from the findings file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@anle2024
anle2024 temporarily deployed to gha-kumo-workflow-tests December 3, 2026 06:44 — with GitHub Actions Inactive
@anle2024 anle2024 changed the title Give the CVE fix bot one dependency file per run Use the old kumo-ai bot's prompts in the CVE fix bot Dec 3, 2026
The daily run no longer skips an open bot PR. It fixes all alerts again
from the latest main, force-replaces the bot branch with one signed
commit, updates the PR, and starts new CI fix rounds. If the PR merges
or closes during the run, the run stops and the next daily run starts
from the new main.

The bot does not replace a draft PR, a PR that a person opened, or a PR
with a commit that a person wrote or rewrote. For a person's change, it
posts one comment that says so. Each CI fix round carries the head
commit that it expects, so a round from an older run stops when the PR
was replaced.

Jobs that change the PR share one concurrency group with queue: max and
read the branch head first. Auto-merge is turned off around the daily
push and turned on only with --match-head-commit. report-failure
comments only when the run still owns the PR head.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@anle2024
anle2024 temporarily deployed to gha-kumo-workflow-tests December 3, 2026 09:42 — with GitHub Actions Inactive
@anle2024 anle2024 changed the title Use the old kumo-ai bot's prompts in the CVE fix bot Make the CVE fix bot behave like the old kumo-ai bot Dec 3, 2026

This branch was previously deployed

1 inactive deployment
gha-kumo-workflow-tests — 61fb8d7c Deployed Dec 3, 2026 by anle2024 via import #3600
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.

1 participant