@@ -214,6 +214,7 @@ pub struct TodoChange {
214214 pub kind : TodoChangeKind ,
215215}
216216
217+ #[ allow( deprecated) ]
217218impl From < & Context > for ContextSummary {
218219 fn from ( value : & Context ) -> Self {
219220 let mut messages = vec ! [ ] ;
@@ -274,7 +275,9 @@ impl From<&Context> for ContextSummary {
274275 tool_results. insert ( call_id, tool_result) ;
275276 }
276277 }
277- ContextMessage :: Image ( _) => { }
278+ ContextMessage :: Image ( _) => {
279+ buffer. push ( SummaryMessage :: Text ( "[1 image(s) attached]" . to_string ( ) ) ) ;
280+ }
278281 }
279282 }
280283
@@ -311,6 +314,14 @@ fn extract_summary_messages(text_msg: &TextMessage, current_todos: &[Todo]) -> V
311314 blocks. push ( SummaryMessage :: Text ( text_msg. content . clone ( ) ) ) ;
312315 }
313316
317+ // Note image attachments in summary so LLM knows they existed
318+ if !text_msg. images . is_empty ( ) {
319+ blocks. push ( SummaryMessage :: Text ( format ! (
320+ "[{} image(s) attached]" ,
321+ text_msg. images. len( )
322+ ) ) ) ;
323+ }
324+
314325 // Add tool call blocks if present
315326 if let Some ( calls) = & text_msg. tool_calls {
316327 blocks. extend ( calls. iter ( ) . filter_map ( |tool_call| {
@@ -873,7 +884,8 @@ mod tests {
873884 }
874885
875886 #[ test]
876- fn test_context_summary_ignores_image_messages ( ) {
887+ #[ allow( deprecated) ]
888+ fn test_context_summary_includes_image_note ( ) {
877889 let fixture = context ( vec ! [
878890 user( "User message" ) ,
879891 ContextMessage :: Image ( crate :: Image :: new_base64(
@@ -886,7 +898,13 @@ mod tests {
886898 let actual = ContextSummary :: from ( & fixture) ;
887899
888900 let expected = ContextSummary :: new ( vec ! [
889- SummaryBlock :: new( Role :: User , vec![ Block :: content( "User message" ) ] ) ,
901+ SummaryBlock :: new(
902+ Role :: User ,
903+ vec![
904+ Block :: content( "User message" ) ,
905+ Block :: content( "[1 image(s) attached]" ) ,
906+ ] ,
907+ ) ,
890908 SummaryBlock :: new( Role :: Assistant , vec![ Block :: content( "Assistant" ) ] ) ,
891909 ] ) ;
892910
0 commit comments