Massachusetts could see a surge in new affordable housing construction after legislative leaders authorized Gov. Charlie Baker to funnel nearly $2 billion into housing projects, a goal Democratic leaders share with the Republican governor.

It took them until nearly the end of their legislative session, but lawmakers finally signed off this month on most of Baker's $1.8 billion dollar housing bond bill, which authorizes the state to spend capital dollars on housing projects.

New projects are still at Baker's discretion to fund, but the plan is for over $1 billion to go into construction of new units and the preservation of existing housing stock, potentially injecting the pricey Massachusetts housing market with more living space for lower-income earners at a time of skyrocketing housing cost. Another $650 million dollars is set aside to modernize much of the state's public housing developments.

Housing and Economic Development Secretary Jay Ash, a Democrat serving in Baker's cabinet, said that over Baker's term, the governor and legislative Democrats figured out a way to work together "to promote good public policy over bad politics," and reach shared goals.

"Making sure that families find safe and affordable roofs over their heads. Making sure that communities are revitalized through housing and making sure the Commonwealth has exactly what it needs to solve all of the housing needs that our residents have," Ash said of the bill Thursday at the construction site of the Harry and Jeanette Weinberg House in Brighton, a facility operated by Jewish Community Housing for the Elderly.

Rep. Kevin Honan, a veteran Brighton Democrat and the chairman of House Speaker Robert DeLeo's Housing Committee, singled Baker out for thanks at the event on his own home district turf.

"He has made housing a priority. We all know that it's very difficult for working men and women in our Commonwealth and recent graduates, to stay here and to drive our economic engine, we need to capture that brain power and we need to do it with affordable housing. This is such an expense for people," Honan said.

Honan admitted to the crowd that the legislative process can sometimes be arduous and difficult, "and sometimes needs to be pushed."

"He lit a fire. He pushed us," Honan said before another top DeLeo Democrat, Ways and Means Chairman Jeffrey Sanchez, joked "don't say that too loud" to a round of laughs from Baker and the Democrats surrounding him.

Bipartisan bonhomie has been the theme of Baker's time in office when it comes to legislative dealings, but that likely won't be the story when Democratic activists descend on Worcester Friday and Saturday for their annual party convention, which will vote to endorse either Bob Massie or Jay Gonzalez to take on Baker for the corner office this November. If party leaders won't do it, expect both candidates to contrast Baker's management record and center-right ideology with hardcore Democrats' desire for bolder gubernatorial vision.

"I am frustrated the Democratic leadership isn't calling out Gov. Baker more for being a much more conservative governor than I think people, including the press, give him credit for," Sen. Jamie Eldridge told WGBH News after the housing bill signing. Still, Eldridge, says, Democratic leaders are privately pushing the Baker administration more there way on some policy issues.

Baker says the job he shares with Democrats is to work for the people of the Commonwealth and that he and Lt. Gov. Karyn Polito are always open to working across the aisle because "you never know where your next coalition is coming from." It's also an unavoidable truth that with Democratic super-majorities in both the House and Senate, Baker has to moderate his policies in order to get any of his legislation passed back to his desk for a signature.

"That's what government is supposed to be about. This thing was set up to be a little messy and a little complicated and you're supposed to be able to work with people you don't always agree with," Baker said.

Correction: An earlier version of this article misstated Rep. Kevin Honan's first name. The error has been corrected.