Sorry this took so long. I haven't fully tested this to make sure it works on testnet and can make segwit blocks, but if people can help review it and maybe help test it, that would be nice.
https://github.com/jtoomim/p2pool/commits/1mb_segwitSegwit compatibility stuff starts with the July 19th commits.
For the UAHF, I have an idea for how to deal with it. Each time we receive a share, we can query our bitcoind to see whether that share's previousblockhash refers to a valid block hash in our bitcoind's blockchain (via the getblockheader RPC). If it is, we accept the share and memoize that hash. If it isn't, we ignore that share. This should allow people to mine on either blockchain without needing to worry about people getting valid shares while mining on the other blockchain.
Unfortunately, I'm very busy right now with datacenter stuff, so I don't know when I'll have a chance to implement this.