You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(atlas): keep sessions through transient 403s, fix wallet gate edge cases, warn on stranded legacy config (#67)
- syncServices: only a 401 clears the session now. 403s also come from
WAFs and rate limiters; treating them as revocation silently signed
users out mid-session, which presented as the Atlas connection
randomly dropping.
- wallet gate: getBalance returns null (not -1) when the balance can't
be determined, so an overdraft of exactly -$1 no longer reads as
'unavailable'; the gate blocks on any verified balance <= 0 instead of
exactly 0 (negative wallets used to sail through); blocking drops the
30s balance cache so a top-up is visible on the next attempt. The wire
format still encodes unknown as -1.
- global: when both the legacy synsc dir and the new config dir exist,
say the legacy one is ignored instead of silently stranding the auth
and config inside it.
// Pre-flight wallet check for managed-proxy calls only. Block ONLY on a
73
-
// VERIFIED empty wallet (balance === 0). If the balance can't be verified
74
-
// (-1: no/expired Atlas session or a transient error), do NOT hard-block —
73
+
// VERIFIED empty or overdrafted wallet. If the balance can't be verified
74
+
// (null: no/expired Atlas session or a transient error), do NOT hard-block —
75
75
// the managed proxy is the billing authority and returns 402 if actually
76
76
// out of credits. Hard-blocking here strands a user whose session lapsed.
77
77
if(requiresWalletBalance(credentialSource)){
78
78
constbalance=awaitOpenScience.getBalance()
79
-
if(balance===0){
79
+
if(balance!==null&&balance<=0){
80
+
// Drop the 30s cache so a top-up is visible on the next
81
+
// attempt instead of blocking until the TTL expires.
82
+
OpenScience.invalidateBalance()
80
83
thrownewError(
81
84
"Your Atlas wallet is empty. Top up at app.syntheticsciences.ai/cli, or switch LLM spend to BYOK in Settings → Spend — BYOK uses your own key and is never billed.",
0 commit comments