Skip to content

perf: parallelise rivet head oracle and base validate runs#45

Open
avrabe wants to merge 1 commit intomainfrom
perf/parallel-rivet-validate
Open

perf: parallelise rivet head oracle and base validate runs#45
avrabe wants to merge 1 commit intomainfrom
perf/parallel-rivet-validate

Conversation

@avrabe
Copy link
Copy Markdown
Contributor

@avrabe avrabe commented May 1, 2026

Fixes Bug #20 from docs/agent-fleet/bugs.md (wave-1 Performance engineer).

The two withTempRepoCheckout calls (head oracle + base validate for subtractFindings) are independent — different tarballs, different tempdirs, different rivet invocations. Promise.all'd them. Each side keeps its own error handler so base-ref failures still degrade to head-only.

  • 834 tests pass
  • eslint clean

🤖 Generated with Claude Code

## Why
Wave-1 Performance engineer flagged this as Bug #20 in
`docs/agent-fleet/bugs.md`. The rivet oracle path in
`reviewPullRequest` ran two independent `withTempRepoCheckout` calls
serially:

  1. head oracle (validate + impact at PR head)
  2. base validate (for `subtractFindings` delta filter)

Each tarball is ~50 MB on the rivet repo, extract takes seconds,
`rivet validate` is another 1-3 s. Sequential wall-time was conservatively
15-40 s, fully blocking the webhook handler.

The two operations have zero data dependency: separate tarballs, separate
tempdirs, separate rivet invocations. Trivially parallelisable.

## What
`Promise.all` over the two `withTempRepoCheckout` calls. Each side keeps
its own error handler — base-ref failures (e.g. force-push lost the base
commit, or schema drift between base and head) gracefully degrade to
head-only oracle findings, same behaviour as before.

## Source
Bug #20, wave-1 Performance engineer (`docs/agent-fleet/bugs.md`).

## Test plan
- [x] 834 tests pass — existing oracle tests cover both head and base
      paths via the injected `runner` mock; concurrency doesn't change
      the assertions
- [x] eslint clean
- [ ] After deploy: wall-time of an AI review on a rivet repo drops by
      ~50% of the rivet-oracle component. Visible in the bot's
      "Rivet oracle complete" log line timing.

## Risk & rollout
- Risk: low. Same calls, same args, same downstream consumers, just
  scheduled concurrently. Each side's failure is still locally caught.
- Rollout: self-update on merge.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant