Skip to content

πŸ™Œ OpenHands: AI-Driven Development

fix 404 issue for /config (#5114)

Robert Brennan6b893863982b
diff --git a/frontend/src/api/open-hands.ts b/frontend/src/api/open-hands.ts
index 072588ce47..33f08d94f2 100644
--- a/frontend/src/api/open-hands.ts
+++ b/frontend/src/api/open-hands.ts
@@ -185,8 +185,7 @@ class OpenHands {
}
static async getRuntimeId(): Promise<{ runtime_id: string }> {
- const response = await request("/api/config");
- const data = await response.json();
+ const data = await request("/api/conversation");
return data;
}
diff --git a/openhands/server/listen.py b/openhands/server/listen.py
index c1b178b9c2..8724daf190 100644
--- a/openhands/server/listen.py
+++ b/openhands/server/listen.py
@@ -11,7 +11,6 @@ import requests
from pathspec import PathSpec
from pathspec.patterns import GitWildMatchPattern
-from openhands.runtime.impl.remote.remote_runtime import RemoteRuntime
from openhands.security.options import SecurityAnalyzers
from openhands.server.data_models.feedback import FeedbackDataModel, store_feedback
from openhands.server.github import (
@@ -565,27 +564,21 @@ def sanitize_filename(filename):
return filename
[email protected]('/api/config')
[email protected]('/api/conversation')
async def get_remote_runtime_config(request: Request):
"""Retrieve the remote runtime configuration.
Currently, this is the runtime ID.
"""
- try:
- runtime = request.state.conversation.runtime
- if isinstance(runtime, RemoteRuntime):
- return JSONResponse(content={'runtime_id': runtime.runtime_id})
- else:
- return JSONResponse(
- status_code=status.HTTP_404_NOT_FOUND,
- content={'error': 'Runtime ID not available in this environment'},
- )
- except Exception as e:
- logger.error(e)
- return JSONResponse(
- status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
- content={'error': 'Something went wrong'},
- )
+ runtime = request.state.conversation.runtime
+ runtime_id = runtime.runtime_id if hasattr(runtime, 'runtime_id') else None
+ session_id = runtime.sid if hasattr(runtime, 'sid') else None
+ return JSONResponse(
+ content={
+ 'runtime_id': runtime_id,
+ 'session_id': session_id,
+ }
+ )
@app.post('/api/upload-files')