Repository navigation
fix(tier3): retry transient Claude Code and Codex install failures - #277
Conversation
Harbor runs each agent installer once. A dropped download, DNS hiccup, package mirror error or npm registry timeout during setup failed the whole trial before the agent started, and SkillEvaluator does not enable Harbor's trial-level retries, so one transient network error could leave an agent without a score. SkillEvaluatorCodex and SkillEvaluatorClaudeCode now wrap Harbor's own install() in a bounded retry: up to three attempts, 2 s and then 4 s apart, within Harbor's agent setup timeout. Only a Harbor command that exited non-zero (NonZeroAgentExitCodeError, including NetworkConnectionError) is retried; the platform probe's RuntimeError, transport errors and cancellation still propagate on the first occurrence. Harbor's install() skips a CLI an earlier attempt already installed, so rerunning it is safe. The gateway Codex, NVIDIA Build and container Claude Code wrappers inherit the retry; local mode, which checks the host CLI instead of installing, is unchanged. Harbor's stock installers are reused as is, rather than patching their shell commands, so future Harbor installer changes still apply. 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 with Claude Code. The retry wrapper is correct: it retries only Harbor's NonZeroAgentExitCodeError, lets probe, transport and cancellation errors through, and shares Harbor's setup timeout. Local agents are unaffected. The 16 new tests and ruff pass locally. One P3 below.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Signed-off-by: Narendran Raghavan <[email protected]>
92f3b00 to
b8a527e
Compare
Conflicted files: docs/agents-and-sandboxes.mdx 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 retry wrapper is bounded (3 attempts, 2 s then 4 s), only catches the non-zero-exit error, and re-runs Harbor's own install(), whose version check skips a CLI that is already there, so a retry should not redo finished work. Probe, transport and cancellation errors still pass straight through, and the local agents are untouched. Two non-blocking points: the retry ignores how long the failed attempt took, and the warning drops the failure text.
No conflicts. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
A retried install shares Harbor's agent setup timeout, so a slow failure retried until the trial ended with a setup timeout instead of the install error. An attempt that took over a third of the agent's setup timeout, or that would leave no room for another attempt as long, is now raised without retrying. The retry warning now ends with the redacted, single-line tail of Harbor's error, which holds the failed command's stderr, so each attempt's cause is visible at the default log level. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
…re detail Skip the retry when the failed attempt already used a third of Harbor's agent setup timeout, so the original error is not replaced by AgentSetupTimeoutError. Include the tail of the failure message in the retry warning. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Signed-off-by: Narendran Raghavan <[email protected]>
…nstall-retries Conflicts in installed_agents.py and test_installed_agent_install_retry.py; kept the redacted retry detail and the setup-budget guard, whose tests cover the slow-attempt and warning cases. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
Resolve the CHANGELOG.md conflict: keep main's new Unreleased entry and put this PR's entry after it. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
Resolve the CHANGELOG.md conflict: keep main's install-retry entry (#277) and add this PR's stop-on-pass entry after it. Signed-off-by: Narendran Raghavan <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
Summary
SkillEvaluator's container wrappers for Claude Code and Codex now retry a failed agent CLI install instead of failing the trial on the first attempt.
SkillEvaluatorCodex.install()andSkillEvaluatorClaudeCode.install()intier3/harbor/installed_agents.pywrap Harbor's owninstall()in a bounded retry: up to 3 attempts, waiting 2 s and then 4 s, with a warning log line per retry.NonZeroAgentExitCodeError, which includes Harbor'sNetworkConnectionError) is retried. That covers the vendor installer (Claude'sbootstrap.sh, NVM,npm install -g) and the distribution package install for Node/npm. The platform probe'sRuntimeError, transport errors such asTimeoutError, and cancellation still propagate on the first occurrence.install()to check the host CLI, so they are unchanged and still fail fast when the CLI is missing.docs/agents-and-sandboxes.mdx(Agents) describes the retries and their bounds.### Fixed.Why
Harbor runs each agent installer once. A dropped download, a DNS hiccup, a package mirror error or an npm registry timeout during setup fails the whole trial before the agent starts, and SkillEvaluator does not configure Harbor's trial-level retries. On a multi-agent or multi-case run, one transient network error during setup can turn a trial into an execution error and leave an agent without a score.
Retrying is safe: Harbor's
install()first checks whether the requested CLI version is already present, so a retry skips a CLI that an earlier attempt installed. All attempts run inside Harbor's agent setup timeout, so an install that keeps failing still fails the trial, with the same exception Harbor raised before.Kept from public
install()instead of rewriting or patching installer shell commands, so it does not pin installer URLs and it picks up future Harbor installer changes._installer_dependencies) and its tests are unchanged, including the fail-fast on an unrecognized platform probe and the propagation of probe transport errors. The new tests confirm that neither is retried.Tests
tests/tier3/test_installed_agent_install_retry.py(16 tests) drives the real Harbor install flow against a fake environment:test_transient_installer_failure_is_retried: acurl: (6) Could not resolve hostfailure on the first installer run is retried once and the install completes, for the Codex, Claude Code, gateway Codex, NVIDIA Build and container Claude Code wrappers.test_persistent_installer_failure_stops_after_bounded_attempts: after 3 failed attempts the originalNetworkConnectionErrorpropagates, with backoff delays of 2 s and 4 s.test_transient_system_package_failure_is_retried: a failed distribution Node/npm install on the npm installer branch is retried.test_platform_and_transport_errors_are_not_retried: an unrecognized platform probe and a probeTimeoutErrorfail on the first attempt, with no sleep and no installer run.test_local_agents_do_not_retry_a_missing_host_cli: local mode still fails once when the host CLI is missing.pytest tests/tier3/test_installed_agent_install_retry.py tests/tier3/test_installed_agent_bootstrap.py tests/tier3/test_harbor_local_agents.py tests/tier3/test_gateway_codex.py tests/test_harbor_gke_mode.py: 581 passed.pytest -n 8 tests/tier3 tests/test_harbor_*.py tests/test_oss_packaging.py tests/test_tier3_public_runtime.py tests/test_ci_change_classifier.py, rebased on currentmain: 9658 passed, 14 skipped, 15 failed. All 15 fail the same way on unmodifiedmainand do not touch the agent install path. Twotest_sidecar_retains_*tests intest_harbor_secure_docker_environment.pydepend on host environment variables. Thirteentest_generated_custom_only_script_*tests intests/tier3/test_judge_failure_artifacts.pyrun the generated verifier with the host'spython3, which is Python 3.9 on the test machine.tests/test_oss_packaging.py,tests/test_tier3_public_runtime.py,tests/test_ci_change_classifier.py: 429 passed.ruff check,ruff format --checkandscripts/check_oss_boundary.py: passed.🤖 Generated with Claude Code