The existence of two maximal ideals with the same set of idempotents Let $R$ be a commutative ring with identity and $A$ and $B$ be two proper ideals of $R$ such that $A+B=R$ and for each $r^2=r\in R$ we have either $r\not\in A$ or $r-1\not\in B$. How can we prove the existance of two maximal ideals $m_1$ and $m_2$ of $R$ such that $A\subseteq m_1$, $B\subseteq m_2$ and $\{r\in m_1\mid r^2=r\}=\{r\in m_2\mid r^2=r\}$?
 A: A proof by duality (to make it accurate first replace $A$ and $B$ with their radicals).
The dual statement about $X=\operatorname{Spec}(R)$ is that we have two closed sets $Y$, $Z$ with $Y\cap Z=\varnothing$ and, for any clopen $C$ of $X$, either $Y\nsubseteq C$ or $Z\nsubseteq(X\setminus C)$. The conclusion is there are closed points $y\in Y$, $z\in Z$ such that $y$ and $z$ cannot be separated by a clopen.
Indeed the hypothesis just means that $Y$ and $Z$ cannot be separated by clopens. Their images in $\pi_0(X)$ are closed subsets of a Stone space that cannot be separated by clopens, so must meet. This provides a connected closed set $T$ meeting both $Y$ and $Z$. Then take any closed points $y\in Y\cap T$, $z\in Z\cap T$.
Remark. Most likely spectrality can be substantially weakened here. We have only used that $X\to\pi_0(X)$ is closed, that $\pi_0(X)$ is zero-dimensional and normal, and that every closed set of $X$ contains a closed point.
A: Sketch:  First, if $e$ is an idempotent in $A$, show that $B$ can be replaced with $B+Re$, and the hypotheses still holds.  Use this to reduce to the case that $A$ and $B$ contain the same idempotents.
Second, if $e$ is an idempotent of $R$ with $e,1-e\notin A$ (and hence also not in $B$) show that we can replace $A$ and $B$ with the new pair $A+Re$ and $B+Re$, still satisfying the same conditions.  Use this to reduce to the case that $A$ and $B$ contain the same idempotents, and either an idempotent or its complement belongs to $A$.
Now, extend to any maximal ideals containing $A$ and $B$, and note that a maximal ideal cannot contain an idempotent and its complement at the same time.
A: Let me add some detail to Pace's sketch.
Let's say that a pair $(A,B)$ of ideals of $R$
satisfies the conditions if
(i) $A$ and $B$ are proper,
(ii)  $A+B=R$,
(iii) there is no idempotent $e$ in $A$ whose complementary idempotent
$1-e$ lies in $B$. 
[Before beginning, note that Condition (i) follows from
Condition (iii): using Condition (iii) and the fact that
both $A$ and $B$ contain $0$, derive that neither
$A$ nor $B$ can contain $1$.]
Lemma.
If $(A,B)$ satisfies the conditions and $e\in A$
is idempotent, then $(A,B+Re)$ satisfies the conditions.
Pf.
We establish Condition (iii) for $(A,B+Re)$
by reducing it to Condition (iii) for $(A,B)$.
Assume that $f$ is an idempotent
in $A$ whose complementary idempotent $1-f$
belongs to $B+Re$. Multiplying the expression
``$(1-f)\in B+Re$''
by $1-e$ yields that
$(1-e)(1-f)\in B(1-e)+Re(1-e)=B(1-e)\subseteq B$,
so the idempotent $(1-e)(1-f)$ belongs to $B$.
But now, since $e, f\in A$, we have that the idempotent
$1-(1-e)(1-f)=e+f-ef\in A$, while its complement
lies in $B$. This contradicts Condition (iii) for $(A,B)$.
Condition (ii) for $(A,B+Re)$ holds because $B+Re$
extends $B$. \\\

Lemma.
If $A$ and $B$ contain the same idempotents,
$(A,B)$ satisfies the conditions, and $e$
is an idempotent with $e, 1-e\notin A$,
then $(A+Re,B+Re)$ satisfies the conditions.
Pf.
Let me argue only Condition (iii),
since (i) is a consequence of (iii) and (ii)
is obvious here.
Assume that there is some idempotent $f\in A+Re$
whose complementary idempotent $1-f$ lies in $B+Re$.
Multiply the expressions
$f\in A+Re$
and
$(1-f)\in B+Re$
by $1-e$. We get
$(1-e)f\in A(1-e)+Re(1-e)=A(1-e)\subseteq A$,
and $(1-e)(1-f)\in B(1-e)\subseteq B$.
Now, since we have assumed that $A$ and $B$
contain the same idempotents, and the idempotent
$(1-e)f$ belongs to $A$, we must have $(1-e)f\in B$.
Since
both $(1-e)f, (1-e)(1-f)$ belong to $B$, the sum
$(1-e)f+(1-e)(1-f)=1-e$ belongs to $B$, contrary
to the assumptions of the lemma
($A$ and $B$ contain the same idempotents and $1-e\notin A$). \\\
