A knowledge base whose data files are unreadable (for example root-owned
files in a container whose app runs as uid 1000) used to take down the
entire KB catalogue: list_kb_versions() -> _read_json() -> Path.exists()
raised PermissionError, so list_knowledge_bases() and the web-source
scheduler failed for every KB.
- _read_json() opens the file directly and treats FileNotFoundError as
"no metadata"; other OSError/ValueError degrades to a warning. This also
avoids Path.exists(), which propagates EACCES on Python >= 3.8.
- _is_storage_ready(), _flat_version_dirs() and list_kb_versions() skip
unreadable versions with a warning instead of raising.
- KnowledgeBaseManager._list_knowledge_bases() isolates per-KB failures
and an unreadable base directory, keeping the rest of the catalogue.
Tests cover unreadable metadata, an unreadable version dir, an unreadable
storage probe, and a manager listing with one unreadable KB.
Co-Authored-By: Claude Code <noreply@anthropic.com>
Reuse the reconciled manager snapshot while building one knowledge-base list response so each item does not reload configuration and rescan every index.
Constraint: Preserve fresh config reads for standalone callers and target the upstream dev branch.
Rejected: Raise the proxy timeout | it masks repeated full-index scans and leaves list cost quadratic.
Confidence: high
Scope-risk: moderate
Directive: Do not reuse manager snapshots across await boundaries or write operations.
Tested: 53 focused pytest cases; Ruff check and format; 58-KB read-only benchmark completed in 2.114 seconds.
Not-tested: Full repository pre-commit suite.
Co-authored-by: OmX <omx@oh-my-codex.dev>