fix(ecc2): honor configured worktree policy in daemon dispatch

This commit is contained in:
Harry committed 2026-10-28 12:49:48 +08:00
1 parent b0a4551adf
commit d3bc76e61e
2 files changed
+9 -7

No files matched your search

+4 -4
View File
@@ -132,7 +132,7 @@ async fn maybe_auto_dispatch(db: &StateStore, cfg: &Config) -> Result<usize> {
db,
cfg,
&cfg.default_agent,
true,
cfg.auto_create_worktrees,
cfg.max_parallel_sessions,
)
},
@@ -155,7 +155,7 @@ async fn coordinate_backlog_cycle(db: &StateStore, cfg: &Config) -> Result<()> {
db,
cfg,
&cfg.default_agent,
true,
cfg.auto_create_worktrees,
cfg.max_parallel_sessions,
)
},
@@ -170,7 +170,7 @@ async fn coordinate_backlog_cycle(db: &StateStore, cfg: &Config) -> Result<()> {
db,
cfg,
&cfg.default_agent,
true,
cfg.auto_create_worktrees,
cfg.max_parallel_sessions,
)
},
@@ -320,7 +320,7 @@ async fn maybe_auto_rebalance(db: &StateStore, cfg: &Config) -> Result<usize> {
db,
cfg,
&cfg.default_agent,
true,
cfg.auto_create_worktrees,
cfg.max_parallel_sessions,
)
},
+5 -3
View File
@@ -7666,6 +7666,7 @@ mod tests {
let mut cfg = build_config(tempdir.path());
cfg.auto_dispatch_limit_per_session = 5;
cfg.auto_create_worktrees = false;
let db = StateStore::open(&cfg.db_path)?;
let now = Utc::now();
db.insert_session(&Session {
@@ -7690,10 +7691,11 @@ mod tests {
"task_handoff",
)?;
let first_tick = auto_dispatch_backlog(&db, &cfg, "claude", true, 10).await?;
let first_tick = auto_dispatch_backlog(&db, &cfg, "claude", cfg.auto_create_worktrees, 10).await?;
assert_eq!(first_tick.len(), 1);
assert_eq!(first_tick[0].routed.len(), 1);
let child_id = first_tick[0].routed[0].session_id.clone();
assert!(db.get_session(&child_id)?.unwrap().worktree.is_none());
assert_eq!(
db.latest_task_handoff_source(&child_id)?.as_deref(),
Some("parent")
@@ -7710,7 +7712,7 @@ mod tests {
})?;
db.send_message("parent", &child_id, &native_notice, "task_handoff")?;
assert_eq!(db.unread_task_handoff_count(&child_id)?, 0);
let second_tick = auto_dispatch_backlog(&db, &cfg, "claude", true, 10).await?;
let second_tick = auto_dispatch_backlog(&db, &cfg, "claude", cfg.auto_create_worktrees, 10).await?;
assert!(second_tick.is_empty());
assert_eq!(db.delegated_children("parent", 10)?, vec![child_id.clone()]);
assert!(db.delegated_children(&child_id, 10)?.is_empty());
@@ -7726,7 +7728,7 @@ mod tests {
"task_handoff",
)?;
assert_eq!(db.unread_task_handoff_count(&child_id)?, 1);
let explicit_tick = auto_dispatch_backlog(&db, &cfg, "claude", true, 10).await?;
let explicit_tick = auto_dispatch_backlog(&db, &cfg, "claude", cfg.auto_create_worktrees, 10).await?;
assert!(explicit_tick
.iter()
.any(|outcome| { outcome.lead_session_id == child_id && outcome.routed.len() == 1 }));