Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .jules/bolt.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,9 @@
## 2026-08-29 - [대용량 텍스트 스캔 시 정규표현식 대신 네이티브 메서드 활용]
**Learning:** `scripts/ci/opencode_review_normalize_output.py`의 라벨 스캐닝 루프에서 긴 LLM 리뷰 텍스트를 대상으로 `pattern.finditer()`를 호출하는 패턴이 있었습니다. 마이크로 벤치마크 결과, 단순 문자열 매칭에서는 네이티브 `str.find()`와 `while` 루프를 조합하는 것이 정규표현식 실행 오버헤드 없이 훨씬 빠르다는 것을 확인했습니다.
**Action:** 내부 탐색 루프에서 정확히 일치하는 리터럴 문자열(라벨 접두사 등)을 검색할 때는 `re.compile(re.escape(string)).finditer()` 대신 고도로 최적화된 Python 네이티브 `text.find(candidate, index)` 메서드를 사용하십시오. 단, 무한 루프를 방지하기 위해 루프의 모든 분기에서 인덱스가 올바르게 진행되도록 보장해야 합니다.
## 2026-09-02 - [대용량 텍스트 파싱 전 O(N) 서브스트링 검사 최적화]
**Learning:** `scripts/ci/opencode_review_surfaces.py`의 `extract_model_prose` 함수와 같이, 대용량 텍스트를 줄 단위로 순회(loop)하며 특정 마커 문자열(sentinel, control)을 검사하는 경우, 마커가 아예 존재하지 않는 입력값(순수 텍스트)이 주어졌을 때에도 매 줄마다 불필요한 split과 반복적인 prefix 매칭을 수행하므로 성능 저하(Cold Path)가 컸습니다. 마이크로 벤치마크 결과, 마커가 없는 긴 텍스트에서 실행 시간이 약 95% 단축되었습니다.
**Action:** 대용량 텍스트를 파싱하기 전, 먼저 C 기반으로 고도로 최적화된 `in` 연산자(또는 `str.find()`)를 사용해 필수 조건 문자열의 존재 여부를 가장 먼저 확인하여 빠른 반환 경로(Fast Path)를 만들어야 합니다.
## 2026-09-02 - [Reduce max_tokens in Preflight requests]
**Learning:** In `scripts/ci/contextual_orchestrator_review_launcher.py`, sending `max_tokens: 4096` during the sidecar preflight check (which only asks the model to "Reply with just 'OK'.") causes HTTP 413 `request_too_large` errors on providers or models that have smaller output context windows (e.g., 2048).
**Action:** Always set `max_tokens` to a very small number (like `16`) when sending dummy/preflight requests to external model providers to prevent 413 limit violations.
2 changes: 1 addition & 1 deletion scripts/ci/contextual_orchestrator_review_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def _preflight_review_agents(
{"role": "user", "content": "Reply with just 'OK'."},
],
"temperature": REVIEW_TEMPERATURE,
"max_tokens": REVIEW_MAX_OUTPUT_TOKENS,
"max_tokens": 16,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Undersized routes pass readiness

Routes capped below 4,096 output tokens pass _preflight_review_agents because its probe requests only 16 tokens. Runtime requests still reserve 4,096, so those routes fail after startup.

Suggested change
"max_tokens": 16,
"max_tokens": REVIEW_MAX_OUTPUT_TOKENS,
Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

"stream": False,
}
try:
Expand Down
3 changes: 3 additions & 0 deletions scripts/ci/opencode_review_surfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,9 @@ def _language(value: str) -> str:

def extract_model_prose(raw_output: str) -> str:
"""Return the human review body, stripping sentinel and control JSON."""
if "<!-- opencode-review-" not in raw_output:
return raw_output.strip()
Comment on lines +332 to +333

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Review line endings remain unnormalized

For marker-free input with non-LF separators, extract_model_prose preserves them instead of converting them to LF. Direct callers can publish inconsistently formatted reviews.

Prompt for agents
Preserve extract_model_prose's existing newline-normalization contract while retaining a fast path for ordinary marker-free LF text. The old splitlines/join path converted CRLF, bare CR, and every other separator recognized by str.splitlines() to LF. Restrict the early return to input that contains none of those non-LF separators, or add an efficient equivalent normalization path. Add regression coverage comparing marker-free CRLF, bare-CR, and Unicode separator inputs with the prior behavior.
Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.


lines: list[str] = []
skipping_control = False
for line in raw_output.splitlines():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def test_preflight_mirrors_runtime_request_and_keeps_only_compatible_routes() ->
assert endpoint == "chat/completions"
assert payload["model"] == agent.model
assert payload["stream"] is False
assert payload["max_tokens"] == 4096
assert payload["max_tokens"] == 16
assert payload["temperature"] == 1.0
assert payload["messages"] == [
{"role": "system", "content": "You are a helpful assistant."},
Expand Down
Loading