Fix stale in_review self-healing to run in JSON mode and update local objects before state load

This commit is contained in:
Chris Wanstrath 2026-03-18 23:48:09 -07:00
parent a682539db3
commit 99f5a378f1

View File

@ -60,11 +60,11 @@ export async function action(opts: { json?: boolean }) {
const statuses = Object.fromEntries(statusEntries)
// Batch self-heal stale in_review flags with a single state write
if (staleReviewSessions.length > 0 && !opts.json) {
if (staleReviewSessions.length > 0) {
for (const s of staleReviewSessions) s.in_review = false
const current = await state.load(root).catch(() => null)
if (current) {
for (const s of staleReviewSessions) {
s.in_review = false
if (current.sessions[s.branch]) current.sessions[s.branch].in_review = false
}
await state.save(root, current).catch(() => {})