@@ -317,30 +317,35 @@ pub async fn run_interactive(
317317 println ! ( ) ;
318318
319319 // Try to restore from history_snapshot (new format with full context)
320- let restored_from_snapshot =
321- if let Some ( history_json) = & record. history_snapshot {
322- match ConversationHistory :: from_json ( history_json) {
323- Ok ( restored) => {
324- conversation_history = restored;
325- // Rebuild raw_chat_history from restored conversation_history
326- raw_chat_history = conversation_history. to_messages ( ) ;
327- println ! (
320+ let restored_from_snapshot = if let Some ( history_json) =
321+ & record. history_snapshot
322+ {
323+ match ConversationHistory :: from_json ( history_json) {
324+ Ok ( restored) => {
325+ conversation_history = restored;
326+ // Rebuild raw_chat_history from restored conversation_history
327+ raw_chat_history = conversation_history. to_messages ( ) ;
328+ println ! (
328329 "{}" ,
329330 " ✓ Restored full conversation context (including compacted history)" . green( )
330331 ) ;
331- true
332- }
333- Err ( e) => {
334- eprintln ! (
335- "{}" ,
336- format!( " Warning: Failed to restore history snapshot: {}" , e) . yellow( )
337- ) ;
338- false
339- }
332+ true
340333 }
341- } else {
342- false
343- } ;
334+ Err ( e) => {
335+ eprintln ! (
336+ "{}" ,
337+ format!(
338+ " Warning: Failed to restore history snapshot: {}" ,
339+ e
340+ )
341+ . yellow( )
342+ ) ;
343+ false
344+ }
345+ }
346+ } else {
347+ false
348+ } ;
344349
345350 // Fallback: Load from messages (old format or if snapshot failed)
346351 if !restored_from_snapshot {
@@ -359,13 +364,13 @@ pub async fn run_interactive(
359364 persistence:: MessageRole :: Assistant => {
360365 raw_chat_history
361366 . push ( rig:: completion:: Message :: Assistant {
362- id : Some ( msg. id . clone ( ) ) ,
363- content : rig:: one_or_many:: OneOrMany :: one (
364- rig:: completion:: message:: AssistantContent :: text (
365- & msg. content ,
366- ) ,
367+ id : Some ( msg. id . clone ( ) ) ,
368+ content : rig:: one_or_many:: OneOrMany :: one (
369+ rig:: completion:: message:: AssistantContent :: text (
370+ & msg. content ,
367371 ) ,
368- } ) ;
372+ ) ,
373+ } ) ;
369374 }
370375 persistence:: MessageRole :: System => { }
371376 }
0 commit comments