"Whomever" as both object and subject

I put together a document with my findings in order to help whomever keeps working on this.

I understand that "whomever" should be used as an object, whereas "whoever" as a subject. But in the sentence above it seems to be acting as both: object for help ("help whomever") and subject for keep ("whomever keeps"). In this case, is the sentence above correct?

Also, would it be correct to use "whoever"? Argument would be the same, that it's used both as subject and object.


Solution 1:

It’s the clause as a whole (whoever keeps working on this) that is the object. Whoever is the subject of that clause. So it should be whoever, not whomever.