fix: use host.docker.internal for container-side Steward URL#401
fix: use host.docker.internal for container-side Steward URL#401
Conversation
- Add isAuthenticationError() helper for proper error classification - Improve try/catch coverage in agent creation and pairing flows - Update tests for new error handling paths
Containers on the milady-isolated bridge network cannot reach the host via localhost. Split STEWARD_API_URL into host-side (for orchestrator API calls) and container-side (for Docker env injection). Host-side: http://localhost:3200 (orchestrator → Steward) Container-side: http://host.docker.internal:3200 (container → Steward) The registerAgentWithSteward() function runs Python via SSH on the Docker host, so it correctly uses the host-side URL. The container env var STEWARD_API_URL now uses STEWARD_CONTAINER_URL which defaults to http://host.docker.internal:3200. Configurable via STEWARD_CONTAINER_URL env var for custom setups.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Tip You can disable sequence diagrams in the walkthrough.Disable the |
PR #401 Review —
|
| Issue | File | Severity |
|---|---|---|
host.docker.internal unavailable on Linux without --add-host |
docker-sandbox-provider.ts:79 |
High |
No Steward deregistration on docker start failure |
docker-sandbox-provider.ts:469-473 |
Medium |
Doc still shows localhost:3200 for container |
docs/steward-container-provisioning.md:12 |
Medium |
Silent fallback on bad JSON in extractStewardToken |
docker-sandbox-provider.ts:160-164 |
Low |
Forbidden → 401 should be 403 |
route.ts:30,91 |
Low |
| Regex escapes only first dot in domain alias | pairing-token.ts:37-38 |
Low |
| Tight timeout for Steward registration over SSH | docker-sandbox-provider.ts:210 |
Low |
No POST auth error test |
milady-create-routes.test.ts |
Low |
The Linux host.docker.internal issue is the most significant concern and should be validated against the actual production node OS before merging. Everything else is low-to-medium.
|
Combined into #403 (fix/steward-security-migrations) |
Problem
Containers on the
milady-isolatedbridge network receiveSTEWARD_API_URL=http://localhost:3200. Inside a bridge network,localhostresolves to the container itself, not the Docker host. This means containers cannot reach the Steward vault service running on the host at port 3200.Impact: All 9 containers on milady-core-1 have been silently unable to reach Steward.
Fix
Split the single
STEWARD_API_URLconstant into two:STEWARD_HOST_URL(http://localhost:3200) — used by the orchestrator for host-side API calls (agent registration, token minting)STEWARD_CONTAINER_URL(http://host.docker.internal:3200) — injected into container env varsConfigurable via
STEWARD_CONTAINER_URLenv var for custom setups.Changes
packages/lib/services/docker-sandbox-provider.ts: +9/-3Testing
host.docker.internalresolves correctly from Docker bridge containers