cat-mode: many PR stacks run as one parallel unit per stack, never serially - #890
Merged
Conversation
…rially route_execution(units=N) never returns local for N>1 publishing units: Invoker first, else one worktree subagent per unit (also when the user directs subagents). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Change-Id: I9d5797fbed454079561fd2f4b36379ab7b7df02d
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_2c635fec-a324-40c0-b5c4-30f32beb5a9d) |
Contributor
|
Queued — the merge queue status continues in this comment ↓. |
… validate; Exit code: 0
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_d209b757-8e0f-40c5-b185-071df8b88b85) |
Owner
Author
|
@Mergifyio queue |
Contributor
Merge Queue Status
This pull request spent 28 minutes 38 seconds in the queue, including 27 minutes 56 seconds running CI. Required conditions to merge
|
6 tasks
4 tasks
mergify Bot
pushed a commit
to Neko-Catpital-Labs/Invoker
that referenced
this pull request
Sep 24, 2026
…llel, never serial (#13140) ## Summary The route-delegation skill told agents to stay local when Invoker was missing, no matter how many PR stacks were involved. So a request to land or repair twenty stacks could run one stack at a time in the parent chat. Now the router counts independent publishing units. More than one never stays local: Invoker gets one workflow per unit, otherwise one worktree subagent per unit. This mirrors catstack PR EdbertChan/catstack#890, which added the same rule to catstack's fallback table. ## Review Claim `routeExecution` and `routeDelegation` never return `local` for more than one non-read-only publishing unit; they return `delegate_invoker`, or `subagent_worktree_per_unit` when Invoker is missing or the user directs subagents. ## Review Lane docs ## Review Unit docs ## Safety Invariant A single unit (the default when `units` is omitted) returns exactly the route it returned before, so every existing caller and payload keeps its behavior. Read-only work never takes the per-unit route. ## Slice Rationale The skill rule and its executable table must change together, or the prose and the script disagree. The contract test for the new rule is the next slice, because the repo's docs lane cannot ship product-test files. ## Non-goals - Does not change the always-on fragments in `packages/shell/src/always-on/fragments.ts`. - Does not change `chat-submit` or `plan-to-invoker` handoff mechanics. - Does not change routing for a single unit or for read-only work. - Does not add the unit-count contract tests; slice (2) does. ## Test Plan <details> <summary>Test Plan</summary> - [x] `cd packages/cli && pnpm test route-delegation-skill` (existing 15 tests pass on this slice alone; with slice (2)'s tests, 6 of 22 fail on master's router and 22 of 22 pass here) - [x] `cd packages/cli && pnpm test bundled-skills` - [x] `cd packages/shell && pnpm test` - [x] `node scripts/check-added-comments.mjs` </details> ## Revert Plan <details> <summary>Revert Plan</summary> - Safe to revert? Yes - Revert command: `git revert <sha>` - Post-revert steps: None - Data migration? No </details> Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Summary
Sometimes there are several stacks of pull requests to land or repair at once. Our working mode decides where each stack runs.
The problem: when many stacks were waiting, the table that picks a place still answered "right here, in this thread". So chewing through them one at a time looked allowed.
The fix: more than one stack now means they all start at the same time. Invoker gets the work first.
When Invoker is missing, or you ask for helper agents, every stack gets its own helper in its own checkout of the repo.
One stack behaves exactly as before.
Review Claim
When more than one stack of pull requests is waiting, the table that picks a place hands the work to Invoker, or to one helper agent per stack. It no longer answers "stay in this thread".
Review Lane
behavior
Review Unit
corpus-lesson
Safety Invariant
With one unit (the default), every existing route is unchanged. Read-only work never enters the per-unit branch.
Slice Rationale
The table, its tests, and the three prose files that describe it change together, so the prose never describes a route the table cannot return.
Non-goals
invoker-route-delegation(Invoker-owned). It still decides first when installed.units.Test Plan
Test Plan
Repro then fix, same checkout, new tests held constant while only the routing
table was swapped back to its base version:
python3 -m unittest tests.test_execution_routing→Ran 25 tests in 0.673s/FAILED (errors=12)python3 -m unittest tests.test_execution_routing→Ran 25 tests in 0.822s/OKpython3 engine/skills/make-pr/scripts/preflight.py --base origin/main --body-file <this body>→ok preflight passed, exit 0 (declares Review Unitcorpus-lesson, 4 unit files + 1 neutral test file)node engine/skills/draft-pr/scripts/validate-pr-body.mjs --body-file <this body> --changed-files-file <changed files>→PR body validation passed., exit 0ruff check --select E9,F corpus/skills/cat-mode/scripts/route_execution.py tests/test_execution_routing.py→All checks passed!Not fully run locally:
bash scripts/test/run_all_tests.shexceeded a 10 minutelocal timeout.
python3 -m unittest tests.test_cat_mode tests.test_execution_routinghas one failure in this sandbox —
test_an_install_the_ssh_path_reaches_is_okreads the sandbox's own installed Invoker version (
0.1.13) instead ofnone.That failure reproduces unchanged on
origin/main, so it is environmental andnot from this slice. CI's
testjob is the authority for the full sweep.Revert Plan
Revert Plan
git revert <sha>(single commit)unitsgone, callers fall back to the old routes.🤖 Generated with Claude Code
Note
Low Risk
Behavioral routing guidance and a defaulted
units=1API in cat-mode skill scripts; no auth or production paths, with regression tests covering the new branches.Overview
Multiple independent PR stacks or publishing workflows must no longer be routed to serial work in the parent chat. Cat-mode docs and
route_execution.pynow treatunits > 1as a first-class case: prefer Invoker (one workflow per unit), otherwisesubagent_worktree_per_unitwith parallel worktree-isolated subagents; user-directed subagents can force the per-unit path even when Invoker is available.route_execution/route_delegationgain optionalunitsanduser_directed_subagents; the CLI JSON payload accepts the same. A new handoff route and steps (one_worktree_per_unit, parallel spawn, transcript greps) document the fallback. Single-unit and read-only behavior stay unchanged (units=1default).Tests lock in that many publishing units never return
localand that delegation for PR-producing work reaches the per-unit route when Invoker is absent.Reviewed by Cursor Bugbot for commit 8ae48c3. Bugbot is set up for automated code reviews on this repo. Configure here.