feat(host-agent): renew active assignment leases
This commit is contained in:
@@ -96,6 +96,41 @@ def test_workflow_runner_linear_planned_goal_completes(tmp_path) -> None:
|
||||
assert [result.step_id for result in run.step_results] == ["first", "second"]
|
||||
|
||||
|
||||
def test_workflow_runner_stops_before_the_next_step(tmp_path) -> None:
|
||||
stop_requested = False
|
||||
calls: list[str] = []
|
||||
|
||||
class StoppingTaskRunner:
|
||||
def run(self, task: Task, *, should_stop=None) -> Task:
|
||||
nonlocal stop_requested
|
||||
calls.append(task.goal)
|
||||
stop_requested = True
|
||||
task.status = "completed"
|
||||
return task
|
||||
|
||||
definition = WorkflowDefinition(
|
||||
name="interruptible",
|
||||
entry_step_id="first",
|
||||
steps=[
|
||||
PlannedGoalStep("first", "first", next_step_id="second"),
|
||||
PlannedGoalStep("second", "second"),
|
||||
],
|
||||
)
|
||||
runner = WorkflowRunner(
|
||||
_store(tmp_path),
|
||||
task_runner_factory=lambda: StoppingTaskRunner(), # type: ignore[arg-type]
|
||||
)
|
||||
|
||||
run = runner.run(
|
||||
definition,
|
||||
"phone",
|
||||
should_stop=lambda: stop_requested,
|
||||
)
|
||||
|
||||
assert run.status == "cancelled"
|
||||
assert calls == ["first"]
|
||||
|
||||
|
||||
def test_workflow_runner_failing_planned_goal_marks_run_failed(tmp_path) -> None:
|
||||
definition = WorkflowDefinition(
|
||||
name="fail",
|
||||
|
||||
Reference in New Issue
Block a user