Copilot external ingest falls back to memory when workspace storage directory is absent
- Dominant language
- TypeScript
- Stars
- 193k
- Forks
- 42.4k
- PR merge metrics
- PR metrics pending
Description
Type: Bug
VS Code Stable 1.133.0 with bundled GitHub Copilot Chat 0.61.0 logs:
```text
Failed to create database. Falling back to in-memory db: Error: unable to open database file
```
The same construction remains on current main in Copilot Chat 0.63.0.
Cause:
`ExternalIngestIndex` joins `codebase-external.sqlite` onto `ExtensionContext.storageUri` and immediately passes the resulting path to `node:sqlite` `DatabaseSync`. The storage URI can be present while the extension-specific directory itself does not yet exist. SQLite can create the file but not its missing parent directory, so construction fails and the extension silently uses an in-memory index for that workspace.
This is distinct from permissions, corruption, and lock contention: the workspace-storage parent is writable, the extension-specific child is absent, and creating only that child makes the same bundled extension create and reopen the disk database successfully. Two cold starts then emitted no fallback, and both clean-close `PRAGMA integrity_check` runs returned `ok`.
Expected:
Before opening a file-backed external-ingest database, Copilot Chat should recursively create its declared file-scheme workspace-storage directory. A unit test should cover an absent nested storage directory and assert that `codebase-external.sqlite` is created there.
Related: #331190 includes the same database warning alongside a separate Windows extension-host crash, but this issue is limited to the deterministic missing-directory fallback.
Contributor guide
Assessment
This issue has not been assessed yet.