Skip to content

[awf] Support secret-backed OpenAI-compatible targets for Codex #7575

Description

@lpcox

Problem

Codex workflows cannot configure a custom OpenAI-compatible API proxy target from a runtime secret. The OpenAI target is currently static, so a sensitive endpoint host must be embedded in generated configuration or injected by brittle post-compilation lockfile patching.

Context

Original issue: github/gh-aw#41929

Users may route engine: codex through a private OpenAI-compatible load balancer whose URL and hostname are sensitive. The endpoint must not appear in committed workflow source, generated lockfiles, logs, diagnostics, uploaded artifacts, or the sandboxed agent environment.

Current behavior

The API proxy reads its OpenAI target as a concrete startup value. AWF has no baseUrlEnv-style configuration that:

  • resolves a URL from runner environment at runtime;
  • validates and normalizes it before containers start;
  • derives the destination host for network policy;
  • keeps the value out of the agent environment; and
  • registers the URL, host, and host:port for masking and artifact redaction.

Copilot BYOK configuration is not equivalent because this request applies specifically to the Codex/OpenAI API-proxy path.

Proposed solution

Add an AWF configuration field for an environment-backed OpenAI target, for example:

{
  "apiProxy": {
    "targets": {
      "openai": {
        "baseUrlEnv": "CODEX_LB_BASE_URL"
      }
    }
  }
}

At startup, AWF should:

  1. Read the named variable only in runner-side configuration code.
  2. Require an HTTP(S) URL and reject embedded credentials, malformed hosts, and unsupported schemes.
  3. Derive the host, host:port, and optional base path.
  4. Add the derived destination to the effective Squid/network policy without persisting it in repository configuration.
  5. Configure the OpenAI API-proxy adapter with the resolved target.
  6. Ensure the secret is excluded from the primary agent environment.
  7. Mask and redact the full URL, host, and host:port from logs, diagnostics, and uploaded artifacts.
  8. Apply the behavior consistently to agent and detection phases.

The gh-aw compiler can then bind ${{ secrets.CODEX_LB_BASE_URL }} to the named runner environment variable without writing its value into the lockfile.

Acceptance criteria

  • A Codex workflow can route through a secret-backed OpenAI-compatible endpoint without post-processing its generated lockfile.
  • The endpoint value and derived host forms do not appear in committed/generated workflow configuration, agent environment, logs, diagnostics, or artifacts.
  • Runtime network policy permits only the validated derived endpoint.
  • Invalid or missing values fail before agent startup with a clear, redacted error.
  • Tests cover URL validation, network-policy derivation, credential isolation, and redaction.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions