I'll try to be fair and explain the entire situation, if I am at fault please tell me.

Till a few weeks ago everything with work was fine, until I started taking too long to finish a task and my boss (The company's COO) became very aggressive with me, blaming me for the entire sprint being held back and explaining the consequences of me not delivering this task and even gave me a warning letter with that written in it.

I explained that the task requirements keep changing and that the tech isn't spec'd out and i had to redo it three times but he dismissed what I said as not "owning" my work.

I spent the next week doing 10-12 hour days to speed things up and my boss sat down with me again and reminded me of the same consequences that happened before, and this time i was more prepared so I stood my ground and explained that if the task has some accepted criteria we can then judge if the task is complete or not, but if it's up to interpretation then I can say it is finished and he would disagree. I explained that I am doing my best but the planning and figuring out how to do this task technically shouldn't happen AFTER it has been estimated. He dismissed all what I said and told me all I'm hearing is that you're not owning your work.

On my PR he made a lot of comments, some made sense and some were an entire different task, I felt he was setting me up to fail and intentionally being difficult with me.

When I brought up that his comments in the PR is another task and needs to be in its own branch he disagreed and reminded me that I am not owning my work.

The following week (this week) I continued working on his comments and as my new PR went up he made new comments about different issues he didn't mention the first time, and some of his comments were really snobby. 
[![enter image description here](https://i.stack.imgur.com/PQ3C1.png)](https://i.stack.imgur.com/PQ3C1.png)

What really ticked me off is that he went to someone else on that same day, who's spending less time in the office than me, and wrote in their PR "change x,y,z but overall good job"

Is it wrong of me to feel like I'm being singled out and bullied and being set up to fail? I feel defeated and completely depressed from the way I'm being treated and this is the first time something like that has ever happened to me, how can I keep the right mentality and how should I be thinking right now?

**Update:**
I left the company, no exit interview and my boss asked me to pack up my things and leave in 30 minutes, the recruiter that got me in there called me and I told them what happened. 6 weeks later I got a job in a bigger company with 20% higher salary, got an email from the previous company offering me an exit interview so I would stop "bad mouthing" them in the tech community, they ended the letter asking me to be professional and dignified.

Thanks for your answers and support, I'm very glad that this chapter which has been the most stressful 6 weeks of my career is now over and I believe I learned from it.

**Update 2:**
For those interested, I just wanted to share that I got a raise at the new company for "taking more ownership and going beyond my role". Interesting how in a single year I managed to get fired from one job and get a raise in the other for the same reason