Sdm0 commited on
Commit
08ccb9c
Β·
verified Β·
1 Parent(s): 4f44dcf

bound review model prompt size

Browse files
Files changed (1) hide show
  1. nodes/correctness_reviewer.py +8 -2
nodes/correctness_reviewer.py CHANGED
@@ -23,7 +23,10 @@ PROMPT_FILE = Path(__file__).resolve().parent.parent / "prompts" / f"correctness
23
  # Max characters of context to include in the prompt (soft limit)
24
  MAX_CONTEXT_CHARS = 6_000
25
  # Max changed-file content to include per file
26
- MAX_FILE_CONTENT_CHARS = 4_000
 
 
 
27
 
28
 
29
  # ─── Load prompt from file ──────────────────────────────────────────────────
@@ -72,7 +75,10 @@ def _build_prompt(state: OpenCodeReviewState) -> str:
72
  lines: list[str] = []
73
 
74
  lines.append("## Diff\n```diff")
75
- lines.append(state.diff or "")
 
 
 
76
  lines.append("```\n")
77
 
78
  # Changed files with full content (truncated per file)
 
23
  # Max characters of context to include in the prompt (soft limit)
24
  MAX_CONTEXT_CHARS = 6_000
25
  # Max changed-file content to include per file
26
+ MAX_FILE_CONTENT_CHARS = 1_200
27
+ # Keep model requests below free-provider token limits. Deterministic checks
28
+ # still inspect the complete diff from state.diff.
29
+ MAX_DIFF_CHARS = 14_000
30
 
31
 
32
  # ─── Load prompt from file ──────────────────────────────────────────────────
 
75
  lines: list[str] = []
76
 
77
  lines.append("## Diff\n```diff")
78
+ diff = state.diff or ""
79
+ if len(diff) > MAX_DIFF_CHARS:
80
+ diff = diff[:MAX_DIFF_CHARS] + "\n… (diff truncated for model context)"
81
+ lines.append(diff)
82
  lines.append("```\n")
83
 
84
  # Changed files with full content (truncated per file)