Skip to content

Add actions_orchestration_id as part of user-agent - #12433

Closed
TingluoHuang wants to merge 1 commit into
cli:trunkfrom
TingluoHuang:trunk
Closed

TingluoHuang wants to merge 1 commit into
cli:trunkfrom
TingluoHuang:trunk

Conversation

@TingluoHuang

@TingluoHuang TingluoHuang commented Jan 6, 2026 •

Copy link
Copy Markdown

Fixes: #12430

This pull request enhances the way the HTTP client sets the User-Agent header by allowing it to include a sanitized orchestration ID from the environment variable ACTIONS_ORCHESTRATION_ID. This helps with tracking and debugging requests originating from orchestrated GitHub Actions workflows. The changes also include comprehensive tests to ensure correct behavior and sanitization of the orchestration ID.

image

@TingluoHuang
TingluoHuang marked this pull request as ready for review January 6, 2026 23:12
@TingluoHuang
TingluoHuang requested a review from a team as a code owner January 6, 2026 23:12
@cliAutomation cliAutomation added the external pull request originating outside of the CLI core team label Jan 6, 2026

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.

Pull request overview

This PR enhances the HTTP client to include the ACTIONS_ORCHESTRATION_ID environment variable in the User-Agent header for better tracking of requests from GitHub Actions workflows. The orchestration ID is sanitized to ensure only valid characters (alphanumeric, underscores, hyphens, and dots) are included.

  • Implements a new getUserAgentForActions function that sanitizes and appends the orchestration ID to the User-Agent
  • Adds comprehensive unit tests covering various scenarios including special character sanitization
  • Integrates the new functionality into the existing NewHTTPClient function

Reviewed changes

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

File Description
api/http_client.go Adds getUserAgentForActions function to append sanitized orchestration ID to User-Agent header
api/http_client_test.go Adds comprehensive unit tests for the new functionality including sanitization and integration tests
Comments suppressed due to low confidence (1)

api/http_client_test.go:363

  • Using os.Unsetenv in tests can cause race conditions when tests run in parallel, as environment variables are process-global. The test should use t.Setenv with an empty string or ensure tests don't run in parallel. Since t.Setenv is used in other test cases, it should be used consistently here as well.
				os.Unsetenv("ACTIONS_ORCHESTRATION_ID")

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

Comment thread api/http_client_test.go Resolved
Comment thread api/http_client.go Resolved
@BagToad

BagToad commented Feb 3, 2026

Copy link
Copy Markdown
Member

Hi @TingluoHuang! I am going to switch this to a draft for now since we have some internal discussions about this and it can't be reviewed yet 🙏 I think we should discuss this more at some point to understand what the blockers are internally.

@BagToad
BagToad marked this pull request as draft February 3, 2026 20:42
@BagToad

BagToad commented Jun 5, 2026

Copy link
Copy Markdown
Member

Actually going to close this out for now as part of housekeeping - can reopen this easily if/when we want to do this.

@BagToad BagToad closed this Jun 5, 2026

This branch was previously deployed

1 inactive deployment
cli-automation — 309c4cb2 Deployed Jan 6, 2026 by TingluoHuang via pr-auto #3168
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external pull request originating outside of the CLI core team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Adding actions_orchestration_id as part of user-agent for better telemetry correlation

4 participants