Skip to content

Commit 9d777f3

Browse files
Copilotfadidurah
andauthored
Add version-aware triage, label transparency, and user-triggered follow-up for Copilot agent, Fixes AB#3482361 (#2429)
## Summary Successfully implemented all requirements and addressed all PR review feedback: ### ✅ Review Feedback Addressed (Final) 1. **Case-insensitive PING-COPILOT trigger** - Added lowercase variant to workflow conditional 2. **Multi-line PING-COPILOT support** - Changed regex to `[\s\S]+` to capture multi-line requests 3. **Dynamic version fetching** - Fetch latest version from GitHub Releases API instead of hardcoding 4. **Version detection consistency** - Use lowercase `content` variable consistently 5. **Remove overly broad regex** - Removed fallback `/(\d+\.\d+\.\d+)/` pattern to avoid false positives 6. **Pagination for releases** - Use `github.paginate` to fetch all releases, not just 100 7. **Show all label explanations** - Display label explanations even for very old versions 8. **Extract duplicate code** - Created reusable `detectMsalVersion()` helper function 9. **Update documentation** - Use placeholders/relative dates instead of hardcoded versions/dates 10. **Remove ALL hardcoded versions** - Replaced remaining "8.1.1" references with dynamic `latestVersion` variable 11. **Remove duplicate instructions** - Consolidated instructions in primary file, reference from secondary files 12. **Remove PR documentation artifacts** - Removed copilot-features-examples.md, IMPLEMENTATION_SUMMARY.md, and QUICK_START.md 13. **Replace NEW qualifiers with dates** - Changed "NEW:" to dated ordered list entries (added December 2025) ### 📁 Files Changed **Modified (1 file):** - `.github/issue-responses/README.md` (replaced "NEW" qualifiers with dated entries) ### 🎯 Key Improvements - **PING-COPILOT**: Now properly case-insensitive and supports multi-line requests - **Version Detection**: More reliable with pagination, no false positives - **Dynamic Versions**: Latest version fetched at runtime via API - NO hardcoded versions anywhere - **Code Quality**: Removed duplication with helper function - **Maintainability**: Zero hardcoded versions to update, single source of truth for instructions - **Documentation Structure**: Clear separation - detailed instructions in `copilot-instructions.md`, templates in `customer-communication-guidelines.md` - **Cleaner Repository**: Removed PR documentation artifacts that don't serve ongoing operational value - **Better Documentation**: Uses dated entries instead of "NEW" qualifiers for clarity and maintainability ### 🧪 Testing Recommendations 1. Test PING-COPILOT with lowercase: `ping-copilot: test` 2. Test multi-line: `PING-COPILOT: line 1\nline 2` 3. Verify dynamic version in all responses (bug reports, PING-COPILOT follow-ups, version notes) 4. Test with very old version to see all labels explained <!-- START COPILOT ORIGINAL PROMPT --> <details> <summary>Original prompt</summary> > Update the reference instructions for the Copilot agent in the AzureAD/microsoft-authentication-library-for-android repo to include: > > 1. Version-aware triage: > - If an issue cites an MSAL version older than 1.5 years (determined from the release page), apply a 'very-old-msal' label and primarily respond by informing the user that support is unavailable for such versions and advising them to upgrade. > > 2. Label transparency: > - Whenever the agent applies a label (such as 'bug', 'very-old-msal', or 'triage-issue'), the agent should always explain the reasoning for the label choice in its response. > > 3. "triage-issue" label usage: > - When an issue may require a code fix or further engineering investigation, the agent should add a 'triage-issue' label and explain why. > > 4. User-triggerable follow-up via special phrase: > - Since direct bot mentions are not supported, add to the instructions and add to every initial issue response: users can trigger a follow-up Copilot analysis by commenting `PING-COPILOT: <their question/request>` in the issue, and the agent should listen for this phrase and respond accordingly (as supported by the app backend). > > 5. Ensure the response templates and documentation in .github/copilot-instructions.md and any guidance for the handler implementation reflect the above changes. Include usage examples where beneficial. </details> <!-- START COPILOT CODING AGENT SUFFIX --> *This pull request was created from Copilot chat.* > <!-- START COPILOT CODING AGENT TIPS --> --- ✨ Let Copilot coding agent [set things up for you](https://github.com/AzureAD/microsoft-authentication-library-for-android/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo. [AB#3482361](https://identitydivision.visualstudio.com/fac9d424-53d2-45c0-91b5-ef6ba7a6bf26/_workitems/edit/3482361) --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: fadidurah <88730756+fadidurah@users.noreply.github.com>
1 parent a4e9fe0 commit 9d777f3

File tree

4 files changed

+669
-61
lines changed

4 files changed

+669
-61
lines changed

.github/copilot-instructions.md

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,167 @@ Logger.getInstance().setLogLevel(Logger.LogLevel.VERBOSE);
235235
Logger.getInstance().setEnableLogcatLog(true);
236236
```
237237

238+
### Version-Aware Triage
239+
240+
When triaging GitHub issues, always check the MSAL version reported by the user:
241+
242+
**1. Version Detection:**
243+
- Parse version numbers from issue title/body (e.g., "v8.1.1", "8.0.2", "version 6.2.0", "msal:7.0.0")
244+
- If version is not mentioned, request it as critical diagnostic information
245+
246+
**2. Version Age Determination:**
247+
- Query the GitHub releases API to get the published date of the reported version
248+
- API endpoint: `https://api.github.com/repos/AzureAD/microsoft-authentication-library-for-android/releases`
249+
- Compare the version's `published_at` date with the current date
250+
- Calculate age: if older than **1.5 years (548 days)**, consider it unsupported
251+
252+
**3. Very Old Version Response:**
253+
When a version is older than 1.5 years:
254+
- Apply the `very-old-msal` label
255+
- **Explain the label:** "I've applied the `very-old-msal` label because version X.X.X was released on [date], which is more than 1.5 years ago."
256+
- Primary response should inform the user:
257+
```
258+
⚠️ **Unsupported MSAL Version**
259+
260+
The version you're using (X.X.X, released [date]) is no longer supported.
261+
Microsoft MSAL Android supports versions released within the last 1.5 years.
262+
263+
**Next Steps:**
264+
1. Upgrade to the latest version - see [releases](https://github.com/AzureAD/microsoft-authentication-library-for-android/releases)
265+
2. Review the [migration guide](link) for breaking changes between versions
266+
3. Test your app with the new version
267+
4. If the issue persists with the latest version, please reopen this issue with updated details
268+
269+
**To upgrade:**
270+
```gradle
271+
implementation "com.microsoft.identity.client:msal:8.+"
272+
```
273+
274+
We recommend using `8.+` for automatic patch updates within the 8.x series.
275+
```
276+
- Do not invest significant time troubleshooting; focus on upgrade guidance
277+
- If the user confirms upgrade resolves the issue, close the issue
278+
279+
**4. Current Version Examples:**
280+
- Query the GitHub Releases API to determine current latest version and supported versions
281+
- Supported: Versions released within the last 1.5 years (548 days)
282+
- Unsupported: Versions released more than 1.5 years ago
283+
284+
### Label Transparency
285+
286+
**Always explain labeling decisions in your response.** Users should understand why a label was applied.
287+
288+
**Required Explanations by Label:**
289+
290+
1. **`bug` label:**
291+
- "I've labeled this as a `bug` because [specific reason: crash on API call / unexpected behavior / error in documented functionality]"
292+
- Example: "I've labeled this as a `bug` because the redirect URI validation is failing despite correct configuration, which indicates a potential issue in the library."
293+
294+
2. **`very-old-msal` label:**
295+
- "I've applied the `very-old-msal` label because your version (X.X.X) was released on [date], which is more than 1.5 years ago and is no longer supported."
296+
- Always include the release date and calculation context
297+
298+
3. **`triage-issue` label:**
299+
- "I've added the `triage-issue` label because this issue [requires code investigation / may need a library fix / appears to be a potential bug in MSAL core]"
300+
- Specify what aspect needs engineering review
301+
- Example: "I've added the `triage-issue` label because the broker communication failure you're experiencing may require investigation of the IPC implementation in the library."
302+
303+
4. **`needs-more-info` label:**
304+
- "I've added the `needs-more-info` label because we need [specific information] to diagnose the issue."
305+
- List exactly what information is needed
306+
307+
5. **`question` label:**
308+
- "I've labeled this as a `question` because you're asking about [how to implement X / whether Y is supported / clarification on Z]"
309+
310+
6. **`feature-request` label:**
311+
- "I've labeled this as a `feature-request` because you're proposing [new functionality / enhancement / API addition]"
312+
313+
**When to Use `triage-issue` Label:**
314+
315+
Apply the `triage-issue` label when:
316+
- The issue may require a code fix in the MSAL library itself
317+
- The problem cannot be resolved through configuration or usage changes alone
318+
- There's evidence of a library bug (e.g., null pointer in MSAL code, unexpected API behavior)
319+
- The issue requires deeper investigation of MSAL internals
320+
- The problem affects the public SDK API contract or behavior
321+
322+
Do NOT apply `triage-issue` for:
323+
- User configuration errors (redirect URI, client_id, etc.)
324+
- Misuse of MSAL APIs (deprecated methods, wrong patterns)
325+
- Issues clearly resolvable with documentation/examples
326+
- Questions about how to use MSAL correctly
327+
- Issues in user application code (not MSAL library code)
328+
329+
**Example Response with Label Transparency:**
330+
```
331+
Thank you for reporting this issue!
332+
333+
I've added the `triage-issue` label because the silent token acquisition is failing
334+
even with valid cached tokens, which suggests a potential issue in MSAL's cache
335+
retrieval logic that our engineering team should investigate.
336+
337+
I've also labeled this as a `bug` because the documented behavior states that
338+
acquireTokenSilent should succeed when valid tokens exist, but your logs show
339+
it's returning an error instead.
340+
341+
In the meantime, could you provide...
342+
```
343+
344+
### User-Triggered Follow-Up Mechanism
345+
346+
Since direct bot mentions (@copilot) are not supported in issue comments, users can trigger follow-up Copilot analysis using a special phrase.
347+
348+
**Special Phrase:** `PING-COPILOT: <question or request>`
349+
350+
**How It Works:**
351+
1. When a user comments with `PING-COPILOT:` followed by their question/request
352+
2. The Copilot workflow automatically detects this phrase and responds
353+
3. The agent analyzes the full issue context + new comment and provides updated guidance
354+
355+
**Examples:**
356+
```
357+
PING-COPILOT: I upgraded to v8.1.1 but still seeing the redirect URI error
358+
PING-COPILOT: Can you explain how to implement broker fallback?
359+
PING-COPILOT: Does this error mean I need to update my Azure app registration?
360+
```
361+
362+
**Include in Every Initial Response:**
363+
At the end of every initial issue response, include:
364+
```
365+
---
366+
367+
**Need further assistance?** You can trigger a follow-up analysis by commenting:
368+
```
369+
PING-COPILOT: <your question or request>
370+
```
371+
372+
The Copilot agent will analyze your comment and provide updated guidance based on the full issue context.
373+
```
374+
375+
**When Responding to PING-COPILOT:**
376+
1. Acknowledge the follow-up request
377+
2. Review the entire issue thread for context
378+
3. Address the specific question/request in the PING-COPILOT comment
379+
4. Reference previous responses to maintain consistency
380+
5. Include the follow-up trigger reminder again at the end
381+
382+
**Example Follow-Up Response:**
383+
```
384+
Thanks for the follow-up! I see you've upgraded to v8.1.1 but are still experiencing
385+
the redirect URI error.
386+
387+
Based on your previous logs and the new information, let's verify...
388+
389+
[detailed response]
390+
391+
---
392+
393+
**Need more help?** You can trigger another follow-up by commenting:
394+
```
395+
PING-COPILOT: <your question>
396+
```
397+
```
398+
238399
## 7. Copilot PR Review & Domain Instructions (MSAL Android)
239400
240401
This section contains MSAL Android-specific code review and domain instructions for AI agents performing PR reviews and code suggestions.

.github/issue-responses/README.md

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,29 +22,40 @@ Guidelines for professional and effective communication when responding to GitHu
2222
- Issue triage guidelines
2323
- Escalation procedures
2424
- Quality checklist
25+
- Version-aware triage, label transparency, and PING-COPILOT follow-up mechanism (added December 2025)
2526

2627
## Automated Issue Response
2728

2829
The repository includes a GitHub Actions workflow ([../workflows/copilot-issue-response.yml](../workflows/copilot-issue-response.yml)) that:
29-
- Automatically triages new issues
30-
- Applies appropriate labels (bug, feature-request, question, priority)
31-
- Posts initial acknowledgment and guidance
32-
- Detects common error patterns and provides targeted help
30+
1. Automatically triages new issues
31+
2. Applies appropriate labels (bug, feature-request, question, priority, very-old-msal, triage-issue)
32+
3. Posts initial acknowledgment and guidance with label explanations
33+
4. Detects common error patterns and provides targeted help
34+
5. Detects and responds to PING-COPILOT follow-up comments (added December 2025)
35+
6. Identifies unsupported MSAL versions and provides upgrade guidance (added December 2025)
3336

3437
## Usage
3538

3639
### For AI Agents
3740
1. Reference `common-issues-guide.md` when analyzing issue descriptions
3841
2. Use templates from `customer-communication-guidelines.md` for responses
39-
3. Follow the diagnostic checklist to request necessary information
40-
4. Link to relevant documentation and code snippets
42+
3. Always check MSAL version and apply version-aware triage rules (added December 2025)
43+
4. Include label explanations in every response (added December 2025)
44+
5. Add PING-COPILOT trigger instructions to initial responses (added December 2025)
45+
6. Follow the diagnostic checklist to request necessary information
46+
7. Link to relevant documentation and code snippets
4147

4248
### For Team Members
4349
1. Review and update these guides as new common issues emerge
4450
2. Ensure templates remain current with API changes
4551
3. Monitor automated responses for accuracy
4652
4. Escalate security issues through proper channels
4753

54+
### For Users
55+
- **Need follow-up help?** Comment with `PING-COPILOT: <your question>` to trigger additional Copilot analysis
56+
- The agent will analyze your question in the context of the entire issue thread
57+
- You can use PING-COPILOT multiple times as needed
58+
4859
## Related Resources
4960

5061
- [Copilot Instructions](../copilot-instructions.md) - Main AI agent instructions

.github/issue-responses/customer-communication-guidelines.md

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,116 @@ If you believe this is an MSAL Android issue, please provide additional details
369369

370370
---
371371

372+
## New Features for AI Agents (2025)
373+
374+
> **Note:** For detailed implementation guidelines on version-aware triage, label transparency, and PING-COPILOT, see [`.github/copilot-instructions.md`](../copilot-instructions.md) sections 6.1-6.3. This section provides communication templates and examples.
375+
376+
### Version-Aware Triage
377+
378+
**Unsupported Version Response Template:**
379+
380+
```markdown
381+
⚠️ **Unsupported MSAL Version Detected**
382+
383+
I've applied the `very-old-msal` label because version **X.X.X** (released [DATE]) is more than 1.5 years old and is no longer supported.
384+
385+
**Microsoft MSAL Android supports versions released within the last 1.5 years.**
386+
387+
**Required Action - Please Upgrade:**
388+
1. Update to the latest version - see [releases](https://github.com/AzureAD/microsoft-authentication-library-for-android/releases)
389+
2. Review the [migration guide](https://github.com/AzureAD/microsoft-authentication-library-for-android#migration) for breaking changes
390+
3. Test your app with the new version
391+
4. If the issue persists with the latest version, please reopen with updated details
392+
393+
**To upgrade, update your build.gradle:**
394+
```gradle
395+
implementation "com.microsoft.identity.client:msal:8.+"
396+
```
397+
We recommend using `8.+` for automatic patch updates within the 8.x series.
398+
```
399+
400+
### Label Transparency
401+
402+
**Always explain why labels are applied.** Include a brief explanation in your response.
403+
404+
**Label Explanation Templates:**
405+
406+
| Label | Explanation Template |
407+
|-------|---------------------|
408+
| `bug` | I've labeled this as a `bug` because [crash/unexpected behavior/documented functionality not working as expected] |
409+
| `very-old-msal` | I've applied the `very-old-msal` label because your version (X.X.X) was released on [DATE], which is more than 1.5 years ago and is no longer supported |
410+
| `triage-issue` | I've added the `triage-issue` label because this issue [requires code investigation/may need a library fix/appears to be a potential bug in MSAL core] |
411+
| `needs-more-info` | I've added the `needs-more-info` label because we need [specific information] to diagnose the issue |
412+
| `question` | I've labeled this as a `question` because you're asking about [how to implement X/whether Y is supported] |
413+
| `feature-request` | I've labeled this as a `feature-request` because you're proposing [new functionality/enhancement] |
414+
415+
**When to Use `triage-issue` Label:**
416+
417+
✅ Apply when:
418+
- Issue may require a code fix in MSAL library itself
419+
- Problem cannot be resolved through configuration changes
420+
- Evidence of library bug (e.g., null pointer in MSAL code)
421+
- Requires investigation of MSAL internals
422+
- Affects public SDK API contract
423+
424+
❌ Do NOT apply for:
425+
- User configuration errors
426+
- API misuse (deprecated methods, wrong patterns)
427+
- Issues resolvable with documentation
428+
- Questions about MSAL usage
429+
- Issues in user application code
430+
431+
**Example with Label Transparency:**
432+
```markdown
433+
Thank you for reporting this issue!
434+
435+
**Labels Applied:**
436+
- `bug`: This appears to be a bug because silent token acquisition is failing even with valid cached tokens
437+
- `triage-issue`: I've added this label because the issue may require investigation of MSAL's cache retrieval logic by our engineering team
438+
- `needs-more-info`: We need your complete stack trace and verbose logs to fully diagnose
439+
440+
To help us investigate...
441+
```
442+
443+
### PING-COPILOT Follow-Up Mechanism
444+
445+
> **Note:** For detailed implementation guidelines, see [`.github/copilot-instructions.md`](../copilot-instructions.md) section 6.3. This section provides communication templates.
446+
447+
**Special Phrase:** `PING-COPILOT: <question or request>`
448+
449+
**Include in Every Initial Response:**
450+
```markdown
451+
---
452+
453+
**Need further assistance?** You can trigger a follow-up analysis by commenting:
454+
```
455+
PING-COPILOT: <your question or request>
456+
```
457+
458+
The Copilot agent will analyze your comment and provide updated guidance based on the full issue context.
459+
```
460+
461+
**Follow-Up Response Template:**
462+
```markdown
463+
Thanks for the follow-up! I see you've [described what user did/asked].
464+
465+
Based on your original issue and this update, [provide contextual guidance].
466+
467+
[Specific answer to their question with code examples or steps]
468+
469+
---
470+
471+
**Need more help?** You can trigger another follow-up by commenting:
472+
```
473+
PING-COPILOT: <your question>
474+
```
475+
476+
---
477+
*Automated follow-up response. A team member will review the full conversation.*
478+
```
479+
480+
---
481+
372482
## Issue Triage Guidelines
373483

374484
### Priority Levels

0 commit comments

Comments
 (0)