88 log ,
99} from "./constants.js" ;
1010import { overlayExternalAuthProfiles , shouldPersistExternalAuthProfile } from "./external-auth.js" ;
11- import { syncExternalCliCredentials } from "./external-cli-sync.js" ;
1211import {
1312 ensureAuthStoreFile ,
1413 resolveAuthStatePath ,
@@ -149,34 +148,9 @@ export async function updateAuthProfileStoreWithLock(params: {
149148 }
150149}
151150
152- function shouldLogAuthStoreTiming ( ) : boolean {
153- return process . env . OPENCLAW_DEBUG_INGRESS_TIMING === "1" ;
154- }
155-
156- function syncExternalCliCredentialsTimed (
157- store : AuthProfileStore ,
158- options ?: Parameters < typeof syncExternalCliCredentials > [ 1 ] ,
159- ) : boolean {
160- if ( ! shouldLogAuthStoreTiming ( ) ) {
161- return syncExternalCliCredentials ( store , options ) ;
162- }
163- const startMs = Date . now ( ) ;
164- const mutated = syncExternalCliCredentials ( store , options ) ;
165- log . info (
166- `auth-store stage=external-cli-sync elapsedMs=${ Date . now ( ) - startMs } mutated=${ mutated } ` ,
167- ) ;
168- return mutated ;
169- }
170-
171- function shouldSyncExternalCliCredentials ( options ?: { syncExternalCli ?: boolean } ) : boolean {
172- return options ?. syncExternalCli !== false ;
173- }
174-
175151export function loadAuthProfileStore ( ) : AuthProfileStore {
176152 const asStore = loadPersistedAuthProfileStore ( ) ;
177153 if ( asStore ) {
178- // Sync from external CLI tools on every load.
179- syncExternalCliCredentialsTimed ( asStore ) ;
180154 return overlayExternalAuthProfiles ( asStore ) ;
181155 }
182156 const legacy = loadLegacyAuthProfileStore ( ) ;
@@ -186,12 +160,10 @@ export function loadAuthProfileStore(): AuthProfileStore {
186160 profiles : { } ,
187161 } ;
188162 applyLegacyAuthStore ( store , legacy ) ;
189- syncExternalCliCredentialsTimed ( store ) ;
190163 return overlayExternalAuthProfiles ( store ) ;
191164 }
192165
193166 const store : AuthProfileStore = { version : AUTH_STORE_VERSION , profiles : { } } ;
194- syncExternalCliCredentialsTimed ( store ) ;
195167 return overlayExternalAuthProfiles ( store ) ;
196168}
197169
@@ -216,11 +188,6 @@ function loadAuthProfileStoreForAgent(
216188 }
217189 const asStore = loadPersistedAuthProfileStore ( agentDir ) ;
218190 if ( asStore ) {
219- // Runtime secret activation must remain read-only:
220- // sync external CLI credentials in-memory, but never persist while readOnly.
221- if ( shouldSyncExternalCliCredentials ( options ) ) {
222- syncExternalCliCredentialsTimed ( asStore , { log : ! readOnly } ) ;
223- }
224191 if ( ! readOnly ) {
225192 writeCachedAuthProfileStore ( {
226193 authPath,
@@ -260,10 +227,6 @@ function loadAuthProfileStoreForAgent(
260227 }
261228
262229 const mergedOAuth = mergeOAuthFileIntoStore ( store ) ;
263- // Keep external CLI credentials visible in runtime even during read-only loads.
264- if ( shouldSyncExternalCliCredentials ( options ) ) {
265- syncExternalCliCredentialsTimed ( store , { log : ! readOnly } ) ;
266- }
267230 const forceReadOnly = process . env . OPENCLAW_AUTH_STORE_READONLY === "1" ;
268231 const shouldWrite = ! readOnly && ! forceReadOnly && ( legacy !== null || mergedOAuth ) ;
269232 if ( shouldWrite ) {
@@ -394,9 +357,6 @@ export function saveAuthProfileStore(
394357 saveJsonFile ( authPath , payload ) ;
395358 savePersistedAuthProfileState ( store , agentDir ) ;
396359 const runtimeStore = cloneAuthProfileStore ( store ) ;
397- if ( shouldSyncExternalCliCredentials ( options ) ) {
398- syncExternalCliCredentialsTimed ( runtimeStore , { log : false } ) ;
399- }
400360 writeCachedAuthProfileStore ( {
401361 authPath,
402362 authMtimeMs : readAuthStoreMtimeMs ( authPath ) ,
0 commit comments