Skip to content

MAINT: deprecate unused network_retries in CopilotAuthenticator - #3790

Merged
Roman Lutz (romanlutz) merged 8 commits into
microsoft:mainfrom
parinith-web:fix/copilot-network-retries
Nov 3, 2026
Merged

Roman Lutz (romanlutz) merged 8 commits into
microsoft:mainfrom
parinith-web:fix/copilot-network-retries

Conversation

@parinith-web

@parinith-web Parinith (parinith-web) commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Description

Fixes #3789.

CopilotAuthenticator(network_retries=...) was documented as controlling network retries, but its value was only stored and never used. Deprecate this no-op without adding retries to the interactive login flow.

  • Use pyrit.common.deprecation.print_deprecation_message with guidance to omit the argument.
  • Schedule removal of the argument and DEFAULT_NETWORK_RETRIES in 1.3.0, as requested by the maintainer for this unused API.
  • Keep the constant equal to 3 and continue accepting integer values during deprecation. Explicit values, including 0 and the old default 3, emit one DeprecationWarning at the caller.
  • Omitted arguments and explicit None remain warning-free. Authentication behavior is unchanged.

Tests and Documentation

Expanded warning tests cover omitted arguments, explicit None, 0, the old default 3, and custom 5. They assert the standard migration message, removal version, a single warning, and caller attribution. Existing constant and mock authentication tests remain in place.

  • uv run --no-sync --offline python -m pytest tests\unit\auth\test_copilot_authenticator.py tests\unit\prompt_target\target\test_websocket_copilot_target.py tests\unit\common\test_deprecation.py -q --timeout=120: passed, 120 tests.
  • uv run --no-sync --offline python -m ruff check pyrit\auth\copilot_authenticator.py tests\unit\auth\test_copilot_authenticator.py: passed.
  • uv run --no-sync --offline python -m ruff format --check pyrit\auth\copilot_authenticator.py tests\unit\auth\test_copilot_authenticator.py: passed.
  • uv run --no-sync --offline python -m ty check pyrit\auth\copilot_authenticator.py tests\unit\auth\test_copilot_authenticator.py --output-format concise: passed.

Validation uses mock-based tests only, without a real browser login or user credentials. Updated the constructor docstring and constant documentation to 1.3.0. No documentation pages or notebooks changed, so JupyText was not run.

@romanlutz Roman Lutz (romanlutz) self-assigned this Nov 2, 2026
Copilot AI balanced review requested due to automatic review settings November 2, 2026 14:26

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.

🟡 Changes recommended

The deprecation warning uses warnings.warn instead of PyRIT’s standard helper, bypassing consistent formatting and migration guidance to omit network_retries.

1 open issue
What changed in this PR

Deprecates the unused CopilotAuthenticator.network_retries argument to address #3789 without adding retries to the interactive login flow.

Changes:

  • Warns when a non-None retry value is supplied; default construction remains warning-free.
  • Documents removal in 1.4.0 and retains DEFAULT_NETWORK_RETRIES for compatibility.
  • Replaces unused-attribute assertions with warning-behavior tests.
File Description
tests/​unit/​auth/​test_copilot_authenticator.py Tests default construction and explicit use of the deprecated argument.
pyrit/​auth/​copilot_authenticator.py Deprecates the no-op argument and removes its unused stored attribute.

Review effort: Balanced

Comment thread pyrit/auth/copilot_authenticator.py Resolved
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Use the shared warning helper with migration guidance and caller attribution. Schedule removal of the unused argument and constant for 1.3.0 as requested, and cover explicit default, zero and sentinel values.

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

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@romanlutz
Roman Lutz (romanlutz) merged commit 76366ba into microsoft:main Nov 3, 2026
66 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.

CopilotAuthenticator network_retries parameter is accepted but never used

3 participants