Heat oil in a large heavy-based pot over medium heat.
Add the onions, celery and carrots and cook for 10 minutes, stirring occasionally, until softened.
Add the garlic and cook for about 1 minute until fragrant.
Add the vegetable stock, passata, mushrooms, walnuts, lentils, oregano, thyme, rosemary, vinegar, soy sauce, a teaspoon of salt and a few turns of the pepper shaker. Give everything a really good stir, cover with a lid and bring to a simmer.
Turn down the heat to low and simmer for 1 ¼ - ½ hours, stirring occasionally and adding a splash of water until sauce has thickened to your liking. Leave the lid off for the last half an hour of cooking. Season to taste with salt and pepper.
Serve with cooked spaghetti and top with fresh basil.