Skip to content

Commit 49f968f

Browse files
rodion-mclaude
andcommitted
Forward remark field from grep results when present
The backend now sends an optional remark field on grep matches (e.g. when lineText was truncated or when a match is multiline). Forward it to the LLM only when non-null. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 28f4681 commit 49f968f

1 file changed

Lines changed: 14 additions & 7 deletions

File tree

src/utils/response_transformer.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,19 +62,26 @@ def transform_grep_response(grep_results: Dict[str, Any]) -> Dict[str, Any]:
6262
item["matchCount"] = result["matchCount"]
6363
if result.get("matches"):
6464
item["matches"] = [
65-
{
66-
"lineNumber": match.get("lineNumber"),
67-
"startColumn": match.get("startColumn"),
68-
"endColumn": match.get("endColumn"),
69-
"lineText": match.get("lineText"),
70-
}
71-
for match in result["matches"]
65+
_build_match_dict(match) for match in result["matches"]
7266
]
7367
formatted_results.append(item)
7468

7569
return {"results": formatted_results, "hint": _GREP_HINT}
7670

7771

72+
def _build_match_dict(match: Dict) -> Dict[str, Any]:
73+
"""Build a match dict, forwarding remark only when present."""
74+
entry: Dict[str, Any] = {
75+
"lineNumber": match.get("lineNumber"),
76+
"startColumn": match.get("startColumn"),
77+
"endColumn": match.get("endColumn"),
78+
"lineText": match.get("lineText"),
79+
}
80+
if match.get("remark") is not None:
81+
entry["remark"] = match["remark"]
82+
return entry
83+
84+
7885
# Backward-compatible aliases (deprecated)
7986
transform_search_response_to_json = transform_search_response
8087
transform_grep_response_to_json = transform_grep_response

0 commit comments

Comments
 (0)