Skip to content

refactor(env): reach pgweb and db-mcp only through the gateway's /svc routes - #823

Open
andrewpark-scaleai wants to merge 2 commits into
mainfrom
andrewpark/gateway-only-console-ports
Open

andrewpark-scaleai wants to merge 2 commits into
mainfrom
andrewpark/gateway-only-console-ports

Conversation

@andrewpark-scaleai

@andrewpark-scaleai andrewpark-scaleai commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Merge order for this group:

  1. Framework: feat(gateway): serve pgweb and db-mcp at /svc/ routes #821 and feat(gateway): open pgweb in a browser with a signed link #824 (merged), then feat(env): give each computer in a multi env a control token of its own #825 (any time).
  2. Consumers (internal PRs) pin a framework release that has 821 and 824, then merge and deploy.
  3. The gateway image with 821, 824 and 825 is promoted.
  4. refactor(env): reach pgweb and db-mcp only through the gateway's /svc routes #823 merges last, after every consumer is deployed on that release and envs on older gateways have expired. Merging it earlier breaks every caller that still uses the old console URLs.

DO NOT MERGE until every consumer of db_web_url and db_mcp_url reads the gateway URLs from #821 instead.

Why

After #821, the gateway serves pgweb and db-mcp at /svc/. This PR makes that the only way in, so deploys expose one port (the gateway's) and records carry one set of console URLs.

What changed

  • The VM path asks the sandbox provider to expose only the gateway's port.
  • The compose file publishes no port for pgweb or db-mcp. Containers on env-network still reach them.
  • The container path creates the pgweb and db-mcp sandboxes with expose_externally=False, as it already does for other sidecars.
  • DeployedGateway drops db_web_url and db_mcp_url, so no deploy writes them. DeployedGatewayEnv still reads them from older records for one release.

Blast Radius

  • Any reader of db_web_url or db_mcp_url gets None on a new deploy's record. Every one must move to db_web_gateway_url / db_mcp_gateway_url first.
  • OpenClaw's environment card loses its "database" link on new envs. Its owner confirmed on 2026-11-19 that nobody uses it.
  • A deploy whose gateway image predates feat(gateway): serve pgweb and db-mcp at /svc/ routes #821 can't reach the consoles. Promote the gateway image first.
  • Envs that pin an older framework keep their old ports until they are rebuilt.

Verification

  • The VM deploy test asserts create_vm gets only the gateway and sidecar ports.
  • tst/unit/env/test_env.py loads a record from an older deploy.
  • Unit trees tst/unit/env, tst/unit/providers and tst/unit/cli pass. ruff check src tst passes.
  • Local Docker and a live modal_vm: the consoles answer through the gateway with the token.

RetriggerView in GreptileConfidence Score: 5/5

The reviewed changes appear safe to merge once the stated rollout requirements are met.

Summary

Database consoles now use the gateway’s /svc routes instead of direct public ports.

  • pgweb and db-mcp are reached only through the gateway.
  • New deploy records list pgweb and db-mcp at gateway URLs.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Client[Console client with control token] --> Gateway[Gateway public port]
  Gateway -->|/svc/pgweb/| Pgweb[Private pgweb]
  Gateway -->|/svc/db-mcp/mcp| DbMcp[Private db-mcp]
Loading

Reviews (7) · Last reviewed commit: "test(env): name the gateway and sidecar ..." · Reviewed by Greptile

@andrewpark-scaleai
andrewpark-scaleai force-pushed the andrewpark/gateway-only-console-ports branch from fc74893 to 572b192 Compare November 19, 2026 20:22
Base automatically changed from andrewpark/gateway-console-routes to main November 20, 2026 01:07
@andrewpark-scaleai
andrewpark-scaleai marked this pull request as ready for review November 20, 2026 16:52
@andrewpark-scaleai
andrewpark-scaleai requested a review from a team as a code owner November 20, 2026 16:52
Comment thread src/agent_env/cli/env/get_instance.py Resolved
… routes

The VM path exposes only the gateway's port, the compose file publishes no
port for pgweb or db-mcp, and the container path creates their sandboxes
with expose_externally=False. DeployedGateway drops db_web_url and db_mcp_url,
so new records name the consoles only at db_web_gateway_url and
db_mcp_gateway_url. DeployedGatewayEnv still reads both from older records
for one release.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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