Skip to content

perf(runner): Parallelize hunk analysis - #519

Merged
gricha merged 2 commits into
mainfrom
parallelize-hunks
Aug 24, 2026
Merged

perf(runner): Parallelize hunk analysis#519
gricha merged 2 commits into
mainfrom
parallelize-hunks

Conversation

@gricha

@gricha gricha commented Aug 24, 2026

Copy link
Copy Markdown
Member

Move hunk analysis onto one shared FIFO work queue.

Warden previously applied concurrency at the file boundary while processing hunks within each file serially. A large multi-hunk file could therefore leave most configured capacity idle.

Hunks are now independent queue items under one global concurrency limit across files, skills, SDK runs, CLI runs, and GitHub Actions. Reports remain deterministically ordered even when hunks finish out of order.

Queued rate-limit delays respect aborts, and file progress begins when work actually starts. Fatal hunk errors now cancel in-flight siblings and prevent queued hunks from making additional provider calls. Public concurrency documentation has been updated accordingly.

@vercel

vercel Bot commented Aug 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
warden-prod Ready Ready Preview Aug 24, 2026 6:40pm

Request Review

@sentry-junior sentry-junior Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. The shared FIFO queue is a clean replacement for the file-level semaphore, and the tests lock in the important bits: cross-file/skill concurrency, deterministic report order when hunks finish out of order, abort-aware rate-limit delays, and file progress starting when work actually begins.

Comment thread packages/warden/src/action/workflow/schedule.ts

@sentry-junior sentry-junior Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Moving concurrency to a shared hunk-level FIFO queue is the right fix for multi-hunk files starving capacity, and the tests cover the important contracts: cross-skill/file limits, deterministic report order when hunks finish out of order, abort-aware rate-limit delays, and file progress starting when work actually begins. Docs and call sites stay consistent with the new unit of work.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 87fae02. Configure here.

Comment thread packages/warden/src/sdk/analyze.ts
Base automatically changed from fix/confine-pi-file-tools to main August 24, 2026 18:36
@gricha
gricha force-pushed the parallelize-hunks branch from 87fae02 to e46db61 Compare August 24, 2026 18:36
Move hunk analysis onto one shared FIFO work queue so large multi-hunk files can use the configured concurrency capacity. Preserve deterministic report order while applying one global limit across entry points.

Co-Authored-By: GPT-5.6 <noreply@anthropic.com>
Give every skill run a shared abort controller and cancel it when queued hunk execution throws. This stops in-flight work and prevents queued hunks from making provider calls after terminal failures.

Co-Authored-By: GPT-5.6 Sol <noreply@anthropic.com>
expect.anything(),
expect.anything(),
expect.objectContaining({ auxiliaryMaxRetries: 7 })
expect.objectContaining({ auxiliaryMaxRetries: 7, concurrency: 2 })

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Base config runner concurrency incorrectly overrides repo config

schedule.ts computes runnerConcurrency with ??, which picks the base config value before the merged config. When a base config defines [runner].concurrency, repo-level overrides are ignored even though mergeRunnerConfig already resolves them correctly into layered.config. Bug is at schedule.ts:137-140; nearest changed line in the hunk is the concurrency: 2 assertion that exercises the setting.

Evidence
  • mergeRunnerConfig in config/loader.ts merges runner configs with overlay (repo) priority via { ...base, ...overlay }.
  • loadLayeredWardenConfig returns the merged result in layered.config, so layered.config.runner?.concurrency already holds the correct effective value.
  • schedule.ts:137-140 computes runnerConcurrency = baseConfig?.runner?.concurrency ?? repoConfig?.runner?.concurrency ?? config.runner?.concurrency.
  • If the base config sets runner.concurrency = 5 and the repo config sets runner.concurrency = 2, the merged config correctly yields 2, but runnerConcurrency evaluates to 5 because ?? stops at the first non-nullish value.
  • This causes the schedule workflow to use the base concurrency limit instead of the repo override, violating the documented layering semantics.

Identified by Warden · code-review · 33R-MJS

@gricha
gricha merged commit b8052da into main Aug 24, 2026
22 checks passed
@gricha
gricha deleted the parallelize-hunks branch August 24, 2026 20:14
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