johns-harness 2026.10.22 → 2026.10.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 2026.10.23
4
+
5
+ ### Fixed
6
+ - Claude subscription credentials stay current after OAuth token rotation. A long-running gateway no longer retries a spent token from its startup snapshot and silently serves the request with the paid API key. Existing sessions use the current subscription credential without a reload or a new session.
7
+ - `/status` and `session_status` explain subscription-to-API fallback, including model unavailable, token refresh failure, authentication, quota and cooldown. The actual served profile stays visible, and the fallback annotation clears after subscription recovery. Explicit API-key selections remain explicit.
8
+ - Anthropic credential refresh rereads the auth store under its lock. Local-agent account precedence, resolved API SecretRefs, Codex ownership, subscription-zero accounting and the existing fallback policy are preserved.
9
+
3
10
  ## 2026.10.22
4
11
 
5
12
  ### Fixed
@@ -0,0 +1,62 @@
1
+ // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92
2
+ // OAuth generations rotate independently of SecretRef activation. Never log credential material.
3
+ import path from 'node:path';
4
+ import { readAuthStore } from './auth-store-transactions.js';
5
+
6
+ const isClaudeOAuth = c => c?.provider === 'anthropic' && c.type === 'oauth';
7
+ export function readCurrentAnthropicAuth({ store, mainAgentDir, agentDir }) {
8
+ const ids = Object.keys(store.profiles ?? {}).filter(id => isClaudeOAuth(store.profiles[id]));
9
+ if (!ids.length) return store;
10
+ const mainPath = path.join(mainAgentDir, 'auth-profiles.json');
11
+ const localPath = path.join(agentDir ?? mainAgentDir, 'auth-profiles.json');
12
+ const main = readAuthStore(mainPath);
13
+ const local = localPath === mainPath ? main : readAuthStore(localPath);
14
+ for (const id of ids) {
15
+ // Local accounts stay local. Deletion, logout or a type change must not resurrect a snapshot.
16
+ const owner = Object.hasOwn(local.profiles, id) ? local : main;
17
+ const current = owner.profiles[id];
18
+ if (isClaudeOAuth(current)) store.profiles[id] = structuredClone(current);
19
+ else delete store.profiles[id];
20
+ store.usageStats ??= {};
21
+ if (owner.usageStats?.[id]) store.usageStats[id] = structuredClone(owner.usageStats[id]);
22
+ else delete store.usageStats[id];
23
+ }
24
+ // New logins still activate through Family 89. API SecretRefs and Codex ownership are untouched.
25
+ return store;
26
+ }
27
+
28
+ const REASONS = Object.freeze({
29
+ auth: 'subscription authentication rejected',
30
+ billing: 'subscription quota or billing rejected',
31
+ rate_limit: 'subscription rate limited',
32
+ overloaded: 'subscription endpoint overloaded',
33
+ timeout: 'subscription request timed out',
34
+ model_not_found: 'model unavailable on subscription',
35
+ cooldown: 'subscription in cooldown',
36
+ credential_unavailable: 'subscription credential unavailable',
37
+ oauth_refresh_failed: 'subscription token refresh failed',
38
+ unknown: 'subscription request failed'
39
+ });
40
+ export function createSubscriptionAuthTracker({ provider, model, store, preferredProfileId, lockedProfileId }) {
41
+ const requested = isClaudeOAuth(store.profiles?.[preferredProfileId]) ? preferredProfileId : 'anthropic:subscription';
42
+ const enabled = provider === 'anthropic' && isClaudeOAuth(store.profiles?.[requested]) && (!lockedProfileId || lockedProfileId === requested);
43
+ let reason;
44
+ return {
45
+ failed(profileId, value) {
46
+ if (!enabled || profileId !== requested) return;
47
+ // Whitelisted categories only: endpoint bodies can contain secrets or untrusted text.
48
+ reason = Object.hasOwn(REASONS, value) ? value : 'unknown';
49
+ },
50
+ result(profileId) {
51
+ if (!enabled || profileId === requested || store.profiles?.[profileId]?.type !== 'api_key') return null;
52
+ const stats = store.usageStats?.[requested];
53
+ const cooled = Math.max(stats?.cooldownUntil ?? 0, stats?.disabledUntil ?? 0) > Date.now();
54
+ return { fromProfileId: requested, toProfileId: profileId, model, reason: reason ?? (cooled ? 'cooldown' : 'credential_unavailable') };
55
+ }
56
+ };
57
+ }
58
+ export function formatAuthProfileFallback(entry, profileId) {
59
+ const fallback = entry?.authProfileFallback;
60
+ if (!fallback || fallback.toProfileId !== profileId || !Object.hasOwn(REASONS, fallback.reason)) return '';
61
+ return ` [API fallback: ${REASONS[fallback.reason]}]`;
62
+ }
@@ -1,3 +1,4 @@
1
+ import { readCurrentAnthropicAuth } from "./anthropic-auth-runtime.js"; // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92
1
2
  import { claudeSubscriptionOrder } from "./subscription-login.js"; // JOHNNESS_PATCH_SUBSCRIPTION_LOGIN_86
2
3
  // JOHNNESS_PATCH_CATALOG_REFRESH_65
3
4
  import { mergeShippedCatalog65 } from "./catalog-refresh.js";
@@ -4235,8 +4236,10 @@ function codexOwnershipContext(agentDir) {
4235
4236
  log: (event) => log$8.info("Codex OAuth ownership", event)
4236
4237
  };
4237
4238
  }
4239
+ // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92
4238
4240
  function readCodexOwnedAuthStore(agentDir, store) {
4239
- return readManagedCodexStore({ ...codexOwnershipContext(agentDir), store });
4241
+ const context = codexOwnershipContext(agentDir);
4242
+ return readCurrentAnthropicAuth({ ...context, store: readManagedCodexStore({ ...context, store }) });
4240
4243
  }
4241
4244
  function sanitizeAuthProfileCredential(credential) {
4242
4245
  const sanitized = { ...credential };
@@ -16462,7 +16465,7 @@ async function refreshUnmanagedOAuthTokenWithLock(params) {
16462
16465
  const authPath = resolveAuthStorePath(params.agentDir);
16463
16466
  fs.mkdirSync(path.dirname(authPath), { recursive: true, mode: 448 });
16464
16467
  return await withFileLock(authPath, AUTH_STORE_LOCK_OPTIONS, async () => {
16465
- const store = ensureAuthProfileStore(params.agentDir);
16468
+ const store = loadAuthProfileStoreForRuntime(params.agentDir, { allowKeychainPrompt: false }); // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92: reread under lock
16466
16469
  const cred = store.profiles[params.profileId];
16467
16470
  if (cred?.provider === "openai-codex") throw new Error("Auth profile changed to Codex; resolve again through its owner");
16468
16471
  if (!cred || cred.type !== "oauth") return null;
@@ -1,3 +1,4 @@
1
+ import { createSubscriptionAuthTracker, formatAuthProfileFallback } from "./anthropic-auth-runtime.js"; // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92
1
2
  import { normalizeBillingUsage, readLatestBillingUsage, formatBillingCost } from "./usage-billing.js"; // JOHNNESS_PATCH_USAGE_BILLING_91 dist/compact-B247y5Qt.js
2
3
  import { importOptional66 } from "./optional-module.js";
3
4
  const JOHNNESS_PATCH_SLIM_TREE_66 = true;
@@ -18434,6 +18435,7 @@ async function runEmbeddedPiAgent(params) {
18434
18435
  });
18435
18436
  if (lockedProfileId && !profileOrder.includes(lockedProfileId)) throw new Error(`Auth profile "${lockedProfileId}" is not configured for ${provider}.`);
18436
18437
  const profileCandidates = lockedProfileId ? [lockedProfileId] : profileOrder.length > 0 ? profileOrder : [void 0];
18438
+ const subscriptionAuth = createSubscriptionAuthTracker({ provider, model: modelId, store: authStore, preferredProfileId, lockedProfileId }); // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92
18437
18439
  let profileIndex = 0;
18438
18440
  const initialThinkLevel = params.thinkLevel ?? "off";
18439
18441
  let thinkLevel = initialThinkLevel;
@@ -18565,7 +18567,8 @@ async function runEmbeddedPiAgent(params) {
18565
18567
  } else authStorage.setRuntimeApiKey(model.provider, apiKeyInfo.apiKey);
18566
18568
  lastProfileId = apiKeyInfo.profileId;
18567
18569
  };
18568
- const advanceAuthProfile = async () => {
18570
+ const advanceAuthProfile = async (reason) => {
18571
+ subscriptionAuth.failed(profileCandidates[profileIndex], reason);
18569
18572
  if (lockedProfileId) return false;
18570
18573
  let nextIndex = profileIndex + 1;
18571
18574
  while (nextIndex < profileCandidates.length) {
@@ -18615,7 +18618,7 @@ async function runEmbeddedPiAgent(params) {
18615
18618
  allInCooldown: false,
18616
18619
  error: err
18617
18620
  });
18618
- if (!await advanceAuthProfile()) throwAuthProfileFailover({
18621
+ if (!await advanceAuthProfile(/refresh/i.test(String(err)) ? "oauth_refresh_failed" : "credential_unavailable")) throwAuthProfileFailover({
18619
18622
  allInCooldown: false,
18620
18623
  error: err
18621
18624
  });
@@ -18987,7 +18990,7 @@ async function runEmbeddedPiAgent(params) {
18987
18990
  reason: promptProfileFailureReason
18988
18991
  });
18989
18992
  const promptFailoverFailure = isFailoverErrorMessage(errorText);
18990
- if (promptFailoverFailure && promptFailoverReason !== "timeout" && await advanceAuthProfile()) {
18993
+ if (promptFailoverFailure && promptFailoverReason !== "timeout" && await advanceAuthProfile(promptFailoverReason)) {
18991
18994
  await maybeBackoffBeforeOverloadFailover(promptFailoverReason);
18992
18995
  continue;
18993
18996
  }
@@ -19050,7 +19053,7 @@ async function runEmbeddedPiAgent(params) {
19050
19053
  if (timedOut && !isProbeSession) log$16.warn(`Profile ${lastProfileId} timed out. Trying next account...`);
19051
19054
  if (cloudCodeAssistFormatError) log$16.warn(`Profile ${lastProfileId} hit Cloud Code Assist format error. Tool calls will be sanitized on retry.`);
19052
19055
  }
19053
- if (await advanceAuthProfile()) {
19056
+ if (await advanceAuthProfile(timedOut ? "timeout" : assistantFailoverReason)) {
19054
19057
  await maybeBackoffBeforeOverloadFailover(assistantFailoverReason);
19055
19058
  continue;
19056
19059
  }
@@ -19084,6 +19087,7 @@ async function runEmbeddedPiAgent(params) {
19084
19087
  lastCallUsage: lastCallUsage ?? void 0,
19085
19088
  promptTokens,
19086
19089
  compactionCount: autoCompactionCount > 0 ? autoCompactionCount : void 0,
19090
+ authProfileFallback: subscriptionAuth.result(lastProfileId), // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92
19087
19091
  authProfileId: lastProfileId // JOHNNESS_PATCH_SUBSCRIPTION_ACTIVATE_89: profile that served this turn
19088
19092
  };
19089
19093
  const payloads = buildEmbeddedRunPayloads({
@@ -35875,7 +35879,7 @@ function resolveModelAuthLabel(params) {
35875
35879
  });
35876
35880
  if (profile.type === "oauth") return `oauth${label ? ` (${label})` : ""}`;
35877
35881
  if (profile.type === "token") return `token${label ? ` (${label})` : ""}`;
35878
- return `api-key${label ? ` (${label})` : ""}`;
35882
+ return `api-key${label ? ` (${label})` : ""}${formatAuthProfileFallback(params.sessionEntry, profileId)}`;
35879
35883
  }
35880
35884
  const envKey = resolveEnvApiKey(providerKey);
35881
35885
  if (envKey?.apiKey) {
@@ -58610,6 +58614,7 @@ async function persistSessionUsageUpdate(params) {
58610
58614
  modelProvider: params.providerUsed ?? entry.modelProvider,
58611
58615
  model: params.modelUsed ?? entry.model,
58612
58616
  authProfileServed: params.authProfileServed ?? entry.authProfileServed, // JOHNNESS_PATCH_SUBSCRIPTION_ACTIVATE_89
58617
+ authProfileFallback: params.authProfileFallback ?? null, // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92
58613
58618
  contextTokens: resolvedContextTokens,
58614
58619
  systemPromptReport: params.systemPromptReport ?? entry.systemPromptReport,
58615
58620
  updatedAt: Date.now()
@@ -58890,6 +58895,7 @@ function createFollowupRunner(params) {
58890
58895
  modelUsed,
58891
58896
  providerUsed: fallbackProvider,
58892
58897
  authProfileServed: runResult.meta?.agentMeta?.authProfileId, // JOHNNESS_PATCH_SUBSCRIPTION_ACTIVATE_89
58898
+ authProfileFallback: runResult.meta?.agentMeta?.authProfileFallback, // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92
58893
58899
  contextTokensUsed,
58894
58900
  systemPromptReport: runResult.meta?.systemPromptReport,
58895
58901
  logLabel: "followup"
@@ -59228,6 +59234,7 @@ async function runReplyAgent(params) {
59228
59234
  modelUsed,
59229
59235
  providerUsed,
59230
59236
  authProfileServed: runResult.meta?.agentMeta?.authProfileId, // JOHNNESS_PATCH_SUBSCRIPTION_ACTIVATE_89
59237
+ authProfileFallback: runResult.meta?.agentMeta?.authProfileFallback, // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92
59231
59238
  contextTokensUsed,
59232
59239
  systemPromptReport: runResult.meta?.systemPromptReport,
59233
59240
  cliSessionId
@@ -72222,6 +72229,7 @@ async function updateSessionStoreAfterAgentRun(params) {
72222
72229
  model: modelUsed
72223
72230
  });
72224
72231
  if (result.meta.agentMeta?.authProfileId) next.authProfileServed = result.meta.agentMeta.authProfileId; // JOHNNESS_PATCH_SUBSCRIPTION_ACTIVATE_89
72232
+ next.authProfileFallback = result.meta.agentMeta?.authProfileFallback ?? null; // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92
72225
72233
  if (isCliProvider(providerUsed, cfg)) {
72226
72234
  const cliSessionId = result.meta.agentMeta?.sessionId?.trim();
72227
72235
  if (cliSessionId) setCliSessionId(next, providerUsed, cliSessionId);
@@ -1,3 +1,4 @@
1
+ import { readCurrentAnthropicAuth } from "./anthropic-auth-runtime.js"; // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92
1
2
  import { claudeSubscriptionOrder } from "./subscription-login.js"; // JOHNNESS_PATCH_SUBSCRIPTION_LOGIN_86
2
3
  // JOHNNESS_PATCH_CATALOG_REFRESH_65
3
4
  import { mergeShippedCatalog65 } from "./catalog-refresh.js";
@@ -563,8 +564,10 @@ function codexOwnershipContext(agentDir) {
563
564
  log: (event) => log$10.info("Codex OAuth ownership", event)
564
565
  };
565
566
  }
567
+ // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92
566
568
  function readCodexOwnedAuthStore(agentDir, store) {
567
- return readManagedCodexStore({ ...codexOwnershipContext(agentDir), store });
569
+ const context = codexOwnershipContext(agentDir);
570
+ return readCurrentAnthropicAuth({ ...context, store: readManagedCodexStore({ ...context, store }) });
568
571
  }
569
572
  function sanitizeAuthProfileCredential(credential) {
570
573
  const sanitized = { ...credential };
@@ -14677,7 +14680,7 @@ async function refreshUnmanagedOAuthTokenWithLock(params) {
14677
14680
  const authPath = resolveAuthStorePath(params.agentDir);
14678
14681
  syncFs.mkdirSync(path.dirname(authPath), { recursive: true, mode: 448 });
14679
14682
  return await withFileLock(authPath, AUTH_STORE_LOCK_OPTIONS, async () => {
14680
- const store = ensureAuthProfileStore(params.agentDir);
14683
+ const store = loadAuthProfileStoreForRuntime(params.agentDir, { allowKeychainPrompt: false }); // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92: reread under lock
14681
14684
  const cred = store.profiles[params.profileId];
14682
14685
  if (cred?.provider === "openai-codex") throw new Error("Auth profile changed to Codex; resolve again through its owner");
14683
14686
  if (!cred || cred.type !== "oauth") return null;
@@ -1,3 +1,4 @@
1
+ import { readCurrentAnthropicAuth } from "./anthropic-auth-runtime.js"; // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92
1
2
  import { claudeSubscriptionOrder } from "./subscription-login.js"; // JOHNNESS_PATCH_SUBSCRIPTION_LOGIN_86
2
3
  // JOHNNESS_PATCH_CATALOG_REFRESH_65
3
4
  import { mergeShippedCatalog65 } from "./catalog-refresh.js";
@@ -566,8 +567,10 @@ function codexOwnershipContext(agentDir) {
566
567
  log: (event) => log$9.info("Codex OAuth ownership", event)
567
568
  };
568
569
  }
570
+ // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92
569
571
  function readCodexOwnedAuthStore(agentDir, store) {
570
- return readManagedCodexStore({ ...codexOwnershipContext(agentDir), store });
572
+ const context = codexOwnershipContext(agentDir);
573
+ return readCurrentAnthropicAuth({ ...context, store: readManagedCodexStore({ ...context, store }) });
571
574
  }
572
575
  function sanitizeAuthProfileCredential(credential) {
573
576
  const sanitized = { ...credential };
@@ -14566,7 +14569,7 @@ async function refreshUnmanagedOAuthTokenWithLock(params) {
14566
14569
  const authPath = resolveAuthStorePath(params.agentDir);
14567
14570
  fs$1.mkdirSync(path.dirname(authPath), { recursive: true, mode: 448 });
14568
14571
  return await withFileLock(authPath, AUTH_STORE_LOCK_OPTIONS, async () => {
14569
- const store = ensureAuthProfileStore(params.agentDir);
14572
+ const store = loadAuthProfileStoreForRuntime(params.agentDir, { allowKeychainPrompt: false }); // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92: reread under lock
14570
14573
  const cred = store.profiles[params.profileId];
14571
14574
  if (cred?.provider === "openai-codex") throw new Error("Auth profile changed to Codex; resolve again through its owner");
14572
14575
  if (!cred || cred.type !== "oauth") return null;
@@ -1,3 +1,4 @@
1
+ import { readCurrentAnthropicAuth } from "./anthropic-auth-runtime.js"; // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92
1
2
  import { claudeSubscriptionOrder } from "./subscription-login.js"; // JOHNNESS_PATCH_SUBSCRIPTION_LOGIN_86
2
3
  // JOHNNESS_PATCH_CATALOG_REFRESH_65
3
4
  import { mergeShippedCatalog65 } from "./catalog-refresh.js";
@@ -457,8 +458,10 @@ function codexOwnershipContext(agentDir) {
457
458
  log: (event) => log$8.info("Codex OAuth ownership", event)
458
459
  };
459
460
  }
461
+ // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92
460
462
  function readCodexOwnedAuthStore(agentDir, store) {
461
- return readManagedCodexStore({ ...codexOwnershipContext(agentDir), store });
463
+ const context = codexOwnershipContext(agentDir);
464
+ return readCurrentAnthropicAuth({ ...context, store: readManagedCodexStore({ ...context, store }) });
462
465
  }
463
466
  function sanitizeAuthProfileCredential(credential) {
464
467
  const sanitized = { ...credential };
@@ -12939,7 +12942,7 @@ async function refreshUnmanagedOAuthTokenWithLock(params) {
12939
12942
  const authPath = resolveAuthStorePath(params.agentDir);
12940
12943
  fs.mkdirSync(path.dirname(authPath), { recursive: true, mode: 448 });
12941
12944
  return await withFileLock(authPath, AUTH_STORE_LOCK_OPTIONS, async () => {
12942
- const store = ensureAuthProfileStore(params.agentDir);
12945
+ const store = loadAuthProfileStoreForRuntime(params.agentDir, { allowKeychainPrompt: false }); // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92: reread under lock
12943
12946
  const cred = store.profiles[params.profileId];
12944
12947
  if (cred?.provider === "openai-codex") throw new Error("Auth profile changed to Codex; resolve again through its owner");
12945
12948
  if (!cred || cred.type !== "oauth") return null;
@@ -1,3 +1,4 @@
1
+ import { createSubscriptionAuthTracker, formatAuthProfileFallback } from "./anthropic-auth-runtime.js"; // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92
1
2
  import { normalizeBillingUsage, readLatestBillingUsage, formatBillingCost } from "./usage-billing.js"; // JOHNNESS_PATCH_USAGE_BILLING_91 dist/pi-embedded-C6ITuRXf.js
2
3
  import { importOptional66 } from "./optional-module.js";
3
4
  const JOHNNESS_PATCH_SLIM_TREE_66 = true;
@@ -27914,7 +27915,7 @@ function resolveModelAuthLabel(params) {
27914
27915
  });
27915
27916
  if (profile.type === "oauth") return `oauth${label ? ` (${label})` : ""}`;
27916
27917
  if (profile.type === "token") return `token${label ? ` (${label})` : ""}`;
27917
- return `api-key${label ? ` (${label})` : ""}`;
27918
+ return `api-key${label ? ` (${label})` : ""}${formatAuthProfileFallback(params.sessionEntry, profileId)}`;
27918
27919
  }
27919
27920
  const envKey = resolveEnvApiKey(providerKey);
27920
27921
  if (envKey?.apiKey) {
@@ -52865,6 +52866,7 @@ async function persistSessionUsageUpdate(params) {
52865
52866
  modelProvider: params.providerUsed ?? entry.modelProvider,
52866
52867
  model: params.modelUsed ?? entry.model,
52867
52868
  authProfileServed: params.authProfileServed ?? entry.authProfileServed, // JOHNNESS_PATCH_SUBSCRIPTION_ACTIVATE_89
52869
+ authProfileFallback: params.authProfileFallback ?? null, // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92
52868
52870
  contextTokens: resolvedContextTokens,
52869
52871
  systemPromptReport: params.systemPromptReport ?? entry.systemPromptReport,
52870
52872
  updatedAt: Date.now()
@@ -53145,6 +53147,7 @@ function createFollowupRunner(params) {
53145
53147
  modelUsed,
53146
53148
  providerUsed: fallbackProvider,
53147
53149
  authProfileServed: runResult.meta?.agentMeta?.authProfileId, // JOHNNESS_PATCH_SUBSCRIPTION_ACTIVATE_89
53150
+ authProfileFallback: runResult.meta?.agentMeta?.authProfileFallback, // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92
53148
53151
  contextTokensUsed,
53149
53152
  systemPromptReport: runResult.meta?.systemPromptReport,
53150
53153
  logLabel: "followup"
@@ -53610,6 +53613,7 @@ async function runReplyAgent(params) {
53610
53613
  modelUsed,
53611
53614
  providerUsed,
53612
53615
  authProfileServed: runResult.meta?.agentMeta?.authProfileId, // JOHNNESS_PATCH_SUBSCRIPTION_ACTIVATE_89
53616
+ authProfileFallback: runResult.meta?.agentMeta?.authProfileFallback, // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92
53613
53617
  contextTokensUsed,
53614
53618
  systemPromptReport: runResult.meta?.systemPromptReport,
53615
53619
  cliSessionId
@@ -69781,6 +69785,7 @@ async function updateSessionStoreAfterAgentRun(params) {
69781
69785
  model: modelUsed
69782
69786
  });
69783
69787
  if (result.meta.agentMeta?.authProfileId) next.authProfileServed = result.meta.agentMeta.authProfileId; // JOHNNESS_PATCH_SUBSCRIPTION_ACTIVATE_89
69788
+ next.authProfileFallback = result.meta.agentMeta?.authProfileFallback ?? null; // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92
69784
69789
  if (isCliProvider(providerUsed, cfg)) {
69785
69790
  const cliSessionId = result.meta.agentMeta?.sessionId?.trim();
69786
69791
  if (cliSessionId) setCliSessionId(next, providerUsed, cliSessionId);
@@ -104032,6 +104037,7 @@ async function runEmbeddedPiAgent(params) {
104032
104037
  });
104033
104038
  if (lockedProfileId && !profileOrder.includes(lockedProfileId)) throw new Error(`Auth profile "${lockedProfileId}" is not configured for ${provider}.`);
104034
104039
  const profileCandidates = lockedProfileId ? [lockedProfileId] : profileOrder.length > 0 ? profileOrder : [void 0];
104040
+ const subscriptionAuth = createSubscriptionAuthTracker({ provider, model: modelId, store: authStore, preferredProfileId, lockedProfileId }); // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92
104035
104041
  let profileIndex = 0;
104036
104042
  const initialThinkLevel = params.thinkLevel ?? "off";
104037
104043
  let thinkLevel = initialThinkLevel;
@@ -104163,7 +104169,8 @@ async function runEmbeddedPiAgent(params) {
104163
104169
  } else authStorage.setRuntimeApiKey(model.provider, apiKeyInfo.apiKey);
104164
104170
  lastProfileId = apiKeyInfo.profileId;
104165
104171
  };
104166
- const advanceAuthProfile = async () => {
104172
+ const advanceAuthProfile = async (reason) => {
104173
+ subscriptionAuth.failed(profileCandidates[profileIndex], reason);
104167
104174
  if (lockedProfileId) return false;
104168
104175
  let nextIndex = profileIndex + 1;
104169
104176
  while (nextIndex < profileCandidates.length) {
@@ -104213,7 +104220,7 @@ async function runEmbeddedPiAgent(params) {
104213
104220
  allInCooldown: false,
104214
104221
  error: err
104215
104222
  });
104216
- if (!await advanceAuthProfile()) throwAuthProfileFailover({
104223
+ if (!await advanceAuthProfile(/refresh/i.test(String(err)) ? "oauth_refresh_failed" : "credential_unavailable")) throwAuthProfileFailover({
104217
104224
  allInCooldown: false,
104218
104225
  error: err
104219
104226
  });
@@ -104592,7 +104599,7 @@ async function runEmbeddedPiAgent(params) {
104592
104599
  reason: promptProfileFailureReason
104593
104600
  });
104594
104601
  const promptFailoverFailure = isFailoverErrorMessage(errorText);
104595
- if (promptFailoverFailure && promptFailoverReason !== "timeout" && await advanceAuthProfile()) {
104602
+ if (promptFailoverFailure && promptFailoverReason !== "timeout" && await advanceAuthProfile(promptFailoverReason)) {
104596
104603
  await maybeBackoffBeforeOverloadFailover(promptFailoverReason);
104597
104604
  continue;
104598
104605
  }
@@ -104655,7 +104662,7 @@ async function runEmbeddedPiAgent(params) {
104655
104662
  if (timedOut && !isProbeSession) log$3.warn(`Profile ${lastProfileId} timed out. Trying next account...`);
104656
104663
  if (cloudCodeAssistFormatError) log$3.warn(`Profile ${lastProfileId} hit Cloud Code Assist format error. Tool calls will be sanitized on retry.`);
104657
104664
  }
104658
- if (await advanceAuthProfile()) {
104665
+ if (await advanceAuthProfile(timedOut ? "timeout" : assistantFailoverReason)) {
104659
104666
  await maybeBackoffBeforeOverloadFailover(assistantFailoverReason);
104660
104667
  continue;
104661
104668
  }
@@ -104704,6 +104711,7 @@ async function runEmbeddedPiAgent(params) {
104704
104711
  lastCallUsage: lastCallUsage ?? void 0,
104705
104712
  promptTokens,
104706
104713
  compactionCount: autoCompactionCount > 0 ? autoCompactionCount : void 0,
104714
+ authProfileFallback: subscriptionAuth.result(lastProfileId), // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92
104707
104715
  authProfileId: lastProfileId // JOHNNESS_PATCH_SUBSCRIPTION_ACTIVATE_89: profile that served this turn
104708
104716
  };
104709
104717
  const payloads = buildEmbeddedRunPayloads({
@@ -1,3 +1,4 @@
1
+ import { createSubscriptionAuthTracker, formatAuthProfileFallback } from "./anthropic-auth-runtime.js"; // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92
1
2
  import { normalizeBillingUsage, readLatestBillingUsage, formatBillingCost } from "./usage-billing.js"; // JOHNNESS_PATCH_USAGE_BILLING_91 dist/pi-embedded-DoQsYfIY.js
2
3
  import { importOptional66 } from "./optional-module.js";
3
4
  const JOHNNESS_PATCH_SLIM_TREE_66 = true;
@@ -27910,7 +27911,7 @@ function resolveModelAuthLabel(params) {
27910
27911
  });
27911
27912
  if (profile.type === "oauth") return `oauth${label ? ` (${label})` : ""}`;
27912
27913
  if (profile.type === "token") return `token${label ? ` (${label})` : ""}`;
27913
- return `api-key${label ? ` (${label})` : ""}`;
27914
+ return `api-key${label ? ` (${label})` : ""}${formatAuthProfileFallback(params.sessionEntry, profileId)}`;
27914
27915
  }
27915
27916
  const envKey = resolveEnvApiKey(providerKey);
27916
27917
  if (envKey?.apiKey) {
@@ -52861,6 +52862,7 @@ async function persistSessionUsageUpdate(params) {
52861
52862
  modelProvider: params.providerUsed ?? entry.modelProvider,
52862
52863
  model: params.modelUsed ?? entry.model,
52863
52864
  authProfileServed: params.authProfileServed ?? entry.authProfileServed, // JOHNNESS_PATCH_SUBSCRIPTION_ACTIVATE_89
52865
+ authProfileFallback: params.authProfileFallback ?? null, // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92
52864
52866
  contextTokens: resolvedContextTokens,
52865
52867
  systemPromptReport: params.systemPromptReport ?? entry.systemPromptReport,
52866
52868
  updatedAt: Date.now()
@@ -53141,6 +53143,7 @@ function createFollowupRunner(params) {
53141
53143
  modelUsed,
53142
53144
  providerUsed: fallbackProvider,
53143
53145
  authProfileServed: runResult.meta?.agentMeta?.authProfileId, // JOHNNESS_PATCH_SUBSCRIPTION_ACTIVATE_89
53146
+ authProfileFallback: runResult.meta?.agentMeta?.authProfileFallback, // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92
53144
53147
  contextTokensUsed,
53145
53148
  systemPromptReport: runResult.meta?.systemPromptReport,
53146
53149
  logLabel: "followup"
@@ -53606,6 +53609,7 @@ async function runReplyAgent(params) {
53606
53609
  modelUsed,
53607
53610
  providerUsed,
53608
53611
  authProfileServed: runResult.meta?.agentMeta?.authProfileId, // JOHNNESS_PATCH_SUBSCRIPTION_ACTIVATE_89
53612
+ authProfileFallback: runResult.meta?.agentMeta?.authProfileFallback, // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92
53609
53613
  contextTokensUsed,
53610
53614
  systemPromptReport: runResult.meta?.systemPromptReport,
53611
53615
  cliSessionId
@@ -69777,6 +69781,7 @@ async function updateSessionStoreAfterAgentRun(params) {
69777
69781
  model: modelUsed
69778
69782
  });
69779
69783
  if (result.meta.agentMeta?.authProfileId) next.authProfileServed = result.meta.agentMeta.authProfileId; // JOHNNESS_PATCH_SUBSCRIPTION_ACTIVATE_89
69784
+ next.authProfileFallback = result.meta.agentMeta?.authProfileFallback ?? null; // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92
69780
69785
  if (isCliProvider(providerUsed, cfg)) {
69781
69786
  const cliSessionId = result.meta.agentMeta?.sessionId?.trim();
69782
69787
  if (cliSessionId) setCliSessionId(next, providerUsed, cliSessionId);
@@ -104022,6 +104027,7 @@ async function runEmbeddedPiAgent(params) {
104022
104027
  });
104023
104028
  if (lockedProfileId && !profileOrder.includes(lockedProfileId)) throw new Error(`Auth profile "${lockedProfileId}" is not configured for ${provider}.`);
104024
104029
  const profileCandidates = lockedProfileId ? [lockedProfileId] : profileOrder.length > 0 ? profileOrder : [void 0];
104030
+ const subscriptionAuth = createSubscriptionAuthTracker({ provider, model: modelId, store: authStore, preferredProfileId, lockedProfileId }); // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92
104025
104031
  let profileIndex = 0;
104026
104032
  const initialThinkLevel = params.thinkLevel ?? "off";
104027
104033
  let thinkLevel = initialThinkLevel;
@@ -104153,7 +104159,8 @@ async function runEmbeddedPiAgent(params) {
104153
104159
  } else authStorage.setRuntimeApiKey(model.provider, apiKeyInfo.apiKey);
104154
104160
  lastProfileId = apiKeyInfo.profileId;
104155
104161
  };
104156
- const advanceAuthProfile = async () => {
104162
+ const advanceAuthProfile = async (reason) => {
104163
+ subscriptionAuth.failed(profileCandidates[profileIndex], reason);
104157
104164
  if (lockedProfileId) return false;
104158
104165
  let nextIndex = profileIndex + 1;
104159
104166
  while (nextIndex < profileCandidates.length) {
@@ -104203,7 +104210,7 @@ async function runEmbeddedPiAgent(params) {
104203
104210
  allInCooldown: false,
104204
104211
  error: err
104205
104212
  });
104206
- if (!await advanceAuthProfile()) throwAuthProfileFailover({
104213
+ if (!await advanceAuthProfile(/refresh/i.test(String(err)) ? "oauth_refresh_failed" : "credential_unavailable")) throwAuthProfileFailover({
104207
104214
  allInCooldown: false,
104208
104215
  error: err
104209
104216
  });
@@ -104575,7 +104582,7 @@ async function runEmbeddedPiAgent(params) {
104575
104582
  reason: promptProfileFailureReason
104576
104583
  });
104577
104584
  const promptFailoverFailure = isFailoverErrorMessage(errorText);
104578
- if (promptFailoverFailure && promptFailoverReason !== "timeout" && await advanceAuthProfile()) {
104585
+ if (promptFailoverFailure && promptFailoverReason !== "timeout" && await advanceAuthProfile(promptFailoverReason)) {
104579
104586
  await maybeBackoffBeforeOverloadFailover(promptFailoverReason);
104580
104587
  continue;
104581
104588
  }
@@ -104638,7 +104645,7 @@ async function runEmbeddedPiAgent(params) {
104638
104645
  if (timedOut && !isProbeSession) log$3.warn(`Profile ${lastProfileId} timed out. Trying next account...`);
104639
104646
  if (cloudCodeAssistFormatError) log$3.warn(`Profile ${lastProfileId} hit Cloud Code Assist format error. Tool calls will be sanitized on retry.`);
104640
104647
  }
104641
- if (await advanceAuthProfile()) {
104648
+ if (await advanceAuthProfile(timedOut ? "timeout" : assistantFailoverReason)) {
104642
104649
  await maybeBackoffBeforeOverloadFailover(assistantFailoverReason);
104643
104650
  continue;
104644
104651
  }
@@ -104672,6 +104679,7 @@ async function runEmbeddedPiAgent(params) {
104672
104679
  lastCallUsage: lastCallUsage ?? void 0,
104673
104680
  promptTokens,
104674
104681
  compactionCount: autoCompactionCount > 0 ? autoCompactionCount : void 0,
104682
+ authProfileFallback: subscriptionAuth.result(lastProfileId), // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92
104675
104683
  authProfileId: lastProfileId // JOHNNESS_PATCH_SUBSCRIPTION_ACTIVATE_89: profile that served this turn
104676
104684
  };
104677
104685
  const payloads = buildEmbeddedRunPayloads({
@@ -1,3 +1,4 @@
1
+ import { readCurrentAnthropicAuth } from "../anthropic-auth-runtime.js"; // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92
1
2
  import { claudeSubscriptionOrder } from "../subscription-login.js"; // JOHNNESS_PATCH_SUBSCRIPTION_LOGIN_86
2
3
  // JOHNNESS_PATCH_CATALOG_REFRESH_65
3
4
  import { mergeShippedCatalog65 } from "../catalog-refresh.js";
@@ -1129,8 +1130,10 @@ function codexOwnershipContext(agentDir) {
1129
1130
  log: (event) => log$9.info("Codex OAuth ownership", event)
1130
1131
  };
1131
1132
  }
1133
+ // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92
1132
1134
  function readCodexOwnedAuthStore(agentDir, store) {
1133
- return readManagedCodexStore({ ...codexOwnershipContext(agentDir), store });
1135
+ const context = codexOwnershipContext(agentDir);
1136
+ return readCurrentAnthropicAuth({ ...context, store: readManagedCodexStore({ ...context, store }) });
1134
1137
  }
1135
1138
  function sanitizeAuthProfileCredential(credential) {
1136
1139
  const sanitized = { ...credential };
@@ -2755,7 +2758,7 @@ async function refreshUnmanagedOAuthTokenWithLock(params) {
2755
2758
  const authPath = resolveAuthStorePath(params.agentDir);
2756
2759
  fs.mkdirSync(path.dirname(authPath), { recursive: true, mode: 448 });
2757
2760
  return await withFileLock(authPath, AUTH_STORE_LOCK_OPTIONS, async () => {
2758
- const store = ensureAuthProfileStore(params.agentDir);
2761
+ const store = loadAuthProfileStoreForRuntime(params.agentDir, { allowKeychainPrompt: false }); // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92: reread under lock
2759
2762
  const cred = store.profiles[params.profileId];
2760
2763
  if (cred?.provider === "openai-codex") throw new Error("Auth profile changed to Codex; resolve again through its owner");
2761
2764
  if (!cred || cred.type !== "oauth") return null;
@@ -1,3 +1,4 @@
1
+ import { readCurrentAnthropicAuth } from "../anthropic-auth-runtime.js"; // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92
1
2
  import { claudeSubscriptionOrder } from "../subscription-login.js"; // JOHNNESS_PATCH_SUBSCRIPTION_LOGIN_86
2
3
  // JOHNNESS_PATCH_CATALOG_REFRESH_65
3
4
  import { mergeShippedCatalog65 } from "../catalog-refresh.js";
@@ -2156,8 +2157,10 @@ function codexOwnershipContext(agentDir) {
2156
2157
  log: (event) => log$8.info("Codex OAuth ownership", event)
2157
2158
  };
2158
2159
  }
2160
+ // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92
2159
2161
  function readCodexOwnedAuthStore(agentDir, store) {
2160
- return readManagedCodexStore({ ...codexOwnershipContext(agentDir), store });
2162
+ const context = codexOwnershipContext(agentDir);
2163
+ return readCurrentAnthropicAuth({ ...context, store: readManagedCodexStore({ ...context, store }) });
2161
2164
  }
2162
2165
  function sanitizeAuthProfileCredential(credential) {
2163
2166
  const sanitized = { ...credential };
@@ -3756,7 +3759,7 @@ async function refreshUnmanagedOAuthTokenWithLock(params) {
3756
3759
  const authPath = resolveAuthStorePath(params.agentDir);
3757
3760
  fs.mkdirSync(path.dirname(authPath), { recursive: true, mode: 448 });
3758
3761
  return await withFileLock(authPath, AUTH_STORE_LOCK_OPTIONS, async () => {
3759
- const store = ensureAuthProfileStore(params.agentDir);
3762
+ const store = loadAuthProfileStoreForRuntime(params.agentDir, { allowKeychainPrompt: false }); // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92: reread under lock
3760
3763
  const cred = store.profiles[params.profileId];
3761
3764
  if (cred?.provider === "openai-codex") throw new Error("Auth profile changed to Codex; resolve again through its owner");
3762
3765
  if (!cred || cred.type !== "oauth") return null;
@@ -1,3 +1,4 @@
1
+ import { createSubscriptionAuthTracker, formatAuthProfileFallback } from "../anthropic-auth-runtime.js"; // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92
1
2
  import { normalizeBillingUsage, readLatestBillingUsage, formatBillingCost } from "../usage-billing.js"; // JOHNNESS_PATCH_USAGE_BILLING_91 dist/plugin-sdk/dispatch-BP0viZiL.js
2
3
  import { importOptional66 } from "../optional-module.js";
3
4
  const JOHNNESS_PATCH_SLIM_TREE_66 = true;
@@ -24311,7 +24312,7 @@ function resolveModelAuthLabel(params) {
24311
24312
  });
24312
24313
  if (profile.type === "oauth") return `oauth${label ? ` (${label})` : ""}`;
24313
24314
  if (profile.type === "token") return `token${label ? ` (${label})` : ""}`;
24314
- return `api-key${label ? ` (${label})` : ""}`;
24315
+ return `api-key${label ? ` (${label})` : ""}${formatAuthProfileFallback(params.sessionEntry, profileId)}`;
24315
24316
  }
24316
24317
  const envKey = resolveEnvApiKey(providerKey);
24317
24318
  if (envKey?.apiKey) {
@@ -34016,6 +34017,7 @@ async function updateSessionStoreAfterAgentRun(params) {
34016
34017
  model: modelUsed
34017
34018
  });
34018
34019
  if (result.meta.agentMeta?.authProfileId) next.authProfileServed = result.meta.agentMeta.authProfileId; // JOHNNESS_PATCH_SUBSCRIPTION_ACTIVATE_89
34020
+ next.authProfileFallback = result.meta.agentMeta?.authProfileFallback ?? null; // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92
34019
34021
  if (isCliProvider(providerUsed, cfg)) {
34020
34022
  const cliSessionId = result.meta.agentMeta?.sessionId?.trim();
34021
34023
  if (cliSessionId) setCliSessionId(next, providerUsed, cliSessionId);
@@ -88266,6 +88268,7 @@ async function runEmbeddedPiAgent(params) {
88266
88268
  });
88267
88269
  if (lockedProfileId && !profileOrder.includes(lockedProfileId)) throw new Error(`Auth profile "${lockedProfileId}" is not configured for ${provider}.`);
88268
88270
  const profileCandidates = lockedProfileId ? [lockedProfileId] : profileOrder.length > 0 ? profileOrder : [void 0];
88271
+ const subscriptionAuth = createSubscriptionAuthTracker({ provider, model: modelId, store: authStore, preferredProfileId, lockedProfileId }); // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92
88269
88272
  let profileIndex = 0;
88270
88273
  const initialThinkLevel = params.thinkLevel ?? "off";
88271
88274
  let thinkLevel = initialThinkLevel;
@@ -88397,7 +88400,8 @@ async function runEmbeddedPiAgent(params) {
88397
88400
  } else authStorage.setRuntimeApiKey(model.provider, apiKeyInfo.apiKey);
88398
88401
  lastProfileId = apiKeyInfo.profileId;
88399
88402
  };
88400
- const advanceAuthProfile = async () => {
88403
+ const advanceAuthProfile = async (reason) => {
88404
+ subscriptionAuth.failed(profileCandidates[profileIndex], reason);
88401
88405
  if (lockedProfileId) return false;
88402
88406
  let nextIndex = profileIndex + 1;
88403
88407
  while (nextIndex < profileCandidates.length) {
@@ -88447,7 +88451,7 @@ async function runEmbeddedPiAgent(params) {
88447
88451
  allInCooldown: false,
88448
88452
  error: err
88449
88453
  });
88450
- if (!await advanceAuthProfile()) throwAuthProfileFailover({
88454
+ if (!await advanceAuthProfile(/refresh/i.test(String(err)) ? "oauth_refresh_failed" : "credential_unavailable")) throwAuthProfileFailover({
88451
88455
  allInCooldown: false,
88452
88456
  error: err
88453
88457
  });
@@ -88816,7 +88820,7 @@ async function runEmbeddedPiAgent(params) {
88816
88820
  reason: promptProfileFailureReason
88817
88821
  });
88818
88822
  const promptFailoverFailure = isFailoverErrorMessage(errorText);
88819
- if (promptFailoverFailure && promptFailoverReason !== "timeout" && await advanceAuthProfile()) {
88823
+ if (promptFailoverFailure && promptFailoverReason !== "timeout" && await advanceAuthProfile(promptFailoverReason)) {
88820
88824
  await maybeBackoffBeforeOverloadFailover(promptFailoverReason);
88821
88825
  continue;
88822
88826
  }
@@ -88879,7 +88883,7 @@ async function runEmbeddedPiAgent(params) {
88879
88883
  if (timedOut && !isProbeSession) log$7.warn(`Profile ${lastProfileId} timed out. Trying next account...`);
88880
88884
  if (cloudCodeAssistFormatError) log$7.warn(`Profile ${lastProfileId} hit Cloud Code Assist format error. Tool calls will be sanitized on retry.`);
88881
88885
  }
88882
- if (await advanceAuthProfile()) {
88886
+ if (await advanceAuthProfile(timedOut ? "timeout" : assistantFailoverReason)) {
88883
88887
  await maybeBackoffBeforeOverloadFailover(assistantFailoverReason);
88884
88888
  continue;
88885
88889
  }
@@ -88913,6 +88917,7 @@ async function runEmbeddedPiAgent(params) {
88913
88917
  lastCallUsage: lastCallUsage ?? void 0,
88914
88918
  promptTokens,
88915
88919
  compactionCount: autoCompactionCount > 0 ? autoCompactionCount : void 0,
88920
+ authProfileFallback: subscriptionAuth.result(lastProfileId), // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92
88916
88921
  authProfileId: lastProfileId // JOHNNESS_PATCH_SUBSCRIPTION_ACTIVATE_89: profile that served this turn
88917
88922
  };
88918
88923
  const payloads = buildEmbeddedRunPayloads({
@@ -100307,6 +100312,7 @@ async function persistSessionUsageUpdate(params) {
100307
100312
  modelProvider: params.providerUsed ?? entry.modelProvider,
100308
100313
  model: params.modelUsed ?? entry.model,
100309
100314
  authProfileServed: params.authProfileServed ?? entry.authProfileServed, // JOHNNESS_PATCH_SUBSCRIPTION_ACTIVATE_89
100315
+ authProfileFallback: params.authProfileFallback ?? null, // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92
100310
100316
  contextTokens: resolvedContextTokens,
100311
100317
  systemPromptReport: params.systemPromptReport ?? entry.systemPromptReport,
100312
100318
  updatedAt: Date.now()
@@ -100587,6 +100593,7 @@ function createFollowupRunner(params) {
100587
100593
  modelUsed,
100588
100594
  providerUsed: fallbackProvider,
100589
100595
  authProfileServed: runResult.meta?.agentMeta?.authProfileId, // JOHNNESS_PATCH_SUBSCRIPTION_ACTIVATE_89
100596
+ authProfileFallback: runResult.meta?.agentMeta?.authProfileFallback, // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92
100590
100597
  contextTokensUsed,
100591
100598
  systemPromptReport: runResult.meta?.systemPromptReport,
100592
100599
  logLabel: "followup"
@@ -100925,6 +100932,7 @@ async function runReplyAgent(params) {
100925
100932
  modelUsed,
100926
100933
  providerUsed,
100927
100934
  authProfileServed: runResult.meta?.agentMeta?.authProfileId, // JOHNNESS_PATCH_SUBSCRIPTION_ACTIVATE_89
100935
+ authProfileFallback: runResult.meta?.agentMeta?.authProfileFallback, // JOHNNESS_PATCH_SUBSCRIPTION_RUNTIME_92
100928
100936
  contextTokensUsed,
100929
100937
  systemPromptReport: runResult.meta?.systemPromptReport,
100930
100938
  cliSessionId