chore: anchor fresh-start history to upstream
This commit is contained in:
@@ -40,7 +40,6 @@ _EPHEMERAL_SCAFFOLDING_FLAGS = (
|
||||
_IMAGE_PART_TYPES = {"image", "image_url", "input_image"}
|
||||
# Reasoning/codex fields are role-gated (assistant-only) inside _insert_message_rows.
|
||||
_ROW_REASONING_KEYS = ("reasoning", "reasoning_content", "reasoning_details", "codex_reasoning_items", "codex_message_items")
|
||||
_PERSIST_AFTER_ADMISSION_INTERRUPT = "_persist_after_admission_interrupt"
|
||||
|
||||
|
||||
def _is_ephemeral_scaffolding(msg: Any) -> bool:
|
||||
@@ -177,6 +176,7 @@ def _db_flush_row(agent, msg: Dict, is_current_turn_user: bool) -> Dict[str, Any
|
||||
**{k: msg.get(k) for k in _ROW_REASONING_KEYS},
|
||||
"_compressed_summary": bool(msg.get(COMPRESSED_SUMMARY_METADATA_KEY)),
|
||||
"timestamp": timestamp, "api_content": api_content,
|
||||
"api_content_sources": msg.get("api_content_sources"),
|
||||
"display_kind": _summary_display_kind(msg), "display_metadata": msg.get("display_metadata"),
|
||||
"platform_message_id": msg.get("platform_message_id"), # load-bearing for restart drain-window recovery dedup
|
||||
}
|
||||
@@ -202,9 +202,7 @@ def _db_flush_collect(agent, messages: List[Dict], conversation_history: Optiona
|
||||
if not isinstance(msg, dict) or _is_ephemeral_scaffolding(msg) or msg.get(_DB_PERSISTED_MARKER):
|
||||
continue
|
||||
# Already durable (history copy or caller-seeded): stamp so future flushes skip it.
|
||||
if (
|
||||
id(msg) in history_ids or id(msg) in seed_ids
|
||||
) and not msg.get(_PERSIST_AFTER_ADMISSION_INTERRUPT):
|
||||
if id(msg) in history_ids or id(msg) in seed_ids:
|
||||
msg[_DB_PERSISTED_MARKER] = True
|
||||
continue
|
||||
batch_rows.append(_db_flush_row(agent, msg, ov_idx == msg_idx or msg is pending_cli_message))
|
||||
|
||||
Reference in New Issue
Block a user