From 1839a536a1ebc95f5a73ec00138600b32cf24d8c Mon Sep 17 00:00:00 2001 From: Seongho Bae Date: Fri, 4 Sep 2026 01:05:36 +0900 Subject: [PATCH] perf(ci): add a no-marker fast path to extract_model_prose MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Salvaged from .github#1416 ("Bolt: extract_model_prose 빠른 반환 경로 추가"), whose branch bundled three changes against a stale base: - extract_model_prose's fast path: still valid, applied here. - max_tokens: REVIEW_MAX_OUTPUT_TOKENS -> 16 in the preflight request: superseded by ADR-0005's own escalation design already on main (REVIEW_PREFLIGHT_BASE_TOKENS = 16, escalating to REVIEW_PREFLIGHT_ESCALATED_TOKENS only when a response is truncated) -- not carried over. - curl --max-time 30 -> 60 in the sidecar preflight: superseded by a later main-side change that removed the timeout entirely, per ADR-0003 ("model inference forbids a wall-clock timeout"), replacing it with a bounded-attempt retry loop instead -- carrying this over would reintroduce exactly what ADR-0003 forbids. For the one idea that's still current: most model responses contain neither SENTINEL_PREFIX nor CONTROL_START, so scanning every line for both prefixes is wasted work. Bolt's own version of this fast path (`return raw_output.strip()`) wasn't quite behavior-preserving -- splitlines()/join("\n") normalizes CRLF and other exotic line separators the plain .strip() path leaves untouched, so a raw model response using non-LF line endings would come back different from before. Fixed to `"\n".join(raw_output.splitlines()).strip()`, which is byte-for-byte identical to the slow path's output while still skipping its per-line prefix-matching loop. .github#1416 will be closed as fully addressed once this merges. Co-Authored-By: Claude Sonnet 5 --- scripts/ci/opencode_review_surfaces.py | 8 ++++++++ tests/test_opencode_review_surfaces.py | 25 +++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/scripts/ci/opencode_review_surfaces.py b/scripts/ci/opencode_review_surfaces.py index b314cddf00..55756d1ea9 100644 --- a/scripts/ci/opencode_review_surfaces.py +++ b/scripts/ci/opencode_review_surfaces.py @@ -329,6 +329,14 @@ def _language(value: str) -> str: def extract_model_prose(raw_output: str) -> str: """Return the human review body, stripping sentinel and control JSON.""" + if ""): + skipping_control = False + continue + lines.append(line) + slow_result = "\n".join(lines).strip() + + assert fast_result == slow_result == "line one\nline two\n\nline three" + + def test_format_request_changes_keeps_model_prose_and_strips_fake_anchor() -> None: """REQUEST_CHANGES keeps the model walkthrough and never cites workflow:1.""" body = surfaces.format_request_changes_review(