Commit 0911974
committed
wip(github): partial device flow implementation (billing display issue remains)
**Problem:**
GitHub Copilot model picker shows "-" for all models instead of cost multipliers.
Billing data only accessible with GitHub user tokens, not OAuth app tokens.
**What Was Done:**
- Created CopilotTokenStore for GitHub user token storage
- Integrated with existing GitHubDeviceFlowService
- Updated GitHubCopilotProvider to use stored tokens
- Added token loading on app startup
- Attempted copilot_internal/v2/token exchange (404 - endpoint unavailable)
- Simplified to direct GitHub user token usage
**What Works:**
✅ Device flow sign-in completes successfully
✅ GitHub user token obtained and stored
✅ Token persists across app restarts
✅ API calls use device flow token
✅ Build passes with no errors
**What's Broken:**
❌ Billing data NOT appearing in model picker UI
❌ API returns billing data (confirmed via curl) but UI doesn't show it
❌ Cause unknown - needs investigation
**Files Changed:**
- NEW: Sources/APIFramework/CopilotTokenStore.swift - Token storage/retrieval
- MODIFIED: Sources/APIFramework/Providers.swift - Added getAPIKey() helper
- MODIFIED: Sources/UserInterface/Components/GitHubDeviceFlowSheet.swift - Stores token
- MODIFIED: Sources/SAM/AppDelegate.swift - Loads tokens on startup
- MODIFIED: Sources/ConfigurationSystem/GitHubDeviceFlow.swift - Added exchange (fails)
- MODIFIED: Sources/APIFramework/ModelListManager.swift - From earlier session
- MODIFIED: Sources/APIFramework/EndpointManager.swift - From earlier session
- MODIFIED: Sources/UserInterface/Components/ModelPickerView.swift - From earlier session
**Storage:**
- Tokens: ~/Library/Application Support/SAM/copilot_tokens.json
- Billing cache: ~/.config/sam/github_copilot_billing_cache.json
**Next Steps:**
1. Investigate why billing data not appearing in UI
2. Simplify CopilotTokenStore (remove failed token exchange)
3. Fix log messages (currently misleading)
4. Test end-to-end flow
**Handoff:**
Complete context in ai-assisted/2026-01-08/0842/CONTINUATION_PROMPT.md
**Notes:**
- This is INCOMPLETE implementation
- Billing data confirmed working via manual API tests
- Issue is in UI display, not API communication
- Related: Morning session created ModelListManager, identified root cause1 parent b168679 commit 0911974
9 files changed
Lines changed: 553 additions & 269 deletions
File tree
- Sources
- APIFramework
- ConfigurationSystem
- SAM
- UserInterface
- Components
- Preferences
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
105 | 114 | | |
106 | 115 | | |
107 | 116 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| 60 | + | |
60 | 61 | | |
61 | 62 | | |
62 | | - | |
| 63 | + | |
63 | 64 | | |
64 | | - | |
| 65 | + | |
| 66 | + | |
65 | 67 | | |
66 | 68 | | |
67 | 69 | | |
| |||
127 | 129 | | |
128 | 130 | | |
129 | 131 | | |
| 132 | + | |
130 | 133 | | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
131 | 137 | | |
132 | 138 | | |
133 | 139 | | |
| |||
136 | 142 | | |
137 | 143 | | |
138 | 144 | | |
| 145 | + | |
139 | 146 | | |
140 | 147 | | |
141 | 148 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
714 | 714 | | |
715 | 715 | | |
716 | 716 | | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
717 | 738 | | |
718 | 739 | | |
719 | 740 | | |
| |||
726 | 747 | | |
727 | 748 | | |
728 | 749 | | |
729 | | - | |
730 | | - | |
731 | | - | |
| 750 | + | |
732 | 751 | | |
733 | 752 | | |
734 | 753 | | |
| |||
790 | 809 | | |
791 | 810 | | |
792 | 811 | | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
793 | 817 | | |
794 | 818 | | |
795 | 819 | | |
| |||
798 | 822 | | |
799 | 823 | | |
800 | 824 | | |
801 | | - | |
| 825 | + | |
802 | 826 | | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
803 | 832 | | |
804 | 833 | | |
805 | 834 | | |
| |||
841 | 870 | | |
842 | 871 | | |
843 | 872 | | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
844 | 880 | | |
845 | 881 | | |
846 | 882 | | |
| |||
998 | 1034 | | |
999 | 1035 | | |
1000 | 1036 | | |
1001 | | - | |
1002 | | - | |
1003 | | - | |
| 1037 | + | |
1004 | 1038 | | |
1005 | 1039 | | |
1006 | 1040 | | |
| |||
1189 | 1223 | | |
1190 | 1224 | | |
1191 | 1225 | | |
1192 | | - | |
1193 | | - | |
1194 | | - | |
| 1226 | + | |
1195 | 1227 | | |
1196 | 1228 | | |
1197 | 1229 | | |
| |||
1854 | 1886 | | |
1855 | 1887 | | |
1856 | 1888 | | |
1857 | | - | |
1858 | | - | |
1859 | | - | |
| 1889 | + | |
1860 | 1890 | | |
1861 | 1891 | | |
1862 | 1892 | | |
| |||
2338 | 2368 | | |
2339 | 2369 | | |
2340 | 2370 | | |
2341 | | - | |
2342 | | - | |
2343 | | - | |
2344 | | - | |
2345 | | - | |
| 2371 | + | |
| 2372 | + | |
2346 | 2373 | | |
2347 | 2374 | | |
2348 | 2375 | | |
| |||
0 commit comments