The best way to control Claude Code, Codex and more from any computer or phone
feat(release): release notes and the update popover open with a short note (#26893)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Theo Browne committed
Oct 29, 2026 at 04:26 UTC
b5fc7bedfe5c84d523273fc8269010e416e9cb6c
13 files changed
+662
-20
.github/workflows/release.yml
+28
-2
@@ -762,11 +762,16 @@ jobs:
762
timeout-minutes: 30
763
permissions:
764
contents: write
765
+ # Release notes read PR bodies and authors.
766
+ pull-requests: read
767
steps:
768
- name: Checkout
769
uses: actions/checkout@v6
770
with:
771
ref: ${{ needs.preflight.outputs.ref }}
772
+ # Release notes need history back to the previous tag, not file contents.
773
+ fetch-depth: 0
774
+ filter: blob:none
775
sparse-checkout: |
776
/*
777
!/.repos/
@@ -892,6 +897,27 @@ jobs:
897
echo 'EOF'
898
} >> "$GITHUB_OUTPUT"
899
900
+ # A short model summary over GitHub's full list. Without a notes file, the
901
+ # release falls back to GitHub's generated notes.
902
+ - name: Write release notes
903
+ if: needs.preflight.outputs.release_channel != 'preview' && needs.preflight.outputs.previous_tag != ''
904
+ continue-on-error: true
905
+ timeout-minutes: 5
906
+ env:
907
+ GH_TOKEN: ${{ github.token }}
908
+ OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
909
+ run: |
910
+ node scripts/generate-release-notes.ts \
911
+ --repository "${{ github.repository }}" \
912
+ --tag "${{ needs.preflight.outputs.tag }}" \
913
+ --ref "${{ needs.preflight.outputs.ref }}" \
914
+ --previous-tag "${{ needs.preflight.outputs.previous_tag }}" \
915
+ --version "${{ needs.preflight.outputs.version }}" \
916
+ --output release-notes.md
917
+ if [[ -f release-notes.md ]]; then
918
+ cat release-notes.md >> "$GITHUB_STEP_SUMMARY"
919
+ fi
920
+
921
# A preview release gets a warning instead of generated notes. Generated
922
# notes would list every commit since the previous preview, which is
923
# unmerged branch history no one should read as a changelog, and would
@@ -917,8 +943,8 @@ jobs:
943
tag_name: ${{ needs.preflight.outputs.tag }}
944
target_commitish: ${{ needs.preflight.outputs.ref }}
945
name: ${{ needs.preflight.outputs.release_name }}
920
- generate_release_notes: ${{ needs.preflight.outputs.release_channel != 'preview' }}
921
- body_path: ${{ needs.preflight.outputs.release_channel == 'preview' && 'release-notes.md' || '' }}
946
+ generate_release_notes: ${{ hashFiles('release-notes.md') == '' }}
947
+ body_path: ${{ hashFiles('release-notes.md') != '' && 'release-notes.md' || '' }}
948
previous_tag: ${{ needs.preflight.outputs.previous_tag }}
949
prerelease: ${{ needs.preflight.outputs.is_prerelease }}
950
make_latest: ${{ needs.preflight.outputs.make_latest }}
apps/desktop/src/updates/DesktopUpdates.ts
+2
@@ -70,6 +70,7 @@ const UpdateInfo = Schema.Struct({
70
version: Schema.String,
71
// Malformed notes must not block update-state decoding; normalizeDesktopUpdateReleaseNotes validates separately.
72
releaseNotes: Schema.optional(Schema.Unknown),
73
+ releaseDate: Schema.optional(Schema.String),
74
});
75
76
const DownloadProgressInfo = Schema.Struct({
@@ -895,6 +896,7 @@ export const make = Effect.gen(function* () {
896
info.releaseNotes,
897
info.version,
898
state.channel,
899
+ info.releaseDate,
900
);
901
yield* setState(
902
reduceDesktopUpdateStateOnUpdateAvailable(
apps/desktop/src/updates/releaseNotes.test.ts
+61
@@ -28,6 +28,7 @@ describe("normalizeDesktopUpdateReleaseNotes", () => {
28
releaseNotes: [
29
{
30
version: "0.0.36-nightly.20260828.1213",
31
+ releasedAt: "2026-08-28",
32
items: [
33
"fix(opencode): handle child approvals, stops, and model catalogs by @human in #8480",
34
"fix(web): keep long task drawers usable on small screens by @human in #8313",
@@ -60,6 +61,37 @@ describe("normalizeDesktopUpdateReleaseNotes", () => {
61
});
62
});
63
64
+ it("reads a generated summary as a note and skips the folded full list", () => {
65
+ const fixes = Array.from({ length: 9 }, (_, index) => `- Fix ${index + 1} (#${index + 1})`);
66
+ const result = normalizeDesktopUpdateReleaseNotes(
67
+ [
68
+ "**v1.2.4** · 12 changes from 3 contributors",
69
+ "## Highlights",
70
+ "Link machines (beta).",
71
+ "## Fixes",
72
+ ...fixes,
73
+ "<details>",
74
+ "<summary>Full changelog</summary>",
75
+ "* fix: raw entry by @human in https://github.com/pingdotgg/t3code/pull/1",
76
+ "</details>",
77
+ ].join("\n"),
78
+ "1.2.4",
79
+ "latest",
80
+ "2026-10-29T10:00:00.000Z",
81
+ );
82
+
83
+ expect(result.releaseNotes).toEqual([
84
+ {
85
+ version: "1.2.4",
86
+ releasedAt: "2026-10-29T10:00:00.000Z",
87
+ stats: "12 changes from 3 contributors",
88
+ intro: "Link machines (beta).",
89
+ items: fixes.map((_, index) => `Fix ${index + 1}`),
90
+ totalItems: 10,
91
+ },
92
+ ]);
93
+ });
94
+
95
it("does not count Markdown or HTML section headings as changes", () => {
96
const changes = Array.from({ length: 8 }, (_, index) => `Change ${index + 1}`);
97
const result = normalizeDesktopUpdateReleaseNotes(
@@ -80,6 +112,35 @@ describe("normalizeDesktopUpdateReleaseNotes", () => {
112
]);
113
});
114
115
+ it("reads handwritten notes with their own <details> as a list", () => {
116
+ const result = normalizeDesktopUpdateReleaseNotes(
117
+ "- Older fix\n- Newer fix\n<details><summary>Logs</summary>\n- hidden\n</details>",
118
+ "1.2.3",
119
+ "latest",
120
+ );
121
+
122
+ expect(result.releaseNotes).toEqual([
123
+ { version: "1.2.3", items: ["hidden", "Logs", "Newer fix", "Older fix"], totalItems: 4 },
124
+ ]);
125
+ });
126
+
127
+ it("dates the offered release from the feed and older nightlies by their build day", () => {
128
+ const result = normalizeDesktopUpdateReleaseNotes(
129
+ [
130
+ { version: "0.0.41-nightly.20260914.1707", note: "- Nightly change 2" },
131
+ { version: "0.0.41-nightly.20260913.1700", note: "- Nightly change 1" },
132
+ ],
133
+ "0.0.41-nightly.20260914.1707",
134
+ "nightly",
135
+ "2026-09-14T18:30:00.000Z",
136
+ );
137
+
138
+ expect(result.releaseNotes.map(({ releasedAt }) => releasedAt)).toEqual([
139
+ "2026-09-14T18:30:00.000Z",
140
+ "2026-09-13",
141
+ ]);
142
+ });
143
+
144
it("drops releases from other trains before grouping on nightly", () => {
145
const releaseNotes = [
146
{ version: "0.0.41-preview.20260914.1683", note: "- Maintainer test build" },
apps/desktop/src/updates/releaseNotes.ts
+50
-1
@@ -93,11 +93,46 @@ function isIgnoredReleaseNoteLine(line: string): boolean {
93
interface ExtractedReleaseNoteItems {
94
readonly items: ReadonlyArray<string>;
95
readonly totalItems: number;
96
+ readonly intro?: string;
97
+ readonly stats?: string;
98
+}
99
+
100
+/**
101
+ * Reads a generated summary (`scripts/generate-release-notes.ts`): a `v1.2.3 · N changes…`
102
+ * header, a highlights paragraph, and fix bullets. PR numbers are left to the GitHub page.
103
+ */
104
+function extractReleaseNoteSummary(summary: string): ExtractedReleaseNoteItems {
105
+ let stats: string | undefined;
106
+ const intro: string[] = [];
107
+ const items: string[] = [];
108
+ for (const rawLine of stripMarkup(summary).split("\n")) {
109
+ const line = rawLine.trim().replace(/\s+/g, " ");
110
+ if (line === "" || /^#{1,6}\s+/.test(line)) continue;
111
+ if (stats === undefined && /^v\S+ · /.test(line)) {
112
+ stats = line.slice(line.indexOf(" · ") + 3);
113
+ continue;
114
+ }
115
+ const text = line
116
+ .replace(/^[-*]\s+/, "")
117
+ .replace(/\s*\((?:#\d+(?:,\s*)?)+\)\.?$/, "")
118
+ .trim();
119
+ if (/^[-*]\s+/.test(line)) items.push(text);
120
+ else intro.push(text);
121
+ }
122
+ return {
123
+ items,
124
+ totalItems: items.length + intro.length,
125
+ ...(intro.length > 0 ? { intro: intro.join(" ") } : {}),
126
+ ...(stats ? { stats } : {}),
127
+ };
128
}
129
130
function extractReleaseNoteItems(note: string | null | undefined): ExtractedReleaseNoteItems {
131
if (!note) return { items: [], totalItems: 0 };
132
133
+ // Generated summaries fold GitHub's full list under this exact <details> block.
134
+ const summaryEnd = note.search(/<details>\s*<summary>\s*Full changelog\s*<\/summary>/i);
135
+ if (summaryEnd >= 0) return extractReleaseNoteSummary(note.slice(0, summaryEnd));
136
const items: string[] = [];
137
let totalItems = 0;
138
for (const rawLine of stripMarkup(note).split("\n")) {
@@ -117,6 +152,15 @@ function extractReleaseNoteItems(note: string | null | undefined): ExtractedRele
152
return { items: items.toReversed(), totalItems };
153
}
154
155
+// The update feed dates only the offered version; prerelease versions carry their UTC build day.
156
+const PRERELEASE_BUILD_DAY = /-(?:nightly|preview)\.(\d{4})(\d{2})(\d{2})\.\d+$/;
157
+
158
+function resolveReleasedAt(version: string, offeredVersion: string, releaseDate?: string) {
159
+ if (version === offeredVersion && releaseDate) return releaseDate;
160
+ const day = PRERELEASE_BUILD_DAY.exec(version);
161
+ return day ? `${day[1]}-${day[2]}-${day[3]}` : undefined;
162
+}
163
+
164
interface NormalizedDesktopUpdateReleaseNotes {
165
readonly releaseNotes: ReadonlyArray<DesktopUpdateReleaseNote>;
166
readonly omittedReleaseCount: number;
@@ -127,6 +171,7 @@ export function normalizeDesktopUpdateReleaseNotes(
171
releaseNotes: unknown,
172
fallbackVersion: string,
173
channel: DesktopUpdateChannel,
174
+ releaseDate?: string,
175
): NormalizedDesktopUpdateReleaseNotes {
176
const rawNotes = (
177
typeof releaseNotes === "string"
@@ -137,13 +182,17 @@ export function normalizeDesktopUpdateReleaseNotes(
182
).filter((entry) => desktopUpdateChannelOf(entry.version) === channel);
183
184
const normalizedNotes = rawNotes.flatMap((entry) => {
140
- const { items, totalItems } = extractReleaseNoteItems(entry.note);
185
+ const { items, totalItems, intro, stats } = extractReleaseNoteItems(entry.note);
186
if (totalItems === 0) return [];
187
+ const releasedAt = resolveReleasedAt(entry.version, fallbackVersion, releaseDate);
188
return [
189
{
190
version: entry.version,
191
items,
192
totalItems,
193
+ ...(intro ? { intro } : {}),
194
+ ...(stats ? { stats } : {}),
195
+ ...(releasedAt ? { releasedAt } : {}),
196
},
197
];
198
});
apps/web/src/components/sidebar/SidebarUpdatePill.browser.test.tsx
+1
-1
@@ -81,7 +81,7 @@ function publish(update: DesktopUpdateState | null) {
81
});
82
}
83
84
-const releaseNotes = () => document.querySelector('[aria-label="Nightly update release notes"]');
84
+const releaseNotes = () => document.querySelector('[aria-label="Update release notes"]');
85
86
describe("SidebarUpdatePill release notes", () => {
87
it("closes when the release notes stop applying", async () => {
apps/web/src/components/sidebar/SidebarUpdatePill.tsx
+2
-2
@@ -53,7 +53,7 @@ function shouldUseSidebarUpdateReleaseNotesPopover(
53
showUpdateDetails: boolean,
54
state: DesktopUpdateState | null,
55
): boolean {
56
- return showUpdateDetails && state?.channel === "nightly" && state.releaseNotes.length > 0;
56
+ return showUpdateDetails && (state?.releaseNotes.length ?? 0) > 0;
57
}
58
59
function handleSidebarUpdateReleaseNotesPopoverOpenChange(
@@ -542,7 +542,7 @@ function SidebarUpdateControl() {
542
{showReleaseNotesPopover && state ? (
543
<PopoverPopup
544
align="center"
545
- aria-label="Nightly update release notes"
545
+ aria-label="Update release notes"
546
initialFocus={false}
547
onKeyDownCapture={(event) => {
548
if (
apps/web/src/components/sidebar/SidebarUpdateReleaseNotes.tsx
+51
-13
@@ -5,8 +5,8 @@ import {
5
getDesktopUpdateReleaseHistoryUrl,
6
getDesktopUpdateReleaseUrl,
7
} from "../desktopUpdate.logic";
8
+import { formatRelativeTimeLabel } from "../../timestampFormat";
9
import { openDesktopUpdateReleaseNotes } from "../desktopUpdate.toast";
9
-import { Separator } from "../ui/separator";
10
11
type DesktopUpdateShell = Pick<DesktopBridge, "openExternal">;
12
@@ -19,6 +19,18 @@ function keyReleaseNoteItems(items: ReadonlyArray<string>) {
19
});
20
}
21
22
+/** Feed times read "3h ago"; build days from a prerelease version read "today" or "2d ago". */
23
+function formatReleaseAge(releasedAt: string): string {
24
+ const day = /^(\d{4})-(\d{2})-(\d{2})$/.exec(releasedAt);
25
+ if (!day) return formatRelativeTimeLabel(releasedAt);
26
+ const now = new Date();
27
+ const today = Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate());
28
+ const days = Math.round(
29
+ (today - Date.UTC(Number(day[1]), Number(day[2]) - 1, Number(day[3]))) / 86_400_000,
30
+ );
31
+ return days <= 0 ? "today" : `${days}d ago`;
32
+}
33
+
34
function ReleaseLink({
35
children,
36
releaseUrl,
@@ -30,7 +42,7 @@ function ReleaseLink({
42
}) {
43
return (
44
<a
33
- className="mt-2 inline-flex items-center gap-1 rounded-sm text-xs leading-5 text-muted-foreground underline decoration-dotted underline-offset-4 outline-none transition-colors hover:text-foreground focus-visible:text-foreground focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring"
45
+ className="mt-1 inline-flex items-center gap-1 rounded-sm text-xs leading-5 text-muted-foreground underline-offset-2 outline-none transition-colors hover:text-foreground hover:underline focus-visible:text-foreground focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring"
46
href={releaseUrl}
47
onClick={(event) => {
48
event.preventDefault();
@@ -38,7 +50,7 @@ function ReleaseLink({
50
}}
51
>
52
{children}
41
- <ExternalLinkIcon aria-hidden className="size-3 shrink-0" strokeWidth={2.25} />
53
+ <ExternalLinkIcon aria-hidden className="size-3 shrink-0" strokeWidth={2} />
54
</a>
55
);
56
}
@@ -52,12 +64,15 @@ export function SidebarUpdateReleaseNotes({
64
readonly state: DesktopUpdateState;
65
readonly tooltip: string;
66
}) {
55
- if (state.channel !== "nightly" || state.releaseNotes.length === 0) {
67
+ if (state.releaseNotes.length === 0) {
68
return <>{tooltip}</>;
69
}
70
+ const releasedAt = state.releaseNotes.find(
71
+ (releaseNote) => releaseNote.version === state.availableVersion,
72
+ )?.releasedAt;
73
74
return (
60
- <div className="flex max-h-[calc(var(--available-height)-0.5rem)] min-h-0 w-fit max-w-[min(24rem,calc(100vw-2rem))] flex-col text-left">
75
+ <div className="flex max-h-[calc(var(--available-height)-0.5rem)] min-h-0 w-fit max-w-[min(24rem,calc(100vw-2rem))] flex-col text-left text-pretty">
76
<div className="shrink-0 px-1">
77
{state.status === "available" ? (
78
<div>
@@ -66,7 +81,9 @@ export function SidebarUpdateReleaseNotes({
81
</div>
82
{state.availableVersion ? (
83
<div className="mt-0.5 text-xs leading-4 text-muted-foreground">
69
- {state.availableVersion}
84
+ {releasedAt
85
+ ? `${state.availableVersion} · ${formatReleaseAge(releasedAt)}`
86
+ : state.availableVersion}
87
</div>
88
) : null}
89
</div>
@@ -74,18 +91,40 @@ export function SidebarUpdateReleaseNotes({
91
<div className="text-sm leading-5 font-medium">{tooltip}</div>
92
)}
93
</div>
77
- <div className="min-h-0 max-h-[min(28rem,calc(100vh-6rem))] overflow-y-auto px-1 pt-4 pb-1">
94
+ <div className="min-h-0 max-h-[min(28rem,calc(100vh-6rem))] overflow-y-auto px-1 pt-3 pb-1">
95
{state.releaseNotes.map((releaseNote, index) => {
96
const releaseUrl = getDesktopUpdateReleaseUrl(releaseNote.version);
97
const omittedItemCount = Math.max(0, releaseNote.totalItems - releaseNote.items.length);
98
const linkLabel =
82
- omittedItemCount === 0
99
+ releaseNote.stats ??
100
+ (omittedItemCount === 0
101
? "View release on GitHub"
84
- : `${omittedItemCount} more ${omittedItemCount === 1 ? "change" : "changes"} on GitHub`;
102
+ : `${omittedItemCount} more ${omittedItemCount === 1 ? "change" : "changes"} on GitHub`);
103
+
104
+ if (releaseNote.intro !== undefined) {
105
+ return (
106
+ <section className={index > 0 ? "mt-4" : undefined} key={releaseNote.version}>
107
+ {releaseNote.version !== state.availableVersion ? (
108
+ <h3 className="mb-1 text-xs leading-4 font-medium text-muted-foreground">
109
+ {releaseNote.releasedAt
110
+ ? `${releaseNote.version} · ${formatReleaseAge(releaseNote.releasedAt)}`
111
+ : releaseNote.version}
112
+ </h3>
113
+ ) : null}
114
+ <p className="break-words text-xs leading-5 text-popover-foreground">
115
+ {releaseNote.intro}
116
+ </p>
117
+ {releaseUrl ? (
118
+ <ReleaseLink releaseUrl={releaseUrl} shell={shell}>
119
+ {releaseNote.stats ?? "View release on GitHub"}
120
+ </ReleaseLink>
121
+ ) : null}
122
+ </section>
123
+ );
124
+ }
125
126
return (
87
- <div key={releaseNote.version}>
88
- {index > 0 && <Separator className="my-3" />}
127
+ <div className={index > 0 ? "mt-4" : undefined} key={releaseNote.version}>
128
<section>
129
<h3 className="text-foreground text-xs leading-4 font-semibold">
130
{index === 0 ? "What's changed" : `Changes in ${releaseNote.version}`}
@@ -107,8 +146,7 @@ export function SidebarUpdateReleaseNotes({
146
);
147
})}
148
{state.omittedReleaseCount > 0 ? (
110
- <div>
111
- <Separator className="my-3" />
149
+ <div className="mt-3">
150
<ReleaseLink releaseUrl={getDesktopUpdateReleaseHistoryUrl()} shell={shell}>
151
{`${state.omittedReleaseCount} older ${state.omittedReleaseCount === 1 ? "release" : "releases"} on GitHub`}
152
</ReleaseLink>
docs/operations/release.md
+1
@@ -42,6 +42,7 @@ the version.
42
- Only plain stable `X.Y.Z` releases are marked as the repository's latest release.
43
- Nightly runs are always GitHub prereleases and never marked latest.
44
- Automatically generated release notes are pinned to the previous tag in the same channel, so stable compares to the previous stable tag and nightly compares to the previous nightly tag.
45
+ - The release job's **Write release notes** step (`scripts/generate-release-notes.ts`) builds the body: a computed header line, a short summary from `gpt-6.1-terra`, and GitHub's generated list folded under `<details>`. It needs the `OPENAI_API_KEY` secret. The summary leaves out commits whose scopes are all mobile; the header counts every commit. The desktop update popover, on every channel, shows the highlights paragraph and the header counts as a short note per release, with the offered release's age from the update feed's `releaseDate`. The nightly Discord post shows the part above `<details>`. If the step fails or there is nothing to summarize, it writes no file and the release uses GitHub's generated notes as before.
46
- Includes Electron auto-update metadata (for example `latest*.yml`, `nightly*.yml`, and `*.blockmap`) in release assets.
47
- Builds a self-contained CLI archive per platform (`t3-<version>-<platform>-<arch>.tar.gz`, `.zip` on Windows) in the same job as that target's desktop artifact and attaches them to the GitHub Release with a `SHA256SUMS` file, on every channel, for five targets: macOS arm64, Linux x64 and arm64, Windows x64 and arm64. Every archive is smoke-tested on hardware of its own architecture, and every one but the Windows archives is also built and signed there. There is no macOS x64 archive: Node single-executables are unsupported on x64 macOS (the SEA docs list macOS as arm64 only) and the binary segfaults on start; the x64 desktop app is Electron and unaffected.
48
- The archive holds the server as a Node single-executable (`scripts/build-cli-archive.ts`), so unpacking it needs neither Node, npm, nor a compiler. It is the only form in which T3 Code manages a runtime: the desktop's SSH environments, the boot service, `t3 update`, and the install scripts all download and verify this archive against `SHA256SUMS`. The `t3` npm package exists for people who run `npx t3` or `npm install -g t3` themselves, and it downloads this same archive too; nothing in the product installs from npm. The `curl | sh` installers are `scripts/install.sh` and `scripts/install.ps1`; the marketing site copies them into its `public/` at build time (`apps/marketing/scripts/stage-install-scripts.mjs`) and serves them at `t3.codes/install.sh` and `/install.ps1`.
packages/contracts/src/ipc.ts
+9
@@ -288,12 +288,21 @@ export interface DesktopUpdateReleaseNote {
288
version: string;
289
items: ReadonlyArray<string>;
290
totalItems: number;
291
+ /** ISO time from the update feed for the offered version, else `YYYY-MM-DD` from a prerelease version. */
292
+ releasedAt?: string;
293
+ /** Generated summaries only: the highlights paragraph. `items` then holds the fixes. */
294
+ intro?: string;
295
+ /** Generated summaries only, for example "275 changes from 22 contributors". */
296
+ stats?: string;
297
}
298
299
export const DesktopUpdateReleaseNoteSchema = Schema.Struct({
300
version: Schema.String,
301
items: Schema.Array(Schema.String),
302
totalItems: Schema.Number,
303
+ releasedAt: Schema.optionalKey(Schema.String),
304
+ intro: Schema.optionalKey(Schema.String),
305
+ stats: Schema.optionalKey(Schema.String),
306
});
307
308
export const DesktopUpdateStateSchema = Schema.Struct({
scripts/generate-release-notes.test.ts
new
+65
@@ -0,0 +1,65 @@
1
+import { assert, it } from "@effect/vitest";
2
+
3
+import * as Option from "effect/Option";
4
+
5
+import {
6
+ countContributors,
7
+ isReleaseNoteCommit,
8
+ summaryText,
9
+ type PullRequest,
10
+} from "./generate-release-notes.ts";
11
+
12
+const pullRequest = (author: PullRequest["author"]): PullRequest => ({
13
+ body: "",
14
+ additions: 1,
15
+ deletions: 1,
16
+ changedFiles: 1,
17
+ author,
18
+});
19
+
20
+it("counts each person once and leaves out bots", () => {
21
+ const commits = [
22
+ { subject: "fix(web): one (#1)", authorName: "Ada Lovelace" },
23
+ { subject: "fix(web): two (#2)", authorName: "Ada Lovelace" },
24
+ { subject: "chore: bump (#3)", authorName: "dependabot[bot]" },
25
+ { subject: "fix: direct push by a PR author", authorName: "Ada Lovelace" },
26
+ { subject: "fix: direct push by someone else", authorName: "Grace Hopper" },
27
+ { subject: "chore: direct push by a bot", authorName: "t3-code[bot]" },
28
+ { subject: "fix(web): four (#4)", authorName: "Linus T" },
29
+ { subject: "fix: direct push by a PR author with no profile name", authorName: "Linus T" },
30
+ { subject: "fix(web): five, whose PR did not resolve (#5)", authorName: "Ken T" },
31
+ ];
32
+ const pullRequests = new Map([
33
+ [1, pullRequest({ __typename: "User", login: "ada", name: "Ada Lovelace" })],
34
+ [2, pullRequest({ __typename: "User", login: "ada", name: "Ada Lovelace" })],
35
+ [3, pullRequest({ __typename: "Bot", login: "dependabot" })],
36
+ [4, pullRequest({ __typename: "User", login: "linus", name: null })],
37
+ ]);
38
+
39
+ assert.equal(countContributors(commits, pullRequests), 4);
40
+});
41
+
42
+it("leaves mobile-only scopes out and keeps shared ones", () => {
43
+ const subjects = {
44
+ "fix(mobile): a": false,
45
+ "feat(android): b": false,
46
+ "fix(ios)!: c": false,
47
+ "fix(web,mobile): d": true,
48
+ "feat(mobile,web): f": true,
49
+ "fix(server): e": true,
50
+ };
51
+ for (const [subject, kept] of Object.entries(subjects)) {
52
+ assert.equal(isReleaseNoteCommit({ subject, authorName: "" }), kept, subject);
53
+ }
54
+});
55
+
56
+it("uses model text only from a completed response", () => {
57
+ const output = [
58
+ { type: "message", content: [{ type: "output_text", text: " ## Highlights\nX " }] },
59
+ ];
60
+ assert.deepStrictEqual(
61
+ summaryText({ status: "completed", output }),
62
+ Option.some("## Highlights\nX"),
63
+ );
64
+ assert.deepStrictEqual(summaryText({ status: "incomplete", output }), Option.none());
65
+});
scripts/generate-release-notes.ts
new
+370
@@ -0,0 +1,370 @@
1
+#!/usr/bin/env node
2
+
3
+import * as NodeRuntime from "@effect/platform-node/NodeRuntime";
4
+import * as NodeServices from "@effect/platform-node/NodeServices";
5
+import * as Config from "effect/Config";
6
+import * as Effect from "effect/Effect";
7
+import * as FileSystem from "effect/FileSystem";
8
+import * as Layer from "effect/Layer";
9
+import * as Logger from "effect/Logger";
10
+import * as Option from "effect/Option";
11
+import * as Schema from "effect/Schema";
12
+import { Command, Flag } from "effect/cli";
13
+import { FetchHttpClient, HttpClient, HttpClientRequest, HttpClientResponse } from "effect/http";
14
+import { ChildProcess, ChildProcessSpawner } from "effect/process";
15
+
16
+// Release notes cover web, desktop, and server. Mobile ships its own store notes.
17
+const MOBILE_SCOPES = new Set(["mobile", "android", "ios"]);
18
+const COMMIT_SCOPES = /^[a-z]+\(([^)]*)\)!?:/i;
19
+const PULL_REQUEST_NUMBER = /\(#(\d+)\)$/;
20
+const PULL_REQUEST_BODY_LIMIT = 300;
21
+const SUMMARY_MODEL = "gpt-6.1-terra";
22
+
23
+const SUMMARY_INSTRUCTIONS = `You write release notes for T3 Code, a GUI for coding agents (web and desktop apps backed by a server; providers like Codex, Claude, Cursor, OpenCode).
24
+
25
+These notes cover the web app, desktop app, and server only. The mobile app has its own release notes, so leave out anything only about mobile, iOS, or Android.
26
+
27
+You get the commit subjects merged since the last release, oldest first. Most end with a PR number like (#1234). Each commit shows lines added and removed and files changed, then a trimmed PR description on the next line starting with ">". Use the descriptions to understand what changed for users and why it matters. Line counts hint at size, but a small change can still matter most.
28
+
29
+Output Markdown in exactly this shape and nothing else:
30
+
31
+## Highlights
32
+Up to 4 short sentences. Name only the new features a user would care about most. If no new feature matters to users, write one sentence about the most important fix. Each feature gets a few words that make the benefit clear, not a description of how it works or where the button is.
33
+
34
+## Fixes
35
+- Up to 10 bullets, one fix each, under 10 words, ending with the PR number like (#123). Fewer is fine. Never pad.
36
+- Each bullet names what was broken and says it works now. A user who hit the bug should recognize it.
37
+- Only list fixes from fix commits. New abilities go in Highlights or nowhere. Say "again" only if the commit says it.
38
+
39
+How to write:
40
+- Pick only significant, user-facing changes. Leave out visual polish (focus rings, spacing, colors), layout tweaks, refactors, tests, CI, build, docs, deps, internal tooling, and performance or efficiency work a user would not feel.
41
+- Include Labs and beta features, with "(beta)" after the feature. Leave out work marked internal testing or dev-only.
42
+- Describe each feature as it is at the end of the range. If a beta feature became standard later in the range, it is not beta.
43
+- Say what the user gets, as short as possible. Cut details, conditions, and mechanics.
44
+- No defaults or rollout state ("on by default", "now available", "behind a flag").
45
+- For lists of file types or formats, use common extensions: "previews for .docx, .ttf, .sqlite, .zip and more".
46
+- No internal names, env vars, file paths, or code terms.
47
+- No em dashes. No hype words. Do not invent anything that is not in the input.
48
+
49
+Examples of the tone:
50
+- Bad: "Cmd+K now finds the right thread first, and it searches message text too." Good: "Much better Cmd+K search."
51
+- Bad: "You can share a thread with a guest who watches it live and sends messages that you approve." Good: "Share threads with guests, safely."
52
+- Bad: "Triage issues from the command palette." Good: "Fix and debug T3 Code itself with a new 'triage' command."
53
+- Bad: "Settings and Usage open as large modals over your thread." Good: leave it out.
54
+- Bad: "Cmd/Ctrl+W closes tabs safely (#25860)" Good: "Cmd/Ctrl+W no longer closes the whole window (#25860)"`;
55
+
56
+class EmptyReleaseRangeError extends Schema.TaggedError<EmptyReleaseRangeError>()(
57
+ "EmptyReleaseRangeError",
58
+ { range: Schema.String },
59
+) {}
60
+
61
+interface ReleaseCommit {
62
+ readonly subject: string;
63
+ readonly authorName: string;
64
+}
65
+
66
+const PullRequest = Schema.Struct({
67
+ body: Schema.String,
68
+ additions: Schema.Number,
69
+ deletions: Schema.Number,
70
+ changedFiles: Schema.Number,
71
+ author: Schema.NullOr(
72
+ Schema.Struct({
73
+ __typename: Schema.String,
74
+ login: Schema.String,
75
+ name: Schema.optional(Schema.NullOr(Schema.String)),
76
+ }),
77
+ ),
78
+});
79
+export type PullRequest = typeof PullRequest.Type;
80
+
81
+const PullRequestQueryResponse = Schema.Struct({
82
+ data: Schema.Struct({
83
+ repository: Schema.Record(Schema.String, Schema.NullOr(PullRequest)),
84
+ }),
85
+});
86
+
87
+const GeneratedNotes = Schema.Struct({ body: Schema.String });
88
+
89
+const SummaryResponse = Schema.Struct({
90
+ status: Schema.String,
91
+ output: Schema.Array(
92
+ Schema.Struct({
93
+ type: Schema.String,
94
+ content: Schema.optional(
95
+ Schema.Array(Schema.Struct({ type: Schema.String, text: Schema.optional(Schema.String) })),
96
+ ),
97
+ }),
98
+ ),
99
+ usage: Schema.optional(
100
+ Schema.Struct({ input_tokens: Schema.Number, output_tokens: Schema.Number }),
101
+ ),
102
+});
103
+
104
+const pullRequestNumber = (subject: string) => {
105
+ const match = PULL_REQUEST_NUMBER.exec(subject);
106
+ return match ? Number(match[1]) : undefined;
107
+};
108
+
109
+/** Drops a commit only when every scope is mobile, so `fix(web,mobile)` stays. */
110
+export function isReleaseNoteCommit(commit: ReleaseCommit): boolean {
111
+ const scopes = COMMIT_SCOPES.exec(commit.subject)?.[1]?.split(",");
112
+ return !scopes?.every((scope) => MOBILE_SCOPES.has(scope.trim().toLowerCase()));
113
+}
114
+
115
+/** Keeps the prose of a PR body: no images, tables, headings, HTML, or verification sections. */
116
+function trimPullRequestBody(body: string, limit = PULL_REQUEST_BODY_LIMIT): string {
117
+ const [prose = ""] = body.split(/\n#+\s*(?:Verification|Council|Test|Testing|Screenshots)\b/i);
118
+ const text = prose
119
+ .split("\n")
120
+ .filter((line) => line.trim() !== "" && !/^\s*[!|#<]/.test(line))
121
+ .join(" ")
122
+ .replace(/\s+/g, " ")
123
+ .trim();
124
+ return text.length > limit ? `${text.slice(0, limit)}...` : text;
125
+}
126
+
127
+function buildSummaryInput(
128
+ commits: ReadonlyArray<ReleaseCommit>,
129
+ pullRequests: ReadonlyMap<number, PullRequest>,
130
+): string {
131
+ return commits
132
+ .flatMap(({ subject }) => {
133
+ const number = pullRequestNumber(subject);
134
+ const pullRequest = number === undefined ? undefined : pullRequests.get(number);
135
+ if (!pullRequest) return [subject];
136
+ const line = `${subject} [+${pullRequest.additions} -${pullRequest.deletions}, ${pullRequest.changedFiles} files]`;
137
+ const body = trimPullRequestBody(pullRequest.body);
138
+ return body ? [line, ` > ${body}`] : [line];
139
+ })
140
+ .join("\n");
141
+}
142
+
143
+/** PR authors without bots, plus authors of direct pushes who have no PR in the range. */
144
+export function countContributors(
145
+ commits: ReadonlyArray<ReleaseCommit>,
146
+ pullRequests: ReadonlyMap<number, PullRequest>,
147
+): number {
148
+ const people = new Set<string>();
149
+ // A PR's squash commit carries its author's git name, which may differ from the profile name.
150
+ const prAuthorNames = new Set<string>();
151
+ const directAuthors: string[] = [];
152
+ for (const commit of commits) {
153
+ const number = pullRequestNumber(commit.subject);
154
+ const author = number === undefined ? undefined : pullRequests.get(number)?.author;
155
+ if (!author) {
156
+ directAuthors.push(commit.authorName);
157
+ continue;
158
+ }
159
+ if (author.__typename === "Bot" || author.login.endsWith("[bot]")) continue;
160
+ people.add(author.login);
161
+ prAuthorNames.add(commit.authorName);
162
+ if (author.name) prAuthorNames.add(author.name);
163
+ }
164
+ for (const name of directAuthors) {
165
+ if (!name.endsWith("[bot]") && !prAuthorNames.has(name)) people.add(name);
166
+ }
167
+ return people.size;
168
+}
169
+
170
+/** No date here: the app shows how long ago a release shipped, and GitHub shows the date. */
171
+function buildReleaseHeader(version: string, changes: number, contributors: number): string {
172
+ const plural = (count: number, word: string) => `${count} ${word}${count === 1 ? "" : "s"}`;
173
+ return `**v${version.replace(/^v/, "")}** · ${plural(changes, "change")} from ${plural(contributors, "contributor")}`;
174
+}
175
+
176
+/** The summary leads; GitHub's full list folds under it. Clients cut the body at `<details>`. */
177
+function assembleReleaseNotes(header: string, summary: string, fullChangelog: string): string {
178
+ return `${header}\n\n${summary.trim()}\n\n<details>\n<summary>Full changelog</summary>\n\n${fullChangelog.trim()}\n\n</details>\n`;
179
+}
180
+
181
+const run = Effect.fn("generateReleaseNotes.run")(function* (
182
+ command: string,
183
+ args: ReadonlyArray<string>,
184
+) {
185
+ const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
186
+ return yield* spawner.string(ChildProcess.make(command, args));
187
+});
188
+
189
+const decodeJson = <S extends Schema.Top>(schema: S) =>
190
+ Schema.decodeUnknownEffect(Schema.fromJsonString(schema));
191
+
192
+const readCommits = Effect.fn("generateReleaseNotes.readCommits")(function* (
193
+ previousTag: string,
194
+ ref: string,
195
+) {
196
+ const log = yield* run("git", [
197
+ "log",
198
+ "--reverse",
199
+ "--format=%s%x1f%an",
200
+ `${previousTag}..${ref}`,
201
+ ]);
202
+ return log
203
+ .split("\n")
204
+ .filter((line) => line !== "")
205
+ .map((line): ReleaseCommit => {
206
+ const [subject = "", authorName = ""] = line.split("\x1f");
207
+ return { subject, authorName };
208
+ });
209
+});
210
+
211
+const readPullRequests = Effect.fn("generateReleaseNotes.readPullRequests")(function* (
212
+ repository: string,
213
+ numbers: ReadonlyArray<number>,
214
+) {
215
+ const [owner, name] = repository.split("/");
216
+ const pullRequests = new Map<number, PullRequest>();
217
+ for (let start = 0; start < numbers.length; start += 100) {
218
+ const fields = numbers
219
+ .slice(start, start + 100)
220
+ .map(
221
+ (number) =>
222
+ `pr${number}: pullRequest(number: ${number}) { body additions deletions changedFiles author { __typename login ... on User { name } } }`,
223
+ )
224
+ .join("\n");
225
+ const query = `query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { ${fields} } }`;
226
+ const response = yield* decodeJson(PullRequestQueryResponse)(
227
+ yield* run("gh", [
228
+ "api",
229
+ "graphql",
230
+ "-f",
231
+ `query=${query}`,
232
+ "-f",
233
+ `owner=${owner}`,
234
+ "-f",
235
+ `name=${name}`,
236
+ ]),
237
+ );
238
+ for (const [alias, pullRequest] of Object.entries(response.data.repository)) {
239
+ if (pullRequest) pullRequests.set(Number(alias.slice(2)), pullRequest);
240
+ }
241
+ }
242
+ return pullRequests;
243
+});
244
+
245
+const readFullChangelog = Effect.fn("generateReleaseNotes.readFullChangelog")(function* (options: {
246
+ readonly repository: string;
247
+ readonly tag: string;
248
+ readonly ref: string;
249
+ readonly previousTag: string;
250
+}) {
251
+ const response = yield* run("gh", [
252
+ "api",
253
+ `repos/${options.repository}/releases/generate-notes`,
254
+ "-f",
255
+ `tag_name=${options.tag}`,
256
+ "-f",
257
+ `target_commitish=${options.ref}`,
258
+ "-f",
259
+ `previous_tag_name=${options.previousTag}`,
260
+ ]);
261
+ return (yield* decodeJson(GeneratedNotes)(response)).body;
262
+});
263
+
264
+export function summaryText(response: typeof SummaryResponse.Type): Option.Option<string> {
265
+ // An incomplete response can carry partial text; publishing it would cut the notes short.
266
+ if (response.status !== "completed") return Option.none();
267
+ const text = response.output
268
+ .flatMap((item) => item.content ?? [])
269
+ .flatMap((part) => (part.type === "output_text" && part.text ? [part.text] : []))
270
+ .join("")
271
+ .trim();
272
+ return text === "" ? Option.none() : Option.some(text);
273
+}
274
+
275
+const summarize = Effect.fn("generateReleaseNotes.summarize")(function* (input: string) {
276
+ const apiKey = yield* Config.Redacted("OPENAI_API_KEY");
277
+ const httpClient = yield* HttpClient.HttpClient;
278
+ const response = yield* HttpClientRequest.post("https://api.openai.com/v1/responses").pipe(
279
+ HttpClientRequest.bearerToken(apiKey),
280
+ HttpClientRequest.bodyJson({
281
+ model: SUMMARY_MODEL,
282
+ reasoning: { effort: "low" },
283
+ instructions: SUMMARY_INSTRUCTIONS,
284
+ input: `Commits:\n${input}`,
285
+ }),
286
+ Effect.flatMap(httpClient.execute),
287
+ Effect.flatMap(HttpClientResponse.filterStatusOk),
288
+ Effect.flatMap((response) => response.json),
289
+ Effect.flatMap(Schema.decodeUnknownEffect(SummaryResponse)),
290
+ Effect.timeout("3 minutes"),
291
+ );
292
+ yield* Effect.logInfo("release summary generated").pipe(
293
+ Effect.annotateLogs({
294
+ model: SUMMARY_MODEL,
295
+ inputTokens: response.usage?.input_tokens,
296
+ outputTokens: response.usage?.output_tokens,
297
+ }),
298
+ );
299
+ return summaryText(response);
300
+});
301
+
302
+const command = Command.make(
303
+ "generate-release-notes",
304
+ {
305
+ repository: Flag.String("repository").pipe(Flag.withDescription("GitHub owner/name.")),
306
+ tag: Flag.String("tag").pipe(Flag.withDescription("Tag being released.")),
307
+ ref: Flag.String("ref").pipe(Flag.withDescription("Commit being released.")),
308
+ previousTag: Flag.String("previous-tag").pipe(Flag.withDescription("Previous release tag.")),
309
+ version: Flag.String("version").pipe(Flag.withDescription("Version shown in the header.")),
310
+ output: Flag.String("output").pipe(Flag.withDescription("File to write the notes to.")),
311
+ },
312
+ ({ repository, tag, ref, previousTag, version, output }) =>
313
+ Effect.gen(function* () {
314
+ // The header counts every commit in the range; the summary skips mobile-only work.
315
+ const allCommits = yield* readCommits(previousTag, ref);
316
+ // The spawner ignores exit codes, so a failed git log shows up as an empty range.
317
+ if (allCommits.length === 0) {
318
+ return yield* new EmptyReleaseRangeError({ range: `${previousTag}..${ref}` });
319
+ }
320
+ const commits = allCommits.filter(isReleaseNoteCommit);
321
+ const numbers = [
322
+ ...new Set(allCommits.flatMap(({ subject }) => pullRequestNumber(subject) ?? [])),
323
+ ];
324
+ const [pullRequests, fullChangelog] = yield* Effect.all(
325
+ [
326
+ readPullRequests(repository, numbers),
327
+ readFullChangelog({ repository, tag, ref, previousTag }),
328
+ ],
329
+ { concurrency: "unbounded" },
330
+ );
331
+ const header = buildReleaseHeader(
332
+ version,
333
+ allCommits.length,
334
+ countContributors(allCommits, pullRequests),
335
+ );
336
+ // With no summary, write nothing: the release falls back to GitHub's generated notes.
337
+ const summary =
338
+ commits.length === 0
339
+ ? Option.none<string>()
340
+ : yield* summarize(buildSummaryInput(commits, pullRequests));
341
+ if (Option.isNone(summary)) {
342
+ return yield* Effect.logWarning("no release summary, leaving GitHub's notes in place");
343
+ }
344
+ const fs = yield* FileSystem.FileSystem;
345
+ // Publish uses the file when it exists, so a partial write must never land at `output`.
346
+ yield* fs.writeFileString(
347
+ `${output}.tmp`,
348
+ assembleReleaseNotes(header, summary.value, fullChangelog),
349
+ );
350
+ yield* fs.rename(`${output}.tmp`, output);
351
+ yield* Effect.logInfo("release notes written").pipe(
352
+ Effect.annotateLogs({ output, commits: commits.length }),
353
+ );
354
+ }),
355
+).pipe(
356
+ Command.withDescription("Write release notes with a model summary over GitHub's full list."),
357
+);
358
+
359
+if (import.meta.main) {
360
+ Command.run(command, { version: "0.0.0" }).pipe(
361
+ Effect.provide(
362
+ Layer.mergeAll(
363
+ Logger.layer([Logger.consolePretty()]),
364
+ NodeServices.layer,
365
+ FetchHttpClient.layer,
366
+ ),
367
+ ),
368
+ NodeRuntime.runMain,
369
+ );
370
+}
scripts/notify-discord-release.test.ts
+9
@@ -132,6 +132,15 @@ it("preserves custom notes and links outside generated GitHub pull request entri
132
);
133
});
134
135
+it("posts a generated summary without its folded full list", () => {
136
+ const summary = "**v1.2.3** · 4 changes\n\n## Fixes\n- Stop works again (#1)";
137
+ const releaseNotes = `${summary}\n\n<details>\n<summary>Full changelog</summary>\n\n* fix: raw by @someone in https://github.com/pingdotgg/t3code/pull/1\n\n</details>\n`;
138
+ assert.equal(
139
+ payloadDescription(buildDiscordReleaseAnnouncement({ ...nightlyAnnouncement, releaseNotes })),
140
+ `${intro}\n\n**v1.2.3** · 4 changes\n\n## Fixes\n- Stop works again ([#1](https://github.com/pingdotgg/t3code/pull/1))\n\n[Full changelog](${nightlyAnnouncement.releaseUrl.href})`,
141
+ );
142
+});
143
+
144
it("falls back when notes are missing, empty, or whitespace", () => {
145
const fallback = buildDiscordReleaseAnnouncement(nightlyAnnouncement);
146
assert.equal(payloadDescription(fallback), intro);
scripts/notify-discord-release.ts
+13
-1
@@ -135,6 +135,12 @@ const suppressMentions = (text: string) =>
135
136
const escapeLinkLabel = (text: string) => text.replace(/[\\[\]]/g, "\\$&");
137
138
+/** GitHub links `(#123)` on the release page; Discord needs the link written out. */
139
+function linkPullRequestNumbers(notes: string, releaseUrl: URL) {
140
+ const repositoryUrl = releaseUrl.href.split("/releases/")[0];
141
+ return notes.replace(/#(\d+)\b/g, `[#$1](${repositoryUrl}/pull/$1)`);
142
+}
143
+
144
function formatReleaseNotes(notes: string) {
145
return notes
146
.replace(
@@ -193,9 +199,15 @@ export const buildDiscordReleaseAnnouncement = (
199
options.target === "prerelease"
200
? "A new T3 Code prerelease is available for nightly testers."
201
: `[View full release notes on GitHub](${options.releaseUrl.href})`;
202
+ // Generated summaries fold the full list under <details>, which Discord cannot render.
203
+ const [summary = "", folded] = (options.releaseNotes ?? "").split(/^<details>/m);
204
const notes =
205
options.target === "prerelease"
198
- ? suppressMentions(formatReleaseNotes(options.releaseNotes?.trim() ?? ""))
206
+ ? suppressMentions(
207
+ folded === undefined
208
+ ? formatReleaseNotes(summary.trim())
209
+ : `${linkPullRequestNumbers(summary.trim(), options.releaseUrl)}\n\n[Full changelog](${options.releaseUrl.href})`,
210
+ )
211
: "";
212
const description = notes ? `${intro}\n\n${notes}` : intro;
213
// Separate embeds avoid URL deduplication; reserve title and footer space within Discord's 6000-character limit.