fix(server): settle inactive threads with open PRs#9610

merged1
main
GitHub fork: t3code/fix-issue-9600
openedSep 4, 2026byGGigioxx
View on GitHubTwo-way sync enabledPR last imported 5d ago

Problem

After #8600 made pull request state authoritative on the server, every open pull request bypassed inactivity settlement. Long-quiet threads therefore stayed active indefinitely despite the configured threshold.

Fix

Let the existing inactivity policy run when a pull request is open. Closed and merged pull requests still settle immediately under their existing rules, and active work, pending input, snooze, and manual overrides remain unchanged.

Reactor fixtures that test merge behavior now use recent thread activity so they stay focused on merge events.

Closes #9600

Verification

  • vp test run apps/server/src/orchestration/ThreadSettlementPolicy.test.ts apps/server/src/orchestration/ThreadSettlementReactor.test.ts (23 passed)
  • vp run --filter t3 typecheck
  • Targeted lint and formatting passed
  • git diff --check
  • Direct policy repro now returns the thread activity timestamp for an inactive thread with an open pull request

Generated with GPT-5.6 Sol in T3 Code through the Codex harness.


Note

Medium Risk Changes server-side thread lifecycle behavior for a common case (open PR + idle thread), which may move threads to Settled sooner than users expect, though it aligns with documented inactivity rules.

Overview Open pull requests no longer prevent auto-settlement by inactivity. resolveAutoSettlementAt drops the branch that returned null whenever a linked PR was still open, so idle threads can settle after autoSettleAfterDays even with an open PR. Closed/merged PR settlement, merge settings, and candidate guards (pending work, snooze, live sessions, etc.) are unchanged.

Tests now expect inactive threads with open PRs to settle, and reactor fixtures use recent latestUserMessageAt on merge-focused threads so initial sweeps do not settle them for inactivity before merge logic runs. User docs state that an open PR does not block inactivity settlement.

Reviewed by Cursor Bugbot for commit ed977dc5240ce9027dee2184941d2153ddb8bff0. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Fix resolveAutoSettlementAt to settle inactive threads with open PRs

Removes the special case in ThreadSettlementPolicy.ts that blocked all settlement while a thread had an open pull request. Open PRs now fall through to the inactivity-duration check, so eligible inactive threads can be auto-settled regardless of PR state. Updates reactor tests with recent user-activity timestamps and revises the thread-sidebar docs to match.

  • Behavioral Change: threads with open PRs are now eligible for inactivity-based settlement; previously resolveAutoSettlementAt always returned null for this state.

Macroscope summarized ed977dc.

Added 1 commit

  • fix(server): settle inactive threads with open PRsed977dc
Synced from GitHub

Approvability

Verdict: Approved at ed977dc

Macroscope's review found this PR approvable — This is a narrowly scoped server bug fix that removes an incorrect open-PR exception from the existing inactivity-settlement policy. Targeted tests and documentation are updated, with no schema, infrastructure, security, billing, or static-analysis changes.

You can add or adjust custom eligibility rules. Learn more.