Repository navigation
Description
What happened
On Windows, turning on any skill package for an expert in Dashboard → 专家 → 技能 → 技能包 immediately returns 500 服务器内部错误. The toggle never succeeds, so skill packages cannot be used on Windows even though the package is already stored locally and its skills load fine when copied into the agent workspace manually.
Root cause (traced from the server log)
POST /api/agents/{agent}/skill-packages→octop/api/routers/skills.py:344 replace_skill_package_mounts→agent_registry.persist_skill_package_ids(agent_id, package_ids).persist_skill_package_ids(octop/infra/agents/manager.py:3566) writesskill_package_idsto the DB first, then callssync_skill_package_dirs()(line 3598).sync_skill_package_dirs(manager.py:3614) buildsskill_dirs = configured + package_dirs, where_resolve_skill_package_dirs(manager.py:3473) returns host-absolute paths such asC:\Users\511\.octop\skill-packages\53NCMD\skills, and assigns them toconfig.skills_dir.reload()→_init_graph()(octop_harness/agent.py:1512) callsself._workspace.skill_paths(extra=self._config.skills_dir).skill_paths→_deepagents_source_path→_backend_storage_key(octop_harness/backends/workspace.py:511). Lines 542-552:
workspace = self._workspace_dir.resolve() # C:\Users\511\.octop\agents\tyzs
local = (workspace / fragment).resolve() # fragment = C:/Users/511/.octop/skill-packages/53NCMD/skills
rel_posix = local.relative_to(workspace).as_posix() # ValueError
raise PermissionError(f"path {path!r} is outside workspace {self._workspace_dir}")A drive-letter absolute path can never be under the agent workspace, so relative_to() fails and PermissionError: path '...' is outside workspace / is raised — although _deepagents_source_path's own docstring says it expects None for "outside the backend mount (e.g. host-absolute skill-package roots)" and would then fall back to resolve_path().
- The exception propagates out of the endpoint as HTTP 500.
POSIX is unaffected: package roots start with /, and _backend_storage_key short-circuits those into virtual keys at line 537. Only Windows drive paths reach the workspace-relative branch.
Related to #2843 (fixed by PR #2878): that change allowed a drive-rooted backend to attach skill packages and removed the earlier 400 guard; this 500 is the next step of the same code path, so it is a follow-up rather than a duplicate.
Side effect: because skill_package_ids is persisted before the failing sync, the agent keeps logging harness list_skill_summaries failed ... using workspace fallback on every reload, and every retry of the toggle repeats the same 500. The only way out is clearing skill_package_ids by hand.
Steps to reproduce
- Windows 11 10.0.26100, Octop Desktop v1.0.3b8, expert backend = the Windows default
{"type":"local_shell","root_dir":"C:/","virtual_mode":true}. - Have any skill package under
%USERPROFILE%\.octop\skill-packages\<PKG>\skills\(Dashboard import or manual copy — both reproduce). - 专家 → edit expert → 技能 → 技能包 → switch a package on.
- Red toast "server internal error"; the server log shows the traceback below.
Environment
- octop: v1.0.3b8 (desktop, windows-amd64, bundled Python 3.12.12)
- OS: Windows 11 10.0.26100 AMD64
- Data dir:
C:\Users\511\.octop - Backend:
{"type":"local_shell","root_dir":"C:/","virtual_mode":true} - Package used:
53NCMD(5 skills). The code path is package-agnostic — any id resolves to the same absoluteskill-packages\<id>\skillsform.
Logs
2026-11-27 22:52:05,319 ERROR octop.api.app — unhandled exception in /api/agents/tyzs/skill-packages
Traceback (most recent call last):
File "...\octop\api\routers\skills.py", line 344, in replace_skill_package_mounts
await server.app_runtime.agent_registry.persist_skill_package_ids(agent_id, package_ids)
File "...\octop\infra\agents\manager.py", line 3598, in persist_skill_package_ids
self.sync_skill_package_dirs(agent_id)
File "...\octop\infra\agents\manager.py", line 3651, in sync_skill_package_dirs
reload()
File "...\octop_harness\agent.py", line 502, in reload_subagents
self._init_graph()
File "...\octop_harness\agent.py", line 1512, in _init_graph
skills=self._workspace.skill_paths(extra=self._config.skills_dir),
File "...\octop_harness\backends\workspace.py", line 1228, in skill_paths
paths.append(self._deepagents_source_path(str(entry)))
File "...\octop_harness\backends\workspace.py", line 1204, in _deepagents_source_path
key = self._backend_storage_key(path, map_system_paths=map_system_paths)
File "...\octop_harness\backends\workspace.py", line 552, in _backend_storage_key
raise PermissionError(msg) from exc
ValueError: 'C:\\Users\\511\\.octop\\skill-packages\\53NCMD\\skills' is not in the subpath of 'C:\\Users\\511\\.octop\\agents\\tyzs'
PermissionError: path 'C:\\Users\\511\\.octop\\skill-packages\\53NCMD\\skills' is outside workspace /
2026-11-27 22:52:39,525 WARNING octop.infra.agents.manager — harness list_skill_summaries failed for agent tyzs; using workspace fallback: path 'C:\\Users\\511\\.octop\\skill-packages\\53NCMD\\skills' is outside workspace /
Suggested fix
- In
_backend_storage_key, when the absolute path is outsideworkspacebut reachable through the backendroot_dir(host-rooted local backends), return the virtual key instead of raising — mirroring the POSIX/-prefixed branch. - Or let
_deepagents_source_pathcatch this and fall back toresolve_path(), as its docstring already describes. - Or mount package skills under a workspace-internal path (
<workspace>/.octop/skills/<pkg>/...) instead of passing the global absolute path throughskills_dir. - Independently: validate and sync before persisting
skill_package_ids, so a failed mount cannot leave the agent stuck in the warning state.
Workaround
Copy the package's skills\* folders into <agent workspace>\.octop\skills\ and keep agents.skill_package_ids empty — workspace-relative paths pass _backend_storage_key and the skills load normally.
Activity