Repository navigation
Description
Is there an existing issue for the same bug?
- I have searched existing issues and this is not a duplicate.
Bug Description
GET /api/conversations/{conversation_id}/runtime raises 404 for an unknown conversation (conversation_router.py#L237-L245),`` and POST /api/conversations/{conversation_id}/runtime/reprovision delegates to it (#L254-L262).```` Neither declares `responses={404: …}`, so the OpenAPI document lists only 200 and 422 for both. Other routes in the same router declare their 404, for example `pause` (#L367).`````
The impact is small but real: generated clients, such as the one mirrored in clients/typescript/, and Schemathesis status-code conformance checks treat the 404 as unexpected.
Expected Behavior
Both routes declare 404 in their OpenAPI responses.
Actual Behavior
The responses for both routes are ['200', '422'].
Steps to Reproduce
Run the code sample below on main (28f4dfe).
Acceptance Criteria
- Both routes declare their 404 response.
- Optional: a test that checks every
/{conversation_id}route answers an unknown id only with codes it declares, so new routes can't drift.
SDK Version
main at 28f4dfe
Python Version
3.13
Operating System
Linux
Minimal Code Sample
from fastapi import FastAPI
from openhands.agent_server.conversation_router import conversation_router
app = FastAPI()
app.include_router(conversation_router, prefix="/api")
paths = app.openapi()["paths"]
print(sorted(paths["/api/conversations/{conversation_id}/runtime"]["get"]["responses"])) # ['200', '422']
print(sorted(paths["/api/conversations/{conversation_id}/runtime/reprovision"]["post"]["responses"])) # ['200', '422']
print(sorted(paths["/api/conversations/{conversation_id}/pause"]["post"]["responses"])) # ['200', '404', '422']Evidence and Additional Context
Found by a Hypothesis test over every /{conversation_id} route: for an unknown id, the answer is never 5xx and is always a declared status. On the parents of e98b956 (#5819) and 6d65010 (#5814) the same test also finds the 500 and undeclared-400 cases those PRs fixed. See #6486.
OpenHands AI triage
The following comments and acceptance criteria were added by the OpenHands AI agent.
Triage
Verified against main (28f4dfe): GET /api/conversations/{conversation_id}/runtime (openhands-agent-server/openhands/agent_server/conversation_router.py L237-L245) raises HTTPException(404) for an unknown conversation, POST .../runtime/reprovision (L254-L262) delegates to it, and neither declares responses={404: ...}, so the OpenAPI lists only 200 and 422. Sibling routes in the same router (pause, interrupt, delete, secrets, ...) already declare the 404, so the fix follows an established repository convention and needs no design decision.
Bounded scope: declare the 404 response on these two routes only, matching the sibling-route convention. Non-goals: no change to route behavior or status codes; no TypeScript client regeneration (clients/typescript/ mirrors 200-response schemas, which are unchanged, so generated types are unaffected and release-time schema sync remains the existing mechanism); no generic OpenAPI drift-test framework (the issue's optional criterion).
Priority rationale: the finding comes from a property-based (Hypothesis) test, not a user report, support evidence, or production impact, so it stays priority:low under the triage policy.
Acceptance Criteria
-
app.openapi()["paths"]["/api/conversations/{conversation_id}/runtime"]["get"]["responses"]includes a404entry, and the same holds for["/api/conversations/{conversation_id}/runtime/reprovision"]["post"]["responses"]- the issue's code sample prints['200', '404', '422']for both routes. - The declaration matches actual behavior: with an unknown conversation id, both routes respond exactly 404, as already exercised by
tests/agent_server/test_conversation_router.py::test_runtime_requires_existing_conversation. - The OpenAPI change is additive only: no existing path, method, response status, or component schema is removed or changed (e.g. a diff of
serialize_openapi(build_public_openapi())againstmain, or theagent-server-rest-api-breakageoasdiff check, shows no removals).
Activity
samarAli-7 commentedon Nov 5, 2026
Hi, I'd like to pick this up.
Reproduced on
main(28f4dfe):GET /api/conversations/{conversation_id}/runtimeandPOST /api/conversations/{conversation_id}/runtime/reprovisionboth advertise['200', '422'], whilePOST /api/conversations/{conversation_id}/pauseadvertises['200', '404', '422'].Plan:
responses={404: {"description": "Conversation not found"}}to both decorators, no behavior or status code change.404inapp.openapi().pytest tests/agent_server/test_conversation_router.py -k runtimeandmake test-server-schema.I'll open the PR once the checks pass.