Skip to content

Fix authentication injection in interactive Copilot CLI - #715

Merged
rr3khan merged 1 commit into
1Password:mainfrom
PreNoob:fix/copilot-plugin-empty-args-auth
Nov 24, 2026
Merged

rr3khan merged 1 commit into
1Password:mainfrom
PreNoob:fix/copilot-plugin-empty-args-auth

Conversation

@PreNoob

@PreNoob PreNoob commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Overview

This pull request updates the authentication logic for the Copilot CLI plugin and adds a new test to verify the behavior. The main change is the removal of a condition that previously prevented authentication when no arguments were provided, ensuring that authentication is now required for interactive sessions. Additionally, a test suite is introduced to cover various command scenarios.

Authentication logic changes:

  • Removed the needsauth.NotWithoutArgs() condition from the NeedsAuth configuration in copilot.go, so authentication is now required even when no arguments are given.

Testing improvements:

  • Added a new test TestCopilotCLINeedsAuth in copilot_test.go to verify the updated authentication requirements for different Copilot CLI command invocations.
    The Copilot CLI starts an interactive session when invoked without arguments. The shell plugin previously skipped credential injection for that invocation, so Copilot could not use the token stored in 1Password. Remove that exclusion while retaining the existing auth-free handling for login, help, version, and completion commands.

Type of change

  • Fixed a bug in an existing plugin

Related Issue(s)

No directly matching issue. #414 concerns the older gh copilot extension.

How To Test

  • Run go test ./plugins/copilot.
  • With 1Password CLI app integration enabled and the Copilot credential configured, run op plugin run -- copilot with no arguments and confirm the interactive CLI starts authenticated.

Changelog

The GitHub Copilot CLI plugin now injects its authentication token when starting an interactive session without arguments.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

@rr3khan rr3khan 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.

Thanks for the fix @PreNoob approved and will merge.

@rr3khan
rr3khan merged commit 4caf7cb into 1Password:main Nov 24, 2026
3 checks passed
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