test(agent): wire TestRig job tools through the scheduler (#716)

Align TestRig with the production agent wiring so create_job exercises the real scheduler path instead of silently falling back to an unscheduled context-only job. Tighten the e2e assertion to lock in the in-progress scheduler behavior for future refactors.

Made-with: Cursor

Co-authored-by: Zaki Manian <[email protected]>
This commit is contained in:
Protocol Zero
2026-03-08 20:40:03 +00:00
committed by GitHub
co-authored by Zaki Manian
parent 461d7712e8
commit 732b3ecfeb
2 changed files with 19 additions and 8 deletions
+10
View File
@@ -242,6 +242,16 @@ mod tests {
"create_job should return a job_id: {:?}",
create_result.1
);
assert!(
create_result.1.contains("in_progress"),
"create_job should dispatch through the scheduler, not stay pending: {:?}",
create_result.1
);
assert!(
!create_result.1.contains("scheduler unavailable"),
"create_job should not fall back to the unscheduled path: {:?}",
create_result.1
);
let status_result = results
.iter()
.find(|(n, _)| n == "job_status")
+9 -8
View File
@@ -545,16 +545,14 @@ impl TestRigBuilder {
.await
.expect("AppBuilder::build_all() failed in test rig");
let scheduler_slot: ironclaw::tools::builtin::SchedulerSlot =
Arc::new(tokio::sync::RwLock::new(None));
// 6. Register job tools, routine tools, and extra tools.
{
use ironclaw::context::ContextManager;
let ctx_mgr = Arc::new(ContextManager::new(
components.config.agent.max_parallel_jobs,
));
components.tools.register_job_tools(
ctx_mgr,
None,
Arc::clone(&components.context_manager),
Some(scheduler_slot.clone()),
None,
components.db.clone(),
None,
@@ -657,10 +655,13 @@ impl TestRigBuilder {
None, // heartbeat_config
None, // hygiene_config
routine_config,
None, // context_manager
Some(Arc::clone(&components.context_manager)),
None, // session_manager
);
// Match main.rs: fill the scheduler slot once Agent::new has created it.
*scheduler_slot.write().await = Some(agent.scheduler());
// 9. Spawn agent in background task.
let agent_handle = tokio::spawn(async move {
if let Err(e) = agent.run().await {