fix(threads): stop pull request watches when settling #16095
main fromrefs/pull/16095/head·merged by juliusmarminge View on GitHubSettling a thread left its PR watches marked as active. Manual and automatic settlement now stop all watches, keep PR links, and block new watches until the thread is unsettled. Watches must be started again after unsettling.
Verified with 93 focused tests, server typecheck, formatting, and CI. Lint has one existing unused-variable warning. Macroscope approved; CodeRabbit found no issues.
Model: gpt-6.1-sol, high reasoning effort. Harness: Codex in T3 Code.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
Approvability#
Verdict: Approved at
234854aMacroscope's review found this PR approvable — This is a focused fix to pull-request watch lifecycle handling: settlement clears watches, stale monitor updates are rejected, and watches can be restarted after unsettling. The change is localized and backed by tests covering both manual and automatic settlement paths.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).Navigate logical layers of code changes, visualize relationships, and explore their blast radius.
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
- Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml
- Review profile: CHILL
- Plan: Advanced
- Run ID:
b72c3846-3eb9-4548-bcb0-a69fc5080687
📥 Commits
Reviewing files that changed from the base of the PR and between 1604ccc9d79f5270fb8e14d60664184bf142c4cb and 234854ae15b52401c9a77c3b228cc8223a8e88c5.
📒 Files selected for processing (5)
apps/server/src/mcp/toolkits/pullRequests/tools.tsapps/server/src/orchestration-v2/Orchestrator.tsapps/server/src/orchestration-v2/PullRequestWatchReactor.tsapps/server/src/orchestration-v2/runtimeLayer.test.tsdocs/user/source-control.md
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
📝 Walkthrough
Walkthrough#
When a thread settles, its pull-request watches are removed. Starting a watch on a settled thread is rejected until the thread is unsettled. Tests cover manual and automatic settlement, projection rebuilds, and subsequent watch attempts.
Changes#
Pull-request watch settlement
Layer / File(s) Summary Enforce watch termination on settlement
apps/server/src/orchestration-v2/Orchestrator.ts,apps/server/src/orchestration-v2/runtimeLayer.test.ts,apps/server/src/mcp/toolkits/pullRequests/tools.ts,apps/server/src/orchestration-v2/PullRequestWatchReactor.ts,docs/user/source-control.mdThe orchestrator removes watches when a thread settles and rejects watch starts while the thread is settled. Tests cover manual and automatic settlement, projection rebuilds, rejected sync and restart attempts, and starting a watch after unsettling the thread. Tool and user guidance describe settlement as ending watches. Priority: ⬇️ Low
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Suggested reviewers:
t3dotggMerge Risk: ⚪ Minimal · up to
23485Settling a thread now ends its pull-request watches, and a new watch has to be started after unsettling. The documentation and tool description match this behavior. No merge-blocking risk was identified.
Security Architecture Review#
Security architecture risk: ⚪ Minimal · up to
23485The change reduces background activity on settled threads without expanding permissions. Watch removal accompanies settlement, and existing stale-result checks prevent stopped watches from being restored or waking the agent. No introduced or materially worsened security concern was identified in the reviewed paths.
Retained concerns No architecture-level concerns identified.
Security review details
Security Blast Radius
- observed — The changed transition affects every pull-request watch attached to the settling thread. It preserves linked assets and reduces future host polling and agent wakes for those watches. Existing target selection remains subject to MCP capability and caller-mode limits.
Trust Boundaries and Controls
- observed — Caller-supplied thread and pull-request targets still pass through the unchanged pull-requests capability check, live-target lookup, writable-thread limits, project resolution, and target resolution. Cross-thread agent mutation requires a live matching provider run; external clients use their approved runtime ceiling. The PR does not broaden this public entrypoint's authority.
Resilience and Maintainability Implications
- observed — Repeated starts reuse the existing watch, while command receipts prevent accepted commands from being applied again. Reactor sweeps enumerate persisted watches and discard caches for removed generations. Interruption is propagated rather than treated as a successful host read, preserving the existing containment path.
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)#
Check name Status Explanation Resolution Description check ⚠️ Warning The description explains the problem and change, but it does not meet key template requirements. It gives no issue or discussion link, maintainer approval, or reason the fix qualifies without prior ap… Add a link to the triaged issue or discussion with explicit maintainer approval. If this focused fix does not require prior approval, explain why it qualifies. Describe the focused tests or manual checks and their observed results, and stat… ✅ Passed checks (4 passed)
Check name Status Explanation Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 4… Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request. Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request. Title check ✅ Passed The title clearly summarizes the main change: pull request watches stop when a thread is settled. Full details: Description check
Explanation
The description explains the problem and change, but it does not meet key template requirements. It gives no issue or discussion link, maintainer approval, or reason the fix qualifies without prior approval. It also reports test totals and general checks without describing the focused tests or their observed results.
Resolution
Add a link to the triaged issue or discussion with explicit maintainer approval. If this focused fix does not require prior approval, explain why it qualifies. Describe the focused tests or manual checks and their observed results, and state anything not checked.
- Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
- Create a new PR
- Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment `@coderabbitai help` to get the list of available commands.juliusmarminge merged this51f7f77
juliusmarminge closed this
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes