mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-09 01:50:44 +08:00
移除静态 specialist 列表依赖,并将未知动态 specialist 默认映射为最小权限 expert,降低路由与权限不一致风险。 Made-with: Cursor
15 lines
674 B
Python
15 lines
674 B
Python
from __future__ import annotations
|
|
|
|
from oclaw.runtime.agents import specialists as specialists_mod
|
|
|
|
|
|
def test_unknown_dynamic_specialist_defaults_to_minimum_expert_permissions(monkeypatch) -> None:
|
|
monkeypatch.setattr(specialists_mod, "discover_specialist_ids", lambda: ("generalist", "qa"))
|
|
assert specialists_mod.expert_name_for_specialist("qa") == "generalist"
|
|
|
|
|
|
def test_agent_role_ids_uses_runtime_discovery(monkeypatch) -> None:
|
|
monkeypatch.setattr(specialists_mod, "discover_specialist_ids", lambda: ("generalist", "ops", "qa"))
|
|
got = specialists_mod.agent_role_ids()
|
|
assert got[0] == specialists_mod.MANAGER_AGENT_ID
|
|
assert "qa" in set(got)
|