Skip to content

fix(harbor): fix bridge tool names, macOS downloads, aggregate jobs and 3.9 graders - #849

Merged
rng1995 merged 4 commits into
mainfrom
naren/harbor-runtime-fixes
Nov 23, 2026
Merged

rng1995 merged 4 commits into
mainfrom
naren/harbor-runtime-fixes

Conversation

@rng1995

@rng1995 rng1995 commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Four independent fixes to the Tier 3 Harbor runtime.

  • NVIDIA Build tool-call names. On the Anthropic Messages route (/v1/messages), the in-trial NVIDIA Build bridge accepts only tool names made of letters, digits, _ and - in what it sends to the backend: it drops other declared tools and refuses replayed tool_use blocks with such names. It did not check the tool-call names in the backend's completions. A completion that called a tool such as bad.tool was streamed to the agent, and once that call was in the conversation history, every later Messages request that replayed it was refused. The bridge now checks the tool-call names in every completion on both the Messages and the Responses (/v1/responses) routes. If any name falls outside [A-Za-z0-9_-], it rejects the whole completion before the first stream event, and the client gets a 502 backend_error with no partial stream. The Responses route still forwards declared function tools and replayed function_call items with any name, so on that route a backend call to a declared tool whose name falls outside that set, which was streamed before, is now also refused with a 502. OpenAI-compatible clients such as Codex already limit tool names to that set. Valid names that the request did not declare are still passed through on both routes.
  • macOS AppleDouble members in local downloads. On macOS, tar adds ._<name> AppleDouble members for files and directories that carry extended attributes. When the local environment packed a directory to download it, those synthetic members made the download fail: the transfer check looks up each archive member in the source directory, and no such ._ file exists there. The pack command now runs with COPYFILE_DISABLE=1. Real ._ files that a user wrote are still copied, and the containment checks are unchanged.
  • Provenance log for retained aggregate Harbor jobs. When Tier 3 runs cases or attempts as separate Harbor jobs (for example with stop-on-pass or a run budget), SkillEvaluator merges their trials into one aggregate Harbor job directory per arm. Harbor's analyzer finds job directories by their job.log, which the aggregate did not have. The aggregate now gets a job.log holding a JSON record: kind: "skillevaluator_retained_aggregate", the aggregate job name and id, the trial total, the name of each source job and, when that job's result.json parses as a Harbor job result, its id, and a note that the trials were retained from source jobs and not run again. The record does not claim a new agent execution.
  • Custom grader on Python 3.9. The bundled custom grader runner runs under the task environment's python3. It checked scores with isinstance(value, int | float), which raises TypeError on Python 3.9. The runner's error handler then wrote an overall score of 0.0 to reward.json and reward.txt, so on a task image whose python3 is 3.9 every custom-graded trial scored 0.0, and in default_plus_custom mode SkillEvaluator's own default score (for example 0.8) was replaced with 0.0 as well. It now uses isinstance(value, (int, float)). Booleans, non-finite values and values outside [0, 1] are still rejected. Evaluations that ran custom graders on such images should be rerun.

Changes

  • src/skillevaluator/tier3/harbor/nvidia_build_bridge.py: _validate_chat_tool_call, which checks completions for both routes, rejects a tool-call name that _is_chat_tool_name does not accept (tool call name is unsupported by NVIDIA Build). Request translation is unchanged.
  • src/skillevaluator/tier3/harbor/local_environment.py: run the directory-pack tar command with env={"COPYFILE_DISABLE": "1"}.
  • src/skillevaluator/tier3/harbor/runner.py: in _merge_attempt_jobs only, record each source job's name, and its id when its result.json parses, and write the aggregate job.log.
  • src/skillevaluator/tier3/harbor/templates/custom_grader_runner.py: use the (int, float) tuple in _numeric.
  • tests/test_nvidia_build_bridge.py: malformed names (., :, /, space, newline, en dash) fail before any Anthropic or Responses event; valid unregistered names, including a 96-character one, still work; over HTTP, on both /v1/messages and /v1/responses, a malformed name is a 502 with no event: lines, the name is not echoed, and, once the bridge worker has finished, the bridge log records invalid_backend_response.
  • tests/test_harbor_local_environment.py: macOS-only test that both download methods keep an authored ._authored.txt, add no generated ._ members after xattr is set on the directory and a selected file, and leave the source and environment root unchanged.
  • tests/test_harbor_runner_status.py: merging two attempts produces an aggregate that the installed Harbor analyzer (_resolve_trial_dirs) and JobScanner find, with a job.log that names the aggregate and both source jobs.
  • tests/tier3/test_judge_failure_artifacts.py: add True and False to the rejected score cases.
  • .github/workflows/ci.yml and scripts/classify_ci_changes.py: run the macOS-only AppleDouble test in the tier3-macos job, which runs on pull requests, and add tests/test_harbor_local_environment.py to the classifier's list of the test files that job runs.
  • scripts/ci/smoke_harbor_verifier.py: the Package job's Python 3.9 step also stages custom_grader_runner.py next to the verifier and runs it with a stub grader in custom_only and default_plus_custom modes. It checks the written scores, that a boolean custom metric is dropped, and that the default overall score of 0.8 is kept in default_plus_custom mode.
  • CHANGELOG.md: four entries under ## Unreleased / ### Fixed.

Verification

  • 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

Ran locally on macOS (Python 3.12, Harbor 0.25.0, pytest -n 3):

  • The 4 changed test modules (tests/test_nvidia_build_bridge.py, tests/test_harbor_local_environment.py, tests/test_harbor_runner_status.py, tests/tier3/test_judge_failure_artifacts.py): 531 passed, 2 skipped (Windows-only taskkill cases). This includes the 27 new cases, and the macOS-only AppleDouble test ran. Two other runs of the same modules on a heavily loaded machine had timing failures in tests this PR does not change: test_bridge_ready_file_creation_refuses_symlinks (3-second subprocess timeout) once, and test_bounded_harbor_process_failure_reaps_descendants[timeout] in both. Both passed when rerun on this branch, and the second also fails under load on unchanged main.
  • 17 existing modules that exercise the changed code (the local-mode, local-upload, Claude background-task and refusal-fallback, public-runtime, transport-rule and local-agent tests; the timeout-recovery, baseline-timeout, stop-on-pass and budget tests that call _merge_attempt_jobs, and the runner-artifact tests; tests/test_harbor_runtime_skill_isolation.py for the grader template; and tests/test_oss_packaging.py): 1550 passed, 3 skipped, 2 failed. Both failures are environment-only: tests/test_tier3_public_runtime.py::test_verifier_refreshes_adc_token_on_401_for_vertex_openapi and ::test_verifier_refreshes_adc_token_on_401_via_gcloud_cli fail with the same Unexpected auth header assertion on unchanged main, because they pick up the test machine's Google ADC setup.
  • 18 modules: the 4 changed test modules, tests/test_ci_workflows.py and tests/test_ci_change_classifier.py (which check the CI jobs' test lists against the classifier), and 12 modules that read CHANGELOG.md or the CI scripts (tests/ci/test_image_build.py, tests/test_select_docs_tests.py, tests/test_benchmark_rollout_docs.py, tests/test_tier3_progress.py, tests/test_oss_packaging.py, tests/test_harbor_claude_refusal_fallback.py and six Tier 3 report and dataset modules): 1703 passed, 2 skipped.
  • ruff check and ruff format --check on the 10 changed Python files: passed.

Two of these fixes need a specific platform or interpreter, which the default CI test jobs do not provide:

  • The AppleDouble test is skipped except on macOS. This PR adds it to the tier3-macos job, which runs on pull requests. With the COPYFILE_DISABLE change reverted, both parameterisations fail locally with FileNotFoundError on a generated member: download_dir_with_exclusions on ._., which the directory's extended attribute produces, and download_dir_filtered on ._keep.txt, because it archives only the selected files.
  • CI's test jobs use Python 3.12 or later, where int | float works, and the added True/False cases also pass on main. The Package job's Python 3.9 step now runs the custom grader runner, as described under Changes. Locally, with a Python 3.9.6 task interpreter, that step passes on this branch and fails with main's template in place, with TypeError: unsupported operand type(s) for | in custom_only mode. Run directly under Python 3.9.6 in default_plus_custom mode, main's template replaced a default score of 0.8 with 0.0 in reward.txt and reward.json. Loaded under Python 3.9.6, this branch's _numeric returns 0.5, 1.0 and 0.0 for 0.5, 1 and 0, and None for True, False, NaN, infinity, -0.01, 1.01 and the string '0.5'.

Release Impact

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

🤖 Generated with Claude Code

…nd 3.9 graders

Four independent fixes to the Tier 3 Harbor runtime:

- The NVIDIA Build bridge rejects backend tool-call names outside
  [A-Za-z0-9_-] before any Anthropic or Responses stream event, so a
  completion with such a name never reaches the agent. The client gets
  a 502 backend_error instead.
- Local directory downloads pack with COPYFILE_DISABLE=1 so macOS tar
  does not add AppleDouble members for extended attributes. Those
  members made the transfer check fail on ._ source files that do not
  exist.
- Merged aggregate Harbor jobs get a job.log provenance record naming
  their source jobs, so Harbor's analyzer can discover them.
- The custom grader runner uses an (int, float) isinstance tuple, so it
  runs on Python 3.9 task interpreters.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Narendran Raghavan <nraghavan@nvidia.com>

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Thanks @rng1995 for this contribution. The source changes look good. All four comments are about test coverage and release-note wording: two new regression tests do not guard their fixes in CI, one log assertion depends on timing, and the CHANGELOG entry understates the effect on users. Findings: 4 P3 (no P1 or P2).

Comment thread tests/test_harbor_local_environment.py Resolved
Comment thread tests/test_nvidia_build_bridge.py Resolved
Comment thread CHANGELOG.md Resolved
Run the AppleDouble download test in the Tier 3 macOS job and list its
file in the CI change classifier. Extend the Python 3.9 verifier smoke
check to stage the custom grader runner and score a stub grader in both
custom grading modes. Wait for the bridge worker before reading the 502
log line, and read the log as UTF-8. Describe the effect of the Python
3.9 grader failure on scores in the changelog.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Narendran Raghavan <nraghavan@nvidia.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 tidy set of fixes, and the second commit closes out the earlier review points: the macOS test now runs in the tier3-macos job with the classifier list kept in sync, the Python 3.9 smoke step exercises the grader runner, the 502 log assertion waits for the worker, and the changelog says what users actually saw.

What I verified:

  • Bridge: the check sits in _validate_chat_tool_call, which both translators already pass through. The bridge's own generated names (_chat_tool_alias, namespace flattening) stay inside [A-Za-z0-9_-], so nothing the bridge produces can trip it. The new unit and HTTP tests fail on main and pass here.
  • macOS downloads: COPYFILE_DISABLE is per-exec only (Harbor's _merge_env does not persist it), it passes the env filter, and the sandbox bootstrap hands it to tar. On a Mac where new files pick up com.apple.provenance xattrs, ten existing download tests in tests/test_harbor_local_environment.py fail on main with the same ._ FileNotFoundError and pass with this change, so the fix matters beyond the new test.
  • Aggregate job.log: Harbor only checks that the file exists and never parses it, so the JSON record is safe. The new test fails on main with Harbor's "not a job directory (no job.log)" error and passes here.
  • Python 3.9 grader: ran the template under a real 3.9.6 with the smoke script's stub grader in both modes. This branch passes; main's template raises the TypeError in _numeric, and in default_plus_custom mode that is what turned a 0.8 default score into 0.0. The template already has from __future__ import annotations, so the float | None annotations are fine, and ast.parse(..., feature_version=(3, 9)) accepts it.
  • CI routing: adding the file to TIER3_PLATFORM_TESTS makes changes to it trigger the macOS job; it skips nothing. tests/test_ci_workflows.py and tests/test_ci_change_classifier.py pass.

The three red Tests jobs are tests/test_cli_banner.py::test_noninteractive_invocations_preserve_streams_and_exit_codes[args2-0-stdout] (-h exits 2). The same test fails the same way on several other open PRs from the same window and this PR does not touch the CLI, so that one is not yours.

Not blocking: four unrelated fixes in one PR is more than I would normally take, since PRs land as one squashed commit and reverting one fix means reverting all four. It is fine this time because each is a few lines with its own regression test, but please split next time.

rng1995 and others added 2 commits November 22, 2026 20:40
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Narendran Raghavan <nraghavan@nvidia.com>
Signed-off-by: Narendran Raghavan <nraghavan@nvidia.com>
@rng1995
rng1995 merged commit ef7cb52 into main Nov 23, 2026
24 checks passed
@rng1995
rng1995 deleted the naren/harbor-runtime-fixes branch November 23, 2026 06:37
@rng1995 rng1995 mentioned this pull request Nov 23, 2026
10 tasks done
@chrisknvidia chrisknvidia mentioned this pull request Nov 23, 2026
6 of 7 tasks
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.

2 participants