Skip to content

fix(plugins): revalidate cached skill roots after package changes - #5369

Open
yu-xin-c wants to merge 2 commits into
HKUDS:mainfrom
yu-xin-c:contrib/plugin-activation-cache
Open

fix(plugins): revalidate cached skill roots after package changes#5369
yu-xin-c wants to merge 2 commits into
HKUDS:mainfrom
yu-xin-c:contrib/plugin-activation-cache

Conversation

@yu-xin-c

Copy link
Copy Markdown
Contributor

Why

Agent Plugin activation is bound to an immutable package snapshot, but the filesystem read path reused cached plugin skill directories without checking whether the package had changed. An in-place replacement could therefore remain readable from a restricted project until another plugin discovery path happened to invalidate the cache.

What changed

  • bind cached skill roots to a lightweight metadata snapshot of each verified package
  • fall back to the existing full activation fingerprint check whenever package metadata changes
  • avoid caching or exposing roots when a package changes during verification
  • preserve the fast path for unchanged packages, including one full activation check across repeated reads
  • add a restricted-project regression test that replaces an enabled plugin resource in place and verifies access is revoked

The existing SHA-256 activation marker remains the source of truth; the metadata snapshot only decides when it must be checked again.

Verification

  • uv run --extra dev pytest tests/agent/test_agent_plugins.py tests/tools/test_read_enhancements.py -q (50 passed)
  • uv run --extra dev ruff check nanobot/agent/plugins.py tests/agent/test_agent_plugins.py
  • uv run --extra dev basedpyright nanobot/agent/plugins.py

@chengyongru chengyongru added bug Something isn't working fix priority: p2 Normal backlog: minor bug, enhancement, docs, cleanup, edge case, or unvalidated proposal. regression security test labels Aug 13, 2026
@Re-bin
Re-bin force-pushed the contrib/plugin-activation-cache branch from 5c3255e to 2f8811d Compare August 15, 2026 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working fix priority: p2 Normal backlog: minor bug, enhancement, docs, cleanup, edge case, or unvalidated proposal. regression security test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants