Repository navigation
feat: jobbench environment - #3070
Conversation
Signed-off-by: Christian Munley <[email protected]>
Signed-off-by: Christian Munley <[email protected]>
Signed-off-by: Christian Munley <[email protected]>
Signed-off-by: Christian Munley <[email protected]>
Signed-off-by: Christian Munley <[email protected]>
|
/claude review |
|
/ok to test 7920ae3 |
Signed-off-by: Christian Munley <[email protected]>
|
SHIP WITH CARE — one correctness blocker on judge-failure handling; the rest is solid. BLOCKER Judge-API failures silently score RISK
NOTE
Async paths look correct ( |
| ) | ||
| for index, rubric in enumerate(rubrics) | ||
| ] | ||
| results = [future.result()[0] for future in futures] |
There was a problem hiding this comment.
BLOCKER — judge-API failure silently scores reward=0.0 instead of routing to the failures sidecar.
WHAT BREAKS: judge.judge_rubric catches every exception (transport/timeout/auth/HTTP) and, after max_retries, returns a result with passed=False, score=0 rather than raising (vendor/judge.py:1427-1468). Here future.result()[0] takes that result and discards the debug dict that carries api_exit_code, so a total judge outage is indistinguishable from a genuinely-failing task: build_scorecard computes normalized_score=0.0 and verify() returns reward=0.0.
BLAST RADIUS: This is exactly the anti-pattern nemo_gym/judge.py exists to prevent. A JudgeError is supposed to tag the row _ng_failure_class="judge_failed" so rollout_collection routes it to <output>_failures.jsonl, excludes it from aggregate metrics, and retries it on resume. Because job_bench never raises JudgeError, an x.ai/Grok outage or bad JOB_BENCH_JUDGE_API_KEY mid-run silently records real 0-reward rows — corrupting eval reports and, if used for training, injecting false negative reward signal. Every task judged during the outage is affected.
FIX: Detect judge-call failure and raise JudgeError so judge_failsafe (already wrapping verify) routes the row. Inspect the discarded debug dict — judge_rubric returns (result, debug) and sets debug["api_exit_code"] to 1/2 on failure — and raise when a rubric never got a parsed response, e.g.:
results = []
for future in futures:
result, debug = future.result()
if debug.get("api_exit_code", 0) != 0:
raise JudgeError(f"Job-Bench judge call failed: {debug.get('error') or 'no response'}")
results.append(result)Import JudgeError from nemo_gym.judge. Without this, verified: false is the only thing standing between this env and silently corrupted numbers.
Signed-off-by: Christian Munley <[email protected]>
|
/ok to test 7b33310 |
|
/claude review |
| for index, rubric in enumerate(rubrics) | ||
| ] | ||
| judged = [future.result() for future in futures] | ||
| errors = [debug["error"] for _, debug in judged if debug["api_exit_code"]] |
There was a problem hiding this comment.
RISK — verify() misroutes unparseable-but-received judge responses to the failure sidecar.
if debug["api_exit_code"] is truthy for both api_exit_code == 2 (no response after retries: transport/timeout/auth — a genuine call failure) and api_exit_code == 1 (the judge did respond, but its JSON couldn't be parsed after all retries — see vendor/judge.py:1535, api_exit_code = 1 if raw_response else 2).
nemo_gym/judge.py's documented boundary is explicit: "a failed call (transport/timeout/auth/HTTP) → JudgeError → sidecar; a received-but-unparseable response is a legitimate wrong answer (let the parser score it, don't raise)." This code raises JudgeError for the unparseable case too.
WHAT BREAKS: a rubric where the judge returned malformed JSON already carries a valid result (passed=False, score=0). Instead of scoring that rubric as failed, the whole task is raised as JudgeError — routed to <output>_failures.jsonl, excluded from aggregate metrics, and retried on resume. BLAST RADIUS: a single persistently-malformed judge response on any one of N rubrics discards the N−1 correctly-judged rubrics for that task and pulls it out of the reported metric, biasing scores by dropping (rather than penalizing) tasks the judge struggled to grade.
FIX: gate on genuine call failures only — if debug["api_exit_code"] == 2 — so exit code 1 falls through to build_scorecard and is scored as a failed rubric.
|
SHIP WITH CARE New JobBench benchmark: OpenCode-sandboxed agent config + a resources server that runs tasks in a sandbox and scores deliverables with the official vendored weighted-rubric judge. The One RISK, inline on
Note (non-blocking): tests cover |
Signed-off-by: Christian Munley <[email protected]>
|
/ok to test 1ebb0f8 |
|
/claude review |
|
/claude review |
|
SHIP WITH CARE — new Job-Bench benchmark: resources server + vendored judge + four harness configs + arm64 Node fixes. Reviewed the scoring path with the hardest scrutiny since wrong rewards corrupt reports/training. It holds up:
Async/dependency conventions check out: the OpenAI judge client is sync and driven off the event loop via Findings:
Per repo policy, behavior-changing environment work needs real smoke-rollout evidence (not just green unit tests) — confirm that's recorded in the PR body before merge. No blocking correctness or async issues found. |
| raise | ||
|
|
||
| session_id = request.session[SESSION_ID_KEY] | ||
| self._sandboxes[session_id] = sandbox |
There was a problem hiding this comment.
NOTE — self._sandboxes[session_id] is only evicted inside verify() (line 216). If a rollout fails before /verify is reached (e.g. the agent's responses() raises, and HarnessAgent.run() closes the sandbox via _close_run_sandbox and re-raises without calling verify), this entry is never popped and the AsyncSandbox reference is retained for the life of the process.
WHAT BREAKS: _sandboxes grows without bound across failed rollouts; the cloud sandbox itself is freed by the agent's cleanup (and by ttl_s), so this is an in-process memory/reference leak, not a leaked cloud resource.
BLAST RADIUS: negligible for a 65-task eval; accumulates over long/high-failure training runs that reuse one resources-server process.
FIX: register a /close_session route (as osworld/tales do) that pops and stops any stored sandbox, or evict + stop the entry in a finally on the seed→verify lifecycle.
Signed-off-by: Christian Munley <[email protected]>
|
/ok to test 5987b47 |
|
/claude review |
Signed-off-by: Christian Munley <[email protected]>
|
/ok to test db6ac6f |
|
/claude review |
|
SHIP — LGTM, no reliability concerns. Reviewed the new Verifier/scoring — reward is the weighted-pass fraction ( Async — the synchronous judge (OpenAI sync client + Extraction safety — Agent setup — the New imports are declared in |
Signed-off-by: Christian Munley <[email protected]>
|
/ok to test 351281d |
|
/claude review |
|
SHIP WITH CARE — new Job-Bench benchmark (resources server + vendored LLM judge + benchmark configs) plus cross-arch fixes to the Node-based agent setup scripts. No blockers found; the verifier logic is sound and the tests are genuinely rigorous. What I verified
Non-blocking
Rollout evidence / smoke results are the human author's to confirm per the repo's behavior-changing-work bar (green unit tests alone aren't sufficient for a new scoring env); I can't run model compute here. |
| if saved is not None: | ||
| rubrics_source = await asyncio.to_thread(resolve_task_path, body.rubrics_file) | ||
| shutil.copyfile(rubrics_source, saved / "rubrics.json") | ||
| pending = saved / "request.partial" | ||
| pending.write_text(body.model_dump_json()) | ||
| pending.replace(saved / "request.json") | ||
| result = await sandbox.exec("tar -czf /tmp/output.tar.gz -C /workspace/output .") | ||
| if result.return_code != 0: | ||
| raise RuntimeError( | ||
| f"Failed to collect Job-Bench output: {result.stderr}; output={(result.stdout or '')[-4000:]}" | ||
| ) | ||
| partial = archive.with_suffix(".partial") | ||
| await sandbox.download("/tmp/output.tar.gz", partial) | ||
| with partial.open("rb") as stream: | ||
| os.fsync(stream.fileno()) | ||
| partial.replace(archive) | ||
| output_dir = local_dir / "output" | ||
| output_dir.mkdir() | ||
| with tarfile.open(archive, "r:gz") as tar: | ||
| # Agent-created environments may contain links outside the output tree. | ||
| runtime_dirs = {"venv", ".venv", "node_modules", ".git", ".cache", "__pycache__"} | ||
| members = ( | ||
| member | ||
| for member in tar | ||
| if (member.isfile() or member.isdir()) | ||
| and not runtime_dirs.intersection( | ||
| Path(member.name).parts if member.isdir() else Path(member.name).parts[:-1] | ||
| ) | ||
| ) | ||
| tar.extractall(output_dir, members=members, filter="data") |
There was a problem hiding this comment.
NOTE (operability): the tarball extraction (tar.extractall, line 254) and the artifact writes (shutil.copyfile/write_text, lines 227-230) run inline on the event loop, unlike the heavy judge work which is correctly offloaded via asyncio.to_thread. WHAT: at concurrency: 32, extracting/writing a large /workspace/output archive blocks all other verify coroutines on this server for the duration. BLAST RADIUS: reduced verify throughput, not incorrect scores. FIX (optional): wrap the extraction+copy block in asyncio.to_thread, consistent with _judge and resolve_task_path. Minor — author's call.
What does this PR do?
Checklist
pre-commit run --all-files) (so CI lint/format/copyright pass).git commit -s) (so the DCO check passes).