Skip to content

Support an LLM inference gateway as a credential route, starting with the openai provider #7480

Closed

Description

@waynesun09

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:

  1. Route shape (from the Proposal below):

    • no token exchange: the OIDC assertion is the credential, and its exp is 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.
  2. Config shape: one inference.gateway block 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.
  3. 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.
  4. pi reaches the gateway through a separate gateway provider id, served by the pi-inference-gateway extension. It does not redirect pi's built-in openai provider. Record this as a decision table:

    Redirect built-in openai Separate gateway provider
    APIs 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, optional compat / contextWindow / maxTokens) is part of the config block and is rendered by the runner;
    • the anthropic-messages auth header is authorization.
  5. 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_*, .env and plugin env cannot override it, and plugin env may not use the prefix.
  6. 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-key header is stripped.

    Deployment and operation of the gateway are out of scope.

  7. 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, aud and the repository claim, then calls upstream with its own key; the runner re-seeds before exp.

  8. 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:

  1. The WIF token-exchange endpoint (auth.openai.com, internal/inference/openaiwif); the TokenEndpoint override is tests-only.
  2. The inference base URL: codex pins https://api.openai.com/v1 behind a digest-guarded config.toml and a -c override; pi refuses to start when the config dir has a models.json (piOpenAIConfigGuard), the only way to change its openai base URL.
  3. The OpenShell profile profiles/fullsend-openai.yaml (host: api.openai.com, path: /v1/responses).
  4. 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 issue

written 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 pinned PI_VERSION at implementation). piOpenAIConfigGuard keeps refusing any agent-authored models.json / auth.json; the extension files must not be agent-writable.
  • codex: [model_providers.<id>].base_url rendered by the runner and covered by the existing whole-file digest guard.

Sequencing.

  1. 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.
  2. Runner: config shape and github setup flags, openai credential branch, profile/provider pair, preflight.
  3. Runtimes: pi extension redirect + codex base_url.
  4. Docs + fullsend inference openai status reporting the gateway source.
  5. 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 / providers without openai leaves the provider on its direct route. uninspectedEndpointRules with a gateway host. Embedded-profile test for the new pair. pi extension test that the redirect happens and models.json is still refused. codex digest guard with the new base_url. github setup --inference-gateway-* round-trips the block and rejects a partial one.
  • Gateway-side gate before any rollout: a caller Authorization header 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.

Activity

  1. added
    security
    type/feature
    feature
    component/sandbox
    component/runner
    component/docs
    on Sep 18, 2026
  2. fullsend-ai-triage commented on Sep 18, 2026

    @fullsend-ai-triage

    🤖 Triage · ⚠️ Cancelled · Started 8:09 PM UTC · Ended 8:11 PM UTC

    Commit: b68ff06 · View workflow run →

  3. removed
    feature
    on Sep 18, 2026
  4. changed the title [-]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[/+] on Sep 18, 2026
  5. fullsend-ai-triage commented on Sep 18, 2026

    @fullsend-ai-triage

    🤖 Triage · ⚠️ Cancelled · Ended 8:12 PM UTC

    Commit: b68ff06 · View workflow run →

  6. fullsend-ai-triage commented on Sep 18, 2026

    @fullsend-ai-triage

    🤖 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

  7. added
    feature
    on Sep 18, 2026
  8. 20 remaining items

  9. added 9 commits that reference this issue on Oct 9, 2026
  10. added 4 commits that reference this issue on Oct 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    component/docscomponent/runnercomponent/sandboxdocumentationneeds-designpriority/mediumready-to-codesecuritytype/feature

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions