My question involves employment and labor law for the state of: California

Hi,
I am on H1B and working for client X in California since 2 1/2 years. When I joined the client i was with company A and there is middle Company B.
So it was like Company A -> Company B -> Client. I transferred my H1 B from Company C (Michigan) in 2009. So I no longer work for Company A. Company c is my employer.

So now it is like Company C -> Company B -> Client

But when I joined the client Company B (Arizona Employer) made a non-compete agreement between me as employee of
Company A and it says I can't work for client directly.
Now my client is ready to hire me for full time. Now since i no longer work Company A is this non-compete agreement still applies since I signed it. I was working and living in California for more than 2 years and I am paying taxes to California. I came to know that in California this agreement is illegal. Since I am a consultant to the California client, does this still will be a problem for me or my client?
My client doesn't want go through any legal issues. Please advise me, I just want to know my options.
Thank You