paseo icon indicating copy to clipboard operation
paseo copied to clipboard

Windows & mobile: conversations re-fetched from daemon on every app restart — slow, and fetches sometimes fail

Open kouyichi opened this issue 3 months ago • 4 comments

Summary

On the Windows desktop app and the iOS/Android mobile apps, closing and reopening the app causes all conversations to be re-fetched from the daemon. With many conversations this is slow, and a noticeable fraction of the time some fetches fail — leaving conversations stuck on a loading spinner (or with missing content) until you retry manually.

Expected behavior

  • Previously seen conversation lists and previously opened conversations should render instantly from a local cache on cold start, then reconcile with the daemon in the background (stale-while-revalidate).
  • A timeline fetch failure should not leave a conversation blank: show whatever cached content exists and retry silently in the background.

Repro

  1. Open the Windows desktop app (or mobile app) against a remote/LAN daemon — mobile typically goes over relay — and let the full conversation list load; open a few conversations.
  2. Quit the app completely, then reopen it.
  3. Observe: the sidebar (agent directory) takes a long time to populate, and opening a previously viewed conversation shows a loading spinner while its timeline is re-fetched over the network. Occasionally the fetch fails and the conversation stays empty until retried.

What I found in the code

  • packages/app/src/runtime/replica-cache/index.ts persists a byte-bounded (32 MiB) replica of directory metadata (projects/workspaces/agents) plus only the focused agent's timeline tail — other conversations' content is not cached at all.
  • PR #3259 ("Restore host directories instantly before reconnect") fixed the directory side, but explicitly lists "No additional timeline caching beyond the existing focused-agent tail" as a non-goal — so after every restart, every other conversation's history is still fetched over the network when opened.
  • packages/app/src/runtime/directory-sync/index.ts (fetchAgents, 200/page) re-syncs the directory on connect; when the daemon has restarted (new generation), the fallback is a full snapshot re-fetch of all conversations.
  • On mobile, fetchAgentTimeline travels over LAN/relay, which is slower and more failure-prone than a local read. Related: #1828 (messages dropped from client timeline when history sync fails), #1829 (keep timeline rendered when history sync fails), #2220 (timeline fetch exceeds relay message cap on image-heavy sessions), #538 (perf with idle agents holding large timelines).

Suggested improvements

  1. Extend the persisted replica cache to keep the timeline (or at least a bounded tail) of recently opened conversations, not just the focused one — LRU-bounded, like the existing whole-host eviction.
  2. On cold start, paint cached conversations immediately and reconcile in the background via the existing cursor/sync mechanism instead of blocking on a full re-fetch.
  3. On timeline fetch failure, fall back to the cached tail with a subtle stale/offline indicator and silent background retry (retry machinery already exists in viewed-timeline-sync.ts — "background retries stay silent").

Environment

  • paseo CLI 0.4.0 (server/daemon)
  • Windows desktop app
  • iOS / Android mobile app
  • Connections: mobile via LAN/relay; Windows via direct connection

Related

#3259 #1828 #1829 #2220 #538 #1041

kouyichi avatar Aug 20 '26 09:08 kouyichi

Your cold-start case has a follow-up fix in v0.8.0.

#3907 painted cached conversations after restart and closed this issue in v0.7.0. That paint was still discarded when live activity arrived while the cache was being read from disk. The conversation fell back to the network fetch and showed the spinner again, and the cached sidebar was dropped entirely when the directory revision changed mid-read. Restarting with agents actively running, which is the situation your repro describes, could still land on the old behavior.

#4436 keeps both. Cached conversation rows now reconcile beneath the live head instead of being thrown away, and cached projects, workspaces, and agents merge beneath live state instead of being abandoned.

This does not do the first item on your list. Paseo still persists only the focused agent's timeline tail, so opening a different previously viewed conversation after a restart still fetches it over the network.

Thanks for the report. Naming the explicit non-goal in #3259 and pointing at viewed-timeline-sync.ts is what made the remaining gap easy to find.

paseo-bot[bot] avatar Sep 18 '26 13:09 paseo-bot[bot]

There's another improvement for reopening cached chats after an app restart in PR #7074: opening a cached chat or workspace on a host will no longer wait for a different agent on that host to stop streaming. This addresses a loading stall alongside the earlier cold-start fixes; it does not add caching for every previously viewed conversation or fix failed network fetches.

It is merged and will be in the next release. The current release, v0.11.4, does not contain it, and the next version number is not decided yet. To get it sooner, watch the repository's releases, where changes often appear in a beta before the stable release.

Thanks for describing the restart workflow and the gaps you hit.

paseo-bot[bot] avatar Oct 16 '26 01:10 paseo-bot[bot]

The wait for the sidebar to populate after reconnect gets an adjacent improvement in #7242: loading the workspace list will start alongside the project list, removing one network wait. This does not expand which conversations are cached or address the failed timeline fetches you described. Thanks for explaining the restart workflow.

The change is merged and will be in the next release; the next version number is not decided yet. The current stable release, v0.11.4, and current beta, v0.12.0-beta.1, do not contain it. Watch Paseo releases if you want it sooner, changes often appear in a beta before stable.

paseo-bot[bot] avatar Oct 17 '26 15:10 paseo-bot[bot]

Reopening an unchanged cached chat gets another improvement in merged PR #9175: the app checks whether it is current and skips re-fetching its messages when the daemon still has the agent loaded. This does not expand which chats are cached or remove waits to resume an unloaded agent; both the app and host need the change.

paseo-bot[bot] avatar Nov 09 '26 11:11 paseo-bot[bot]