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, 03:37 UTC
fix(gitcafe): a timed-out cafe credential check says it timed out (#39533)
tiliakoos committed
Nov 21, 2026 at 01:29 UTC
a04bca5bcf369b9d25a41b6fa1d00d38734a3047
2 files changed
+41
-3
packages/source-control-gitcafe/src/server/GitCafeCredentials.test.ts
+24
-1
@@ -1,5 +1,5 @@
1
import { assert, describe, it } from "@effect/vitest";
2
-import { SecretProviderId } from "@t3tools/contracts";
2
+import { SecretProviderId, VcsProcessTimeoutError } from "@t3tools/contracts";
3
import * as Effect from "effect/Effect";
4
import * as Layer from "effect/Layer";
5
import * as Redacted from "effect/Redacted";
@@ -144,4 +144,27 @@ describe("GitCafeCredentials", () => {
144
assert.strictEqual(calls.length, 2);
145
}).pipe(Effect.provide(layer));
146
});
147
+
148
+ it.effect("reports a cafe timeout as a timeout and does not cache it", () => {
149
+ const { layer, calls } = harness((input) =>
150
+ calls.length === 1
151
+ ? Effect.fail(
152
+ new VcsProcessTimeoutError({
153
+ operation: input.operation,
154
+ command: input.command,
155
+ cwd: input.cwd,
156
+ timeoutMs: 10_000,
157
+ }),
158
+ )
159
+ : Effect.succeed(processOutput("password=gct_1\n")),
160
+ );
161
+ return Effect.gen(function* () {
162
+ const credentials = yield* GitCafeCredentials.GitCafeCredentials;
163
+ const error = yield* Effect.flip(credentials.get("git.cafe"));
164
+ assert.strictEqual(error._tag, "GitCafeCliTimeoutError");
165
+ assert.notInclude(error.message, "cafe auth status");
166
+ assert.strictEqual((yield* credentials.get("git.cafe")).source, "cafe");
167
+ assert.strictEqual(calls.length, 2);
168
+ }).pipe(Effect.provide(layer));
169
+ });
170
});
packages/source-control-gitcafe/src/server/GitCafeCredentials.ts
+17
-2
@@ -55,10 +55,20 @@ export class GitCafeCliFailedError extends Schema.TaggedError<GitCafeCliFailedEr
55
}
56
}
57
58
+export class GitCafeCliTimeoutError extends Schema.TaggedError<GitCafeCliTimeoutError>()(
59
+ "GitCafeCliTimeoutError",
60
+ { host: Schema.String, timeoutMs: Schema.Number, cause: Schema.Defect() },
61
+) {
62
+ override get message(): string {
63
+ return `The GitCafe CLI did not hand over a credential for ${this.host} within ${this.timeoutMs / 1000} seconds. The server may be overloaded; try again.`;
64
+ }
65
+}
66
+
67
export type GitCafeCredentialUnavailableError =
68
| GitCafeCliMissingError
69
| GitCafeNotSignedInError
70
| GitCafeCliFailedError
71
+ | GitCafeCliTimeoutError
72
| SettingsSecretUnresolvedError;
73
74
export class GitCafeCredentials extends Context.Service<
@@ -123,7 +133,9 @@ export const make = Effect.gen(function* () {
133
? new GitCafeCliMissingError({ host })
134
: error._tag === "VcsProcessExitError"
135
? new GitCafeNotSignedInError({ host })
126
- : new GitCafeCliFailedError({ host, cause: error }),
136
+ : error._tag === "VcsProcessTimeoutError"
137
+ ? new GitCafeCliTimeoutError({ host, timeoutMs: error.timeoutMs, cause: error })
138
+ : new GitCafeCliFailedError({ host, cause: error }),
139
),
140
Effect.map((output) => credentialPassword(output.stdout)),
141
Effect.filterOrFail(
@@ -164,7 +176,10 @@ export const make = Effect.gen(function* () {
176
Exit.isSuccess(exit)
177
? TOKEN_TTL
178
: Exit.findErrorOption(exit).pipe(
167
- Option.exists((error) => error._tag === "GitCafeCliFailedError"),
179
+ Option.exists(
180
+ (error) =>
181
+ error._tag === "GitCafeCliFailedError" || error._tag === "GitCafeCliTimeoutError",
182
+ ),
183
)
184
? Duration.zero
185
: MISSING_TTL,