Repository navigation
fix(tier3): canonicalize truncated Harbor case IDs - #204
efegokdemir wants to merge 4 commits into
Conversation
|
@efegokdemir, Thanks for creating this PR. please add a PR description covering the problem being fixed, a concrete before/after example if there are any. Please also explain how the benchmark-verdict test relates to the case-ID fix, so reviewers can understand the full scope. |
Signed-off-by: Efe Gökdemir <[email protected]>
9595dab to
d631950
Compare
rng1995
left a comment
There was a problem hiding this comment.
I reviewed against main at 472c12f (collector.py is the same on current main) and found three issues, all P3, posted inline.
The main one: the runner always passes case_id_by_task_selector to collect_harbor_results, so a normal Tier 3 run never reaches the new prefix branch in _canonical_case_id. On that path, base already resolves Harbor-truncated trial names through the task path in result.json. This tree also has no per-case token table in BENCHMARK.md, so I couldn't reproduce the #192 phantom rows here. Details are on the CHANGELOG line. Where the branch does run (direct calls without a selector map), the prefix rule is broader than Harbor's 32-character truncation.
Checked and fine:
- The two parametrized prefix tests fail on main and pass here.
- Ambiguous prefixes stay unchanged, and an exact match still wins.
- The new benchmark-card test also passes on main, so it is a regression guard only. Its negative assertion matches the real PASS callout format (
benchmark.py:767), so it is not vacuous.
| distribution Node/npm before Harbor's own installers. Native, gateway Codex, | ||
| and NVIDIA Build agents now provision Node/npm only on the installer branches | ||
| that need them, while preserving installed-agent and version-pin checks. | ||
| - Canonicalised uniquely truncated Harbor task IDs against the evaluation |
There was a problem hiding this comment.
[P3] CHANGELOG describes a phantom-row fix that Tier 3 runs never reach
The entry says this keeps token-usage coverage on the real case instead of producing phantom rows. I don't think this change does that for a normal Tier 3 run:
- The runner is the only production caller of
collect_harbor_results(tier3/harbor/runner.py:4527). It always passescase_id_by_task_selector, which is neverNone(runner.py:4349). - With that map,
_apply_harbor_result_case_identitytakes the case ID from the task path in result.json and marks the reward_authoritative_entry_id, or_trusted_case_identity_unresolvedif the lookup fails (collector.py:4096-4107)._entry_idthen returns at line 4412 or 4417, before_canonical_case_idruns. The new prefix branch never executes on that path. - Harbor truncates only the trial directory name (
task_name[:32].rstrip('_-')inTrialConfig.generate_trial_name). The task path in result.json keeps the full ID, so main already resolves truncated trials to the canonical case on the runner path. - This tree's
BenchmarkReporterhas no per-case token-usage table; the HTML report only charts token totals per agent. The table in [BUG]: Generated BENCHMARK.md does not faithfully explain a passing gate and splits canonical case IDs #192 comes from a 1.5.6 report.
How I checked: I built a dual-arm Harbor job tree with Harbor's result models and 32-character trial names (huggingface-factory-peft-sft-loc__..., huggingface-global-negative-serv__...), including a run where the baseline times out on both long cases. I ran collect_harbor_results on this branch and on main at 472c12f (collector.py is the same on current main), with a spy on _canonical_case_id.
- With the runner's selector map, base and this branch produce identical summaries and saved reward.json files, all with canonical IDs. The spy saw 0 calls with expected IDs.
- Output only differs for a direct call with no selector map, a result.json with no task path or task name, and a reward.json with no
entry_id. There, base fails coverage (Unexpected scored cases: huggingface-factory-peft-sft-loc, huggingface-global-negative-servandMissing scored attempts ...). It does not publish phantom rows.
Suggested fix: Reword the entry to what actually changed, for example "Collector calls without a task-selector map now resolve a uniquely truncated case ID to its dataset case." If the goal is the #192 rows, add a regression test on the runner/report path that fails without the change.
| expected_id | ||
| for candidate in candidates | ||
| for expected_id in expected_case_ids | ||
| if expected_id.startswith(candidate) |
There was a problem hiding this comment.
[P3] Prefix rule is wider than Harbor's truncation and can map unrelated IDs onto a case
expected_id.startswith(candidate) accepts any unique prefix, with no length or shape check. Harbor only shortens trial names, and always as task_name[:32].rstrip('_-'). This rule also applies to grader-written entry_id values and result.json task names, which Harbor never truncates, and it matches IDs as short as one character. So an ID that is not in the dataset is now counted as a real case if it happens to be a unique prefix of one.
This only runs when collect_harbor_results is called without case_id_by_task_selector (see the CHANGELOG comment). On that path the Unexpected scored cases and Missing scored attempts checks used to fail closed, and test_unexpected_case_fails_execution_coverage relies on that.
What I ran (main at 472c12f, then this branch, no selector map):
_entry_id({"entry_id": "case-1"}, {"case-10", "case-2"})givescase-1, thencase-10."c"against{"case-10"}also becomescase-10.- Trials for
case-2andcase-1, expected["case-10", "case-2"]. Base:failed, withUnexpected scored cases: case-1andMissing scored attempts for cases: case-10. This branch:succeededwith no errors, and the case-1 score is counted as case-10. - A copy of
test_unexpected_case_fails_execution_coveragewith expected IDs["case-evil-twin"]and graderentry_idcase-evil. Base:failed. This branch:succeeded. - Grader
entry_idcase-0with expected["case-001"]. pass@k reportspassed_cases: 1, but the saved reward.json still sayscase-0, because_save_trialsonly rewrites a missing or result-derived ID (collector.py:5825). The per-trial file and the summary then disagree.
Suggested fix: Require Harbor's truncation shape: expected_id[:32].rstrip("_-") == candidate, for exactly one expected ID. With that check, both #192 examples and the new tests still pass (I checked), and case-1 no longer maps to case-10. Add a negative test that case-1 against expected {"case-10"} still fails with Unexpected scored cases.
|
|
||
|
|
||
| def test_canonical_case_id_prefers_exact_match_over_longer_prefix() -> None: | ||
| assert _entry_id({"entry_id": "case-prefix"}, {"case-prefix", "case-prefix-long"}) == "case-prefix" |
There was a problem hiding this comment.
[P3] Exact-match preference test cannot fail
This test passes entry_id="case-prefix", which is already in the expected set. _entry_id returns it at the early raw_entry_id in expected_case_ids check (collector.py:4420), so the new prefix block never runs. The test passes on main. It also passes against a mutant that checks prefixes before the exact-candidate loop and returns the longest match, which is the regression the test name describes.
Ordering only matters when a candidate becomes exact after suffix stripping. With expected {"case-prefix", "case-prefix-long"}, _entry_id({"_trial_name": "case-prefix_attempt1__AbC1234"}, ...) and _canonical_case_id("case-prefix-with-skill", ...) return case-prefix on this branch and case-prefix-long on the mutant.
Suggested fix: Use one of those inputs and assert case-prefix.
|
After reproducing the current Tier 3 runner/report flow, I confirmed that the runner supplies the task-selector mapping and canonical case IDs are recovered from the persisted task paths. I could not reproduce the reported #192 phantom-row behavior on current main. The remaining collector-only improvement affects direct calls without that mapping and does not establish a production fix for #192. I'm closing this PR rather than expanding its scope without evidence. Thanks for the detailed review and feedback. |
Summary
Harbor may truncate task IDs in result directory names. For example, the case ID
huggingface-factory-peft-sft-local-returnmay be reported ashuggingface-factory-peft-sft-loc; the collector restores the full ID only when the reported ID uniquely matches a prefix, leaving ambiguous IDs unchanged. The benchmark-card test is separate: it prevents incomplete agent results from being reported as PASS and does not test ID mapping.Verification
Ran
uv run --no-dev --with pytest pytest -q tests/tier3/test_harbor_result_entry_id.py tests/golden/test_benchmark_card.py(53 passed).make lintmake testmake buildRelease Impact
CHANGELOG.md