Repository navigation
fix(tier3): omit local Codex credential dirs from stop-on-pass merges - #276
Conversation
In local mode, Codex keeps its runtime home and credential under each trial's agent log dir: codex-secrets/auth.json holds the API key (or an uploaded host auth.json) and codex-home/auth.json links to it. Harbor removes both only in a best-effort cleanup that swallows errors, so a timed-out or cancelled trial can leave them behind. With --stop-on-pass, the per-attempt jobs are snapshotted with the secure copier before they are merged. A leftover auth.json symlink made that copy fail closed, so the run could not finalize, and a regular-file auth.json was copied into the merged job together with the credential. Pass an ignore callback to the attempt snapshot that drops codex-home and codex-secrets only directly under <trial>/agent or <trial>/steps/<step>/agent (Harbor's multi-step layout). Paths are matched against the copier's own lexical source root, so platform root aliases such as macOS /tmp keep working. Every other path, including the same names at any other depth, still goes through the existing symlink and hard-link checks. The source attempt jobs are left unchanged. Share the directory names between SkillEvaluatorLocalCodex and the runner through the dependency-free tier3.harbor package, and pin them with a test so the exclusion tracks the agent's paths. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
rng1995
left a comment
There was a problem hiding this comment.
Reviewed the diff in full context. No findings. The ignore callback is limited to /agent and /steps//agent, so the secure copier's symlink and hard-link checks still apply everywhere else; the new tests cover both copy backends, all three auth.json layouts, the multi-step layout and a set of look-alike paths that must still fail closed. Constants are shared with local_agents.py and a test pins them to the agent class. tests (-k merge_attempt_jobs, 54 passed) and ruff pass locally. Minor style note only: runner.py imports the private _absolute_lexical helper from secure_copy; a public alias would be cleaner but is not worth blocking on.
Reviewed with Claude Code.
2b187c4 to
532f94e
Compare
Conflicted files: CHANGELOG.md Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
chrisknvidia
left a comment
There was a problem hiding this comment.
The ignore callback is wired correctly: _merge_attempt_jobs has one snapshot copy of the source job, and the later per-trial copy and the final publish both read from that filtered snapshot, so the dirs are gone from every copy after it. The same callback runs for both secure-copy backends, and the manifest rebuild uses the same callback, so the copy-time recheck agrees. One gap: the depth match only covers a step name with a single path component.
With --harbor-keep-jobs the whole _harbor-jobs directory is kept, including the untouched source attempt dirs, so the leftover codex-secrets/auth.json is still on disk there. This PR stops the second copy and the failed merge, which is fine, but the description reads as if the key no longer reaches retained output. Worth saying that in the description, or scrubbing the two dirs from the source attempt once the snapshot is taken.
The stop-on-pass merge only dropped leftover local Codex runtime dirs in <trial>/agent and <trial>/steps/<one component>/agent. Step names may span several path components, so a step such as phase/author kept the old behavior: a linked codex-home/auth.json failed the merge, and a regular codex-secrets/auth.json was copied into the merged job. Read the step names the trial declares in its result.json (or in the attempt root's trial_results entry, the merge's own fallback) without following links, validate them as the runtime preflight does, and also drop the dirs in those step agent dirs. Undeclared, absolute and dot-segment step paths still go through the secure copier's link checks. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
Conflicted files: CHANGELOG.md. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
* docs(changelog): move entries released in 0.7.0-0.7.2 out of Unreleased 0.7.0 (#314) and 0.7.1 (#327) never cut their sections on main, and 0.7.2 (#335) added its section below the whole Unreleased block, so Unreleased still listed work that had already shipped. Place each Unreleased entry under the release that shipped the PR that added it: - 0.7.0: the published section from the 0.7.0 tag, verbatim. It already holds the six entries that main had filed under 0.6.0, so 0.6.0 again matches the v0.6.0 tag, including the original run_config.json entry. - 0.7.1: #264 #271 #274 #281 #284 #289 #293 #299 #316 #317 #318 #323 #324 #326 #327, plus the #320 wording of the Windows Git-root entry, since #320 changed that 0.7.0 fix in 0.7.1. - 0.7.2: #263 #265 #269 #270 #276 #279 #287 #290 #296 #309 #328 #330 merged with the existing #335 entries. Only post-v0.7.2 entries stay under Unreleased, with one heading per subsection. Entry text is unchanged, apart from the published tag wording in 0.7.0 and 0.6.0. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> * chore(release): prepare v0.8.0 Set the package, fallback, lock, citation and developer-guide versions to 0.8.0 and move every entry merged since v0.7.2 under '## 0.8.0 - 2026-11-05', leaving Unreleased empty. The refusal-fallback documentation test now reads the release section that names CLAUDE_CODE_DISABLE_REFUSAL_FALLBACK, requires it to be 0.8.0, and requires exactly one entry there to name the switch. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> * chore(release): pin the verified 0.8.0 Tier 1 image and add its CI bundle Pin onboarding to the Tier 1 image published by the reviewed main revision 55d2d04 in "Build and publish Tier 1 image" run 42158955180: ghcr.io/nvidia/skillevaluator-tier1@sha256:9d5483243918937be4f2178f74cf7c622a531dee41e3176906994d52fa14950a (config sha256:d17d6f5105ec5f1bf0cbe4dff0d693aae4ecf01e9c1c6a6ddb7830518acace33). The workflow and publisher refs both move to 55d2d04. ci/bundles/0.8.0 mirrors the 0.7.2 bundle. The templates, README and release.json are the run's github-actions-onboarding artifact and match ci/render_templates.py output for these pins byte for byte. The scanner inventory and verification receipt come from the build's runtime-stage version step, the five-case smoke receipt, the onboarding job's anonymous pull, and the public manifest, whose config digest equals the smoke-tested image ID. The ZIP uses the 0.7.2 layout (sorted members, inner checksums, 1980 timestamps, 0644, deflate level 9) and rebuilds to identical bytes. Point the current-bundle links at 0.8.0 and list 0.7.2 as historical. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Narendran Raghavan <[email protected]> --------- Signed-off-by: Narendran Raghavan <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
Summary
--stop-on-passruns with local-mode Codex now finalize even when Harbor's Codex cleanup did not run. The merged per-arm job no longer contains the Codex credential._merge_attempt_jobssnapshots each attempt job withcopytree_secure. That snapshot now gets an ignore callback that dropscodex-homeandcodex-secretsin two places only:<trial>/agent<trial>/steps/<step>/agent, where Harbor 0.24's multi-step trials move agent logs after each stepcopytree_secure's own lexical source root, so platform root aliases still work (for example macOS/tmp->/private/tmp).artifacts/agent/codex-home.LOCAL_CODEX_HOME_DIRNAMEandLOCAL_CODEX_SECRETS_DIRNAMElive in the dependency-freeskillevaluator.tier3.harborpackage.SkillEvaluatorLocalCodexbuilds its_REMOTE_CODEX_HOME/_REMOTE_CODEX_SECRETS_DIRfrom them, and so does the runner's exclusion set, so the two cannot drift apart.Why
In local mode,
SkillEvaluatorLocalCodexkeeps Codex's runtime home and credential under each trial's agent log dir, not/tmp, so that concurrent trials do not share them. Harbor's Codex agent works like this:codex-secrets/auth.json, which holds theOPENAI_API_KEYvalue or an uploaded hostauth.json.ln -sfto pointcodex-home/auth.jsonat that file.finallyblock that swallows every exception.If a trial times out, is cancelled, or the cleanup command fails, both dirs stay in
<trial>/agent/.With
--stop-on-pass, those per-attempt jobs are then snapshotted before the merge:auth.jsonsymlink made the secure copy fail with "symlink or reparse point". The merge failed closed and the run could not finalize.auth.jsonwas copied into the merged job together with the API key. With--harbor-keep-jobsthat copy stays on disk.Docker and the other backends keep
CODEX_HOMEat/tmp/codex-homeinside the container, so they are not affected. Runs without--stop-on-passdo not merge attempts, so they are not affected either.Kept from public
copytree_secure, so links anywhere else in a trial still reject the merge. A 15-path test pins this._merge_attempt_jobsare unchanged. The second copy reads from the private snapshot, so it needs no change.SKILL_IDENTIFIEDcase. That part is not ported. The only internal-only piece is ascore_mismatchdiagnostic field, which is left out to keep this PR focused.Tests
New tests in
tests/test_harbor_runner_status.py, next to the existing merge tests:test_merge_attempt_jobs_omits_leftover_local_codex_credential_dirshas 12 cases. It is parametrized over:agent/and multi-stepsteps/step-1/agent/auth.jsonas a link tocodex-secrets, a link to a host file, or a regular fileEach case checks that both dirs are absent from the merged trial and that the key appears in no merged file. It also checks that trajectory, agent log, verifier reward, artifacts, and look-alike
artifacts/agent/codex-*paths are kept, that the merged trial result is valid, and that the source attempt is unchanged. Without the fix, all 12 cases fail: the linked layouts raise "symlink or reparse point", and the regular-file layout copies the credential.test_merge_attempt_jobs_codex_exclusions_track_local_codex_runtime_dirschecks thatSkillEvaluatorLocalCodexandSkillEvaluatorLocalNvidiaBuildCodexboth put their runtime dirs directly under Harbor'sEnvironmentPaths.agent_dir, using the excluded names.test_merge_attempt_jobs_rejects_auth_links_outside_trial_codex_dirshas 15 cases. A linkedauth.jsonat a trial root, understeps/, underartifacts/agent/, in a nestedagent/, or in look-alike dir names still rejects the merge, and a pre-existing aggregate is left untouched.The fixture key is synthetic and below Gitleaks' generic-key entropy threshold, so no allowlist entry is needed.
Validation:
tests/test_harbor_runner_status.py,test_harbor_runner_artifacts.py,test_harbor_secure_copy.py,test_harbor_local_mode.py,test_harbor_local_environment.py,test_harbor_local_upload.py,test_harbor_runner_environment.py,test_nvidia_build_bridge.py,test_tier3_public_runtime.py,test_oss_packaging.py,test_character_facts.py,test_harbor_runtime_skill_isolation.py,test_tier3_case_summary.py,test_tier3_progress.py,tests/tier3/andtests/reporting/test_tier3_scoped_reports.py: 8,225 passed, 7 skipped.ruff checkandruff format --checkpass on the changed files.🤖 Generated with Claude Code