Forgejo: implementer failure and reset #157

Merged
lucas merged 1 commit from agent/issue-147-implementer-abandon into main 2026-10-30 13:06:12 +01:00
Collaborator

Closes: #147

Implementer sessions can now end as failed. Both the agent and a human can trigger it.

  • Agent: the new forgejo_abandon_implementation tool (implementer policy only, and only for the session's own issue) posts ## Implementation abandoned plus the summary on the issue. When the call succeeds, the bridge queues an implementation_abandoned row and wakes the dispatcher. The wake goes through a new bridge.onForgejoTrigger hook, which index.ts sets.
  • Human: closing the agent's PR without merging no longer archives the session. It queues an implementation_scrapped turn (continue-only, no permission check) whose seed tells the agent to call the tool. After that turn ends, whatever the outcome, the dispatcher queues the same abandon row with summaryPosted: false. The dedupe key leaves out that flag, so if the agent already called the tool, this second insert does nothing.
  • Reset (handleAbandon): waits for the session to go idle, then closes every open PR mapped to the session (new DispatchApi.closePull, PATCH on the pulls endpoint; branches are kept). It removes progress_label and adds the new optional implementation.planning_label. If the agent wrote no summary, it posts the fixed notice. Any problems are reported on the issue, or as a notification if posting fails. Finally it archives the session. The issue stays open.
  • If the agent closes the PR itself (the abandon handler does this), that close is dropped without archiving.
  • planning_label must differ from progress_label. It may equal intake_label.

Deviations from the plan:

  • enqueueAbandon is in a new module, forgejo/abandon.ts, not in dispatcher.ts, so the bridge doesn't import the dispatcher.
  • swapInProgressLabels is now a generic swapLabels(add, remove). The start path and the abandon path both use it.
  • If .omp/forgejo.yaml can't be read or parsed during the reset, the labels are left alone and the problem is reported on the issue.

Known behavior, unchanged: the issue stays mapped to the archived session until a new implementer starts. So a comment on the issue before that resumes the abandoned session, the same way comments on closed artifacts do today.

Verification: bun test apps/server/src/forgejo apps/server/src/bridge (858 pass). The new dispatcher tests cover the agent abandon, no planning label, a human scrap with the fixed notice, dedupe after the agent's summary, the agent's own close being dropped, label-failure reporting, and a restart on the issue afterwards. Server typecheck is clean apart from an existing system-prompt.test.ts error that this PR doesn't touch.

Closes: #147 Implementer sessions can now end as failed. Both the agent and a human can trigger it. - **Agent**: the new `forgejo_abandon_implementation` tool (implementer policy only, and only for the session's own issue) posts `## Implementation abandoned` plus the summary on the issue. When the call succeeds, the bridge queues an `implementation_abandoned` row and wakes the dispatcher. The wake goes through a new `bridge.onForgejoTrigger` hook, which `index.ts` sets. - **Human**: closing the agent's PR without merging no longer archives the session. It queues an `implementation_scrapped` turn (continue-only, no permission check) whose seed tells the agent to call the tool. After that turn ends, whatever the outcome, the dispatcher queues the same abandon row with `summaryPosted: false`. The dedupe key leaves out that flag, so if the agent already called the tool, this second insert does nothing. - **Reset** (`handleAbandon`): waits for the session to go idle, then closes every open PR mapped to the session (new `DispatchApi.closePull`, PATCH on the pulls endpoint; branches are kept). It removes `progress_label` and adds the new optional `implementation.planning_label`. If the agent wrote no summary, it posts the fixed notice. Any problems are reported on the issue, or as a notification if posting fails. Finally it archives the session. The issue stays open. - If the agent closes the PR itself (the abandon handler does this), that close is dropped without archiving. - `planning_label` must differ from `progress_label`. It may equal `intake_label`. Deviations from the plan: - `enqueueAbandon` is in a new module, `forgejo/abandon.ts`, not in `dispatcher.ts`, so the bridge doesn't import the dispatcher. - `swapInProgressLabels` is now a generic `swapLabels(add, remove)`. The start path and the abandon path both use it. - If `.omp/forgejo.yaml` can't be read or parsed during the reset, the labels are left alone and the problem is reported on the issue. Known behavior, unchanged: the issue stays mapped to the archived session until a new implementer starts. So a comment on the issue before that resumes the abandoned session, the same way comments on closed artifacts do today. Verification: `bun test apps/server/src/forgejo apps/server/src/bridge` (858 pass). The new dispatcher tests cover the agent abandon, no planning label, a human scrap with the fixed notice, dedupe after the agent's summary, the agent's own close being dropped, label-failure reporting, and a restart on the issue afterwards. Server typecheck is clean apart from an existing `system-prompt.test.ts` error that this PR doesn't touch.
omp-deck force-pushed agent/issue-147-implementer-abandon from efaa7dc1b1 to 7933859ec0 2026-10-30 13:05:18 +01:00 Compare
lucas approved these changes 2026-10-30 13:06:08 +01:00
lucas merged commit 436c8048ee into main 2026-10-30 13:06:12 +01:00
lucas deleted branch agent/issue-147-implementer-abandon 2026-10-30 13:06:13 +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!157
No description provided.