fix(server): sync pull request draft status changes#22832
Problem
The sidebar can keep showing a pull request as a draft after it becomes ready. Its saved status only refreshed when the PR changed between open, closed, or merged, so changes to isDraft were missed.
Change
Track draft status alongside the PR state when detecting changes. Refresh linked thread snapshots when draft status changes, and include draft status in reports from connected environments.
Scope and approval
This is a focused fix for an obvious stale sidebar status. The thread details menu already reads the current draft status, but the sidebar's saved snapshot did not update when only that status changed.
Verification
Ran 162 focused tests, package typechecks for the server, client runtime, and contracts, and lint on the changed files. Lint reported existing warnings. Browser verification was not run.
Checks
- SuccessfulCodeRabbitGitHub
Review completed
- Skipped
- Skipped
- Skipped
- SuccessfulRemove preview downloadGitHub
- SuccessfulCheckGitHub
- SkippedRustGitHub
- Skipped
- SuccessfulBuild and TypecheckGitHub
- SuccessfulTest WebGitHub
- SuccessfulRelease SmokeGitHub
- SuccessfulTestGitHub
- SuccessfulTest Server 3GitHub
- SuccessfulChangesGitHub
- SuccessfulTest Server 4GitHub
- SuccessfulTest Server 7GitHub
- SuccessfulTest Server 5GitHub
- SuccessfulTest Server 6GitHub
- SuccessfulTest Server 2GitHub
- SuccessfulTest Server 1GitHub
- SuccessfulTest Server 8GitHub
- SuccessfulLintGitHub
- SuccessfulLabel PR 22832GitHub
- Skipped
- SuccessfulLabel PR sizeGitHub
- Skipped
- SkippedDeploy web previewGitHub
- SkippedEAS PreviewGitHub
- SuccessfulNative fingerprint diffGitHub
- Skipped
- Skipped
- SuccessfulPrepare PR size configGitHub
- SuccessfulCollect PR targetsGitHub
Added 2 commits
Approvability
Verdict: Approved at 1e4d9ce
Macroscope's review found this PR approvable ā This is a narrowly scoped fix to propagate pull request draft-status transitions through the existing server, routing, and synchronization paths. The contract addition is optional and backward-compatible, and the production behavior is covered by focused tests without changing defaults or static-analysis configuration.
No code changes detected at b6f33dc. Prior analysis still applies.
You can add or adjust custom eligibility rules. Learn more.
No actionable comments were generated in the recent review. š
ā¹ļø Recent review info
āļø Run configuration
- Configuration used: Path: .coderabbit.config.ts
- Review profile: CHILL
- Plan: Team
- Run ID:
781a0ed8-3bf7-427b-9bc7-281826f77634
š„ Commits
Reviewing files that changed from the base of the PR and between 96f09c6558b098f05ad0c027afa3846209c03d4f and b6f33dc7d0cad8ba8cf7492819f2be5940dfa12b.
š Files selected for processing: 8
apps/server/src/git/GitManager.test.tsapps/server/src/git/GitManager.tsapps/server/src/orchestration-v2/PullRequestSyncReactor.test.tsapps/server/src/pullRequest/PullRequestService.test.tsapps/server/src/pullRequest/PullRequestService.tspackages/client-runtime/src/state/pullRequestRouting.tspackages/client-runtime/src/state/pullRequests.test.tspackages/contracts/src/pullRequest.ts
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
Pull request state reporting and change detection now include optional draft status. The server publishes changes when draft status changes, deduplicates reports using both state and draft status, and synchronizes updated status.
Changes: Draft-status propagation
Layer / File(s) Summary Status contract and routed propagation
packages/contracts/src/pullRequest.ts,packages/client-runtime/src/state/pullRequestRouting.ts,packages/client-runtime/src/state/pullRequests.test.tsThe report-state contract accepts optional isDraft. Client routing forwards it when present, and detail-read tests cover absent,true, andfalsevalues.Server-side draft change detection
apps/server/src/pullRequest/PullRequestService.ts,apps/server/src/git/GitManager.ts,apps/server/src/pullRequest/PullRequestService.test.ts,apps/server/src/git/GitManager.test.tsPull request detail readings and Git lookup state include draft status. The server publishes notifications when state or draft status changes. Tests cover draft transitions and stale reads. State report deduplication and sync
apps/server/src/pullRequest/PullRequestService.ts,apps/server/src/pullRequest/PullRequestService.test.ts,apps/server/src/orchestration-v2/PullRequestSyncReactor.test.tsThe server deduplicates reports using both state and draft status. Reactor tests verify cache invalidation and synchronization with the updated draft status. Priority: ā¬ļø Low
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix
Sequence Diagram(s)
mermaid1 sequenceDiagram 2 participant ClientRuntime 3 participant PullRequestService 4 participant PullRequestSyncReactor 5 participant SyncCommand 6 ClientRuntime->>PullRequestService: Report state with optional isDraft 7 PullRequestService->>PullRequestSyncReactor: Publish state-change event 8 PullRequestSyncReactor->>PullRequestSyncReactor: Invalidate pull request cache 9 PullRequestSyncReactor->>SyncCommand: Dispatch updated isDraft value Suggested reviewers:
t3dotgg,flamboh
Merge Risk: āŖ Minimal Ā· up to b6f33
Draft-status propagation is mergeable after normal checks; no outstanding issue is supported by the reviewed evidence.
Pre-merge checks: Passed 4
Check name Status Explanation Title check Passed The title is concise, uses the repository's conventional format, and clearly describes syncing pull request draft status changes. Description check Passed The description includes all required sections. It explains the stale-status problem, the implementation change, the focused scope justification, and the verification performed, including limitations. 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.
⨠Finishing Touches
š Generate docstrings
- Commit to this branch
- Create a new PR
š§Ŗ Generate unit tests (beta)
- Commit to this branch
- Create a new PR
- Autofix Ā· Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
Thread transfer impact
ā Thread transfer remains within every enforced ceiling.
| Provider | Metric | Main baseline | This PR | Impact | PR ceiling | |
|---|---|---|---|---|---|---|
| Codex | Total thread wire | 5.0 KiB | 5.0 KiB | +7 B (+0.1%) | 6.8 KiB | ā |
| Codex | Thread snapshot wire | 3.8 KiB | 3.8 KiB | 0 B (0.0%) | 4.9 KiB | ā |
| Codex | Live turn WebSocket wire | 1.2 KiB | 1.2 KiB | +7 B (+0.6%) | 2.0 KiB | ā |
| Codex | Live turn WebSocket decoded | 20.9 KiB | 20.9 KiB | 0 B (0.0%) | 29.3 KiB | ā |
| Codex | Live turn messages | 2 | 2 | 0 (0.0%) | 8 | ā |
| Claude | Total thread wire | 5.0 KiB | 5.0 KiB | ā7 B (ā0.1%) | 6.8 KiB | ā |
| Claude | Thread snapshot wire | 3.8 KiB | 3.8 KiB | 0 B (0.0%) | 4.9 KiB | ā |
| Claude | Live turn WebSocket wire | 1.2 KiB | 1.2 KiB | ā7 B (ā0.6%) | 2.0 KiB | ā |
| Claude | Live turn WebSocket decoded | 21.2 KiB | 21.2 KiB | 0 B (0.0%) | 29.3 KiB | ā |
| Claude | Live turn messages | 2 | 2 | 0 (0.0%) | 8 | ā |
Baseline: 96f09c6 Ā· PR result: b6f33dc Ā· Source CI: success
Scenario and decoded snapshot size
10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
- Codex decoded thread snapshot: 108.5 KiB
- Claude decoded thread snapshot: 108.8 KiB
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.