@@ -56,7 +56,7 @@ pub(super) fn check_cloud_handoff_input(app: &mut App, trimmed: &str) -> bool {
5656 }
5757 if app. has_unsent_handoff_work ( Some ( trimmed) ) {
5858 app. push_display_message ( DisplayMessage :: error (
59- "Cloud handoff not queued: unsent messages, commands, draft text, or attachments would be lost. Send or save them , then retry /cloud or /local. Nothing was removed." . to_string ( ) ,
59+ format ! ( "Cloud handoff not queued: {} would be lost. Send or save that work , then retry /cloud or /local. Nothing was removed." , app . unsent_handoff_work ( Some ( trimmed ) ) . join ( ", " ) ) ,
6060 ) ) ;
6161 return false ;
6262 }
@@ -289,20 +289,48 @@ impl App {
289289 }
290290
291291 fn has_unsent_handoff_work ( & self , accepted_command : Option < & str > ) -> bool {
292+ !self . unsent_handoff_work ( accepted_command) . is_empty ( )
293+ }
294+
295+ // Report categories, never private draft contents, so an empty-looking
296+ // composer does not leave users guessing which queue blocked the move.
297+ fn unsent_handoff_work ( & self , accepted_command : Option < & str > ) -> Vec < & ' static str > {
292298 let draft = self . input . trim ( ) ;
293- ( !draft. is_empty ( ) && accepted_command != Some ( draft) )
294- || !self . queued_messages . is_empty ( )
295- || !self . queued_commands . is_empty ( )
296- || !self . hidden_queued_system_messages . is_empty ( )
297- || !self . pending_images . is_empty ( )
298- || !self . pasted_contents . is_empty ( )
299- || self
300- . interleave_message
301- . as_ref ( )
302- . is_some_and ( |text| !text. is_empty ( ) )
303- || !self . interleave_images . is_empty ( )
304- || !self . pending_soft_interrupts . is_empty ( )
305- || !self . pending_soft_interrupt_requests . is_empty ( )
299+ [
300+ (
301+ !draft. is_empty ( ) && accepted_command != Some ( draft) ,
302+ "composer draft" ,
303+ ) ,
304+ ( !self . queued_messages . is_empty ( ) , "queued messages" ) ,
305+ ( !self . queued_commands . is_empty ( ) , "queued commands" ) ,
306+ (
307+ !self . hidden_queued_system_messages . is_empty ( ) ,
308+ "queued system reminders" ,
309+ ) ,
310+ ( !self . pending_images . is_empty ( ) , "image attachments" ) ,
311+ ( !self . pasted_contents . is_empty ( ) , "pasted contents" ) ,
312+ (
313+ self . interleave_message
314+ . as_ref ( )
315+ . is_some_and ( |text| !text. is_empty ( ) ) ,
316+ "pending interleave message" ,
317+ ) ,
318+ (
319+ !self . interleave_images . is_empty ( ) ,
320+ "pending interleave images" ,
321+ ) ,
322+ (
323+ !self . pending_soft_interrupts . is_empty ( ) ,
324+ "pending interrupts" ,
325+ ) ,
326+ (
327+ !self . pending_soft_interrupt_requests . is_empty ( ) ,
328+ "unacknowledged interrupts" ,
329+ ) ,
330+ ]
331+ . into_iter ( )
332+ . filter_map ( |( present, label) | present. then_some ( label) )
333+ . collect ( )
306334 }
307335
308336 /// Shared by polling and deterministic dispatch tests. No process starts here.
@@ -318,9 +346,12 @@ impl App {
318346 if changed_session || self . has_unsent_handoff_work ( None ) {
319347 self . pending_cloud_handoff = None ;
320348 let reason = if changed_session {
321- "the active session changed. Retry /cloud or /local from the session you want to move"
349+ "the active session changed. Retry /cloud or /local from the session you want to move" . to_string ( )
322350 } else {
323- "unsent messages, commands, draft text, or attachments would be lost. Send or save them, then retry /cloud or /local"
351+ format ! (
352+ "{} would be lost. Send or save that work, then retry /cloud or /local" ,
353+ self . unsent_handoff_work( None ) . join( ", " )
354+ )
324355 } ;
325356 self . push_display_message ( DisplayMessage :: error ( format ! (
326357 "Pending cloud handoff canceled: {reason}. Nothing was removed."
@@ -728,6 +759,27 @@ mod tests {
728759 ]
729760 }
730761
762+ #[ test]
763+ fn handoff_error_identifies_blocking_queue_without_its_contents ( ) {
764+ let mut app = crate :: tui:: app:: tests:: create_test_app ( ) ;
765+ let session = super :: super :: commands:: active_session_id ( & app) ;
766+ app. hidden_queued_system_messages
767+ . push ( "private reminder" . into ( ) ) ;
768+ handle_cloud_command ( & mut app, "/cloud" , & session) ;
769+ let error = & app. display_messages . last ( ) . unwrap ( ) . content ;
770+ assert ! ( error. contains( "queued system reminders would be lost" ) ) ;
771+ assert ! ( !error. contains( "private reminder" ) ) ;
772+
773+ app. hidden_queued_system_messages . clear ( ) ;
774+ app. pending_cloud_handoff = Some ( pending ( CloudCommand :: Return , & session) ) ;
775+ app. pending_soft_interrupt_requests
776+ . push ( ( 1 , "private interrupt" . into ( ) ) ) ;
777+ assert ! ( app. take_ready_cloud_handoff( ) . is_none( ) ) ;
778+ let error = & app. display_messages . last ( ) . unwrap ( ) . content ;
779+ assert ! ( error. contains( "unacknowledged interrupts would be lost" ) ) ;
780+ assert ! ( !error. contains( "private interrupt" ) ) ;
781+ }
782+
731783 #[ test]
732784 fn acceptance_refuses_unsent_state_without_consuming_it ( ) {
733785 for ( label, populate) in unsent_cases ( ) {
0 commit comments