agent-orchestrator icon indicating copy to clipboard operation
agent-orchestrator copied to clipboard

Archiving or removing a project strands its open pull requests with no path to closure

Open louiemenard opened this issue 3 months ago • 1 comments

This was generated by AI during triage. Measured against AO v0.12.10 on 2026-09-04, across three separate AO instances (a Linux VM install, a macOS host install, and an OrbStack VM install). Repository names and URLs are withheld because the repositories are private; everything below is product-level state.

Archiving or removing a project strands its open pull requests with no path to closure

When a project is archived or removed from the board, AO keeps its sessions and its pr rows, but the project no longer appears in GET /api/v1/projects. Any pull request those sessions opened is then held by a terminated session in a project the board does not list. Nothing drives it, nothing surfaces it, and no other AO instance will adopt it.

Measured

Two pull requests on one repository have been open since 2026-09-03 with no path to closure:

PR Head branch Owning session Owning instance Session state Project state
#6 ao/<proj>-19/rolling-average <proj>-19 macOS host install terminated project absent from /api/v1/projects, its 29 sessions retained
#11 ao/sandbox-21/rolling-average sandbox-21 OrbStack VM install terminated project row present with archived_at set

The macOS host instance still returns PR #6 attached to its session, with live mergeability:

{ "id": "<proj>-19", "projectId": "<proj>", "status": "terminated",
  "branch": "ao/<proj>-19/root",
  "prs": [ { "number": 6, "state": "open", "mergeability": "conflicting",
             "review": "none" } ] }

So the data is not lost. It is unreachable: the project it belongs to is not on the board, and the session that owns it is terminated, which also means a review cannot be run on it.

The multi-instance part, which makes it worse

These three AO instances point at the same Git repository. Each instance's pr table contains only the pull requests its own sessions opened, which is correct per instance — but it means no instance is authoritative for the repository. An operator looking at any one board sees a subset and reasonably concludes the other pull requests do not exist. That is exactly the wrong conclusion, and it is how these two went unnoticed for a day.

Why it matters

An archived project is the normal end of a piece of work. If archiving silently abandons open pull requests, then over time a repository accumulates open pull requests that no board shows and no user knows to look for. There is no AO surface that lists "pull requests AO opened that are still open", so the only way to find them is to go to the forge and read them by hand — which is what turned these two up.

Suggested fix

Any of these would close the hole; the first is the smallest:

  1. Warn on archive. When archiving or removing a project, count its sessions' pull requests that are still open and say so, rather than archiving silently.
  2. Keep them reachable. Let an archived project's sessions still be listed and filtered, so a pull request AO opened is never invisible to the board that opened it.
  3. Offer closure at archive time. An explicit "close the pull requests these sessions opened, or leave them" choice, since abandoning them is sometimes the right answer and should be a decision rather than a side effect.

Related: #3402 (cleanup is non-idempotent, no session-delete lifecycle) and #2608 (cleanup cannot reclaim archived-project worktrees) are the same family — archived projects leaving state behind that nothing can reach.

Verified read-only

Every measurement was a GET or a query against a copy of the database. No AO state was mutated, and neither pull request was closed, edited or commented on.

louiemenard avatar Sep 04 '26 10:09 louiemenard

this is a valid reachability bug. project removal currently soft-archives the project while preserving its sessions, history, and pull request rows. active project queries exclude archived rows, and the frontend only attaches sessions to projects returned by that query, so open pull requests can remain stored but disappear from every normal ao surface.

pr #5246 adds an important warning before removal, but it only prevents new surprises. it does not restore access to pull requests already hidden by archived projects. a complete fix would also need an archived-project or cross-project open-pr recovery surface.

codebanditssss avatar Sep 15 '26 15:09 codebanditssss