| 124 | |
| 125 | |
| 126 | def _load_task_hint() -> str: |
| 127 | if not os.environ.get("JCODE_HARBOR_ENABLE_HINTS"): |
| 128 | return "" |
| 129 | task_name = os.environ.get("JCODE_HARBOR_CURRENT_TASK", "").strip() |
| 130 | hints_path = os.environ.get("JCODE_HARBOR_TASK_HINTS_FILE", "").strip() |
| 131 | extra = os.environ.get("JCODE_HARBOR_EXTRA_PREAMBLE", "").strip() |
| 132 | parts: list[str] = [] |
| 133 | if extra: |
| 134 | parts.append(extra) |
| 135 | if task_name and hints_path: |
| 136 | path = Path(hints_path).expanduser() |
| 137 | try: |
| 138 | hints = json.loads(path.read_text()) |
| 139 | except Exception: # noqa: BLE001 |
| 140 | hints = {} |
| 141 | hint = hints.get(task_name) if isinstance(hints, dict) else None |
| 142 | if isinstance(hint, str) and hint.strip(): |
| 143 | parts.append(hint.strip()) |
| 144 | if not parts: |
| 145 | return "" |
| 146 | return "\nAdditional benchmark retry guidance:\n" + "\n\n".join(parts) + "\n\n" |
| 147 | |
| 148 | |
| 149 | def _load_final_payload(output_dir: Path) -> dict[str, Any] | None: |