Skip to content

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

Open
Claude wants to merge 8 commits intomainfrom
claude/fix-issue-20590
Open

feat(proxy): add --openai-api-target and --anthropic-api-target flags#1249
Claude wants to merge 8 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

Smoke Test Results

GitHub MCP: #1243 feat(cli): add --memory-limit flag, #1163 test: expand credential hiding tests
Playwright: github.com title contains "GitHub"
File Write: /tmp/gh-aw/agent/smoke-test-claude-22982054128.txt created
Bash: File verified via cat

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

Result: ❌ 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

⚠️ 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.00% 📉 -0.42%
Statements 82.42% 81.96% 📉 -0.46%
Functions 82.77% 81.99% 📉 -0.78%
Branches 74.82% 73.36% 📉 -1.46%
📁 Per-file Coverage Changes (2 files)
File Lines (Before → After) Statements (Before → After)
src/cli.ts 47.8% → 46.5% (-1.23%) 48.1% → 46.8% (-1.33%)
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

@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 1/1 passed ✅ PASS
Go env 1/1 passed ✅ PASS
Go uuid 1/1 passed ✅ PASS
Java gson 1/1 passed ✅ PASS
Java caffeine 1/1 passed ✅ PASS
Node.js clsx all passed ✅ PASS
Node.js execa all passed ✅ PASS
Node.js p-limit all passed ✅ PASS
Rust fd 1/1 passed ✅ PASS
Rust zoxide 1/1 passed ✅ PASS

Overall: 8/8 ecosystems passed — ✅ PASS

Note (Java): Maven's squid-proxy hostname (set via JAVA_TOOL_OPTIONS) did not resolve in the container. The proxy was reconfigured to use the Squid IP 172.30.0.10:3128 directly, and Maven's local repository was redirected to a writable path (/tmp/gh-aw/agent/maven-repo) since ~/.m2/repository was not writable. Both gson and caffeine compiled and tested successfully after this fix.

Generated by Build Test Suite for issue #1249 ·

…ests (#1250)

* Initial plan

* fix(ci): skip agentic workflow activation for bot-triggered pull requests

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.00% 📉 -0.42%
Statements 82.42% 81.96% 📉 -0.46%
Functions 82.77% 81.99% 📉 -0.78%
Branches 74.82% 73.36% 📉 -1.46%
📁 Per-file Coverage Changes (2 files)
File Lines (Before → After) Statements (Before → After)
src/cli.ts 47.8% → 46.5% (-1.23%) 48.1% → 46.8% (-1.33%)
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

@github-actions
Copy link
Contributor

Smoke test results:
PR titles: [WIP] [66732031089] Fix failing GitHub Actions workflow Build and Lint | feat(proxy): add --openai-api-target and --anthropic-api-target flags
GitHub MCP (last 2 merged PRs): ✅
Safeinputs GH PR list: ✅
Playwright GitHub title: ✅
Tavily search: ❌ (Tavily MCP unavailable)
File write+cat: ✅
Build (npm ci && npm run build): ✅
Discussion comment: ✅
Overall status: FAIL

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

@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

Test Status
GitHub MCP (last 2 merged PRs)
Playwright (github.com title check)
File write (smoke-test-copilot-22984713100.txt)
Bash tool (file read-back)

Last 2 merged PRs:

Overall: PASS

📰 BREAKING: Report filed by Smoke Copilot 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>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants