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>
On Windows, file_lock_shared took msvcrt LK_NBLCK, which is an
exclusive, mandatory byte-range lock (msvcrt has no shared lock). A
reader that overlapped another reader failed with PermissionError,
_read_and_reconcile_config mapped that to an empty catalog, and the next
update_kb_status auto-registered its KB into the empty catalog and saved
it, dropping every other knowledge base's entry from kb_config.json.
Writers already replace the file atomically, so readers need no lock:
take none on Windows. POSIX keeps its LOCK_SH.
Linked-folder sync wrote a full snapshot for every file and never deleted the old ones. Index a staged batch in one publish and keep the newest three snapshots per embedding signature.
Co-authored-by: Cursor <cursoragent@cursor.com>
`kb create --docs-dir` staged every source at `raw/<basename>` with an
unconditional copy, so a docs tree with one `full.md` per volume kept only
the last file and still reported success. Both KB entry points now share one
staging rule (`knowledge/staging.py`): a taken name is reused only when the
content matches, otherwise the newcomer gets a free sibling name, so nothing
the user asked to index is dropped.
Issue: #2041
load_run() read .indexing-run.json and .indexing-cancel.json with a bare
Path.read_text(), so a brief Windows sharing lock (antivirus, indexer, a
concurrent reader) failed the safety check at once with "Indexing journal
is unreadable", and the locale default encoding garbled or rejected the
UTF-8 that atomic_write_json writes (a document named "ÁLGEBRA.pdf" makes
every check fail under cp1252).
Add file_io.read_text(), which reads UTF-8 and shares the bounded
PermissionError backoff already used by _atomic_replace(). Missing files,
corrupt JSON and locks that outlast the backoff keep their existing
behaviour.
Closes#1912
* fix(knowledge): make update_kb_status write failures observable
The ready-transition metadata refresh swallowed every exception
(`except Exception: pass`), and a kb_config.json persist failure
surfaced only as an opaque raise inside fire-and-forget callers, so
a lost status update left the persisted KB state stale with no
diagnostic.
- Log a warning naming the KB when the best-effort ready-transition
metadata refresh fails, instead of silently passing.
- Log an error with the KB name and status when persisting the
config fails, then re-raise so callers still receive the exception
(the write is authoritative, not best-effort).
Tests: a persist failure is logged and re-raised; a metadata refresh
failure is logged and does not propagate.
* fix(knowledge): make progress WS failures visible instead of silent
The websocket_progress endpoint swallowed five failure points with
`except Exception: pass`: timestamp parsing (x2), error-frame delivery,
socket close, and user-context reset. A corrupt progress snapshot or a
broken teardown path therefore vanished without a trace.
- Share a _progress_age_seconds helper for both freshness checks: narrow
the catch to (TypeError, ValueError), keep the inactive/stale fallback,
and log unparseable timestamps at warning level.
- Reuse the already-parsed snapshot age in the replay decision, so one
corrupt timestamp warns once per connection instead of once per
freshness check.
- Trace failed error-frame delivery and failed close at debug level
(usually an already-disconnected client, not a fault).
- Log a failed reset_current_user at warning level: leaking the user
context is a real fault, not a disconnect.
Tests: malformed timestamp degrades with a warning; cleanup failures are
logged and never propagate; normal disconnects stay silent.
* fix(knowledge): stop swallowing a failed reindex error-progress write
The reindex failure path wrapped its ProgressTracker ERROR update in
`except Exception: pass`, so when that write itself failed the rebuild's
failure alert disappeared and the KB progress view silently stayed stale.
Log a warning instead; the task-level error status remains authoritative.
* fix(knowledge): log folder sync state recording failures
update_folder_sync_state() swallowed per-file mtime recording errors
with 'except Exception: pass', so a file whose state could not be
recorded silently degraded the persisted sync state while last_sync
still advanced. Log the failure at WARNING and keep the un-recorded
fallback so the next scan re-syncs the file.
* test(codebuddy): make credential fixture expiry relative to now
test_load_credentials_parses_session wrote a hard-coded expiresAt of
1791055241000 (2026-10-03 15:40:41 UTC) and asserted is_expired() is
False. Once that instant passed the assertion flipped, so the test now
fails on every Python version for every branch.
Derive expiresAt / refreshExpiresAt from time.time() so the fixture
always describes a live session, and assert against the value written.
---------
Co-authored-by: XZH <cto@xzh.ai>
Combine knowledge bootstrap coverage and preserve later progress-isolation tests, native notebook tooltip, and locale-aware tool-hint fallback. Regenerate frontend contracts and align test fixtures with merged APIs.
Ship folder-based workspaces and data migration, daily practice, redesigned
provider and model settings, and streaming conversation improvements.
Synchronize README translations and document the archive/permanent-delete
upgrade behavior in assets/releases/ver1-6-9.md.
Reduce initial JavaScript by deduplicating English resources and loading
animation features after hydration. Keep the existing route size budgets.
Update regression fixtures and browser audits for scoped URLs and the new
settings and learning interfaces.
Bind mastery drafts before their opening turn and preserve stored session modes.
Track chat duration from submission through terminal completion. Run async reading
extensions on their event loop and allow retries after cancellable timeouts.
Allow first uploads into empty LlamaIndex knowledge bases, preserve Telegram
thread routing, parse embedding Retry-After dates, and enforce robots rules and
host pacing during documentation crawls, including redirects.
Fixes#1461Fixes#1458Fixes#1451Fixes#1448Fixes#1392Fixes#1429
Refs #1435, #1412
Reuses contributions from PRs #1462, #1452 and #1403.
Co-authored-by: sjagadee <srini.jagadeesh@gmail.com>
Co-authored-by: AoHanBei <dongaohan21@gmail.com>
Co-authored-by: Gao-Chenkai <DevChenkai@outlook.com>
Empty LlamaIndex KBs and UID-mismatched volumes were reported as
"not initialized". Fail-fast on unwritable data dirs and remap the
non-root deeptutor user instead of swallowing chown failures.
Co-authored-by: Cursor <cursoragent@cursor.com>
A knowledge-base name is three things at once: a kb_config.json key, a
directory under data/knowledge_bases, and a path segment in every per-KB API
route. `validate_knowledge_base_name` exists to keep those three uses
compatible — its docstring says so — but it was called from one of the eight
HTTP entry points that can write a name into the config. The seven connect-*
endpoints (Obsidian, MarginNote, folder, LightRAG server, WeKnora, IMA, and
the subagent connection) did `(name or "").strip()` and wrote the result.
A name holding a "/" registers fine that way and is then unreachable.
uvicorn percent-decodes the path before routing, so %2F is a real separator
by the time Starlette matches `{kb_name}` — compiled to `[^/]+`, which cannot
span it. All 29 per-KB routes 404, delete included, while the list endpoint
takes no path parameter and keeps rendering the KB. Connected KBs are also
exempt from the orphan prune, so nothing collects it either: visible, unusable,
and removable only by hand-editing kb_config.json.
Two changes, both needed. Validation moves onto the eight `register_*`
methods, which is the seam every route already goes through — no route file
changes, since they all map ValueError to 400 — and the now-unreachable
"name is required" guards go with it. And a path-free
`POST /knowledge-bases/delete` gives the entries that predate the guard a way
out; a body is never split into segments. Widening the path route to
`{kb_name:path}` would not work: it is declared ahead of the DELETE routes
for linked folders, GitHub sources and web sources, and a greedy converter
would silently swallow all three.
Two smaller fixes ride along. The delete handler's catch-all swallowed its
own HTTPException and answered 500 with "404: ... not found" in the detail;
it now re-raises. And CreateKbModal states the rule under the field instead
of letting an untranslated English 400 be the first the user hears of it.
test_marginnote4_kb's store-collision case used "My Lib" / "My/Lib"; the
slash is now refused before that guard is reached, so it uses "My.Lib" —
still a name the rule allows, still sanitized to the same My_Lib.db.
Provisioning reached across modules for `KnowledgeBaseManager.config` and
`_save_config()`, which put a partner-workspace concern inside the manager's
private state. `register_connected_entry` states the operation instead: adopt
an entry that already exists, refuse anything that is not a pointer KB, and
report whether it was new so provisioning stays idempotent the way the
copytree branch is.
Ship lighter isolated runtimes, richer Books and Mastery flows,
Reading/session polish, and explicit model API capabilities.
Release notes: assets/releases/ver1-6-4.md