feat(clients): add PR auto-settle toggle
What Changed
- Add an independent setting for settling Sidebar v2 threads when their pull request is merged or closed, enabled by default for backward compatibility.
- Gate the shared settlement calculation on that setting while preserving manual settlement, explicit un-settlement, pending-work guards, and inactivity-based settlement.
- Expose the control on web/desktop and mobile, and document how disabling both automatic triggers enables fully manual settlement.
Closes #4982.
Why
Sidebar v2 previously classified merged and closed pull-request threads as settled unconditionally. Disabling “Auto-settle inactive threads” therefore could not keep those threads active for follow-up work.
The merged/closed trigger is now configurable independently from the inactivity trigger. Existing users keep the current behavior unless they opt out.
This composes with #5151: open PRs remain protected from inactivity auto-settle; this setting only controls the merged/closed completion trigger.
UI Changes
Before
The inactivity setting also stated that merged and closed PR threads always settle, with no separate control.
After
A separate toggle controls merged/closed-PR settlement. Here it is disabled while inactivity-based settlement remains enabled.
Validation
bun test packages/contracts/src/settings.test.ts packages/client-runtime/src/state/threadSettled.test.ts apps/mobile/src/features/threads/threadListV2.test.ts— 251 passedbun --cwd apps/web test -- src/components/settings/settingsSearch.test.ts— 8 passedbun --cwd apps/desktop test -- DesktopClientSettings.test.ts— 7 passed- Typechecks passed for contracts, client runtime, web, and mobile
- Targeted lint and formatting checks passed for all 18 changed files
- Verified in an empty, isolated local T3 home that the setting defaults on, persists off across reload, remains independent from inactivity settlement, and persists when re-enabled
Checklist
- [x] This PR is small and focused
- [x] I explained what changed and why
- [x] I included before/after screenshots for the UI change
- [x] No animation or timing behavior changed, so a video is not applicable
Built with GPT-5.6-Sol via the Codex harness in T3 Code.
[!NOTE]
Add auto-settle toggle for merged/closed PR threads across web and mobile
- Adds
sidebarAutoSettleOnChangeRequestCompletiontoClientSettingsSchema(defaulttrue) so users can disable auto-settling threads when a PR is merged or closed.- Extends
effectiveSettledto gate the PR-completion branch on the new flag; existing behavior is unchanged when the flag is omitted.- Web: adds a toggle in
BetaSettingsPanel, wires it throughuseClientThreadSettlementPreferencesintoSidebarV2andChatView.- Mobile: persists two new device-local preferences (
threadListV2AutoSettleInactive,threadListV2AutoSettleOnChangeRequestCompletion), exposed via toggles inSettingsRouteScreenand consumed byHomeScreenandThreadNavigationSidebar.- Behavioral Change: preferences are held off (no auto-settling) until client settings are fully hydrated, preventing premature thread classification on load.
Macroscope summarized 2689452.
Summary by CodeRabbit
-
New Features
- Added separate controls for automatically settling inactive threads and threads linked to merged or closed pull requests.
- Applied these preferences across web and mobile thread lists, with sensible defaults.
- Added settings search support for the new automatic-settling option.
-
Documentation
- Documented automatic thread-settling behavior, defaults, mobile support, and manual-only options.
-
Bug Fixes
- Threads remain active when automatic settling for completed pull requests is disabled.
[!NOTE] Low Risk Preference and UI changes around thread list classification; defaults preserve existing behavior and settlement logic is covered by targeted tests.
Overview Adds
sidebarAutoSettleOnChangeRequestCompletion(default on) so merged/closed PR auto-settling is no longer tied to the inactivity setting.effectiveSettledonly auto-settles on terminal PR states when that flag is enabled; manual settle, open-PR inactivity blocking, and the inactivity window stay unchanged.Web/desktop expose a separate Beta toggle and
useClientThreadSettlementPreferences(hydration-safe) feeds Sidebar v2, ChatView, and settings search. Mobile mirrors the two triggers via device-local preferences,resolveThreadListV2SettlementPreferences, and switches under Thread List v2 Beta.User docs describe controlling both automatic settle paths independently.
Reviewed by Cursor Bugbot for commit 26894525dec9e71e154b75fa4044be5adbb98f69. Bugbot is set up for automated code reviews on this repo. Configure here.
📝 Walkthrough
Walkthrough
The change adds a separate setting for automatic settlement after merged or closed change requests. Web and mobile settings expose both settlement triggers. Runtime and Thread List v2 classification apply the preferences and preserve manual settlement behavior.
Changes
Thread settlement contract and runtime
| Layer / File(s) | Summary |
|---|---|
Settings contract and settlement classification packages/contracts/src/settings.ts, packages/client-runtime/src/state/threadSettled.ts, packages/*/src/*test*, apps/desktop/src/settings/DesktopClientSettings.test.ts |
Client settings default change-request completion settlement to enabled. effectiveSettled skips merged or closed change-request settlement when disabled. Tests cover defaults, patches, and manual-only behavior. |
Web controls and consumers
| Layer / File(s) | Summary |
|---|---|
Web settings and settlement consumers apps/web/src/components/settings/BetaSettingsPanel.tsx, apps/web/src/components/settings/settingsSearch.*, apps/web/src/components/SidebarV2.tsx, apps/web/src/components/ChatView.tsx, docs/user/source-control.md |
Web settings expose independent inactivity and merged/closed change-request controls. Sidebar and chat settlement evaluation receive the new preference. Documentation and settings search include the control. |
Mobile Thread List v2
| Layer / File(s) | Summary |
|---|---|
Mobile preference storage and resolution apps/mobile/src/persistence/mobile-preferences.ts, apps/mobile/src/features/threads/threadListV2.ts, apps/mobile/src/features/threads/use-thread-list-v2-enabled.ts |
Mobile preferences store both flags. A shared resolver applies the three-day inactivity default and enables change-request completion settlement unless explicitly disabled. |
Mobile consumers and settings apps/mobile/src/features/home/HomeScreen.tsx, apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx, apps/mobile/src/features/settings/SettingsRouteScreen.tsx, apps/mobile/src/features/threads/threadListV2.test.ts |
Home, sidebar, and Thread List v2 use resolved preferences. Mobile Beta settings persist both switches. Tests cover defaults and active-list classification. |
Estimated code review effort: 3 (Moderate) | ~25 minutes
Sequence Diagram(s)
sequenceDiagram
participant SettingsPanel
participant ClientSettings
participant SidebarV2
participant effectiveSettled
SettingsPanel->>ClientSettings: update merged/closed auto-settle setting
ClientSettings->>SidebarV2: provide setting
SidebarV2->>effectiveSettled: evaluate thread state and preference
effectiveSettled-->>SidebarV2: settled or active classification
Possibly related PRs
- pingdotgg/t3code#4026: Related Sidebar and Thread List v2 settlement logic.
- pingdotgg/t3code#4243: Related server-backed settlement model and
effectiveSettled. - pingdotgg/t3code#4309: Related merged/closed change-request settlement behavior.
Suggested reviewers: t3dotgg, shivamhwp
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | ⚠️ Warning | Docstring coverage is 27.27% which is insufficient. The required threshold is 80.00%. | Write docstrings for the functions missing them to satisfy the coverage threshold. |
✅ Passed checks (4 passed)
| Check name | Status | Explanation |
|---|---|---|
| Linked Issues check | ✅ Passed | The changes satisfy issue #4982 by separating settlement triggers, preserving defaults and manual behavior, and enabling fully manual settlement. |
| Out of Scope Changes check | ✅ Passed | The web, desktop, mobile, runtime, contract, test, and documentation changes directly support the requested auto-settle feature. |
| Title check | ✅ Passed | The title clearly and concisely describes the addition of a pull-request auto-settle toggle. |
| Description check | ✅ Passed | The description covers the required changes, rationale, UI updates, validation, screenshots, and checklist items. |
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
- [ ] Create stacked PR
- [ ] Commit on current branch
🧪 Generate unit tests (beta)
- [ ] Create PR with unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
Approvability
Verdict: Needs human review
New feature adding a user-facing settings toggle across web, mobile, and desktop that changes thread auto-settlement behavior. Cross-platform feature additions warrant human review.
You can customize Macroscope's approvability policy. Learn more.
@coderabbitai review
Review finished. Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.✅ Action performed
[!NOTE] 🤖 GPT-5.6 Sol responding on behalf of Theo
Closing this PR after an automated pass over open pull requests. Configurable automatic settlement already shipped in #5880.