Repository navigation
Start concurrent jobs 10s apart - #193
Merged
Merged
Conversation
Jobs started by bot.concurrentJobs launched back to back, so all of them ran start-up and picked a story in the same instant, and a job whose PRD sync lost the lock chose from a PRD the first job was still refreshing. Each job now starts BOT_JOB_START_DELAY_SECONDS (default 10) after the one before it.
bbondy
approved these changes
Oct 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User impact: with
bot.concurrentJobsabove 1, the jobs now start 10 seconds apart instead of all in the same instant.The problem
./run.shwithbot.concurrentJobsabove 1 launches every job back to back. All of them run start-up (PRD sync, label sweep, worktree cleanup) and pick a story at the same moment. The sync and the sweep sit behind a lock that makes a second caller skip rather than wait, so a job that loses it picks a story from a PRD the first job is still refreshing.Reproduce
config.jsonset"bot": { "maxConcurrentRuns": 3, "concurrentJobs": 3 }with a worktree profile../run.sh 1from the bot directory.Run slot N of 3lines each job prints.Before: the three lines appear within the same second, and the jobs' start-up overlaps. Expected: the jobs start one after another.
tests/test_parallel_jobs.py::TestStartDelaycovers it — fails on the parent commit, passes here.The fix
Each job after the first waits
BOT_JOB_START_DELAY_SECONDS(default 10,0restores the old behaviour) after the one before it is started. The wait can be interrupted, so Ctrl+C or TERM during the gap stops the jobs already running at once and starts no more. Claims already stop two jobs working one story; this narrows the stale-PRD case and spreads the load, and does not remove it if a sync outlasts the gap.Test plan
.venv/bin/python -m pytest tests/test_parallel_jobs.py— 43 passedmake lint— passedmake check-reviewdog— no findings (landrun missing, ran unsandboxed)make test— 1393 passed, 9 failed: 8 intest_scripts.pyandtest_rebase_pr.pythat already fail on master, and one new timing test I then fixed and re-ran 3 times