Skip to content

fix: stop misclassifying plugin skills as sandbox-only via stale cache - #9755

Open
Rain-0x01-39 wants to merge 1 commit into
AstrBotDevs:masterfrom
Rain-0x01-39:fix/9754
Open

fix: stop misclassifying plugin skills as sandbox-only via stale cache#9755
Rain-0x01-39 wants to merge 1 commit into
AstrBotDevs:masterfrom
Rain-0x01-39:fix/9754

Conversation

@Rain-0x01-39

@Rain-0x01-39 Rain-0x01-39 commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Fixes #9754

Modifications / 改动点

  • SkillManager.is_sandbox_only_skill() now returns False when the name resolves to a plugin-provided skill directory, before consulting the sandbox skills cache.

  • Previously, the method only checked the local skills_root and data/sandbox_skills_cache.json. That cache is persistent and never cleaned up when switching back to the local runtime, so a leftover entry with the same name as a builtin-star skill (e.g. the pdf skill shipped by the builtin astrbot star) made SkillsService.resolve_local_skill_dir() reject the skill with PermissionError: Sandbox preset skill cannot be opened from local skill files. even though the skill has real local files under astrbot/builtin_stars/astrbot/skills/ and should be viewable read-only in the Dashboard.

  • Added a regression test test_plugin_skill_with_stale_sandbox_cache_is_not_sandbox_only.

  • This is NOT a breaking change. / 这不是一个破坏性变更。

Screenshots or Test Results / 运行截图或测试结果

$ uv run pytest tests/test_skill_manager_sandbox_cache.py -q
4 passed, 1 warning in 9.41s

The new test fails on master (assertion at tests/test_skill_manager_sandbox_cache.py:211) and passes with the fix. Other skill-related suites show no new failures (9 pre-existing Windows path-related failures in tests/test_skill_metadata_enrichment.py etc. are identical with and without this change).

uv run ruff format and uv run ruff check pass on the touched files.


Checklist / 检查清单

  • 😊 If there are new features added in the PR, I have discussed it with the authors through issues/emails, etc.
    / 如果 PR 中有新加入的功能,已经通过 Issue / 邮件等方式和作者讨论过。

  • 👀 My changes have been well-tested, and "Verification Steps" and "Screenshots" have been provided above.
    / 我的更改经过了良好的测试,并已在上方提供了“验证步骤”和“运行截图”

  • 🤓 I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations in requirements.txt and pyproject.toml.
    / 我确保没有引入新依赖库,或者引入了新依赖库的同时将其添加到 requirements.txtpyproject.toml 文件相应位置。

  • 😮 My changes do not introduce malicious code.
    / 我的更改没有引入恶意代码。

Summary by Sourcery

Correct sandbox classification so plugin-provided skills take precedence over stale sandbox cache entries.

Bug Fixes:

  • Prevent plugin-provided skills from being misclassified as sandbox-only when a stale sandbox cache entry has the same name.
  • Allow local resolution and read-only dashboard access to plugin skills despite obsolete sandbox cache data.

Tests:

  • Add a regression test covering plugin skills that conflict with stale sandbox cache entries.

@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. area:core The bug / feature is about astrbot's core, backend labels Aug 21, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@Rain-0x01-39

Copy link
Copy Markdown
Contributor Author

The only failing check (Run pytest suite) is unrelated to this PR:

FAILED tests/test_anthropic_kimi_code_provider.py::test_create_http_client_uses_anthropic_httpx_module
AttributeError: module 'anthropic._base_client' has no attribute 'httpx'. Did you mean: 'httpx2'?

This test monkeypatches the private attribute anthropic._base_client.httpx, which was renamed to httpx2 in a newer anthropic SDK release that CI resolved during this run (uv.lock pins 0.105.2, where it still passes — verified locally: 27 passed). All other checks including the new regression test pass (2163 passed).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:core The bug / feature is about astrbot's core, backend size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] 沙盒缓存残留导致内置 star 提供的 skill(如 pdf)被误判为 sandbox preset,WebUI 无法查看

1 participant