As anybody who follows elections on Daily Kos knows, California's current top two primary system has the unfortunate effect of allowing one party to get two of its candidates on the general election ballot simply because the other party had too many primary candidates splitting the vote. In 2012, this allowed republicans to win California's blue-leaning 31st district by having two republicans and 4 democrats on the primary ballot. In the 2014 cycle, we only narrowly avoided repeating this blunder in the 31st district. And two republicans advanced to the general the purple trending 25th district (thereby shutting democrats out of what looked to be a competitive race).
The top two system nevertheless does have some merit. It eliminates the spoiler effect inherent in a first-past-the-post system, without having to rely on runoffs (which depress turn out) or ranked-choice voting (which has tended to be confusing and unpopular with voters). In truly uncompetitive districts, it probably does democracy a service to have two members of the same party on the ballot, as this prevents the general election from becoming a meaningless "coronation", with all the real action being in the low-turnout primary.
With the intention of allowing two candidates of the same party to advance in districts that are truly uncompetitive, but preventing this outcome in competitive districts, I propose the following fix to the top two primary system:
1. All candidates appear on the same primary ballot with all registered voters being able to vote for only one candidate.
2. The candidate who receives the most votes advances to the general election.
3. If candidates who share the leading candidate's party affiliation have together received at least X % of the vote, the second place candidate advances to the general.
4. In all other cases, the top candidate who does not share the leading candidate's party affiliation advances to the general.
The effect of this proposal would depend considerably on the value chosen for X. If X=95, then nearly every general election race will have candidates from different parties. If X=60, the race would have to be fairly close before anybody but the top two candidates would advance. For example, in the 25th district, the republican party collectively received 64.7% of the vote (presumably due to low turnout). You could even choose X=50, on the grounds that if a party receives 50% of the vote they've won.
I would personally go with a value in the 60-70 range. This would still allow dem on dem or rep on rep contests in truly uncompetitive districts, but force a "real" contest everywhere else.