mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-02 07:10:15 +08:00
When the persisted ``status`` in ``kb_config.json`` is still a "live" sentinel (``processing`` / ``initializing``) but a flat ``version-N`` directory on disk is already ready, ``get_info()`` previously returned ``status="processing"`` because the elif chain had no branch to recover the case. The UI therefore showed a perpetual "Processing…" banner even though the KB was fully usable. This typically happens when the progress writer or worker process crashes after the LlamaIndex version is finalised but before ``update_kb_status(name, "ready")`` rewrites kb_config.json — the on-disk truth and the persisted status diverge. Fix: in ``get_info``, after the existing ``effective_needs_reindex`` short-circuit, add a branch that promotes status to ``"ready"`` when: - status is currently ``processing`` or ``initializing``, - a ready ``version-N`` exists (``has_ready_llamaindex``), - and the persisted progress stage is not ``error``. The ``error`` guard preserves visibility of genuine indexing failures when an older ready version still exists. The promotion clears the stale progress banner to match the existing semantic in ``update_kb_status`` (where ready KBs drop progress). The persistent ``kb_config.json`` is left untouched on read; the next legitimate ``update_kb_status`` call cleans it up. 7 new tests in ``tests/knowledge/test_manager_get_info_status.py`` cover the headline #418 reproduction, the completed-stage variant, the ``initializing`` variant, and the negative cases (error stage, no ready version yet, ready-status pass-through, mismatched-signature -> needs_reindex precedence).