fabro/lib/apps/fabro-server/src/server/handler
Bryan Helmkamp 5c6289df80
Simplify async pull request creation
Structural cleanup of the durable pull request creation feature, from a
three-agent review (reuse, quality, efficiency) of the branch:

- Move the supervisor out of handler/ into server/pull_request_supervisor.rs,
  collapse its double bookkeeping into one task-id map, and fold the five
  copy-pasted failure arms into attempt_pull_request_creation.
- Tag pull_request.failed events with the creation id they resolve, so a
  publish-stage failure can never fail an unrelated explicit creation. The
  reducer gains PullRequestCreation::succeed/fail transition methods.
- Scan pending creations through a narrow projection-cache accessor instead
  of materializing every run summary, raise the scan interval to 30s (notify
  covers the live path), and cap retries for runs whose worker cannot even
  record a failure.
- Answer "creation already pending" POSTs before taking the per-run create
  lock, which a worker can hold for the whole creation.
- Replace the hand-rolled per-run lock map with fabro_store::KeyedMutex.
- Reuse cheap Arc'd projections (cached_run_projection) on the poll endpoint
  and in the worker instead of deep-cloning run summaries and diffs.
- Merge ExistingPullRequest into fabro_github::CreatedPullRequest and
  extract one reconcile_existing_pull_request helper for both call sites.
- Give the client poll loop a 15-minute deadline; document that Retry-After
  and the poll interval are the same constant.
- Resolve a wedged pending creation (run already has a pull request) as a
  durable failure instead of skipping it forever.
- Tests: shared wait_for_pull_request_creation helper, a pinned generation-
  failure assertion, and a new pipeline test proving reconciliation adopts
  an existing PR without an LLM call or create request.

Verified: cargo build --workspace, cargo nextest run --workspace (7,767
passed), nightly clippy -D warnings, fmt --check, insta (no pending), bun
typecheck in fabro-api-client.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-04 14:51:29 -04:00
..
prompts refactor(agent): simplify prompt template rendering 2026-07-24 19:10:48 -04:00
artifacts.rs fix: make the artifact tie-break match the artifacts page 2026-08-01 09:20:40 -04:00
automations.rs refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
billing.rs refactor: simplify artifact ZIP download 2026-08-01 09:09:54 -04:00
completions.rs Merge origin/main into fix/validate-model-reasoning-effort 2026-07-24 09:24:07 -04:00
environments.rs refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
events.rs Harden event pagination bounds and scope desc params to the run route 2026-07-24 10:21:25 -04:00
graph.rs refactor: pass the catalog by value and correct the RenderMode docs 2026-07-28 14:30:48 -04:00
lifecycle.rs refactor: simplify cancellation lifecycle code from review 2026-07-23 21:15:35 -04:00
llm_sse.rs refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
mcp_servers.rs refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
mod.rs Make pull request creation durable and asynchronous 2026-08-01 19:28:52 -04:00
models.rs refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
pair.rs feat(reasoning): capture provider reasoning in agent.message 2026-07-24 14:21:15 -04:00
playground.rs Simplify LLM error mapping and validate reasoning_effort parsing 2026-07-24 08:29:12 -04:00
pull_requests.rs Simplify async pull request creation 2026-08-04 14:51:29 -04:00
runs.rs fabro(01KYQN78K19NY7PNSCDYP6CG9G): simplify_sol (succeeded) 2026-07-31 14:09:32 -04:00
sandbox.rs fix(sandbox): reactivate stopped run sandboxes 2026-07-28 12:50:20 -04:00
sandboxes.rs refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
secrets.rs refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
sessions.rs Merge pull request #668 from fabro-sh/feat/provider-qualified-fallbacks 2026-07-28 18:13:43 -04:00
steer.rs refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
system.rs refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
variables.rs refactor: organize crates into three layers 2026-07-23 17:59:34 -04:00
worker_control.rs refactor: deduplicate cached-run access and event scans 2026-07-24 09:25:42 -04:00