Skip to content

Conversation

TingluoHuang
Copy link
Member

We want to make sure we always try these request using legacy auth in case the new auth cause any false positive.

@Copilot Copilot AI review requested due to automatic review settings May 5, 2025 17:40
@TingluoHuang TingluoHuang requested a review from a team as a code owner May 5, 2025 17:40
Copy link
Contributor

@Copilot 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 adds conditional checks on HostContext.AllowAuthMigration to ensure legacy authentication paths are only used when migration is not allowed, preventing false positives under the new auth flow.

  • Gate certain exception handlers (e.g., AccessDeniedException, RunnerNotFoundException) behind the migration flag.
  • Wrap retry and session-creation logic in both MessageListener and BrokerMessageListener to skip legacy behavior when migration is enabled.

Reviewed Changes

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

File Description
src/Runner.Listener/MessageListener.cs Added !HostContext.AllowAuthMigration guards to exception filters and retry conditions.
src/Runner.Listener/BrokerMessageListener.cs Introduced !HostContext.AllowAuthMigration checks around OAuth token requests, session creation, and message retrieval.
Comments suppressed due to low confidence (2)

src/Runner.Listener/MessageListener.cs:318

  • No tests were added to cover the behavior when HostContext.AllowAuthMigration is true versus false; consider adding unit tests for both scenarios to verify that exception handling and retry logic behave correctly under each flag setting.
catch (AccessDeniedException e) when (e.ErrorCode == 1 && !HostContext.AllowAuthMigration)

src/Runner.Listener/BrokerMessageListener.cs:144

  • The new condition on HostContext.AllowAuthMigration alters the session-creation and token-request logic but no tests cover the migration-enabled path; add tests to ensure both branches work as intended.
if (!HostContext.AllowAuthMigration &&

@TingluoHuang TingluoHuang merged commit 26eff8e into main May 5, 2025
9 checks passed
@TingluoHuang TingluoHuang deleted the users/tihuang/ignoreerr branch May 5, 2025 18:23
marko-k0 pushed a commit to dfinity/runner that referenced this pull request May 13, 2025
sirredbeard pushed a commit to sirredbeard/runner that referenced this pull request Jun 11, 2025
sirredbeard pushed a commit to sirredbeard/runner that referenced this pull request Jun 11, 2025
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.

3 participants