feat: OpenHands Gateway and V1 routing for self-hosted deployments + agent-canvas backend support#14909
Open
kripper wants to merge 12 commits into
Open
feat: OpenHands Gateway and V1 routing for self-hosted deployments + agent-canvas backend support#14909kripper wants to merge 12 commits into
kripper wants to merge 12 commits into
Conversation
6 tasks
- Added POST /{conversation_id}/pause proxy endpoint forwarding to agent-server
- Uses _get_agent_server_context to resolve agent-server URL and session key
- Modified pauseConversation to check VITE_ENABLE_WEBSOCKET_GATEWAY flag
Refactor conversation_router.py:
- Extract _proxy_to_agent_server() and _resolve_agent_server_context() helpers
- Refactor pause_conversation to use shared helpers
- Add resume_conversation (POST /api/conversations/{id}/run)
- Add events_count (GET /api/conversations/{id}/events/count)
Add git_changes proxy to git_router.py:
- GET /api/v1/git/changes?conversation_id={id}&path={p}
Update frontend services for gateway routing (same pattern as pause):
- resumeConversation, getEventCount, getGitChanges: gateway path via openHands
- Add POST /{conversation_id}/ask_agent proxy with 600s timeout for LLM calls
- Refactor _proxy_to_agent_server() to accept optional timeout param
(httpx 0.28+ send() drops timeout kwarg - use dedicated client)
- Read request.body() once upfront instead of single-use request.stream()
Add git/diff proxy to git_router.py:
- GET /api/v1/git/diff proxy endpoint
Update frontend services for gateway routing:
- askAgent: gateway path via openHands
- getGitChangeDiff: gateway path via openHands with conversationId
- When app-server local event store is empty, proxy search/count requests to agent-server so V1 conversations can still list and count their events - Added _proxy_request() helper and _get_agent_server_context lazy import - search_events falls back to agent-server when local store has no items - count_events falls back to agent-server when local store returns zero
openhands.core.logger was removed in newer SDK versions. Switch to openhands.app_server.utils.logger which is the local replacement.
feat: add gateway WebSocket URL to AppConversation and improve sandbox_spec fallback (sandbox_spec/condenser part)
… integration - POST /oauth/device/authorize — returns device_code, user_code, verification URIs - POST /oauth/device/token — polled by client; returns authorization_pending → access_token - POST /oauth/device/verify-authenticated — confirms authorization from browser popup - GET /oauth/device/verify — self-contained HTML authorization page Uses X-Forwarded-Proto for scheme detection with https fallback for known cloud domains. Registered in app.py.
dcf7581 to
dc014e3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
HUMAN:
Verified.
Why
To have agent+canvas + OH containers + OH self-hosted
Description
Requires: OpenHands/agent-canvas#1435
How to Test
ENABLE_WEBSOCKET_GATEWAY=true. This enables the websocket gateway on the backend.VITE_ENABLE_WEBSOCKET_GATEWAY="true"infrontend/.envand rebuild the front end. This makes the websockets use relative urls and use the same host and port of the web app.SANDBOX_CONTAINER_URL_PATTERN="http://127.0.0.1:{port}"(change to the IP of your dockerd host).Type