Fix SQLite recovery and preserve provider conversation context

Persist exact provider history and archived tool results independently of
terminal scrollback, and retain them when active run checkpoints are cleared.
Keep conversation and session saving independent of automatic reopening.

Deduplicate only committed session snapshots, retry transient SQLite write
contention, and enqueue conversation updates before writer shutdown. Recover
healthy startup data independently and protect unread records by disabling
writes with a persistent warning after an incomplete restore. Retain local
transcript pane conversation links across restarts.

Add regression coverage for SQLite failures, context round trips, legacy
fallbacks, and transcript snapshots.
This commit is contained in:
2026-09-20 16:40:44 -05:00
parent 316f53471b
commit d7fbc09bcf
21 changed files with 714 additions and 185 deletions
@@ -83,7 +83,14 @@ pub fn convert_persisted_conversation_to_ai_conversation_with_metadata(
}
};
let conversation_data = serde_json::from_str::<AgentConversationData>(&conversation_data).ok();
let conversation_data = match serde_json::from_str::<AgentConversationData>(&conversation_data)
{
Ok(data) => Some(data),
Err(error) => {
log::error!("Failed to restore conversation {conversation_id} metadata: {error}");
return None;
}
};
// Local-DB restore: an empty `agent_tasks` row is the normal shape of a
// child conversation persisted before its first server response, so