Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(workflow_runs): handle missing todo schema gracefully

Steven Enamakel2ec9d108cd28
diff --git a/crates/openhuman-core/src/agent/orchestration/workflow_runs/engine.rs b/crates/openhuman-core/src/agent/orchestration/workflow_runs/engine.rs
index b107db50b2..60647982a3 100644
--- a/crates/openhuman-core/src/agent/orchestration/workflow_runs/engine.rs
+++ b/crates/openhuman-core/src/agent/orchestration/workflow_runs/engine.rs
@@ -39,9 +39,33 @@
//! interrupt→checkpoint→resume path once a human-review phase kind exists. The
//! current between-phase cancellation bookkeeping is intentionally left in place
//! until that phase kind lands, to keep stop/resume semantics unchanged.
+//!
+//! ## Module layout
+//!
+//! - [`cancel`] — the process-wide per-run cancellation registry.
+//! - [`state`] — `phase_states` shape, dependency walk, prompt building, and
+//! the shared `persist` write.
+//! - [`scheduler`] — the `dispatch` step: pick the next runnable phase.
+//! - [`phase_exec`] — the `run_phase` step: fan a phase's agents out.
+//! - [`lifecycle`] — `start`/`stop`/`resume` and the spawned engine loop.
+
+mod cancel;
+mod lifecycle;
+mod phase_exec;
+mod scheduler;
+mod state;
#[cfg(test)]
#[path = "engine_tests.rs"]
mod engine_tests;
-include!("engine_part_01.rs");
-include!("engine_part_02.rs");
+
+pub(super) const LOG_TARGET: &str = "workflow_run_engine";
+
+pub use lifecycle::{resume_workflow_run, start_workflow_run, stop_workflow_run};
+pub(crate) use phase_exec::{execute_phase, PhaseExecOutcome};
+pub(crate) use scheduler::{select_next_phase, PhaseSelection};
+
+#[cfg(test)]
+pub(super) use lifecycle::run_engine_loop;
+#[cfg(test)]
+pub(super) use state::init_phase_states;
diff --git a/crates/openhuman-core/src/threads/todos/schemas/registry.rs b/crates/openhuman-core/src/threads/todos/schemas/registry.rs
new file mode 100644
index 0000000000..dc88d77b59
--- /dev/null
+++ b/crates/openhuman-core/src/threads/todos/schemas/registry.rs
@@ -0,0 +1,87 @@
+//! Controller schema and registered-controller lists for the `todos`
+//! namespace.
+
+use crate::core::all::RegisteredController;
+use crate::core::ControllerSchema;
+
+use super::handlers::{
+ handle_add, handle_clear, handle_decide_plan, handle_edit, handle_list, handle_reclaim_stale,
+ handle_remove, handle_replace, handle_revise_plan, handle_run_get, handle_run_list,
+ handle_set_session_thread, handle_update_status,
+};
+use super::schema_defs::schemas;
+
+pub fn all_controller_schemas() -> Vec<ControllerSchema> {
+ vec![
+ schemas("list"),
+ schemas("add"),
+ schemas("edit"),
+ schemas("update_status"),
+ schemas("set_session_thread"),
+ schemas("decide_plan"),
+ schemas("revise_plan"),
+ schemas("remove"),
+ schemas("replace"),
+ schemas("clear"),
+ schemas("run_list"),
+ schemas("run_get"),
+ schemas("reclaim_stale"),
+ ]
+}
+
+pub fn all_registered_controllers() -> Vec<RegisteredController> {
+ vec![
+ RegisteredController {
+ schema: schemas("list"),
+ handler: handle_list,
+ },
+ RegisteredController {
+ schema: schemas("add"),
+ handler: handle_add,
+ },
+ RegisteredController {
+ schema: schemas("edit"),
+ handler: handle_edit,
+ },
+ RegisteredController {
+ schema: schemas("update_status"),
+ handler: handle_update_status,
+ },
+ RegisteredController {
+ schema: schemas("set_session_thread"),
+ handler: handle_set_session_thread,
+ },
+ RegisteredController {
+ schema: schemas("decide_plan"),
+ handler: handle_decide_plan,
+ },
+ RegisteredController {
+ schema: schemas("revise_plan"),
+ handler: handle_revise_plan,
+ },
+ RegisteredController {
+ schema: schemas("remove"),
+ handler: handle_remove,
+ },
+ RegisteredController {
+ schema: schemas("replace"),
+ handler: handle_replace,
+ },
+ RegisteredController {
+ schema: schemas("clear"),
+ handler: handle_clear,
+ },
+ RegisteredController {
+ schema: schemas("run_list"),
+ handler: handle_run_list,
+ },
+ RegisteredController {
+ schema: schemas("run_get"),
+ handler: handle_run_get,
+ },
+ RegisteredController {
+ schema: schemas("reclaim_stale"),
+ handler: handle_reclaim_stale,
+ },
+ ]
+}