@@ -282,10 +282,10 @@ impl Channel {
282282 _ = tokio:: time:: sleep( sleep_duration) , if next_deadline. is_some( ) => {
283283 let now = tokio:: time:: Instant :: now( ) ;
284284 // Check coalesce deadline
285- if self . coalesce_deadline. is_some_and( |d| d <= now) {
286- if let Err ( error) = self . flush_coalesce_buffer( ) . await {
287- tracing :: error! ( %error , channel_id = % self . id , "error flushing coalesce buffer on deadline" ) ;
288- }
285+ if self . coalesce_deadline. is_some_and( |d| d <= now)
286+ && let Err ( error) = self . flush_coalesce_buffer( ) . await
287+ {
288+ tracing :: error! ( %error , channel_id = % self . id , "error flushing coalesce buffer on deadline" ) ;
289289 }
290290 // Check retrigger deadline
291291 if self . retrigger_deadline. is_some_and( |d| d <= now) {
@@ -391,7 +391,10 @@ impl Channel {
391391
392392 if messages. len ( ) == 1 {
393393 // Single message - process normally
394- let message = messages. into_iter ( ) . next ( ) . ok_or_else ( || anyhow:: anyhow!( "empty iterator after length check" ) ) ?;
394+ let message = messages
395+ . into_iter ( )
396+ . next ( )
397+ . ok_or_else ( || anyhow:: anyhow!( "empty iterator after length check" ) ) ?;
395398 self . handle_message ( message) . await
396399 } else {
397400 // Multiple messages - batch them
@@ -462,10 +465,11 @@ impl Channel {
462465 . get ( "telegram_chat_type" )
463466 . and_then ( |v| v. as_str ( ) )
464467 } ) ;
465- self . conversation_context = Some (
466- prompt_engine
467- . render_conversation_context ( & first. source , server_name, channel_name) ?,
468- ) ;
468+ self . conversation_context = Some ( prompt_engine. render_conversation_context (
469+ & first. source ,
470+ server_name,
471+ channel_name,
472+ ) ?) ;
469473 }
470474
471475 // Persist each message to conversation log (individual audit trail)
@@ -605,8 +609,11 @@ impl Channel {
605609 let browser_enabled = rc. browser_config . load ( ) . enabled ;
606610 let web_search_enabled = rc. brave_search_key . load ( ) . is_some ( ) ;
607611 let opencode_enabled = rc. opencode . load ( ) . enabled ;
608- let worker_capabilities =
609- prompt_engine. render_worker_capabilities ( browser_enabled, web_search_enabled, opencode_enabled) ?;
612+ let worker_capabilities = prompt_engine. render_worker_capabilities (
613+ browser_enabled,
614+ web_search_enabled,
615+ opencode_enabled,
616+ ) ?;
610617
611618 let status_text = {
612619 let status = self . state . status_block . read ( ) . await ;
@@ -712,10 +719,11 @@ impl Channel {
712719 . get ( "telegram_chat_type" )
713720 . and_then ( |v| v. as_str ( ) )
714721 } ) ;
715- self . conversation_context = Some (
716- prompt_engine
717- . render_conversation_context ( & message. source , server_name, channel_name) ?,
718- ) ;
722+ self . conversation_context = Some ( prompt_engine. render_conversation_context (
723+ & message. source ,
724+ server_name,
725+ channel_name,
726+ ) ?) ;
719727 }
720728
721729 let system_prompt = self . build_system_prompt ( ) . await ?;
@@ -802,8 +810,11 @@ impl Channel {
802810 let browser_enabled = rc. browser_config . load ( ) . enabled ;
803811 let web_search_enabled = rc. brave_search_key . load ( ) . is_some ( ) ;
804812 let opencode_enabled = rc. opencode . load ( ) . enabled ;
805- let worker_capabilities = prompt_engine
806- . render_worker_capabilities ( browser_enabled, web_search_enabled, opencode_enabled) ?;
813+ let worker_capabilities = prompt_engine. render_worker_capabilities (
814+ browser_enabled,
815+ web_search_enabled,
816+ opencode_enabled,
817+ ) ?;
807818
808819 let status_text = {
809820 let status = self . state . status_block . read ( ) . await ;
@@ -814,17 +825,16 @@ impl Channel {
814825
815826 let empty_to_none = |s : String | if s. is_empty ( ) { None } else { Some ( s) } ;
816827
817- prompt_engine
818- . render_channel_prompt (
819- empty_to_none ( identity_context) ,
820- empty_to_none ( memory_bulletin. to_string ( ) ) ,
821- empty_to_none ( skills_prompt) ,
822- worker_capabilities,
823- self . conversation_context . clone ( ) ,
824- empty_to_none ( status_text) ,
825- None , // coalesce_hint - only set for batched messages
826- available_channels,
827- )
828+ prompt_engine. render_channel_prompt (
829+ empty_to_none ( identity_context) ,
830+ empty_to_none ( memory_bulletin. to_string ( ) ) ,
831+ empty_to_none ( skills_prompt) ,
832+ worker_capabilities,
833+ self . conversation_context . clone ( ) ,
834+ empty_to_none ( status_text) ,
835+ None , // coalesce_hint - only set for batched messages
836+ available_channels,
837+ )
828838 }
829839
830840 /// Register per-turn tools, run the LLM agentic loop, and clean up.
@@ -1147,8 +1157,10 @@ impl Channel {
11471157 for ( key, value) in retrigger_metadata {
11481158 self . pending_retrigger_metadata . insert ( key, value) ;
11491159 }
1150- self . retrigger_deadline =
1151- Some ( tokio:: time:: Instant :: now ( ) + std:: time:: Duration :: from_millis ( RETRIGGER_DEBOUNCE_MS ) ) ;
1160+ self . retrigger_deadline = Some (
1161+ tokio:: time:: Instant :: now ( )
1162+ + std:: time:: Duration :: from_millis ( RETRIGGER_DEBOUNCE_MS ) ,
1163+ ) ;
11521164 }
11531165 }
11541166
0 commit comments