Repository navigation
feat(marketplace): support runtime local plugin loading - #3826
Conversation
Coverage Report •
|
||||||||||||||||||||||||||||||
all-hands-bot
left a comment
There was a problem hiding this comment.
⚠️ QA Report: PASS WITH ISSUES
Runtime local plugin loading works end-to-end for local marketplaces, including qualified/unqualified refs and post-initialization MCP tool refresh; the only issue observed is a failing PR Description Check.
Does this PR achieve its stated goal?
Yes. The base branch does not expose LocalConversation.load_plugin, while the PR head exposes it and successfully loads local marketplace plugins at runtime. I verified both plugin-name@marketplace-name and unqualified plugin-name refs add skills to the conversation, missing marketplace registration fails with a clear ValueError, and a real FastMCP stdio server contributed by a runtime-loaded plugin becomes available after the agent was already initialized.
| Phase | Result |
|---|---|
| Environment Setup | ✅ make build completed successfully; no tests/lint/pre-commit were run locally. |
| CI Status | PR Description Check / Validate PR description is failing; qa-changes was in progress; all other completed checks were green at report time. |
| Functional Verification | ✅ Exercised SDK behavior with real LocalConversation.load_plugin(...), local marketplace files, and a real MCP subprocess. |
Functional Verification
Test 1: Baseline without the PR
Step 1 — Reproduce / establish baseline (without the fix):
Checked out feat/marketplace-autoload-registrations and ran OPENHANDS_SUPPRESS_BANNER=1 uv run python /tmp/qa_runtime_plugin.py:
has_load_plugin= False
load_plugin_result= AttributeError 'LocalConversation' object has no attribute 'load_plugin'
This confirms the base branch cannot load a marketplace plugin at runtime through LocalConversation.
Step 2 — Apply the PR's changes:
Checked out feat/marketplace-runtime-load-plugin at 2d2c9f6a0408bce01d0b6b4991374dc8a1195fd7.
Step 3 — Re-run with the fix in place:
Ran OPENHANDS_SUPPRESS_BANNER=1 uv run python /tmp/qa_runtime_plugin.py:
has_load_plugin= True
qualified_skill_loaded= Loaded content for runtime-skill
resolved_after_qualified= 1
unqualified_skill_loaded= Loaded content for second-runtime-skill
resolved_after_unqualified= 2
missing_registration_error= No agent context available. Configure agent_context with registered_marketplaces to use load_plugin().
This shows the new runtime API exists, resolves both qualified and unqualified plugin refs from a registered local marketplace, merges plugin skills into the active conversation context, tracks resolved plugins, and reports a useful error when no marketplace is configured.
Test 2: Runtime MCP loading after agent readiness
Step 1 — Establish baseline after initialization:
On the PR head, the script initialized the agent first and printed the available tools before loading the plugin:
tools_before_runtime_load= ['finish', 'think']
This establishes the agent was already ready and no MCP tool was present yet.
Step 2 — Apply runtime plugin load:
The script loaded runtime-mcp-plugin@qa-mcp from a local marketplace. The plugin's .mcp.json launched a real FastMCP stdio subprocess exposing qa_runtime_echo.
Step 3 — Verify new MCP tools are available:
Ran OPENHANDS_SUPPRESS_BANNER=1 uv run python /tmp/qa_runtime_plugin_mcp.py:
mcp_config_servers= ['qa-runtime-server']
tools_after_runtime_load= ['finish', 'qa_runtime_echo', 'think']
runtime_echo_tool_available= True
This confirms runtime MCP config was merged and the initialized agent's tool map was rebuilt so the newly loaded MCP tool is available without recreating the conversation.
Issues Found
- 🟡 CI:
PR Description Check / Validate PR descriptionis failing. I did not edit human-only PR description fields; functional QA for the runtime plugin-loading behavior passed.
This review was generated by an AI agent (OpenHands) on behalf of the user.
|
✅ Review complete. This review was performed through OpenHands Cloud Automation. You can log in and view the conversation here. |
all-hands-bot
left a comment
There was a problem hiding this comment.
🟡 Acceptable — Clean implementation with correct state management; minor improvements suggested below.
The refactoring of _expand_secret_refs from a local closure into a proper class method (_expand_plugin_source_ref) is a clear win: the expansion logic is now reusable and the three new runtime-load helpers (_marketplace_registry_from_context, _merge_runtime_plugin_hooks, load_plugin) follow existing patterns well. The reset_runtime_tools + init_state sequence for handling post-agent-ready MCP reinit is the right mechanism.
[IMPROVEMENT OPPORTUNITIES]
-
[base.py, Line 904]
reset_runtime_tools()leaves the agent in an invalid, uninitialized state until the caller follows up withinit_state(). After calling this,tools_mapraisesRuntimeErrorand any active step would break. Right now the only caller isLocalConversation.load_plugin(), which immediately callsinit_state()in the samewith self._state:block. But as a public method, the ordering contract is invisible. Either add a docstring warning ("Must be followed immediately byinit_state()"), or narrow the scope — e.g., rename to_reset_for_reinit()to signal it is an internal transition helper. -
[local_conversation.py, Lines 928-929]
_marketplace_registry_from_context()already expandssourceandreffor every registration before building theMarketplaceRegistry, so the spec returned byresolve_plugin()carries already-expanded values. The two_expand_plugin_source_ref()calls here are redundant (though harmless —expand_variable_referencesis idempotent on already-expanded strings). This mirrors the same double-expansion in_ensure_plugins_loaded(). Not a blocker, but worth cleaning up in both places for clarity. -
[local_conversation.py, Line 966] The three new tests cover skills (basic load), MCP reinit, and the error case — but
_merge_runtime_plugin_hookshas no test coverage. A fourth test that loads a plugin with hooks and asserts the hook processor is replaced would close this gap.
[RISK ASSESSMENT]
- [Overall PR]
⚠️ Risk Assessment: 🟢 LOW
Additive API change (newload_plugin()method andreset_runtime_tools()) with no modifications to existing code paths other than a clean refactoring of a local closure into a class method. No breaking changes. Stack-based PR with limited blast radius.
VERDICT:
✅ Worth merging — core logic is sound, the minor issues above can be addressed in a follow-up or later chunk of this stack.
KEY INSIGHT: reset_runtime_tools() is a narrow internal transition primitive — its only safe use is as part of the reset → reinit pair in load_plugin(); making that constraint visible (via naming or docs) would prevent accidental misuse as the SDK surface grows.
This review was generated by an AI agent (OpenHands) on behalf of the user through OpenHands Automation. View conversation
Improve this review? If any feedback above seems incorrect or irrelevant to this repository, you can teach the reviewer to do better:
- Add a
.agents/skills/custom-codereview-guide.mdfile to your branch (or edit it if one already exists) with the/codereviewtrigger and the context the reviewer is missing. See the customization docs for the required frontmatter format.- Re-request a review - the reviewer reads guidelines from the PR branch, so your changes take effect immediately.
Was this review helpful? React with 👍 or 👎 to give feedback.
all-hands-bot
left a comment
There was a problem hiding this comment.
✅ QA Report: PASS
Runtime marketplace plugin loading works end-to-end for SDK-local Conversation usage: skills, MCP tools after agent initialization, hooks, plugin subagents, short refs, explicit @marketplace refs, and missing-registration errors were all exercised successfully.
Does this PR achieve its stated goal?
Yes. The base branch has no LocalConversation.load_plugin(...) entry point, while the PR branch exposes it and successfully resolves local marketplace plugin refs at runtime. I verified the PR loads a skill plugin via plugin@marketplace, loads MCP/hook/agent plugins via short names, rebuilds initialized tools so a newly loaded MCP tool appears after _ensure_agent_ready(), and raises a clear ValueError when no marketplace is registered.
| Phase | Result |
|---|---|
| Environment Setup | ✅ Dependencies were already bootstrapped with uv sync --dev; temp runtime QA script compiled and ran. |
| CI Status | Validate PR description failing and a newer qa-changes run in progress at review time. |
| Functional Verification | ✅ Public SDK usage behaved as claimed against base vs PR. |
Functional Verification
Test 1: Baseline lacks runtime plugin loading
Step 1 — Reproduce / establish baseline without the fix:
Checked out base commit 809499b1 and ran uv run python /tmp/qa_runtime_plugin.py baseline:
conversation_type=LocalConversation
has_load_plugin=False
baseline_load_plugin_result=AttributeError:'LocalConversation' object has no attribute 'load_plugin'
This establishes the prior state: SDK-local conversations could not runtime-load a registered marketplace plugin through load_plugin().
Step 2 — Apply the PR's changes:
Checked out PR branch feat/marketplace-runtime-load-plugin at 2d2c9f6a0408bce01d0b6b4991374dc8a1195fd7.
Test 2: Runtime skill plugin loads from an explicit marketplace ref
Ran uv run python /tmp/qa_runtime_plugin.py skill on the PR branch:
conversation_type=LocalConversation
has_load_plugin=True
skills_before=[]
skills_after=['runtime-marketplace-skill']
resolved_plugins=[{'source': '/tmp/oh-qa-runtime-plugin-p808zivg/plugins/runtime-skill-plugin'}]
This confirms runtime-skill-plugin@qa-market resolves through the registered marketplace and merges the plugin skill into the conversation's agent context.
Test 3: Runtime MCP plugin rebuilds tools after agent readiness
Ran uv run python /tmp/qa_runtime_plugin.py mcp on the PR branch:
conversation_type=LocalConversation
has_load_plugin=True
tools_after_initial_ready=['finish', 'think']
tools_after_runtime_load=['finish', 'runtime_echo', 'think']
runtime_echo_tools=['runtime_echo']
mcp_servers=['runtime-local-plugin']
This confirms the PR's claimed reinitialization path works: after the agent was already ready, loading a short-name MCP plugin added the MCP server config and made the new runtime_echo tool available.
Test 4: Runtime hook plugin merges and executes
Ran uv run python /tmp/qa_runtime_plugin.py hook on the PR branch:
conversation_type=LocalConversation
has_load_plugin=True
hook_log_exists_before=False
hook_log_exists_after=True
hook_log_content=runtime-hook-fired
This confirms a runtime-loaded plugin hook was merged into the conversation hook processor and executed, producing the expected workspace side effect.
Test 5: Runtime plugin subagent registration works
Ran uv run python /tmp/qa_runtime_plugin.py agent on the PR branch:
conversation_type=LocalConversation
has_load_plugin=True
registered_agent_before=[]
registered_agent_after=['qa-runtime-marketplace-agent']
This confirms an agent definition bundled in a runtime-loaded plugin becomes available through the SDK subagent registry.
Test 6: Missing marketplace registration reports a clear error
Ran uv run python /tmp/qa_runtime_plugin.py missing-registration on the PR branch:
conversation_type=LocalConversation
has_load_plugin=True
missing_registration_result=ValueError:No agent context available. Configure agent_context with registered_marketplaces to use load_plugin().
This confirms the negative path is handled explicitly rather than failing with a lower-level marketplace or attribute error.
Issues Found
None for the runtime behavior exercised.
This QA review was created by an AI agent (OpenHands) on behalf of the user.
2d2c9f6 to
c3ff186
Compare
|
✅ Review complete. This review was performed through OpenHands Cloud Automation. You can log in and view the conversation here. |
all-hands-bot
left a comment
There was a problem hiding this comment.
🟢 Good taste — Implementation is clean, all prior review threads are resolved, and no new issues were found on re-review.
What this PR does well:
- Refactoring
_expand_secret_refsfrom a local closure into_expand_plugin_source_ref(a proper class method) is a clear win — the three security-sensitiveexpand_variable_referencesparameters (check_env=False,support_unbraced=False,expand_defaults=False) are now tested at one consistent call site instead of being silently replicated. load_plugin()follows the established lazy-init pattern (_agent_ready/_resolved_plugins) cleanly, and thereset_runtime_tools()+init_state()reinit pair underwith self._state:is the right mechanism for post-agent-ready MCP tool refresh._marketplace_registry_from_context()cleanly separates registry construction from the call site, making both_ensure_plugins_loadedandload_plugineasier to read.
Prior review threads (all resolved):
reset_runtime_tools()ordering contract → author deferred; current call site is immediately followed byinit_state(), so safe.- Double
_expand_plugin_source_ref()call on already-expanded spec → kept as a defensive normalization boundary; idempotent and harmless. - Missing direct test for
_merge_runtime_plugin_hooks→ deferred to follow-up; non-blocking.
[RISK ASSESSMENT]
- [Overall PR]
⚠️ Risk Assessment: 🟢 LOW
Additive API only (load_plugin()+reset_runtime_tools()). No existing code paths modified except the clean local-closure→method refactoring. No breaking changes.
VERDICT:
✅ Worth merging — implementation is sound, all feedback has been addressed or deferred with sound reasoning.
KEY INSIGHT: _expand_plugin_source_ref is the right abstraction boundary; the non-obvious security parameter choices are now isolated at one call site, reducing the risk of future callers silently getting the expansion semantics wrong.
This review was generated by an AI agent (OpenHands) on behalf of the user through OpenHands Automation. View conversation
Improve this review? If any feedback above seems incorrect or irrelevant to this repository, you can teach the reviewer to do better:
- Add a
.agents/skills/custom-codereview-guide.mdfile to your branch (or edit it if one already exists) with the/codereviewtrigger and the context the reviewer is missing. See the customization docs for the required frontmatter format.- Re-request a review - the reviewer reads guidelines from the PR branch, so your changes take effect immediately.
Was this review helpful? React with 👍 or 👎 to give feedback.
all-hands-bot
left a comment
There was a problem hiding this comment.
✅ QA Report: PASS
Runtime local plugin loading works end-to-end: I verified the base branch lacks the API, then loaded local marketplace plugins at runtime on the PR branch and executed a newly loaded MCP tool.
Does this PR achieve its stated goal?
Yes. The PR set out to add LocalConversation.load_plugin(plugin_ref) for runtime SDK-local marketplace plugin loading, supporting plugin-name and plugin-name@marketplace-name, merging plugin skills/MCP/hooks/agent definitions, and rebuilding tools after the agent was already initialized. In a real SDK script, the PR branch loaded qualified and unqualified plugin refs, added the runtime skill, registered the plugin agent, merged a hook matcher, rebuilt MCP tools after _ensure_agent_ready(), and executed the dynamically loaded runtime_echo MCP tool successfully.
| Phase | Result |
|---|---|
| Environment Setup | ✅ make build completed successfully and installed the uv workspace environment. |
| CI Status | ✅ 13 checks passing; qa-changes pending/in progress; check-pr-artifacts skipped at observation time. |
| Functional Verification | ✅ Runtime marketplace plugin loading, missing-marketplace error handling, and MCP tool execution verified. |
Functional Verification
Test 1: Baseline branch does not expose runtime plugin loading
Step 1 — Reproduce / establish baseline without the feature:
Checked out feat/marketplace-autoload-registrations, then ran uv run python /tmp/qa_runtime_plugin_loading.py baseline:
mode=baseline
has_load_plugin=False
baseline_result=LocalConversation has no runtime load_plugin API
This establishes the prior user-facing SDK state: a LocalConversation created with a registered marketplace has no runtime load_plugin method on the base branch.
Step 2 — Apply the PR's changes:
Checked out feat/marketplace-runtime-load-plugin at c3ff1866165c8619fec4fb206c5d5f3a941f3453.
Step 3 — Re-run with the feature branch:
Ran uv run python /tmp/qa_runtime_plugin_loading.py head against a temporary local marketplace containing skill, hook, MCP, and file-agent plugins:
mode=head
has_load_plugin=True
skills_after_qualified_load=runtime-skill
plugin_agent_registered=True
hook_matchers_after_unqualified_load=qa-*
tools_before_runtime_mcp=finish,think
mcp_servers_after_runtime_load=qa-runtime-server
tools_after_runtime_mcp=finish,runtime_echo,think
runtime_mcp_tool_available=True
resolved_plugins_count=3
This confirms the new public API exists and delivers the intended behavior: plugin-name@marketplace-name loaded the skill/agent plugin, unqualified plugin-name loaded the hook and MCP plugins, and the runtime MCP config rebuilt the initialized agent tools so runtime_echo became available after the agent had already been readied.
Test 2: Dynamically loaded MCP tool is actually executable
Step 1 — Establish pre-load state:
The previous run showed tools_before_runtime_mcp=finish,think, so the runtime MCP tool was not present before loading the MCP plugin.
Step 2 — Apply the PR's runtime load path and invoke the tool:
Ran uv run python /tmp/qa_runtime_plugin_loading.py call-mcp:
mode=call-mcp
has_load_plugin=True
Created 1 MCP tools
Loaded 1 tools from spec
mcp_tool_call_observation=content=[TextContent(cache_prompt=False, type='text', text="[Tool 'runtime_echo' executed.]"), TextContent(cache_prompt=False, type='text', text='runtime:hello')] is_error=False tool_name='runtime_echo' kind='MCPToolObservation'
This goes beyond checking configuration: the SDK started the plugin-provided FastMCP stdio server, created the MCP tool, and executed it with real input (hello), returning runtime:hello with is_error=False.
Test 3: Missing marketplace configuration returns a clear error
Step 1 — Baseline:
On the base branch this runtime API does not exist, as shown in Test 1.
Step 2 — Run the PR branch error path:
Ran uv run python /tmp/qa_runtime_plugin_loading.py missing-marketplace with an AgentContext that had no registered marketplaces:
mode=missing-marketplace
has_load_plugin=True
missing_marketplace_error=No marketplaces registered. Configure registered_marketplaces in AgentContext to use load_plugin().
This confirms the new runtime API fails clearly when users call it without the required marketplace registration.
Issues Found
None.
This QA review was created by an AI agent (OpenHands) on behalf of the user.
VascoSch92
left a comment
There was a problem hiding this comment.
A couple of things to double-check.
8dffdcc to
49d983b
Compare
c3ff186 to
5e9bef4
Compare
49d983b to
407def2
Compare
|
✅ Review complete. This review was performed through OpenHands Cloud Automation. You can log in and view the conversation here. |
5e9bef4 to
31a70a3
Compare
407def2 to
443524f
Compare
31a70a3 to
782fd80
Compare
all-hands-bot
left a comment
There was a problem hiding this comment.
🟢 Good taste — Clean, well-structured feature with all prior review threads resolved and good test coverage.
This PR (Phase 3 of the marketplace stack) adds LocalConversation.load_plugin(plugin_ref) cleanly: secret-ref expansion, skill/MCP/hook/agent merging, proper tool lifecycle management via add_runtime_tools, and correct hook processor teardown+restart. The refactor of the local _expand_secret_refs closure into _expand_plugin_source_ref is a good encapsulation improvement. Two minor observations below — neither is blocking.
[IMPROVEMENT OPPORTUNITIES]
- [
openhands-sdk/openhands/sdk/agent/base.py, Line 916] Validation order:tool_names = [tool.name for tool in tools]runs before theisinstance(tool, ToolDefinition)guard (line 922). A non-ToolDefinitionobject without a.nameattribute raisesAttributeErrorrather than the intendedValueError. In practice unreachable through current callers (bothcreate_mcp_toolsandInvokeSkillTool.createreturn typedToolDefinitionlists), but the defensive check defeats itself in its current order. Fix: validateisinstancein a pre-pass before buildingtool_names. - [
openhands-sdk/openhands/sdk/agent/base.py, Line 918] O(n²) duplicate detection:{name for name in tool_names if tool_names.count(name) > 1}is O(n²). Negligible for typical tool counts, butCounter-based detection is cleaner and idiomatic.
[RISK ASSESSMENT]
- [Overall PR]
⚠️ Risk Assessment: 🟢 LOW
SDK-local only; no agent-server routes or public API changes. All changes are additive — newadd_runtime_toolsonAgentandload_pluginonLocalConversation. Existing plugin loading (_ensure_plugins_loaded) is refactored minimally (closure → method) with no behavioral change. Test suite covers new paths including hook lifecycle.
VERDICT:
✅ Worth merging: Core logic is sound, prior feedback fully addressed, implementation matches the stated scope.
KEY INSIGHT:
The dual-MCP-variable approach (keeping runtime_plugin_mcp for tool creation separate from merged_mcp for agent state) correctly avoids reinitializing existing stateful MCP sessions on each plugin load.
This review was generated by an AI agent (OpenHands) on behalf of the user through OpenHands Automation. View conversation
Improve this review? If any feedback above seems incorrect or irrelevant to this repository, you can teach the reviewer to do better:
- Add a
.agents/skills/custom-codereview-guide.mdfile to your branch (or edit it if one already exists) with the/codereviewtrigger and the context the reviewer is missing. See the customization docs for the required frontmatter format.- Re-request a review - the reviewer reads guidelines from the PR branch, so your changes take effect immediately.
Resolve with AI? Install the iterate skill in your agent and run
/iterateto automatically drive this PR through CI, review, and QA until it's merge-ready.Was this review helpful? React with 👍 or 👎 to give feedback.
all-hands-bot
left a comment
There was a problem hiding this comment.
✅ QA Report: PASS
Runtime local plugin loading works end-to-end for marketplace resolution, skills, MCP tools after agent initialization, hooks, plugin agent definitions, and missing-registration errors.
Does this PR achieve its stated goal?
Yes. I exercised the SDK as a user by constructing local marketplace/plugin directories and calling Conversation(...).load_plugin(...) at runtime; the base branch lacks this capability (AttributeError), while the PR branch loads plugins by both plugin-name and plugin-name@marketplace-name, updates skills/resolved plugin state, exposes an MCP tool after the agent was already ready, merges hook config, registers plugin agent definitions, and returns a clear error when no marketplaces are configured.
| Phase | Result |
|---|---|
| Environment Setup | ✅ make build completed and installed the editable SDK packages in .venv |
| CI Status | ⏳ 9 checks passing; sdk-tests and cross-tests still in progress when checked |
| Functional Verification | ✅ Real SDK scripts exercised runtime plugin loading behavior successfully |
Functional Verification
Test 1: Baseline without the PR has no runtime plugin load entry point
Step 1 — Reproduce / establish baseline (without the fix):
Checked out origin/feat/marketplace-autoload-registrations at 443524fa2b93cd976ac76332c32d8bb05738af5c and ran:
OPENHANDS_SUPPRESS_BANNER=1 uv run python /tmp/qa_runtime_plugin.py skill; echo EXIT:$?Observed:
AttributeError: 'LocalConversation' object has no attribute 'load_plugin'
EXIT:1
This confirms the base branch cannot load a marketplace plugin at runtime through LocalConversation/Conversation.
Step 2 — Apply the PR's changes:
Checked out feat/marketplace-runtime-load-plugin at 5e9bef4c56c6fb78b43112fe3d560e23800abb86.
Step 3 — Re-run with the fix in place:
Ran:
OPENHANDS_SUPPRESS_BANNER=1 uv run python /tmp/qa_runtime_plugin.py skillObserved:
Loaded plugin 'runtime-skill' from /tmp/.../marketplace/plugins/runtime-skill
SKILL_OK ['qa-runtime-skill'] resolved_plugins 1
This shows runtime load_plugin("runtime-skill@qa") now resolves the local marketplace entry, loads the plugin skill into the conversation agent context, and records the resolved plugin.
Test 2: Supported plugin reference syntaxes
Ran on the PR branch:
OPENHANDS_SUPPRESS_BANNER=1 uv run python /tmp/qa_runtime_plugin.py refsObserved:
Loaded plugin 'first-plugin' from /tmp/.../marketplace/plugins/first
Loaded plugin 'second-plugin' from /tmp/.../marketplace/plugins/second
REFS_OK ['qa-first-skill', 'qa-second-skill']
This verifies both plugin-name and plugin-name@marketplace-name references work against registered marketplaces and merge skills into the active conversation agent.
Test 3: MCP tools are available after the agent is already initialized
Ran on the PR branch with a real local FastMCP stdio server plugin:
OPENHANDS_SUPPRESS_BANNER=1 uv run python /tmp/qa_runtime_plugin.py mcp_after_readyObserved:
Created 1 MCP tools
MCP_OK before ['finish', 'think'] after ['finish', 'runtime_echo', 'think']
This confirms a runtime-loaded plugin can add MCP config after _ensure_agent_ready() has already initialized tools, and the newly discovered MCP tool (runtime_echo) becomes available without losing existing tools.
Test 4: Runtime hook config is merged
Ran a plugin load with an existing PreToolUse hook plus a runtime plugin hook:
OPENHANDS_SUPPRESS_BANNER=1 uv run python - <<'PY'
# Construct local hook plugin, load it, and print merged matchers
PYObserved:
Loaded hooks from /tmp/.../runtime-hook/hooks/hooks.json
Loaded plugin 'runtime-hook' from /tmp/.../marketplace/plugins/runtime-hook
HOOKS_OK ['explicit-*', 'runtime-*']
This verifies runtime plugin hooks merge with existing conversation hook config instead of replacing it.
Test 5: Runtime plugin agent definitions are registered
Ran a plugin load with an agents/<name>.md file-based agent definition:
OPENHANDS_SUPPRESS_BANNER=1 uv run python - <<'PY'
# Construct local agent plugin, load it, and inspect registered agent definitions
PYObserved:
Loaded plugin 'runtime-agent' from /tmp/.../marketplace/plugins/runtime-agent
Registered plugin agent 'qa-plugin-agent-500c62b2'
AGENT_OK qa-plugin-agent-500c62b2 Runtime QA plugin agent
This verifies plugin agent definitions are registered when the plugin is loaded at runtime.
Test 6: Missing marketplace configuration errors clearly
Ran on the PR branch with an AgentContext that has no registered_marketplaces:
OPENHANDS_SUPPRESS_BANNER=1 uv run python - <<'PY'
# Create Conversation without registered marketplaces and call load_plugin('missing-plugin')
PYObserved:
ValueError No marketplaces registered. Configure registered_marketplaces in AgentContext to use load_plugin().
This confirms the runtime entry point fails with an actionable error for the missing-registration case.
Issues Found
None.
This QA review was created by an AI agent (OpenHands) on behalf of the user.
443524f to
060b73a
Compare
|
Glad to see we've closed the runtime plugin-loading gap that existed in #2495 — the one @enyst pointed out (plugin hooks/agents not merged and MCP tools not rebuilt after Comment posted by an AI agent (OpenHands) on behalf of the user. |
782fd80 to
f85c59f
Compare
|
✅ Review complete. This review was performed through OpenHands Cloud Automation. You can log in and view the conversation here. |
all-hands-bot
left a comment
There was a problem hiding this comment.
🟡 Acceptable — Clean runtime plugin loading with solid test coverage
All previously flagged issues from earlier review rounds are addressed in the current HEAD. Two minor suggestions below; neither is a blocker.
[IMPROVEMENT OPPORTUNITIES]
-
Silent no-op in
add_runtime_toolswhen uninitialized:if not self._initialized: returndrops all tools silently when the agent has not been initialized. The calling path inload_pluginguards this withif self._agent_ready:, butadd_runtime_toolsis now public API and a direct caller would silently lose all tools with no indication of why. Consider at leastlogger.warning(...)before thereturnso misbehavior is observable. -
Hardcoded 30-second MCP timeout:
create_mcp_tools(plugin_mcp_config, 30)in_runtime_tools_for_plugin. A named constant or keyword argument would make this easier to track and tune without hunting for magic numbers.
[RISK ASSESSMENT]
- [Overall PR]
⚠️ Risk Assessment: 🟡 MEDIUM. New public API on bothLocalConversation(load_plugin) and the agent base class (add_runtime_tools). Logic is well-tested for happy paths and error cases. The coordination of agent state, MCP config, hooks, and resolved plugins in a single method warrants careful integration testing before enabling in production flows.
VERDICT:
✅ Worth merging: Core logic is sound; all prior review feedback incorporated.
KEY INSIGHT:
Extracting _expand_secret_refs into _expand_plugin_source_ref and threading it through load_plugin is the right move — it eliminates the previous duplication and keeps secret-expansion behavior consistent across both pre-load and runtime-load paths.
Improve this review? If any feedback above seems incorrect or irrelevant to this repository, you can teach the reviewer to do better:
- Add a
.agents/skills/custom-codereview-guide.mdfile to your branch (or edit it if one already exists) with the/codereviewtrigger and the context the reviewer is missing. See the customization docs for the required frontmatter format.- Re-request a review — the reviewer reads guidelines from the PR branch, so your changes take effect immediately.
- When your PR is merged, the guideline file goes through normal code review by repository maintainers.
Resolve with AI? Install the iterate skill in your agent and run
/iterateto automatically drive this PR through CI, review, and QA until it is merge-ready.Was this review helpful? React with 👍 or 👎 to give feedback.
This review was generated by an AI agent (OpenHands) on behalf of the user through OpenHands Automation. View conversation
all-hands-bot
left a comment
There was a problem hiding this comment.
✅ QA Report: PASS
Runtime marketplace plugin loading works end-to-end on the PR branch; I verified skills, qualified/unqualified marketplace refs, hook merging, plugin agent registration, and post-initialization MCP tool availability with a real local SDK conversation.
Does this PR achieve its stated goal?
Yes. The PR set out to add LocalConversation.load_plugin(plugin_ref) for SDK-local runtime plugin loading from registered marketplaces and merge plugin skills, MCP config/tools, hooks, and agent definitions into the active conversation. On the base commit, the same real-user script reports RESULT: load_plugin_missing; on the PR head, runtime loading succeeds for both runtime-plugin@local and runtime-plugin, the new skill/hook/subagent are visible, and an already-initialized conversation gains the runtime MCP tool qa_echo without losing existing tools.
| Phase | Result |
|---|---|
| Environment Setup | ✅ uv sync --dev completed and installed the project environment. |
| CI Status | ✅ All non-QA checks observed green; qa-changes was still in progress when checked. |
| Functional Verification | ✅ Real SDK conversation exercised runtime marketplace plugin loading and post-ready MCP tool reinitialization. |
Functional Verification
Test 1: Runtime plugin loading from a registered local marketplace
Step 1 — Establish baseline without the PR change:
Checked out base commit 060b73a6 and ran uv run python /tmp/qa_runtime_plugin_loading.py:
RESULT: load_plugin_missing
This shows the base branch does not expose the runtime load_plugin() entry point, so a user cannot load a marketplace plugin after creating a local conversation.
Step 2 — Apply the PR's changes:
Checked out PR branch feat/marketplace-runtime-load-plugin at f85c59fb9549d6bc4d7129250c712a7f50a66a3a.
Step 3 — Re-run with the PR change:
Ran uv run python /tmp/qa_runtime_plugin_loading.py against a temporary local marketplace containing a plugin skill, hook config, subagent markdown file, and MCP server config:
QUALIFIED_SKILLS: ['runtime-skill']
QUALIFIED_RESOLVED_COUNT: 1
HOOK_MATCHERS: ['qa-*']
PLUGIN_AGENTS: ['qa-runtime-agent']
UNQUALIFIED_SKILLS: ['runtime-skill']
This confirms both qualified (runtime-plugin@local) and unqualified (runtime-plugin) references resolve through the registered marketplace, and the runtime plugin contributes skills, hooks, resolved plugin metadata, and plugin agent definitions to the local conversation.
Test 2: Post-initialization MCP/runtime tools become available
Step 1 — Establish baseline without runtime MCP loading:
In the same script, I created a conversation, called _ensure_agent_ready() before loading the plugin, and recorded tools before the runtime load:
TOOLS_BEFORE: ['finish', 'think']
This confirms the agent had already initialized its original tool set before the runtime plugin was loaded.
Step 2 — Load the runtime plugin with MCP config:
Called conversation.load_plugin("runtime-plugin") on the already-ready conversation. The plugin's .mcp.json started a real FastMCP stdio server exposing a qa_echo tool.
Step 3 — Verify tools after runtime load:
The same run printed:
Created 1 MCP tools
TOOLS_AFTER: ['finish', 'invoke_skill', 'qa_echo', 'think']
MCP_CONFIG_KEYS: ['qa-runtime']
This confirms the PR updates the active conversation's MCP config and adds runtime MCP tools after _ensure_agent_ready() has already run, while preserving existing tools.
Notes: I did not run pytest, pre-commit, linters, or the full test suite; this was functional QA via a real SDK script.
Issues Found
None.
This review was created by an AI agent (OpenHands) on behalf of the user.
f85c59f to
cd112bd
Compare
|
✅ Review complete. This review was performed through OpenHands Cloud Automation. You can log in and view the conversation here. |
all-hands-bot
left a comment
There was a problem hiding this comment.
✅ QA Report: PASS
Runtime marketplace plugin loading works end-to-end for local SDK conversations, including bare/qualified refs, merged skills/hooks, and MCP tools added after agent readiness.
Does this PR achieve its stated goal?
Yes. The PR set out to add LocalConversation.load_plugin(plugin_ref) for runtime loading from registered marketplaces and to make runtime-loaded plugin capabilities available in local conversations. I exercised the SDK directly with temporary real marketplace/plugin directories: the base branch has no load_plugin API, while the PR branch successfully loaded the same plugin via both runtime-qa@qa and runtime-qa, updated conversation state/resolved plugins, merged a skill and hook, and added a live MCP tool after the agent was already initialized.
| Phase | Result |
|---|---|
| Environment Setup | ✅ uv run created the project environment and import openhands.sdk succeeded. |
| CI Status | 🟡 Most checks were green; qa-changes was still in progress when checked. |
| Functional Verification | ✅ Runtime plugin loading and runtime MCP tool registration worked with real SDK calls. |
Functional Verification
Test 1: Runtime local plugin loading from a registered marketplace
Step 1 — Reproduce / establish baseline without the PR:
Ran git checkout feat/marketplace-autoload-registrations && OPENHANDS_SUPPRESS_BANNER=1 uv run python /tmp/qa_runtime_plugin.py; echo exit_code=$?:
workspace=/tmp/oh-runtime-plugin-qa-pyb0h7ts/workspace
has_load_plugin=False
load_plugin API is unavailable on this branch
exit_code=2
This confirms the base branch cannot perform runtime marketplace plugin loading because LocalConversation.load_plugin is not available.
Step 2 — Apply the PR's changes:
Checked out feat/marketplace-runtime-load-plugin at cd112bdc.
Step 3 — Re-run with the PR:
Ran OPENHANDS_SUPPRESS_BANNER=1 uv run python /tmp/qa_runtime_plugin.py:
workspace=/tmp/oh-runtime-plugin-qa-0h19yzg0/workspace
has_load_plugin=True
ref=runtime-qa@qa
skills_before= []
resolved_before= None
skills_after= ['runtime-advice']
resolved_count= 1
resolved_sources= ['/tmp/oh-runtime-plugin-qa-0h19yzg0/marketplace/plugins/runtime-qa']
post_tool_hooks= 1
agent_state_updated= True
ref=runtime-qa
skills_before= []
resolved_before= None
skills_after= ['runtime-advice']
resolved_count= 1
resolved_sources= ['/tmp/oh-runtime-plugin-qa-0h19yzg0/marketplace/plugins/runtime-qa']
post_tool_hooks= 1
agent_state_updated= True
RESULT=runtime plugin loaded successfully by qualified and bare refs
This shows the new API loads a local plugin from a registered marketplace using both supported ref forms, merges the plugin skill and hook, records a resolved plugin, and updates the conversation's agent state.
Test 2: Runtime MCP tool registration after agent readiness
Step 1 — Reproduce / establish baseline without the PR:
Ran git checkout feat/marketplace-autoload-registrations && OPENHANDS_SUPPRESS_BANNER=1 uv run python /tmp/qa_runtime_mcp_plugin.py; echo exit_code=$?:
workspace=/tmp/oh-runtime-mcp-qa-nobvjm_m/workspace
has_load_plugin=False
load_plugin API is unavailable on this branch
exit_code=2
This confirms the base branch has no runtime entry point for loading an MCP-providing plugin after conversation creation.
Step 2 — Apply the PR's changes:
Checked out feat/marketplace-runtime-load-plugin at cd112bdc.
Step 3 — Re-run with the PR:
Ran OPENHANDS_SUPPRESS_BANNER=1 uv run python /tmp/qa_runtime_mcp_plugin.py:
workspace=/tmp/oh-runtime-mcp-qa-2tswn4uw/workspace
has_load_plugin=True
agent_ready_before= True
tools_before= ['finish', 'think']
new_tools= ['runtime_echo']
mcp_servers= ['qa-runtime']
RESULT=runtime MCP tool available after agent readiness
This shows a plugin with a real stdio MCP server can be loaded after the agent has already initialized, and the new MCP tool becomes available without losing existing tools.
Test 3: Missing marketplace configuration error path
Ran OPENHANDS_SUPPRESS_BANNER=1 uv run python /tmp/qa_runtime_plugin_error.py on the PR branch:
has_load_plugin= True
ValueError: No agent context available. Configure agent_context with registered_marketplaces to use load_plugin().
This confirms users get an actionable error when calling load_plugin() without marketplace registration.
Issues Found
None.
This QA review was created by an AI agent (OpenHands) on behalf of the user.
all-hands-bot
left a comment
There was a problem hiding this comment.
🟡 Acceptable — the core feature is well-covered and the targeted test suite passes, but I found two important runtime-safety issues that should be addressed before I can approve this review round.
[CRITICAL ISSUES]
- See inline comments: runtime hook loading mutates conversation state/callbacks without the
LocalConversationstate lock, and runtime plugin loading logs the marketplace-provided source without redaction.
[TESTING]
- I ran
uv run pytest tests/sdk/conversation/test_local_conversation_plugins.py -qlocally: 28 passed.
[RISK ASSESSMENT]
- [Overall PR]
⚠️ Risk Assessment: 🟡 MEDIUM
This adds a public runtime plugin-loading path that can mutate agent context, MCP tools, hooks, plugin agents, and secret-expanded plugin sources after conversation construction. The implementation is mostly localized and tested, but the touched surfaces include tool lifecycle, hook callbacks, and secrets/logging behavior, so it should be merged with caution after the inline issues are fixed.
VERDICT:
❌ Needs rework: The feature direction is sound, but runtime loading needs to preserve the same state-locking and secret-redaction invariants as startup plugin loading.
KEY INSIGHT: Runtime plugin loading is no longer just configuration assembly; it is live conversation mutation, so it must be atomic and safe around state/callback updates.
Improve this review? If any feedback above seems incorrect or irrelevant to this repository, you can teach the reviewer to do better:
- Add a
.agents/skills/custom-codereview-guide.mdfile to your branch (or edit it if one already exists) with the/codereviewtrigger and the context the reviewer is missing (e.g., "Security concerns about X do not apply here because Y"). See the customization docs for the required frontmatter format.- Re-request a review - the reviewer reads guidelines from the PR branch, so your changes take effect immediately.
- When your PR is merged, the guideline file goes through normal code review by repository maintainers.
Resolve with AI? Install the iterate skill in your agent and run
/iterateto automatically drive this PR through CI, review, and QA until it's merge-ready.Was this review helpful? React with 👍 or 👎 to give feedback.
This review was generated by an AI agent (OpenHands) on behalf of the user through OpenHands Automation. View conversation
cd112bd to
ad5ce25
Compare
060b73a to
339f257
Compare
027d1ab to
edbc276
Compare
Add LocalConversation.load_plugin for registered marketplace plugin references and reset initialized agent tools when runtime MCP config changes. Co-authored-by: openhands <openhands@all-hands.dev>
Co-authored-by: openhands <openhands@all-hands.dev>
Co-authored-by: openhands <openhands@all-hands.dev>
edbc276 to
7745f89
Compare
Python API breakage checks — ✅ PASSEDResult: ✅ PASSED |
REST API breakage checks (OpenAPI) — ✅ PASSEDResult: ✅ PASSED |
Co-authored-by: openhands <openhands@all-hands.dev>
HUMAN:
Phase 3 of the marketplace implementation changes. This PR tightly integrates the marketplace data classes into the plugin loading machinery for local conversations.
AGENT:
Summary
Chunk 3 of the marketplace-registration reimplementation, stacked after #3825.
LocalConversation.load_plugin(plugin_ref)for resolving and loading plugins from registered marketplaces at runtime.plugin-nameandplugin-name@marketplace-namereferences throughMarketplaceRegistry._ensure_agent_ready()has already run.Why
Runtime marketplace plugin loading lets local conversations opt into additional plugin capabilities after startup without reinitializing the whole conversation.
Scope
This is SDK-local runtime loading only. Agent-server routes and
RemoteConversation.load_plugin(...)are planned for later chunks in this stack.How to Test
This PR was created by an AI agent (OpenHands) on behalf of the user.
@csmith49 can click here to continue refining the PR
Agent Server images for this PR
• GHCR package: https://github.com/OpenHands/agent-sdk/pkgs/container/agent-server
Variants & Base Images
eclipse-temurin:17-jdknikolaik/python-nodejs:python3.13-nodejs22-slimgolang:1.21-bookwormPull (multi-arch manifest)
# Each variant is a multi-arch manifest supporting both amd64 and arm64 docker pull ghcr.io/openhands/agent-server:4135dc7-pythonRun
All tags pushed for this build
About Multi-Architecture Support
4135dc7-python) is a multi-arch manifest supporting both amd64 and arm644135dc7-python-amd64) are also available if needed