Repository navigation
feat(adapters): endpoint overrides for routing through an LLM gateway - #34
Merged
Merged
Conversation
Container adapters can declare `optionalHostEnv`: endpoint overrides (ANTHROPIC_BASE_URL, ANTHROPIC_CUSTOM_HEADERS; OPENAI_BASE_URL) that are forwarded into attempt containers only when set, so a gateway or proxy is an env change rather than a code change. The harness adds an override's host to the egress allowlist, retargets the preflight key probe at it, and redacts header bundles from artifacts like a key; base URLs stay diagnostic. The codex adapter renders OPENAI_BASE_URL into ~/.codex/config.toml as a custom model provider: codex 0.149.1 ignores the env var for its built-in provider (verified in the pinned image). The diagnose analyst honors the same Anthropic overrides so it takes the agent's route.
[High impact] The PR appears safe to merge; all five previous findings are addressed. SummaryAdds gateway endpoint overrides for Claude, Codex, and the diagnosis analyst.
|
…rd routes Review findings on the endpoint-override contract: - A header bundle with several lines could not reach the attempt container: the env-file channel is line-based and refused newlines. Multi-line values now ride the docker CLI's own environment, named on argv by `-e KEY` alone, so argv still never carries a value. Covered by a daemon-free split test and a Docker round-trip. - The credentials inside a header bundle (each auth header's value and the bare bearer token) are redaction targets of their own, so a transcript that prints only the token is scrubbed; hostSecretEnv expands bundles the same way. - An override's host joins the egress allowlist only under the proxy, where the list is live and an IP literal is refused loudly by design; without the proxy an IP-based gateway no longer stops an otherwise valid run. - The non-secret override URLs are recorded in full in the pair environment, so a changed gateway route changes both manifest and attempt identity and a resume cannot mix routes. Vendor-direct pairs hash exactly as before. - getting-started states that a gateway still needs the key variable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
optionalHostEnv: endpoint overrides forwarded into attempt containers only when set (ANTHROPIC_BASE_URLandANTHROPIC_CUSTOM_HEADERSfor claude,OPENAI_BASE_URLfor codex). Unset means vendor-direct, exactly as before.*_HEADERSfrom artifacts like a key; base URLs stay diagnostic in transcripts.OPENAI_BASE_URLinto~/.codex/config.tomlas a custom model provider, because codex 0.149.1 ignores the env var for its built-in provider (verified in the pinnedagent-runtimeimage: it still dialed api.openai.com).AnthropicModelClient(thediagnoseanalyst) honorsANTHROPIC_BASE_URLvia the SDK andANTHROPIC_CUSTOM_HEADERSvia a smallName: Valueparser, so diagnosis takes the same route as the agent.quickstudy/agent-runtimeagainst a Cloudflare AI Gateway: Claude Code 2.1.215 and Codex 0.149.1 both completed a prompt through it. The README documents the contract with placeholders only; nothing vendor- or company-specific lands in the harness.