A ring $R$ which can be written as a direct sum of two ideals. Let $R$ be a unital associative ring and 
$$
R=A\oplus B,
$$
where $A$ is a two-sided ideal of $R$ and $B$ is a right ideal of $R$. Does it follow that $B$ is a two-sided ideal of $R$?
I feel like the answer should be yes. Say I take an arbitrary element $(r,s)\in R$, I need to show that $(r,s)b\in B$ for all $b\in B$. But an element of $B$ can only be written as $(0,b)$ for some $b\in R$, so 
$$
(r,s)(0,b)=(0,sb)\in B.
$$
I feel like I am missing something and it's not that simple, since I'm not using the fact that $R$ is unital at all. What am I missing here?
 A: Counterexample
Let $R$ be a ring with identity and a proper ideal $A$, and assume also that there is a nonzero element $e\in A$ such that $ea=a$ for all $a\in A$ and yet there exists an $a'\in A$ such that $a'e\neq a'$. (For example, you could take any rng $A$ with a left identity $e$ that isn't a right identity, and then unitize it in the standard way into the ring $R=\mathbb Z \times A$.)
Now let $B$ be the subring $(1-e)R(1-e)$, and consider the subring of $R$ that is $S=A+B$. It's important to remember that $e$ is idempotent and so $e(1-e)=0$. Notice also that $1=e + (1-e)\in A+B$.
Clearly $A\cap B=\{0\}$, because if $a=(1-e)r(1-e)$, then left multiplication by $e$ yields $a=ea=0$. Having shown this, we now have that $S=A\oplus B$. $A$ remains an ideal in $S$ since it was an ideal in $R$.  Furthermore $B^2\subseteq B$, and $BA\subseteq B$ (in fact, $BA=\{0\}$) so $B$ is a right ideal of $S$.
Of course, $a'(1-e)\in A\setminus \{0\}$, and it cannot be in $B$ since $A\cap B=\{0\}$. Nevertheless $a'(1-e)\in AB$, so we see that $B$ does not absorb multiplication on the left in $S$, so $B$ isn't a left ideal.
A: If writing $R = A\oplus B$ means that $R$ is the direct sum of two additive subgroups $A$ and $B$, and $A$ happens to be a 2-sided ideal while $B$ happens to be a right ideal, then it need not be true that $B$ is a 2-sided ideal. 
Example. $R$ is the ring of upper triangular $2\times 2$ matrices over a field, $A$ is the ideal of $R$ consisting of matrices of the form $\left[\begin{matrix}
*&*\\0&0\end{matrix}\right]$ and $B$ is the right ideal of $R$ consisting of matrices of the form $\left[\begin{matrix}
0&0\\0&*\end{matrix}\right]$.
