Skip to content

fix(store): one local registry container per port, never removed - #43

Merged
polakamtejas merged 2 commits into
mainfrom
tejas/local-registry-per-port
Oct 5, 2026
Merged

polakamtejas merged 2 commits into
mainfrom
tejas/local-registry-per-port

Conversation

@polakamtejas

@polakamtejas polakamtejas commented Oct 1, 2026 •

Copy link
Copy Markdown
Collaborator

The local image store brings up a registry:2 container named agentenv-registry on first push. If registry_host named a different port from the one that container publishes, bring-up ran docker rm -f on it and started a fresh one. That deleted every image pushed to the old registry.

Change (store/image_store/local_registry_image_store.py): each port gets its own container, and bring-up never removes one.

  • The default port 5000 keeps agentenv-registry; any other port gets agentenv-registry-<port>. Registries on different ports run side by side, and each restarts by name with its own images.
  • A registry already answering /v2/ is used as is, a missing container is created, and a stopped one is started.
  • An older version ran agentenv-registry on whatever port was configured. If that container is on another port when port 5000 needs the name, bring-up stops with:
agentenv-registry is using port 5001, not 5000: point registry_host at port 5001, or remove the container

Not handled: an older version's agentenv-registry on a non-default port that is stopped when you upgrade. A push to that port creates a new, empty agentenv-registry-<port>, and the old images stay in the stopped container. It takes a non-default port, the older version and a container stopped by hand (--restart unless-stopped brings it back after a reboot, and a running one keeps answering /v2/ and is used as before), so there's no code for it.

Testing

  • tst/unit/store/local_registry_image_store_test.py (7 tests, docker faked):
    • port 5000 runs agentenv-registry, port 5001 runs agentenv-registry-5001
    • a serving registry is left alone
    • a stopped container is started under its port's name (5000 and 5001)
    • an older agentenv-registry on another port is refused and never removed
    • a docker failure is surfaced
  • Live, against real Docker on unused ports 5097 and 5098, next to a running agentenv-registry on 5000: both came up as agentenv-registry-5097 / -5098 alongside it. After docker stop agentenv-registry-5097, the next push restarted the same container (same id). The test containers were removed afterwards.
  • Unit tier: 5790 passed. The only 2 failures are the test_mcp_cli_builder tests, because the generated CLI's interpreter has no click. No plugin-API break.

🤖 Generated with Claude Code

RetriggerConfidence Score: 4/5

The PR is not ready to merge while a stopped older registry on a custom port can be replaced in use by an empty one.

Fix All in CursorFindings

  1. P1 Second registry cannot start ▶
Fix with agent prompt
### Issue 1
src/agent_env/store/image_store/local_registry_image_store.py:62-65
When `agentenv-registry` already serves port 5000, a store configured for port 5001 tries to use the same container name. The new port-mismatch branch raises an error, so pushes to the second store fail. Give each port its own container name while keeping `agentenv-registry` for port 5000.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

The local image store now names managed registries by port and refuses to replace an older container mapped to a different port. This keeps existing registry images in place while letting another configured port use its own container.

  • Port 5000 keeps agentenv-registry; other ports use agentenv-registry-<port>.
  • Registries already answering /v2/ stay in use, and stopped containers on the requested port are started.

Reviews (3) · Last reviewed commit: "fix(store): name the local registry cont..."

@polakamtejas
polakamtejas requested a review from a team as a code owner October 1, 2026 23:11
Comment thread src/agent_env/store/image_store/local_registry_image_store.py Outdated
Comment thread tst/unit/store/local_registry_image_store_test.py Outdated
Comment thread src/agent_env/store/image_store/local_registry_image_store.py Outdated
…er port

When registry_host named a port other than the one the `agentenv-registry`
container publishes, bring-up ran `docker rm -f` on it and started a fresh
one, deleting every image pushed to the old registry. It now stops with an
error naming both ports and the two ways out: point registry_host at the
container's port, or remove the container yourself. Nothing else changes: a
registry already answering is used, a missing one is created, and a stopped
one on the right port is started.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@polakamtejas
polakamtejas force-pushed the tejas/local-registry-per-port branch from ef7e2d0 to d0dcd75 Compare October 2, 2026 04:07
@polakamtejas polakamtejas changed the title fix(store): give each local registry port its own container, and never remove one fix(store): refuse, never remove, a local registry container on another port Oct 2, 2026
Comment thread src/agent_env/store/image_store/local_registry_image_store.py
agentenv-registry stays the default port's container; any other port gets
agentenv-registry-<port>, so registries on different ports coexist instead of the second
being refused, and each restarts by name with its own images. The port-mismatch refusal
remains for an older version's agentenv-registry, which it ran on any port.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@polakamtejas polakamtejas changed the title fix(store): refuse, never remove, a local registry container on another port fix(store): one local registry container per port, never removed Oct 3, 2026
@polakamtejas
polakamtejas merged commit 98b91e7 into main Oct 5, 2026
14 checks passed
@polakamtejas
polakamtejas deleted the tejas/local-registry-per-port branch October 5, 2026 15:06
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