From b1d20fb38cd609070c14134e94704c16d2862045 Mon Sep 17 00:00:00 2001
From: "detail-app[bot]" <180357370+detail-app[bot]@users.noreply.github.com>
Date: Sun, 6 Sep 2026 02:26:31 +0000
Subject: [PATCH 1/3] fix(git-auth): fall back to still-valid token on
near-expiry refresh failure
---
CHANGELOG.md | 3 +
crates/pcb-diode-api/src/auth.rs | 5 +-
crates/pcb-diode-api/src/git_auth.rs | 52 +++++++++--
crates/pcbc/tests/auth_git.rs | 135 ++++++++++++++++++++++++++-
4 files changed, 186 insertions(+), 9 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index cdd24b2c9..e0cef6f8f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -57,6 +57,9 @@ and this project adheres to Semantic Versioning (https://semver.org/spec/v2.0.0.
- Support opaque service-account client IDs and proper OAuth Basic encoding.
- Allow off-page schematic placement and avoid existing text and graphics.
+- Fall back to the still-valid access token in `pb auth git` when a transient
+ OAuth refresh failure lands in the final minutes of a token's life, instead
+ of aborting Git operations with a misleading re-login prompt.
## [0.4.49] - 2026-09-04
diff --git a/crates/pcb-diode-api/src/auth.rs b/crates/pcb-diode-api/src/auth.rs
index 9f0e43d16..6044b623c 100644
--- a/crates/pcb-diode-api/src/auth.rs
+++ b/crates/pcb-diode-api/src/auth.rs
@@ -17,7 +17,8 @@ use crate::WorkspaceContext;
mod service_account;
-const NOT_AUTHENTICATED_MESSAGE: &str = "Not authenticated. Run `pcb auth login` to authenticate.";
+pub(crate) const NOT_AUTHENTICATED_MESSAGE: &str =
+ "Not authenticated. Run `pcb auth login` to authenticate.";
const DIODE_API_AUTH_NONE: &str = "none";
#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -118,7 +119,7 @@ fn load_auth(ctx: &WorkspaceContext) -> Result