Skip to content

feat(api-proxy): forward COPILOT_INTEGRATION_ID from host env#5147

Merged
lpcox merged 2 commits into
mainfrom
feat/copilot-integration-id-override
Jun 17, 2026
Merged

feat(api-proxy): forward COPILOT_INTEGRATION_ID from host env#5147
lpcox merged 2 commits into
mainfrom
feat/copilot-integration-id-override

Conversation

@lpcox

@lpcox lpcox commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds support for forwarding COPILOT_INTEGRATION_ID environment variable from host to api-proxy container, allowing consumers to override the default 'agentic-workflows' integration ID when needed for specific model allowlists or other integration requirements.

Implementation

  • Forward COPILOT_INTEGRATION_ID from --env, --env-file, or host env (with --env-all)
  • Trim and validate the value (ignore empty/whitespace-only values)
  • Fall back to api-proxy's default 'agentic-workflows' when unset
  • Do NOT forward GITHUB_COPILOT_INTEGRATION_ID (remains unused)

Testing

Added 7 new test cases covering:

  • ✅ Forwarding when explicitly set (host env with --env-all)
  • ✅ Not setting when empty string
  • ✅ Not setting when whitespace-only
  • ✅ Trimming surrounding whitespace
  • ✅ Not setting when nothing is set
  • ✅ Forwarding from --env flag (config.additionalEnv)
  • ✅ Preferring --env over host env

All unit tests pass.

Why This Approach

This is intentionally undocumented for limited use cases:

  1. Not in schema - Only accessible via env var or --env CLI flag, not stdin config
  2. Not documented - Won't be added to README or docs/environment.md
  3. Direct communication - We'll provide this directly to the user who needs it via private channel

Usage

Users can set it via --env flag:

awf --env COPILOT_INTEGRATION_ID=copilot-developer-cli --allow-domains api.githubcopilot.com ...

Or via host env with --env-all:

export COPILOT_INTEGRATION_ID=copilot-developer-cli
awf --env-all --allow-domains api.githubcopilot.com ...

Or in GitHub Actions:

env:
  COPILOT_INTEGRATION_ID: copilot-developer-cli

Add support for forwarding COPILOT_INTEGRATION_ID environment variable
from host to api-proxy container. This allows consumers to override the
default 'agentic-workflows' integration ID when needed for specific
model allowlists or other integration requirements.

Implementation:
- Forward COPILOT_INTEGRATION_ID from host env if explicitly set
- Trim and validate the value (ignore empty/whitespace-only values)
- Fall back to api-proxy's default 'agentic-workflows' when unset

This is intentionally undocumented for limited use cases only.

Closes #5132

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 17, 2026 04:00
@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 97.30% 97.34% 📈 +0.04%
Statements 97.16% 97.20% 📈 +0.04%
Functions 98.84% 98.84% ➡️ +0.00%
Branches 91.92% 91.96% 📈 +0.04%
📁 Per-file Coverage Changes (1 files)
File Lines (Before → After) Statements (Before → After)
src/workdir-setup.ts 92.7% → 94.5% (+1.82%) 92.7% → 94.5% (+1.82%)

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Not ready to approve

There’s a mismatch between the claimed --env support and the current implementation plus a test reliability issue due to incomplete env cleanup in existing tests.

Pull request overview

Adds an opt-in mechanism for callers to override the api-proxy’s default Copilot integration ID (agentic-workflows) by forwarding COPILOT_INTEGRATION_ID into the api-proxy container (with trimming and whitespace-only suppression), plus unit tests to validate the forwarding behavior.

Changes:

  • Forward COPILOT_INTEGRATION_ID into the api-proxy container only when it’s non-empty after trimming.
  • Keep GITHUB_COPILOT_INTEGRATION_ID intentionally un-forwarded.
  • Add Jest coverage for set/empty/whitespace/trim/unset cases.
File summaries
File Description
src/services/api-proxy-service-config.ts Adds conditional forwarding of COPILOT_INTEGRATION_ID into the api-proxy container env.
src/services/api-proxy-service-api-targets.test.ts Adds unit tests validating forwarding/omission behavior for COPILOT_INTEGRATION_ID.

Copilot's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 2

Note

Your feedback helps us improve the quality of this feature.
Please use 👍 or 👎 to tell us whether this assessment is correct.


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

Comment on lines +125 to +127
...(process.env.COPILOT_INTEGRATION_ID?.trim() && {
COPILOT_INTEGRATION_ID: process.env.COPILOT_INTEGRATION_ID.trim(),
}),
Comment on lines +544 to +548
it('should forward COPILOT_INTEGRATION_ID from host env when explicitly set', () => {
const origCopilot = process.env.COPILOT_INTEGRATION_ID;
const origGhCopilot = process.env.GITHUB_COPILOT_INTEGRATION_ID;
process.env.COPILOT_INTEGRATION_ID = 'my-custom-integration';
delete process.env.GITHUB_COPILOT_INTEGRATION_ID;
@lpcox

lpcox commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator Author

@copilot address review feedback

@github-actions

Copy link
Copy Markdown
Contributor

⏳ Copilot review left inline comments.

@lpcox To proceed:

  1. Ask @copilot to address the review feedback (reply to this comment or the review thread)
  2. Once the fix is pushed, add the ready-for-aw label to trigger agentic CI smoke tests

- Use getConfigEnvValue() to support --env/--env-file/--env-all for COPILOT_INTEGRATION_ID
- Add describe-level beforeEach/afterEach to prevent test flakiness
- Add tests for additionalEnv support and precedence
- All 9 tests in COPILOT_INTEGRATION_ID forwarding suite passing

Copilot AI commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

@copilot address review feedback

Review feedback addressed in commit f8a1456:

  1. ✅ Added support for --env flag via config.additionalEnv - now uses getConfigEnvValue() which properly prioritizes --env > --env-file > host env (with --env-all)
  2. ✅ Centralized environment cleanup - added describe-level beforeEach/afterEach to prevent test flakiness from host environment variables

All 9 tests in the COPILOT_INTEGRATION_ID forwarding suite are passing, including 2 new tests that verify --env support and precedence.

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

🔑 Smoke Copilot PAT reports failed. PAT auth path may have issues...

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Smoke Copilot BYOK AOAI (api-key) completed. Copilot AOAI BYOK (api-key) mode operational. 🔓

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

📡 Smoke OTel Tracing reports failed. OTel tracing regression detected. ⚠️

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Smoke Copilot BYOK AOAI (Entra) completed. Copilot AOAI BYOK (Entra) mode operational. 🔓

All smoke tests passed; comment posted and label added

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Contribution Check failed. Please review the logs for details.

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Smoke Claude failed

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Smoke Gemini completed. All facets verified. 💎

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Security Guard has started processing this pull request

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Smoke Copilot BYOK completed. Copilot BYOK mode operational. 🔓

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

🔌 Smoke Services — All services reachable! ✅

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Build Test Suite completed successfully!

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Chroot tests passed! Smoke Chroot - All security and functionality tests succeeded.

@github-actions

Copy link
Copy Markdown
Contributor

🔬 Smoke Test Results

PR: feat(api-proxy): forward COPILOT_INTEGRATION_ID from host env
Author: @lpcox

Test Result
GitHub MCP connectivity
GitHub.com HTTP connectivity ❌ (pre-step data not available — template vars unresolved)
File write/read ❌ (pre-step data not available — template vars unresolved)

Overall: FAIL — pre-computed test data was not injected (workflow template expressions unresolved).

📰 BREAKING: Report filed by Smoke Copilot

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: Copilot BYOK (Direct) Mode ✅ PASS

Test Results:

  • ✅ MCP GitHub connectivity (PR list retrieval)
  • ✅ GitHub.com HTTP 200
  • ✅ File write/read capability
  • ✅ BYOK inference path active (COPILOT_DUMMY_BYOK placeholder)

Mode: Direct BYOK (COPILOT_PROVIDER_API_KEY) → api-proxy sidecar → api.githubcopilot.com

All smoke tests passed. Agent is running in direct BYOK mode with api-proxy credential injection enabled.

🔑 BYOK report filed by Smoke Copilot BYOK

@github-actions

Copy link
Copy Markdown
Contributor

@lpcox
[Test Coverage] Add branch coverage for audit-enricher, log-and-limits, docker-host-staging ✅
feat(api-proxy): forward COPILOT_INTEGRATION_ID from host env ✅
GitHub.com connectivity ✅
File write/read ✅
Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY + COPILOT_PROVIDER_BASE_URL) via api-proxy → Azure OpenAI (Foundry, o4-mini-aw) ✅

Overall: PASS

🔑 BYOK (AOAI api-key) report filed by Smoke Copilot BYOK AOAI (api-key)

@github-actions

Copy link
Copy Markdown
Contributor

Smoke test results:

  • fix(api-proxy): support --env flag and fix test env cleanup
  • feat(api-proxy): forward COPILOT_INTEGRATION_ID from host env
  • PR/discussion GitHub query step ❌
  • Playwright GitHub title check ✅
  • Temp file creation + verification ✅
  • npm ci && npm run build ❌ (node missing)
    Overall: FAIL

🔮 The oracle has spoken through Smoke Codex

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test Results

Check Result
Redis PING ❌ (no response)
PostgreSQL pg_isready ❌ (no response)
PostgreSQL SELECT 1 ❌ (no response)

Overall: FAILhost.docker.internal is unreachable from this runner. Service containers are not accessible.

🔌 Service connectivity validated by Smoke Services

@github-actions

Copy link
Copy Markdown
Contributor

@lpcox
Running in direct BYOK mode (AWF_AUTH_TYPE=github-oidc + AWF_AUTH_AZURE_* + COPILOT_PROVIDER_BASE_URL) via api-proxy → Azure OpenAI (o4-mini-aw) via Microsoft Entra
GitHub MCP Testing PRs:

  • [Test Coverage] Add branch coverage for audit-enricher, log-and-limits, docker-host-staging
  • feat(api-proxy): forward COPILOT_INTEGRATION_ID from host env
    Connectivity (github.com): ✅
    File I/O: ✅
    BYOK Inference: ✅
    Overall: PASS

🪪 BYOK (AOAI Entra) report filed by Smoke Copilot BYOK AOAI (Entra)

@github-actions

Copy link
Copy Markdown
Contributor

Chroot Version Comparison Results

Runtime Host Version Chroot Version Match?
Python Python 3.12.13 Python 3.12.3
Node.js v24.16.0 v22.22.3
Go go1.22.12 go1.22.12

Overall: ❌ Not all versions match

Python and Node.js versions differ between host and chroot environments.

Tested by Smoke Chroot

@github-actions

Copy link
Copy Markdown
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

Notes:

  • Java: Maven local repository was pre-owned by root; used -Dmaven.repo.local flag to redirect to a writable path. All tests passed successfully.
  • All other ecosystems ran without issues.

Generated by Build Test Suite for issue #5147 ·

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: Gemini Engine Validation

  • GitHub MCP Testing: ❌ (Tools not found)
  • GitHub.com Connectivity: ❌ (HTTP 400 from Squid / SSL Error 35)
  • File Writing Testing: ✅
  • Bash Tool Testing: ✅

PR Titles Reviewed:

Overall status: FAIL

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • localhost

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "localhost"

See Network Configuration for more information.

💎 Faceted by Smoke Gemini

@lpcox lpcox merged commit 44ea6ef into main Jun 17, 2026
82 of 86 checks passed
@lpcox lpcox deleted the feat/copilot-integration-id-override branch June 17, 2026 14:54
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.

3 participants