Skip to content

Remove GitHub API call from CLI initialization hot path#16699

Merged
pelikhan merged 6 commits intomainfrom
copilot/remove-github-username-check
Feb 19, 2026
Merged

Remove GitHub API call from CLI initialization hot path#16699
pelikhan merged 6 commits intomainfrom
copilot/remove-github-username-check

Conversation

Copy link
Contributor

Copilot AI commented Feb 19, 2026

The trial command was calling getCurrentGitHubUsername() during initialization to populate the --host-repo flag's default value description. This GitHub API call executed on every CLI invocation, adding unnecessary latency to all commands.

Changes

Removed hot path API call

  • Deleted getCurrentGitHubUsername() invocation from NewTrialCommand() initialization
  • Updated --host-repo flag description to use static placeholder <username>/gh-aw-trial

Preserved lazy resolution

  • Username resolution remains in RunWorkflowTrials() when no --host-repo is provided
  • Behavior unchanged; API call now only happens when actually needed
- // Get current username for default trial repo description
- username, _ := getCurrentGitHubUsername()
- defaultHostRepo := "gh-aw-trial"
- if username != "" {
-     defaultHostRepo = fmt.Sprintf("%s/gh-aw-trial", username)
- }
- cmd.Flags().String("host-repo", "", fmt.Sprintf("Custom host repository slug (defaults to '%s'). Use '.' for current repository", defaultHostRepo))
+ cmd.Flags().String("host-repo", "", "Custom host repository slug (defaults to '<username>/gh-aw-trial'). Use '.' for current repository")

Command initialization now executes in ~11ms instead of potentially several seconds depending on network latency.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 4 commits February 19, 2026 01:08
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
- Removed getCurrentGitHubUsername() call from command initialization (line 181-185)
- Updated --host-repo flag description to use generic placeholder '<username>/gh-aw-trial'
- Username resolution still happens lazily in RunWorkflowTrials() when needed (line 298)
- Eliminates slow GitHub API call in hot path of every CLI command
- Command initialization now executes in ~11ms instead of potentially seconds

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Remove resolving GitHub username from CLI command path Remove GitHub API call from CLI initialization hot path Feb 19, 2026
Copilot AI requested a review from pelikhan February 19, 2026 01:12
@pelikhan pelikhan marked this pull request as ready for review February 19, 2026 01:13
Copilot AI review requested due to automatic review settings February 19, 2026 01:13
@pelikhan pelikhan merged commit beadde0 into main Feb 19, 2026
51 checks passed
@pelikhan pelikhan deleted the copilot/remove-github-username-check branch February 19, 2026 01:13
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 removes a GitHub API call from the CLI initialization hot path to improve performance. Previously, every invocation of the CLI triggered an API call to fetch the current username, even for commands that didn't need it.

Changes:

  • Removed getCurrentGitHubUsername() call from NewTrialCommand() initialization
  • Updated --host-repo flag description to use static placeholder text <username>/gh-aw-trial
  • Preserved lazy username resolution in RunWorkflowTrials() when the flag value is needed

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments