Repository navigation
Description
Bug description
Selectable runtime mode uses a private UUID regex in RuntimeDispatchMiddleware. FastAPI accepts more UUID path forms than this regex accepts. For example, %7B<uuid>%7D is decoded as {uuid}, and urn:uuid:<uuid> is also valid. Both values resolve to the same conversation in FastAPI.
The middleware does not match these forms. A request for a Docker conversation therefore stays on the local route.
Expected behavior
The middleware must use the same UUID parsing rules as the typed FastAPI routes. All valid forms of one conversation ID must select the same runtime.
Actual behavior
The mismatch affects HTTP run and delete routes and the events and session WebSocket routes. A stopped Docker conversation can enter the local run path. A local delete also skips the Docker cleanup path.
Steps to reproduce
- Enable selectable runtime mode.
- Create a Docker provisioning manifest for a conversation.
- Send a run or delete request with
{uuid}orurn:uuid:<uuid>as the path value. - Observe that the middleware does not add the Docker route prefix.
Acceptance criteria
- HTTP and WebSocket dispatch parse one path segment with the shared UUID parser.
- Braced and URN UUID forms route a Docker conversation to its Docker handlers.
- Invalid UUID values remain on the public route for normal FastAPI validation.
- Canonical UUID routing and shared catalog reads do not change.
Follow-up to #5977.
@VascoSch92 Could you add ready-for-dev so the tested fix can enter today's release?
OpenHands AI triage
The following comments and acceptance criteria were added by the OpenHands AI agent.
Triage
Resolution: this issue was closed as completed because PR #6125 ("fix(agent-server): align hybrid UUID routing") merged into main. The ready-for-dev label is therefore not applied; the repository's readiness workflow only governs open issues. Priority is recorded as priority:low for the backlog record.
Scope: RuntimeDispatchMiddleware in openhands-agent-server/openhands/agent_server/docker_runtime/hybrid.py, which only runs in selectable-runtime mode (OH_CONVERSATION_RUNTIME_SELECTABLE). The agent-server is owned by this repository, so no cross-repo move was needed.
Evidence: the middleware's private _UUID regex matched only canonical and hyphenless forms, while the typed routes declare conversation_id: UUID. FastAPI/pydantic resolves {uuid}, urn:uuid:<uuid>, and 32-hex to the same UUID, and rejects not-a-uuid with 422. A Docker conversation addressed with a braced or URN value was therefore left on the local route. The affected entry points are the HTTP routes under /api/conversations/{conversation_id}... (including run and delete) and the /sockets/events/{conversation_id} and /sockets/session/{conversation_id} WebSockets.
Priority: priority:low. There is no human discussion, user report, support evidence, or reproduced failure in a live workflow. The report is a code-inspection finding with a synthetic reproducer, which is speculative for prioritization purposes.
Non-goals: no change to the public REST/WebSocket contract or OpenAPI schema; no change to non-selectable single-runtime servers; no change to the shared catalog read (GET/HEAD /api/conversations/{conversation_id}); no new authentication or permission surface; operations intentionally unsupported in Docker mode (for example fork, switch_llm, switch_profile) stay unsupported.
Acceptance Criteria
These are the criteria that applied while the issue was open; PR #6125 is the reference implementation for them.
- In selectable mode, a run (
POST /api/conversations/{id}/run) or delete (DELETE /api/conversations/{id}) for a conversation with a Docker provisioning manifest is dispatched to the Docker handlers (rewritten under the/_dockerroute prefix) when the{id}segment is any form the typed routes accept: canonical, hyphenless 32-hex, braced{uuid}, orurn:uuid:<uuid>. - The same dispatch holds for the
/sockets/events/{id}and/sockets/session/{id}WebSocket routes. - A path segment the typed routes reject (for example
not-a-uuid) is not rewritten to the Docker prefix, so it remains on the public route and FastAPI returns its normal validation result (HTTP 422; the WebSocket equivalent). - Dispatch parsing is not more permissive than the typed routes: a value pydantic's
UUIDvalidation rejects, such as an unmatched brace{<uuid>, is not routed to Docker. - Canonical UUID routing is unchanged, and the shared catalog read is unchanged:
GET/HEAD /api/conversations/{id}for a Docker conversation still serves the local catalog record. - Deleting a Docker conversation through an alternate UUID form takes the Docker delete path (container cleanup) rather than the local delete path.
- With
OH_CONVERSATION_RUNTIME_SELECTABLEunset, behavior is unchanged and no dispatch rewriting occurs. -
uv run pytest tests/agent_server/docker_runtime/test_hybrid.pypasses, including a regression test for the braced and URN forms that fails on the pre-fixmain.
Activity