This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch 
investigate-and-fix-camel-23932-ensure-ai-agents
in repository https://gitbox.apache.org/repos/asf/camel.git

commit c7ae4c847812b02c73e469cf1f5ce6c46cf689e7
Author: Guillaume Nodet <[email protected]>
AuthorDate: Fri Jul 31 11:32:47 2026 +0200

    CAMEL-23932: Auto-delete stale branches and enforce fork usage for AI 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 <[email protected]>
---
 .github/workflows/pr-cleanup-branches.yml | 5 +++--
 AGENTS.md                                 | 9 +++++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/pr-cleanup-branches.yml 
b/.github/workflows/pr-cleanup-branches.yml
index 3871f49af0df..292e5fe1d976 100644
--- a/.github/workflows/pr-cleanup-branches.yml
+++ b/.github/workflows/pr-cleanup-branches.yml
@@ -26,11 +26,12 @@ permissions:
 
 jobs:
   cleanup:
-    name: Delete automated branch
+    name: Delete PR branch
     if: >-
       github.repository == 'apache/camel'
       && github.event.pull_request.head.repo.full_name == 
github.event.repository.full_name
-      && startsWith(github.event.pull_request.head.ref, 'automated/upgrade')
+      && github.event.pull_request.head.ref != 'main'
+      && !startsWith(github.event.pull_request.head.ref, 'camel-')
     runs-on: ubuntu-latest
     steps:
       - name: Delete branch
diff --git a/AGENTS.md b/AGENTS.md
index 3c1844ec279c..501558871658 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -36,9 +36,14 @@ These rules apply to ALL AI agents working on this codebase.
 - An agent MUST NEVER push commits to a branch it did not create.
 - If a contributor's PR needs changes, the agent may suggest changes via 
review comments,
   but must not push to their branch without explicit permission.
-- An agent should prefer to use his own fork to push branches instead of the 
main apache/camel repository. It avoids to fill the main repository with a long 
list of uncleaned branches.
+- An agent MUST use its own fork to push branches instead of the main 
apache/camel repository.
+  Pushing directly to the upstream repo fills it with stale branches that 
waste CI time and disk
+  space for all contributors. A `pr-cleanup-branches.yml` workflow deletes 
non-protected branches
+  when their PR is closed, but using a fork avoids the problem entirely.
 - An agent must provide a useful name for the git branch. It should contain 
the global topic and issue number if possible.
-- After a Pull Request is merged or rejected, the branch should be deleted.
+- After a Pull Request is merged or rejected, the branch MUST be deleted. The
+  `pr-cleanup-branches.yml` workflow handles this automatically for branches 
pushed directly to
+  `apache/camel`, but agents using forks must delete their remote branch 
manually.
 
 ### JIRA Ticket Ownership
 

Reply via email to