From c67a5035321516226b3937e3c0fe8b8c3a53bade Mon Sep 17 00:00:00 2001 From: Hyu Date: Wed, 12 Aug 2026 19:49:56 +0800 Subject: [PATCH] feat(health): expose plugin runtime readiness (#2420) Co-authored-by: Chan --- src/langbot/pkg/core/app.py | 4 ++++ tests/unit_tests/core/test_app_shutdown.py | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/langbot/pkg/core/app.py b/src/langbot/pkg/core/app.py index 3f4a17329..4b82b3efc 100644 --- a/src/langbot/pkg/core/app.py +++ b/src/langbot/pkg/core/app.py @@ -249,6 +249,10 @@ class Application: {}, ) ), + 'plugin_runtime_connected': bool( + self.plugin_connector is not None + and getattr(self.plugin_connector, '_runtime_available', lambda: False)() + ), } mcp_loader = getattr(self.tool_mgr, 'mcp_tool_loader', None) runtime_stats.update( diff --git a/tests/unit_tests/core/test_app_shutdown.py b/tests/unit_tests/core/test_app_shutdown.py index e284f5000..ad6dcfad6 100644 --- a/tests/unit_tests/core/test_app_shutdown.py +++ b/tests/unit_tests/core/test_app_shutdown.py @@ -87,7 +87,10 @@ async def test_runtime_resource_stats_are_aggregate_and_constant_time() -> None: app.platform_mgr = SimpleNamespace(_bots_by_key={}) app.pipeline_mgr = SimpleNamespace(_pipelines_by_key={}) app.rag_mgr = SimpleNamespace(knowledge_bases={}) - app.plugin_connector = SimpleNamespace(_known_desired_states={'installation': object()}) + app.plugin_connector = SimpleNamespace( + _known_desired_states={'installation': object()}, + _runtime_available=lambda: True, + ) app.persistence_mgr = SimpleNamespace( get_resource_stats=lambda: { 'configured_capacity': 20, @@ -140,3 +143,4 @@ async def test_runtime_resource_stats_are_aggregate_and_constant_time() -> None: } assert stats['models']['providers'] == 1 assert stats['runtimes']['plugin_installations'] == 1 + assert stats['runtimes']['plugin_runtime_connected'] is True