@@ -39,6 +39,7 @@ export interface WorkspaceToolsDebug {
3939 mode : "cache-fresh" | "cache-stale" | "rebuild" ;
4040 includeDts : boolean ;
4141 sourceTimeoutMs : number | null ;
42+ skipCacheRead : boolean ;
4243 sourceCount : number ;
4344 normalizedSourceCount : number ;
4445 cacheHit : boolean ;
@@ -52,6 +53,7 @@ interface GetWorkspaceToolsOptions {
5253 includeDts ?: boolean ;
5354 sourceTimeoutMs ?: number ;
5455 allowStaleOnMismatch ?: boolean ;
56+ skipCacheRead ?: boolean ;
5557}
5658
5759export interface WorkspaceToolInventory {
@@ -133,6 +135,7 @@ export async function getWorkspaceTools(
133135 const includeDts = options . includeDts ?? false ;
134136 const sourceTimeoutMs = options . sourceTimeoutMs ;
135137 const allowStaleOnMismatch = options . allowStaleOnMismatch ?? false ;
138+ const skipCacheRead = options . skipCacheRead ?? false ;
136139 const sources = ( await ctx . runQuery ( internal . database . listToolSources , { workspaceId } ) )
137140 . filter ( ( source : { enabled : boolean } ) => source . enabled ) ;
138141 traceStep ( "listToolSources" , listSourcesStartedAt ) ;
@@ -141,10 +144,12 @@ export async function getWorkspaceTools(
141144 const debugBase : Omit < WorkspaceToolsDebug , "mode" | "normalizedSourceCount" | "cacheHit" | "cacheFresh" | "timedOutSources" | "durationMs" | "trace" > = {
142145 includeDts,
143146 sourceTimeoutMs : sourceTimeoutMs ?? null ,
147+ skipCacheRead,
144148 sourceCount : sources . length ,
145149 } ;
146150
147- try {
151+ if ( ! skipCacheRead ) {
152+ try {
148153 const cacheReadStartedAt = Date . now ( ) ;
149154 const cacheEntry = await ctx . runQuery ( internal . workspaceToolCache . getEntry , {
150155 workspaceId,
@@ -202,9 +207,12 @@ export async function getWorkspaceTools(
202207 }
203208 }
204209 }
205- } catch ( error ) {
206- const msg = error instanceof Error ? error . message : String ( error ) ;
207- console . warn ( `[executor] workspace tool cache read failed for '${ workspaceId } ': ${ msg } ` ) ;
210+ } catch ( error ) {
211+ const msg = error instanceof Error ? error . message : String ( error ) ;
212+ console . warn ( `[executor] workspace tool cache read failed for '${ workspaceId } ': ${ msg } ` ) ;
213+ }
214+ } else {
215+ trace . push ( "cacheEntryLookup=skipped" ) ;
208216 }
209217
210218 const configs : ExternalToolSourceConfig [ ] = [ ] ;
@@ -364,13 +372,24 @@ export async function getWorkspaceTools(
364372export async function loadWorkspaceToolInventoryForContext (
365373 ctx : ActionCtx ,
366374 context : { workspaceId : Id < "workspaces" > ; actorId ?: string ; clientId ?: string } ,
367- options : { includeDts ?: boolean ; sourceTimeoutMs ?: number ; allowStaleOnMismatch ?: boolean } = { } ,
375+ options : {
376+ includeDts ?: boolean ;
377+ sourceTimeoutMs ?: number ;
378+ allowStaleOnMismatch ?: boolean ;
379+ skipCacheRead ?: boolean ;
380+ } = { } ,
368381) : Promise < WorkspaceToolInventory > {
369382 const includeDts = options . includeDts ?? false ;
370383 const sourceTimeoutMs = options . sourceTimeoutMs ;
371384 const allowStaleOnMismatch = options . allowStaleOnMismatch ;
385+ const skipCacheRead = options . skipCacheRead ;
372386 const [ result , policies ] = await Promise . all ( [
373- getWorkspaceTools ( ctx , context . workspaceId , { includeDts, sourceTimeoutMs, allowStaleOnMismatch } ) ,
387+ getWorkspaceTools ( ctx , context . workspaceId , {
388+ includeDts,
389+ sourceTimeoutMs,
390+ allowStaleOnMismatch,
391+ skipCacheRead,
392+ } ) ,
374393 ctx . runQuery ( internal . database . listAccessPolicies , { workspaceId : context . workspaceId } ) ,
375394 ] ) ;
376395 const typedPolicies = policies as AccessPolicyRecord [ ] ;
@@ -405,7 +424,12 @@ export async function loadWorkspaceToolInventoryForContext(
405424export async function listToolsForContext (
406425 ctx : ActionCtx ,
407426 context : { workspaceId : Id < "workspaces" > ; actorId ?: string ; clientId ?: string } ,
408- options : { includeDts ?: boolean ; sourceTimeoutMs ?: number ; allowStaleOnMismatch ?: boolean } = { } ,
427+ options : {
428+ includeDts ?: boolean ;
429+ sourceTimeoutMs ?: number ;
430+ allowStaleOnMismatch ?: boolean ;
431+ skipCacheRead ?: boolean ;
432+ } = { } ,
409433) : Promise < ToolDescriptor [ ] > {
410434 const inventory = await loadWorkspaceToolInventoryForContext ( ctx , context , options ) ;
411435 return inventory . tools ;
@@ -414,7 +438,12 @@ export async function listToolsForContext(
414438export async function listToolsWithWarningsForContext (
415439 ctx : ActionCtx ,
416440 context : { workspaceId : Id < "workspaces" > ; actorId ?: string ; clientId ?: string } ,
417- options : { includeDts ?: boolean ; sourceTimeoutMs ?: number ; allowStaleOnMismatch ?: boolean } = { } ,
441+ options : {
442+ includeDts ?: boolean ;
443+ sourceTimeoutMs ?: number ;
444+ allowStaleOnMismatch ?: boolean ;
445+ skipCacheRead ?: boolean ;
446+ } = { } ,
418447) : Promise < {
419448 tools : ToolDescriptor [ ] ;
420449 warnings : string [ ] ;
0 commit comments