feat(forgejo): link an implementer session to its pull request #48

Merged
lucas merged 2 commits from 46-forgejo-link-implementer-session-to-its-pull-request-implementer-split-2-3 into main 2026-10-20 13:47:41 +02:00
Collaborator

An implementer session now opens at most one pull request, and a resumed session is told which pull request it already opened. This builds on split 1/3 (#47): forgejo_sessions already records the PR an implementer session opens, and that mapping drives the comment policy and the dispatcher's routing of PR mentions.

  • listForgejoSessionNumbers(repo, sessionId) (new) lists the numbers mapped to a session. An implementer's PRs are those numbers minus its issue.
  • forgejo_create_pr is denied once a PR is mapped to the session: this session already opened pull request #N; push further commits to its branch instead.
  • systemContext/policySystemContext take the session id (null while the session is being created). On resume, the implementer orientation names the linked PR and says not to open another.

Decisions

  • The plan was rebased on split 1/3. The PR number stays in forgejo_sessions, not in the trigger scope, so the original pullNumber field and the forgejo_create_pr wrapper are dropped.
  • If mapping the PR fails, it is still only logged, as in 1/3. The mapping is a local SQLite upsert, so failures are near-impossible.
  • The orientation names the PR only when a session is resumed. A live session already has the PR number from the forgejo_create_pr result.

Verification

  • cd apps/server && bun test src/bridge/session-policy.test.ts src/db/forgejo-sessions.test.ts src/forgejo/dispatcher.test.ts: 57 pass, 0 fail. This includes the existing dispatcher test where mentions on the issue and on the PR it opened continue the implementer session.
  • bun run typecheck (protocol, server, web): clean.

Closes #46

An implementer session now opens at most one pull request, and a resumed session is told which pull request it already opened. This builds on split 1/3 (#47): `forgejo_sessions` already records the PR an implementer session opens, and that mapping drives the comment policy and the dispatcher's routing of PR mentions. - `listForgejoSessionNumbers(repo, sessionId)` (new) lists the numbers mapped to a session. An implementer's PRs are those numbers minus its issue. - `forgejo_create_pr` is denied once a PR is mapped to the session: `this session already opened pull request #N; push further commits to its branch instead`. - `systemContext`/`policySystemContext` take the session id (null while the session is being created). On resume, the implementer orientation names the linked PR and says not to open another. ## Decisions - [The plan was rebased on split 1/3](https://git.sclu1034.dev/lucas/omp-deck/issues/46#issuecomment-16390). The PR number stays in `forgejo_sessions`, not in the trigger scope, so the original `pullNumber` field and the `forgejo_create_pr` wrapper are dropped. - If mapping the PR fails, it is still only logged, as in 1/3. The mapping is a local SQLite upsert, so failures are near-impossible. - The orientation names the PR only when a session is resumed. A live session already has the PR number from the `forgejo_create_pr` result. ## Verification - `cd apps/server && bun test src/bridge/session-policy.test.ts src/db/forgejo-sessions.test.ts src/forgejo/dispatcher.test.ts`: 57 pass, 0 fail. This includes the existing dispatcher test where mentions on the issue and on the PR it opened continue the implementer session. - `bun run typecheck` (protocol, server, web): clean. Closes #46
The PRs an implementer session opened are the numbers forgejo_sessions maps
to it besides its issue. Once there is one, forgejo_create_pr is denied so
follow-up work lands on the existing PR's branch.

Refs #46

Co-Authored-By: Claude Opus 5.5 via omp-deck
systemContext now receives the session id (null while the session is being
created). A resumed implementer session whose PR is mapped to it is told to
continue on that PR and not to open another.

Refs #46

Co-Authored-By: Claude Opus 5.5 via omp-deck
lucas merged commit 0fee3b224c into main 2026-10-20 13:47:41 +02:00
lucas deleted branch 46-forgejo-link-implementer-session-to-its-pull-request-implementer-split-2-3 2026-10-20 13:47:42 +02:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
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!48
No description provided.