diff --git a/application/api/user/agents/portability.py b/application/api/user/agents/portability.py index 905a36d5..406fbdca 100644 --- a/application/api/user/agents/portability.py +++ b/application/api/user/agents/portability.py @@ -536,7 +536,6 @@ def serialize_agent(conn, agent: dict, user: str) -> dict: workflow_block, tools, sources, model = _serialize_workflow(conn, agent, user) prompt = "default" else: - workflow_block = None tools = _serialize_tools(conn, agent, user) sources = _serialize_sources(conn, agent, user) model = _serialize_models(conn, agent, user) @@ -1293,7 +1292,6 @@ def apply_import(conn, user: str, doc: dict, resolution: Optional[dict] = None) ) is_workflow = (spec.get("agent_type") or "classic") == "workflow" - workflow_result = _WORKFLOW_UNCHANGED if is_workflow: workflow_result = _apply_workflow( conn, @@ -1305,6 +1303,8 @@ def apply_import(conn, user: str, doc: dict, resolution: Optional[dict] = None) model_ids_by_name, warnings, ) + else: + workflow_result = _WORKFLOW_UNCHANGED agents_repo = AgentsRepository(conn) is_update = bool(target.get("action") == "update" and target.get("agent_id")) diff --git a/tests/api/test_workflow_portability.py b/tests/api/test_workflow_portability.py index 706427f8..8741834c 100644 --- a/tests/api/test_workflow_portability.py +++ b/tests/api/test_workflow_portability.py @@ -380,6 +380,6 @@ def test_import_with_null_workflow_keeps_published_but_clears_draft(pg_conn): # Draft agent: explicit null clears the link. AgentsRepository(pg_conn).update(str(agent["id"]), user, {"status": "draft"}) - result = apply_import(pg_conn, user, doc) + apply_import(pg_conn, user, doc) updated = AgentsRepository(pg_conn).get(str(agent["id"]), user) assert updated["workflow_id"] is None