Repository navigation
Description
Problem
Two ProPR instances can monitor the same repository: a self-hosted instance plus a Fly instance, a test instance, or a migration from one host to another. Today each instance receives the repository's GitHub events and acts on them independently, so a labelled issue can produce two tasks and two PRs, a PR comment can start two follow-ups, and both instances may edit the same labels and status comments.
The Fly setup wizard used to warn about this with static text (removed in a separate issue). A warning is not the fix: either instance should be able to handle the work, without conflicts.
Goal
When several instances monitor one repository, each unit of work (issue task, PR follow-up, review, ultrafix cycle, CI follow-up, automation run) is handled by exactly one instance, and work is never lost if that instance is down.
Requirements
- Exactly-once claim. Before starting work for an event, an instance claims it, and other instances skip claimed work. Investigate where the claim can live atomically: ProPR Connect (it already routes each repository's events to the registered instances and could deliver each event to one instance with a lease), and/or a GitHub-side claim that is safe under races (labels are not atomic; check what is). Instances using their own GitHub App webhooks, without Connect, must also be covered, or the limitation must be explicit.
- Ownership of follow-ups. Work on an existing PR (comments, reviews,
/fix, ultrafix, model switches) goes to the instance that owns the PR's task when it is available, and is taken over by another instance when the owner is gone (lease expiry), with its state recovered from GitHub. - Capability-aware. An instance that lacks the requested model or agent (for example an
llm-*label it cannot serve) does not claim the work, so an instance that can serve it picks it up. - No conflicting writes. Labels (
AI-processing,AI-done, …) and status comments are written only by the claimant. - Failover. If the claimant dies mid-task, the claim expires and another instance can retry, using the existing recovery paths for in-flight tasks.
- Dashboard visibility. The Repositories page shows when another instance also monitors a repository, which instance holds current work, and lets the operator pin a repository to this instance or hand it off. This replaces the old wizard warning.
- Back-compat. A single instance behaves exactly as today, with no extra latency on the common path.
Deliverable
First a short design note in docs/ comparing claim mechanisms (Connect-level single delivery vs a GitHub-side claim) with their failure modes, then an implementation with tests that run two instances against one fixture repository: concurrent labelling, simultaneous PR comments, owner shutdown mid-task, and a capability mismatch.
Activity