Repository navigation
Description
Toolkit version
0.16.1 (OCR v1.14.6)
Platform
macOS arm64, ocr-ci review --local --incremental
Problem
A branch that changes only three Markdown files (about 250, 680 and 455 lines, 85–191 KB each) saved its baseline as
Incremental baseline: 3 groups, 0 qualified.
Unqualified groups by reason: read_verification 1, search_tool 2
Tool calls: file_read 33, code_search 9, ocr_toolkit_evidence 4, file_find 3, file_read_diff 1. Each repeat review of such a branch costs about 1.4 million tokens, so documentation reviews get no benefit from the Markdown reuse added in #353.
Each of the four rejection paths below is deterministic and is reached by ordinary native tool use on long Markdown documents:
| Native behavior (OCR 1.14.6) | Toolkit 0.16.1 | Reason counted |
|---|---|---|
file_read cuts a line longer than 2048 bytes, stops at 500 lines or at 256 KiB, and reports IS_TRUNCATED: true |
_read_observation requires IS_TRUNCATED: false |
read_verification |
code_search returns the first 100 matches plus a truncation note |
_render_search raises when there are more than 100 raw matches |
search_tool |
code_search with use_perl_regexp: true |
validated_replay_arguments rejects it |
search_tool |
code_search with pathspec magic in file_patterns, e.g. :(exclude)dir/ (the tool description suggests this form) |
rejected by _SEARCH_PATTERN |
search_tool |
All three changed files contain lines longer than 2048 bytes. In Cyrillic text that is about 1,000 characters, for example one long table row. One file also exceeds 500 lines. In one documentation-heavy repository, 129 of 667 Markdown files contain such lines and 30 files exceed 500 lines.
Synthetic reproducer
import json
from ocr_toolkit.local_incremental_dependencies import _read_observation
from ocr_toolkit.local_incremental_replay import _render_search
from ocr_toolkit.local_incremental_state import validated_replay_arguments, ReviewRange
rr = ReviewRange("a" * 40, "b" * 40)
def attempt(label, fn):
try:
fn(); print(label, "-> accepted")
except Exception as e:
print(label, "->", type(e).__name__, e)
long = "x" * 3000
resp = (f"File: doc.md (Total lines: 3)\nIS_TRUNCATED: true\nLINE_RANGE: 1-2\n1|short\n"
f"2|{long[:2048]} …[line truncated, 952 more bytes omitted]\n\n"
"Note: Lines longer than 2048 bytes were cut mid-line and the omitted bytes are not part of this result. "
"Reason about the visible part only.\n")
attempt("truncated read", lambda: _read_observation(
{"file_path": "doc.md", "start_line": 1, "end_line": 2}, resp, rr, ok=True))
rows = b"".join(b"%s:f.md\x00%d\x00hit\n" % (b"b" * 40, i) for i in range(1, 102))
attempt("search, 101 raw matches", lambda: _render_search(rows, "b" * 40))
attempt("use_perl_regexp", lambda: validated_replay_arguments("code_search",
json.dumps({"search_text": "A-(1|2)", "use_perl_regexp": True}).encode()))
attempt("pathspec exclude", lambda: validated_replay_arguments("code_search",
json.dumps({"search_text": "A-1", "file_patterns": [":(exclude)specs/"]}).encode()))Output: all four attempts raise IncrementalError. A plain code_search with file_patterns: ["docs/"] is accepted.
Proposal
The native outputs are pure functions of the immutable revision, the arguments and fixed native limits, so they can be verified instead of rejected:
- Truncated reads. Record the limits that applied: 500 lines, 2048 bytes per line with the rune-safe cut and the omitted-byte count, 256 KiB. Verify the rendered window by recomputing it from the blob with the same limits.
- Capped searches. Replay the search and compare the first 100 matches and the reported matched-file count, which the native note includes.
- Regex searches. Replay with the same
git grep -Pinvocation that OCR builds. - Pathspec magic. Accept the pathspec forms that OCR passes to
git grepand replay them unchanged. - Diagnostics. Split the reason counts so the user can see which of these applied, for example
read_truncated,search_capped,search_regex,search_pathspec.
Acceptance
A second incremental run of a Markdown-only branch whose groups read long-line files and used capped or regex searches reuses the groups whose files and replayed results are unchanged.
Activity
xeonvs commentedon Dec 2, 2026
Measured #369 on synthetic Markdown with the installed, qualified OCR 1.14.6. Control and candidate used identical revisions, model and settings. The local measurement adapter preserves the installed executable path and checks its qualified digest. Default release executable staging is unchanged.
The follow-up used 50.5% fewer input + output tokens on this fixture. On 0.16.1 zero of two groups qualified. On the candidate both initial groups qualified; the subsequent change required one fresh group. The known unit-conversion finding was carried byte for byte with its original provenance. On the candidate with the default filter, a separate first/follow-up pair used 91,172/53,049 tokens and 12/8 requests. That pair compares different review stages within one version. A read or search with unproved output still requires fresh review. The original issue's 1.4M figure was not independently reproduced.
Offline preparation measurements on a fixed range used fresh processes and warm OS caches. Standalone local preflight took 1.04–1.43 s. Preparation through the first request to a local deterministic peer took 4.53–5.03 s before and 2.80–2.88 s after the change; native preview also varied. Within preparation, evidence collection fell from 1.43–1.54 s to 0.98–1.01 s. Full collector tree walks fell from five to two, with byte-identical evidence and bootstrap. Peak RSS increased from approximately 103–104 to 109–110 MB. The first fixed MCP list request took 419–453 ms including cold server startup; the same query on the running server took approximately 1.5 ms, returned identical data, and issued no Git subprocesses.
Prepare 0.16.2: incremental review efficiency and CI deduplication (#369
Prepare 0.16.2 from protected dev (#371)
Release v0.16.2 (#372)
github-actions commentedon Dec 2, 2026
Stable v0.16.2 delivery is verified by immutable release asset
release-receipt.jsonin v0.16.2 (SHA-2566a08c5772052b1b6219d6cdf4086bd702b0dcd69a2414c65f9902b201ea92049).