Keep plugin-aware CLI validation aligned with the shared registry

The shared /plugins command flow already routes through the plugin registry, but
allowed-tool normalization still fell back to builtin tools when registry
construction failed. This keeps plugin-related validation errors visible at the
CLI boundary and updates tools tests to use the enum-based plugin permission
API so workspace verification remains green.

Constraint: Plugin tool permissions are now strongly typed in the plugins crate
Rejected: Restore string-based permission arguments in tests | weakens the plugin API contract
Rejected: Keep builtin fallback in normalize_allowed_tools | masks plugin registry integration failures
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: Do not silently bypass current_tool_registry() failures unless plugin-aware allowed-tool validation is intentionally being disabled
Tested: cargo test -p commands -- --nocapture; cargo test --workspace
Not-tested: Manual REPL /plugins interaction in a live session
This commit is contained in:
Yeachan-Heo
2026-04-01 07:22:41 +00:00
parent f967484b9a
commit a10bbaf8de
2 changed files with 51 additions and 10 deletions

View File

@@ -3099,7 +3099,7 @@ mod tests {
execute_tool, final_assistant_text, mvp_tool_specs, persist_agent_terminal_state,
AgentInput, AgentJob, GlobalToolRegistry, SubagentToolExecutor,
};
use plugins::{PluginTool, PluginToolDefinition};
use plugins::{PluginTool, PluginToolDefinition, PluginToolPermission};
use runtime::{ApiRequest, AssistantEvent, ConversationRuntime, RuntimeError, Session};
use serde_json::json;
@@ -3181,7 +3181,7 @@ mod tests {
},
script.display().to_string(),
Vec::new(),
"workspace-write",
PluginToolPermission::WorkspaceWrite,
script.parent().map(PathBuf::from),
)])
.expect("registry should build");
@@ -3217,7 +3217,7 @@ mod tests {
},
"echo".to_string(),
Vec::new(),
"read-only",
PluginToolPermission::ReadOnly,
None,
)])
.expect_err("conflicting plugin tool should fail");