If you are a developer what code are you accountable for?
Is it only your own? Is it your own plus that of a system that you've worked on for some period of time? Is it your team's? Is it every project ever worked on at your company?
I ask this because I've seen a lot of different answers and I will share with you my own approach to this and why that has been my approach.
When I approach a code base I did not create, my first question is to ask, "What can I learn from this code?". This question can and should consume you for some time. You won't know the answer right away, if you think you do, you probably aren't listening closely enough.
Once you know what you should be learning and have begun to learn you can ask how you can make it better. There are always ways to make improvements and to meld your learning with what you already know.
At no point during this process do I use the phrase 'spaghetti code', precisely because it places the source of misunderstandings outside the self onto an inanimate object: 'the code'.
Code is, at one level, a tool to communicate to a machine what you want it to do. It can't be 'spaghetti' if the machine understands it and does what the humans in the room wanted it to do.
On another level, code is a tool to communicate between one developer and another the intent to make a program and what that program was supposed to do. You may choose to blame the previous developer (who completed their assignment), but I don't see how that helps any business situation you happen to be in.
My approach was to be accountable for all code that I touched.
For code written, from scratch by me, I am accountable for all of it, no matter how long ago I wrote it.
As a boss or manager, I don't necessarily expect every person to have that level of accountability, but I expect them to be on a journey that moves in that direction.
And I hate, hate, hate the term 'spaghetti code' (if that wasn't already clear) because it is such a victim phrase. Are you the victim of code? I certainly never wanted to be. I wanted to win and make the code do what it was supposed to do.
Think of the great developers you know. Do they use that phrase? I've never heard one do it.
The 7 Habits of Highly Effective People is very instructive on this point in general. Stephen Covey was not a developer but the lessons are apt to all of us, at all times.
Become proactive. You'll be glad you did.