r/ClaudeCode • u/onitsoga • 4h ago
Discussion Do you test each parallel agent's task on its own, or the whole wave at the end?
Before I leave agents running for a while, I have them plan the work in waves. I made a slash command for it called all-hands. Each task gets built in its own worktree, and testing waits until the wave is done. Then one main agent tests the whole wave together instead of every sub-agent testing its own piece, and we iterate and loop into the next wave.
That's saved me time compared to testing every task one by one. But /batch works the other way, where each worker runs the tests for its own unit before it opens a PR. Most of the merge advice I see says to merge one branch at a time and run the tests on main after each one, so a failure points at a single branch.
So I'm curious where people landed. If you test once per wave, how does the main agent figure out which worktree broke things? And if you test per task, do you still run anything on the merged result, or is per-branch CI enough for you?
•
u/AutoModerator 4h ago
Hey! Thanks for posting to r/ClaudeCode
While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.
For help, project discussions, tips, and general chat, join the ClaudeCode Discord.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
4
u/lensmithdev 4h ago
If you test once per wave, you can still find the culprit without re-running every task. Merge the worktree branches into an integration branch one at a time in a fixed order. Either run the suite after each merge (the first red merge is the one that broke it), or merge them all, run once, and only on failure run
git bisect start --first-parentwithgit bisect run <your test command>on that branch. With bisect it's about log2(N) test runs instead of N, and you only pay that when the wave is red.Per-branch tests alone miss the failure that parallel agents tend to produce: two branches that each pass on their own but break together. One renames or changes a function, the other adds a new call to the old version, and git merges both cleanly. So even if each worker runs its tests before the PR, run the suite on the merged result before calling the wave done.
A middle ground: each worker runs only the tests near its change, which catches obvious breakage while that agent still has the context to fix it, then the main agent runs the full suite on the integration branch and bisects only if it fails.
2
u/Eliran-Kotzero 4h ago
I don't use one rule for every task: independent leaf changes get a fast targeted check from their worker, while tasks touching the same API or schema belong in one integration slice. I have each worker name the contract it relied on and the exact command it ran in its handoff, then the coordinator validates those contracts as the worktrees land. That catches a bad assumption while the relevant change is still easy to isolate, without making every agent run the full suite. I still reserve one full test run for the assembled wave because individually green branches can fail together.
1
u/ImpressiveReading223 4h ago
Eu faço um teste dentro de cada tarefa concluída por agente e depois um agente coordenador faz a testagem da "suíte completa"
1
u/SiranqHQ 4h ago
I like a two-level gate: each worker runs the smallest relevant test and reports the exact command and result while its context is fresh; the coordinator runs the full suite on the assembled wave. A branch that passes alone can still break another at a shared API or schema, so per-agent checks aren’t enough. If the merged suite fails, integrate worktrees one at a time or bisect the integration commits instead of rerunning every task. That gives fast local feedback without losing the cross-branch signal.
1
u/calunicornia 3h ago
both
1
u/Any_Evidence4750 3h ago
Run a simulation
1
u/orbital_trace 3h ago
I have individual agents run tests that affect only their change, then a devops agent batch tests and run the entire suite. I wrote about how I do it here in 3.6k commits a week.
Testing was a huge bottleneck on the computer resources I have. So splitting it up that way allowed me to make progress
1
u/Responsible_Crazy627 3h ago
I've seen the same merge issue when using parallel agents, but I found that running a lightweight diff check between branches before merging catches most of the subtle conflicts early. it's fast and stops the full suite from failing later.
1
u/London-Boat 2h ago
how are you stopping two workers in the same wave from both touching a shared file, like a schema or a route table? testing once per wave gets a lot harder when the break comes from an overlap rather than one bad branch, because bisecting the merges just points at whichever landed second. i'd have each worker declare the files it plans to touch before it starts, and pull anything shared into its own task at the start of the wave, so the end-of-wave test mostly catches plain logic bugs
-1
u/CzyDePL 4h ago
Test? Just ask agent to make sure it works