LiveAgent icon indicating copy to clipboard operation
LiveAgent copied to clipboard

Startup can hang forever on the boot screen when the local service stops answering (2.0.16, after data migration)

Open xiaozhou26 opened this issue 3 weeks ago • 0 comments

Report

On 2.0.16, after clicking data migration, LiveAgent stays on the startup screen (bird icon and progress bar) and never opens.

What the code does

Two startup gates wait on the local K-brain service with no time limit and no way out:

  1. Settings gate (App.tsx hydrateSettings): AppBootShell stays up until loadPersistedSettingsWithDefaults() and kbrainSkillsAdapter.list() resolve. None of these K-brain requests has a timeout. The shell shows only the icon and a progress bar: no text, no timeout, no retry.
  2. History gate (main.tsx): startup awaits migrateAllHistoryOnce before mounting the app. Its K-brain requests (existence checks, import POSTs) and page reads had no time limit. Retry appeared only after an error, so a request that never settles keeps the screen up forever.

The migration marker includes the app version, so every upgrade runs a full legacy pass at startup. After a data-directory move, the storage scope changes and caches reset, which also forces a full re-pass.

Related defects on the same path:

  • data_dir_migrate: a failed fetch during the copy reconnects through kbrain_backend_connection → ensure_started, which can restart K-brain on the old root mid-copy. The shutdown also ran synchronously on the async runtime.
  • copy_entry: a FIFO in the data root goes through fs::copy, which blocks forever. A socket makes the copy fail.
  • pi_history_migration_page was a sync command, so it ran on the main thread.

Reproduction (isolated)

I built v2.0.16 from source with K-brain v0.107.29. It ran in a temp HOME / LIVEAGENT_DEV_HOME with synthetic 1.x data (2000 conversations). I froze the K-brain child with SIGSTOP once startup reached the history check. This is fault injection that simulates a backend that stops answering.

Result: the history pass finished and the app mounted, then the settings gate stayed on the bare boot shell. After 100 s there was still no text and no button. It moved on only after SIGCONT.

The exact trigger on the reporter's machine is not confirmed: their data was not examined.

xiaozhou26 avatar Nov 10 '26 07:11 xiaozhou26