The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 07:15 UTC
fix(server): a gh auth token timeout no longer asks you to check gh auth status (#38775)
Co-authored-by: Julius Marminge <julius0216@outlook.com>
Shadman Taqi committed
Nov 19, 2026 at 09:32 UTC
888fd3f3f9a249b21a1920fb4f0813b38d987467
3 files changed
+21
-4
packages/source-control-github/src/server/GitHubCredentials.ts
+17
-2
@@ -81,11 +81,21 @@ export class GitHubCliFailedError extends Schema.TaggedError<GitHubCliFailedErro
81
}
82
}
83
84
+export class GitHubCliTimeoutError extends Schema.TaggedError<GitHubCliTimeoutError>()(
85
+ "GitHubCliTimeoutError",
86
+ { host: Schema.String, timeoutMs: Schema.Number, cause: Schema.Defect() },
87
+) {
88
+ override get message(): string {
89
+ return `The GitHub CLI did not hand over a credential for ${this.host} within ${this.timeoutMs / 1000} seconds. The server may be overloaded; try again.`;
90
+ }
91
+}
92
+
93
export type GitHubCredentialUnavailableError =
94
| GitHubCliMissingError
95
| GitHubNotSignedInError
96
| GitHubHostDisabledError
97
| GitHubCliFailedError
98
+ | GitHubCliTimeoutError
99
| SettingsSecretUnresolvedError;
100
101
export class GitHubCredentials extends Context.Service<
@@ -177,7 +187,9 @@ export const make = Effect.gen(function* () {
187
: // gh exits non-zero with "no oauth token" when it has no login for the host.
188
error._tag === "VcsProcessExitError"
189
? new GitHubNotSignedInError({ host, ...(account === undefined ? {} : { account }) })
180
- : new GitHubCliFailedError({ host, cause: error }),
190
+ : error._tag === "VcsProcessTimeoutError"
191
+ ? new GitHubCliTimeoutError({ host, timeoutMs: error.timeoutMs, cause: error })
192
+ : new GitHubCliFailedError({ host, cause: error }),
193
),
194
Effect.map((output) => output.stdout.trim()),
195
Effect.filterOrFail(
@@ -239,7 +251,10 @@ export const make = Effect.gen(function* () {
251
Exit.isSuccess(exit)
252
? TOKEN_TTL
253
: Exit.findErrorOption(exit).pipe(
242
- Option.exists((error) => error._tag === "GitHubCliFailedError"),
254
+ Option.exists(
255
+ (error) =>
256
+ error._tag === "GitHubCliFailedError" || error._tag === "GitHubCliTimeoutError",
257
+ ),
258
)
259
? Duration.zero
260
: MISSING_TTL,
packages/source-control-github/src/server/GitHubRest.test.ts
+3
-2
@@ -614,12 +614,13 @@ describe("GitHubCredentials", () => {
614
Layer.provide(Layer.succeed(HttpClient.HttpClient, unexpectedHttp)),
615
);
616
617
- it.effect("does not cache a gh failure that is not about signing in", () => {
617
+ it.effect("reports a gh timeout as a timeout and does not cache it", () => {
618
let calls = 0;
619
return Effect.gen(function* () {
620
const credentials = yield* GitHubCredentials.GitHubCredentials;
621
const first = yield* Effect.flip(credentials.get("github.com"));
622
- expect(first._tag).toBe("GitHubCliFailedError");
622
+ expect(first._tag).toBe("GitHubCliTimeoutError");
623
+ expect(first.message).not.toContain("gh auth status");
624
expect((yield* credentials.get("github.com")).source).toBe("gh");
625
expect(calls).toBe(2);
626
}).pipe(
packages/source-control-github/src/server/GitHubSourceControlProvider.ts
+1
@@ -398,6 +398,7 @@ function fromGitHubApiError(
398
case "GitHubApiNotFoundError":
399
return failure(notFound, error);
400
case "GitHubCliFailedError":
401
+ case "GitHubCliTimeoutError":
402
case "GitHubAppSessionError":
403
case "GitHubApiResponseError":
404
case "GitHubApiRequestError":