CAMEL-23932: Auto-delete stale branches and enforce fork usage for AI agents - #25275
Merged
gnodet merged 2 commits intoJul 31, 2026
Merged
Conversation
… agents Expand pr-cleanup-branches.yml to delete any non-protected branch pushed directly to apache/camel when its PR is merged or closed. Previously the workflow only covered `automated/upgrade*` branches, leaving backport/*, feature/*, fix/*, regen_bot_*, investigate-and-fix-*, and other patterns to accumulate indefinitely. Protected patterns excluded: `main`, `camel-*.x`. Also strengthen CLAUDE.md/AGENTS.md fork-preference from "should" to "MUST" so AI agents are clearly instructed to use their own forks rather than pushing directly to the upstream repo. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
apupier
requested changes
Jul 31, 2026
Comment on lines
+33
to
+34
| && github.event.pull_request.head.ref != 'main' | ||
| && !startsWith(github.event.pull_request.head.ref, 'camel-') |
Contributor
There was a problem hiding this comment.
regen_bot_sbom must be kept too, see comment #25115 (comment)
The regen_bot_sbom branch is a persistent branch reused across multiple PRs by the regen bot — deleting it would break the bot. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Author
apupier
approved these changes
Jul 31, 2026
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.
Summary
Addresses CAMEL-23932 — AI agents push branches directly to
apache/cameland fail to clean them up after PRs are merged or closed.Changes
Expanded
pr-cleanup-branches.yml: The workflow now deletes any non-protected branch pushed directly toapache/camelwhen its PR is merged or closed. Previously it only matchedautomated/upgrade*, leavingbackport/*,feature/*,fix/*,investigate-and-fix-*,dependabot/*,dependency/*,ci/*, and ad-hoc AI agent branches to accumulate indefinitely.Protected patterns excluded from cleanup:
maincamel-*(all maintenance branches likecamel-4.14.x,camel-4.18.x, plus legacycamel-1.x/camel-2.x/camel-3.x)regen_bot_*(persistent branches reused by the regen bot across multiple PRs)Strengthened CLAUDE.md/AGENTS.md: Changed fork-preference from advisory "should prefer" to mandatory "MUST use". Also upgraded branch deletion from "should be deleted" to "MUST be deleted", with a note that the workflow handles it automatically for upstream branches.
Stale branches found during investigation
These branches exist on
apache/camelwith their PRs already merged or closed:backport/25036-to-camel-4.14.xbackport/25036-to-camel-4.18.xfeature/CAMEL-24259-tui-tabs-and-inline-docsregen_bot_3xfix-camel-24227-add-volatile-to-jmx-writable-fielfix/CAMEL-24140investigate-and-fix-flaky-aws-eventbridge-localstaThese will need to be deleted manually (the workflow only triggers on future PR close events).
Test plan
actionlintor GitHub Actions validation)apache/cameland verify the branch is auto-deletedmain,camel-*.x, andregen_bot_*branches are never affectedClaude Code on behalf of gnodet
🤖 Generated with Claude Code