Release v0.51.319 — Release KI (Phase 3 light: refresh stale continuation metadata, #3789) (#3795)
Some checks failed
Release & Docker / release (push) Has been cancelled

Phase-3-LOW. #3789 (@ai-ag2026, refs #3740): refresh stale-indexed compression continuation rows from sidecar; gate excludes session_source='fork' (release-gate MUST-FIX). Full suite 8213, Opus SHIP, Codex MUST-FIX applied, CI 11/11. Co-authored-by: ai-ag2026 <ai-ag2026@users.noreply.github.com>
This commit is contained in:
nesquena-hermes
2026-06-07 13:12:23 -07:00
committed by GitHub
parent ce9adc5e2c
commit 2e1aa3c99c
3 changed files with 132 additions and 7 deletions

View File

@@ -2610,11 +2610,27 @@ def _row_may_need_sidecar_metadata_refresh(
)
if is_runtime_row:
return True
sid = str(session.get('session_id') or '')
if not session.get('pre_compression_snapshot'):
return False
# Refresh a stale-indexed COMPRESSION CONTINUATION row from its sidecar.
# Gate tightly: a plain /branch fork also carries parent_session_id
# (#1342) but has no compression sidecar drift to correct, and its file
# mtime routinely exceeds the indexed logical last_message_at — so
# including forks here would call load_metadata_only() on every fork row
# on every /api/sessions poll (the molasses #3770 guards against, per the
# #3789 release gate). Exclude session_source == 'fork'
# (the marker /api/session/branch stamps; see _is_continuation_session)
# so only true continuations are eligible.
if str(session.get('session_source') or '').strip().lower() == 'fork':
return False
lineage_shaped = bool(
session.get('parent_session_id')
or session.get('_lineage_root_id')
or session.get('_compression_segment_count')
)
return bool(lineage_shaped and sid and _sidecar_mtime_after_index_timestamp(session))
if session.get('message_count') is None or session.get('last_message_at') is None:
return True
sid = str(session.get('session_id') or '')
return bool(sid and stale_snapshot_ids and sid in stale_snapshot_ids)