diff --git a/src/main/ai-vault/scanners/pi/session-scanner-pi-omp-shared-root.test.ts b/src/main/ai-vault/scanners/pi/session-scanner-pi-omp-shared-root.test.ts index 7a743a0b37b..7ac6a1f49c6 100644 --- a/src/main/ai-vault/scanners/pi/session-scanner-pi-omp-shared-root.test.ts +++ b/src/main/ai-vault/scanners/pi/session-scanner-pi-omp-shared-root.test.ts @@ -138,6 +138,17 @@ describe('scanAiVaultSessions with overlapping Pi and OMP roots', () => { layout: 'a parent folder for a workspace', piRoot: parentFolder, scope: { scopePaths: ['/repo/app'], limit: 1 } + }, + // Workspace and Project skip the recency pass for cwd-bucket agents. + { + layout: 'the same folder for a scope-only workspace', + piRoot: sameFolder, + scope: { scopePaths: ['/repo/app'], scopeOnly: true } + }, + { + layout: 'a parent folder for a scope-only workspace', + piRoot: parentFolder, + scope: { scopePaths: ['/repo/app'], scopeOnly: true } } ])('lists each transcript once under its writer when Pi scans $layout', async (testCase) => { const root = await mkdtemp(join(tmpdir(), 'orca-ai-vault-pi-omp-shared-')) diff --git a/src/main/ai-vault/session-scanner-source-discovery.ts b/src/main/ai-vault/session-scanner-source-discovery.ts index 3d16e92696c..c7347433c6a 100644 --- a/src/main/ai-vault/session-scanner-source-discovery.ts +++ b/src/main/ai-vault/session-scanner-source-discovery.ts @@ -52,7 +52,12 @@ function agentDiscoveries( ): Promise[] { const rootDirs = source.rootDirs(options, wslHomeDirs) // Scope-only scans read cwd-bucket agents through their bucket inventory and can't place cwd-less ones. - if (scopeOnlyScan(options) && !scopeWalksAgentFiles(agent, options.scopePaths)) { + // Pi stays listed: OMP shares its folder under PI_CODING_AGENT_DIR, and Pi's listing decides who parses a file. + if ( + scopeOnlyScan(options) && + !scopeWalksAgentFiles(agent, options.scopePaths) && + agent !== 'pi' + ) { return rootDirs.map(async (rootDir) => ({ agent, rootDir, files: [] })) } const discover = (rootDir: string): Promise => diff --git a/src/renderer/src/components/right-sidebar/ai-vault/scanning/ai-vault-session-refresh.ts b/src/renderer/src/components/right-sidebar/ai-vault/scanning/ai-vault-session-refresh.ts index e1e5771e5d2..cc67e934686 100644 --- a/src/renderer/src/components/right-sidebar/ai-vault/scanning/ai-vault-session-refresh.ts +++ b/src/renderer/src/components/right-sidebar/ai-vault/scanning/ai-vault-session-refresh.ts @@ -81,11 +81,9 @@ export function useAiVaultSessionRefresh( const mountedRef = useRef(true) const publicationGateRef = useRef(undefined!) publicationGateRef.current ??= new AiVaultSessionPublicationGate() - const scopeBaseKey = aiVaultSessionResultCacheKey(executionHostScope, scopePaths, scopeOnly) - const scanScopeKey = `${scopeBaseKey}\n${sessionLimit}` - // Another scope's scope-only rows would pass for this scope's list while it loads or after it fails. - const shown = - scan && (!scan.scopeOnly || scan.scopeKey === `${scopeBaseKey}\n${scan.limit}`) ? scan : null + const scanScopeKey = `${aiVaultSessionResultCacheKey(executionHostScope, scopePaths, scopeOnly)}\n${sessionLimit}` + // Workspace or Project rows would pass for All's list while it loads or after it fails; the filter narrows the rest. + const shown = scan?.scopeOnly && !scopeOnly ? null : scan // Kept through rescans so a repeat failure doesn't blink; shown only for the scope that failed. const error = failure?.scopeKey === scanScopeKey ? aiVaultScanErrorText(failure.cause) : null const scopePathsRef = useRef(scopePaths)