We consider deformations of D-brane systems induced by a change in the closed string background in the framework of bosonic open-closed string field theory, where it is possible to unambiguously tame infrared divergences originating from both open and closed string degenerations. A closed string classical solution induces a tadpole for the open strings which shifts the open string vacuum and generates a cosmological constant composed of two terms: one which is directly related to the closed string solution and the other which depends on the open string vacuum shift. We show that only the sum of these two terms is invariant under closed SFT gauge transformations and therefore is an observable. We conjecture that this observable is universally proportional to the shift in the world-sheet disk partition function between the starting D-brane in undeformed background and the final D-brane in deformed background, which typically includes also a change in the string coupling constant. We test the conjecture by considering a perturbative closed string solution describing deformations of a Narain compactification and, from the SFT cosmological constant, we reproduce the expected shift in the g-function of various D-branes living in the compactification. In doing this we are also able to identify a surprising change in the string coupling constant at second order in the deformation.