Commit 39d017d
committed
fix(github_graphql): reuse ApiClient transport for GraphQL to enable token refresh
Replace oauth2.StaticTokenSource-based HTTP client with the underlying http.Client from ApiAsyncClient.
Previously, the GraphQL client constructed its own HTTP client using StaticTokenSource, which froze the access token at task start time. This caused GitHub App installation tokens (which expire after ~1 hour) to become invalid during long-running pipelines, leading to persistent 401 errors.
Now, the GraphQL client reuses apiClient.GetClient(), which is already configured with RefreshRoundTripper and TokenProvider. This enables automatic token refresh on 401 responses, aligning GraphQL behavior with the REST client.
Design decisions:
- Reuse transport layer instead of duplicating authentication logic to ensure consistency across REST and GraphQL clients.
- Avoid StaticTokenSource, as it prevents token refresh and breaks long-running pipelines.
- Leverage existing RefreshRoundTripper for transparent token rotation without modifying GraphQL query logic.
- Keep protocol-specific logic (GraphQL vs REST) separate while sharing the underlying HTTP transport.
This ensures GraphQL pipelines using GitHub App authentication can run beyond token expiry without failure.
Fixes #8788 (bug 2)1 parent f1d24c1 commit 39d017d
1 file changed
Lines changed: 2 additions & 32 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | 23 | | |
25 | 24 | | |
26 | | - | |
27 | 25 | | |
28 | 26 | | |
29 | 27 | | |
| |||
39 | 37 | | |
40 | 38 | | |
41 | 39 | | |
42 | | - | |
43 | 40 | | |
44 | 41 | | |
45 | 42 | | |
| |||
180 | 177 | | |
181 | 178 | | |
182 | 179 | | |
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 | 180 | | |
211 | 181 | | |
212 | 182 | | |
213 | 183 | | |
214 | | - | |
215 | 184 | | |
216 | 185 | | |
217 | 186 | | |
218 | 187 | | |
219 | 188 | | |
220 | 189 | | |
221 | | - | |
| 190 | + | |
| 191 | + | |
222 | 192 | | |
223 | 193 | | |
224 | 194 | | |
| |||
0 commit comments