huskies: merge 1006
This commit is contained in:
@@ -24,27 +24,9 @@ pub(crate) fn spawn_event_bridges(
|
||||
// filesystem watcher or from a CRDT sync peer.
|
||||
{
|
||||
let crdt_watcher_tx = watcher_tx.clone();
|
||||
let crdt_prune_root = project_root.clone();
|
||||
if let Some(mut crdt_rx) = crate::crdt_state::subscribe() {
|
||||
tokio::spawn(async move {
|
||||
while let Ok(evt) = crdt_rx.recv().await {
|
||||
if matches!(
|
||||
evt.to_stage,
|
||||
crate::pipeline_state::Stage::Archived { .. }
|
||||
| crate::pipeline_state::Stage::Abandoned { .. }
|
||||
| crate::pipeline_state::Stage::Superseded { .. }
|
||||
| crate::pipeline_state::Stage::Rejected { .. }
|
||||
) && let Some(root) = crdt_prune_root.as_ref().cloned()
|
||||
{
|
||||
let story_id = evt.story_id.clone();
|
||||
tokio::spawn(async move {
|
||||
let config =
|
||||
crate::config::ProjectConfig::load(&root).unwrap_or_default();
|
||||
crate::worktree::remove_worktree_by_story_id(&root, &story_id, &config)
|
||||
.await
|
||||
.ok();
|
||||
});
|
||||
}
|
||||
let (action, commit_msg) =
|
||||
io::watcher::stage_metadata(&evt.to_stage, &evt.story_id);
|
||||
let watcher_evt = io::watcher::WatcherEvent::WorkItem {
|
||||
@@ -66,6 +48,14 @@ pub(crate) fn spawn_event_bridges(
|
||||
// ensures that MergeFailure and other non-"active" stages are covered
|
||||
// without any per-stage special-casing.
|
||||
if let Some(root) = project_root {
|
||||
// Worktree lifecycle subscribers: create worktrees on Stage::Coding
|
||||
// and remove them on terminal stages (Done, Archived, Abandoned, Superseded).
|
||||
crate::agents::pool::worktree_lifecycle::spawn_worktree_create_subscriber(
|
||||
root.clone(),
|
||||
agents.port(),
|
||||
);
|
||||
crate::agents::pool::worktree_lifecycle::spawn_worktree_cleanup_subscriber(root.clone());
|
||||
|
||||
// Mergemaster auto-spawn subscriber: reacts to TransitionFired events for
|
||||
// Stage::MergeFailure { kind: ConflictDetected } and spawns mergemaster
|
||||
// directly from the typed event, eliminating the predicate-mismatch
|
||||
|
||||
Reference in New Issue
Block a user