Repository navigation
Description
Scope of the pull request for this issue: the ADR only
Do not sign off commits: no git commit -s and no Signed-off-by trailer (agent commits are DCO-exempt, and post-code rejects the trailer).
The pull request for this issue adds one new ADR and the living-document updates that go with it (docs/architecture.md, and an annotation on the matching open question in docs/problems/security-threat-model.md or agent-infrastructure.md). It contains no code. The runner, CLI, image and egress implementation for the pi runtime is #8280, and the walkthrough docs are a later pull request.
Follow skills/writing-adrs/SKILL.md and docs/ADRs/0000-adr-template.md. Use the next free number after checking open pull requests; 0133 to 0136 are already taken by in-flight pull requests. Status: Accepted. Structure it for scanning: short sections, bullets, one decision table, and one Mermaid sequence diagram.
The decision to record
An inference gateway is a credential route of its own. The gateway trusts the forge's OIDC issuer directly, and the runner hands the job's OIDC token to it as the bearer credential. The gateway holds the upstream provider key, so the forge stores no reusable provider key.
The ADR must cover:
-
Route shape (from the Proposal below):
- no token exchange: the OIDC assertion is the credential, and its
expis the credential's expiry; - the runner fetches the token with an explicit audience and seeds it into a run-scoped OpenShell provider as an endpoint-bound placeholder (ADR 0025 tier 2, the same pattern as ADR 0092);
- the runner re-seeds it before
exp, since GitHub OIDC tokens live 300 s; - the real token stays on the host side of the OpenShell proxy, and the sandbox sees only the placeholder.
- no token exchange: the OIDC assertion is the credential, and its
-
Config shape: one
inference.gatewayblock in the committed.fullsend/config.yaml(url,audience,providers, plus the model list below):- all or none: a partial block is an error;
- pull-request events read it from the base branch (ADR 0033);
- there is no runner-variable form;
- the layers merge field by field.
-
Precedence:
- order: gateway, then WIF, then static key, then error;
- a configured gateway that is unreachable or refuses the token fails the run and never falls back to a static key;
- a block that does not apply to the run (no OIDC endpoint, e.g. a local run) is ignored.
-
pi reaches the gateway through a separate
gatewayprovider id, served by the pi-inference-gateway extension. It does not redirect pi's built-inopenaiprovider. Record this as a decision table:Redirect built-in openaiSeparate gatewayproviderAPIs covered Responses (GPT) only Responses, Messages and Chat Completions, chosen per model Model families GPT GPT, Claude, Gemini, open-weight Existing guards ( piOpenAIConfigGuard)must change unchanged Validated live no yes (2026-10-09 result on this issue) Consequences of that choice:
- the sandbox runs
PI_OFFLINE=1, so the model list (id → api, optionalcompat/contextWindow/maxTokens) is part of the config block and is rendered by the runner; - the anthropic-messages auth header is
authorization.
- the sandbox runs
-
Threat-model delta versus ADR 0092:
- a short-lived token whose audience is only the gateway, behind a placeholder;
- a new service on the request path;
- the forge stores nothing reusable;
- the agent cannot set the base URL: the runner owns
INFERENCE_GATEWAY_*,.envand plugin env cannot override it, and plugin env may not use the prefix.
-
Gateway-side requirements the route depends on (operator responsibilities, verified live):
- remote JWKS for the forge issuer;
- a fixed audience;
- an exact-match claim on
repository; - the caller token is never forwarded upstream;
- the
x-api-keyheader is stripped.
Deployment and operation of the gateway are out of scope.
-
Sequence diagram (Mermaid): runner fetches the OIDC token, then seeds the OpenShell provider placeholder; pi sends the request with the placeholder; the proxy injects the token toward the gateway host only; the gateway checks JWKS,
audand therepositoryclaim, then calls upstream with its own key; the runner re-seeds beforeexp. -
Deferred, named: Claude Code and Codex on the gateway route, GitLab ID tokens, and other gateways.
Where the original Proposal below says pi redirects its built-in openai provider (registerProvider("openai", ...)), item 4 above replaces it.
Cite ADR 0025, 0033, 0073 and 0092 in Context; do not restate them. Use generic names only (gateway.example.com, example-org/example-repo).
Problem
fullsend talks to every inference provider directly, with a per-provider credential held by the forge or exchanged by the runner. For the openai provider that means either an OpenAI Workload Identity Federation exchange (#6689, ADR 0092), which needs admin access to the OpenAI organization, or a static OPENAI_API_KEY / FULLSEND_OPENAI_API_KEY (#7295), a long-lived provider key in forge secret storage.
There is no way to put an LLM gateway in front of the provider. A gateway (an OpenAI-compatible front door such as agentgateway, LiteLLM or APISIX that validates the job's CI OIDC token against the forge's JWKS, maps the caller to a provider key it holds server-side, and forwards /v1/responses) is the standard way to get per-repository trust, credential custody and central attribution without any provider-side identity federation. fullsend cannot use one because the OpenAI endpoint is pinned in four independent places:
- The WIF token-exchange endpoint (
auth.openai.com,internal/inference/openaiwif); theTokenEndpointoverride is tests-only. - The inference base URL: codex pins
https://api.openai.com/v1behind a digest-guardedconfig.tomland a-coverride; pi refuses to start when the config dir has amodels.json(piOpenAIConfigGuard), the only way to change its openai base URL. - The OpenShell profile
profiles/fullsend-openai.yaml(host: api.openai.com,path: /v1/responses). - The egress preflight
checkOpenAIEgressInspected(openAIAPIHost).
None of these should become configurable one at a time. A gateway is a new credential route with its own trust boundary, not a base-URL knob, and it should be designed once for all providers even though the first implementation covers only openai.
Why now
#7295 makes GPT usable from Actions with the weakest credential posture fullsend supports. The gateway route is what lets that secret be deleted again, and it is the same mechanism other providers will need. Who operates the gateway (a team, a platform group, or a hosted service) is a deployment choice outside this issue; fullsend only has to be able to point at one.
Proposal
Add an LLM gateway as a first-class credential route, provider-neutral in shape, implemented first for the openai provider.
Route shape. The gateway trusts the forge's OIDC issuer directly. The runner fetches the job's OIDC assertion with an explicit audience, seeds it into the run-scoped OpenShell provider as the bearer credential, and re-seeds it on the existing refresh path. There is no provider token exchange: the assertion is the credential, its expiry is the JWT's own exp, and the gateway holds the real provider key. The CI OIDC token therefore does enter the sandbox, which is only safe because its audience is the gateway and nothing else accepts it. The existing OpenAI exchange endpoint stays fixed and is not made configurable; pointing WIF at a different STS is a different feature.
Config shape. One gateway block in the committed .fullsend/config.yaml, and nothing else: no runner-variable form, so there is a single source and no drift between a repository variable and the committed file. Pull-request events read the file from the base branch (ADR 0033), so a pull request cannot redirect its own run, and the layers merge field by field, so an organization preset can carry url and audience while each repository opts its providers in. All-or-none within the block; partial is an error:
inference:
gateway:
url: https://<gateway-host>
audience: <gateway-audience>
providers: [openai] # only openai in this issuewritten by fullsend github setup --inference-gateway-* like the Vertex and OpenAI blocks. url must be https; loopback only under test. A provider not listed in providers is unaffected by the block. The existing FULLSEND_OPENAI_* variables keep their ADR 0092 role for the WIF trio only; the gateway block has no variable equivalent by design.
Precedence in resolveOpenAICredential: gateway → WIF trio → static key → error. A configured gateway that is unreachable or refuses the token fails the run; it never falls back to the static key, otherwise the secret can never actually be removed. A gateway block that is not applicable in this run (no OIDC endpoint, e.g. a local run) is ignored the way an inapplicable inference.openai WIF block is today.
Sandbox side. A new fullsend-gateway profile + providers/gateway.yaml pair next to the OpenAI ones (not an edit, so the direct routes keep working during rollout): same credential name OPENAI_API_KEY, refresh: external, protocol: rest, allow_uninspected_credentials: true (ai-openshell/openshell#2904 applies to any inspected endpoint), POST /v1/responses only, binaries: **/node, **/codex. checkOpenAIEgressInspected generalised to the configured gateway host. Later providers add their own endpoint rule to the same profile rather than a new one.
Runtimes. Both guards stay exactly as written:
- pi: a runner-owned extension calls
registerProvider("openai", { baseUrl })(documented overload in pi's extension API; re-verify against the pinnedPI_VERSIONat implementation).piOpenAIConfigGuardkeeps refusing any agent-authoredmodels.json/auth.json; the extension files must not be agent-writable. - codex:
[model_providers.<id>].base_urlrendered by the runner and covered by the existing whole-file digest guard.
Sequencing.
- ADR first. ADR 0092 covers WIF and the static key; the gateway changes the threat model (short-lived gateway-only token in the sandbox, a service on the request path, forge stores nothing reusable) and needs its own record covering all providers. Explore AgentGateway and evaluate relevance to fullsend #64 was an exploration, not a decision.
- Runner: config shape and
github setupflags,openaicredential branch, profile/provider pair, preflight. - Runtimes: pi extension redirect + codex
base_url. - Docs +
fullsend inference openai statusreporting the gateway source. - Deferred and named: GitLab, whose ID token arrives as an
id_tokens:job variable rather than a request URL (new runner code); further providers (Anthropic on Vertex, xAI on Vertex) as separate issues once the route exists.
Not proposed: any change to how the sandbox receives a credential (still an endpoint-bound placeholder), to the WIF default, to the static route from #7295, or to the fixed OpenAI exchange endpoint. Budgets stay on the provider side; the gateway only maps caller → key. Gateway deployment and operation are out of scope.
Validation
- Unit:
resolveOpenAICredential: gateway present / partial / gateway + static (gateway wins) / gateway failure does not fall back / gateway inapplicable locally does fall through /providerswithoutopenaileaves the provider on its direct route.uninspectedEndpointRuleswith a gateway host. Embedded-profile test for the new pair. pi extension test that the redirect happens andmodels.jsonis still refused. codex digest guard with the newbase_url.github setup --inference-gateway-*round-trips the block and rejects a partial one. - Gateway-side gate before any rollout: a caller
Authorizationheader is never forwarded upstream; an unenrolled repository is refused; a token minted for repository A is refused for repository B. - Rollout: one throwaway repository first with the static secret still present but unused; a real run completes on the gateway route and the prompt-cache hit rate matches the direct baseline; then real repositories one at a time; then delete
FULLSEND_OPENAI_API_KEY, which is the step that delivers the benefit.
Related: #6689, #7295, #64, #6920 (codex), #6716 (placeholder-prefix reset), ADR 0025, ADR 0092.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
fullsend-ai-triage commentedon Sep 18, 2026
🤖 Triage ·⚠️ Cancelled · Started 8:09 PM UTC · Ended 8:11 PM UTC
Commit:
b68ff06· View workflow run →[-]Support a user-run LLM inference gateway as a credential route, starting with the openai provider[/-][+]Support an LLM inference gateway as a credential route, starting with the openai provider[/+]fullsend-ai-triage commentedon Sep 18, 2026
🤖 Triage ·⚠️ Cancelled · Ended 8:12 PM UTC
Commit:
b68ff06· View workflow run →fullsend-ai-triage commentedon Sep 18, 2026
🤖 Finished Triage · ✅ Success · Started 8:14 PM UTC · Completed 8:19 PM UTC
Commit:
b68ff06· View workflow run →Runtime: claude · Model: sonnet → claude-sonnet-5 · Effort: high · Cost: $0.37
20 remaining items
docs(#7480): add Praxis verification and gateway-neutral requirements…
docs(#7480): cross-reference ADR 0069 and tighten ADR 0137 consequences
docs(#7480): replace the gateway tables in ADR 0137 with prose
docs(#7480): use a purpose-specific audience in the ADR 0137 example
docs(#7480): select the gateway route per model, with no precedence o…
docs(#7480): defer multiple gateways per repository in ADR 0137
docs(#7480): drop APISIX from the ADR 0137 gateway examples
docs(#7480): keep ADR 0137's route runtime-neutral, pi details under pi
docs(#7480): make ADR 0137's credential seeder route-aware
build(fullsend-ai#8262): ship pi-inference-gateway extension in sandb…
docs(fullsend-ai#8274): add inference gateway section for local pi runs
docs(fullsend-ai#7480): ADR 0137 inference gateway as a credential route
Merge pull request fullsend-ai#8284 from fullsend-ai/agent/7480-infer…