Repository navigation
fix(agent-guard): discover contributed skill guards under plugins/*/skills/*/guards - #1757
Conversation
cad5280 to
88d986e
Compare
|
Hi @potiuk - while auditing Post-modularization (#1087 / #1672), guards live under This PR adds plugin guard discovery, hardens directory deduplication with |
potiuk
left a comment
There was a problem hiding this comment.
Discovering guards under plugins/*/skills/*/guards and deduplicating by resolved path is the right fix; I merged it with current main locally, the isolated-setup fingerprint still holds and the agent-guard suites pass. One follow-up outside this PR's scope: the separately published magpie-agent-guard marketplace plugin has neither skills/ nor plugins/ beside the engine, so framework_root() is still None there and the skill guards stay undiscovered on a marketplace install — worth its own issue.
This review was drafted by an AI-assisted tool and
confirmed by an Apache Magpie maintainer. The maintainer
approving this PR has read the findings and signed off. If
something feels off, please reply on the PR and a maintainer
will follow up.More on how Apache Magpie handles maintainer review:
Contributing guide.
While exploring the
agent-guarddispatcher and auditing how pre-execution hooks discover skill guards across different harnesses, I noticed thatagent_guard.discover_guards()was returning only 1 guard (no_verify_commit.pyfromguards.d/), completely omitting the domain-specific safety guards documented in the README (mention,mark_ready, andsecurity_language).Tracking down the discovery logic,
guard_dirs()was still scanning(root / "skills").glob("*/guards"). Following the modular plugin migration (#1087 / #1672), canonical guards live underplugins/*/skills/*/guards. On checkouts whereskills/*entries are symlinks (or in adopter repositories deploying plugins directly without top-level symlink mirrors), the glob returned empty and the guards silently dropped.Summary
agent_guard.guard_dirs()to discover contributed skill guards underplugins/*/skills/*/guardsin addition toskills/*/guards(retaining backwards compatibility).framework_root()to recognize eitherskills/orplugins/sitting besidetools/agent-guard.d.resolve()so environments exposing both canonical plugin paths andskills/symlinks do not register duplicate guard instances.tools/agent-guard/tests/test_skill_guards.pyandtest_discovery.pywith canonical plugin directories, cross-platform path handling, and new regression unit tests.Type of change
tools/*/withpyproject.toml)prek, workflows, validators)Test plan
ruff checkandruff format --checkpass with zero warnings across all touched files.mypy --platform linux tools/agent-guard/src/agent_guardpasses (Success: no issues found in 3 source files).pytest tools/agent-guard/tests/test_skill_guards.py tools/agent-guard/tests/test_discovery.pypasses cleanly (87 passed, 2 skipped on Windows non-admin symlink privileges).test_plugin_skill_guards_are_discovered()test_guard_dirs_deduplicates_symlinks()agent_guard.discover_guards()discovers all 4 active guards (no_verify_commit,mention,mark_ready,security_language).RFC-AI-0004 compliance
Linked issues
Fixes #1756