From 12a60a88b470c3851007f315dd14860ae5b53278 Mon Sep 17 00:00:00 2001 From: Konstantin M Date: Thu, 9 Jul 2026 03:44:55 +0000 Subject: [PATCH] perf(webui/session-load-latency) tier3e: fix empty-scene inconclusive prefix read (Greptile P1) When cached session has no anchor_activity_scenes and the prefix reader returns None (e.g. sidecar too large for prefix), the empty-scenes path did not mark _scene_check_inconclusive = True. This meant an inactive session with matching message counts would return False (cache fresh) even though disk may have gained its first scene record. Fix: the empty-scenes else-branch now sets _scene_check_inconclusive when disk_meta_quick is None, matching the existing behavior in the cached-scenes branch (line 3173). The code then falls through to the full metadata comparison instead of serving a stale cache. discussion_r3548650345 --- api/models.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/api/models.py b/api/models.py index 68e68560..38c3dfc0 100644 --- a/api/models.py +++ b/api/models.py @@ -3180,6 +3180,12 @@ def _cached_session_lags_disk(cached) -> bool: disk_scenes = disk_meta_quick.get('anchor_activity_scenes') or {} if isinstance(disk_scenes, dict) and disk_scenes: return True + else: + # Prefix read failed (may still succeed via index fallback for + # message count). Mark inconclusive so we fall through to the + # full metadata comparison instead of returning False with + # stale cache. Greptile P1 (discussion_r3548650345). + _scene_check_inconclusive = True if getattr(cached, 'active_stream_id', None) or getattr(cached, 'pending_user_message', None): # Active session: messages may be in flight; fall through to the # full check to be safe.