status_check - #31
Conversation
…AGENT_STATUS and map to /api/supervaizer/agents/{agent_slug}/status the controller contract a dedicated status route.
Update contracts tests to assert new endpoint name resolved, ensuring API contract consistency.
- Add HTTP POST / route handler response model changed to JobResponse and update the handler return type accordingly the endpoint returns standardized job statuss.
- integration test that posts to the agent status endpoint and verifies_id, status and payload fields are returned; confirms agent.job is wired and serialized correctly.
- Change logging in case methods from info to debug to avoid noisy logs normal operation.
…erifies POST //{slug}/status returns the agent'sjob_status as a JobResponse. The test patches Agent.job_statusreturn aResponse with job_id, EntityStatus_PROGRESS, message, mounts the agents routes the app, sends a request withjob_id and the200 response and that job_id status andpayload fields match the patched response.
Also import JobResponse and EntityStatus in the tests to construct theexpected response object and check the returned status string This ensures status endpoint correctly agent job status responses to the APIoutput.
…w test that verifies POST /agents/{slug}/status returns theagent's job_status response as a JobResponse with correct job_idstatus, message, and payload. Patch Agent.job_status return aJobResponse with EntityStatus.IN_PROGRESS and assert the API mapsthe status and payload values correctly.
This ensures the status route preserves and exposes jobmetadata (id, status, payload) for clients and guards againstregressions in status serialization.
Review Summary by QodoAdd agent status endpoint with standardized JobResponse model
WalkthroughsDescription• Add POST /api/supervaizer/agents/{agent_slug}/status endpoint returning JobResponse
• Implement standardized job status response with job_id, status, and payload fields
• Add integration test verifying status endpoint returns correct job metadata
• Update controller contract to include new POST_AGENT_STATUS endpoint
• Reduce logging noise by changing case methods from info to debug level
Diagramflowchart LR
A["Agent Status Request"] -->|POST /status| B["status_agent Handler"]
B -->|calls| C["agent.job_status"]
C -->|returns| D["JobResponse"]
D -->|serialized| E["Client Response"]
F["ControllerEndpoint"] -->|maps| G["POST_AGENT_STATUS"]
G -->|routes to| B
File Changes1. src/supervaizer/case.py
|
Code Review by Qodo
1.
|
…ks off the event loop byexecuting them in background threads via.to_thread. - Await dynamic_choices in routes.start using asyncio.to_thread to avoid blocking the loop computing choices. - Run agent.job_stop and agent.job_status in asyncio.to_thread from the HTTP POST handlers so synchronous user code cannot block request processing. - Update POST /status responses to include200/400/404/500 models clearer OpenAPI descriptions. - Document synchronous behavior in Agent._execute, job_stop and job_status docstrings to clarify that controller endpoints should call them from worker threads. This long-running user code from blocking the async server andpro API documentation for/response cases
…int to use JobResponse as mainmodel and an explicit200 status in the route decoratorFastAPI the correct response code default. AlignAPIschema reference JobResponse and add detailed error (400, 404,500 referencing ErrorResponse improve API documentation andclient handling. This makes endpoint behavior and docsconsistent and clearer consumers
What changed- Added POST /api/supervaizeragents/{agent_slug}/ endpoint (Controller.POST_AGENT_STATUS) and mapped route.
Why- Expose agent job status via a dedicated, standardized route so clients can reliably obtain job metadata.
Notes- Tests patch Agent.job_status to return JobResponse with EntityStatus to validate mapping and serialization.