fix(copilot): keep verified identity ahead of legacy names - #3460
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 6, 2026, 11:46 PM ET / September 7, 2026, 03:46 UTC. ClawSweeper reviewWhat this changesThe PR prevents Copilot reauthentication from replacing a legacy account whose resolved GitHub ID differs, with focused regression tests and documentation. Merge readiness✅ Ready for maintainer review This PR addresses a source-confirmed defect still present on main and in v0.56.7. No introduced correctness defect was found; the related Enterprise-routing PR addresses separate behavior. Priority: P2 Review scores
Verification
How this fits togetherCodexBar matches a newly authenticated GitHub identity against saved Copilot accounts before updating credentials or adding an account. The saved token then feeds Copilot usage requests. flowchart TD
A[GitHub login and token] --> B[Resolve GitHub identity]
C[Saved Copilot accounts] --> D[Match account identity]
B --> D
D --> E[Update matching account or add account]
E --> F[Copilot usage requests]
Before mergeNone. Agent review detailsSecurityNone. Review metrics
Technical reviewBest possible solution: Keep verified numeric identity authoritative for token-resolved legacy accounts while preserving unresolved-token recovery and existing identifier migration. Do we have a high-confidence way to reproduce the issue? Yes, from source: on main, a legacy account resolving to a different ID can still match by login or display label and be selected for credential replacement. This review did not execute the scenario. Is this the best way to solve the issue? Yes. Tightening the existing matcher is a focused repair, preserves established recovery paths, and avoids changing storage or Enterprise routing. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 49f2dc916919. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
A legacy Copilot token account can resolve to a different stable GitHub user ID and still be selected for reauthentication because its login or display label matches. The login flow then updates that saved account with the new token.
Keep resolved stable IDs authoritative. Search all token-resolved legacy accounts before accepting a label fallback, and retain that fallback only for accounts whose identity could not be resolved. The single-pass matcher removes one production line and preserves existing stable-ID and legacy external-login migration paths.
This narrower defect was found while investigating #3341; it does not resolve that PR's Enterprise-host routing scope.
Validation:
make checkpassed with zero violations. Isolated P2 autoreview found no actionable findings.Tests use injected synthetic identities and token stores; no real account requests or credentials were used. Changelog and provider documentation describe the identity precedence.