Repository navigation
fix(tier3): name Docker address-pool exhaustion and document trial network cleanup - #557
Conversation
…tworks Each trial's Compose project normally creates its own Docker network, and Docker carves those from a small set of default address pools. When an interrupted or killed run leaves the networks behind, later trials fail with "all predefined address pools have been fully subnetted". The secure Compose error puts the long command line before Docker's stderr, so the 600-character trial failure reason cut that line off and nothing named the cause. The trial failure reason now places a short note right after the exception type when Docker's message reports exhausted address pools. The note names the cause and points at the scoped listing of Compose networks or a lower --n-concurrent. The exception type stays first, so reason consumers that match on the type prefix are unaffected. The documented cleanup for leftovers now covers a SkillEvaluator process that is killed rather than interrupted, lists stopped containers too, and lists and removes the trials' Compose networks after their containers, keeping the advice to check project names first. A new troubleshooting entry covers the address-pool error without suggesting a host-wide network prune. Signed-off-by: Narendran Raghavan <nraghavan@nvidia.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The leftover-resources note now stands in its own bullet, so "a Windows run" read as if any Windows run left containers behind. Only an interrupted run does: Ctrl+C on Windows stops the Harbor task tree at once, without the graceful teardown wait. Name the skipped or exceeded Ctrl+C wait and a Ctrl+C on Windows directly. Signed-off-by: Narendran Raghavan <nraghavan@nvidia.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ddress-pool note Docker refuses to remove a network that still has a container attached. After a killed run or a Ctrl+C on Windows, a leftover trial container can still be running on its Compose network, so following the address-pool note in the trial failure reason (which named only the networks) ended in an "has active endpoints" error. The note now lists both the trial containers and the networks with the scoped Compose label filter, asks to check their names, and removes the containers with docker rm -f before the networks with docker network rm, matching the documented recipe. It still fits well inside the 600-character reason bound and never suggests a host-wide prune. Signed-off-by: Narendran Raghavan <nraghavan@nvidia.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Narendran Raghavan <nraghavan@nvidia.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
rng1995
left a comment
There was a problem hiding this comment.
The change targets a real recovery problem. Docker's address-pool error used to fall past the 600-character reason cut. Now the failure reason names that cause right after the exception type, and the documented cleanup covers the leftover Compose networks, removing containers before networks. The new tests pass and pin the note's placement, content and length. Two small gaps remain. First, the note is added to any exception whose message contains Docker's phrase, including agent-command failures that embed the agent's own output. Second, the concurrency advice names only --n-concurrent, but parallel agents multiply the number of trial networks.
The note was added to any exception whose message quoted Docker's address-pool error. Agent exit errors carry the agent's own stdout and stderr, so an agent that read a log quoting that error and then failed on, for example, a 401 got a reason that started with host cleanup advice. The note also pushed the 401 line past the 600-character cut, so the trial was no longer classed as an agent runtime failure. Add the note only when the exception type is not an agent runtime failure type and Docker's error follows Compose's "failed to create network" prefix. Signed-off-by: Narendran Raghavan <nraghavan@nvidia.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
--n-concurrent limits concurrent trials per agent, and agents run in parallel up to --max-agents, which defaults to every selected agent. Several agents at the default --n-concurrent can use up Docker's address pools without that flag ever being raised, so the note now offers a lower --n-concurrent or --max-agents. It still fits well inside the 600-character reason cut. Signed-off-by: Narendran Raghavan <nraghavan@nvidia.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each running trial holds a network, so a run holds up to --n-concurrent networks for each agent running in parallel, and up to --max-agents agents run in parallel. The address-pool Troubleshooting entry now says so and offers a lower --n-concurrent or --max-agents. Signed-off-by: Narendran Raghavan <nraghavan@nvidia.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Narendran Raghavan <nraghavan@nvidia.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
chrisknvidia
left a comment
There was a problem hiding this comment.
This is worth merging. It is a small fix, not urgent. On main nothing in a trial failure names Docker's address-pool error (the long Compose command comes first and the 600-character cut drops Docker's line), and the documented cleanup lists containers only, even though docker rm -f leaves the Compose network behind. The PR names the cause in the failure reason and extends the cleanup docs to the networks, without removing anything on the user's Docker host.
What I flagged earlier looks fixed. The note is now added only when the exception is not an agent failure type and Docker's error follows Compose's failed to create network, so an agent whose output quotes Docker's phrase keeps its real error: I re-ran my case (a NonZeroAgentExitCodeError with a 401 line before the Docker phrase) and _agent_runtime_failure_reason returns the reason again, with no note. The note and the Troubleshooting entry now name --max-agents next to --n-concurrent and say that each running trial holds a network. When I remove either guard from the new code, the new guard tests fail.
Not verified: I could not run Docker, so I did not see the pool error or the cleanup itself. The PR's own test module imports Harbor, which is too old in my environment, so I ran the 27 collector-only cases it adds in isolation (they pass here, and 5 fail on main); the end-to-end collection test I could not run. CI is green and the branch merges cleanly with main.
Signed-off-by: Narendran Raghavan <nraghavan@nvidia.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review follow-up on No new source defect confirmed. The earlier agent-output misclassification and max-agents guidance findings are addressed. The full collector/runtime-failure module passed 158 tests with pinned Harbor 0.25.0. I did not deliberately exhaust Docker network pools or delete networks/containers; failure classification and report propagation were checked with result artifacts/tests. Please resolve the current merge conflict and preserve container-before-network cleanup guidance. |
Signed-off-by: Narendran Raghavan <nraghavan@nvidia.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summary
Each Docker-mode trial's Compose project normally creates its own Docker network, and Docker carves those networks from a small set of default address pools. A skipped or exceeded Ctrl+C wait, a Ctrl+C on Windows, or a killed SkillEvaluator process can leave a trial's containers and its Compose network behind. Once enough networks pile up, every new trial fails with
all predefined address pools have been fully subnetted.On main, two things make this hard to recover from:
docker rm -f. It never mentions the Compose networks, which are what use up the pools.This PR names the cause in the trial failure reason and fixes the documented cleanup. It does not add any automatic removal of Docker resources.
Changes
collector._exception_details: when Compose fails to create a trial network (failed to create network ...) with Docker's address-pool error (all predefined address pools have been fully subnettedorcould not find an available, non-overlapping IPv4 address pool, any case), the reason places a short note right after the exception type. The note names the cause, lists the leftover trial containers and networks (docker ps -a --filter label=com.docker.compose.projectanddocker network ls --filter label=com.docker.compose.project), asks to check their names, and removes the containers withdocker rm -fbefore the networks withdocker network rm, because Docker refuses to remove a network that still has a container attached. It also offers a lower--n-concurrentor--max-agents. The note is 368 characters, so it fits inside the reason's 600-character bound together with the exception type.NonZeroAgentExitCodeError,AgentTimeoutError,ApiRateLimitErrorand the rest), so their reasons, and the agent runtime classification that reads them, stay as recorded.docs/tier3-live-evaluation.mdx: the leftover-resources note is now its own bullet. It names a skipped or exceeded Ctrl+C wait, a Ctrl+C on Windows, and a SkillEvaluator process killed rather than interrupted (for example withkillor by a cancelled CI job). It lists stopped containers too (docker ps -a --filter label=com.docker.compose.project), lists the Compose networks (docker network ls --filter label=com.docker.compose.project), and removes the containers withdocker rm -fbefore the networks withdocker network rm. The advice to check project names before removing anything stays.docs/tier3-live-evaluation.mdxTroubleshooting: a new entry forall predefined address pools have been fully subnettedexplains the cause. Each running trial holds a network, so a run holds up to--n-concurrentnetworks for each agent running in parallel, and up to--max-agentsagents run in parallel, every selected agent by default. The entry gives the same scoped recipe, or a lower--n-concurrentor--max-agents. It does not suggestdocker network prune, which would also remove other projects' unused networks on a shared host.CHANGELOG.md: one Fixed entry under Unreleased.Kept from public
RuntimeError: <note> <message>). Code that matches reasons on their type prefix, such asAgentTimeoutError:in timeout recovery andAgentSetupNetworkError:in the setup retry check, behaves as before.exception.txtis still copied into the run output.docker rm -fanddocker network rmon the user's Docker host, and it still could not help when the SkillEvaluator process is killed, because the Harbor path has no SIGTERM or SIGHUP handling. That stays a separate decision.Tests
tests/test_harbor_collector_runtime_failures.py, 28 cases in 8 tests:test_docker_address_pool_exhaustion_is_named_before_the_reason_cut(3 cases: both Docker messages, plus upper case). Docker's line starts past character 600. The reason starts with the type and the note, names the scoped listing, never mentionsprune, and is exactly 600 characters.test_docker_address_pool_note_removes_trial_containers_before_networks: the whole note fits inside the cut, lists both containers and networks with the Compose label filter, asks to check their names, putsdocker rm -fbeforedocker network rm, ends withor lower --n-concurrent or --max-agents., and never mentionsprune.test_docker_address_pool_note_without_exception_type: a Compose network failure with no exception type also gets the note.test_docker_address_pool_error_outside_compose_network_creation_gets_no_note(2 cases): Docker's phrase quoted in a verifier log, and the phrase ahead of an unrelatedfailed to create networkerror, keep their reasons unchanged.test_agent_runtime_failures_get_no_address_pool_note(18 cases, one per agent runtime failure type): a Compose-shaped address-pool message keeps its reason unchanged.test_agent_failure_quoting_docker_address_pool_error_keeps_its_reason: aNonZeroAgentExitCodeErrorwhose stdout hasAPI Error: 401 Unauthorizedbefore a quoted Docker address-pool error._agent_runtime_failure_reasonreturns the full recorded reason with the 401 line and no note.test_other_docker_network_failures_get_no_address_pool_note: another network failure keeps its reason unchanged.test_trial_failure_names_docker_address_pool_exhaustion: end to end throughcollect_harbor_results, the trial failure reason names the cause.PYTHONPATHpointing at main'ssrc): 6 failed and 22 passed. The 6 failures are the tests that expect the note. The 22 guard tests pass on main as expected, because main adds no note.test_harbor_timeout_recovery.py, the docs tests that readtier3-live-evaluation.mdx,test_ci_workflows.py,test_oss_packaging.pyandtest_ci_change_classifier.py): 916 passed, 26 failed. The same 26 tests also fail on main 33b382f in the same local environment, which has Harbor 0.24 installed while the project pins 0.25: 24 fail importingharbor.agents.agent_auth_resolution, 1 compares the environment keyword contract with the installed Harbor source, and 1 istest_validate_tier3_writes_the_same_report_pair. They are not affected by this change.ruff checkandruff format --checkon the changed.pyfiles: clean.scripts/check_oss_boundary.py: passed.main8b19b2fe3. Against open PR Enable public plugin assessment and saved-run reports #394,git merge-tree --write-treeconflicts only in the files where Enable public plugin assessment and saved-run reports #394 already conflicts withmain; none of them is a file this PR changes apart fromCHANGELOG.md.🤖 Generated with Claude Code