Skip to content

fix(tier3): keep malformed optional usage metadata unavailable - #725

Merged
rng1995 merged 5 commits into
NVIDIA:mainfrom
Afloat16:fix/unavailable-malformed-usage-metadata
Nov 18, 2026
Merged

rng1995 merged 5 commits into
NVIDIA:mainfrom
Afloat16:fix/unavailable-malformed-usage-metadata

Conversation

@Afloat16

Copy link
Copy Markdown
Contributor

Summary

measured_condition_usage() reads optional trajectory final_metrics without checking its container type. A JSON null, array, boolean, number or string raises an uncaught AttributeError, which can interrupt the collector while it is assembling otherwise completed Tier 3 results.

Treat a non-object metrics container as unavailable usage. Mark the condition incomplete for usage totals so a valid sibling trial cannot disguise the missing measurement. Existing metric validation, duplicate-trial handling and scores remain unchanged.

Verification

All ten new cases fail against the original implementation. They cover five malformed JSON value types both alone and alongside a measured trial, and require all condition totals to remain unavailable rather than partial.

python -m pytest tests/tier3/test_usage_metric_shapes.py tests/test_baseline_store.py tests/test_harbor_collector_multistep_trajectory.py -q — 118 passed, 2 failed.

The two failures are tests/test_baseline_store.py::test_runner_fresh_reused_and_incompatible[default] and [custom_only]. Both reproduce on unchanged base 8fe9723: the environment places the test's isolated output-provenance key inside a tree selected for evaluation, so the existing location guard refuses the run before collection. No successful full-module run is claimed.

  • I am familiar with the Contributing Guidelines
  • Added or updated focused tests
  • Updated documentation for user-visible changes (Unreleased changelog)
  • Ran make lint equivalent: python -m ruff check src tests
  • Full make test did not complete successfully in this environment (see below)
  • Ran make build equivalent: python -m build (wheel and sdist)
  • Did not add credentials, private datasets, or proprietary benchmark content

The unchanged base 8fe9723, tested with python -m pytest -x -q, stops after 456 passed and 19 deselected at tests/ci/test_gateway_benchmark_workflows.py::test_gitlab_enriched_tier1_applies_the_keyless_job_baselines[extra0-expected0]. The sandbox has no /tmp, while that workflow fixture explicitly invokes mktemp -d /tmp/skillevaluator-enriched-tier1.XXXXXX. The same test fails for the same reason on the retry branch. No full-suite pass is claimed.

Release Impact

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

Signed-off-by: Afloat <ShuffleMonkey@163.com>

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

Thanks, this is a real one. On main a null, list, string or number in final_metrics raises AttributeError, which is not in the except tuple, so one bad trajectory file takes down the whole collection step. The guard keeps all four usage fields None for the condition, which matches what the reports document (unavailable, never zero). I checked that the new tests fail without the source change and pass with it. Looks good to me.

Signed-off-by: Afloat <ShuffleMonkey@163.com>
Signed-off-by: Afloat <ShuffleMonkey@163.com>

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

Thanks, @Afloat16, for guarding malformed optional final_metrics. The condition stays unavailable when a trajectory's metrics are not an object, instead of aborting completed-result collection or reporting partial usage as complete. I found no new actionable issues on this head.

Validation: all 10 new usage-shape cases and all 34 existing baseline-store tests passed.

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

Thanks @Afloat16 for this contribution! I reviewed 92a8d54cff. I reproduced the problem on main, confirmed this change fixes it, checked that the new tests fail on main, and ran the new and related tests on this head (all pass). I left 2 inline comments (2 P3); please take a look.

Comment thread CHANGELOG.md Resolved
Signed-off-by: Afloat <ShuffleMonkey@163.com>
@rng1995
rng1995 enabled auto-merge (squash) November 18, 2026 05:14
@rng1995
rng1995 merged commit e3ede73 into NVIDIA:main Nov 18, 2026
25 checks passed
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