@@ -117,17 +117,20 @@ impl DualModeOrchestrator {
117117 ConcurrencyController :: new (
118118 workflow. concurrency . global_max ,
119119 ModeQuotas {
120- time_max : workflow. concurrency . global_max . saturating_sub ( workflow. concurrency . issue_max ) ,
120+ time_max : workflow
121+ . concurrency
122+ . global_max
123+ . saturating_sub ( workflow. concurrency . issue_max ) ,
121124 issue_max : workflow. concurrency . issue_max ,
122125 } ,
123- workflow. concurrency . fairness . parse ( ) . unwrap_or ( FairnessPolicy :: RoundRobin ) ,
126+ workflow
127+ . concurrency
128+ . fairness
129+ . parse ( )
130+ . unwrap_or ( FairnessPolicy :: RoundRobin ) ,
124131 )
125132 } else {
126- ConcurrencyController :: new (
127- 10 ,
128- ModeQuotas :: default ( ) ,
129- FairnessPolicy :: RoundRobin ,
130- )
133+ ConcurrencyController :: new ( 10 , ModeQuotas :: default ( ) , FairnessPolicy :: RoundRobin )
131134 } ;
132135
133136 // Create shared state
@@ -143,9 +146,13 @@ impl DualModeOrchestrator {
143146
144147 // Setup time mode
145148 let time_mode = {
146- let scheduler = TimeScheduler :: new ( & config. agents , Some ( & config. compound_review . schedule ) ) ?;
149+ let scheduler =
150+ TimeScheduler :: new ( & config. agents , Some ( & config. compound_review . schedule ) ) ?;
147151 let shutdown_rx = state. shutdown_tx . subscribe ( ) ;
148- Some ( TimeModeComponents { scheduler, shutdown_rx } )
152+ Some ( TimeModeComponents {
153+ scheduler,
154+ shutdown_rx,
155+ } )
149156 } ;
150157
151158 // Setup issue mode if configured
@@ -154,7 +161,11 @@ impl DualModeOrchestrator {
154161 match create_tracker ( workflow) {
155162 Ok ( tracker) => {
156163 let shutdown_rx = state. shutdown_tx . subscribe ( ) ;
157- Some ( IssueModeComponents { tracker, workflow : workflow. clone ( ) , shutdown_rx } )
164+ Some ( IssueModeComponents {
165+ tracker,
166+ workflow : workflow. clone ( ) ,
167+ shutdown_rx,
168+ } )
158169 }
159170 Err ( e) => {
160171 warn ! ( "failed to create issue tracker: {}" , e) ;
@@ -245,14 +256,14 @@ impl DualModeOrchestrator {
245256 /// Shutdown gracefully.
246257 async fn shutdown ( & mut self ) {
247258 info ! ( "initiating graceful shutdown" ) ;
248-
259+
249260 // Stop accepting new tasks
250261 self . request_shutdown ( ) ;
251262
252263 // Wait for active agents to complete
253264 let timeout = Duration :: from_secs ( 30 ) ;
254265 let start = std:: time:: Instant :: now ( ) ;
255-
266+
256267 loop {
257268 let active_count = {
258269 let agents = self . active_agents . lock ( ) . await ;
@@ -265,7 +276,10 @@ impl DualModeOrchestrator {
265276 }
266277
267278 if start. elapsed ( ) > timeout {
268- warn ! ( "shutdown timeout reached with {} agents still active" , active_count) ;
279+ warn ! (
280+ "shutdown timeout reached with {} agents still active" ,
281+ active_count
282+ ) ;
269283 break ;
270284 }
271285
@@ -274,7 +288,7 @@ impl DualModeOrchestrator {
274288
275289 // Shutdown base orchestrator
276290 self . base . shutdown ( ) ;
277-
291+
278292 info ! ( "shutdown complete" ) ;
279293 }
280294
@@ -291,12 +305,19 @@ impl DualModeOrchestrator {
291305 }
292306
293307 /// Trigger compound review.
294- pub async fn trigger_compound_review ( & mut self ) -> Result < CompoundReviewResult , crate :: OrchestratorError > {
308+ pub async fn trigger_compound_review (
309+ & mut self ,
310+ ) -> Result < CompoundReviewResult , crate :: OrchestratorError > {
295311 self . base . trigger_compound_review ( ) . await
296312 }
297313
298314 /// Handoff task between agents.
299- pub async fn handoff ( & mut self , from_agent : & str , to_agent : & str , ctx : HandoffContext ) -> Result < ( ) , crate :: OrchestratorError > {
315+ pub async fn handoff (
316+ & mut self ,
317+ from_agent : & str ,
318+ to_agent : & str ,
319+ ctx : HandoffContext ,
320+ ) -> Result < ( ) , crate :: OrchestratorError > {
300321 self . base . handoff ( from_agent, to_agent, ctx) . await
301322 }
302323}
@@ -305,7 +326,10 @@ impl DualModeOrchestrator {
305326async fn run_time_mode ( components : TimeModeComponents , state : SharedState ) {
306327 info ! ( "starting time mode task" ) ;
307328
308- let TimeModeComponents { mut scheduler, mut shutdown_rx } = components;
329+ let TimeModeComponents {
330+ mut scheduler,
331+ mut shutdown_rx,
332+ } = components;
309333
310334 // Get immediate agents (Safety layer)
311335 let immediate = scheduler. immediate_agents ( ) ;
@@ -353,7 +377,11 @@ async fn run_time_mode(components: TimeModeComponents, state: SharedState) {
353377async fn run_issue_mode ( components : IssueModeComponents , state : SharedState ) {
354378 info ! ( "starting issue mode task" ) ;
355379
356- let IssueModeComponents { tracker, workflow, mut shutdown_rx } = components;
380+ let IssueModeComponents {
381+ tracker,
382+ workflow,
383+ mut shutdown_rx,
384+ } = components;
357385
358386 let poll_interval = Duration :: from_secs ( workflow. poll_interval_secs ) ;
359387
@@ -363,7 +391,7 @@ async fn run_issue_mode(components: IssueModeComponents, state: SharedState) {
363391 match tracker. fetch_candidate_issues( ) . await {
364392 Ok ( issues) => {
365393 info!( count = issues. len( ) , "fetched candidate issues" ) ;
366-
394+
367395 for issue in issues {
368396 // Skip blocked issues
369397 if !issue. all_blockers_terminal( & workflow. tracker. states. terminal) {
@@ -416,11 +444,15 @@ fn create_tracker(workflow: &WorkflowConfig) -> Result<Box<dyn IssueTracker>, St
416444 active_states : workflow. tracker . states . active . clone ( ) ,
417445 terminal_states : workflow. tracker . states . terminal . clone ( ) ,
418446 use_robot_api : workflow. tracker . use_robot_api ,
419- } ) . map_err ( |e| format ! ( "failed to create Gitea tracker: {}" , e) ) ?;
420-
447+ } )
448+ . map_err ( |e| format ! ( "failed to create Gitea tracker: {}" , e) ) ?;
449+
421450 Ok ( Box :: new ( tracker) )
422451 }
423- _ => Err ( format ! ( "unsupported tracker kind: {}" , workflow. tracker. kind) ) ,
452+ _ => Err ( format ! (
453+ "unsupported tracker kind: {}" ,
454+ workflow. tracker. kind
455+ ) ) ,
424456 }
425457}
426458
0 commit comments