Self-improving AI Employees for everyone
Python ai-agentsai-employeeai-employeesassistantautonomous-agentsco-employeescompanygrok-botinstinctloop-agentsmuseown-your-datapersonalself-hosted
fix(skills): keep a Master Skill's settings when a tool is wired to its agent
trohitg6e3988331636
diff --git a/docs-internal/workflow_ops_protocol.md b/docs-internal/workflow_ops_protocol.mdindex b83015a8..5f016f67 100644--- a/docs-internal/workflow_ops_protocol.md+++ b/docs-internal/workflow_ops_protocol.md@@ -122,7 +122,7 @@ return {"operations": [workflow_ops.add_node(ref, "masterSkill",- {"skillsConfig": {...}},+ {"skills_config": {...}},label="Master Skill",position=workflow_ops.anchored(agent_id, offset_x=-60, offset_y=220),),@@ -158,7 +158,7 @@ failures (toast, log, retry, etc.).| Service | Trigger | Module ||---|---|---|-| Auto-add Skill on tool connect | WS request `evaluate_auto_skill` (frontend on edge connect/disconnect) | `server/services/auto_skill.py` |+| Auto-add Skill on tool connect | WS request `evaluate_auto_skill` (frontend on edge connect/disconnect). The handler reads the wired Master Skill's saved row, so its `set_node_parameters` op is that whole row with only `skills_config` changed | `server/services/auto_skill.py` || Agent Builder runtime tools | `apply_graph_additions`, then the persisted `workflow_ops_apply` push (mid-execution, from the agent's tool call) | `server/nodes/tool/agent_builder/__init__.py` || Turn on Talk (any employee on Home, hired or built in Dev mode) | `apply_graph_additions`, then the persisted push | `server/services/employees/handlers.py` || Vertex managed agent cloud-tool nodes | whole-graph `database.save_workflow`, then a push that is NOT persisted (the editor saves the parameter rows) | `server/nodes/agent/vertex_managed_agent/_ops.py` |diff --git a/server/services/auto_skill.py b/server/services/auto_skill.pyindex d3d7622e..0eb4bb4a 100644--- a/server/services/auto_skill.py+++ b/server/services/auto_skill.py@@ -86,6 +86,7 @@ def evaluate(target_node_id: Optional[str] = None,master_skill_id: Optional[str] = None,master_skill_config: Optional[SkillsConfig] = None,+ master_skill_parameters: Optional[Dict[str, Any]] = None,) -> Dict[str, List[Any]]:"""Decide what (if anything) to do for an edge connect/disconnect.@@ -96,7 +97,13 @@ def evaluate(* Empty batch -- the event is irrelevant (not a tool node, not thetools handle, not an agent target).* One ``set_node_parameters`` op -- a Master Skill is already- wired; toggle the matching skill in its ``skillsConfig``.+ wired; toggle the matching skill in its ``skills_config``. The op+ carries the Master Skill's whole saved row+ (``master_skill_parameters``) with only ``skills_config`` changed,+ because applying it replaces the row: an op holding+ ``skills_config`` alone would wipe ``skill_folder`` and every other+ setting. The saved row's ``skills_config`` wins over the+ client-sent ``master_skill_config`` when both are present.* One ``add_node`` + one ``add_edge`` op -- no Master Skill existsyet; spawn one, wire it into the agent's ``input-skill``, andseed it with the matching skill enabled.@@ -112,12 +119,14 @@ def evaluate(enabled = action == "connect"if master_skill_id:- new_config = _toggle_skill(master_skill_config, skill, enabled)+ row = dict(master_skill_parameters or {})+ current = row["skills_config"] if "skills_config" in row else master_skill_config+ new_config = _toggle_skill(current, skill, enabled)return {"operations": [workflow_ops.set_node_parameters(master_skill_id,- {"skills_config": new_config},+ {**row, "skills_config": new_config},),],}diff --git a/server/services/skills/handlers.py b/server/services/skills/handlers.pyindex babf13e6..90f5c755 100644--- a/server/services/skills/handlers.py+++ b/server/services/skills/handlers.py@@ -145,18 +145,26 @@ async def handle_evaluate_auto_skill(data: Dict[str, Any], websocket: WebSocket)plugin-registry agent classification + canonical SkillConfigshape. Frontend forwards minimal edge details and the currentMaster Skill state; this returns a standard workflow-ops batch- (see docs-internal/workflow_ops_protocol.md).+ (see docs-internal/workflow_ops_protocol.md). The wired Master+ Skill's saved row is read here so the returned+ ``set_node_parameters`` op replaces it with every other setting kept."""from services import auto_skill+ master_skill_id = data.get("master_skill_id")+ master_skill_parameters = None+ if master_skill_id:+ master_skill_parameters = await container.database().get_node_parameters(master_skill_id)+result = auto_skill.evaluate(action=data["action"],source_type=data["source_type"],target_type=data["target_type"],target_handle=data["target_handle"],target_node_id=data.get("target_node_id"),- master_skill_id=data.get("master_skill_id"),+ master_skill_id=master_skill_id,master_skill_config=data.get("master_skill_config"),+ master_skill_parameters=master_skill_parameters,)return {"success": True, **result}diff --git a/server/tests/test_auto_skill.py b/server/tests/test_auto_skill.pyindex 6e765b88..a399adad 100644--- a/server/tests/test_auto_skill.py+++ b/server/tests/test_auto_skill.py@@ -226,6 +226,87 @@ def test_other_skills_in_config_are_preserved():_exit(patches)+def test_set_params_keeps_the_rest_of_the_master_skill_row():+ """Applying set_node_parameters replaces the whole row, so the op must+ carry every saved setting, not just skills_config. Before the fix it+ carried skills_config alone and wiped skill_folder on every connect."""+ patches = _patch_lookups(skill="http-request-skill")+ _enter(patches)+ try:+ result = _evaluate(+ master_skill_id="ms-1",+ master_skill_parameters={+ "skill_folder": "assistant",+ "label": "Master Skill",+ "skills_config": {+ "calculator-skill": {"enabled": True, "instructions": "", "isCustomized": False},+ },+ },+ )+ params = result["operations"][0]["parameters"]+ assert params["skill_folder"] == "assistant"+ assert params["label"] == "Master Skill"+ assert params["skills_config"]["calculator-skill"]["enabled"] is True+ assert params["skills_config"]["http-request-skill"]["enabled"] is True+ finally:+ _exit(patches)+++def test_saved_skills_config_wins_over_the_client_copy():+ patches = _patch_lookups(skill="http-request-skill")+ _enter(patches)+ try:+ result = _evaluate(+ master_skill_id="ms-1",+ master_skill_config={},+ master_skill_parameters={+ "skills_config": {+ "calculator-skill": {"enabled": True, "instructions": "", "isCustomized": False},+ },+ },+ )+ skills_config = result["operations"][0]["parameters"]["skills_config"]+ assert set(skills_config) == {"calculator-skill", "http-request-skill"}+ finally:+ _exit(patches)+++async def test_handler_reads_the_saved_master_skill_row():+ """The WS handler loads the Master Skill's saved row and the op it+ returns keeps that row's other settings."""+ from services.skills import handlers++ class _Database:+ async def get_node_parameters(self, node_id):+ assert node_id == "ms-1"+ return {"skill_folder": "assistant", "skills_config": {}}++ container = SimpleNamespace(database=lambda: _Database())+ patches = _patch_lookups(skill="http-request-skill") + [+ patch.object(handlers, "container", container),+ ]+ _enter(patches)+ try:+ result = await handlers.handle_evaluate_auto_skill(+ {+ "action": "connect",+ "source_type": "httpRequest",+ "target_type": "aiAgent",+ "target_handle": "input-tools",+ "target_node_id": "agent-1",+ "master_skill_id": "ms-1",+ "master_skill_config": None,+ },+ None,+ )+ params = result["operations"][0]["parameters"]+ assert params["skill_folder"] == "assistant"+ assert params["skills_config"]["http-request-skill"]["enabled"] is True+ finally:+ _exit(patches)++# --- spawn new Master Skill --------------------------------------------------