Repository navigation
feat(gateway): forwarded headers and triggers by route (FD-4683) - #443
williamloo-scale wants to merge 5 commits into
Conversation
d76be33 to
a68ff2a
Compare
8dcebd1 to
4c1fcc1
Compare
a68ff2a to
f1a665a
Compare
4c1fcc1 to
22947c3
Compare
22947c3 to
253eaec
Compare
250afe3 to
30113cb
Compare
18b1b98 to
d95702e
Compare
d43c767 to
b055f91
Compare
d95702e to
8389f76
Compare
|
A heads-up from #478 (M8.54). The driver's Once both merge, could the gateway use the same helpers, so there's one convention to keep in step (which headers drop, how |
…gers by route (FD-4683) This PR's change, rebased as one commit onto #429. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ock are judged by the site's own path With X-Forwarded-Prefix the prefix leads scope["path"], so the clock's exception for the card and data plane and the guard that keeps a broad @api route off reserved paths both missed them: through the gateway's /svc/<name>/ a lost clock answered 503 to agentenv's own data/get, ready and sync_time, and a catch-all route served a page at /agentenv/x. Both, and the static fallback, now read the path without the root path, as routing does, which also drops the private starlette._utils import. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8389f76 to
c7f214b
Compare
Comments Outside DiffThese findings could not be posted inline.
|
The rebase onto main was pushed while the pull request still targeted the old stack base, which it conflicted with, so the pull_request workflows never ran. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…K serves no health path Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Role keys come out of this change: one key per deploy lets any holder, a deployed agent included, claim any role, and neither the hub nor agentenvhub-sdk sends the key yet. Forwarded headers and triggers by route stay. The gateway again believes the role header alone, and an SDK site, holding no key, treats every caller as default, as on main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The gateway side of website/v1: the address a site is reached at, and triggers matched by route. Keyed roles were part of this change and are held back for a design with one key per role (see below).
/svcand/websitesetX-Forwarded-Host,-Protoand-Prefixand drop the client's copies; a front's ownX-Forwarded-Hostand-Protowin, else the request'sHostand scheme. The SDK takes the prefix as the root path, sobase_url,request.urland redirects name the gateway's address. Behind the prefix, a site still judges its reserved paths and the clock rule by its own path: a catch-all@apiroute can't answer/agentenv/..., and with the clock unreadable the card, the data plane andsync_timestill answer at/svc/<name>/.whenmay nameop, a route of the site's card, and then matches only requests that reach it. Registration refuses an op the card doesn't name, and an op on a site whose card can't be read. triggers/v1 declareswebsite_op, so an older gateway is refused. The card'swebsite/v1routes[].pathis now the path the route is served at, converters included (/api/files/{rest:path}), so the gateway matches nested and typed paths.Held back: keyed roles
One key per deploy let any holder, a deployed agent included, claim any role, and neither the hub nor agentenvhub-sdk sends the key yet. They return as one key per role, with the hub sending it. Here, as on main, the gateway believes the role header alone, and an SDK site, holding no key, treats every caller as
default. The earlier commits of this branch keep the first version.Test
/websiteand/svc. A client'sX-Forwarded-Prefixand an invalid-Protowere ignored, and a trailing-slash redirect named the gateway's address. Conformance passed 8 of 8 through/svc.{rest:path}route. An op trigger on a site whose card was down at registration was refused, then accepted once the site was back./svcanswered 503 while the card,data/get,readyandsync_timeanswered, and an unknown reserved path answered 404, not the catch-all.🤖 Generated with Claude Code


Confidence Score: 5/5
The reviewed changes appear safe to merge.Summary
This PR forwards the gateway address to websites and adds triggers that match named website routes.
Diagram
sequenceDiagram participant Client participant Gateway participant Website participant Triggers Client->>Gateway: Request under /website or /svc Gateway->>Website: Forward request with gateway address headers Website-->>Gateway: Response Gateway->>Gateway: Match forwarded path to named route Gateway->>Triggers: Evaluate request with route name Triggers-->>Gateway: Wait for matching barrier, if any Gateway-->>Client: Return responseReviews (18) · Last reviewed commit: "refactor(gateway)!: hold keyed roles bac..." · Reviewed by Greptile