Skip to content

πŸ™Œ OpenHands: AI-Driven Development

fix: app unawareness of custom secrets in v1 conversations (#11914)

Hiep Le09e50b876db1
diff --git a/openhands/app_server/app_conversation/live_status_app_conversation_service.py b/openhands/app_server/app_conversation/live_status_app_conversation_service.py
index 44ab374f6c..4b710553ca 100644
--- a/openhands/app_server/app_conversation/live_status_app_conversation_service.py
+++ b/openhands/app_server/app_conversation/live_status_app_conversation_service.py
@@ -650,6 +650,7 @@ class LiveStatusAppConversationService(AppConversationServiceBase):
system_message_suffix: str | None,
mcp_config: dict,
condenser_max_size: int | None,
+ secrets: dict | None = None,
) -> Agent:
"""Create an agent with appropriate tools and context based on agent type.
@@ -659,6 +660,7 @@ class LiveStatusAppConversationService(AppConversationServiceBase):
system_message_suffix: Optional suffix for system messages
mcp_config: MCP configuration dictionary
condenser_max_size: condenser_max_size setting
+ secrets: Optional dictionary of secrets for authentication
Returns:
Configured Agent instance with context
@@ -687,7 +689,9 @@ class LiveStatusAppConversationService(AppConversationServiceBase):
)
# Add agent context
- agent_context = AgentContext(system_message_suffix=system_message_suffix)
+ agent_context = AgentContext(
+ system_message_suffix=system_message_suffix, secrets=secrets
+ )
agent = agent.model_copy(update={'agent_context': agent_context})
return agent
@@ -784,7 +788,12 @@ class LiveStatusAppConversationService(AppConversationServiceBase):
# Create agent with context
agent = self._create_agent_with_context(
- llm, agent_type, system_message_suffix, mcp_config, user.condenser_max_size
+ llm,
+ agent_type,
+ system_message_suffix,
+ mcp_config,
+ user.condenser_max_size,
+ secrets=secrets,
)
# Finalize and return the conversation request
diff --git a/tests/unit/app_server/test_live_status_app_conversation_service.py b/tests/unit/app_server/test_live_status_app_conversation_service.py
index 82e365fa4c..273d79ca25 100644
--- a/tests/unit/app_server/test_live_status_app_conversation_service.py
+++ b/tests/unit/app_server/test_live_status_app_conversation_service.py
@@ -821,5 +821,6 @@ class TestLiveStatusAppConversationService:
'Test suffix',
mock_mcp_config,
self.mock_user.condenser_max_size,
+ secrets=mock_secrets,
)
self.service._finalize_conversation_request.assert_called_once()