Let sessions on agent-authored PRs push to their head branch #62

Merged
lucas merged 1 commit from agent/issue-61-own-pr-implementer into main 2026-10-23 10:08:26 +02:00
Collaborator

Closes: #61

  • DispatchApi.readPull reads a PR's head branch and head/base repos.
  • When a comment addressed to the agent lands on a PR the agent authored, the dispatcher now starts an implementer session, the same kind submitted reviews already get. If the PR is mapped to a read-only forgejo_pull_request session, that session is replaced. If the PR's head branch lives in another repository, the trigger fails with a fork-head comment saying why.
  • ForgejoImplementerScope.headBranch confines the session: git_branch may only create or switch to the head branch (list is also allowed), and git_push may only push to origin. The prompt tells the session to create the head branch locally, act on explicit requests, and ask only when a request is ambiguous. Scopes without headBranch (issue-started or older persisted ones) work as before.
  • ownPr is removed from ForgejoPullRequestScope. Those sessions now only handle PRs written by humans. Old persisted rows that still carry the field still parse.
  • No docs described the old read-only behavior, so none changed.

Verification: bun test src/bridge/session-policy.test.ts src/forgejo/dispatcher.test.ts src/bridge/permission-filter.test.ts passes (98 tests) and bun run typecheck is clean. I did not run the manual end-to-end check against a live Forgejo.

Closes: #61 - `DispatchApi.readPull` reads a PR's head branch and head/base repos. - When a comment addressed to the agent lands on a PR the agent authored, the dispatcher now starts an implementer session, the same kind submitted reviews already get. If the PR is mapped to a read-only `forgejo_pull_request` session, that session is replaced. If the PR's head branch lives in another repository, the trigger fails with a `fork-head` comment saying why. - `ForgejoImplementerScope.headBranch` confines the session: `git_branch` may only create or switch to the head branch (`list` is also allowed), and `git_push` may only push to `origin`. The prompt tells the session to create the head branch locally, act on explicit requests, and ask only when a request is ambiguous. Scopes without `headBranch` (issue-started or older persisted ones) work as before. - `ownPr` is removed from `ForgejoPullRequestScope`. Those sessions now only handle PRs written by humans. Old persisted rows that still carry the field still parse. - No docs described the old read-only behavior, so none changed. Verification: `bun test src/bridge/session-policy.test.ts src/forgejo/dispatcher.test.ts src/bridge/permission-filter.test.ts` passes (98 tests) and `bun run typecheck` is clean. I did not run the manual end-to-end check against a live Forgejo.
Comments addressed to the agent on a pull request it authored now start
(or replace a read-only mapping with) an implementer session, like
submitted reviews already did. The session's scope records the PR's head
branch, read via the API; such sessions may only create/switch to that
branch and push to origin. A PR whose head lives in another repository
fails the trigger with a comment saying why.

The ownPr flag on pull request sessions is gone: those sessions now only
serve PRs authored by humans.

Co-Authored-By: Claude Opus 5.5 via omp-deck
lucas approved these changes 2026-10-23 10:08:21 +02:00
lucas merged commit c7f3d5fa37 into main 2026-10-23 10:08:26 +02:00
lucas deleted branch agent/issue-61-own-pr-implementer 2026-10-23 10:08:26 +02: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!62
No description provided.