feat: auto-forward OTEL_* env vars with one-shot token protection for headers#3180
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Pull request overview
This PR improves OpenTelemetry support in the AWF agent container by automatically forwarding OTEL_* environment variables (without requiring --env-all) and ensuring OTLP header credentials are protected via the one-shot token mechanism.
Changes:
- Automatically forward all host
OTEL_*env vars in default (selective passthrough) mode, while respectingEXCLUDED_ENV_VARSand deduplication. - Extend one-shot token protection (
AWF_ONE_SHOT_TOKENS) to include OTLP header variables that commonly contain bearer tokens. - Add tests for OTEL forwarding behavior and document OTEL env var handling and network constraints.
Show a summary per file
| File | Description |
|---|---|
src/services/agent-environment.ts |
Adds default-mode passthrough of OTEL_* vars, forwards COPILOT_OTEL_FILE_EXPORTER_PATH, and protects OTEL header vars via AWF_ONE_SHOT_TOKENS. |
src/services/agent-environment-credentials.test.ts |
Adds unit tests validating OTEL passthrough behavior and one-shot token list coverage. |
docs/environment.md |
Documents OTEL automatic forwarding, one-shot token protection, and OTLP network requirements. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 3/3 changed files
- Comments generated: 1
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@copilot recompile smoke codex |
Done — recompiled |
🔥 Smoke Test: Copilot BYOK — PASS
Running in BYOK offline mode ( Overall: PASS ✅
|
🔬 Smoke Test Results
Overall: FAIL — workflow template variables ( No label applied due to failures.
|
Smoke Test Results (Claude Engine Validation)❌ GitHub API - Failed: Bad credentials error with gh CLI auth Overall: FAIL (2/3 tests passed) One test failed due to GitHub CLI authentication not being properly configured in the workflow environment.
|
Smoke Test Results
PR Titles:
Overall Status: FAIL Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "localhost"See Network Configuration for more information.
|
This comment has been minimized.
This comment has been minimized.
Chroot Version Comparison Results
Overall: FAILED — Python and Node.js versions differ between host and chroot environments.
|
🏗️ Build Test Suite Results
Overall: 8/8 ecosystems passed — ✅ PASS
|
Smoke Test Results — FAIL
|
|
Smoke Codex: FAIL Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "registry.npmjs.org"See Network Configuration for more information.
|
New Feature
In standalone AWF (without
--env-all),OTEL_*variables were silently dropped andOTEL_EXPORTER_OTLP_HEADERS— which typically containsAuthorization: Bearer <token>— was unprotected in/proc/self/environ.Changes
src/services/agent-environment.tsOTEL_*host vars in the selective passthrough block (no--env-allrequired); respectsEXCLUDED_ENV_VARSand deduplicationCOPILOT_OTEL_FILE_EXPORTER_PATHtoalwaysForwardVarsAWF_ONE_SHOT_TOKENS— cached on firstgetenv()call and removed from/proc/self/environvia the LD_PRELOAD library:src/services/agent-environment-credentials.test.ts— tests for OTEL_* forwarding in default mode, absence when unset, one-shot token list coverage, andCOPILOT_OTEL_FILE_EXPORTER_PATHpassthroughdocs/environment.md— new OpenTelemetry (OTEL) Environment Variables section covering automatic forwarding, one-shot credential protection, OTLP/HTTP vs gRPC network constraints (port 4317 is blocked; usehttp/protobuf), and a variable category reference tableNetwork note
OTLP/HTTP (
http/protobuf, default port 4318→443) works through Squid. OTLP/gRPC (port 4317) is blocked by the default DROP rule — users should setOTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf. The OTLP collector domain must be in--allow-domains.