refactor(#2591): model a DAG as a container node — grouping side-tables become graph walks

This commit is contained in:
atlas 2026-07-20 22:33:43 +02:00 committed by mara
commit a78280feed
4 changed files with 362 additions and 324 deletions

View file

@ -106,9 +106,10 @@ fn handle_completion(coord: &Arc<Coordinator>, done: NodeDone) {
.job_queue
.append_subgraph(claim.dag_id, subgraph, claim.node_id);
}
coord
let terminal = coord
.job_queue
.complete_node(claim.dag_id, claim.node_id, Ok(()));
fire_terminal_hook(coord, terminal);
}
Err(e) => {
let msg = format!("{e:#}");
@ -120,9 +121,10 @@ fn handle_completion(coord: &Arc<Coordinator>, done: NodeDone) {
error = %msg,
"job_queue: node failed"
);
coord
let terminal = coord
.job_queue
.complete_node(claim.dag_id, claim.node_id, Err(msg));
fire_terminal_hook(coord, terminal);
}
}
// The next loop iteration re-reconciles the transient pills against the
@ -130,6 +132,19 @@ fn handle_completion(coord: &Arc<Coordinator>, done: NodeDone) {
coord.emit_rebuild_queue_snapshot();
}
/// Fire a settled DAG's inline terminal hook (approval-resolve / rebuilt-emit /
/// intent-revert) off the container-terminal summary `complete_node` returned —
/// spawned so the async hook doesn't block the scheduler loop.
fn fire_terminal_hook(coord: &Arc<Coordinator>, terminal: Option<super::TerminalDag>) {
let Some(terminal) = terminal else {
return;
};
let coord = Arc::clone(coord);
tokio::spawn(async move {
exec::run_terminal_hook(&coord, &terminal).await;
});
}
/// Reconcile the transient-guard set against live lease ownership: drop pills
/// whose lease is no longer held, create one for each newly-held `(dag, agent)`.
fn reconcile_transients(