Skip to content

Claude Code. Any Model. The most powerful AI coding agent now speaks every language.

fix(meta-muse-code): send no device-code poll after the code expires

Jack Rudenko267a5feb54f0
diff --git a/packages/cli/src/auth/meta-muse-oauth.ts b/packages/cli/src/auth/meta-muse-oauth.ts
index 3180132c..75b7587d 100644
--- a/packages/cli/src/auth/meta-muse-oauth.ts
+++ b/packages/cli/src/auth/meta-muse-oauth.ts
@@ -238,6 +238,10 @@ export class MuseCodeOAuth {
while (this.deps.now() < deadline) {
await this.deps.sleep(intervalMs);
+ // Re-checked AFTER the sleep: the guard above ran one interval ago, so
+ // without this the last poll went out at exactly `expires_in` with a
+ // device code that had already expired (RFC 8628).
+ if (this.deps.now() >= deadline) break;
let response: Response;
let answer: TokenAnswer;
let text: string;