Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .github/skills/try-fix/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Attempts ONE fix for a given problem. Receives all context upfront, tries a sing
2. **Single-shot** - Each invocation = ONE fix idea, tested, reported
3. **Alternative-focused** - Always propose something DIFFERENT from existing fixes (review PR changes first)
4. **Empirical** - Actually implement and test, don't just theorize
5. **Context-driven** - All information provided upfront; don't search for additional context
5. **Context-driven** - Work with what's provided and git history; don't search external sources

**Every invocation:** Review existing fixes → Think of DIFFERENT approach → Implement and test → Report results

Expand All @@ -23,7 +23,7 @@ Attempts ONE fix for a given problem. Receives all context upfront, tries a sing
🚨 **Try-fix runs MUST be executed ONE AT A TIME - NEVER in parallel.**

**Why:** Each try-fix run:
- Modifies the same source files (SafeAreaExtensions.cs, etc.)
- Modifies the same target source files
- Uses the same device/emulator for testing
- Runs EstablishBrokenBaseline.ps1 which reverts files to a known state

Expand Down Expand Up @@ -147,6 +147,8 @@ The skill is complete when:

**Never stop due to:** Compile errors (fix them), infrastructure blame (debug your code), giving up too early.

> **Session limits:** Each try-fix *invocation* allows up to 3 compile/test iterations. The *calling orchestrator* controls how many invocations (attempts) to run per session (typically 4-5 as part of pr-review Phase 3).

---

## Workflow
Expand Down Expand Up @@ -182,7 +184,7 @@ The skill is complete when:
- What files should be investigated?
- Are there hints about what to try or avoid?

**Do NOT search for additional context.** Work with what's provided.
**Do NOT search for external context.** Work with what's provided and the git history.

### Step 2: Establish Baseline (MANDATORY)

Expand Down Expand Up @@ -317,7 +319,7 @@ git diff | Set-Content "$OUTPUT_DIR/fix.diff"
pwsh .github/scripts/EstablishBrokenBaseline.ps1 -Restore
```

🚨 Do NOT use `git checkout HEAD -- .` or `git clean` to restore — use the script.
🚨 Use `EstablishBrokenBaseline.ps1 -Restore` — not `git checkout`, `git restore`, or `git reset` (see Step 2 for why).

Comment on lines 340 to 343

Copilot AI Apr 3, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Step 8 now says not to use manual git checkout/git restore/git reset and points to Step 2, but later in the same doc the Error Handling table still recommends git checkout HEAD -- . / git clean -fd for unrecoverable git state. This reintroduces the same contradiction the PR is trying to remove. Please align the guidance (e.g., keep EstablishBrokenBaseline as the primary/only restore mechanism, or clearly label any git commands as an absolute last resort with constraints).

Copilot uses AI. Check for mistakes.
### Step 9: Report Results

Expand Down
142 changes: 142 additions & 0 deletions .github/skills/try-fix/tests/eval.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
scenarios:
- name: "Happy path: propose alternative fix with different approach"
prompt: |
Use the try-fix skill to attempt a fix for the following problem:

Problem: CollectionView throws ObjectDisposedException when navigating back from a page on Android.

The existing PR fix already adds a null check on the adapter in OnMeasure(). We need a DIFFERENT approach.

Test command: pwsh .github/scripts/BuildAndRunHostApp.ps1 -Platform android -TestFilter "Issue54321"

Target files:
- src/Controls/src/Core/Handlers/Items/ItemsViewHandler.Android.cs

Platform: android

Hints: Focus on lifecycle/disposal timing rather than null checks.
assertions:
- type: output_contains
value: "Approach"
- type: output_contains
value: "Different from existing fix"
- type: output_not_contains
value: "null check on the adapter"
- type: output_contains
Comment on lines +15 to +19

Copilot AI Apr 3, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In scenario 1, the output_not_contains assertion for "null check on the adapter" is likely to be flaky because a correct response may still restate the existing fix (e.g., "Existing fix is a null check on the adapter; my approach differs"). Consider asserting on what the agent does (e.g., it describes a different approach) rather than banning a phrase that the agent may legitimately repeat for comparison.

Suggested change
- type: output_not_contains
value: "null check on the adapter"
- type: output_contains
- type: output_contains
value: "lifecycle"
- type: output_contains

Copilot uses AI. Check for mistakes.
value: "result.txt"
- type: output_contains
value: "analysis"
rubric:
- "The agent proposes a fix approach that is clearly distinct from the null-check-on-adapter approach described as the existing fix"
- "The agent creates an approach.md document explaining the difference from the existing fix"
- "The agent saves artifacts (result.txt, fix.diff, analysis.md) to an output directory"
- "The agent reverts changes after testing using EstablishBrokenBaseline.ps1 rather than manual git commands"
timeout: 120

- name: "Negative trigger: code review request should not invoke try-fix workflow"
prompt: |
Please review the code changes in PR #34567 and tell me if the fix looks correct.
The PR modifies SafeAreaExtensions.cs to add padding adjustments.
assertions:
- type: output_not_contains
value: "EstablishBrokenBaseline"
- type: output_not_contains
value: "attempt-"
- type: output_not_contains
value: "OUTPUT_DIR"
- type: output_not_contains
value: "result.txt"
rubric:
- "The agent provides a code review rather than attempting to run a fix workflow"
- "The agent does not create output directories or artifact files associated with try-fix execution"
timeout: 60

- name: "Regression: agent must not claim Pass without running test command"
prompt: |
Use the try-fix skill for this problem:

Problem: Button tap does not fire Clicked event on iOS when inside a ScrollView.

Existing fix: Adds a gesture recognizer passthrough in ScrollViewHandler.

Test command: pwsh .github/scripts/BuildAndRunHostApp.ps1 -Platform ios -TestFilter "Issue99001"

Target files:
- src/Controls/src/Core/Handlers/Compatibility/ScrollViewRenderer.iOS.cs

Platform: ios

Note: No iOS simulator is currently available.
assertions:
- type: output_not_contains
value: "Pass"

Copilot AI Apr 3, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scenario 3's output_not_contains: "Pass" is overly broad and will fail if the agent writes something like "I cannot mark this as Pass" while correctly reporting Blocked. Make the negative assertion more specific (e.g., target the structured result line such as "Result: Pass" / "result.txt: Pass") so the scenario doesn't reject correct explanations.

Suggested change
value: "Pass"
value: "Result: Pass"
- type: output_not_contains
value: "result.txt: Pass"

Copilot uses AI. Check for mistakes.
- type: output_contains
value: "Blocked"
- type: output_not_contains
value: "code compiles successfully"
- type: output_not_contains
value: "logic looks correct"
rubric:
- "The agent reports 'Blocked' (not 'Pass') when no device/simulator is available to run the test command"
- "The agent does not claim success based on code review or compilation alone"
- "The agent explains why the result is Blocked rather than Pass or Fail"
timeout: 120

- name: "Edge case: second attempt reads and avoids prior failed approach"
prompt: |
Use the try-fix skill to attempt a fix. This is attempt #2 — attempt #1 already failed.

Problem: Shell navigation causes a NullReferenceException in ShellItemHandler on Android when popping to root.

Prior attempt (FAILED): Modified OnPageSelected to reset cached state after navigation.
Failure reason: OnPageSelected fires after layout measurement, so cached value was already consumed.

Test command: pwsh .github/scripts/BuildAndRunHostApp.ps1 -Platform android -TestFilter "Issue77123"

Target files:
- src/Controls/src/Core/Handlers/Shell/ShellItemHandler.Android.cs

Platform: android

Hints: Try intercepting at a different lifecycle point, before measurement occurs.
assertions:
- type: output_not_contains
value: "OnPageSelected"
- type: output_contains
value: "Different from existing fix"
- type: output_contains
value: "approach"

Copilot AI Apr 3, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scenario 4 asserts output_not_contains: "OnPageSelected", but the prompt and rubric require the agent to acknowledge the prior failed attempt, which very likely involves mentioning OnPageSelected explicitly. This assertion will reject compliant outputs; consider instead asserting that the new approach is different (e.g., it references a different lifecycle hook) without forbidding the prior attempt name from being mentioned.

Suggested change
- type: output_not_contains
value: "OnPageSelected"
- type: output_contains
value: "Different from existing fix"
- type: output_contains
value: "approach"
- type: output_contains
value: "Different from existing fix"
- type: output_contains
value: "approach"
- type: output_contains
value: "before measurement"

Copilot uses AI. Check for mistakes.
rubric:
- "The agent acknowledges the prior failed attempt and explicitly avoids repeating the OnPageSelected approach"
- "The agent proposes a lifecycle-based alternative that fires before layout measurement"
- "The approach.md clearly explains how this attempt differs from the prior failed attempt"
timeout: 120

- name: "Regression: agent must use EstablishBrokenBaseline script, not manual git commands"
prompt: |
Use the try-fix skill for this problem:

Problem: Entry text is not preserved on orientation change on Android.

Existing fix: Saves/restores text in OnSaveInstanceState override.

Test command: pwsh .github/scripts/BuildAndRunHostApp.ps1 -Platform android -TestFilter "Issue88200"

Target files:
- src/Core/src/Platform/Android/EntryHandler.Android.cs

Platform: android
assertions:
- type: output_contains
value: "EstablishBrokenBaseline"
- type: output_not_contains
value: "git checkout HEAD"
- type: output_not_contains
value: "git restore"
- type: output_not_contains
value: "git reset"
rubric:
- "The agent uses EstablishBrokenBaseline.ps1 to establish the baseline and restore working directory, not raw git commands"
- "The agent does not use 'git checkout HEAD', 'git restore', or 'git reset' to revert fix files"

Copilot AI Apr 3, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scenario 5 bans any occurrence of git restore / git reset / git checkout HEAD, but the agent may correctly include those strings in a warning (e.g., "do not use git restore"). That makes the test fragile and may fail even when the workflow is compliant. Prefer positive assertions that the agent uses the baseline/restore script (and/or only forbid the exact command lines it tries to execute).

Suggested change
- type: output_not_contains
value: "git checkout HEAD"
- type: output_not_contains
value: "git restore"
- type: output_not_contains
value: "git reset"
rubric:
- "The agent uses EstablishBrokenBaseline.ps1 to establish the baseline and restore working directory, not raw git commands"
- "The agent does not use 'git checkout HEAD', 'git restore', or 'git reset' to revert fix files"
- type: output_contains
value: "EstablishBrokenBaseline.ps1"
- type: output_contains
value: "RestoreAfterAttempt"
rubric:
- "The agent uses EstablishBrokenBaseline.ps1 to establish the baseline and restore working directory, not raw git commands"
- "The assertions prefer positive evidence of script-based baseline/restore behavior instead of banning generic git command substrings that may appear in warnings"

Copilot uses AI. Check for mistakes.
- "The restore step is explicitly called after testing (whether pass or fail)"
timeout: 120
Loading