I think the issues you are raising were addressed in this case (PDF format) from the Bankruptcy Court for the Northern District of Texas:
Quote Quoting In re Shortt
All requirements for setoff under section 553 of the Bankruptcy Code are satisfied here. AAFES has a valid non-bankruptcy right of setoff that section 553 preserved. AAFES and the IRS are the same entity for purposes of setoff.
(That would not be a binding precedent in California; but the same laws are implicated.)