I am a junior faculty member at a research university. I am working with postdoc A on a project. Postdoc A's PI, Dr. B, works in the same university, but is affiliated with another department. Prior to starting the project, postdoc A and I have agreed that we would work on the project during their spare time. We did not inform Dr. B about this arrangement. When the project is about half-way done, Dr.B found out that A is working with me on the project. Dr.B approached me and told me that all postdoc A's projects have to go through them, and claimed that postdoc A could get fired by the school if the school found out that postdoc A is publishing papers without their PI.
Is it true that all projects of a postdoc have to go through their PI (even if the research is conducted during the postdoc's spare time)?
Do I have the obligation to let Dr.B know about my collaboration with postdoc A, given that we agree to work on the project during A's spare time? (I know as a courtesy to a colleague, I probably should have informed Dr.B about it before the project starts...)
What can I do at this point to make sure postdoc A's career is not affected by this incident?
It is likely not legally binding that postdoctoral activity must go through the supervisor, especially not if the additional work was beyond "normal working hours" and uncompensated. For example, if the postdoc had wished to donate time to a charity, no permission from the supervisor would be necessary. However,
Yes, you and Postdoc A had a professional obligation to inform Dr. B about your collaboration, especially if it was intended to result in publication and was not just for Postdoc A to learn something new. Dr. B has committed to training and advising Postdoc A, and Dr. B's financial and intellectual commitment to Postdoc A makes your unpaid collaboration possible. Also, you might be hard-pressed now (after the fact) to demonstrate convincingly that none of the work ever took time from the projects with Dr. B. Therefore,
You should take the fall for this one. Apologize to Dr. B, say that you should have known better and that you wrongly advised Postdoc A. Offer review and editing of the manuscript and possibly minor authorship to Dr. B. Or, collaboration on a follow-up project. Give a gift of coffee, tea, or a favorite food (I have found this to be a surprisingly effective apology strategy with academics -- citing my personal experience here).
Citation for all advice -- personal experience in the lab of another Dr. B, watching another Postdoc A.