Skip to content

The micro-VM for AI agents — light enough to embed on your laptop, elastic enough to power an agentic cloud.

fix(infra): use a positive route priority for GCP introspection (#3068)

kekxy57445cd253b1
diff --git a/apps/infra/docs/gcp/networking.md b/apps/infra/docs/gcp/networking.md
index 79e41ba63..e512db609 100644
--- a/apps/infra/docs/gcp/networking.md
+++ b/apps/infra/docs/gcp/networking.md
@@ -24,6 +24,9 @@ GCP uses private runner hosts, direct Cloud Run VPC egress, and separate public
| Private VM/GKE → internet | Cloud NAT when internet egress is enabled |
| Backoffice → ClickHouse | Consumer PSC endpoint → service attachment → internal passthrough LB |
+The internal API load balancer forwards `/internal/v1/credentials/introspect` verbatim
+in its priority 1 rule. The priority 2 catch-all adds `/api/` to short paths such as `/boxes`.
+
Cloud Run API ingress is restricted to internal/load-balancer traffic. The collector and registry proxy are internal-only.
Their VPC egress mode is `PRIVATE_RANGES_ONLY`: public internet traffic does not automatically take
Cloud NAT. There is no Serverless VPC Access connector in this resource graph.
diff --git a/apps/infra/mdeploy/stack/providers/gcp/api.ts b/apps/infra/mdeploy/stack/providers/gcp/api.ts
index 17fb064b4..d87adaa7d 100644
--- a/apps/infra/mdeploy/stack/providers/gcp/api.ts
+++ b/apps/infra/mdeploy/stack/providers/gcp/api.ts
@@ -78,15 +78,15 @@ const CLOUD_SQL_VOLUME = 'cloudsql'
*
* The first rule also passes the MCP endpoint and its RFC 9728 metadata, the
* routes `apps/api` keeps outside the prefix (`MCP_ROOT_ROUTES`) so that the
- * public URL is the OAuth resource. Exact matches, so every other root path
- * still gains `/api`.
+ * public URL is the OAuth resource. Each balancer can add exact root paths
+ * that its backend also serves without the prefix.
*
* `prefixMatch: '/'` rather than a `/*` path rule: a path rule's wildcard is
* documented only after a non-empty prefix, and a rewrite replaces exactly the
* portion that matched — so `/` becomes `/api/` and `/boxes` becomes
* `/api/boxes`.
*/
-export const apiPrefixRouteRules = (service: $util.Input<string>) => [
+export const apiPrefixRouteRules = (service: $util.Input<string>, ...extraMatches: { fullPathMatch: string }[]) => [
{
priority: 1,
matchRules: [
@@ -94,6 +94,7 @@ export const apiPrefixRouteRules = (service: $util.Input<string>) => [
{ prefixMatch: '/api/' },
{ fullPathMatch: '/mcp' },
{ fullPathMatch: '/.well-known/oauth-protected-resource/mcp' },
+ ...extraMatches,
],
service,
},
@@ -845,14 +846,9 @@ export const gcpApiProvider =
{
name: API_PATH_MATCHER,
defaultService: internalBackend.id,
- routeRules: [
- {
- priority: 0,
- matchRules: [{ fullPathMatch: '/internal/v1/credentials/introspect' }],
- service: internalBackend.id,
- },
- ...apiPrefixRouteRules(internalBackend.id),
- ],
+ routeRules: apiPrefixRouteRules(internalBackend.id, {
+ fullPathMatch: '/internal/v1/credentials/introspect',
+ }),
},
],
})