Skip to content

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

Merged
earakely-scale merged 2 commits into
mainfrom
andrewpark/gateway-only-console-ports
Nov 23, 2026
Merged

earakely-scale merged 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: https://github.com/scaleapi/agentenv-framework/pull/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 https://github.com/scaleapi/agentenv-framework/pull/821 instead.

Why

After https://github.com/scaleapi/agentenv-framework/pull/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 https://github.com/scaleapi/agentenv-framework/pull/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>
@earakely-scale
earakely-scale merged commit 1d447c5 into main Nov 23, 2026
35 checks passed
@earakely-scale
earakely-scale deleted the andrewpark/gateway-only-console-ports branch November 23, 2026 16:50
mandykwok-scale added a commit that referenced this pull request Nov 23, 2026
Main moved pgweb and db-mcp behind the gateway's /svc routes (#823), so a slot's door now routes only the gateway and
sidecar ports, and a slot's grant is its gateway's address alone. The console check asks through the door in a slot,
so the 401 it expects is the gateway's. A slot's compose writes a value with a line break on one double-quoted line,
so the logged compose masks a multiline secret in full.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants