Skip to content

[smoke-otel-tracing] Scenario 1 regression: TestInitProvider_NoEndpoint and TestInitProvider_WithHeaders fail when GH_AW_OTLP_ENDPOINTS is set in JSO [Content truncated due to length] #7468

Closed

Description

@github-actions

Failing Scenario

Scenario 1: Provider Initialization (internal/tracing/) — 4 tests fail when run in the smoke-otel-tracing workflow.

Failing Tests

Test Result Error
TestInitProvider_NoEndpoint_ReturnsNoopProvider FAIL Object expected to be of type noop.TracerProvider, but was *trace.TracerProvider
TestInitProvider_WithHeaders/single_well-formed_header FAIL timed out waiting for OTLP export request — headers test is non-deterministic
TestInitProvider_WithHeaders/multiple_headers_with_whitespace_trimmed FAIL timed out waiting for OTLP export request — headers test is non-deterministic
TestInitProvider_WithHeaders/malformed_and_empty-key_headers_are_skipped FAIL timed out waiting for OTLP export request — headers test is non-deterministic

Full Test Output

=== RUN   TestInitProvider_NoEndpoint_ReturnsNoopProvider
2026/06/13 06:45:52 internal_logging.go:50: "msg"="otlptrace: parse endpoint url" "error"="parse \"[{\\\"url\\\":\\\"https://o205451.ingest.us.sentry.io/api/4511419678457856/integration/otlp\\\"/v1/traces\": first path segment in URL cannot contain colon" "url"="[{\"url\":\"https://o205451.ingest.us.sentry.io/api/4511419678457856/integration/otlp\"/v1/traces"
2026/06/13 06:45:52 internal_logging.go:50: "msg"="otlptrace: parse endpoint url" "error"="parse \"\\\"headers\\\":\\\"x-sentry-auth=sentry sentry_key=7b9eaff58bd23ee89a2b3c289865a27a\\\"}]/v1/traces\": first path segment in URL cannot contain colon" ...
    provider_test.go:183:
        Error Trace: provider_test.go:183
        Error:       Object expected to be of type noop.TracerProvider, but was *trace.TracerProvider
        Test:        TestInitProvider_NoEndpoint_ReturnsNoopProvider
--- FAIL: TestInitProvider_NoEndpoint_ReturnsNoopProvider (0.00s)

=== RUN   TestInitProvider_WithHeaders/single_well-formed_header
    provider_test.go:636: timed out waiting for OTLP export request — headers test is non-deterministic
--- FAIL: TestInitProvider_WithHeaders/single_well-formed_header (3.04s)

=== RUN   TestInitProvider_WithHeaders/multiple_headers_with_whitespace_trimmed
    provider_test.go:636: timed out waiting for OTLP export request — headers test is non-deterministic
--- FAIL: TestInitProvider_WithHeaders/multiple_headers_with_whitespace_trimmed (3.04s)

=== RUN   TestInitProvider_WithHeaders/malformed_and_empty-key_headers_are_skipped
    provider_test.go:636: timed out waiting for OTLP export request — headers test is non-deterministic
--- FAIL: TestInitProvider_WithHeaders/malformed_and_empty-key_headers_are_skipped (3.04s)

FAIL    github.com/github/gh-aw-mcpg/internal/tracing   9.395s

Root Cause

The CI environment (smoke-otel-tracing workflow) sets GH_AW_OTLP_ENDPOINTS to a JSON array format:

GH_AW_OTLP_ENDPOINTS=[{"url":"https://o205451.ingest.us.sentry.io/api/4511419678457856/integration/otlp","headers":"x-sentry-auth=sentry sentry_key=7b9eaff58bd23ee89a2b3c289865a27a"}]

resolveExtraEndpoints in config_resolver.go splits this string by comma, producing two garbage URL fragments:

  1. [{"url":"https://o205451.ingest.us.sentry.io/api/4511419678457856/integration/otlp"
  2. "headers":"x-sentry-auth=sentry sentry_key=7b9eaff58bd23ee89a2b3c289865a27a"}]

Both fragments pass resolveEndpoint() (Go's url.Parse is permissive) and get /v1/traces appended. The OTLP exporter construction calls otlptracehttp.New() with these invalid URLs — which succeeds (lazy connection), so len(exporters) > 0. The SDK provider is created and registered globally instead of noop.

Two related issues:

Issue A — Test isolation (TestInitProvider_NoEndpoint_ReturnsNoopProvider)

The test calls tracing.InitProvider(ctx, nil) without first calling t.Setenv("GH_AW_OTLP_ENDPOINTS", ""). The other TestInitProvider_IsEnabled_* tests correctly isolate with t.Setenv. This test assumes the env is unset, which is wrong in the smoke workflow environment.

Issue B — Test isolation (TestInitProvider_WithHeaders)

The table-driven subtests configure an Endpoint pointing to a local httptest.Server, but do not clear GH_AW_OTLP_ENDPOINTS. Since resolveExtraEndpoints takes precedence over cfg.Endpoint when the env var is non-empty, all spans are routed to the Sentry garbage URLs (which return 401), never reaching the local test server. The 3-second timeout fires.

Issue C — resolveExtraEndpoints doesn't parse JSON format

GH_AW_OTLP_ENDPOINTS is being set to a JSON array with per-endpoint url and headers fields (as shown above). The current implementation treats it as plain comma-separated URLs. If the JSON format is intentional for the workflow, resolveExtraEndpoints needs to detect and parse JSON arrays; otherwise the workflow should set the env var in the plain comma-separated URL format.

Environment

  • Go version: go1.25.11 linux/amd64
  • Workflow run: 27459360247
  • GH_AW_OTLP_ENDPOINTS: [{"url":"https://o205451.ingest.us.sentry.io/.../otlp","headers":"x-sentry-auth=..."}]
  • OTEL_EXPORTER_OTLP_ENDPOINT: https://o205451.ingest.us.sentry.io/api/4511419678457856/integration/otlp

Other Scenarios

All other scenarios passed:

  • ✅ Scenario 2: Parent Context Propagation — 7 tests pass
  • ✅ Scenario 3: HTTP Handler Span Creation — 8 tests pass
  • ✅ Scenario 4: Tool Call Span Instrumentation — all circuit breaker and callBackendTool tests pass
  • ✅ Scenario 5: Header Parsing — TestParseOTLPHeaders and TestResolveHeaders_* all pass
  • ✅ Scenario 6: HTTP Backend Auth — all MCP HTTP connection tests pass
  • ✅ Scenario 7: Graceful Shutdown — TestInitProvider_WithEndpoint_ReturnsSdkProvider passes
  • ✅ Scenario 8: Binary Integration — binary starts with OTel enabled, W3C parent context resolved: traceId=e3dd6ea3d5866246548b640e777a88b9 confirmed in debug output

📡 OTel tracing smoke test by Smoke OTel Tracing

  • expires on Jun 20, 2026, 6:50 AM UTC

Activity

  1. github-actions commented on Jun 13, 2026

    @github-actions
    ContributorAuthor

    🤖 This is an automated response from Repo Assist.

    Root cause confirmed. I've opened #7478 to fix Issues A and B identified here.

    Issue A (TestInitProvider_NoEndpoint_ReturnsNoopProvider) and Issue B (TestInitProvider_WithHeaders ×3 subtests) share the same root cause: resolveExtraEndpoints reads GH_AW_OTLP_ENDPOINTS from the ambient environment, and these tests don't clear it with t.Setenv("GH_AW_OTLP_ENDPOINTS", ""). The fix is a 3-line change adding that guard, mirroring the pattern already used by TestInitProvider_IsEnabled_Noop, TestInitProvider_IsEnabled_SDK, and TestInitProvider_FanOut_EmptyEnvVar.

    Issue C (JSON-array format parsing) needs a maintainer decision:

    • The documented format in AGENTS.md is comma-separated plain URLs: (ep1.example.com/redacted),(ep2.example.com/redacted)
    • The smoke workflow sets it to a JSON array: [{"url":"...","headers":"..."}]
    • Two options: (1) update resolveExtraEndpoints to detect and parse JSON input, or (2) update the smoke workflow to use the plain comma-separated format

    Option 2 is simpler and keeps the code minimal, but only works if per-endpoint headers aren't needed. Option 1 enables per-endpoint header configuration (which the JSON format's headers field would support).

    Warning

    Firewall blocked 1 domain

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

    • proxy.golang.org

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

    network:
      allowed:
        - defaults
        - "proxy.golang.org"

    See Network Configuration for more information.

    Generated by Repo Assist · 1.2K AIC · ⊞ 50.2K · ◷
    Comment /repo-assist to run again

    Add this agentic workflows to your repo

    To install this agentic workflow, run

    gh aw add githubnext/agentics/workflows/repo-assist.md@851905c06e905bf362a9f6cc54f912e3df747d55
    
  2. added a commit that references this issue on Jun 13, 2026
    a947b66
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions