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 21, 03:37 UTC
fix(desktop): update checks say why a build with a different saved track offers nothing (#38506)
Co-authored-by: Claude Haiku 5.5 <noreply@anthropic.com> Co-authored-by: Julius Marminge <julius0216@outlook.com>
shivam committed
Nov 21, 2026 at 01:52 UTC
271357040676ea578f134493169df4b27ee080f6
42 files changed
+339
-35
apps/desktop/src/i18n/translations/de.json
+3
@@ -55,6 +55,8 @@
55
"6994444f4fec4070": "Browservorschau",
56
"49de6209699eb616": "Unbenannter Passkey",
57
"b4a5bb1075d95154": "Passkey auswählen",
58
+ "61aa0109862ff7ca": "Nightly",
59
+ "f3430cac09a505a0": "Stable",
60
"1f12213f4d809e89": "Du bist auf dem neuesten Stand!",
61
"c6399b55619e2f67": "T3 Code {version} ist derzeit die neueste verfügbare Version.",
62
"b6e5b31255e011c5": "OK",
@@ -74,6 +76,7 @@
76
"2f0a8211a72e29aa": "Neu starten",
77
"116a21f6cc215e5f": "Suche nach Updates fehlgeschlagen",
78
"32c88cd9421abf33": "Es konnte nicht nach Updates gesucht werden.",
79
+ "9e5ada64a94c10de": "Dieser {build}-Build kann sich über den Kanal {saved} nicht selbst aktualisieren. Stelle den Update-Kanal wieder auf {build} um oder nutze Review neben Update-Kanal, um den Wechsel zu {saved} erneut zu versuchen.",
80
"b37aca07d3c644d9": "Ein unbekannter Fehler ist aufgetreten. Bitte versuche es später erneut.",
81
"c8c23435e780a60c": "Updates nicht verfügbar",
82
"aecf7c98b81bef7a": "Automatische Updates sind derzeit nicht verfügbar.",
apps/desktop/src/i18n/translations/en.json
+3
@@ -55,6 +55,8 @@
55
"6994444f4fec4070": "Browser preview",
56
"49de6209699eb616": "Unnamed passkey",
57
"b4a5bb1075d95154": "Choose a passkey",
58
+ "61aa0109862ff7ca": "Nightly",
59
+ "f3430cac09a505a0": "Stable",
60
"1f12213f4d809e89": "You're up to date!",
61
"c6399b55619e2f67": "T3 Code {version} is currently the newest version available.",
62
"b6e5b31255e011c5": "OK",
@@ -74,6 +76,7 @@
76
"2f0a8211a72e29aa": "Restart",
77
"116a21f6cc215e5f": "Update check failed",
78
"32c88cd9421abf33": "Could not check for updates.",
79
+ "9e5ada64a94c10de": "This {build} build can't update from the {saved} track on its own. Switch the update track back to {build}, or use Review beside Update track to retry the switch to {saved}.",
80
"b37aca07d3c644d9": "An unknown error occurred. Please try again later.",
81
"c8c23435e780a60c": "Updates unavailable",
82
"aecf7c98b81bef7a": "Automatic updates are not available right now.",
apps/desktop/src/i18n/translations/es.json
+3
@@ -55,6 +55,8 @@
55
"6994444f4fec4070": "Vista previa del navegador",
56
"49de6209699eb616": "Llave de acceso sin nombre",
57
"b4a5bb1075d95154": "Elige una llave de acceso",
58
+ "61aa0109862ff7ca": "Nightly",
59
+ "f3430cac09a505a0": "Estable",
60
"1f12213f4d809e89": "¡Estás al día!",
61
"c6399b55619e2f67": "T3 Code {version} es la versión más reciente disponible.",
62
"b6e5b31255e011c5": "Aceptar",
@@ -74,6 +76,7 @@
76
"2f0a8211a72e29aa": "Reiniciar",
77
"116a21f6cc215e5f": "Error al buscar actualizaciones",
78
"32c88cd9421abf33": "No se pudo buscar actualizaciones.",
79
+ "9e5ada64a94c10de": "Esta compilación {build} no puede actualizarse por sí sola desde el canal {saved}. Vuelve a poner el canal de actualizaciones en {build} o usa Revisar junto a Canal de actualizaciones para reintentar el cambio a {saved}.",
80
"b37aca07d3c644d9": "Se produjo un error desconocido. Vuelve a intentarlo más tarde.",
81
"c8c23435e780a60c": "Actualizaciones no disponibles",
82
"aecf7c98b81bef7a": "Las actualizaciones automáticas no están disponibles ahora mismo.",
apps/desktop/src/i18n/translations/fr.json
+3
@@ -55,6 +55,8 @@
55
"6994444f4fec4070": "Aperçu du navigateur",
56
"49de6209699eb616": "Clé d’accès sans nom",
57
"b4a5bb1075d95154": "Choisir une clé d’accès",
58
+ "61aa0109862ff7ca": "Nightly",
59
+ "f3430cac09a505a0": "Stable",
60
"1f12213f4d809e89": "Vous êtes à jour !",
61
"c6399b55619e2f67": "T3 Code {version} est actuellement la version la plus récente.",
62
"b6e5b31255e011c5": "OK",
@@ -74,6 +76,7 @@
76
"2f0a8211a72e29aa": "Redémarrer",
77
"116a21f6cc215e5f": "Échec de la recherche de mises à jour",
78
"32c88cd9421abf33": "Impossible de rechercher des mises à jour.",
79
+ "9e5ada64a94c10de": "Cette version {build} ne peut pas se mettre à jour seule depuis le canal {saved}. Remettez le canal de mise à jour sur {build}, ou utilisez Consulter à côté de Canal de mise à jour pour relancer le passage à {saved}.",
80
"b37aca07d3c644d9": "Une erreur inconnue s’est produite. Veuillez réessayer plus tard.",
81
"c8c23435e780a60c": "Mises à jour indisponibles",
82
"aecf7c98b81bef7a": "Les mises à jour automatiques ne sont pas disponibles pour le moment.",
apps/desktop/src/i18n/translations/ja.json
+3
@@ -55,6 +55,8 @@
55
"6994444f4fec4070": "ブラウザープレビュー",
56
"49de6209699eb616": "名前のないパスキー",
57
"b4a5bb1075d95154": "パスキーを選択",
58
+ "61aa0109862ff7ca": "Nightly",
59
+ "f3430cac09a505a0": "安定版",
60
"1f12213f4d809e89": "最新の状態です",
61
"c6399b55619e2f67": "T3 Code {version} が現在利用できる最新バージョンです。",
62
"b6e5b31255e011c5": "OK",
@@ -74,6 +76,7 @@
76
"2f0a8211a72e29aa": "再起動",
77
"116a21f6cc215e5f": "更新の確認に失敗しました",
78
"32c88cd9421abf33": "更新を確認できませんでした。",
79
+ "9e5ada64a94c10de": "この {build} ビルドは {saved} トラックから単独では更新できません。更新トラックを {build} に戻すか、更新トラックの横にある「レビュー」を使って {saved} への切り替えを再試行してください。",
80
"b37aca07d3c644d9": "不明なエラーが発生しました。しばらくしてからもう一度お試しください。",
81
"c8c23435e780a60c": "更新を利用できません",
82
"aecf7c98b81bef7a": "現在、自動更新は利用できません。",
apps/desktop/src/i18n/translations/ko.json
+3
@@ -55,6 +55,8 @@
55
"6994444f4fec4070": "브라우저 미리 보기",
56
"49de6209699eb616": "이름 없는 패스키",
57
"b4a5bb1075d95154": "패스키 선택",
58
+ "61aa0109862ff7ca": "Nightly",
59
+ "f3430cac09a505a0": "Stable",
60
"1f12213f4d809e89": "최신 버전입니다!",
61
"c6399b55619e2f67": "T3 Code {version}이(가) 현재 사용 가능한 최신 버전입니다.",
62
"b6e5b31255e011c5": "확인",
@@ -74,6 +76,7 @@
76
"2f0a8211a72e29aa": "다시 시작",
77
"116a21f6cc215e5f": "업데이트 확인 실패",
78
"32c88cd9421abf33": "업데이트를 확인할 수 없습니다.",
79
+ "9e5ada64a94c10de": "이 {build} 빌드는 {saved} 트랙에서 스스로 업데이트할 수 없습니다. 업데이트 트랙을 다시 {build}(으)로 바꾸거나, 업데이트 트랙 옆의 검토를 사용해 {saved}(으)로 전환을 다시 시도하세요.",
80
"b37aca07d3c644d9": "알 수 없는 오류가 발생했습니다. 나중에 다시 시도하세요.",
81
"c8c23435e780a60c": "업데이트를 사용할 수 없음",
82
"aecf7c98b81bef7a": "지금은 자동 업데이트를 사용할 수 없습니다.",
apps/desktop/src/i18n/translations/pt-BR.json
+3
@@ -55,6 +55,8 @@
55
"6994444f4fec4070": "Pré-visualização do navegador",
56
"49de6209699eb616": "Chave de acesso sem nome",
57
"b4a5bb1075d95154": "Escolha uma chave de acesso",
58
+ "61aa0109862ff7ca": "Nightly",
59
+ "f3430cac09a505a0": "Estável",
60
"1f12213f4d809e89": "Você está atualizado!",
61
"c6399b55619e2f67": "O T3 Code {version} é a versão mais recente disponível.",
62
"b6e5b31255e011c5": "OK",
@@ -74,6 +76,7 @@
76
"2f0a8211a72e29aa": "Reiniciar",
77
"116a21f6cc215e5f": "Falha ao verificar atualizações",
78
"32c88cd9421abf33": "Não foi possível verificar atualizações.",
79
+ "9e5ada64a94c10de": "Esta build {build} não consegue se atualizar sozinha pelo canal {saved}. Volte o canal de atualização para {build} ou use Revisar ao lado de Canal de atualização para tentar de novo a mudança para {saved}.",
80
"b37aca07d3c644d9": "Ocorreu um erro desconhecido. Tente novamente mais tarde.",
81
"c8c23435e780a60c": "Atualizações indisponíveis",
82
"aecf7c98b81bef7a": "As atualizações automáticas não estão disponíveis no momento.",
apps/desktop/src/i18n/translations/ru.json
+3
@@ -55,6 +55,8 @@
55
"6994444f4fec4070": "Предпросмотр в браузере",
56
"49de6209699eb616": "Безымянный ключ доступа",
57
"b4a5bb1075d95154": "Выберите ключ доступа",
58
+ "61aa0109862ff7ca": "Nightly",
59
+ "f3430cac09a505a0": "Стабильный",
60
"1f12213f4d809e89": "У вас последняя версия!",
61
"c6399b55619e2f67": "T3 Code {version} — новейшая доступная версия.",
62
"b6e5b31255e011c5": "OK",
@@ -74,6 +76,7 @@
76
"2f0a8211a72e29aa": "Перезапустить",
77
"116a21f6cc215e5f": "Ошибка проверки обновлений",
78
"32c88cd9421abf33": "Не удалось проверить обновления.",
79
+ "9e5ada64a94c10de": "Эта сборка {build} не может сама обновиться с канала «{saved}». Верните канал обновлений на «{build}» или нажмите «Ревью» рядом с «Канал обновлений», чтобы повторить переход на «{saved}».",
80
"b37aca07d3c644d9": "Произошла неизвестная ошибка. Повторите попытку позже.",
81
"c8c23435e780a60c": "Обновления недоступны",
82
"aecf7c98b81bef7a": "Автоматические обновления сейчас недоступны.",
apps/desktop/src/i18n/translations/sv.json
+3
@@ -55,6 +55,8 @@
55
"6994444f4fec4070": "Förhandsvisning i webbläsaren",
56
"49de6209699eb616": "Namnlös lösenordsnyckel",
57
"b4a5bb1075d95154": "Välj en lösenordsnyckel",
58
+ "61aa0109862ff7ca": "Nightly",
59
+ "f3430cac09a505a0": "Stable",
60
"1f12213f4d809e89": "Du har den senaste versionen!",
61
"c6399b55619e2f67": "T3 Code {version} är den senaste tillgängliga versionen.",
62
"b6e5b31255e011c5": "OK",
@@ -74,6 +76,7 @@
76
"2f0a8211a72e29aa": "Starta om",
77
"116a21f6cc215e5f": "Sökningen efter uppdateringar misslyckades",
78
"32c88cd9421abf33": "Kunde inte söka efter uppdateringar.",
79
+ "9e5ada64a94c10de": "Den här {build}-versionen kan inte uppdatera sig själv från spåret {saved}. Byt tillbaka uppdateringsspåret till {build}, eller använd Granska bredvid Uppdateringsspår för att försöka byta till {saved} igen.",
80
"b37aca07d3c644d9": "Ett okänt fel inträffade. Försök igen senare.",
81
"c8c23435e780a60c": "Uppdateringar är inte tillgängliga",
82
"aecf7c98b81bef7a": "Automatiska uppdateringar är inte tillgängliga just nu.",
apps/desktop/src/i18n/translations/zh.json
+3
@@ -55,6 +55,8 @@
55
"6994444f4fec4070": "浏览器预览",
56
"49de6209699eb616": "未命名通行密钥",
57
"b4a5bb1075d95154": "选择通行密钥",
58
+ "61aa0109862ff7ca": "Nightly 版",
59
+ "f3430cac09a505a0": "稳定版",
60
"1f12213f4d809e89": "已是最新版本!",
61
"c6399b55619e2f67": "T3 Code {version} 已是最新版本。",
62
"b6e5b31255e011c5": "确定",
@@ -74,6 +76,7 @@
76
"2f0a8211a72e29aa": "重启",
77
"116a21f6cc215e5f": "检查更新失败",
78
"32c88cd9421abf33": "无法检查更新。",
79
+ "9e5ada64a94c10de": "此 {build} 构建无法自行从 {saved} 通道更新。请将更新通道切回 {build},或使用“更新通道”旁的“查看”重新尝试切换到 {saved}。",
80
"b37aca07d3c644d9": "发生未知错误,请稍后重试。",
81
"c8c23435e780a60c": "更新不可用",
82
"aecf7c98b81bef7a": "目前无法自动更新。",
apps/desktop/src/updates/DesktopUpdates.test.ts
+71
-5
@@ -79,6 +79,17 @@ const stableUpdateInfo = (
79
};
80
};
81
82
+// Subscribes before emitting, so the state the emit publishes is the one awaited, not a scheduler yield.
83
+const nextPublishedState = (emit: () => void) =>
84
+ Effect.gen(function* () {
85
+ const updates = yield* DesktopUpdates.DesktopUpdates;
86
+ const { changes } = yield* updates.subscribe;
87
+ const published = yield* Stream.runHead(changes).pipe(Effect.forkChild);
88
+ emit();
89
+ yield* Fiber.join(published);
90
+ return yield* updates.getState;
91
+ });
92
+
93
describe("DesktopUpdates", () => {
94
it.effect("updates Linux .deb installs and leaves other non-AppImage installs off", () =>
95
Effect.gen(function* () {
@@ -1191,16 +1202,49 @@ describe("DesktopUpdates", () => {
1202
const updates = yield* DesktopUpdates.DesktopUpdates;
1203
yield* updates.configure;
1204
yield* updates.check("startup");
1194
- harness.emit("update-available", { version: "1.2.4-nightly.20261027.1" });
1195
- yield* flushCallbacks;
1196
-
1197
- assert.equal((yield* updates.getState).channel, "nightly");
1198
- assert.isNull((yield* updates.getState).availableVersion);
1205
+ const state = yield* nextPublishedState(() =>
1206
+ harness.emit("update-available", { version: "1.2.4-nightly.20261027.1" }),
1207
+ );
1208
+ assert.equal(state.channel, "nightly");
1209
+ assert.isNull(state.availableVersion);
1210
+ assert.equal(state.status, "error");
1211
+ assert.equal(state.errorContext, "check");
1212
+ assert.isTrue(state.canRetry);
1213
+ assert.deepEqual(state.trackMismatch, { buildChannel: "latest" });
1214
assert.deepEqual(harness.checkAllowedDowngrade, [false]);
1215
}),
1216
).pipe(Effect.provide(Layer.merge(TestClock.layer(), harness.layer)));
1217
});
1218
1219
+ it.effect("reports a track mismatch when the feed offers no release at all", () => {
1220
+ const harness = makeHarness({ savedChannel: "nightly" });
1221
+
1222
+ return Effect.scoped(
1223
+ Effect.gen(function* () {
1224
+ const updates = yield* DesktopUpdates.DesktopUpdates;
1225
+ yield* updates.configure;
1226
+ yield* updates.check("startup");
1227
+ const state = yield* nextPublishedState(() => harness.emit("update-not-available"));
1228
+ assert.equal(state.status, "error");
1229
+ assert.equal(state.errorContext, "check");
1230
+ assert.isTrue(state.canRetry);
1231
+ assert.deepEqual(state.trackMismatch, { buildChannel: "latest" });
1232
+
1233
+ // A later failure has its own reason, so the mismatch must not stay attached to it.
1234
+ const failed = yield* nextPublishedState(() =>
1235
+ harness.emit("error", new Error("background updater failure")),
1236
+ );
1237
+ assert.isUndefined(failed.trackMismatch);
1238
+
1239
+ const mismatched = yield* nextPublishedState(() => harness.emit("update-not-available"));
1240
+ assert.isDefined(mismatched.trackMismatch);
1241
+ yield* updates.check("menu");
1242
+ assert.equal((yield* updates.getState).status, "checking");
1243
+ assert.isUndefined((yield* updates.getState).trackMismatch);
1244
+ }),
1245
+ ).pipe(Effect.provide(Layer.merge(TestClock.layer(), harness.layer)));
1246
+ });
1247
+
1248
it.effect("never offers an older Nightly to a Nightly build's own checks", () => {
1249
const harness = makeHarness({ appVersion: "1.2.4-nightly.20261027.1" });
1250
@@ -1389,6 +1433,28 @@ describe("DesktopUpdates under a managed policy", () => {
1433
).pipe(Effect.provide(Layer.merge(TestClock.layer(), harness.layer)));
1434
});
1435
1436
+ it.effect("does not name a blocked build track as the one to switch back to", () => {
1437
+ const harness = makeHarness({
1438
+ appVersion: "1.2.4-nightly.20261027.1",
1439
+ savedChannel: "latest",
1440
+ policy: managed({ allowNightly: false, feedUrl: "https://updates.example.com/t3code" }),
1441
+ });
1442
+
1443
+ return Effect.scoped(
1444
+ Effect.gen(function* () {
1445
+ const updates = yield* DesktopUpdates.DesktopUpdates;
1446
+ yield* updates.configure;
1447
+ yield* updates.check("startup");
1448
+ const state = yield* nextPublishedState(() => harness.emit("update-not-available"));
1449
+
1450
+ assert.equal(state.channel, "latest");
1451
+ assert.equal(state.status, "error");
1452
+ assert.equal(state.errorContext, "check");
1453
+ assert.isUndefined(state.trackMismatch);
1454
+ }),
1455
+ ).pipe(Effect.provide(Layer.merge(TestClock.layer(), harness.layer)));
1456
+ });
1457
+
1458
it.effect("does not report the channel as the only block when updates are off anyway", () => {
1459
const harness = makeHarness({
1460
appVersion: "1.2.3-nightly.20261028.1",
apps/desktop/src/updates/DesktopUpdates.ts
+30
-3
@@ -368,6 +368,13 @@ function getAutoUpdateDisabledReason(args: {
368
return null;
369
}
370
371
+const trackLabel = (channel: DesktopUpdateChannel) =>
372
+ channel === "nightly" ? "Nightly" : "Stable";
373
+
374
+// Clients localize `trackMismatch`; this English text serves older renderers and remote reports.
375
+const trackMismatchMessage = (build: DesktopUpdateChannel, saved: DesktopUpdateChannel) =>
376
+ `This ${trackLabel(build)} build can't update from the ${trackLabel(saved)} track on its own. Switch the update track back to ${trackLabel(build)}, or use Review beside Update track to retry the switch to ${trackLabel(saved)}.`;
377
+
378
function isArm64HostRunningIntelBuild(runtimeInfo: DesktopRuntimeInfo): boolean {
379
return runtimeInfo.hostArch === "arm64" && runtimeInfo.appArch === "x64";
380
}
@@ -496,6 +503,26 @@ export const make = Effect.gen(function* () {
503
)
504
: Option.none();
505
506
+ // Without a release floor, a build on another track than its saved one never offers anything.
507
+ // A track the policy blocks is never named as the one to switch to.
508
+ const noOfferState = (state: DesktopUpdateState, checkedAt: string) =>
509
+ Effect.map(Ref.get(releaseFloorRef), (floor) => {
510
+ const buildChannel = desktopUpdateChannelOf(environment.appVersion);
511
+ if (Option.isSome(floor) || buildChannel === state.channel) {
512
+ return reduceDesktopUpdateStateOnNoUpdate(state, checkedAt);
513
+ }
514
+ const blocked = channelBlockedReason(buildChannel);
515
+ if (Option.isSome(blocked)) {
516
+ return reduceDesktopUpdateStateOnCheckFailure(state, blocked.value, checkedAt);
517
+ }
518
+ return reduceDesktopUpdateStateOnCheckFailure(
519
+ state,
520
+ trackMismatchMessage(buildChannel, state.channel),
521
+ checkedAt,
522
+ { buildChannel },
523
+ );
524
+ });
525
+
526
const resolveStateDisabledReason = (channel: DesktopUpdateChannel) =>
527
resolveDisabledReason.pipe(Effect.map(Option.orElse(() => channelBlockedReason(channel))));
528
@@ -1070,7 +1097,7 @@ export const make = Effect.gen(function* () {
1097
channel: state.channel,
1098
});
1099
const checkedAt = yield* currentIsoTimestamp;
1073
- yield* setState(reduceDesktopUpdateStateOnNoUpdate(state, checkedAt));
1100
+ yield* setState(yield* noOfferState(state, checkedAt));
1101
yield* Ref.set(lastLoggedDownloadMilestoneRef, -1);
1102
return;
1103
}
@@ -1117,7 +1144,7 @@ export const make = Effect.gen(function* () {
1144
const handleUpdateNotAvailable = Effect.gen(function* () {
1145
const checkedAt = yield* currentIsoTimestamp;
1146
const state = yield* Ref.get(updateStateRef);
1120
- yield* setState(reduceDesktopUpdateStateOnNoUpdate(state, checkedAt));
1147
+ yield* setState(yield* noOfferState(state, checkedAt));
1148
yield* Ref.set(lastLoggedDownloadMilestoneRef, -1);
1149
yield* logUpdaterInfo("no updates available");
1150
}).pipe(Effect.withSpan("desktop.updates.handleUpdateNotAvailable"));
@@ -1145,7 +1172,7 @@ export const make = Effect.gen(function* () {
1172
1173
if (Option.isNone(activeAction)) {
1174
const checkedAt = yield* currentIsoTimestamp;
1148
- yield* updateState((current) => ({
1175
+ yield* updateState(({ trackMismatch: _trackMismatch, ...current }) => ({
1176
...current,
1177
status: "error",
1178
message: error.message,
apps/desktop/src/updates/updateMachine.ts
+21
-11
@@ -11,6 +11,14 @@ function nextStatusAfterDownloadFailure(
11
return currentState.availableVersion ? "available" : "error";
12
}
13
14
+// A mismatch describes only the check that found it.
15
+function withoutTrackMismatch({
16
+ trackMismatch: _trackMismatch,
17
+ ...state
18
+}: DesktopUpdateState): DesktopUpdateState {
19
+ return state;
20
+}
21
+
22
function getCanRetryAfterDownloadFailure(currentState: DesktopUpdateState): boolean {
23
return currentState.availableVersion !== null;
24
}
@@ -46,7 +54,7 @@ export function reduceDesktopUpdateStateOnCheckStart(
54
): DesktopUpdateState {
55
const hasDownloadedUpdate = state.downloadedVersion !== null;
56
return {
49
- ...state,
57
+ ...withoutTrackMismatch(state),
58
status: "checking",
59
checkedAt,
60
releaseNotes: hasDownloadedUpdate ? state.releaseNotes : [],
@@ -62,10 +70,11 @@ export function reduceDesktopUpdateStateOnCheckFailure(
70
state: DesktopUpdateState,
71
message: string,
72
checkedAt: string,
73
+ trackMismatch?: DesktopUpdateState["trackMismatch"],
74
): DesktopUpdateState {
75
if (state.downloadedVersion !== null) {
76
return {
68
- ...state,
77
+ ...withoutTrackMismatch(state),
78
status: "downloaded",
79
message: null,
80
checkedAt,
@@ -76,13 +85,14 @@ export function reduceDesktopUpdateStateOnCheckFailure(
85
}
86
87
return {
79
- ...state,
88
+ ...withoutTrackMismatch(state),
89
status: "error",
90
message,
91
checkedAt,
92
downloadPercent: null,
93
errorContext: "check",
94
canRetry: true,
95
+ ...(trackMismatch === undefined ? {} : { trackMismatch }),
96
};
97
}
98
@@ -96,7 +106,7 @@ export function reduceDesktopUpdateStateOnUpdateAvailable(
106
const isDownloadedVersion = state.downloadedVersion === version;
107
const preserveReleaseNotes = isDownloadedVersion && releaseNotes.length === 0;
108
return {
99
- ...state,
109
+ ...withoutTrackMismatch(state),
110
status: isDownloadedVersion ? "downloaded" : "available",
111
availableVersion: version,
112
downloadedVersion: isDownloadedVersion ? version : null,
@@ -116,7 +126,7 @@ export function reduceDesktopUpdateStateOnNoUpdate(
126
): DesktopUpdateState {
127
if (state.downloadedVersion !== null) {
128
return {
119
- ...state,
129
+ ...withoutTrackMismatch(state),
130
status: "downloaded",
131
availableVersion: state.downloadedVersion,
132
downloadPercent: 100,
@@ -128,7 +138,7 @@ export function reduceDesktopUpdateStateOnNoUpdate(
138
}
139
140
return {
131
- ...state,
141
+ ...withoutTrackMismatch(state),
142
status: "up-to-date",
143
availableVersion: null,
144
downloadedVersion: null,
@@ -146,7 +156,7 @@ export function reduceDesktopUpdateStateOnDownloadStart(
156
state: DesktopUpdateState,
157
): DesktopUpdateState {
158
return {
149
- ...state,
159
+ ...withoutTrackMismatch(state),
160
status: "downloading",
161
downloadPercent: 0,
162
message: null,
@@ -160,7 +170,7 @@ export function reduceDesktopUpdateStateOnDownloadFailure(
170
message: string,
171
): DesktopUpdateState {
172
return {
163
- ...state,
173
+ ...withoutTrackMismatch(state),
174
status: nextStatusAfterDownloadFailure(state),
175
message,
176
downloadPercent: null,
@@ -174,7 +184,7 @@ export function reduceDesktopUpdateStateOnDownloadProgress(
184
percent: number,
185
): DesktopUpdateState {
186
return {
177
- ...state,
187
+ ...withoutTrackMismatch(state),
188
status: "downloading",
189
downloadPercent: percent,
190
message: null,
@@ -188,7 +198,7 @@ export function reduceDesktopUpdateStateOnDownloadComplete(
198
version: string,
199
): DesktopUpdateState {
200
return {
191
- ...state,
201
+ ...withoutTrackMismatch(state),
202
status: "downloaded",
203
availableVersion: version,
204
downloadedVersion: version,
@@ -204,7 +214,7 @@ export function reduceDesktopUpdateStateOnInstallFailure(
214
message: string,
215
): DesktopUpdateState {
216
return {
207
- ...state,
217
+ ...withoutTrackMismatch(state),
218
status: "downloaded",
219
message,
220
errorContext: "install",
apps/desktop/src/window/DesktopApplicationMenu.ts
+18
-1
@@ -4,6 +4,7 @@ import * as Layer from "effect/Layer";
4
import * as Option from "effect/Option";
5
import * as Schema from "effect/Schema";
6
7
+import type { DesktopUpdateChannel } from "@t3tools/contracts";
8
import * as Electron from "electron";
9
import { msg } from "gt-i18n";
10
@@ -68,6 +69,11 @@ const runMainContentsCommand = Effect.fn("desktop.menu.runMainContentsCommand")(
69
yield* desktopWindow.runMainContentsCommand(command);
70
});
71
72
+const trackLabel = (channel: DesktopUpdateChannel) =>
73
+ channel === "nightly"
74
+ ? m(msg("Nightly", { $context: "release track" }))
75
+ : m(msg("Stable", { $context: "release track" }));
76
+
77
const checkForUpdatesFromMenu = Effect.gen(function* () {
78
const updates = yield* DesktopUpdates.DesktopUpdates;
79
const electronDialog = yield* ElectronDialog.ElectronDialog;
@@ -134,7 +140,18 @@ const checkForUpdatesFromMenu = Effect.gen(function* () {
140
type: "warning",
141
title: m(msg("Update check failed")),
142
message: m(msg("Could not check for updates.")),
137
- detail: updateState.message ?? m(msg("An unknown error occurred. Please try again later.")),
143
+ detail:
144
+ updateState.trackMismatch !== undefined
145
+ ? m(
146
+ msg(
147
+ "This {build} build can't update from the {saved} track on its own. Switch the update track back to {build}, or use Review beside Update track to retry the switch to {saved}.",
148
+ ),
149
+ {
150
+ build: trackLabel(updateState.trackMismatch.buildChannel),
151
+ saved: trackLabel(updateState.channel),
152
+ },
153
+ )
154
+ : (updateState.message ?? m(msg("An unknown error occurred. Please try again later."))),
155
buttons: [m(msg("OK"))],
156
});
157
}
apps/mobile/src/i18n/translations/de.json
+2
@@ -732,6 +732,8 @@
732
"b50da99bbfd59a6d": "Das Update auf t3@{version} wurde zurückgerollt.",
733
"31dc4da5813e0846": "Das Update auf t3@{version} ist fehlgeschlagen.",
734
"b060872e18e91755": "Server-Update fehlgeschlagen.",
735
+ "77231250643f4943": "Dieser {build, select, nightly {Nightly} other {Stable}}-Build kann sich über den Kanal {saved, select, nightly {Nightly} other {Stable}} nicht selbst aktualisieren. Stelle den Update-Kanal wieder auf {build, select, nightly {Nightly} other {Stable}} um oder nutze Review neben Update-Kanal, um den Wechsel zu {saved, select, nightly {Nightly} other {Stable}} erneut zu versuchen.",
736
+ "43ed503038717b90": "Server-Update fehlgeschlagen:",
737
"a8cb0a2b46270859": "Die Umgebungsdaten konnten nicht synchronisiert werden.",
738
"4731d4616735186c": "{count, plural, one {{count} Subagent gestartet} other {{count} Subagenten gestartet}}",
739
"885110d4e416d2cd": "{count, plural, one {{count} Subagent ausgeführt} other {{count} Subagenten ausgeführt}}",
apps/mobile/src/i18n/translations/en.json
+2
@@ -732,6 +732,8 @@
732
"b50da99bbfd59a6d": "The t3@{version} update rolled-back.",
733
"31dc4da5813e0846": "The t3@{version} update failed.",
734
"b060872e18e91755": "Server update failed.",
735
+ "77231250643f4943": "This {build, select, nightly {Nightly} other {Stable}} build can't update from the {saved, select, nightly {Nightly} other {Stable}} track on its own. Switch the update track back to {build, select, nightly {Nightly} other {Stable}}, or use Review beside Update track to retry the switch to {saved, select, nightly {Nightly} other {Stable}}.",
736
+ "43ed503038717b90": "Server update failed:",
737
"a8cb0a2b46270859": "Could not synchronize environment data.",
738
"4731d4616735186c": "{count, plural, one {Kicked off {count} subagent} other {Kicked off {count} subagents}}",
739
"885110d4e416d2cd": "{count, plural, one {Ran {count} subagent} other {Ran {count} subagents}}",
apps/mobile/src/i18n/translations/es.json
+2
@@ -732,6 +732,8 @@
732
"b50da99bbfd59a6d": "La actualización a t3@{version} se revirtió.",
733
"31dc4da5813e0846": "La actualización a t3@{version} falló.",
734
"b060872e18e91755": "Falló la actualización del servidor.",
735
+ "77231250643f4943": "Esta compilación {build, select, nightly {Nightly} other {Estable}} no puede actualizarse por sí sola desde el canal {saved, select, nightly {Nightly} other {Estable}}. Vuelve a poner el canal de actualizaciones en {build, select, nightly {Nightly} other {Estable}} o usa Revisar junto a Canal de actualizaciones para reintentar el cambio a {saved, select, nightly {Nightly} other {Estable}}.",
736
+ "43ed503038717b90": "Falló la actualización del servidor:",
737
"a8cb0a2b46270859": "No se pudieron sincronizar los datos del entorno.",
738
"4731d4616735186c": "{count, plural, one {Se inició {count} subagente} other {Se iniciaron {count} subagentes}}",
739
"885110d4e416d2cd": "{count, plural, one {Se ejecutó {count} subagente} other {Se ejecutaron {count} subagentes}}",
apps/mobile/src/i18n/translations/fr.json
+2
@@ -732,6 +732,8 @@
732
"b50da99bbfd59a6d": "La mise à jour t3@{version} a été annulée.",
733
"31dc4da5813e0846": "La mise à jour t3@{version} a échoué.",
734
"b060872e18e91755": "Échec de la mise à jour du serveur.",
735
+ "77231250643f4943": "Cette version {build, select, nightly {Nightly} other {Stable}} ne peut pas se mettre à jour seule depuis le canal {saved, select, nightly {Nightly} other {Stable}}. Remettez le canal de mise à jour sur {build, select, nightly {Nightly} other {Stable}}, ou utilisez Consulter à côté de Canal de mise à jour pour relancer le passage à {saved, select, nightly {Nightly} other {Stable}}.",
736
+ "43ed503038717b90": "Échec de la mise à jour du serveur :",
737
"a8cb0a2b46270859": "Impossible de synchroniser les données de l’environnement.",
738
"4731d4616735186c": "{count, plural, one {{count} sous-agent lancé} other {{count} sous-agents lancés}}",
739
"885110d4e416d2cd": "{count, plural, one {{count} sous-agent exécuté} other {{count} sous-agents exécutés}}",
apps/mobile/src/i18n/translations/ja.json
+2
@@ -732,6 +732,8 @@
732
"b50da99bbfd59a6d": "t3@{version} の更新はロールバックされました。",
733
"31dc4da5813e0846": "t3@{version} の更新に失敗しました。",
734
"b060872e18e91755": "サーバーの更新に失敗しました。",
735
+ "77231250643f4943": "この {build, select, nightly {Nightly} other {安定版}} ビルドは {saved, select, nightly {Nightly} other {安定版}} トラックから単独では更新できません。更新トラックを {build, select, nightly {Nightly} other {安定版}} に戻すか、更新トラックの横にある「レビュー」を使って {saved, select, nightly {Nightly} other {安定版}} への切り替えを再試行してください。",
736
+ "43ed503038717b90": "サーバーの更新に失敗しました:",
737
"a8cb0a2b46270859": "環境のデータを同期できませんでした。",
738
"4731d4616735186c": "{count, plural, other {{count} 個のサブエージェントを開始しました}}",
739
"885110d4e416d2cd": "{count, plural, other {{count} 個のサブエージェントを実行しました}}",
apps/mobile/src/i18n/translations/ko.json
+2
@@ -732,6 +732,8 @@
732
"b50da99bbfd59a6d": "t3@{version} 업데이트가 롤백되었습니다.",
733
"31dc4da5813e0846": "t3@{version} 업데이트에 실패했습니다.",
734
"b060872e18e91755": "서버 업데이트에 실패했습니다.",
735
+ "77231250643f4943": "이 {build, select, nightly {Nightly} other {Stable}} 빌드는 {saved, select, nightly {Nightly} other {Stable}} 트랙에서 스스로 업데이트할 수 없습니다. 업데이트 트랙을 다시 {build, select, nightly {Nightly} other {Stable}}(으)로 바꾸거나, 업데이트 트랙 옆의 검토를 사용해 {saved, select, nightly {Nightly} other {Stable}}(으)로 전환을 다시 시도하세요.",
736
+ "43ed503038717b90": "서버 업데이트에 실패했습니다:",
737
"a8cb0a2b46270859": "환경 데이터를 동기화할 수 없습니다.",
738
"4731d4616735186c": "{count, plural, other {서브에이전트 {count}개 시작함}}",
739
"885110d4e416d2cd": "{count, plural, other {서브에이전트 {count}개 실행함}}",
apps/mobile/src/i18n/translations/pt-BR.json
+2
@@ -732,6 +732,8 @@
732
"b50da99bbfd59a6d": "A atualização t3@{version} foi revertida.",
733
"31dc4da5813e0846": "A atualização t3@{version} falhou.",
734
"b060872e18e91755": "Falha ao atualizar o servidor.",
735
+ "77231250643f4943": "Esta build {build, select, nightly {Nightly} other {Estável}} não consegue se atualizar sozinha pelo canal {saved, select, nightly {Nightly} other {Estável}}. Volte o canal de atualização para {build, select, nightly {Nightly} other {Estável}} ou use Revisar ao lado de Canal de atualização para tentar de novo a mudança para {saved, select, nightly {Nightly} other {Estável}}.",
736
+ "43ed503038717b90": "Falha ao atualizar o servidor:",
737
"a8cb0a2b46270859": "Não foi possível sincronizar os dados do ambiente.",
738
"4731d4616735186c": "{count, plural, one {{count} subagente iniciado} other {{count} subagentes iniciados}}",
739
"885110d4e416d2cd": "{count, plural, one {{count} subagente executado} other {{count} subagentes executados}}",
apps/mobile/src/i18n/translations/ru.json
+2
@@ -732,6 +732,8 @@
732
"b50da99bbfd59a6d": "Обновление t3@{version} откачено.",
733
"31dc4da5813e0846": "Ошибка обновления t3@{version}.",
734
"b060872e18e91755": "Не удалось обновить сервер.",
735
+ "77231250643f4943": "Эта сборка {build, select, nightly {Nightly} other {Стабильный}} не может сама обновиться с канала «{saved, select, nightly {Nightly} other {Стабильный}}». Верните канал обновлений на «{build, select, nightly {Nightly} other {Стабильный}}» или нажмите «Ревью» рядом с «Канал обновлений», чтобы повторить переход на «{saved, select, nightly {Nightly} other {Стабильный}}».",
736
+ "43ed503038717b90": "Не удалось обновить сервер:",
737
"a8cb0a2b46270859": "Не удалось синхронизировать данные окружения.",
738
"4731d4616735186c": "{count, plural, one {Запущен {count} субагент} few {Запущено {count} субагента} many {Запущено {count} субагентов} other {Запущено {count} субагента}}",
739
"885110d4e416d2cd": "{count, plural, one {Отработал {count} субагент} few {Отработали {count} субагента} many {Отработали {count} субагентов} other {Отработали {count} субагента}}",
apps/mobile/src/i18n/translations/sv.json
+2
@@ -732,6 +732,8 @@
732
"b50da99bbfd59a6d": "Uppdateringen till t3@{version} återställdes.",
733
"31dc4da5813e0846": "Uppdateringen till t3@{version} misslyckades.",
734
"b060872e18e91755": "Serveruppdateringen misslyckades.",
735
+ "77231250643f4943": "Den här {build, select, nightly {Nightly} other {Stable}}-versionen kan inte uppdatera sig själv från spåret {saved, select, nightly {Nightly} other {Stable}}. Byt tillbaka uppdateringsspåret till {build, select, nightly {Nightly} other {Stable}}, eller använd Granska bredvid Uppdateringsspår för att försöka byta till {saved, select, nightly {Nightly} other {Stable}} igen.",
736
+ "43ed503038717b90": "Serveruppdateringen misslyckades:",
737
"a8cb0a2b46270859": "Kunde inte synkronisera miljöns data.",
738
"4731d4616735186c": "{count, plural, one {Startade {count} subagent} other {Startade {count} subagenter}}",
739
"885110d4e416d2cd": "{count, plural, one {Körde {count} subagent} other {Körde {count} subagenter}}",
apps/mobile/src/i18n/translations/zh.json
+2
@@ -732,6 +732,8 @@
732
"b50da99bbfd59a6d": "t3@{version} 更新已回滚。",
733
"31dc4da5813e0846": "t3@{version} 更新失败。",
734
"b060872e18e91755": "服务器更新失败。",
735
+ "77231250643f4943": "此 {build, select, nightly {Nightly 版} other {稳定版}} 构建无法自行从 {saved, select, nightly {Nightly 版} other {稳定版}} 通道更新。请将更新通道切回 {build, select, nightly {Nightly 版} other {稳定版}},或使用“更新通道”旁的“查看”重新尝试切换到 {saved, select, nightly {Nightly 版} other {稳定版}}。",
736
+ "43ed503038717b90": "服务器更新失败:",
737
"a8cb0a2b46270859": "无法同步环境数据。",
738
"4731d4616735186c": "{count, plural, other {已启动 {count} 个子智能体}}",
739
"885110d4e416d2cd": "{count, plural, other {已运行 {count} 个子智能体}}",
apps/server/src/desktopUpdate/DesktopAppUpdate.test.ts
+29
@@ -204,6 +204,35 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("desktop app upda
204
}),
205
);
206
207
+ it.effect.each([true, false])(
208
+ "carries the track mismatch only for its own failure (%s)",
209
+ (matchingReason) =>
210
+ Effect.gen(function* () {
211
+ const mismatch = "This Stable build can't update from the Nightly track on its own.";
212
+ const reason = matchingReason ? mismatch : "The desktop update was cancelled.";
213
+ const { service } = yield* makeHarness({
214
+ reports: (requestId) => [
215
+ report(
216
+ requestId,
217
+ makeState({
218
+ status: "error",
219
+ channel: "nightly",
220
+ message: mismatch,
221
+ errorContext: "check",
222
+ trackMismatch: { buildChannel: "latest" },
223
+ }),
224
+ { outcome: "failed", reason },
225
+ ),
226
+ ],
227
+ });
228
+ const error = yield* service.run(() => Effect.void).pipe(Effect.flip);
229
+ expect(error.reason).toBe(reason);
230
+ expect(error.trackMismatch).toEqual(
231
+ matchingReason ? { buildChannel: "latest", savedChannel: "nightly" } : undefined,
232
+ );
233
+ }),
234
+ );
235
+
236
it.effect("fails when the desktop stops reporting before a terminal outcome", () =>
237
Effect.gen(function* () {
238
const { service } = yield* makeHarness({
apps/server/src/desktopUpdate/DesktopAppUpdate.ts
+12
-3
@@ -137,9 +137,18 @@ export const make = Effect.fn("desktopUpdate.desktopAppUpdate.make")(function* (
137
`The T3 Code desktop app on this machine is already up to date on ${report.state.currentVersion}.`,
138
);
139
}
140
- return yield* failWith(
141
- report.reason ?? report.state.message ?? "The desktop app update failed.",
142
- );
140
+ const reason = report.reason ?? report.state.message ?? "The desktop app update failed.";
141
+ const mismatch = report.state.trackMismatch;
142
+ if (mismatch !== undefined && reason === report.state.message) {
143
+ return yield* new ServerSelfUpdateError({
144
+ reason,
145
+ trackMismatch: {
146
+ buildChannel: mismatch.buildChannel,
147
+ savedChannel: report.state.channel,
148
+ },
149
+ });
150
+ }
151
+ return yield* failWith(reason);
152
});
153
154
const run: DesktopAppUpdate["Service"]["run"] = Effect.fn("desktopUpdate.desktopAppUpdate.run")(
apps/web/src/components/desktopUpdate.logic.ts
+9
@@ -1,3 +1,4 @@
1
+import { desktopTrackMismatchText } from "@t3tools/client-runtime/state/server";
2
import type { DesktopUpdateActionResult, DesktopUpdateState } from "@t3tools/contracts";
3
import { desktopUpdateChannelOf } from "@t3tools/shared/cliRelease";
4
import { msg } from "gt-react";
@@ -159,6 +160,14 @@ export function getDesktopUpdateButtonTooltip(
160
}),
161
);
162
}
163
+ if (state.trackMismatch !== undefined) {
164
+ return resolve(
165
+ desktopTrackMismatchText({
166
+ buildChannel: state.trackMismatch.buildChannel,
167
+ savedChannel: state.channel,
168
+ }),
169
+ );
170
+ }
171
return state.message ?? resolve(msg("Update failed"));
172
}
173
// The updater discards every release of the other track, so "up to date" would be false here.
apps/web/src/i18n/translations/de.json
+2
@@ -733,6 +733,8 @@
733
"b50da99bbfd59a6d": "Das Update auf t3@{version} wurde zurückgerollt.",
734
"31dc4da5813e0846": "Das Update auf t3@{version} ist fehlgeschlagen.",
735
"b060872e18e91755": "Server-Update fehlgeschlagen.",
736
+ "77231250643f4943": "Dieser {build, select, nightly {Nightly} other {Stable}}-Build kann sich über den Kanal {saved, select, nightly {Nightly} other {Stable}} nicht selbst aktualisieren. Stelle den Update-Kanal wieder auf {build, select, nightly {Nightly} other {Stable}} um oder nutze Review neben Update-Kanal, um den Wechsel zu {saved, select, nightly {Nightly} other {Stable}} erneut zu versuchen.",
737
+ "43ed503038717b90": "Server-Update fehlgeschlagen:",
738
"a8cb0a2b46270859": "Die Umgebungsdaten konnten nicht synchronisiert werden.",
739
"4731d4616735186c": "{count, plural, one {{count} Subagent gestartet} other {{count} Subagenten gestartet}}",
740
"885110d4e416d2cd": "{count, plural, one {{count} Subagent ausgeführt} other {{count} Subagenten ausgeführt}}",
apps/web/src/i18n/translations/en.json
+2
@@ -733,6 +733,8 @@
733
"b50da99bbfd59a6d": "The t3@{version} update rolled-back.",
734
"31dc4da5813e0846": "The t3@{version} update failed.",
735
"b060872e18e91755": "Server update failed.",
736
+ "77231250643f4943": "This {build, select, nightly {Nightly} other {Stable}} build can't update from the {saved, select, nightly {Nightly} other {Stable}} track on its own. Switch the update track back to {build, select, nightly {Nightly} other {Stable}}, or use Review beside Update track to retry the switch to {saved, select, nightly {Nightly} other {Stable}}.",
737
+ "43ed503038717b90": "Server update failed:",
738
"a8cb0a2b46270859": "Could not synchronize environment data.",
739
"4731d4616735186c": "{count, plural, one {Kicked off {count} subagent} other {Kicked off {count} subagents}}",
740
"885110d4e416d2cd": "{count, plural, one {Ran {count} subagent} other {Ran {count} subagents}}",
apps/web/src/i18n/translations/es.json
+2
@@ -733,6 +733,8 @@
733
"b50da99bbfd59a6d": "La actualización a t3@{version} se revirtió.",
734
"31dc4da5813e0846": "La actualización a t3@{version} falló.",
735
"b060872e18e91755": "Falló la actualización del servidor.",
736
+ "77231250643f4943": "Esta compilación {build, select, nightly {Nightly} other {Estable}} no puede actualizarse por sí sola desde el canal {saved, select, nightly {Nightly} other {Estable}}. Vuelve a poner el canal de actualizaciones en {build, select, nightly {Nightly} other {Estable}} o usa Revisar junto a Canal de actualizaciones para reintentar el cambio a {saved, select, nightly {Nightly} other {Estable}}.",
737
+ "43ed503038717b90": "Falló la actualización del servidor:",
738
"a8cb0a2b46270859": "No se pudieron sincronizar los datos del entorno.",
739
"4731d4616735186c": "{count, plural, one {Se inició {count} subagente} other {Se iniciaron {count} subagentes}}",
740
"885110d4e416d2cd": "{count, plural, one {Se ejecutó {count} subagente} other {Se ejecutaron {count} subagentes}}",
apps/web/src/i18n/translations/fr.json
+2
@@ -733,6 +733,8 @@
733
"b50da99bbfd59a6d": "La mise à jour t3@{version} a été annulée.",
734
"31dc4da5813e0846": "La mise à jour t3@{version} a échoué.",
735
"b060872e18e91755": "Échec de la mise à jour du serveur.",
736
+ "77231250643f4943": "Cette version {build, select, nightly {Nightly} other {Stable}} ne peut pas se mettre à jour seule depuis le canal {saved, select, nightly {Nightly} other {Stable}}. Remettez le canal de mise à jour sur {build, select, nightly {Nightly} other {Stable}}, ou utilisez Consulter à côté de Canal de mise à jour pour relancer le passage à {saved, select, nightly {Nightly} other {Stable}}.",
737
+ "43ed503038717b90": "Échec de la mise à jour du serveur :",
738
"a8cb0a2b46270859": "Impossible de synchroniser les données de l’environnement.",
739
"4731d4616735186c": "{count, plural, one {{count} sous-agent lancé} other {{count} sous-agents lancés}}",
740
"885110d4e416d2cd": "{count, plural, one {{count} sous-agent exécuté} other {{count} sous-agents exécutés}}",
apps/web/src/i18n/translations/ja.json
+2
@@ -733,6 +733,8 @@
733
"b50da99bbfd59a6d": "t3@{version} の更新はロールバックされました。",
734
"31dc4da5813e0846": "t3@{version} の更新に失敗しました。",
735
"b060872e18e91755": "サーバーの更新に失敗しました。",
736
+ "77231250643f4943": "この {build, select, nightly {Nightly} other {安定版}} ビルドは {saved, select, nightly {Nightly} other {安定版}} トラックから単独では更新できません。更新トラックを {build, select, nightly {Nightly} other {安定版}} に戻すか、更新トラックの横にある「レビュー」を使って {saved, select, nightly {Nightly} other {安定版}} への切り替えを再試行してください。",
737
+ "43ed503038717b90": "サーバーの更新に失敗しました:",
738
"a8cb0a2b46270859": "環境のデータを同期できませんでした。",
739
"4731d4616735186c": "{count, plural, other {{count} 個のサブエージェントを開始しました}}",
740
"885110d4e416d2cd": "{count, plural, other {{count} 個のサブエージェントを実行しました}}",
apps/web/src/i18n/translations/ko.json
+2
@@ -733,6 +733,8 @@
733
"b50da99bbfd59a6d": "t3@{version} 업데이트가 롤백되었습니다.",
734
"31dc4da5813e0846": "t3@{version} 업데이트에 실패했습니다.",
735
"b060872e18e91755": "서버 업데이트에 실패했습니다.",
736
+ "77231250643f4943": "이 {build, select, nightly {Nightly} other {Stable}} 빌드는 {saved, select, nightly {Nightly} other {Stable}} 트랙에서 스스로 업데이트할 수 없습니다. 업데이트 트랙을 다시 {build, select, nightly {Nightly} other {Stable}}(으)로 바꾸거나, 업데이트 트랙 옆의 검토를 사용해 {saved, select, nightly {Nightly} other {Stable}}(으)로 전환을 다시 시도하세요.",
737
+ "43ed503038717b90": "서버 업데이트에 실패했습니다:",
738
"a8cb0a2b46270859": "환경 데이터를 동기화할 수 없습니다.",
739
"4731d4616735186c": "{count, plural, other {서브에이전트 {count}개 시작함}}",
740
"885110d4e416d2cd": "{count, plural, other {서브에이전트 {count}개 실행함}}",
apps/web/src/i18n/translations/pt-BR.json
+2
@@ -733,6 +733,8 @@
733
"b50da99bbfd59a6d": "A atualização t3@{version} foi revertida.",
734
"31dc4da5813e0846": "A atualização t3@{version} falhou.",
735
"b060872e18e91755": "Falha ao atualizar o servidor.",
736
+ "77231250643f4943": "Esta build {build, select, nightly {Nightly} other {Estável}} não consegue se atualizar sozinha pelo canal {saved, select, nightly {Nightly} other {Estável}}. Volte o canal de atualização para {build, select, nightly {Nightly} other {Estável}} ou use Revisar ao lado de Canal de atualização para tentar de novo a mudança para {saved, select, nightly {Nightly} other {Estável}}.",
737
+ "43ed503038717b90": "Falha ao atualizar o servidor:",
738
"a8cb0a2b46270859": "Não foi possível sincronizar os dados do ambiente.",
739
"4731d4616735186c": "{count, plural, one {{count} subagente iniciado} other {{count} subagentes iniciados}}",
740
"885110d4e416d2cd": "{count, plural, one {{count} subagente executado} other {{count} subagentes executados}}",
apps/web/src/i18n/translations/ru.json
+2
@@ -733,6 +733,8 @@
733
"b50da99bbfd59a6d": "Обновление t3@{version} откачено.",
734
"31dc4da5813e0846": "Ошибка обновления t3@{version}.",
735
"b060872e18e91755": "Не удалось обновить сервер.",
736
+ "77231250643f4943": "Эта сборка {build, select, nightly {Nightly} other {Стабильный}} не может сама обновиться с канала «{saved, select, nightly {Nightly} other {Стабильный}}». Верните канал обновлений на «{build, select, nightly {Nightly} other {Стабильный}}» или нажмите «Ревью» рядом с «Канал обновлений», чтобы повторить переход на «{saved, select, nightly {Nightly} other {Стабильный}}».",
737
+ "43ed503038717b90": "Не удалось обновить сервер:",
738
"a8cb0a2b46270859": "Не удалось синхронизировать данные окружения.",
739
"4731d4616735186c": "{count, plural, one {Запущен {count} субагент} few {Запущено {count} субагента} many {Запущено {count} субагентов} other {Запущено {count} субагента}}",
740
"885110d4e416d2cd": "{count, plural, one {Отработал {count} субагент} few {Отработали {count} субагента} many {Отработали {count} субагентов} other {Отработали {count} субагента}}",
apps/web/src/i18n/translations/sv.json
+2
@@ -733,6 +733,8 @@
733
"b50da99bbfd59a6d": "Uppdateringen till t3@{version} återställdes.",
734
"31dc4da5813e0846": "Uppdateringen till t3@{version} misslyckades.",
735
"b060872e18e91755": "Serveruppdateringen misslyckades.",
736
+ "77231250643f4943": "Den här {build, select, nightly {Nightly} other {Stable}}-versionen kan inte uppdatera sig själv från spåret {saved, select, nightly {Nightly} other {Stable}}. Byt tillbaka uppdateringsspåret till {build, select, nightly {Nightly} other {Stable}}, eller använd Granska bredvid Uppdateringsspår för att försöka byta till {saved, select, nightly {Nightly} other {Stable}} igen.",
737
+ "43ed503038717b90": "Serveruppdateringen misslyckades:",
738
"a8cb0a2b46270859": "Kunde inte synkronisera miljöns data.",
739
"4731d4616735186c": "{count, plural, one {Startade {count} subagent} other {Startade {count} subagenter}}",
740
"885110d4e416d2cd": "{count, plural, one {Körde {count} subagent} other {Körde {count} subagenter}}",
apps/web/src/i18n/translations/zh.json
+2
@@ -733,6 +733,8 @@
733
"b50da99bbfd59a6d": "t3@{version} 更新已回滚。",
734
"31dc4da5813e0846": "t3@{version} 更新失败。",
735
"b060872e18e91755": "服务器更新失败。",
736
+ "77231250643f4943": "此 {build, select, nightly {Nightly 版} other {稳定版}} 构建无法自行从 {saved, select, nightly {Nightly 版} other {稳定版}} 通道更新。请将更新通道切回 {build, select, nightly {Nightly 版} other {稳定版}},或使用“更新通道”旁的“查看”重新尝试切换到 {saved, select, nightly {Nightly 版} other {稳定版}}。",
737
+ "43ed503038717b90": "服务器更新失败:",
738
"a8cb0a2b46270859": "无法同步环境数据。",
739
"4731d4616735186c": "{count, plural, other {已启动 {count} 个子智能体}}",
740
"885110d4e416d2cd": "{count, plural, other {已运行 {count} 个子智能体}}",
packages/client-runtime/src/connection/outdatedHostUpdate.ts
+6
-2
@@ -24,7 +24,11 @@ import * as Socket from "effect/socket/Socket";
24
25
import { fetchRemoteEnvironmentDescriptor } from "../environment/descriptor.ts";
26
import { makeWsRpcProtocolClient, PING_TIMEOUT } from "../rpc/protocol.ts";
27
-import { isLegacyUpdateHandoffLoss, resolveServerUpdateProgressResult } from "../state/server.ts";
27
+import {
28
+ isLegacyUpdateHandoffLoss,
29
+ localizeServerSelfUpdateError,
30
+ resolveServerUpdateProgressResult,
31
+} from "../state/server.ts";
32
import * as RelayEnvironmentDiscovery from "../relay/discovery.ts";
33
import * as ConnectionResolver from "./resolver.ts";
34
import * as EnvironmentRegistry from "./registry.ts";
@@ -206,7 +210,7 @@ export const updateOutdatedHost = Effect.fn("clientRuntime.connection.updateOutd
210
}
211
return updateResult;
212
}),
209
- );
213
+ ).pipe(Effect.mapError(localizeServerSelfUpdateError));
214
215
yield* onStage("resuming");
216
const pollUrls = [
packages/client-runtime/src/state/server.test.ts
+36
-9
@@ -66,12 +66,14 @@ import {
66
resolveServerUpdateProgressResult,
67
serverUpdateStateForProgressEvent,
68
serverUpdateStateAtom,
69
+ serverUpdateFailureText,
70
serverUpdateStateForServerVersion,
71
validateServerUpdateReadyEvent,
72
waitForNextEnvironmentReconnect,
73
waitForDesktopUpdateTarget,
74
runDesktopCommitWithReconnectObserver,
75
} from "./server.ts";
76
+import { errorDisplayMessage, errorI18nMessage } from "../errors/translatable.ts";
77
import { runAtomCommand } from "./runtime.ts";
78
import { applyServerConfigProjection } from "./serverConfigProjection.ts";
79
@@ -239,14 +241,21 @@ describe("accepted server update recovery", () => {
241
{ loss: "interrupt", resumes: true },
242
{ loss: "socket", resumes: true },
243
{ loss: "server_error", resumes: false },
244
+ { loss: "track_mismatch", method: "desktop-managed", resumes: false },
245
+ { loss: "track_mismatch", method: "desktop-managed", unary: true, resumes: false },
246
{ loss: "no_progress", resumes: false },
247
{ loss: "cancel", resumes: false },
248
{ loss: "socket", method: "respawn", resumes: true },
249
{ loss: "socket", method: "desktop-managed", resumes: false },
246
- ] as const)("handles $loss with $method and recovery=$resumes", (scenario) =>
250
+ ] as const)("handles $loss with $method, unary=$unary and recovery=$resumes", (scenario) =>
251
Effect.gen(function* () {
252
const { loss, resumes } = scenario;
253
const method = "method" in scenario ? scenario.method : "boot-service";
254
+ const trackMismatch = new ServerSelfUpdateError({
255
+ reason:
256
+ "This Stable build can't update from the Nightly track on its own. Switch the update track back to Stable, or use Review beside Update track to retry the switch to Nightly.",
257
+ trackMismatch: { buildChannel: "latest", savedChannel: "nightly" },
258
+ });
259
const observing = yield* Deferred.make<void>();
260
const cancelFiber = yield* Deferred.make<Fiber.Fiber<unknown, unknown>>();
261
const oldReadyObserved = yield* Deferred.make<void>();
@@ -257,7 +266,10 @@ describe("accepted server update recovery", () => {
266
environment: {
267
...CONFIG.environment,
268
serverVersion: "0.0.30",
260
- capabilities: { serverSelfUpdate: method, serverSelfUpdateProgress: true },
269
+ capabilities: {
270
+ serverSelfUpdate: method,
271
+ serverSelfUpdateProgress: !("unary" in scenario),
272
+ },
273
},
274
} as ServerConfig;
275
const ready = (serverVersion: string) =>
@@ -283,6 +295,7 @@ describe("accepted server update recovery", () => {
295
),
296
)
297
: Stream.make(ready("0.0.30")).pipe(Stream.concat(Stream.never)),
298
+ [WS_METHODS.serverUpdateServer]: () => Effect.fail(trackMismatch),
299
[WS_METHODS.serverUpdateServerWithProgress]: () =>
300
Stream.unwrap(
301
Effect.sync(() => {
@@ -306,9 +319,11 @@ describe("accepted server update recovery", () => {
319
? new ServerSelfUpdateError({
320
reason: "Archive verification failed.",
321
})
309
- : new RpcClientError.RpcClientError({
310
- reason: new Socket.SocketCloseError({ code: 1006 }),
311
- }),
322
+ : loss === "track_mismatch"
323
+ ? trackMismatch
324
+ : new RpcClientError.RpcClientError({
325
+ reason: new Socket.SocketCloseError({ code: 1006 }),
326
+ }),
327
),
328
),
329
),
@@ -377,10 +392,22 @@ describe("accepted server update recovery", () => {
392
);
393
if (!resumes) {
394
expect(first).toBe("settled");
380
- expect(AsyncResult.isFailure(yield* Effect.promise(() => pending))).toBe(true);
381
- expect(registry.get(serverUpdateStateAtom(TARGET.environmentId))).toMatchObject({
382
- status: "failed",
383
- });
395
+ const failure = yield* Effect.promise(() => pending);
396
+ expect(AsyncResult.isFailure(failure)).toBe(true);
397
+ const failed = registry.get(serverUpdateStateAtom(TARGET.environmentId));
398
+ expect(failed).toMatchObject({ status: "failed" });
399
+ if (
400
+ loss === "track_mismatch" &&
401
+ AsyncResult.isFailure(failure) &&
402
+ failed.status === "failed"
403
+ ) {
404
+ const cause = Cause.squash(failure.cause);
405
+ const marked = errorI18nMessage(cause);
406
+ expect(marked).toHaveLength(2);
407
+ expect(failed.i18nMessage).toEqual(marked);
408
+ expect(errorDisplayMessage(cause)).toBe(trackMismatch.message);
409
+ expect(serverUpdateFailureText(failed)).toBe(trackMismatch.message);
410
+ }
411
return;
412
}
413
expect(first).toBe("observing");
packages/client-runtime/src/state/server.ts
+27
-1
@@ -4,8 +4,10 @@ import {
4
markedTextEnglish,
5
resolveMarkedText,
6
thrownErrorMessage,
7
+ withI18nMessage,
8
} from "../errors/translatable.ts";
9
import {
10
+ type DesktopUpdateChannel,
11
type EnvironmentId,
12
type ProviderInstanceId,
13
type ServerConfig,
@@ -13,6 +15,7 @@ import {
15
type ServerLifecycleWelcomePayload,
16
type ServerLifecycleStreamReadyEvent,
17
type ServerProviderWorkspaceSnapshot,
18
+ ServerSelfUpdateError,
19
type ServerSelfUpdateProgressEvent,
20
type ServerSelfUpdateResult,
21
shouldRecommendDatabaseCompaction,
@@ -388,6 +391,29 @@ export function serverUpdateFailure(error: unknown): {
391
: { message: serverUpdateFailureMessage(error), i18nMessage };
392
}
393
394
+/** Marked text for a desktop app whose build track differs from its saved update track. */
395
+export function desktopTrackMismatchText(mismatch: {
396
+ readonly buildChannel: DesktopUpdateChannel;
397
+ readonly savedChannel: DesktopUpdateChannel;
398
+}): string {
399
+ return msg(
400
+ "This {build, select, nightly {Nightly} other {Stable}} build can't update from the {saved, select, nightly {Nightly} other {Stable}} track on its own. Switch the update track back to {build, select, nightly {Nightly} other {Stable}}, or use Review beside Update track to retry the switch to {saved, select, nightly {Nightly} other {Stable}}.",
401
+ { build: mismatch.buildChannel, saved: mismatch.savedChannel },
402
+ );
403
+}
404
+
405
+const isServerSelfUpdateError = Schema.is(ServerSelfUpdateError);
406
+
407
+/** Gives a host's track mismatch marked text; older hosts send only the English `reason`. */
408
+export function localizeServerSelfUpdateError<E>(error: E): E {
409
+ if (!isServerSelfUpdateError(error) || error.trackMismatch === undefined) return error;
410
+ return withI18nMessage(
411
+ error,
412
+ msg("Server update failed:"),
413
+ desktopTrackMismatchText(error.trackMismatch),
414
+ );
415
+}
416
+
417
export function serverUpdateFailureText(
418
state: Extract<ServerUpdateState, { status: "failed" }>,
419
resolve: MFunctionType = mFallback,
@@ -1218,7 +1244,7 @@ export function createServerEnvironmentAtoms<R, E>(
1244
targetVersion,
1245
});
1246
return updateResult;
1221
- }),
1247
+ }).pipe(Effect.mapError(localizeServerSelfUpdateError)),
1248
);
1249
1250
// A track switch's desktop host already on its track's newest build only saved the
packages/contracts/src/ipc.ts
+3
@@ -292,6 +292,8 @@ export interface DesktopUpdateState {
292
notAppliedVersion?: string;
293
/** Off only because a managed policy rules out this channel; switching channels turns it on. */
294
channelBlockedByPolicy?: true;
295
+ /** The check failed only because this build's track differs from the saved `channel`. */
296
+ trackMismatch?: { readonly buildChannel: DesktopUpdateChannel };
297
}
298
299
export interface DesktopUpdateReleaseNote {
@@ -336,6 +338,7 @@ export const DesktopUpdateStateSchema = Schema.Struct({
338
canRetry: Schema.Boolean,
339
notAppliedVersion: Schema.optionalKey(Schema.String),
340
channelBlockedByPolicy: Schema.optionalKey(Schema.Literal(true)),
341
+ trackMismatch: Schema.optionalKey(Schema.Struct({ buildChannel: DesktopUpdateChannelSchema })),
342
});
343
344
export const DesktopCliCommandStateSchema = Schema.Struct({
packages/contracts/src/server.ts
+7
@@ -1070,6 +1070,13 @@ export class ServerSelfUpdateError extends Schema.TaggedError<ServerSelfUpdateEr
1070
"ServerSelfUpdateError",
1071
{
1072
reason: TrimmedNonEmptyString,
1073
+ /** Set when the host's desktop app refused only because its build and saved tracks differ. */
1074
+ trackMismatch: Schema.optionalKey(
1075
+ Schema.Struct({
1076
+ buildChannel: DesktopUpdateChannelSchema,
1077
+ savedChannel: DesktopUpdateChannelSchema,
1078
+ }),
1079
+ ),
1080
cause: Schema.optional(Schema.Defect()),
1081
},
1082
) {