Forgejo: re-check agent PRs for conflicts when their base branch is pushed #90

Merged
lucas merged 1 commit from agent/issue-89-base-push-conflicts into main 2026-10-26 16:19:02 +01:00
Collaborator

Implements the plan in #89.

  • webhook.ts: push deliveries to refs/heads/* are accepted as a repo-level pushed row (number 0), including the agent's own pushes; tag pushes and branch deletions are ignored.
  • dispatch-api.ts: PullSummary gains mergeable / baseBranch; new listOpenPulls (state=open, also filtered client-side).
  • dispatcher.ts: handleBasePush fans a pushed row out into one base_pushed row per open agent PR targeting the branch (failures go to the deck fallback only, since there is no thread). The gate treats base_pushed like a push to the agent's PR: no permission check, drops on base change or when Forgejo does not report mergeable: false. baseConflictSeed confirms with checkBaseConflict (injectable) in the session's checkout; a missing session is created as an implementer session.
  • conversation-detect.ts: buildBaseConflictSeed with conflicting files, optional catch-up text and the shared rebaseInstruction.
  • Docs: enable the Push webhook event.

Tests: webhook classification cases and dispatcher fan-out / mergeable drop / clean local merge / mapped & new session / failed check. bun test apps/server/src/forgejo passes (277), server and web typecheck clean. Not exercised against a live Forgejo instance; whether mergeable can briefly read false right after a push is unverified (the local check filters that).

Closes: #89

Implements the plan in #89. - `webhook.ts`: `push` deliveries to `refs/heads/*` are accepted as a repo-level `pushed` row (number 0), including the agent's own pushes; tag pushes and branch deletions are ignored. - `dispatch-api.ts`: `PullSummary` gains `mergeable` / `baseBranch`; new `listOpenPulls` (`state=open`, also filtered client-side). - `dispatcher.ts`: `handleBasePush` fans a `pushed` row out into one `base_pushed` row per open agent PR targeting the branch (failures go to the deck fallback only, since there is no thread). The gate treats `base_pushed` like a push to the agent's PR: no permission check, drops on base change or when Forgejo does not report `mergeable: false`. `baseConflictSeed` confirms with `checkBaseConflict` (injectable) in the session's checkout; a missing session is created as an implementer session. - `conversation-detect.ts`: `buildBaseConflictSeed` with conflicting files, optional catch-up text and the shared `rebaseInstruction`. - Docs: enable the **Push** webhook event. Tests: webhook classification cases and dispatcher fan-out / mergeable drop / clean local merge / mapped & new session / failed check. `bun test apps/server/src/forgejo` passes (277), server and web typecheck clean. Not exercised against a live Forgejo instance; whether `mergeable` can briefly read `false` right after a push is unverified (the local check filters that). Closes: #89
A Forgejo `push` to a branch is queued as a repo-level `pushed` row and
fanned out into one `base_pushed` check per open agent PR targeting it.
A check whose PR Forgejo reports unmergeable is confirmed with a local
merge-tree in the PR's session checkout; a real conflict runs a turn
asking the agent to rebase, creating an implementer session if needed.

Closes: #89
Co-Authored-By: Claude Opus 5.5 via omp-deck
lucas approved these changes 2026-10-26 16:18:57 +01:00
lucas merged commit a21b38f62c into main 2026-10-26 16:19:02 +01:00
lucas deleted branch agent/issue-89-base-push-conflicts 2026-10-26 16:19:02 +01:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
lucas/omp-deck!90
No description provided.