After accidentally shooting Roger (twice!), he comes through big time by pulling it together enough to bury Roger's body in Mimi's (Lois Smith) backyard. He then uses video of Roger's dead body to intimidate and scare Obie.
He knows Krystal doesn't love him, but this is really as good as it's going to get for Cody right now. Actor Pellerin told us that "Krystal finds comfort in having [Cody] around" and that that's enough for him right now.
Creator Matt Lutsky added, "I think there could be a really cynical read of their relationship from Krystal's perspective that she's just using him and he's just a tool for her, which is true, but I also think that in her circumstances, someone being a tool for her is a form of love and connection. There is at least one person there she can turn to, even if it's for cynical purposes."