@@ -115,13 +115,15 @@ describe("effectiveSettled", () => {
115115 // Settled iff nothing blocks (pending work / live session) AND
116116 // the override says settled, or (with no override) a merged PR
117117 // or staleness auto-settles. The "active" pin suppresses both
118- // auto signals.
118+ // auto signals, and an open PR suppresses the inactivity path:
119+ // a thread with a PR out for review is never done, however quiet.
119120 expected :
120121 pending === undefined &&
121122 ! running &&
122123 ( settledOverride === "settled" ||
123124 ( settledOverride === null &&
124- ( changeRequestState === "merged" || inactivity === "stale" ) ) ) ,
125+ ( changeRequestState === "merged" ||
126+ ( changeRequestState !== "open" && inactivity === "stale" ) ) ) ) ,
125127 } ) ) ,
126128 ) ,
127129 ) ,
@@ -176,6 +178,26 @@ describe("effectiveSettled", () => {
176178 }
177179 } ) ;
178180
181+ it ( "never auto-settles a stale thread with an open change request" , ( ) => {
182+ const stale = makeShell ( { activityAt : STALE } ) ;
183+ expect (
184+ effectiveSettled ( stale , {
185+ now : NOW ,
186+ autoSettleAfterDays : 3 ,
187+ changeRequestState : "open" ,
188+ } ) ,
189+ ) . toBe ( false ) ;
190+ // An explicit user settle still wins: open PR only blocks the auto path.
191+ const settled = makeShell ( { settledOverride : "settled" , activityAt : STALE } ) ;
192+ expect (
193+ effectiveSettled ( settled , {
194+ now : NOW ,
195+ autoSettleAfterDays : 3 ,
196+ changeRequestState : "open" ,
197+ } ) ,
198+ ) . toBe ( true ) ;
199+ } ) ;
200+
179201 it ( "keeps an explicitly un-settled merged-PR thread active" , ( ) => {
180202 const shell = makeShell ( {
181203 settledOverride : "active" ,
0 commit comments