feat(janitor): unmergeable_pr_rebase rule — auto-rebase when no event fires #783
No reviewers
Labels
No labels
area:agents
area:dashboard
area:database
area:design
area:design-review
area:flows
area:infra
area:meta
area:security
area:sessions
area:webhook
area:workdir
security
type:bug
type:chore
type:meta
type:user-story
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
charles/claude-hooks!783
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "code-lead/781"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #781.
Summary
Adds janitor rule
unmergeable_pr_rebasethat closes the no-event gap on Forgejo: when a PR'smergeableflag flips tofalseoutside of apull_request closed && merged=true(push to base outside a merge, force-push, dependency landing elsewhere), nothing currently dispatches a rebase. The rule sweeps open PRs each janitor pass and dispatches via the same path ashandlePostMergeRebase.Design
_ALL_RULESandreconcileOnce.mergeable !== false, non-agent authors, and any PR that declares parents (those defer tohandlePostMergeRebase's parent-merge cascade — avoids racing the stacked-rebase serialisation)._postMergeRebaseDispatchedmap. Two paths (event-driven + janitor sweep) cannot double-dispatch within the 10-minute window.handlePostMergeRebaseintodispatchPrRebaseso both call sites share the skill loader, B10 watchdog tagging, A3 label resolution, and dedup.implseam so tests swap the dispatcher / dependency-graph reader / agent resolver withoutmock.module(which is process-global in Bun).Test plan
mergeable=false+ agent author + no parentsmergeable=truedispatchPrRebaseis a silent skip (noJanitorActionemitted)post-merge.test.ts,event-handlers.test.ts) still pass through the refactored helper — 100/100just qaclean (3 pre-existingsession JSONL pruningfailures onmainare unrelated)