dotnet / arcade-services

Arcade Engineering Services
MIT License
54 stars 73 forks source link

Maestro keeps commenting on PRs with failed policies #3601

Closed premun closed 1 month ago

premun commented 1 month ago

Examples:

premun commented 1 month ago

We have a high amount of exceptions of this type:

System.InvalidOperationException:
   at System.Linq.ThrowHelper.ThrowMoreThanOneMatchException (System.Linq, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a)
   at System.Linq.Enumerable.TryGetSingle (System.Linq, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a)
   at Microsoft.DotNet.DarcLib.GitHubClient+<CreateOrUpdatePullRequestMergeStatusInfoAsync>d__34.MoveNext (Microsoft.DotNet.DarcLib, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null: /_/src/Microsoft.DotNet.Darc/DarcLib/GitHubClient.cs:475)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at SubscriptionActorService.PullRequestActorImplementation+<CheckMergePolicyAsync>d__29.MoveNext (SubscriptionActorService, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null: /_/src/Maestro/SubscriptionActorService/PullRequestActor.cs:575)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at SubscriptionActorService.PullRequestActorImplementation+<SynchronizePullRequestAsync>d__28.MoveNext (SubscriptionActorService, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null: /_/src/Maestro/SubscriptionActorService/PullRequestActor.cs:520)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e)
   at SubscriptionActorService.ActionRunner+<InvokeAction>d__11`1.MoveNext (SubscriptionActorService, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null: /_/src/Maestro/SubscriptionActorService/ActionRunner/ActionRunner.cs:124)
premun commented 1 month ago

Okay, seems like GitHub Octokit library has int32 overflow when we are creating the comments. The comment gets created but we do not note down it happened because of an exception:

await gitHubClient.Issue.Comment.Create(owner, repo, prIssueId, comment);
pr.SourceRepoNotified = true;
premun commented 1 month ago

We will bump Octokit and see. I can also make it that if we see this exception, we will note down the comment happened

premun commented 1 month ago

The fix for this is probably here: https://github.com/octokit/octokit.net/pull/2928