Avoid repeatedly materializing quadratic scan-history matching payloads
Summary
The workbench matching plan repeats findings from earlier scans in each later batch. Across a long history, constructing and serializing that plan can grow approximately quadratically, even before the model-side matching work is considered.
Current status
#575 added compact model catalogues and #782 added paged/batched matching work. The old subprocess stdout limit was also removed. The original claims that every comparison uses one unbounded model prompt and necessarily hits a 4 MiB stdout cap no longer describe current behavior.
The remaining workbench batch construction still materializes earlier findings into each later batch. Model prompt improvements do not remove that response-level duplication.
Example
For successive scans A, B, C, and D, a plan that embeds full earlier findings produces:
B: before = [A]
C: before = [A, B]
D: before = [A, B, C]
The same A/B payload is copied and serialized repeatedly. A single finding-heavy scan can therefore enlarge many later batches.
Expected behavior
- Avoid repeated materialization/serialization while preserving all required comparisons and semantic grouping.
- Consider shared references, incremental retrieval, or existing batching facilities rather than introducing an arbitrary history ceiling.
- Preserve resumability and equivalent matching results across batches.
- Use a synthetic large-history regression to measure the relevant workbench payload/memory behavior separately from model context size.
#149 remains open but predates some of the shipped matching changes. Its scope should be reassessed against the remaining duplication instead of restoring obsolete limits.
Two open branches overlap here: #149 is the focused contributor implementation for bounded scan-history payloads, while #153 folds that work into a larger, currently conflicted aggregate that also includes #120, #121, #122, and #155. Prefer #149 as the implementation for this issue; keep matching isolation, renderer resilience, cosmetic alignment, and report severity behavior separate unless a specific integration regression requires coordination.