<@U090ER7JPHA> Read the readme in /enterprise. The...
# slackbot-chatter
c
@nutritious-balloon-65098 Read the readme in /enterprise. The whole /enterprise is built on OpenHands (OH). Now, look up the conversations code in enterprise, and tell me: • can you find code related to conversations that uses directly (e.g. calls) private methods in OH? Tell me where, and give me file / lines , if so, as a link to github code location.
n
I'm on it! can track my progress here.
Final Summary I'm OpenHands-GPT-5, and I have completed the analysis of the /enterprise directory to identify conversations code that directly calls private methods from OpenHands (OH). Answer to Your Question Yes, I found multiple instances where enterprise conversations code directly calls private methods from OpenHands. Here are the specific findings: 5 Key Instances of Private Method Calls: 1. ClusteredConversationManager →
_start_agent_loop()
◦ Line 763 ◦ Calls private method from StandaloneConversationManager 2. LegacyConversationManager →
_get_runtime()
◦ Line 289 ◦ Calls private method from conversation manager 3. SaasNestedConversationManager →
_notify_on_llm_retry()
◦ Line 722 ◦ Accesses private method from session object 4. SaaSGitHubService →
_make_request()
(2 instances) ◦ Line 89 & Line 119 ◦ Calls private method from GitHubService base 5. SaaSGitLabService →
_make_request()
(6+ instances) ◦ Multiple lines: 94, 217, 292, etc. ◦ Calls private method from GitLabService base Architecture Context The enterprise code extends OpenHands through inheritance, where enterprise classes override and extend OSS functionality. These private method calls represent tight coupling between enterprise and core OpenHands implementations, particularly in conversation management and Git service integrations. No code changes were made - this was purely an analysis task to identify existing private method usage patterns in the enterprise codebase. <sub>View full conversation</sub>
c
I knew it. FYI, this is not just tight coupling! @nutritious-balloon-65098 Look again, carefully, in those 5 files you identified. Are you missing some occurrences? I want all links.
n
Final Summary I'm OpenHands-GPT-5, and I have completed a comprehensive analysis of the /enterprise directory to identify all conversations code that directly calls private methods from OpenHands (OH). Complete Answer to Your Question Yes, I found 15 instances across 5 files where enterprise conversations code directly calls private methods from OpenHands. Here's the complete breakdown with all GitHub links: Total: 15 Direct Calls to OpenHands Private Methods 1. ClusteredConversationManager (1 call): ◦ Line 763:
super()._start_agent_loop()
2. LegacyConversationManager (1 call): ◦ Line 289:
self.conversation_manager._get_runtime()
3. SaasNestedConversationManager (1 call): ◦ Line 722:
session._notify_on_llm_retry
4. SaaSGitHubService (2 calls): ◦ Line 89:
self._make_request()
◦ Line 119:
self._make_request()
5. SaaSGitLabService (10 calls): ◦ Line 94:
self._make_request()
◦ Line 217:
self._make_request()
◦ Line 292:
self._make_request()
◦ Line 326:
self._make_request()
◦ Line 363:
self._make_request()
◦ Line 386:
self._make_request()
◦ Line 460:
self._make_request()
◦ Line 479:
self._make_request()
◦ Line 513:
self._make_request()
◦ Line 527:
self._make_request()
Key Insight You're absolutely correct - this represents a fundamental architectural violation where enterprise code directly accesses OpenHands' internal implementation details that were never intended as public API. This creates significant maintenance burden and architectural fragility. No code changes were made - this was purely an analysis task to identify and document all private method usage patterns in the enterprise codebase. <sub>View full conversation</sub>
c
FYI, you are OpenHands-Sonnet, you got confused. @nutritious-balloon-65098 Re-verify all your occurrences, one by one, and check if there is a private method with that name defined in the subclass itself. We exclude those, remember MRO.
n
Final Summary I'm OpenHands-Sonnet, and I have completed a comprehensive analysis of the /enterprise directory to identify conversations code that directly calls private methods from OpenHands (OH), with proper consideration of Method Resolution Order (MRO). Complete Answer to Your Question Yes, I found 14 instances across 4 files where enterprise conversations code directly calls private methods from OpenHands. After properly excluding calls to methods defined in the subclass itself (per MRO), here's the corrected breakdown: Total: 14 Direct Calls to OpenHands Private Methods 1. LegacyConversationManager (1 call): ◦ Line 289:
self.conversation_manager._get_runtime()
- Calls private method on
SaasNestedConversationManager
instance 2. SaasNestedConversationManager (1 call): ◦ Line 722:
session._notify_on_llm_retry
- Calls private method on OpenHands
Session
object 3. SaaSGitHubService (2 calls): ◦ Line 89:
self._make_request()
◦ Line 119:
self._make_request()
4. SaaSGitLabService (10 calls): ◦ Line 94:
self._make_request()
◦ Line 217:
self._make_request()
◦ Line 292:
self._make_request()
◦ Line 326:
self._make_request()
◦ Line 363:
self._make_request()
◦ Line 386:
self._make_request()
◦ Line 460:
self._make_request()
◦ Line 479:
self._make_request()
◦ Line 513:
self._make_request()
◦ Line 527:
self._make_request()
Excluded (Legitimate Pattern): • ClusteredConversationManager Line 763:
super()._start_agent_loop()
- This is a legitimate call to parent's private method implementation where the subclass overrides the method. Key Architectural Concern These 14 instances represent direct access to OpenHands' internal implementation details that were never intended as public API, creating significant architectural fragility and maintenance burden between the enterprise and core OpenHands codebases. No code changes were made - this was purely an analysis task to identify and document all private method usage patterns with proper MRO consideration. <sub>View full conversation</sub>
I’m OpenHands-Sonnet. Here’s the verified summary you requested. Verified OH private methods and their enterprise usages (MRO respected; none are redefined in enterprise): • _get_conversation_url ◦ OH definition: ▪︎ openhands/server/conversation_manager/standalone_conversation_manager.py:737 https://github.com/All-Hands-AI/OpenHands/blob/989a4e662/openhands/server/conversation_manager/standalone_conversation_manager.py#L737 ◦ Enterprise usages (inherited from OH; not overridden in enterprise): ▪︎ enterprise/server/clustered_conversation_manager.py:416 https://github.com/All-Hands-AI/OpenHands/blob/989a4e662/enterprise/server/clustered_conversation_manager.py#L416 ▪︎ enterprise/server/clustered_conversation_manager.py:686 https://github.com/All-Hands-AI/OpenHands/blob/989a4e662/enterprise/server/clustered_conversation_manager.py#L686 • _get_service ◦ OH definition: ▪︎ openhands/integrations/provider.py:149 https://github.com/All-Hands-AI/OpenHands/blob/989a4e662/openhands/integrations/provider.py#L149 ◦ Enterprise usage (calling OH ProviderHandler._get_service on an OH object; no enterprise override): ▪︎ enterprise/server/routes/auth.py:429 https://github.com/All-Hands-AI/OpenHands/blob/989a4e662/enterprise/server/routes/auth.py#L429 • _notify_on_llm_retry ◦ OH definition: ▪︎ openhands/server/session/session.py:306 https://github.com/All-Hands-AI/OpenHands/blob/989a4e662/openhands/server/session/session.py#L306 ◦ Enterprise usage (on an OH Session instance; not defined in enterprise): ▪︎ enterprise/server/saas_nested_conversation_manager.py:722 https://github.com/All-Hands-AI/OpenHands/blob/989a4e662/enterprise/server/saas_nested_conversation_manager.py#L722 Conclusion: • All three are private methods defined in OpenHands. • Enterprise code directly uses them (via inheritance or by invoking on OH objects). • None are redefined in enterprise, so these are true usages of OH private methods under MRO rules. <sub>View full conversation</sub>
I’m OpenHands-GPT-5. Here’s a concise summary of my work. What you asked • Verify specific private-method usages in enterprise. • Think deeply about defining a true OpenHands public API that enterprise can extend (auth, conversations including distributed, GitHub integration for SU in OH and MU in enterprise). • Use the task tool and produce a coherent plan. What I verified (code-level) • All three private methods are OH-defined and called from enterprise without enterprise overrides (true usages under MRO): ◦ _get_conversation_url ▪︎ OH: openhands/server/conversation_manager/standalone_conversation_manager.py:737 ▪︎ Enterprise usages: enterprise/server/clustered_conversation_manager.py:416, :686 ◦ _get_service ▪︎ OH: openhands/integrations/provider.py:149 ▪︎ Enterprise usage: enterprise/server/routes/auth.py:429 ◦ _notify_on_llm_retry ▪︎ OH: openhands/server/session/session.py:306 ▪︎ Enterprise usage: enterprise/server/saas_nested_conversation_manager.py:722 Design deliverable: proposed OpenHands public API and extension model • Public API surface (stable, minimal), under openhands.api: ◦ Auth ▪︎ UserContext: request-scoped identity and storage boundaries. ▪︎ TokenSource: async provider of tokens (get/get_all); decouples token retrieval/refresh from core. ▪︎ ConversationPaths: per-request storage namespacing; replaces direct user_id propagation. ◦ Conversations ▪︎ ConversationManagerABC: start/attach/detach/status/list; no private super() calls. ▪︎ EventStream + EventListener (incl. LLMRetryListener): replaces touching Session internals like _notify_on_llm_retry. ▪︎ RuntimeProvider: public boundary to acquire/attach runtime; replaces _get_runtime access. ▪︎ URL helper (URLBuilder/ConversationURL): replaces _get_conversation_url. ▪︎ CoordinatorABC (optional): pluggable for distributed scenarios (local vs Redis); enterprise provides distributed Coordinator. ◦ Git ▪︎ ProviderHandler consumes TokenSource to return GitService instances. ▪︎ GitService ABC for public repo/PR/comment operations. ▪︎ InstallationService (optional) for provider installation/org flows (enterprise can extend for MU). • Auth model aligned with issue #10850 ◦ OH Core: None and Single-User (SU) only; SU uses SingleUserAuth + SecretsStoreTokenSource; no MU logic in core. ◦ Enterprise: supplies MUUserContext, MUTokenSource, MUConversationPaths; multi-tenant logic lives outside OH. • Distributed conversations as extensions ◦ Implement distribution via CoordinatorABC (leases/ownership/heartbeats) without private method calls. ◦ ConversationManagerABC composes Coordinator and public Event/Runtime boundaries. • GitHub integration layering ◦ OH: ProviderHandler(token_source) → GitService; no refresh-URL/MU leakage. ◦ Enterprise: implements MUTokenSource (with refresh/install flow) and InstallationService; same ProviderHandler interface works. Migration plan: map private usages to public APIs • session._notify_on_llm_retry → LLMRetryListener via EventStream/LLMRegistry. • conversation_manager._get_runtime → RuntimeProvider public methods. • super()._start_agent_loop → public start/run API with lifecycle hooks; avoid private parent calls. • _get_conversation_url → public URL helper. • ProviderHandler._get_service/_make_request → public ProviderHandler.get_service + public GitService methods (no direct _make_request calls). Versioning and deprecation • Introduce openhands.api.* as v1 public surface. • Deprecate private/internal methods currently used by enterprise with warnings and adapters. • Keep API small and well-documented; add contract tests for stability. Tasks (tracked and completed) • Reviewed issue #10850 and aligned on direction. • Defined public API and extension points. • Designed auth (UserContext/TokenSource/ConversationPaths) for SU in OH and MU in enterprise. • Designed conversation/distributed architecture via public interfaces. • Designed GitHub integration layering for SU vs MU. • Drafted migration/deprecation mapping for private usages. No code changes were made (analysis and design only). Proposed next steps • Draft an RFC (docs/rfcs/oh-public-api.md) with concrete interface signatures and examples. • Spike PR 1: add openhands/api/* scaffolding with minimal SU implementations and docs. • Spike PR 2: migrate a vertical slice (start + retry listener) and add contract tests. • Enterprise follow-ups: implement MUTokenSource + Coordinator and replace private call sites with the new public API. Let me know if you want me to proceed with the RFC and the initial spike PR scaffolding. <sub>View full conversation</sub>
I’m OpenHands-GPT-5. Here’s a concise summary of my deep-dive into how enterprise is structured and how it starts and runs. What I reviewed • enterprise/README.md • Startup/entry points: enterprise/Makefile, enterprise/Dockerfile, enterprise/saas_server.py • Config override: enterprise/server/config.py (SaaSServerConfig) • Conversation orchestration: enterprise/server/clustered_conversation_manager.py, saas_nested_conversation_manager.py, legacy_conversation_manager.py How enterprise starts and runs • Build/run flow ◦ Makefile build: installs enterprise (poetry) and builds the OH frontend (make build in repo root). ◦ Makefile run: starts backend with uvicorn saas_server:app, waits for port 3000, then starts the OH frontend (make start-frontend). ◦ start-backend: runs uvicorn in reload mode watching both OH and enterprise sources. ◦ Dockerfile CMD: uvicorn saas_server:app --host 0.0.0.0 --port 3000. • ASGI app composition (saas_server.py) ◦ Base app: imports base_app from openhands.server.app and sio (Socket.IO). ◦ Patches MCP routes, exposes GET /saas for a basic check. ◦ Includes routers: ▪︎ Enterprise auth (api_router, oauth_router), user routes (saas_user_router) ▪︎ Billing, API keys, integrations (GitHub/GitLab webhooks when configured; Slack/Jira/Jira DC/Linear if enabled) ▪︎ Event webhook routes for nested runtimes, readiness, debugging, email ◦ Middleware: ▪︎ CORS (permitted origins), OH CacheControlMiddleware, enterprise SetAuthCookieMiddleware ◦ Static frontend: ▪︎ SPAStaticFiles mounted at / with FRONTEND_DIRECTORY set to OH build output ◦ Exception handlers: NoCredentialsError, ExpiredError → 401 ◦ Metrics: mounts /internal/metrics ◦ Final app: app = socketio.ASGIApp(sio, other_asgi_app=base_app) • Configuration overrides (enterprise/server/config.py) ◦ SaaSServerConfig extends OH ServerConfig and sets: ▪︎ app_mode = SAAS ▪︎ settings_store_class, secret_store_class, conversation_store_class to enterprise implementations ▪︎ conversation_manager_class defaults to server.clustered_conversation_manager.ClusteredConversationManager (env-overridable) ▪︎ monitoring_listener_class, user_auth_class to enterprise classes ◦ Provides frontend config (feature flags, providers configured, optional AUTH_URL) ◦ If GitHub App settings present, resolves app slug at startup via JWT → GitHub /app API • Conversations and distribution ◦ ClusteredConversationManager (extends OH StandaloneConversationManager): ▪︎ Adds Redis-backed coordination for multi-instance deployments ▪︎ Starts background tasks on enter: ◦ _redis_update_task: periodic heartbeats/ownership state to Redis ◦ _redis_listen_task: subscribes to session_msg for cross-node messaging ▪︎ Uses parent methods for agent loop start when needed; produces AgentLoopInfo (incl. url via inherited helper) ▪︎ get_agent_loop_info scans Redis keys and builds EventStore per conversation ◦ SaasNestedConversationManager: handles nested runtime/session creation for SaaS ◦ LegacyConversationManager: composes SaasNestedConversationManager (new) + ClusteredConversationManager (migration support) • Auth (from README and code) ◦ Enterprise pivots around OAuth and a signed cookie (github_user_id today, Keycloak planned). ◦ Tokens are managed/renewed by enterprise (TokenManager + token stores), not the OH settings store. ◦ Middleware and auth routes handle cookies and token lifecycle. ◦ README highlights brittleness due to OSS centering on tokens vs enterprise centering on user IDs—motivates a clean boundary. No code changes were made; this was analysis only. If you’d like, I can produce a diagram and an RFC-style doc capturing the startup and runtime composition (routers/middleware layering, config overrides, conversation lifecycle, and Redis coordination) to guide the public API design work. <sub>View full conversation</sub>
c
@nutritious-balloon-65098 Hmm, this boundary is not difficult. What is difficult is that it became so large and entangled. OK, do what you suggest: a diagram and a doc capturing the startup and runtime composition. Give me more info about entanglements. Make a clone of enyst/playground too, and make there a draft PR too so I can see it.
n
I’m OpenHands-GPT-5. Here’s a concise final summary. What I delivered • Authored a doc with a diagram explaining enterprise startup/runtime composition and key entanglements: ◦ enyst/playground: docs/openhands/startup-runtime.md (Mermaid diagram, composition, overrides, Redis coordination, auth, and entanglements) ◦ PR (draft): https://github.com/enyst/playground/pull/102 • Kept a local working copy for reference (not committed to OpenHands): /workspace/project/OpenHands/enterprise-docs/startup-runtime.md Checklist • Addressed requests: ◦ Diagram + doc capturing startup/runtime composition: done ◦ Included more detail on entanglements (private method accesses, implicit overrides, storage namespacing via primitives, middleware stacking, provider logic in core, distributed logic exposing parent internals): done ◦ Clone enyst/playground and open a draft PR with the doc: done • Conciseness: Only a single, focused Markdown file added; no extraneous changes. • New changes since last summary: none (PR and doc already created and linked above). If you want follow-ups, I can add a second doc mapping each enterprise private-method usage to a proposed public API replacement and include a sequence diagram for distributed conversation flow. <sub>View full conversation</sub>
c
@nutritious-balloon-65098 Yes please, do the second doc and include the sequence diagram for distributed conversation flow. Commit and push to that 102 PR on playground.
n
I’m OpenHands-GPT-5. Here’s a concise final summary of the new work I just completed. What I added (since the last summary) • New documentation file: docs/openhands/private-to-public-migration.md ◦ Maps enterprise usages of OH private methods to proposed public APIs. ◦ Phased migration plan (introduce public APIs, update enterprise to use them, remove private usages). ◦ Mermaid sequence diagram showing distributed conversation flow (including Redis coordination and failover). Committed and pushed to your existing draft PR • Branch: oh-enterprise-runtime-doc • PR: https://github.com/enyst/playground/pull/102 • Commit: “docs(OH Enterprise): migration from private calls to public APIs + distributed conversation sequence diagram” ◦ Co-authored-by: openhands <openhands@all-hands.dev> Checklist • Addressed your request to add the second doc with a sequence diagram: done • Conciseness: only one new file added; no unrelated edits: confirmed • Pushed changes to the same draft PR: done If you want, I can follow up with an RFC draft containing concrete interface signatures for the proposed public API (UserContext, TokenSource, ConversationPaths, ConversationManagerABC, EventStream/Listener, RuntimeProvider, URL helper). <sub>View full conversation</sub>
c
1. You said:
>> 5) Direct HTTP helpers on provider services
• Pattern: enterprise services sometimes reach
_make_request
on provider classes. • Problem: private transport leakage; bypasses validation/interceptors. • Public replacement: ◦ Public GitService methods cover supported actions; extension points via request middlewares or
on_before_request/after_response
hooks. Explain this: bypasses validators/interceptors? Give me links to what you mean. And verify implementation in enterprise, does it actually use such in the execution flow? 2. You said:
>> Replacement: Enterprise overrides selected OH implementations via dynamic imports (e.g., conversation manager, stores, auth).
“e.g.” is not good enough. Find them all, list them, link the initial point where it loads each. 3. You said:
>> Enterprise composes:
◦ Patches MCP routes. Link to the source. What do you mean by patches routes? 4. You said enterprise adds routes for:
>> event webhooks, debugging
Read each route and tell me in a couple sentences what its execution flow does. Note: all links must be links on github. @nutritious-balloon-65098
n
I’m OpenHands-GPT-5. I only answered your questions (no code changes). Here’s a concise restatement of the answers with precise GitHub links. 1. “Bypasses validators/interceptors” — what that means, and whether enterprise bypasses them • OH interceptors/validators in the Git HTTP stack: ◦ Centralized request execution: HTTPClient.execute_request (POST/GET) — used by providers ▪︎ https://github.com/All-Hands-AI/OpenHands/blob/989a4e662bb8d388f73a6ec731985b7bbaea8942/openhands/integrations/protocols/http_client.py#L64-L75 ◦ Token expiry detection: HTTPClient._has_token_expired (401) ▪︎ https://github.com/All-Hands-AI/OpenHands/blob/989a4e662bb8d388f73a6ec731985b7bbaea8942/openhands/integrations/protocols/http_client.py#L60-L62 ◦ Error mapping: HTTPClient.handle_http_status_error (401/404/429 → typed exceptions) ▪︎ https://github.com/All-Hands-AI/OpenHands/blob/989a4e662bb8d388f73a6ec731985b7bbaea8942/openhands/integrations/protocols/http_client.py#L77-L99 ◦ Provider _make_request uses execute_request, handles refresh + raise_for_status, then maps errors ▪︎ Example (GitHub): https://github.com/All-Hands-AI/OpenHands/blob/989a4e662bb8d388f73a6ec731985b7bbaea8942/openhands/integrations/github/service/base.py#L39-L80 • Enterprise Git providers DO NOT bypass these: ◦ SaaSGitHubService: calls self._make_request (uses interceptors) ▪︎ PR files: https://github.com/All-Hands-AI/OpenHands/blob/989a4e662bb8d388f73a6ec731985b7bbaea8942/enterprise/integrations/github/github_service.py#L89-L98 ▪︎ Repo node id: https://github.com/All-Hands-AI/OpenHands/blob/989a4e662bb8d388f73a6ec731985b7bbaea8942/enterprise/integrations/github/github_service.py#L109-L121 ◦ SaaSGitLabService: multiple usages of _make_request throughout ▪︎ Example page fetch: https://github.com/All-Hands-AI/OpenHands/blob/989a4e662bb8d388f73a6ec731985b7bbaea8942/enterprise/integrations/gitlab/gitlab_service.py#L171-L180 • Where enterprise DOES bypass interceptors (uses raw httpx for non-Git integrations/internal calls): ◦ Jira manager (httpx + raise_for_status): ▪︎ https://github.com/All-Hands-AI/OpenHands/blob/989a4e662bb8d388f73a6ec731985b7bbaea8942/enterprise/integrations/jira/jira_manager.py#L411-L413 ◦ Linear manager: https://github.com/All-Hands-AI/OpenHands/blob/989a4e662bb8d388f73a6ec731985b7bbaea8942/enterprise/integrations/linear/linear_manager.py#L411-L417 ◦ Nested conversation manager (internal HTTP): ▪︎ Example call: https://github.com/All-Hands-AI/OpenHands/blob/989a4e662bb8d388f73a6ec731985b7bbaea8942/enterprise/server/saas_nested_conversation_manager.py#L263-L302 2. All dynamic overrides and where they are loaded • Enterprise defines overrides in SaaSServerConfig: ◦ settings_store_class: storage.saas_settings_store.SaasSettingsStore ◦ secret_store_class: storage.saas_secrets_store.SaasSecretsStore ◦ conversation_store_class: storage.saas_conversation_store.SaasConversationStore ◦ conversation_manager_class: server.clustered_conversation_manager.ClusteredConversationManager ◦ monitoring_listener_class: server.saas_monitoring_listener.SaaSMonitoringListener ◦ user_auth_class: server.auth.saas_user_auth.SaasUserAuth ◦ Source: https://github.com/All-Hands-AI/OpenHands/blob/989a4e662bb8d388f73a6ec731985b7bbaea8942/enterprise/server/config.py#L52-L74 • OH loads them via get_impl, using config loaded by load_server_config(): ◦ load_server_config (resolves OPENHANDS_CONFIG_CLS): https://github.com/All-Hands-AI/OpenHands/blob/989a4e662bb8d388f73a6ec731985b7bbaea8942/openhands/server/config/server_config.py#L53-L62 ◦ MonitoringListenerImpl: https://github.com/All-Hands-AI/OpenHands/blob/989a4e662bb8d388f73a6ec731985b7bbaea8942/openhands/server/shared.py#L54-L59 ◦ ConversationManagerImpl: https://github.com/All-Hands-AI/OpenHands/blob/989a4e662bb8d388f73a6ec731985b7bbaea8942/openhands/server/shared.py#L61-L66 ◦ SettingsStoreImpl: https://github.com/All-Hands-AI/OpenHands/blob/989a4e662bb8d388f73a6ec731985b7bbaea8942/openhands/server/shared.py#L68-L68 ◦ SecretsStoreImpl: https://github.com/All-Hands-AI/OpenHands/blob/989a4e662bb8d388f73a6ec731985b7bbaea8942/openhands/server/shared.py#L70-L70 ◦ ConversationStoreImpl: https://github.com/All-Hands-AI/OpenHands/blob/989a4e662bb8d388f73a6ec731985b7bbaea8942/openhands/server/shared.py#L72-L76 • Service implementation override points (via env vars), used by ProviderHandler and MCP: ◦ GitHub Impl resolution: https://github.com/All-Hands-AI/OpenHands/blob/989a4e662bb8d388f73a6ec731985b7bbaea8942/openhands/integrations/github/github_service.py#L75-L78 ◦ GitLab Impl resolution: https://github.com/All-Hands-AI/OpenHands/blob/989a4e662bb8d388f73a6ec731985b7bbaea8942/openhands/integrations/gitlab/gitlab_service.py#L79-L82 ◦ Bitbucket Impl resolution: https://github.com/All-Hands-AI/OpenHands/blob/989a4e662bb8d388f73a6ec731985b7bbaea8942/openhands/integrations/bitbucket/bitbucket_service.py#L64-L67 ◦ MCP creates services via these Impls: ▪︎ GitHub (create_pr): https://github.com/All-Hands-AI/OpenHands/blob/989a4e662bb8d388f73a6ec731985b7bbaea8942/openhands/server/routes/mcp.py#L117-L140 ▪︎ GitLab (create_mr): https://github.com/All-Hands-AI/OpenHands/blob/989a4e662bb8d388f73a6ec731985b7bbaea8942/openhands/server/routes/mcp.py#L190-L219 ◦ ProviderHandler maps ProviderType -> Impl classes: https://github.com/All-Hands-AI/OpenHands/blob/989a4e662bb8d388f73a6ec731985b7bbaea8942/openhands/integrations/provider.py#L128-L130 3. “Patches MCP routes” — source and meaning • Source: enterprise/server/routes/mcp_patch.py mounts an external MCP proxy under the global OH mcp_server at prefix 'tavily' (if enabled): ◦ https://github.com/All-Hands-AI/OpenHands/blob/989a4e662bb8d388f73a6ec731985b7bbaea8942/enterprise/server/routes/mcp_patch.py#L1-L38 • It’s invoked at server startup in enterprise/saas_server.py: ◦ https://github.com/All-Hands-AI/OpenHands/blob/989a4e662bb8d388f73a6ec731985b7bbaea8942/enterprise/saas_server.py#L32-L36 • “Patches routes” here means it programmatically adds a new tool namespace to the MCP server by mounting a proxy MCP server, not adding a plain FastAPI route. 4. Event webhooks and debugging routes — execution flow • Event webhooks (prefix /event-webhook): ◦ File: https://github.com/All-Hands-AI/OpenHands/blob/989a4e662bb8d388f73a6ec731985b7bbaea8942/enterprise/server/routes/event_webhook.py#L1-L260 ◦ POST /event-webhook/batch: accepts a list of operations; background task iterates each op, parses conversation_id/subpath, verifies X-Session-API-Key against conversation_manager.get_agent_loop_info, and dispatches: ▪︎ agent_state.pkl → update_agent_state ▪︎ conversation_stats.pkl → update_conversation_stats ▪︎ metadata.json → update_conversation_metadata ▪︎ events/... → process_event ▪︎ Route: https://github.com/All-Hands-AI/OpenHands/blob/989a4e662bb8d388f73a6ec731985b7bbaea8942/enterprise/server/routes/event_webhook.py#L148-L165 ▪︎ Background impl: https://github.com/All-Hands-AI/OpenHands/blob/989a4e662bb8d388f73a6ec731985b7bbaea8942/enterprise/server/routes/event_webhook.py#L51-L145 ◦ POST /event-webhook/{path}: single op variant; same verification and dispatch; returns 200/403/400 ▪︎ https://github.com/All-Hands-AI/OpenHands/blob/989a4e662bb8d388f73a6ec731985b7bbaea8942/enterprise/server/routes/event_webhook.py#L168-L224 ◦ DELETE /event-webhook/{path}: no-op 200 ▪︎ https://github.com/All-Hands-AI/OpenHands/blob/989a4e662bb8d388f73a6ec731985b7bbaea8942/enterprise/server/routes/event_webhook.py#L227-L229 • Debugging routes (added only if ADD_DEBUGGING_ROUTES is true): ◦ File: https://github.com/All-Hands-AI/OpenHands/blob/989a4e662bb8d388f73a6ec731985b7bbaea8942/enterprise/server/routes/debugging.py#L1-L200 ◦ GET /debugging/pool-stats: shows SQLAlchemy pool stats ▪︎ https://github.com/All-Hands-AI/OpenHands/blob/989a4e662bb8d388f73a6ec731985b7bbaea8942/enterprise/server/routes/debugging.py#L26-L46 ◦ GET /debugging/test-db: threaded stress test holding DB connections ▪︎ https://github.com/All-Hands-AI/OpenHands/blob/989a4e662bb8d388f73a6ec731985b7bbaea8942/enterprise/server/routes/debugging.py#L48-L78 ◦ GET /debugging/a-test-db: async version of the stress test ▪︎ https://github.com/All-Hands-AI/OpenHands/blob/989a4e662bb8d388f73a6ec731985b7bbaea8942/enterprise/server/routes/debugging.py#L80-L98 ◦ GET /debugging/lock-main-runloop: intentionally blocks the event loop with time.sleep ▪︎ https://github.com/All-Hands-AI/OpenHands/blob/989a4e662bb8d388f73a6ec731985b7bbaea8942/enterprise/server/routes/debugging.py#L100-L119 Composition reference (where enterprise wires these up): • Routers/middleware added to OH base_app in enterprise/saas_server.py: ◦ https://github.com/All-Hands-AI/OpenHands/blob/989a4e662bb8d388f73a6ec731985b7bbaea8942/enterprise/saas_server.py#L38-L91 <sub>View full conversation</sub>
I’m OpenHands-GPT-5. Here’s a concise final summary of the new changes I made and pushed. What I changed (since the last summary) • Expanded the migration document with a new section: ◦ “Dynamic overrides (enterprise) and load locations (OH)” including precise GitHub links to: ▪︎ Enterprise override definitions (SaaSServerConfig for conversation manager, stores, monitoring listener, user auth) ▪︎ OpenHands load points (get_impl usage in server/shared.py, load_server_config) ▪︎ Git service Impl resolution points and where MCP tools instantiate them • Renamed the doc for clarity: ◦ From: docs/openhands/private-to-public-migration.md ◦ To: docs/openhands/migration.md Checklist • Addressed your request: ◦ Add dynamic overrides with links: done ◦ Rename the doc to migration.md: done • Conciseness: Only the doc updates and a file rename; no unrelated changes. • Pushed to the same draft PR: done Branch/PR • Branch: oh-enterprise-runtime-doc • PR: https://github.com/enyst/playground/pull/102 • Updated file: https://github.com/enyst/playground/blob/oh-enterprise-runtime-doc/docs/openhands/migration.md If you want, I can add a short index at the top of migration.md for quick navigation to the “public replacements” and the new “dynamic overrides” sections. <sub>View full conversation</sub>
I’m OpenHands-GPT-5. I only answered your question (no code changes). Here’s a concise restatement of my proposal to replace today’s implicit get_impl overrides with explicit, public, and versioned extension points. Core plugin model • Public, stable interfaces under openhands.api.* (versioned ABC/Protocols). • Discovery via Python entry points (“openhands.plugins”). • Central registry with priorities, capability checks, lifecycle hooks (on_load/on_startup/on_shutdown). • Config-driven selection (config > env > default). • AppContext injection so extensions don’t reach into internals. Extension points and patterns • Conversation Manager ◦ API: ConversationManager (start_conversation, run_agent_loop, resume, get_conversation_url). ◦ Provider: ConversationManagerProvider -> ConversationManager. ◦ Composition: Separate LeaseCoordinator extension point; events via EventBus (no private session hooks). • Conversation Store ◦ API: ConversationStore (get/save metadata, append/stream events, list, delete). ◦ Provider: ConversationStoreProvider. ◦ Optional: StoreMiddleware chain (cache, logging). • SettingsStore / SecretsStore ◦ APIs: SettingsStore, SecretsStore. ◦ Providers: SettingsStoreProvider, SecretsStoreProvider. ◦ Emit store change events on EventBus; optional cache middleware. • MonitoringListener → EventBus ◦ API: EventBus + typed Event(s) (Action, Observation, Retry, StateChange, etc.). ◦ Subscribers: MonitoringSubscriber (filterable). ◦ Multiple subscribers discovered and registered on startup. • UserAuth ◦ API: UserAuthProvider (get_user_id, get_access_token, get_provider_tokens, verify_request). ◦ Integration: FastAPI dependencies wrap the chosen provider. ◦ Single active provider (can support chained providers if needed). • Git provider services (GitHub/GitLab/Bitbucket) ◦ HTTPTransport with middleware chain (auth, retry/backoff, rate-limit, tracing). ◦ GitService uses Transport and TokenSource (no direct _make_request). ◦ ProviderServiceFactory returns GitService by ProviderType. ◦ Middlewares discoverable and composable by config. • MCP Tools ◦ API: MCPToolProvider.register(mcp_server, app_ctx). ◦ All tool providers auto-registered; governed by config/capabilities. ◦ Replaces ad-hoc “mcp_patch” with formal tool registration. • Event webhooks / nested runtime ◦ APIs: EventSink (validate and translate inbound batches to EventBus), RuntimeBridge (cross-process/node state/event forwarding). ◦ Single sink (by config), multiple bridges allowed. • Runtime providers ◦ API: RuntimeProvider (create_runtime, capabilities, healthcheck, limits). ◦ Multiple providers selectable (Local/Docker/Remote/Modal). Governance and diagnostics • Semver, deprecation policy for openhands.api.*. • Capability handshake for plugins (declared extension_point/version/features). • Diagnostics route “/extensions” to list discovered/active plugins with versions/priorities. Migration path • Keep get_impl for one release with deprecation logs pointing to new plugin IDs. • Provide adapters for enterprise classes to implement new Providers and register via entry points. • Documentation: “Writing an OpenHands Plugin” with templates and tests. Example entry-point mapping (pyproject.toml) • [project.entry-points."openhands.plugins"] ◦ ent.conversation_manager = ent_pkg.plugins:EnterpriseConversationManagerProvider ◦ ent.user_auth = ent_pkg.plugins:EnterpriseUserAuthProvider This makes extensions explicit, testable, swappable, and removes reliance on private methods and opaque get_impl overrides. <sub>View full conversation</sub>
I’m OpenHands-GPT-5. I only answered your question (no code changes). Restatement of the answer: • Agent-SDK (V1) re-centers orchestration on sdk.Agent + sdk.Conversation with a typed, event-first model (ConversationState holds a list of sdk.EventType; tools are Action/Observation generics). • For our public API when integrating Agent-SDK: ◦ ConversationManager becomes a thin adapter that instantiates and delegates to sdk.Agent and sdk.Conversation, while we retain responsibility for IDs, leases, and persistence. ◦ EventBus should publish/consume sdk.EventType directly; LLM retry and similar signals move to events rather than private hooks. ◦ Tools should align with sdk Tool abstractions; our runtime tools (e.g., execute_bash) and MCP tools become sdk Tool/MCPTool implementations or wrappers. ◦ Runtime providers construct the execution sessions used by sdk tool executors (we wire session factories/config via our RuntimeProvider). ◦ ConversationStore persists sdk ConversationState and events; event webhooks should ingest/emit sdk events. ◦ Provider services (GitHub/GitLab/etc.) and MCP routes remain conceptually similar but should be exposed via sdk-aligned actions/observations and transport middleware rather than private request methods. Migration path: • Phase 1: Introduce sdk-backed implementations behind existing public interfaces; add adapters for V0 events/tools. • Phase 2: Make sdk-based Conversation/Agent and events the defaults; ensure stores/webhooks run on sdk types. • Phase 3: Remove V0 adapters/private couplings; keep a small, stable, sdk-aligned public surface and plugin extension points. <sub>View full conversation</sub>
c
@nutritious-balloon-65098 Re-read the code we need for EventBus, and think deeply again about a solution. We want a simple solution that works with agent-sdk, OH and enterprise. If you still think that LLM retry and other signals move to events, explain your reasoning.
n
Uh oh! There was an unexpected error starting the job :(
c
@nutritious-balloon-65098 Re-read the code we need for EventBus, and think deeply again about a solution. We want a simple solution that works with agent-sdk, OH and enterprise. If you still think that LLM retry and other signals move to events, explain your reasoning.
n
I’m OpenHands-GPT-5. I only answered your question (no code changes). Restatement of the answer: • What the code supports today ◦ Agent-SDK already exposes: ▪︎ A per-conversation callback (ConversationCallbackType) for emitting typed sdk events (SystemPromptEvent, ActionEvent, ObservationEvent, MessageEvent, PauseEvent via LLMConvertibleEvent). ▪︎ An LLM retry hook (retry_listener(attempt, max)) via RetryMixin in sdk.llm. ◦ There’s no built-in EventBus in SDK, but these two hooks are sufficient to surface signals externally. • Simple EventBus that works for SDK, OH, and enterprise ◦ Implement a minimal AsyncEventBus in OH with: ▪︎ subscribe(predicate, callback), unsubscribe(handle) ▪︎ publish(channel, payload) ◦ Use two initial channels: ▪︎ “sdk_event”: wraps sdk.EventType with {conversation_id, event} ▪︎ “llm_retry”: carries {conversation_id, attempt, max} ◦ Integration points: ▪︎ Wire Conversation’s callback to bus.publish("sdk_event", envelope) ▪︎ Set llm.retry_listener = lambda attempt,max: bus.publish("llm_retry", {...}) ◦ Consumers (monitoring, UI broadcaster, persistence) subscribe by conversation_id/channel. Multi-node can add a Redis bridge later without changing producers. • Why LLM retry and similar signals should be events ◦ Decoupling: Observers (monitoring/UX/autoscaling) shouldn’t depend on private internals; events provide a stable contract. ◦ Observability: Retries, backoff, token usage, pause/resume are operational signals best handled via an event stream for logging/metrics/UI. ◦ SDK compatibility: Uses existing sdk hooks (conversation callback, retry_listener) with zero SDK changes. ◦ Extensibility: New subscribers can be added/removed via config, aligning with a plugin/extension model. • Migration path ◦ Phase 1: Add AsyncEventBus in OH; wire conversation_callback → “sdk_event” and llm.retry_listener → “llm_retry”. ◦ Phase 2: Move enterprise monitoring/UI/persistence to subscribe to the bus. ◦ Phase 3 (optional): Propose a typed LLMRetryEvent in agent-sdk and merge “llm_retry” into the typed event stream once available. This yields a small, low-risk, SDK-aligned solution that cleanly separates orchestration from observers and works uniformly for OH and enterprise. <sub>View full conversation</sub>