proposal: serialize mcp_config as sanitized deprecated projection#2877
Closed
enyst wants to merge 2 commits intofix/mcp-secrets-expansionfrom
Closed
proposal: serialize mcp_config as sanitized deprecated projection#2877enyst wants to merge 2 commits intofix/mcp-secrets-expansionfrom
enyst wants to merge 2 commits intofix/mcp-secrets-expansionfrom
Conversation
Serialize Agent.mcp_config as a sanitized projection instead of dropping the field entirely, and mark the serialized surface deprecated for removal in v1.22.0. Preserve raw runtime config only for explicit internal transport paths via raw_mcp_config context. Co-authored-by: openhands <openhands@all-hands.dev>
Resolve the proposal branch conflicts by keeping the base branch's selective MCP redaction, while preserving the proposal's deprecation metadata and raw_mcp_config transport override. Co-authored-by: openhands <openhands@all-hands.dev>
Contributor
Coverage Report •
|
|||||||||||||||||||||||||||||||||||||||||||||
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.
Summary
This proposal keeps the serialized
mcp_configfield present, but changes it from a runnable config dump into a sanitized projection:v1.17.0→v1.22.0)model_dump(context={"raw_mcp_config": True})Why this version
I aimed for the smallest change that addresses both concerns:
mcp_configin the response shape instead of the field disappearing outrightThis keeps the public contract additive while making it clear that serialized
mcp_configis no longer the runnable source of truth.Changes
AgentBase.mcp_configexclude=Trueraw_mcp_config=Truefor remote conversation startup / in-memory server handoff so the live runtime still gets the real config where explicitly intendedValidation
Ran:
uv run pytest tests/sdk/agent/test_agent_serialization.py tests/sdk/conversation/test_mcp_secrets_serialization_leak.py tests/sdk/conversation/test_local_conversation_plugins.py tests/sdk/skills/test_mcp_config_expansion.py tests/sdk/plugin/test_plugin_loading.py tests/sdk/plugin/test_plugin_loader.py tests/sdk/conversation/test_secrets_manager.py -k 'mcp or secret or serialization' uv run pytest tests/agent_server/test_conversation_service.py::TestConversationServiceStartConversation::test_start_conversation_with_secrets tests/agent_server/test_conversation_service.py::TestConversationServiceStartConversation::test_start_conversation_without_secrets -q uv run pre-commit run --files openhands-sdk/openhands/sdk/agent/base.py openhands-sdk/openhands/sdk/conversation/impl/remote_conversation.py openhands-agent-server/openhands/agent_server/conversation_service.py openhands-agent-server/openhands/agent_server/event_service.py tests/sdk/agent/test_agent_serialization.py tests/sdk/conversation/test_mcp_secrets_serialization_leak.pyNotes
This proposal intentionally stays minimal. It does not try to reconstruct provenance inside an already-expanded MCP config. Instead it treats serialized
mcp_configas a safe public projection and keeps raw config transport opt-in.This PR was created by an AI assistant (OpenHands) on behalf of the user.