mirror of
https://github.com/openswarm-ai/openswarm.git
synced 2026-09-13 21:27:41 +02:00
[eric] agents: convention fixes on merge surface (public cross-file helpers, pydantic approval memory, resolve_ask @typechecked)
This commit is contained in:
@@ -46,7 +46,7 @@ async def test_can_use_tool_deny_returns_deny():
|
||||
async def test_can_use_tool_ask_routes_through_approval():
|
||||
ctx = p_ctx()
|
||||
with patch.object(gate_hooks.path_gate, "maybe_override_policy", return_value=("ask", None)), \
|
||||
patch.object(gate_hooks, "p_resolve_ask", new=AsyncMock(return_value=ApprovalDecision(behavior="allow"))):
|
||||
patch.object(gate_hooks, "resolve_ask", new=AsyncMock(return_value=ApprovalDecision(behavior="allow"))):
|
||||
result = await gate_hooks.can_use_tool(ctx, "Write", {"file_path": "/x"}, None)
|
||||
assert isinstance(result, PermissionResultAllow)
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ the scheduled-tasks PR shipped without a test, and the exact path most at risk i
|
||||
agent-manager decomposition (the gating moved from agent_manager into path_gate)."""
|
||||
|
||||
from backend.apps.agents.manager.permissions import path_gate
|
||||
from backend.apps.agents.manager.permissions.workflow_approval import p_is_claude_schedule_skill
|
||||
from backend.apps.agents.manager.permissions.workflow_approval import is_claude_schedule_skill
|
||||
|
||||
|
||||
def test_schedule_commit_tools_force_ask_even_when_always_allow():
|
||||
@@ -26,11 +26,11 @@ def test_claude_internal_cron_tools_denied():
|
||||
|
||||
|
||||
def test_claude_schedule_skill_detected():
|
||||
assert p_is_claude_schedule_skill("Skill", {"skill": "schedule"})
|
||||
assert p_is_claude_schedule_skill("Skill", {"skill": "Schedule"})
|
||||
assert not p_is_claude_schedule_skill("Skill", {"skill": "other"})
|
||||
assert not p_is_claude_schedule_skill("Bash", {"skill": "schedule"})
|
||||
assert not p_is_claude_schedule_skill("Skill", "not a dict")
|
||||
assert is_claude_schedule_skill("Skill", {"skill": "schedule"})
|
||||
assert is_claude_schedule_skill("Skill", {"skill": "Schedule"})
|
||||
assert not is_claude_schedule_skill("Skill", {"skill": "other"})
|
||||
assert not is_claude_schedule_skill("Bash", {"skill": "schedule"})
|
||||
assert not is_claude_schedule_skill("Skill", "not a dict")
|
||||
|
||||
|
||||
def test_normal_tool_unaffected_by_schedule_gate():
|
||||
|
||||
@@ -166,6 +166,7 @@ def test_workflow_round_trips_through_the_store(isolated_workflows_data):
|
||||
# from before the workflow store was on eric/dev.
|
||||
from backend.apps.swarm.entities.workflows import WorkflowExportable
|
||||
from backend.apps.swarm.exportable import RemapTable
|
||||
from backend.apps.workflows import storage
|
||||
assert WorkflowExportable.load("nonexistent") is None
|
||||
new_id = WorkflowExportable.import_(
|
||||
{"title": "Shared WF", "schedule": {"enabled": True}}, {}, RemapTable()
|
||||
@@ -174,7 +175,10 @@ def test_workflow_round_trips_through_the_store(isolated_workflows_data):
|
||||
loaded = WorkflowExportable.load(new_id)
|
||||
assert loaded is not None
|
||||
assert loaded.name == "Shared WF"
|
||||
assert loaded.p_data["schedule"]["enabled"] is False
|
||||
# Read the persisted row back through the store's public API (not the entity's
|
||||
# private data) to confirm the schedule was forced off on import.
|
||||
saved = storage.get_workflow(new_id)
|
||||
assert saved is not None and saved.schedule.enabled is False
|
||||
|
||||
|
||||
def test_session_export_carries_transcript_drops_runtime_and_secrets():
|
||||
|
||||
Reference in New Issue
Block a user