Skip to content

fix(tier3): canonicalize truncated Harbor case IDs - #204

Closed
efegokdemir wants to merge 4 commits into
NVIDIA:mainfrom
efegokdemir:efe/fix-benchmark-report-consistency-192
Closed

efegokdemir wants to merge 4 commits into
NVIDIA:mainfrom
efegokdemir:efe/fix-benchmark-report-consistency-192

Conversation

@efegokdemir

@efegokdemir efegokdemir commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Harbor may truncate task IDs in result directory names. For example, the case ID huggingface-factory-peft-sft-local-return may be reported as huggingface-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).

  • I am familiar with the Contributing Guidelines
  • Added or updated focused tests
  • Updated documentation for user-visible changes
  • Ran make lint
  • Ran make test
  • Ran make build
  • Did not add credentials, private datasets, or proprietary benchmark content

Release Impact

  • No user-visible release note needed
  • Updated CHANGELOG.md

@chrisknvidia

chrisknvidia commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

@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.

@efegokdemir
efegokdemir force-pushed the efe/fix-benchmark-report-consistency-192 branch from 9595dab to d631950 Compare October 14, 2026 03:42

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread CHANGELOG.md
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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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 passes case_id_by_task_selector, which is never None (runner.py:4349).
  • With that map, _apply_harbor_result_case_identity takes the case ID from the task path in result.json and marks the reward _authoritative_entry_id, or _trusted_case_identity_unresolved if the lookup fails (collector.py:4096-4107). _entry_id then returns at line 4412 or 4417, before _canonical_case_id runs. The new prefix branch never executes on that path.
  • Harbor truncates only the trial directory name (task_name[:32].rstrip('_-') in TrialConfig.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 BenchmarkReporter has 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-serv and Missing 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)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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"}) gives case-1, then case-10. "c" against {"case-10"} also becomes case-10.
  • Trials for case-2 and case-1, expected ["case-10", "case-2"]. Base: failed, with Unexpected scored cases: case-1 and Missing scored attempts for cases: case-10. This branch: succeeded with no errors, and the case-1 score is counted as case-10.
  • A copy of test_unexpected_case_fails_execution_coverage with expected IDs ["case-evil-twin"] and grader entry_id case-evil. Base: failed. This branch: succeeded.
  • Grader entry_id case-0 with expected ["case-001"]. pass@k reports passed_cases: 1, but the saved reward.json still says case-0, because _save_trials only 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"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.

@efegokdemir

Copy link
Copy Markdown
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants