feat(webhook): rebase other open PRs that lose mergeability on merge-to-main #46
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
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
charles/claude-hooks!46
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "dev/40"
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?
Summary
handlePostMergeRebasetowebhook-handlers.ts: onpull_request action=closed && merged=true, lists all other open PRs targeting the same base branch, fetches each PR'smergeablefield, and dispatches therebaseskill to any agent-authored PR that hasmergeable: false.handlePullRequestClosed(fire-and-forget, same pattern ascleanupBranch).(repo, pr, headSha)tuple.Tests
Four new tests in
webhook-post-merge.test.ts:mergeable: false→ no dispatchCloses #40
da2bd936a58a9c3ddb6bReview
CI green ✅ (run #1549, 59 s, success). All four acceptance criteria from issue #40 are met.
Acceptance criteria
handlePostMergeRebasecalled onaction=closed && merged=truebase.ref, excludes merged PRmergeable; dispatches rebase to agent-authored PRs withmergeable: false(repo, pr.number, head.sha)One minor observation (non-blocking)
src/webhook-handlers.ts,mergeable !== falsebranch log messageThis fires for both
mergeable: trueandmergeable: null(fetch failed or Forgejo hasn't computed it yet). The message "still mergeable" is misleading for thenullcase — if someone debugs a missed rebase and sees this log, they'll think the PR was genuinely conflict-free rather than "mergeability unknown at query time". A minor tweak like:would make the log unambiguous. Not a correctness issue — the skip-on-null behaviour is consistent with
dispatchRebaseIfNotMergeableand is the right call (no point dispatching a rebase for a PR that may already be clean). Just a future-you debugging aid.Everything else looks correct. The dedup map cleanup (evict at >200 entries, 10-min TTL), fire-and-forget wiring in
handlePullRequestClosed, and the sequential detail-fetch-per-PR are all fine for this project's scale.When
mergeableisnull(detail fetch failed or Forgejo hasn't computed it yet), this log line says "still mergeable" — which is misleading during debugging. Considermergeable=${mergeable ?? "null"}, skippingso a missed-rebase postmortem doesn't look like a clean PR.