When Dipen Joshi left India on an H-1B visa to work for Compubahn, a Silicon Valley recruitment firm, he signed a contract requiring him to remain with the firm for 18 months or pay steep penalties. He tried to leave for a job at Oracle Corp., but Compubahn demanded $77,000 in fees and penalties under the contract. Joshi sued, and a San Mateo County court has now ruled that the contract violates state unfair competition laws and is therefore unenforceable. What’s more, Compubahn was ordered to pay Joshi $215,000 in legal fees and other expenses. The ruling could spur more lawsuits because about half of H-1B visa high-tech workers are under similar restrictive agreements with recruitment firms.