Skip to content
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ All notable changes to the claude-plugins project will be documented in this fil

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). Entries are listed newest-first; each plugin section is treated as released when merged to `main`.

### code-review v3.13.1

#### Fixed
- `partition`'s Bug Hunter A cap now matches the number of Bug Hunter A agents the spawn spec reserves. When `--max-bha-agents` is omitted, `partition` reads `arbitrate-budget`'s `budget.bha_partitions` from `--cr-dir`, floored at 1. On shallow, which runs no `arbitrate-budget`, it uses the LOC-based count (`ceil(total_loc / 1200)`, at most 5) over the full `diff_data.json`. `run-prefix` no longer passes the flag; it used to pass route's `9 - 2 - <domain critics>` (7 with no critic) against 5 reserved agents. A partition's files are no longer dropped as `budget_capped`. That reason remains, with its required coverage gap, for a `partitions.json` produced some other way. An explicit `--max-bha-agents` still overrides the derived cap (a value below 1 is floored at 1 with a warning), and `route` still reports a `max_bha_agents`, now the LOC-based count, for telemetry only.
- `route` clamps `defaults.reviewBudget` from `critic-gates.json` at 0, so a negative value selects no domain critics instead of all but the last few.
- The partitioner folds trivial partitions (under 20 LOC) into another partition with room under `--max-files` before its budget-respecting merge and its force-merge. A folded trivial partition no longer takes a Bug Hunter A slot or causes another partition to double. When the force-merge's smallest pair mixes impl and test, an impl-only or test-only pair with the same combined LOC now wins, so test-only partitions stay on the test-only model.
- `derive-static-spec` records a required coverage gap for a skipped required reviewer, matching `derive-spawn-spec` and using the same set of benign skip reasons.
- Every writer of `coverage_gaps.json` (`arbitrate-budget`, the spawn-spec stages, `verify-spawn`, `verify-consolidate`) tags its findings with `gap_producer`. On every run, and every return path past the review-root check, each replaces only its own findings. A resumed walk therefore neither duplicates a gap nor keeps a stale one, and `arbitrate-budget` no longer erases other producers' gaps. Untagged findings in a run directory written by 3.13.0 are attributed to the producer whose shape they have, so a resumed 3.13.0 run does not double-count them. Finding ids from the spawn-spec stages, `verify-spawn` and `verify-consolidate` carry the producer (e.g. `coverage-verifier-verify-spawn_f0`), so they no longer collide with `arbitrate-budget`'s `coverage-verifier_f<N>`.

### vibe v1.1.31

#### Fixed
Expand Down
2 changes: 1 addition & 1 deletion plugins/code-review/.claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "code-review",
"description": "Code review plugin",
"version": "3.13.0",
"version": "3.13.1",
"author": {
"name": "ClosedLoop",
"email": "support@closedloop.ai"
Expand Down
2 changes: 1 addition & 1 deletion plugins/code-review/.codex-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "code-review",
"version": "3.13.0",
"version": "3.13.1",
"description": "Code review plugin for automated review workflows and inline GitHub PR comments.",
"author": {
"name": "ClosedLoop",
Expand Down
55 changes: 41 additions & 14 deletions plugins/code-review/SCHEMA.md
Original file line number Diff line number Diff line change
Expand Up @@ -433,20 +433,45 @@ does not duplicate it. Presenters use `gated_by_verify` to surface

**BHA budget cap invariant:** the BHA descriptor count is bounded by
`coverage_plan.budget.bha_partitions` (the post-arbitrate cap), not
by the count of partitions in `partitions.json`. When the partitioner
emitted more partitions than the budget reserved, the first `cap`
partitions spawn and the rest land in `skipped[]` with
`reason: "budget_capped"`. A cap of 0 suppresses all BHA spawns
regardless of partition count. When arbitrate-budget set the cap to 0
because the diff is docs-only (`coverage_plan.budget.docs_only: true`),
by the count of partitions in `partitions.json`. On standard and deep,
arbitrate-budget runs before `stage_17_partition`, and `partition`, given
no `--max-bha-agents`, reads that same `budget.bha_partitions` from
`<cr_dir>/coverage.json` and applies it as its cap, floored at 1. On
shallow, which runs no arbitrate-budget, it applies the LOC count
(`ceil(total_loc / 1200)`, at least 1, at most `DEFAULT_MAX_BHA_AGENTS`)
over the full `<cr_dir>/diff_data.json`, which is within
`derive-static-spec`'s `DEFAULT_MAX_BHA_AGENTS` cap. An explicit
`--max-bha-agents` overrides both.
`route` reports that LOC count as `max_bha_agents` for telemetry only. With
a cache dir active the partitioner reads `uncached_diff_data.json` and
still force-merges down to the same cap, so the partition count never
exceeds it. Docs-only is the intentional exception: arbitrate-budget
reserves 0 while the partitioner runs with 1. If a `partitions.json` holds
more partitions than a positive cap (one not produced by that partitioner
run), the first `cap` partitions spawn and the rest land in `skipped[]`
with `reason: "budget_capped"`, a required coverage gap in both
`derive-spawn-spec` and `derive-static-spec`. A cap of 0 suppresses all
BHA spawns regardless of partition count. When arbitrate-budget set the
cap to 0 because the diff is docs-only (`coverage_plan.budget.docs_only: true`),
the single skipped entry carries `reason: "docs_only"`; a cap of 0
without that marker keeps `reason: "budget_capped"`.

**Required coverage-gap invariant:** every entry in `skipped[]`
with `bucket == "required"` and a non-benign reason
(everything except `deferred_pln723`, `no_partitions`, `docs_only`,
`gated_by_verify`) produces a coverage-gap finding appended to
`coverage_gaps.json`. `cmd_finalize_result` reads that file into the
`gated_by_verify`) produces a coverage-gap finding in
`coverage_gaps.json`. arbitrate-budget always writes the file (it is
`stage_16`'s completion signal); the other writers create it only when they
have a finding, and readers treat an absent file as empty. Every writer
tags its findings with `gap_producer` (`arbitrate-budget`, `spawn-spec`,
`verify-spawn`, `verify-consolidate`) and, on every run and every return
path past the review-root check, replaces only the findings carrying its
own tag, so a resumed walk neither duplicates nor keeps one. An untagged
finding, from a run directory written by 3.13.0 or earlier, is attributed
to the producer whose shape it has (arbitrate-budget by default), so it is
replaced too. Ids are
`coverage-verifier-<gap_producer>_f<index>`, except arbitrate-budget's
`coverage-verifier_f<index>`. `cmd_finalize_result` reads that file into the
envelope's coverage-gap bucket where it contributes to the canonical
verdict. The runtime symmetric pair to this derive-time check is
`stage_20b_verify_spawn` (see §6c).
Expand All @@ -472,7 +497,7 @@ crashed at runtime. Both producers write to `coverage_gaps.json` so
"present_agents": ["auditor", "bha_p0", "bhb", "domain_0"],
"missing_agents": [], // every missing descriptor (required + best_effort)
"missing_required": [], // subset of missing_agents with bucket == "required"
"missing_required_gaps": 0, // coverage_gaps.json findings appended
"missing_required_gaps": 0, // coverage_gaps.json findings written (gap_producer: "verify-spawn")
"generated_at": "<ISO-8601>"
}
```
Expand All @@ -489,7 +514,8 @@ crashed at runtime. Both producers write to `coverage_gaps.json` so
```

**Runtime gap invariant:** for each entry in `missing_required[]`,
exactly one coverage-gap finding is appended to `coverage_gaps.json`
exactly one coverage-gap finding is in `coverage_gaps.json` (verify-spawn
replaces its own earlier findings on each run, including its no-op runs)
with `source: "coverage-verifier"` and reason `spawn_missing_required_agent`.
Missing best-effort agents are recorded for telemetry but emit no
finding — best-effort omissions are budget-driven, not coverage gaps.
Expand Down Expand Up @@ -522,7 +548,7 @@ finding — best-effort omissions are budget-driven, not coverage gaps.
| 19 | cache-check | `cache-check` | `cache_result.json` |
| 19b| derive-spawn-spec (plan 05) | `derive-spawn-spec` | `spawn.json` (`spec` section) |
| 20 | spawn-reviewers | (agent_fleet) | `agent_<id>.json` |
| 20b| verify-spawn (plan 05) | `verify-spawn` | `spawn.json` (`verification` section) + `coverage_gaps.json` append |
| 20b| verify-spawn (plan 05) | `verify-spawn` | `spawn.json` (`verification` section) + `coverage_gaps.json` (replaces its own entries) |
| 21 | collect-findings | `collect-findings` | `findings.json` (with deterministic IDs) |
| 22 | validate | `validate` | `findings_validated.json` |
| 23 | verify-findings (plan 03) | `verify-findings` | `findings_verified.json` |
Expand Down Expand Up @@ -604,7 +630,7 @@ process, the `depends_on` `completed` set is reconstructed from artifacts on dis
| `ran_stages` | string[] | Stage ids executed (or `continue`-failed) this segment, in order. |
| `message` | string \| null | Short diagnostic on `error`, else null. |
| `fast_path` | bool | Gate B routing decision. Present **only** on `ready_for_reviewers`. |
| `max_bha_agents` | int \| null | Gate B Bug-Hunter-A agent cap. Present **only** on `ready_for_reviewers`.|
| `max_bha_agents` | int \| null | Gate B `route`'s LOC-based Bug Hunter A count, for telemetry; not the partitioner's cap. Present **only** on `ready_for_reviewers`.|
| `cache_status_message` | string \| null | `cache_result.json.status_message` to print. Present on `ready_for_reviewers` and `hygiene_exit`. |

`next_action`, `resume_stage`, `singleton`, `failed_stage`, `ran_stages`, and
Expand All @@ -625,8 +651,9 @@ with `.get()`, not direct indexing.

On `ready_for_reviewers` the runner has already run Gate B `route` (writing
`spawn.json.route`) and — unless `fast_path` — `stage_17_partition` (with the
`--loc-budget 500 --max-files 25 --max-bha-agents <N>` augmentation, and the
`uncached_diff_data.json` swap when a cache dir is active). In `fast_path` mode
`--loc-budget 500 --max-files 25` augmentation, partition reading its Bug
Hunter A cap from `--cr-dir`, and the `uncached_diff_data.json` swap when a
cache dir is active). In `fast_path` mode
partition is skipped (no `partitions.json` / `patches_p<N>.txt`) and any cached
BHA replay artifact is deleted. The `fast_path` / `max_bha_agents` /
`cache_status_message` fields let the orchestrator print the routing + cache
Expand Down
Loading