-
Notifications
You must be signed in to change notification settings - Fork 613
[BUG][PLUGIN]: Issues identified in several native plugins #2103
Description
Summary
This document details the issues found with plugins in plugins/config.yaml.
Each plugin was tested for instantiation and basic hook invocation using smoke tests introduced in #2102.
| Plugin | Status | Issue Type | Priority |
|---|---|---|---|
| ToolsTelemetryExporterPlugin | Partial | Metadata type mismatch | Medium |
| VaultPlugin | Partial | Metadata type mismatch | Medium |
| ALTKJsonProcessor | Broken | Missing dependency | High |
1. ToolsTelemetryExporterPlugin
Status: Partial (hook invocation fails)
File: plugins/tools_telemetry_exporter/telemetry_exporter.py
Hooks: tool_pre_invoke, tool_post_invoke
Test Results
- Instantiation: Pass
tool_pre_invokehook: Fails with errortool_post_invokehook: Pass (when no metadata access is required)
Issues
Metadata Type Mismatch (Medium Priority)
The plugin expects Tool and Gateway ORM objects in the global context metadata, but receives plain dictionaries:
ERROR - Plugin ToolsTelemetryExporter failed with error: 'dict' object has no attribute 'name'
Root Cause (telemetry_exporter.py:85-99):
def _get_pre_invoke_context_attributes(self, context: PluginContext) -> Dict:
global_context = context.global_context
tool_metadata: Tool = global_context.metadata.get(TOOL_METADATA) # Expects Tool object
target_mcp_server_metadata: Gateway = global_context.metadata.get(GATEWAY_METADATA) # Expects Gateway object
return {
# ...
"tool": {
"name": tool_metadata.name or "", # Fails if tool_metadata is a dict
"target_tool_name": tool_metadata.original_name or "",
"description": tool_metadata.description or "",
},
"target_mcp_server": {
"id": target_mcp_server_metadata.id or "", # Fails if metadata is a dict
"name": target_mcp_server_metadata.name or "",
"url": str(target_mcp_server_metadata.url or ""),
},
}Additionally:
- OpenTelemetry is an optional dependency and logs a warning when unavailable:
WARNING - ToolsTelemetryExporter: OpenTelemetry is not available. Telemetry export will be disabled.
Recommendation
Add defensive type checking for metadata to handle both object attributes and dictionary access:
tool_name = tool_metadata.name if hasattr(tool_metadata, 'name') else tool_metadata.get('name', '')2. VaultPlugin
Status: Partial (hook invocation fails)
File: plugins/vault/vault_plugin.py
Hooks: tool_pre_invoke
Test Results
- Instantiation: Pass
tool_pre_invokehook: Fails with error
Issues
Metadata Type Mismatch (Medium Priority)
The plugin expects the gateway metadata to have a tags attribute as an object property, but receives a plain dictionary:
ERROR - Plugin VaultPlugin failed with error: 'dict' object has no attribute 'tags'
Root Cause (vault_plugin.py:125-142):
async def tool_pre_invoke(self, payload: ToolPreInvokePayload, context: PluginContext) -> ToolPreInvokeResult:
# ...
gateway_metadata = context.global_context.metadata["gateway"]
if self._sconfig.system_handling == SystemHandling.TAG:
# Extract tags from dict format {"id": "...", "label": "..."}
normalized_tags: list[str] = []
for tag in gateway_metadata.tags: # Fails if gateway_metadata is a dict
# ...The code assumes gateway_metadata is an object with a .tags attribute, but when the metadata is passed as a dictionary, this access fails.
Recommendation
Add defensive type checking to support both dictionary and object access:
tags = gateway_metadata.tags if hasattr(gateway_metadata, 'tags') else gateway_metadata.get('tags', [])3. ALTKJsonProcessor
Status: Broken (cannot instantiate)
File: plugins/altk_json_processor/json_processor.py
Hooks: tool_post_invoke
Test Results
- Instantiation: Fails with ModuleNotFoundError
Issues
Missing Dependency (High Priority)
The plugin cannot be loaded because the altk (Agent Lifecycle Toolkit) package is not installed:
ModuleNotFoundError: No module named 'altk'
plugins/altk_json_processor/json_processor.py:16: in <module>
from altk.core.llm import get_llm
Import statements causing the failure:
from altk.core.llm import get_llm
from altk.core.toolkit import AgentPhase
from altk.post_tool.code_generation.code_generation import CodeGenerationComponent, CodeGenerationComponentConfig
from altk.post_tool.core.toolkit import CodeGenerationRunInput, CodeGenerationRunOutputRoot Cause
ALTK is an optional dependency defined in pyproject.toml:
[project.optional-dependencies]
altk = [
# ... altk dependencies
]The plugin imports ALTK modules at the top level without any graceful handling for when the dependency is not installed.
Recommendation
Make imports conditional:
try:
from altk.core.llm import get_llm
from altk.core.toolkit import AgentPhase
from altk.post_tool.code_generation.code_generation import CodeGenerationComponent, CodeGenerationComponentConfig
from altk.post_tool.core.toolkit import CodeGenerationRunInput, CodeGenerationRunOutput
ALTK_AVAILABLE = True
except ImportError:
ALTK_AVAILABLE = False
# Log warning during init
class ALTKJsonProcessor(Plugin):
def __init__(self, config: PluginConfig):
super().__init__(config)
if not ALTK_AVAILABLE:
logger.warning("ALTK not installed. Plugin will skip processing.")
# ...
async def tool_post_invoke(self, payload, context):
if not ALTK_AVAILABLE:
return ToolPostInvokeResult(continue_processing=True)
# ... rest of implementationTasks
- ToolsTelemetryExporterPlugin - Fix metadata access to support dictionary types
- VaultPlugin - Fix metadata access to support dictionary types
- ALTKJsonProcessor - Add conditional imports and graceful degradation when ALTK not installed