The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 24, 11:30 UTC
fix(web): render draft PRs in gray (#9537)
Exotic committed
Sep 4, 2026 at 09:17 UTC
caab2fdbac041ac2e851ad4fa3ac4a40a1d4a8f6
30 files changed
+152
-36
apps/mobile/src/features/threads/thread-list-items.tsx
+10
-6
@@ -23,7 +23,7 @@ import { relativeTime } from "../../lib/time";
23
import { themeColorWithAlpha } from "../../lib/mobileTheme";
24
import { useUniwindTheme } from "../../lib/useUniwindTheme";
25
import type { PendingNewTask } from "../../state/use-pending-new-tasks";
26
-import { useThreadPr, type ThreadPr } from "../../state/use-thread-pr";
26
+import { useThreadPr, type ThreadPrPresentation } from "../../state/use-thread-pr";
27
import type { HomeGroupDisplayAction } from "../home/homeListItems";
28
import { ThreadSwipeable } from "../home/thread-swipe-actions";
29
import { buildThreadTitleRegenerationMenuItems } from "./thread-title-regeneration-menu";
@@ -42,9 +42,15 @@ export type ThreadListVariant = "compact" | "sidebar";
42
export const THREAD_LIST_COMPACT_INSET = HOME_HORIZONTAL_INSET;
43
const SIDEBAR_ROW_RADIUS = 12;
44
45
-function pullRequestTintColor(state: ThreadPr["state"], colorScheme: "light" | "dark") {
45
+function pullRequestTintColor(
46
+ pr: Pick<ThreadPrPresentation, "state" | "isDraft">,
47
+ colorScheme: "light" | "dark",
48
+) {
49
const dark = colorScheme === "dark";
47
- switch (state) {
50
+ if (pr.state === "open" && pr.isDraft === true) {
51
+ return dark ? "#a1a1aa" : "#71717a";
52
+ }
53
+ switch (pr.state) {
54
case "open":
55
return dark ? "#34d399" : "#059669";
56
case "merged":
@@ -548,9 +554,7 @@ export const ThreadListRow = memo(function ThreadListRow(props: {
554
<PullRequestIcon
555
size={compact ? 13 : 11}
556
color={
551
- selected
552
- ? String(selectedForegroundColor)
553
- : pullRequestTintColor(pr.state, colorScheme)
557
+ selected ? String(selectedForegroundColor) : pullRequestTintColor(pr, colorScheme)
558
}
559
/>
560
<Text
apps/mobile/src/state/thread-pr-presentation.ts
+5
-2
@@ -6,6 +6,7 @@ export type ThreadPr = NonNullable<VcsStatusResult["pr"]>;
6
export interface ThreadPrPresentation {
7
readonly number: number;
8
readonly state: ThreadPr["state"];
9
+ readonly isDraft: boolean;
10
/** Provider-side last activity, bounding when a terminal state landed. */
11
readonly updatedAt: string | null;
12
readonly url: string;
@@ -27,13 +28,15 @@ export function presentThreadPr(
28
provider: VcsStatusResult["sourceControlProvider"] | null | undefined,
29
): ThreadPrPresentation {
30
const presentation = resolveChangeRequestPresentation(provider);
31
+ const isDraft = pr.state === "open" && pr.isDraft === true;
32
return {
33
number: pr.number,
34
state: pr.state,
35
+ isDraft,
36
updatedAt: pr.updatedAt ?? null,
37
url: pr.url,
38
label: String(pr.number),
36
- accessibilityLabel: `#${pr.number} ${presentation.longName} ${pr.state}`,
37
- textClassName: PR_STATE_TEXT_CLASS[pr.state],
39
+ accessibilityLabel: `#${pr.number} ${presentation.longName} ${isDraft ? "draft" : pr.state}`,
40
+ textClassName: isDraft ? "text-adaptive-zinc-500-400" : PR_STATE_TEXT_CLASS[pr.state],
41
};
42
}
apps/mobile/src/state/use-thread-pr.test.ts
+9
@@ -33,4 +33,13 @@ describe("presentThreadPr", () => {
33
accessibilityLabel: "#3774 merge request merged",
34
});
35
});
36
+
37
+ it("uses gray for draft pull requests", () => {
38
+ expect(
39
+ presentThreadPr({ ...pullRequest, state: "open", isDraft: true }, undefined),
40
+ ).toMatchObject({
41
+ accessibilityLabel: "#3774 pull request draft",
42
+ textClassName: "text-adaptive-zinc-500-400",
43
+ });
44
+ });
45
});
apps/server/src/git/GitManager.test.ts
+10
-5
@@ -54,6 +54,7 @@ interface FakeGhScenario {
54
baseRefName: string;
55
headRefName: string;
56
state?: "open" | "closed" | "merged";
57
+ isDraft?: boolean;
58
isCrossRepository?: boolean;
59
headRepositoryNameWithOwner?: string | null;
60
headRepositoryOwnerLogin?: string | null;
@@ -116,6 +117,7 @@ function normalizeFakePullRequestSummary(raw: unknown): GitHubCli.GitHubPullRequ
117
? "closed"
118
: "merged"
119
: undefined;
120
+ const isDraft = typeof record.isDraft === "boolean" ? record.isDraft : undefined;
121
const isCrossRepository =
122
typeof record.isCrossRepository === "boolean" ? record.isCrossRepository : undefined;
123
const headRepositoryNameWithOwner =
@@ -138,6 +140,7 @@ function normalizeFakePullRequestSummary(raw: unknown): GitHubCli.GitHubPullRequ
140
baseRefName,
141
headRefName,
142
...(state ? { state } : {}),
143
+ ...(isDraft === true ? { isDraft: true } : {}),
144
...(isCrossRepository !== undefined ? { isCrossRepository } : {}),
145
...(headRepositoryNameWithOwner ? { headRepositoryNameWithOwner } : {}),
146
...(headRepositoryOwnerLogin ? { headRepositoryOwnerLogin } : {}),
@@ -508,7 +511,7 @@ function createGitHubCliWithFakeGh(scenario: FakeGhScenario = {}): {
511
"--limit",
512
String(input.limit ?? 1),
513
"--json",
511
- "number,title,url,baseRefName,headRefName,state,mergedAt,isCrossRepository,headRepository,headRepositoryOwner",
514
+ "number,title,url,baseRefName,headRefName,state,isDraft,mergedAt,isCrossRepository,headRepository,headRepositoryOwner",
515
],
516
}).pipe(
517
Effect.map((result) => JSON.parse(result.stdout) as unknown[]),
@@ -552,7 +555,7 @@ function createGitHubCliWithFakeGh(scenario: FakeGhScenario = {}): {
555
"view",
556
input.reference,
557
"--json",
555
- "number,title,url,baseRefName,headRefName,state,mergedAt,isCrossRepository,headRepository,headRepositoryOwner",
558
+ "number,title,url,baseRefName,headRefName,state,isDraft,mergedAt,isCrossRepository,headRepository,headRepositoryOwner",
559
],
560
}).pipe(
561
Effect.map((result) => JSON.parse(result.stdout) as GitHubCli.GitHubPullRequestSummary),
@@ -699,7 +702,7 @@ const GitManagerTestLayer = GitVcsDriver.layer.pipe(
702
);
703
704
it.layer(GitManagerTestLayer)("GitManager", (it) => {
702
- it.effect("status includes PR metadata when branch already has an open PR", () =>
705
+ it.effect("status includes draft PR metadata when branch already has a draft PR", () =>
706
Effect.gen(function* () {
707
const repoDir = yield* makeTempDir("t3code-git-manager-");
708
yield* initRepo(repoDir);
@@ -719,6 +722,7 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => {
722
url: "https://github.com/pingdotgg/codething-mvp/pull/13",
723
baseRefName: "main",
724
headRefName: "feature/status-open-pr",
725
+ isDraft: true,
726
},
727
]),
728
],
@@ -737,6 +741,7 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => {
741
baseRef: "main",
742
headRef: "feature/status-open-pr",
743
state: "open",
744
+ isDraft: true,
745
updatedAt: null,
746
});
747
}),
@@ -1686,7 +1691,7 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => {
1691
updatedAt: "2026-03-10T07:00:00.000Z",
1692
});
1693
expect(ghCalls).toContain(
1689
- "pr list --head jasonLaster:statemachine --state all --limit 20 --json number,title,url,baseRefName,headRefName,state,mergedAt,updatedAt,isCrossRepository,headRepository,headRepositoryOwner",
1694
+ "pr list --head jasonLaster:statemachine --state all --limit 20 --json number,title,url,baseRefName,headRefName,state,isDraft,mergedAt,updatedAt,isCrossRepository,headRepository,headRepositoryOwner",
1695
);
1696
}),
1697
20_000,
@@ -1752,7 +1757,7 @@ it.layer(GitManagerTestLayer)("GitManager", (it) => {
1757
updatedAt: "2026-03-10T07:00:00.000Z",
1758
});
1759
expect(ghCalls).toContain(
1755
- "pr list --head contributor:main --state all --limit 20 --json number,title,url,baseRefName,headRefName,state,mergedAt,updatedAt,isCrossRepository,headRepository,headRepositoryOwner",
1760
+ "pr list --head contributor:main --state all --limit 20 --json number,title,url,baseRefName,headRefName,state,isDraft,mergedAt,updatedAt,isCrossRepository,headRepository,headRepositoryOwner",
1761
);
1762
}),
1763
20_000,
apps/server/src/git/GitManager.ts
+5
-5
@@ -170,6 +170,7 @@ interface OpenPrInfo {
170
171
interface PullRequestInfo extends OpenPrInfo, PullRequestHeadRemoteInfo {
172
state: "open" | "closed" | "merged";
173
+ isDraft?: boolean;
174
updatedAt: Option.Option<DateTime.Utc>;
175
}
176
@@ -404,6 +405,7 @@ function toPullRequestInfo(summary: ChangeRequest): PullRequestInfo {
405
baseRefName: summary.baseRefName,
406
headRefName: summary.headRefName,
407
state: summary.state ?? "open",
408
+ ...(summary.isDraft === true ? { isDraft: true } : {}),
409
updatedAt: summary.updatedAt,
410
...(summary.isCrossRepository !== undefined
411
? { isCrossRepository: summary.isCrossRepository }
@@ -558,6 +560,7 @@ function toStatusPr(pr: PullRequestInfo): {
560
baseRef: string;
561
headRef: string;
562
state: "open" | "closed" | "merged";
563
+ isDraft?: boolean;
564
updatedAt: string | null;
565
} {
566
return {
@@ -567,6 +570,7 @@ function toStatusPr(pr: PullRequestInfo): {
570
baseRef: pr.baseRefName,
571
headRef: pr.headRefName,
572
state: pr.state,
573
+ ...(pr.isDraft === true ? { isDraft: true } : {}),
574
updatedAt: Option.match(pr.updatedAt, {
575
onNone: () => null,
576
onSome: (updatedAt) => DateTime.formatIso(updatedAt),
@@ -1518,11 +1522,7 @@ export const make = Effect.gen(function* () {
1522
);
1523
if (firstPullRequest) {
1524
return {
1521
- number: firstPullRequest.number,
1522
- title: firstPullRequest.title,
1523
- url: firstPullRequest.url,
1524
- baseRefName: firstPullRequest.baseRefName,
1525
- headRefName: firstPullRequest.headRefName,
1525
+ ...firstPullRequest,
1526
state: "open",
1527
updatedAt: Option.none(),
1528
} satisfies PullRequestInfo;
apps/server/src/pullRequest/GitHubPullRequestCli.ts
+2
@@ -468,6 +468,7 @@ export class GitHubPullRequestCli extends Context.Service<
468
readonly headBranch: string;
469
readonly baseBranch: string;
470
readonly state: "open" | "closed" | "merged";
471
+ readonly isDraft?: boolean;
472
readonly updatedAt: string;
473
},
474
GitHubPullRequestCliError
@@ -1650,6 +1651,7 @@ export const make = Effect.gen(function* () {
1651
headBranch: summary.headRefName,
1652
baseBranch: summary.baseRefName,
1653
state: summary.state ?? "open",
1654
+ ...(summary.isDraft === true ? { isDraft: true } : {}),
1655
updatedAt: summary.updatedAt,
1656
}),
1657
),
apps/server/src/pullRequest/PullRequestProvider.ts
+2
@@ -96,6 +96,8 @@ export interface ProviderChangeRequestSummary {
96
readonly headBranch: string;
97
readonly baseBranch: string;
98
readonly state: PullRequestState;
99
+ /** Present when the host says an open pull request is still a draft. */
100
+ readonly isDraft?: boolean;
101
readonly updatedAt: string;
102
}
103
apps/server/src/pullRequest/PullRequestService.ts
+2
@@ -1254,6 +1254,7 @@ export const make = Effect.gen(function* () {
1254
title: changeRequest.title,
1255
url: changeRequest.url,
1256
state: changeRequest.state,
1257
+ ...(changeRequest.isDraft === true ? { isDraft: true } : {}),
1258
headBranch: changeRequest.headBranch,
1259
baseBranch: changeRequest.baseBranch,
1260
updatedAt: changeRequest.updatedAt,
@@ -2278,6 +2279,7 @@ export const make = Effect.gen(function* () {
2279
title: detail.title,
2280
url: detail.url,
2281
state: detail.state,
2282
+ ...(detail.isDraft === true ? { isDraft: true } : {}),
2283
headBranch: detail.headBranch,
2284
baseBranch: detail.baseBranch,
2285
updatedAt: detail.updatedAt,
apps/server/src/sourceControl/AzureDevOpsSourceControlProvider.ts
+2
@@ -61,6 +61,7 @@ function toChangeRequest(summary: {
61
readonly baseRefName: string;
62
readonly headRefName: string;
63
readonly state: "open" | "closed" | "merged";
64
+ readonly isDraft?: boolean;
65
readonly updatedAt: ChangeRequest["updatedAt"];
66
}): ChangeRequest {
67
return {
@@ -71,6 +72,7 @@ function toChangeRequest(summary: {
72
baseRefName: summary.baseRefName,
73
headRefName: summary.headRefName,
74
state: summary.state,
75
+ ...(summary.isDraft === true ? { isDraft: true } : {}),
76
updatedAt: summary.updatedAt,
77
isCrossRepository: false,
78
};
apps/server/src/sourceControl/BitbucketSourceControlProvider.ts
+1
@@ -17,6 +17,7 @@ function toChangeRequest(summary: NormalizedBitbucketPullRequestRecord): ChangeR
17
baseRefName: summary.baseRefName,
18
headRefName: summary.headRefName,
19
state: summary.state,
20
+ ...(summary.isDraft === true ? { isDraft: true } : {}),
21
updatedAt: summary.updatedAt ?? Option.none(),
22
...(summary.isCrossRepository !== undefined
23
? { isCrossRepository: summary.isCrossRepository }
apps/server/src/sourceControl/GitHubCli.test.ts
+3
-1
@@ -65,6 +65,7 @@ describe("GitHubCli.layer", () => {
65
baseRefName: "main",
66
headRefName: "feature/pr-threads",
67
state: "OPEN",
68
+ isDraft: true,
69
mergedAt: null,
70
updatedAt: "2026-08-24T12:34:56Z",
71
isCrossRepository: true,
@@ -92,6 +93,7 @@ describe("GitHubCli.layer", () => {
93
baseRefName: "main",
94
headRefName: "feature/pr-threads",
95
state: "open",
96
+ isDraft: true,
97
updatedAt: "2026-08-24T12:34:56.000Z",
98
isCrossRepository: true,
99
headRepositoryNameWithOwner: "octocat/codething-mvp",
@@ -105,7 +107,7 @@ describe("GitHubCli.layer", () => {
107
"view",
108
"#42",
109
"--json",
108
- "number,title,url,baseRefName,headRefName,state,mergedAt,updatedAt,isCrossRepository,headRepository,headRepositoryOwner",
110
+ "number,title,url,baseRefName,headRefName,state,isDraft,mergedAt,updatedAt,isCrossRepository,headRepository,headRepositoryOwner",
111
],
112
cwd: "/repo",
113
timeoutMs: 30_000,
apps/server/src/sourceControl/GitHubCli.ts
+3
-2
@@ -205,6 +205,7 @@ export interface GitHubPullRequestSummary {
205
readonly baseRefName: string;
206
readonly headRefName: string;
207
readonly state?: "open" | "closed" | "merged";
208
+ readonly isDraft?: boolean;
209
readonly updatedAt?: string;
210
readonly isCrossRepository?: boolean;
211
readonly headRepositoryNameWithOwner?: string | null;
@@ -366,7 +367,7 @@ export const make = Effect.gen(function* () {
367
"--limit",
368
String(input.limit ?? 1),
369
"--json",
369
- "number,title,url,baseRefName,headRefName,state,mergedAt,isCrossRepository,headRepository,headRepositoryOwner",
370
+ "number,title,url,baseRefName,headRefName,state,isDraft,mergedAt,isCrossRepository,headRepository,headRepositoryOwner",
371
],
372
}).pipe(
373
Effect.map((result) => result.stdout.trim()),
@@ -398,7 +399,7 @@ export const make = Effect.gen(function* () {
399
"view",
400
input.reference,
401
"--json",
401
- "number,title,url,baseRefName,headRefName,state,mergedAt,updatedAt,isCrossRepository,headRepository,headRepositoryOwner",
402
+ "number,title,url,baseRefName,headRefName,state,isDraft,mergedAt,updatedAt,isCrossRepository,headRepository,headRepositoryOwner",
403
],
404
}).pipe(
405
Effect.map((result) => result.stdout.trim()),
apps/server/src/sourceControl/GitHubSourceControlProvider.test.ts
+1
-1
@@ -150,7 +150,7 @@ it.effect("uses gh json listing for non-open change request state queries", () =
150
"--limit",
151
"10",
152
"--json",
153
- "number,title,url,baseRefName,headRefName,state,mergedAt,updatedAt,isCrossRepository,headRepository,headRepositoryOwner",
153
+ "number,title,url,baseRefName,headRefName,state,isDraft,mergedAt,updatedAt,isCrossRepository,headRepository,headRepositoryOwner",
154
]);
155
assert.strictEqual(changeRequests[0]?.provider, "github");
156
assert.strictEqual(changeRequests[0]?.state, "merged");
apps/server/src/sourceControl/GitHubSourceControlProvider.ts
+2
-1
@@ -30,6 +30,7 @@ function toChangeRequest(summary: GitHubCli.GitHubPullRequestSummary): ChangeReq
30
baseRefName: summary.baseRefName,
31
headRefName: summary.headRefName,
32
state: summary.state ?? "open",
33
+ ...(summary.isDraft === true ? { isDraft: true } : {}),
34
updatedAt:
35
summary.updatedAt === undefined
36
? Option.none()
@@ -153,7 +154,7 @@ export const make = Effect.gen(function* () {
154
"--limit",
155
String(input.limit ?? 20),
156
"--json",
156
- "number,title,url,baseRefName,headRefName,state,mergedAt,updatedAt,isCrossRepository,headRepository,headRepositoryOwner",
157
+ "number,title,url,baseRefName,headRefName,state,isDraft,mergedAt,updatedAt,isCrossRepository,headRepository,headRepositoryOwner",
158
],
159
})
160
.pipe(
apps/server/src/sourceControl/GitLabCli.ts
+1
@@ -246,6 +246,7 @@ export interface GitLabMergeRequestSummary {
246
readonly baseRefName: string;
247
readonly headRefName: string;
248
readonly state?: "open" | "closed" | "merged";
249
+ readonly isDraft?: boolean;
250
readonly updatedAt?: Option.Option<DateTime.Utc>;
251
readonly isCrossRepository?: boolean;
252
readonly headRepositoryNameWithOwner?: string | null;
apps/server/src/sourceControl/GitLabSourceControlProvider.ts
+1
@@ -26,6 +26,7 @@ function toChangeRequest(summary: GitLabCli.GitLabMergeRequestSummary): ChangeRe
26
baseRefName: summary.baseRefName,
27
headRefName: summary.headRefName,
28
state: summary.state ?? "open",
29
+ ...(summary.isDraft === true ? { isDraft: true } : {}),
30
updatedAt: summary.updatedAt ?? Option.none(),
31
...(summary.isCrossRepository !== undefined
32
? { isCrossRepository: summary.isCrossRepository }
apps/server/src/sourceControl/azureDevOpsPullRequests.ts
+3
@@ -14,6 +14,7 @@ export interface NormalizedAzureDevOpsPullRequestRecord {
14
readonly baseRefName: string;
15
readonly headRefName: string;
16
readonly state: "open" | "closed" | "merged";
17
+ readonly isDraft?: boolean;
18
readonly updatedAt: Option.Option<DateTime.Utc>;
19
}
20
@@ -35,6 +36,7 @@ const AzureDevOpsPullRequestSchema = Schema.Struct({
36
sourceRefName: TrimmedNonEmptyString,
37
targetRefName: TrimmedNonEmptyString,
38
status: Schema.String,
39
+ isDraft: Schema.optional(Schema.Boolean),
40
creationDate: Schema.optional(Schema.OptionFromNullOr(Schema.DateTimeUtcFromString)),
41
closedDate: Schema.optional(Schema.OptionFromNullOr(Schema.DateTimeUtcFromString)),
42
_links: Schema.optional(
@@ -168,6 +170,7 @@ function normalizeAzureDevOpsPullRequestRecord(
170
baseRefName: normalizeRefName(raw.targetRefName),
171
headRefName: normalizeRefName(raw.sourceRefName),
172
state: normalizeAzureDevOpsPullRequestState(raw.status),
173
+ ...(raw.isDraft === true ? { isDraft: true } : {}),
174
updatedAt: (raw.closedDate ?? Option.none()).pipe(
175
Option.orElse(() => raw.creationDate ?? Option.none()),
176
),
apps/server/src/sourceControl/bitbucketPullRequests.ts
+3
@@ -10,6 +10,7 @@ export interface NormalizedBitbucketPullRequestRecord {
10
readonly baseRefName: string;
11
readonly headRefName: string;
12
readonly state: "open" | "closed" | "merged";
13
+ readonly isDraft?: boolean;
14
readonly updatedAt: Option.Option<DateTime.Utc>;
15
readonly isCrossRepository?: boolean;
16
readonly headRepositoryNameWithOwner?: string | null;
@@ -38,6 +39,7 @@ export const BitbucketPullRequestSchema = Schema.Struct({
39
id: PositiveInt,
40
title: TrimmedNonEmptyString,
41
state: Schema.optional(Schema.NullOr(Schema.String)),
42
+ draft: Schema.optional(Schema.Boolean),
43
updated_on: Schema.optional(Schema.OptionFromNullOr(Schema.DateTimeUtcFromString)),
44
links: Schema.Struct({
45
html: Schema.Struct({
@@ -98,6 +100,7 @@ export function normalizeBitbucketPullRequestRecord(
100
baseRefName: raw.destination.branch.name,
101
headRefName: raw.source.branch.name,
102
state: normalizeBitbucketPullRequestState(raw.state),
103
+ ...(raw.draft === true ? { isDraft: true } : {}),
104
updatedAt: raw.updated_on ?? Option.none(),
105
...(isCrossRepository ? { isCrossRepository: true } : {}),
106
...(headRepositoryNameWithOwner ? { headRepositoryNameWithOwner } : {}),
apps/server/src/sourceControl/gitHubPullRequests.ts
+3
@@ -14,6 +14,7 @@ export interface NormalizedGitHubPullRequestRecord {
14
readonly baseRefName: string;
15
readonly headRefName: string;
16
readonly state: "open" | "closed" | "merged";
17
+ readonly isDraft?: boolean;
18
readonly updatedAt: Option.Option<DateTime.Utc>;
19
readonly isCrossRepository?: boolean;
20
readonly headRepositoryNameWithOwner?: string | null;
@@ -27,6 +28,7 @@ const GitHubPullRequestSchema = Schema.Struct({
28
baseRefName: TrimmedNonEmptyString,
29
headRefName: TrimmedNonEmptyString,
30
state: Schema.optional(Schema.NullOr(Schema.String)),
31
+ isDraft: Schema.optional(Schema.Boolean),
32
mergedAt: Schema.optional(Schema.NullOr(Schema.String)),
33
updatedAt: Schema.optional(Schema.OptionFromNullOr(Schema.DateTimeUtcFromString)),
34
isCrossRepository: Schema.optional(Schema.Boolean),
@@ -93,6 +95,7 @@ function normalizeGitHubPullRequestRecord(
95
baseRefName: raw.baseRefName,
96
headRefName: raw.headRefName,
97
state: normalizeGitHubPullRequestState(raw),
98
+ ...(raw.isDraft === true ? { isDraft: true } : {}),
99
updatedAt: raw.updatedAt ?? Option.none(),
100
...(typeof raw.isCrossRepository === "boolean"
101
? { isCrossRepository: raw.isCrossRepository }
apps/server/src/sourceControl/gitLabMergeRequests.ts
+4
@@ -14,6 +14,7 @@ export interface NormalizedGitLabMergeRequestRecord {
14
readonly baseRefName: string;
15
readonly headRefName: string;
16
readonly state: "open" | "closed" | "merged";
17
+ readonly isDraft?: boolean;
18
readonly updatedAt: Option.Option<DateTime.Utc>;
19
readonly isCrossRepository?: boolean;
20
readonly headRepositoryNameWithOwner?: string | null;
@@ -41,6 +42,8 @@ const GitLabMergeRequestSchema = Schema.Struct({
42
source_branch: TrimmedNonEmptyString,
43
target_branch: TrimmedNonEmptyString,
44
state: Schema.optional(Schema.NullOr(Schema.String)),
45
+ draft: Schema.optional(Schema.Boolean),
46
+ work_in_progress: Schema.optional(Schema.Boolean),
47
updated_at: Schema.optional(Schema.OptionFromNullOr(Schema.DateTimeUtcFromString)),
48
source_project_id: Schema.optional(Schema.NullOr(Schema.Number)),
49
target_project_id: Schema.optional(Schema.NullOr(Schema.Number)),
@@ -108,6 +111,7 @@ function normalizeGitLabMergeRequestRecord(
111
baseRefName: raw.target_branch,
112
headRefName: raw.source_branch,
113
state: normalizeGitLabMergeRequestState(raw.state),
114
+ ...(raw.draft === true || raw.work_in_progress === true ? { isDraft: true } : {}),
115
updatedAt: raw.updated_at ?? Option.none(),
116
...(typeof isCrossRepository === "boolean" ? { isCrossRepository } : {}),
117
...(sourceProjectPath ? { headRepositoryNameWithOwner: sourceProjectPath } : {}),
apps/web/src/components/Sidebar.tsx
+1
-1
@@ -954,7 +954,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
954
linkedPullRequestStatus,
955
});
956
const prStatus = prStatusIndicator(pr, prProvider);
957
- const settledPrHoverClass = pr ? settledPrHoverColorClass(pr.state) : undefined;
957
+ const settledPrHoverClass = pr ? settledPrHoverColorClass(pr.state, pr.isDraft) : undefined;
958
useEffect(() => {
959
const nextSnapshot = nextThreadChangeRequestSnapshot({
960
threadBranch: thread.branch,
apps/web/src/components/ThreadStatusIndicators.test.ts
+28
@@ -10,6 +10,7 @@ import {
10
resolveDisplayedThreadPrProvider,
11
resolveThreadPr,
12
settledPrHoverColorClass,
13
+ threadChangeRequestSnapshotsEqual,
14
threadChangeRequestSnapshotsAtom,
15
type ThreadChangeRequestSnapshot,
16
} from "./ThreadStatusIndicators";
@@ -559,6 +560,18 @@ describe("resolveDisplayedThreadPr + nextThreadChangeRequestSnapshot", () => {
560
});
561
expect(displayed?.state).toBe("merged");
562
});
563
+
564
+ it("refreshes a cached snapshot when a pull request becomes ready", () => {
565
+ const readyPr = { ...mergedPr, state: "open" as const };
566
+ const draftPr = { ...readyPr, isDraft: true };
567
+
568
+ expect(
569
+ threadChangeRequestSnapshotsEqual(
570
+ snapshotFor(featureBranch, draftPr),
571
+ snapshotFor(featureBranch, readyPr),
572
+ ),
573
+ ).toBe(false);
574
+ });
575
});
576
577
describe("threadChangeRequestSnapshotsAtom", () => {
@@ -600,6 +613,17 @@ describe("prStatusIndicator", () => {
613
"text-red-600",
614
);
615
});
616
+
617
+ it("uses gray and draft wording for draft pull requests", () => {
618
+ const draftPr = status().pr;
619
+ if (!draftPr) throw new Error("Expected pull request fixture");
620
+
621
+ expect(prStatusIndicator({ ...draftPr, isDraft: true }, undefined)).toMatchObject({
622
+ label: "PR draft",
623
+ colorClass: "text-zinc-500 dark:text-zinc-400/80",
624
+ tooltipLead: "PR #42 - Draft",
625
+ });
626
+ });
627
});
628
629
describe("settledPrHoverColorClass", () => {
@@ -610,4 +634,8 @@ describe("settledPrHoverColorClass", () => {
634
] as const)("restores the %s pull request color on row hover", (state, colorClass) => {
635
expect(settledPrHoverColorClass(state)).toContain(`group-hover/v2-row:${colorClass}`);
636
});
637
+
638
+ it("keeps draft pull requests gray on row hover", () => {
639
+ expect(settledPrHoverColorClass("open", true)).toContain("group-hover/v2-row:text-zinc-500");
640
+ });
641
});
apps/web/src/components/ThreadStatusIndicators.tsx
+17
-6
@@ -84,9 +84,15 @@ export function useLinkedThreadPullRequest(
84
);
85
}
86
87
-export function settledPrHoverColorClass(state: NonNullable<ThreadPr>["state"]): string {
87
+export function settledPrHoverColorClass(
88
+ state: NonNullable<ThreadPr>["state"],
89
+ isDraft = false,
90
+): string {
91
switch (state) {
92
case "open":
93
+ if (isDraft) {
94
+ return "group-hover/v2-row:text-zinc-500 dark:group-hover/v2-row:text-zinc-400/80";
95
+ }
96
return "group-hover/v2-row:text-emerald-600 dark:group-hover/v2-row:text-emerald-300/90";
97
case "merged":
98
return "group-hover/v2-row:text-violet-600 dark:group-hover/v2-row:text-violet-300/90";
@@ -99,12 +105,13 @@ export function prStatusIndicator(
105
pr: ThreadPr,
106
provider: VcsStatusResult["sourceControlProvider"] | null | undefined,
107
): PrStatusIndicator | null {
102
- function formatPrState(state: NonNullable<ThreadPr>["state"]): string {
103
- return state.charAt(0).toUpperCase() + state.slice(1);
108
+ function formatPrState(pr: NonNullable<ThreadPr>): string {
109
+ if (pr.state === "open" && pr.isDraft === true) return "Draft";
110
+ return pr.state.charAt(0).toUpperCase() + pr.state.slice(1);
111
}
112
113
function formatPrStatusLead(pr: NonNullable<ThreadPr>, changeRequestShortName: string): string {
107
- return `${changeRequestShortName} #${pr.number} - ${formatPrState(pr.state)}`;
114
+ return `${changeRequestShortName} #${pr.number} - ${formatPrState(pr)}`;
115
}
116
if (!pr) return null;
117
const presentation = resolveChangeRequestPresentation(provider);
@@ -113,9 +120,12 @@ export function prStatusIndicator(
120
const tooltip = `${tooltipLead}: ${pr.title}`;
121
122
if (pr.state === "open") {
123
+ const isDraft = pr.isDraft === true;
124
return {
117
- label: `${presentation.shortName} open`,
118
- colorClass: "text-emerald-600 dark:text-emerald-300/90",
125
+ label: `${presentation.shortName} ${isDraft ? "draft" : "open"}`,
126
+ colorClass: isDraft
127
+ ? "text-zinc-500 dark:text-zinc-400/80"
128
+ : "text-emerald-600 dark:text-emerald-300/90",
129
tooltip,
130
tooltipLead,
131
tooltipTitle: pr.title,
@@ -230,6 +240,7 @@ export function threadChangeRequestSnapshotsEqual(
240
left.pr.baseRef === right.pr.baseRef &&
241
left.pr.headRef === right.pr.headRef &&
242
left.pr.state === right.pr.state &&
243
+ left.pr.isDraft === right.pr.isDraft &&
244
(left.pr.updatedAt ?? null) === (right.pr.updatedAt ?? null) &&
245
sourceControlProvidersEqual(left.sourceControlProvider, right.sourceControlProvider) &&
246
linkedPullRequestsEqual(left.linkedPullRequest, right.linkedPullRequest)
apps/web/src/components/pullRequest/PullRequestDetailPanel.tsx
+8
-2
@@ -625,7 +625,13 @@ export function PullRequestDetailPanel({
625
() =>
626
resolvedCoreDetail === null || sharedSummary === null || sharedSummary === resolvedCoreDetail
627
? resolvedCoreDetail
628
- : { ...resolvedCoreDetail, ...sharedSummary },
628
+ : {
629
+ ...resolvedCoreDetail,
630
+ ...sharedSummary,
631
+ // A summary may come from an older server that does not report draft state. Keep the
632
+ // detail's required value instead of making the complete detail shape partial.
633
+ isDraft: sharedSummary.isDraft ?? resolvedCoreDetail.isDraft,
634
+ },
635
[resolvedCoreDetail, sharedSummary],
636
);
637
const activity = activityQuery.data;
@@ -1297,7 +1303,7 @@ export function PullRequestDetailPanel({
1303
!conflicting &&
1304
allowedMergeMethods.length > 1;
1305
// The pull request number carries this state in the overview and the right-panel tab mirrors
1300
- // it. The conflict action is separate from this state: an open pull request remains green.
1306
+ // it. Conflicts take the action slot while they need a person, but do not change the PR state.
1307
const statePresentation = detail
1308
? resolvePullRequestState({ state: detail.state, isDraft: detail.isDraft })
1309
: null;
apps/web/src/components/pullRequest/pullRequestPresentation.tsx
+3
-3
@@ -33,9 +33,9 @@ interface StatePresentation {
33
}
34
35
/**
36
- * How a pull request's state reads on this page. Open, closed and merged use the same ink as
37
- * the thread badge in `ThreadStatusIndicators`, so one pull request cannot look like two
38
- * different things in two places; draft and conflicts are states that badge never shows.
36
+ * How a pull request's state reads on this page. Open, closed, merged, and draft use the same
37
+ * ink as the thread badge in `ThreadStatusIndicators`, so one pull request cannot look like two
38
+ * different things in two places.
39
*
40
* Draft outranks conflicts: a draft is not heading for a merge yet, so conflicts only surface
41
* once it is real work.
packages/client-runtime/src/state/pullRequests.ts
+1
@@ -69,6 +69,7 @@ export function pullRequestDetailToVcsStatus(
69
baseRef: detail.baseBranch,
70
headRef: detail.headBranch,
71
state: detail.state,
72
+ ...(detail.isDraft === true ? { isDraft: true } : {}),
73
updatedAt: detail.updatedAt,
74
};
75
}
packages/contracts/src/git.ts
+2
@@ -198,6 +198,8 @@ const VcsStatusChangeRequest = Schema.Struct({
198
baseRef: TrimmedNonEmptyStringSchema,
199
headRef: TrimmedNonEmptyStringSchema,
200
state: VcsStatusChangeRequestState,
201
+ /** Optional for compatibility with older servers and providers. */
202
+ isDraft: Schema.optional(Schema.Boolean),
203
/**
204
* Last provider-side activity (ISO). For a merged/closed change request
205
* this bounds when it reached that state, so clients can tell a PR that
packages/contracts/src/pullRequest.ts
+2
@@ -634,6 +634,8 @@ export const PullRequestSummary = Schema.Struct({
634
title: TrimmedNonEmptyString,
635
url: TrimmedNonEmptyString,
636
state: PullRequestState,
637
+ /** Present when the host says the open pull request is still a draft. */
638
+ isDraft: Schema.optional(Schema.Boolean),
639
headBranch: TrimmedNonEmptyString,
640
baseBranch: TrimmedNonEmptyString,
641
updatedAt: IsoDateTime,
packages/contracts/src/sourceControl.ts
+2
@@ -29,6 +29,8 @@ export const ChangeRequest = Schema.Struct({
29
baseRefName: TrimmedNonEmptyString,
30
headRefName: TrimmedNonEmptyString,
31
state: ChangeRequestState,
32
+ /** Present when the provider can tell that an open change request is still a draft. */
33
+ isDraft: Schema.optional(Schema.Boolean),
34
updatedAt: Schema.Option(Schema.DateTimeUtc),
35
isCrossRepository: Schema.optional(Schema.Boolean),
36
headRepositoryNameWithOwner: Schema.optional(Schema.NullOr(TrimmedNonEmptyString)),
scripts/build-desktop-artifact.ts
+16
-1
@@ -2863,7 +2863,7 @@ export const packWindowsServerAsar = Effect.fn("packWindowsServerAsar")(function
2863
readonly arch: typeof BuildArch.Type;
2864
}) {
2865
const fs = yield* FileSystem.FileSystem;
2866
- yield* Effect.tryPromise({
2866
+ const archiveStream = yield* Effect.tryPromise({
2867
try: () =>
2868
createPackageWithOptions(input.sourceDir, input.asarPath, {
2869
dot: true,
@@ -2872,6 +2872,21 @@ export const packWindowsServerAsar = Effect.fn("packWindowsServerAsar")(function
2872
}),
2873
catch: (cause) => new WindowsServerSidecarPackError({ asarPath: input.asarPath, cause }),
2874
});
2875
+ yield* Effect.tryPromise({
2876
+ try: () =>
2877
+ new Promise<void>((resolve, reject) => {
2878
+ const stream = archiveStream as NodeJS.WritableStream & {
2879
+ readonly writableFinished?: boolean;
2880
+ };
2881
+ if (stream.writableFinished === true) {
2882
+ resolve();
2883
+ return;
2884
+ }
2885
+ stream.once("finish", resolve);
2886
+ stream.once("error", reject);
2887
+ }),
2888
+ catch: (cause) => new WindowsServerSidecarPackError({ asarPath: input.asarPath, cause }),
2889
+ });
2890
const unpackedDirPath = `${input.asarPath}.unpacked`;
2891
if (!(yield* fs.exists(unpackedDirPath))) {
2892
return yield* new WindowsServerSidecarPackError({