Skip to content

feat(proxy): add --openai-api-target and --anthropic-api-target flags#1249

Merged
lpcox merged 9 commits intomainfrom
claude/fix-issue-20590
Mar 12, 2026
Merged

feat(proxy): add --openai-api-target and --anthropic-api-target flags#1249
lpcox merged 9 commits intomainfrom
claude/fix-issue-20590

Conversation

@Claude
Copy link
Contributor

@Claude Claude AI commented Mar 12, 2026

Add --openai-api-target and --anthropic-api-target CLI flags to configure custom upstream API endpoints in the api-proxy, enabling AWF to work with internal LLM routers, Azure OpenAI, and other custom OpenAI-compatible endpoints instead of the hardcoded api.openai.com/api.anthropic.com defaults.

Changes Made

  • src/cli.ts: Added --openai-api-target and --anthropic-api-target CLI flags with OPENAI_API_TARGET/ANTHROPIC_API_TARGET env var fallback; added validateApiTargetInAllowedDomains() that warns at startup when a custom target is not covered by --allow-domains; extracted DEFAULT_OPENAI_API_TARGET and DEFAULT_ANTHROPIC_API_TARGET constants
  • src/types.ts: Added openaiApiTarget and anthropicApiTarget optional fields to WrapperConfig
  • src/docker-manager.ts: Passes OPENAI_API_TARGET and ANTHROPIC_API_TARGET environment variables to the api-proxy container with debug logging
  • containers/api-proxy/server.js: Reads configurable upstream targets from environment variables, falling back to the default public endpoints when not set; startup log now includes the active target hostname
  • src/cli.test.ts: Added unit tests for validateApiTargetInAllowedDomains and the default target constants
  • docs/api-proxy-sidecar.md: Documented --openai-api-target, --anthropic-api-target, and --copilot-api-target in the Configuration reference section, including the requirement to add custom targets to --allow-domains

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@Claude Claude AI assigned Claude and lpcox Mar 12, 2026
@lpcox
Copy link
Collaborator

lpcox commented Mar 12, 2026

@copilot fix the pr title and summary

Copy link
Contributor

Copilot AI commented Mar 12, 2026

@copilot fix the pr title and summary

Updated the PR description with a proper summary. The PR title should be updated to feat(proxy): add --openai-api-target and --anthropic-api-target flags to follow the conventional commits format — I don't have a tool to update the title directly.

@github-actions
Copy link
Contributor

⚠️ Coverage Regression Detected

This PR decreases test coverage. Please add tests to maintain coverage levels.

Overall Coverage

Metric Base PR Delta
Lines 82.42% 82.50% 📈 +0.08%
Statements 82.42% 82.49% 📈 +0.07%
Functions 82.77% 82.77% ➡️ +0.00%
Branches 74.82% 74.48% 📉 -0.34%
📁 Per-file Coverage Changes (1 files)
File Lines (Before → After) Statements (Before → After)
src/docker-manager.ts 84.0% → 84.3% (+0.29%) 83.3% → 83.6% (+0.29%)

Coverage comparison generated by scripts/ci/compare-coverage.ts

Copilot AI changed the title Completing task feat(proxy): add --openai-api-target and --anthropic-api-target flags Mar 12, 2026
@github-actions
Copy link
Contributor

PR titles:
feat(cli): add --memory-limit flag for configurable container memory
test: expand credential hiding tests to all 14 protected paths
GitHub MCP review ✅ | safeinputs-gh ✅
Playwright ✅ | Tavily search ❌
File write ✅ | cat verify ✅
Discussion comment ✅ | build ✅
Overall: FAIL

🔮 The oracle has spoken through Smoke Codex for issue #1249

@github-actions
Copy link
Contributor

Smoke Test Results

Recent merged PRs:

Test Result
GitHub MCP (list PRs)
Playwright (github.com title)
File write
Bash verify

Overall: PASS

💥 [THE END] — Illustrated by Smoke Claude for issue #1249

@github-actions
Copy link
Contributor

Chroot Version Comparison Results

Runtime Host Version Chroot Version Match?
Python Python 3.12.12 Python 3.12.3 ❌ NO
Node.js v24.14.0 v20.20.0 ❌ NO
Go go1.22.12 go1.22.12 ✅ YES

Overall: ❌ Not all tests passed — Python and Node.js versions differ between host and chroot environment.

Tested by Smoke Chroot for issue #1249

@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

Smoke test results for run 22980663938:

✅ GitHub MCP — last 2 merged PRs: #1243 feat(cli): add --memory-limit flag | #1240 test(docker): verify capsh execution chain (both by @Mossaka)
✅ Playwright — github.com title contains "GitHub"
✅ File write — /tmp/gh-aw/agent/smoke-test-copilot-22980663938.txt created
✅ Bash — file read back successfully

Overall: PASS

📰 BREAKING: Report filed by Smoke Copilot for issue #1249

@lpcox lpcox marked this pull request as ready for review March 12, 2026 01:03
Copilot AI review requested due to automatic review settings March 12, 2026 01:03
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds two new CLI flags (--openai-api-target and --anthropic-api-target) to configure custom upstream API endpoints for the api-proxy sidecar, enabling AWF to work with internal LLM routers, Azure OpenAI, and other OpenAI/Anthropic-compatible endpoints instead of the hardcoded defaults.

Changes:

  • Added --openai-api-target and --anthropic-api-target CLI flags and corresponding WrapperConfig fields, following the existing --copilot-api-target pattern.
  • Passes the new target values as OPENAI_API_TARGET / ANTHROPIC_API_TARGET environment variables to the api-proxy container.
  • Updated server.js to read these env vars (with defaults to api.openai.com / api.anthropic.com) and use them in all proxyRequest calls.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/types.ts Added openaiApiTarget and anthropicApiTarget optional fields to WrapperConfig with documentation
src/cli.ts Added CLI flag definitions and wiring of options/env vars into config
src/docker-manager.ts Passes new target env vars to api-proxy container and adds debug logging
containers/api-proxy/server.js Reads configurable targets from env vars and uses them in proxy routing and startup logging

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@github-actions
Copy link
Contributor

⚠️ Coverage Regression Detected

This PR decreases test coverage. Please add tests to maintain coverage levels.

Overall Coverage

Metric Base PR Delta
Lines 82.42% 82.50% 📈 +0.08%
Statements 82.42% 82.49% 📈 +0.07%
Functions 82.77% 82.77% ➡️ +0.00%
Branches 74.82% 74.48% 📉 -0.34%
📁 Per-file Coverage Changes (1 files)
File Lines (Before → After) Statements (Before → After)
src/docker-manager.ts 84.0% → 84.3% (+0.29%) 83.3% → 83.6% (+0.29%)

Coverage comparison generated by scripts/ci/compare-coverage.ts

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
@github-actions
Copy link
Contributor

Smoke test results for run 22982054129

✅ GitHub MCP: Last 2 merged PRs — #1243: feat(cli): add --memory-limit flag by @Mossaka | #1240: test(docker): verify capsh execution chain by @Mossaka
✅ Playwright: github.com title contains "GitHub"
✅ File write: /tmp/gh-aw/agent/smoke-test-copilot-22982054129.txt created and verified
✅ Bash: file content confirmed

Overall: PASS

📰 BREAKING: Report filed by Smoke Copilot for issue #1249

@github-actions
Copy link
Contributor

PR titles: feat(cli): add --memory-limit flag for configurable container memory | test: expand credential hiding tests to all 14 protected paths
GitHub MCP review: ✅
safeinputs-gh PR list: ✅
Playwright title check: ✅
Tavily search: ❌ (tool unavailable)
File write+cat: ✅
Discussion query+comment: ✅
Build: ✅
Overall: FAIL

🔮 The oracle has spoken through Smoke Codex for issue #1249

@github-actions
Copy link
Contributor

Chroot Version Comparison Results

Runtime Host Version Chroot Version Match?
Python Python 3.12.12 Python 3.12.3 ❌ NO
Node.js v24.14.0 v20.20.0 ❌ NO
Go go1.22.12 go1.22.12 ✅ YES

Result: FAILED — Python and Node.js versions differ between host and chroot environments.

Tested by Smoke Chroot for issue #1249

@github github deleted a comment Mar 12, 2026
@github github deleted a comment Mar 12, 2026
…t coverage for API target validation (#1251)

* Initial plan

* fix: resolve failing Build and Lint (Node 22) CI workflow

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
@github-actions
Copy link
Contributor

⚠️ Coverage Regression Detected

This PR decreases test coverage. Please add tests to maintain coverage levels.

Overall Coverage

Metric Base PR Delta
Lines 82.42% 82.32% 📉 -0.10%
Statements 82.42% 82.32% 📉 -0.10%
Functions 82.77% 82.93% 📈 +0.16%
Branches 74.82% 74.03% 📉 -0.79%
📁 Per-file Coverage Changes (2 files)
File Lines (Before → After) Statements (Before → After)
src/docker-manager.ts 84.0% → 84.3% (+0.29%) 83.3% → 83.6% (+0.29%)
src/cli.ts 47.8% → 48.2% (+0.45%) 48.1% → 48.7% (+0.55%)

Coverage comparison generated by scripts/ci/compare-coverage.ts

@github-actions
Copy link
Contributor

Smoke Test Results

Overall: PASS

💥 [THE END] — Illustrated by Smoke Claude for issue #1249

@github-actions
Copy link
Contributor

Smoke Test Results

GitHub MCP — Last 2 merged PRs:

Playwrightgithub.com title contains "GitHub"
File Writing/tmp/gh-aw/agent/smoke-test-copilot-22985143129.txt created
Bash — File verified via cat

Overall: PASS

Author: @lpcox

📰 BREAKING: Report filed by Smoke Copilot for issue #1249

@github-actions
Copy link
Contributor

Smoke test summary
PR: fix: resolve pid-tracker integration test failure and add missing test coverage for API target validation
PR: fix(ci): skip agentic workflow activation for bot-triggered pull requests
Tests: 1✅ 2✅ 3✅ 4❌ 5✅ 6✅ 7✅ 8✅
Overall: FAIL

🔮 The oracle has spoken through Smoke Codex for issue #1249

@github github locked as spam and limited conversation to collaborators Mar 12, 2026
@github github deleted a comment Mar 12, 2026
…bs (#1252)

* Initial plan

* fix(ci): remove unused Setup Scripts step from update_cache_memory jobs

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
@lpcox
Copy link
Collaborator

lpcox commented Mar 12, 2026

@copilot fix the pr title and summary

…in api-proxy-sidecar.md

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
…1254)

* Initial plan

* fix: resolve coverage regression and locked PR comment failure

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
@github github unlocked this conversation Mar 12, 2026
@github-actions
Copy link
Contributor

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 82.42% 82.70% 📈 +0.28%
Statements 82.42% 82.70% 📈 +0.28%
Functions 82.77% 83.01% 📈 +0.24%
Branches 74.82% 75.20% 📈 +0.38%
📁 Per-file Coverage Changes (2 files)
File Lines (Before → After) Statements (Before → After)
src/docker-manager.ts 84.0% → 84.6% (+0.65%) 83.3% → 83.9% (+0.63%)
src/cli.ts 47.8% → 49.9% (+2.12%) 48.1% → 50.5% (+2.31%)

Coverage comparison generated by scripts/ci/compare-coverage.ts

@github-actions
Copy link
Contributor

Smoke Test Results

Overall: PASS

💥 [THE END] — Illustrated by Smoke Claude for issue #1249

@github-actions
Copy link
Contributor

Smoke test results for run 23005850164:

GitHub MCP — Last 2 merged PRs: #1254 "fix: resolve test coverage regression and locked PR comment failure", #1252 "fix(ci): remove unused Setup Scripts step from update_cache_memory jobs"
Playwright — github.com title contains "GitHub"
File Write/tmp/gh-aw/agent/smoke-test-copilot-23005850164.txt created
Bash — File verified via cat

Overall: PASS | PR author: @Copilot | Assignees: @lpcox @Copilot

📰 BREAKING: Report filed by Smoke Copilot for issue #1249

@github-actions
Copy link
Contributor

PR titles: fix: resolve test coverage regression and locked PR comment failure; fix(ci): remove unused Setup Scripts step from update_cache_memory jobs; feat(proxy): add --openai-api-target and --anthropic-api-target flags; fix(docker): simplify security model - remove direct DNS exceptions
GitHub MCP merged PR review: ✅
safeinputs-gh pr list: ✅
Playwright title contains GitHub: ✅
Tavily search: ❌ (tool unavailable)
File write: ✅
Bash cat verify: ✅
Discussion comment: ✅
Build (npm ci && npm run build): ✅
Overall: FAIL

🔮 The oracle has spoken through Smoke Codex for issue #1249

@github-actions
Copy link
Contributor

Chroot Version Comparison Results

Runtime Host Version Chroot Version Match?
Python Python 3.12.12 Python 3.12.3 ❌ NO
Node.js v24.14.0 v20.20.0 ❌ NO
Go go1.22.12 go1.22.12 ✅ YES

Overall result: ❌ FAILED — Python and Node.js versions differ between host and chroot environments.

Tested by Smoke Chroot for issue #1249

@github-actions
Copy link
Contributor

🏗️ Build Test Suite Results

Ecosystem Project Build/Install Tests Status
Bun elysia 1/1 passed ✅ PASS
Bun hono 1/1 passed ✅ PASS
C++ fmt N/A ✅ PASS
C++ json N/A ✅ PASS
Deno oak N/A 1/1 passed ✅ PASS
Deno std N/A 1/1 passed ✅ PASS
.NET hello-world N/A ✅ PASS
.NET json-parse N/A ✅ PASS
Go color passed ✅ PASS
Go env passed ✅ PASS
Go uuid passed ✅ PASS
Java gson 1/1 passed ✅ PASS
Java caffeine 1/1 passed ✅ PASS
Node.js clsx passed ✅ PASS
Node.js execa passed ✅ PASS
Node.js p-limit passed ✅ PASS
Rust fd 1/1 passed ✅ PASS
Rust zoxide 1/1 passed ✅ PASS

Overall: 8/8 ecosystems passed — ✅ PASS

Generated by Build Test Suite for issue #1249 ·

@lpcox lpcox merged commit 0aff975 into main Mar 12, 2026
60 checks passed
@lpcox lpcox deleted the claude/fix-issue-20590 branch March 12, 2026 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants