|
26 | 26 | DEFAULT_JUDGE_TIMEOUT_SECONDS = 300 |
27 | 27 |
|
28 | 28 | # Judge result cache: maps cache_key -> GradeResult dict |
29 | | -# Cache key = hash of (task_id, transcript_summary, rubric, judge_model) |
| 29 | +# Cache key = hash of (task_id, transcript_summary, rubric, judge_model, workspace_content) |
30 | 30 | _judge_cache: Dict[str, Dict[str, Any]] = {} |
31 | 31 | _judge_cache_dir: Optional[Path] = None |
32 | 32 |
|
@@ -65,9 +65,15 @@ def _save_judge_cache() -> None: |
65 | 65 | logger.warning(f"Failed to save judge cache: {e}") |
66 | 66 |
|
67 | 67 |
|
68 | | -def _compute_cache_key(task_id: str, transcript: str, rubric: str, model: str) -> str: |
| 68 | +def _compute_cache_key( |
| 69 | + task_id: str, |
| 70 | + transcript: str, |
| 71 | + rubric: str, |
| 72 | + model: str, |
| 73 | + workspace_content: str = "", |
| 74 | +) -> str: |
69 | 75 | """Compute a cache key from grading inputs.""" |
70 | | - content = f"{task_id}|{transcript}|{rubric}|{model}" |
| 76 | + content = f"{task_id}|{transcript}|{rubric}|{model}|{workspace_content}" |
71 | 77 | return hashlib.sha256(content.encode()).hexdigest()[:16] |
72 | 78 |
|
73 | 79 |
|
@@ -288,7 +294,13 @@ def _grade_llm_judge( |
288 | 294 | rubric = task.llm_judge_rubric or _format_grading_criteria(task) |
289 | 295 |
|
290 | 296 | # Check cache before calling judge |
291 | | - cache_key = _compute_cache_key(task.task_id, transcript_summary, rubric, judge_model) |
| 297 | + cache_key = _compute_cache_key( |
| 298 | + task.task_id, |
| 299 | + transcript_summary, |
| 300 | + rubric, |
| 301 | + judge_model, |
| 302 | + workspace_content, |
| 303 | + ) |
292 | 304 | if cache_key in _judge_cache: |
293 | 305 | cached = _judge_cache[cache_key] |
294 | 306 | if verbose: |
@@ -534,7 +546,7 @@ def _read_workspace_files(workspace_path: str) -> str: |
534 | 546 | continue |
535 | 547 | try: |
536 | 548 | content = f.read_text(encoding="utf-8") |
537 | | - file_contents.append(f"### File: {rel}\n{content[:3000]}") |
| 549 | + file_contents.append(f"### File: {rel}\n{content}") |
538 | 550 | except (OSError, UnicodeDecodeError): |
539 | 551 | pass |
540 | 552 | return "\n\n".join(file_contents) |
|
0 commit comments