fix(server): idle servers no longer sweep branch pull requests every minute (#23702)

The one-minute sweep looked up every active branch thread's pull request even
with no client connected. It now runs only when BackgroundPolicy reports
foreground demand (shouldRunOpportunisticWork) and resumes on the next tick
once a client is back. The startup backfill and thread events (finished turns,
unsettle, metadata changes) still refresh unconditionally, so headless agents
and scheduled tasks keep their pull request links current.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
29ce300674Julius Marminge committed on 10/22/2026, 9:08:45 PMparent1e1b2b9
2 files changedLine totals unavailable