feat: add stop_reason to runs (#2935)

This commit is contained in:
Sarah Wooders
2025-09-16 14:27:00 -07:00
committed by GitHub
parent 4af601db98
commit 8eef166c3a
10 changed files with 144 additions and 7 deletions

View File

@@ -9011,6 +9011,25 @@ async def test_list_jobs_filter_by_type(server: SyncServer, default_user, defaul
assert jobs[0].id == run.id
@pytest.mark.asyncio
async def test_list_jobs_by_stop_reason(server: SyncServer, sarah_agent, default_user):
"""Test listing jobs by stop reason."""
run_pydantic = PydanticRun(
user_id=default_user.id,
status=JobStatus.pending,
job_type=JobType.RUN,
stop_reason=StopReasonType.requires_approval,
)
run = await server.job_manager.create_job_async(pydantic_job=run_pydantic, actor=default_user)
assert run.stop_reason == StopReasonType.requires_approval
# list jobs by stop reason
jobs = await server.job_manager.list_jobs_async(actor=default_user, job_type=JobType.RUN, stop_reason=StopReasonType.requires_approval)
assert len(jobs) == 1
assert jobs[0].id == run.id
async def test_e2e_job_callback(monkeypatch, server: SyncServer, default_user):
"""Test that job callbacks are properly dispatched when a job is completed."""
captured = {}