Investigate and fix flaky/random CI test failures in dotnet/macios. Trigger on GitHub issues describing intermittent test failures, CI postmortem issues, or when asked to fix a flaky test. Analyzes test code, identifies root causes (shared state, environment dependencies, race conditions), and applies fixes.
70
85%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Low
Low-risk findings worth noting
Investigate and fix flaky CI test failures reported in GitHub issues for dotnet/macios.
ci-postmortem labelRead the GitHub issue to extract:
If build URLs are provided, inspect logs for additional context (stack traces, timing info).
Find the test source file:
grep -r "TestMethodName" tests/Read the full test method and all helper methods it calls. Understand:
Common flaky test root causes in this repo:
tests/monotouch-test/Security/KeyChainTest.cs uses per-process unique IDsInvalidRecord or authentication-related errors on keychain operationsLAContext where actually needed (not on plain query/delete operations)When fixing:
Prefer unique identifiers over shared ones. Use Process.GetCurrentProcess ().Id, Guid.NewGuid (), or {bundleId}-{testType}-{pid} patterns for resource identifiers.
Create minimal query records. For search/delete operations, don't attach unnecessary attributes (like LAContext) that can cause intermittent errors.
Handle all status codes. Never silently return false for unexpected error codes. Either handle them with a fallback path or fail with a descriptive assertion message.
Add diagnostic logging. Use TestContext.Out.WriteLine to log operation results that would help diagnose future failures.
Clean up legacy state. If renaming identifiers, also clean up entries from old names that may linger on CI agents.
Always clean up in finally blocks. Ensure test resources are released even on failure.
If you cannot determine the root cause with available information:
dev/{username}/fix-{test-name} or similarFixes #NNNN if the change actually fixes the problem, or Ref #NNNN if it only adds logging/diagnosticscopilot label to the PRtests/monotouch-test/Security/ are particularly prone to flakiness due to shared macOS keychain state on CI agentsInitSecRecord in RecordTest.cs attaches LAContext to all SecRecord instances — this is sometimes unnecessary and can cause InvalidRecord errorsKeyChainTest.cs demonstrates the recommended pattern: per-process unique identifiers using bundle ID + test type + PIDd259b5f
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.