feat: support workspace skills in requests#8884
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces request-scoped 'Workspace Skills' that are discovered under the session workspace directory and injected during local runtime execution. It includes priority rules for merging workspace skills with other skill sources, updates to documentation and localization, and comprehensive unit tests. The review feedback suggests resolving the workspace root and verifying that the resolved skills root is relative to it to prevent directory traversal vulnerabilities, as well as wrapping directory iteration in a try-except block to handle potential OS errors.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
Hey - I've found 2 issues, and left some high level feedback:
- In
list_workspace_skills, there are several broadexcept Exception/except OSErrorblocks that silently drop entries; consider narrowing the exception types and/or adding minimal logging so unexpected filesystem issues are detectable rather than quietly skipping skills. - The logic that merges
workspace_skillsintoskillsin_ensure_persona_and_skillsbuilds a dict and then re-sorts by name; if priority ordering across different sources ever becomes more complex, it might be clearer to extract this merge/priority policy into a dedicated helper to keep the agent setup function easier to follow.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `list_workspace_skills`, there are several broad `except Exception`/`except OSError` blocks that silently drop entries; consider narrowing the exception types and/or adding minimal logging so unexpected filesystem issues are detectable rather than quietly skipping skills.
- The logic that merges `workspace_skills` into `skills` in `_ensure_persona_and_skills` builds a dict and then re-sorts by name; if priority ordering across different sources ever becomes more complex, it might be clearer to extract this merge/priority policy into a dedicated helper to keep the agent setup function easier to follow.
## Individual Comments
### Comment 1
<location path="astrbot/core/skills/skill_manager.py" line_range="401" />
<code_context>
+ SkillInfo(
+ name=skill_name,
+ description=description,
+ path=str(resolved_skill_md).replace("\\", "/"),
+ active=True,
+ source_type="workspace",
</code_context>
<issue_to_address>
**suggestion:** Consider using `Path.as_posix()` instead of manual string replacement for normalization.
Because `resolved_skill_md` is already a `Path`, `resolved_skill_md.as_posix()` is a clearer and more robust way to normalize separators than `str(...).replace("\\", "/")`, and avoids issues if backslashes appear elsewhere in the string representation.
```suggestion
path=resolved_skill_md.as_posix(),
```
</issue_to_address>
### Comment 2
<location path="tests/unit/test_astr_main_agent.py" line_range="850-853" />
<code_context>
+ req = ProviderRequest()
+ req.conversation = MagicMock(persona_id=None)
+
+ await module._ensure_persona_and_skills(req, {}, mock_context, mock_event)
+
+ assert "**workspace-skill**" in req.system_prompt
</code_context>
<issue_to_address>
**suggestion (testing):** Make the runtime explicit in the test to decouple it from default behavior
Right now the test passes `{}` for `runtime`, which depends on `_ensure_persona_and_skills`’ default runtime behavior. Because workspace skills are only enabled for certain runtime modes (e.g. `"local"`), the test could change meaning if that default changes. Please pass an explicit runtime config (e.g. `{"computer_use_runtime": "local"}`) and assert behavior for that specific mode.
```suggestion
req = ProviderRequest()
req.conversation = MagicMock(persona_id=None)
runtime_config = {"computer_use_runtime": "local"}
await module._ensure_persona_and_skills(req, runtime_config, mock_context, mock_event)
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Summary
Tests
Summary by Sourcery
Add support for request-scoped workspace Skills that are discovered per-session and injected into requests with defined source precedence and sanitization.
New Features:
Enhancements:
Documentation:
Tests: