fix(ai-vault): say OpenCode-in-WSL is not searchable from Windows yet (#20971)

The scan issue for an OpenCode database on a \\wsl.localhost share read as an
error with an instruction the user cannot follow. It now surfaces on the Agent
Session Search settings page under a computer row, where it belongs as a known
limitation, so the WSL branch now reads 'OpenCode sessions inside WSL can't be
searched from Windows yet.'

Copy only: the issue keeps kind 'scope' and its path, every other branch is
untouched, and discovery, the WSL gate, and the busy-timeout behavior are
unchanged.
This commit is contained in:
Jinwoo Hong
2026-09-16 12:04:16 -04:00
committed by GitHub
parent 3e5eb0329a
commit f85d2bf6ad
2 changed files with 13 additions and 15 deletions
@@ -250,14 +250,13 @@ describe('openCodeBusyTimeoutMs', () => {
describe('openCodeDatabaseScanIssue', () => {
const cantOpen = Object.assign(new Error('unable to open database file'), { errcode: 14 })
it('names the wal-index over a WSL share rather than repeating the driver string', () => {
const issue = openCodeDatabaseScanIssue(
'\\\\wsl.localhost\\Ubuntu\\home\\ada\\.local\\share\\opencode\\opencode.db',
cantOpen
)
it('states the WSL share as a known limitation rather than an error to act on', () => {
const dbPath = '\\\\wsl.localhost\\Ubuntu\\home\\ada\\.local\\share\\opencode\\opencode.db'
const issue = openCodeDatabaseScanIssue(dbPath, cantOpen)
expect(issue.kind).toBe('scope')
expect(issue.message).toContain('\\\\wsl.localhost')
expect(issue.path).toBe(dbPath)
expect(issue.message).toBe("OpenCode sessions inside WSL can't be searched from Windows yet.")
// Checkpointing cannot fix a share that refuses SQLite's locks, so the copy
// must not send the user after the write-ahead log.
expect(issue.message).not.toContain('write-ahead log')
@@ -282,7 +281,7 @@ describe('openCodeDatabaseScanIssue', () => {
)
expect(issue.message).not.toContain('is writing to')
expect(issue.message).toContain('inside the distro')
expect(issue.message).toBe("OpenCode sessions inside WSL can't be searched from Windows yet.")
})
it('still blames a live writer for the same error on a local path', () => {
@@ -99,16 +99,15 @@ export function openCodeDatabaseScanIssue(dbPath: string, error: unknown): AiVau
? `OpenCode is writing to ${name} right now, so its history was skipped. It is read again on the next refresh.`
: kind === 'unreadable'
? `OpenCode history in ${name} could not be read: ${errorMessage(error)}`
: `OpenCode history in ${name} could not be read. ${unreadableShareAdvice(dbPath)}`
: unreadableShareDetail(dbPath, name)
return { agent: 'opencode', kind: 'scope', path: dbPath, message: detail }
}
function unreadableShareAdvice(dbPath: string): string {
// Named only when the evidence supports it; a generic share gets generic copy.
// Deliberately not "flush the write-ahead log": checkpointing changes nothing
// here, and telling the user to try it would send them after a fix that cannot
// work. The share itself is the blocker.
function unreadableShareDetail(dbPath: string, name: string): string {
// A known limitation, not a failure the user can act on: nothing they do on
// the Windows side makes the share hand out SQLite's locks. Deliberately not
// "flush the write-ahead log" either — checkpointing changes nothing here.
return isWslUncPath(dbPath)
? 'Windows cannot open SQLite databases over the \\\\wsl.localhost share, so this history has to be read from inside the distro.'
: 'Its write-ahead log cannot be opened read-only on this filesystem. Exit OpenCode cleanly to flush the log.'
? "OpenCode sessions inside WSL can't be searched from Windows yet."
: `OpenCode history in ${name} could not be read. Its write-ahead log cannot be opened read-only on this filesystem. Exit OpenCode cleanly to flush the log.`
}