From 36282762bdcb9a5ecadad8e76723feee7e924c13 Mon Sep 17 00:00:00 2001 From: shivam <91240327+shivamhwp@users.noreply.github.com> Date: Wed, 18 Nov 2026 08:18:29 +0000 Subject: [PATCH 1/5] fix(desktop): update checks say why a build with a different saved track offers nothing A Stable build whose saved update track is Nightly discarded every release and reported Up to date. Such a build now ends its check in a retryable error that names both tracks, since crossing tracks still needs a guarded switch. Model and harness: Claude Opus 5.5 via T3 Code (Claude Code harness). Co-Authored-By: Claude Haiku 5.5 --- .../src/updates/DesktopUpdates.test.ts | 10 ++++++++-- apps/desktop/src/updates/DesktopUpdates.ts | 19 ++++++++++++++++++- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/apps/desktop/src/updates/DesktopUpdates.test.ts b/apps/desktop/src/updates/DesktopUpdates.test.ts index 33ed00a764738..7a604f2187646 100644 --- a/apps/desktop/src/updates/DesktopUpdates.test.ts +++ b/apps/desktop/src/updates/DesktopUpdates.test.ts @@ -1194,8 +1194,14 @@ describe("DesktopUpdates", () => { harness.emit("update-available", { version: "1.2.4-nightly.20261027.1" }); yield* flushCallbacks; - assert.equal((yield* updates.getState).channel, "nightly"); - assert.isNull((yield* updates.getState).availableVersion); + const state = yield* updates.getState; + assert.equal(state.channel, "nightly"); + assert.isNull(state.availableVersion); + assert.equal(state.status, "error"); + assert.equal(state.errorContext, "check"); + assert.isTrue(state.canRetry); + assert.include(state.message, "Stable build"); + assert.include(state.message, "Nightly track"); assert.deepEqual(harness.checkAllowedDowngrade, [false]); }), ).pipe(Effect.provide(Layer.merge(TestClock.layer(), harness.layer))); diff --git a/apps/desktop/src/updates/DesktopUpdates.ts b/apps/desktop/src/updates/DesktopUpdates.ts index 775a9ff6b04ff..f3a21066eacb9 100644 --- a/apps/desktop/src/updates/DesktopUpdates.ts +++ b/apps/desktop/src/updates/DesktopUpdates.ts @@ -368,6 +368,12 @@ function getAutoUpdateDisabledReason(args: { return null; } +const trackLabel = (channel: DesktopUpdateChannel) => + channel === "nightly" ? "Nightly" : "Stable"; + +const trackMismatchMessage = (build: DesktopUpdateChannel, saved: DesktopUpdateChannel) => + `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)}.`; + function isArm64HostRunningIntelBuild(runtimeInfo: DesktopRuntimeInfo): boolean { return runtimeInfo.hostArch === "arm64" && runtimeInfo.appArch === "x64"; } @@ -1070,7 +1076,18 @@ export const make = Effect.gen(function* () { channel: state.channel, }); const checkedAt = yield* currentIsoTimestamp; - yield* setState(reduceDesktopUpdateStateOnNoUpdate(state, checkedAt)); + const buildChannel = desktopUpdateChannelOf(environment.appVersion); + const awaitingSwitch = + Option.isNone(yield* Ref.get(releaseFloorRef)) && buildChannel !== state.channel; + yield* setState( + awaitingSwitch + ? reduceDesktopUpdateStateOnCheckFailure( + state, + trackMismatchMessage(buildChannel, state.channel), + checkedAt, + ) + : reduceDesktopUpdateStateOnNoUpdate(state, checkedAt), + ); yield* Ref.set(lastLoggedDownloadMilestoneRef, -1); return; } From c08c325951445d072ce531a0736ef4e51c9a1614 Mon Sep 17 00:00:00 2001 From: shivam <91240327+shivamhwp@users.noreply.github.com> Date: Wed, 18 Nov 2026 08:41:13 +0000 Subject: [PATCH 2/5] test(desktop): drop copy-text assertions from the track mismatch test Keep the state assertions; the message wording is not behaviour. --- apps/desktop/src/updates/DesktopUpdates.test.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/apps/desktop/src/updates/DesktopUpdates.test.ts b/apps/desktop/src/updates/DesktopUpdates.test.ts index 7a604f2187646..511e3ef9ad4ff 100644 --- a/apps/desktop/src/updates/DesktopUpdates.test.ts +++ b/apps/desktop/src/updates/DesktopUpdates.test.ts @@ -1200,8 +1200,6 @@ describe("DesktopUpdates", () => { assert.equal(state.status, "error"); assert.equal(state.errorContext, "check"); assert.isTrue(state.canRetry); - assert.include(state.message, "Stable build"); - assert.include(state.message, "Nightly track"); assert.deepEqual(harness.checkAllowedDowngrade, [false]); }), ).pipe(Effect.provide(Layer.merge(TestClock.layer(), harness.layer))); From 54fb9d274b4bee9b250bf7fd34a847194261e654 Mon Sep 17 00:00:00 2001 From: shivam <91240327+shivamhwp@users.noreply.github.com> Date: Wed, 18 Nov 2026 08:47:56 +0000 Subject: [PATCH 3/5] fix(desktop): a feed with no newer release reports the track mismatch too The no-update path published Up to date for a build whose saved track is off its own, while the update-available discard already reported it. Both now share one decision. Model and harness: Claude Opus 5.5 via T3 Code (Claude Code harness). Co-Authored-By: Claude Haiku 5.5 --- .../src/updates/DesktopUpdates.test.ts | 19 +++++++++++++ apps/desktop/src/updates/DesktopUpdates.ts | 28 ++++++++++--------- 2 files changed, 34 insertions(+), 13 deletions(-) diff --git a/apps/desktop/src/updates/DesktopUpdates.test.ts b/apps/desktop/src/updates/DesktopUpdates.test.ts index 511e3ef9ad4ff..9b034385d88e0 100644 --- a/apps/desktop/src/updates/DesktopUpdates.test.ts +++ b/apps/desktop/src/updates/DesktopUpdates.test.ts @@ -1205,6 +1205,25 @@ describe("DesktopUpdates", () => { ).pipe(Effect.provide(Layer.merge(TestClock.layer(), harness.layer))); }); + it.effect("reports a track mismatch when the feed offers no release at all", () => { + const harness = makeHarness({ savedChannel: "nightly" }); + + return Effect.scoped( + Effect.gen(function* () { + const updates = yield* DesktopUpdates.DesktopUpdates; + yield* updates.configure; + yield* updates.check("startup"); + harness.emit("update-not-available"); + yield* flushCallbacks; + + const state = yield* updates.getState; + assert.equal(state.status, "error"); + assert.equal(state.errorContext, "check"); + assert.isTrue(state.canRetry); + }), + ).pipe(Effect.provide(Layer.merge(TestClock.layer(), harness.layer))); + }); + it.effect("never offers an older Nightly to a Nightly build's own checks", () => { const harness = makeHarness({ appVersion: "1.2.4-nightly.20261027.1" }); diff --git a/apps/desktop/src/updates/DesktopUpdates.ts b/apps/desktop/src/updates/DesktopUpdates.ts index f3a21066eacb9..d6e66fec4e800 100644 --- a/apps/desktop/src/updates/DesktopUpdates.ts +++ b/apps/desktop/src/updates/DesktopUpdates.ts @@ -424,6 +424,19 @@ export const make = Effect.gen(function* () { ), ); + // Without a release floor, a build on another track than its saved one never offers anything. + const noOfferState = (state: DesktopUpdateState, checkedAt: string) => + Effect.map(Ref.get(releaseFloorRef), (floor) => { + const buildChannel = desktopUpdateChannelOf(environment.appVersion); + return Option.isNone(floor) && buildChannel !== state.channel + ? reduceDesktopUpdateStateOnCheckFailure( + state, + trackMismatchMessage(buildChannel, state.channel), + checkedAt, + ) + : reduceDesktopUpdateStateOnNoUpdate(state, checkedAt); + }); + const stateChanges = yield* PubSub.sliding(16); // Serialize writes and publishes against subscription so snapshots cannot overlap the first change. const stateMutex = yield* Semaphore.make(1); @@ -1076,18 +1089,7 @@ export const make = Effect.gen(function* () { channel: state.channel, }); const checkedAt = yield* currentIsoTimestamp; - const buildChannel = desktopUpdateChannelOf(environment.appVersion); - const awaitingSwitch = - Option.isNone(yield* Ref.get(releaseFloorRef)) && buildChannel !== state.channel; - yield* setState( - awaitingSwitch - ? reduceDesktopUpdateStateOnCheckFailure( - state, - trackMismatchMessage(buildChannel, state.channel), - checkedAt, - ) - : reduceDesktopUpdateStateOnNoUpdate(state, checkedAt), - ); + yield* setState(yield* noOfferState(state, checkedAt)); yield* Ref.set(lastLoggedDownloadMilestoneRef, -1); return; } @@ -1134,7 +1136,7 @@ export const make = Effect.gen(function* () { const handleUpdateNotAvailable = Effect.gen(function* () { const checkedAt = yield* currentIsoTimestamp; const state = yield* Ref.get(updateStateRef); - yield* setState(reduceDesktopUpdateStateOnNoUpdate(state, checkedAt)); + yield* setState(yield* noOfferState(state, checkedAt)); yield* Ref.set(lastLoggedDownloadMilestoneRef, -1); yield* logUpdaterInfo("no updates available"); }).pipe(Effect.withSpan("desktop.updates.handleUpdateNotAvailable")); From 94acb6a72e4b78db43e3eb10721624a0489d2252 Mon Sep 17 00:00:00 2001 From: shivam <91240327+shivamhwp@users.noreply.github.com> Date: Wed, 18 Nov 2026 21:37:54 +0000 Subject: [PATCH 4/5] fix(desktop): localize update-track mismatch diagnostics --- apps/desktop/src/i18n/translations/de.json | 3 ++ apps/desktop/src/i18n/translations/en.json | 3 ++ apps/desktop/src/i18n/translations/es.json | 3 ++ apps/desktop/src/i18n/translations/fr.json | 3 ++ apps/desktop/src/i18n/translations/ja.json | 3 ++ apps/desktop/src/i18n/translations/ko.json | 3 ++ apps/desktop/src/i18n/translations/pt-BR.json | 3 ++ apps/desktop/src/i18n/translations/ru.json | 3 ++ apps/desktop/src/i18n/translations/sv.json | 3 ++ apps/desktop/src/i18n/translations/zh.json | 3 ++ .../src/updates/DesktopUpdates.test.ts | 14 ++++++ apps/desktop/src/updates/DesktopUpdates.ts | 4 +- apps/desktop/src/updates/updateMachine.ts | 32 ++++++++----- .../src/window/DesktopApplicationMenu.ts | 19 +++++++- apps/mobile/src/i18n/translations/de.json | 2 + apps/mobile/src/i18n/translations/en.json | 2 + apps/mobile/src/i18n/translations/es.json | 2 + apps/mobile/src/i18n/translations/fr.json | 2 + apps/mobile/src/i18n/translations/ja.json | 2 + apps/mobile/src/i18n/translations/ko.json | 2 + apps/mobile/src/i18n/translations/pt-BR.json | 2 + apps/mobile/src/i18n/translations/ru.json | 2 + apps/mobile/src/i18n/translations/sv.json | 2 + apps/mobile/src/i18n/translations/zh.json | 2 + .../desktopUpdate/DesktopAppUpdate.test.ts | 29 ++++++++++++ .../src/desktopUpdate/DesktopAppUpdate.ts | 15 +++++-- .../web/src/components/desktopUpdate.logic.ts | 9 ++++ apps/web/src/i18n/translations/de.json | 2 + apps/web/src/i18n/translations/en.json | 2 + apps/web/src/i18n/translations/es.json | 2 + apps/web/src/i18n/translations/fr.json | 2 + apps/web/src/i18n/translations/ja.json | 2 + apps/web/src/i18n/translations/ko.json | 2 + apps/web/src/i18n/translations/pt-BR.json | 2 + apps/web/src/i18n/translations/ru.json | 2 + apps/web/src/i18n/translations/sv.json | 2 + apps/web/src/i18n/translations/zh.json | 2 + .../src/connection/outdatedHostUpdate.ts | 8 +++- .../client-runtime/src/state/server.test.ts | 45 +++++++++++++++---- packages/client-runtime/src/state/server.ts | 28 +++++++++++- packages/contracts/src/ipc.ts | 3 ++ packages/contracts/src/server.ts | 7 +++ 42 files changed, 255 insertions(+), 28 deletions(-) diff --git a/apps/desktop/src/i18n/translations/de.json b/apps/desktop/src/i18n/translations/de.json index bd128da18cd16..94b926c6d41ef 100644 --- a/apps/desktop/src/i18n/translations/de.json +++ b/apps/desktop/src/i18n/translations/de.json @@ -54,6 +54,8 @@ "6994444f4fec4070": "Browservorschau", "49de6209699eb616": "Unbenannter Passkey", "b4a5bb1075d95154": "Passkey auswählen", + "61aa0109862ff7ca": "Nightly", + "f3430cac09a505a0": "Stable", "1f12213f4d809e89": "Du bist auf dem neuesten Stand!", "c6399b55619e2f67": "T3 Code {version} ist derzeit die neueste verfügbare Version.", "b6e5b31255e011c5": "OK", @@ -73,6 +75,7 @@ "2f0a8211a72e29aa": "Neu starten", "116a21f6cc215e5f": "Suche nach Updates fehlgeschlagen", "32c88cd9421abf33": "Es konnte nicht nach Updates gesucht werden.", + "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.", "b37aca07d3c644d9": "Ein unbekannter Fehler ist aufgetreten. Bitte versuche es später erneut.", "c8c23435e780a60c": "Updates nicht verfügbar", "aecf7c98b81bef7a": "Automatische Updates sind derzeit nicht verfügbar.", diff --git a/apps/desktop/src/i18n/translations/en.json b/apps/desktop/src/i18n/translations/en.json index ad77a1a07a9a3..c7f108ef0dc34 100644 --- a/apps/desktop/src/i18n/translations/en.json +++ b/apps/desktop/src/i18n/translations/en.json @@ -54,6 +54,8 @@ "6994444f4fec4070": "Browser preview", "49de6209699eb616": "Unnamed passkey", "b4a5bb1075d95154": "Choose a passkey", + "61aa0109862ff7ca": "Nightly", + "f3430cac09a505a0": "Stable", "1f12213f4d809e89": "You're up to date!", "c6399b55619e2f67": "T3 Code {version} is currently the newest version available.", "b6e5b31255e011c5": "OK", @@ -73,6 +75,7 @@ "2f0a8211a72e29aa": "Restart", "116a21f6cc215e5f": "Update check failed", "32c88cd9421abf33": "Could not check for updates.", + "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}.", "b37aca07d3c644d9": "An unknown error occurred. Please try again later.", "c8c23435e780a60c": "Updates unavailable", "aecf7c98b81bef7a": "Automatic updates are not available right now.", diff --git a/apps/desktop/src/i18n/translations/es.json b/apps/desktop/src/i18n/translations/es.json index 0b3243ebe918b..45884056187ed 100644 --- a/apps/desktop/src/i18n/translations/es.json +++ b/apps/desktop/src/i18n/translations/es.json @@ -54,6 +54,8 @@ "6994444f4fec4070": "Vista previa del navegador", "49de6209699eb616": "Llave de acceso sin nombre", "b4a5bb1075d95154": "Elige una llave de acceso", + "61aa0109862ff7ca": "Nightly", + "f3430cac09a505a0": "Estable", "1f12213f4d809e89": "¡Estás al día!", "c6399b55619e2f67": "T3 Code {version} es la versión más reciente disponible.", "b6e5b31255e011c5": "Aceptar", @@ -73,6 +75,7 @@ "2f0a8211a72e29aa": "Reiniciar", "116a21f6cc215e5f": "Error al buscar actualizaciones", "32c88cd9421abf33": "No se pudo buscar actualizaciones.", + "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}.", "b37aca07d3c644d9": "Se produjo un error desconocido. Vuelve a intentarlo más tarde.", "c8c23435e780a60c": "Actualizaciones no disponibles", "aecf7c98b81bef7a": "Las actualizaciones automáticas no están disponibles ahora mismo.", diff --git a/apps/desktop/src/i18n/translations/fr.json b/apps/desktop/src/i18n/translations/fr.json index a0dcf1bd13ac3..cee10508a3caa 100644 --- a/apps/desktop/src/i18n/translations/fr.json +++ b/apps/desktop/src/i18n/translations/fr.json @@ -54,6 +54,8 @@ "6994444f4fec4070": "Aperçu du navigateur", "49de6209699eb616": "Clé d’accès sans nom", "b4a5bb1075d95154": "Choisir une clé d’accès", + "61aa0109862ff7ca": "Nightly", + "f3430cac09a505a0": "Stable", "1f12213f4d809e89": "Vous êtes à jour !", "c6399b55619e2f67": "T3 Code {version} est actuellement la version la plus récente.", "b6e5b31255e011c5": "OK", @@ -73,6 +75,7 @@ "2f0a8211a72e29aa": "Redémarrer", "116a21f6cc215e5f": "Échec de la recherche de mises à jour", "32c88cd9421abf33": "Impossible de rechercher des mises à jour.", + "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}.", "b37aca07d3c644d9": "Une erreur inconnue s’est produite. Veuillez réessayer plus tard.", "c8c23435e780a60c": "Mises à jour indisponibles", "aecf7c98b81bef7a": "Les mises à jour automatiques ne sont pas disponibles pour le moment.", diff --git a/apps/desktop/src/i18n/translations/ja.json b/apps/desktop/src/i18n/translations/ja.json index 93553bbf1a743..3ec71bc1ec095 100644 --- a/apps/desktop/src/i18n/translations/ja.json +++ b/apps/desktop/src/i18n/translations/ja.json @@ -54,6 +54,8 @@ "6994444f4fec4070": "ブラウザープレビュー", "49de6209699eb616": "名前のないパスキー", "b4a5bb1075d95154": "パスキーを選択", + "61aa0109862ff7ca": "Nightly", + "f3430cac09a505a0": "安定版", "1f12213f4d809e89": "最新の状態です", "c6399b55619e2f67": "T3 Code {version} が現在利用できる最新バージョンです。", "b6e5b31255e011c5": "OK", @@ -73,6 +75,7 @@ "2f0a8211a72e29aa": "再起動", "116a21f6cc215e5f": "更新の確認に失敗しました", "32c88cd9421abf33": "更新を確認できませんでした。", + "9e5ada64a94c10de": "この {build} ビルドは {saved} トラックから単独では更新できません。更新トラックを {build} に戻すか、更新トラックの横にある「レビュー」を使って {saved} への切り替えを再試行してください。", "b37aca07d3c644d9": "不明なエラーが発生しました。しばらくしてからもう一度お試しください。", "c8c23435e780a60c": "更新を利用できません", "aecf7c98b81bef7a": "現在、自動更新は利用できません。", diff --git a/apps/desktop/src/i18n/translations/ko.json b/apps/desktop/src/i18n/translations/ko.json index aac215f3a63d1..fb3b604ef6a60 100644 --- a/apps/desktop/src/i18n/translations/ko.json +++ b/apps/desktop/src/i18n/translations/ko.json @@ -54,6 +54,8 @@ "6994444f4fec4070": "브라우저 미리 보기", "49de6209699eb616": "이름 없는 패스키", "b4a5bb1075d95154": "패스키 선택", + "61aa0109862ff7ca": "Nightly", + "f3430cac09a505a0": "Stable", "1f12213f4d809e89": "최신 버전입니다!", "c6399b55619e2f67": "T3 Code {version}이(가) 현재 사용 가능한 최신 버전입니다.", "b6e5b31255e011c5": "확인", @@ -73,6 +75,7 @@ "2f0a8211a72e29aa": "다시 시작", "116a21f6cc215e5f": "업데이트 확인 실패", "32c88cd9421abf33": "업데이트를 확인할 수 없습니다.", + "9e5ada64a94c10de": "이 {build} 빌드는 {saved} 트랙에서 스스로 업데이트할 수 없습니다. 업데이트 트랙을 다시 {build}(으)로 바꾸거나, 업데이트 트랙 옆의 검토를 사용해 {saved}(으)로 전환을 다시 시도하세요.", "b37aca07d3c644d9": "알 수 없는 오류가 발생했습니다. 나중에 다시 시도하세요.", "c8c23435e780a60c": "업데이트를 사용할 수 없음", "aecf7c98b81bef7a": "지금은 자동 업데이트를 사용할 수 없습니다.", diff --git a/apps/desktop/src/i18n/translations/pt-BR.json b/apps/desktop/src/i18n/translations/pt-BR.json index 78e635076cf72..1e83d57cab397 100644 --- a/apps/desktop/src/i18n/translations/pt-BR.json +++ b/apps/desktop/src/i18n/translations/pt-BR.json @@ -54,6 +54,8 @@ "6994444f4fec4070": "Pré-visualização do navegador", "49de6209699eb616": "Chave de acesso sem nome", "b4a5bb1075d95154": "Escolha uma chave de acesso", + "61aa0109862ff7ca": "Nightly", + "f3430cac09a505a0": "Estável", "1f12213f4d809e89": "Você está atualizado!", "c6399b55619e2f67": "O T3 Code {version} é a versão mais recente disponível.", "b6e5b31255e011c5": "OK", @@ -73,6 +75,7 @@ "2f0a8211a72e29aa": "Reiniciar", "116a21f6cc215e5f": "Falha ao verificar atualizações", "32c88cd9421abf33": "Não foi possível verificar atualizações.", + "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}.", "b37aca07d3c644d9": "Ocorreu um erro desconhecido. Tente novamente mais tarde.", "c8c23435e780a60c": "Atualizações indisponíveis", "aecf7c98b81bef7a": "As atualizações automáticas não estão disponíveis no momento.", diff --git a/apps/desktop/src/i18n/translations/ru.json b/apps/desktop/src/i18n/translations/ru.json index deb40ac5292c2..3df900eae3871 100644 --- a/apps/desktop/src/i18n/translations/ru.json +++ b/apps/desktop/src/i18n/translations/ru.json @@ -54,6 +54,8 @@ "6994444f4fec4070": "Предпросмотр в браузере", "49de6209699eb616": "Безымянный ключ доступа", "b4a5bb1075d95154": "Выберите ключ доступа", + "61aa0109862ff7ca": "Nightly", + "f3430cac09a505a0": "Стабильный", "1f12213f4d809e89": "У вас последняя версия!", "c6399b55619e2f67": "T3 Code {version} — новейшая доступная версия.", "b6e5b31255e011c5": "OK", @@ -73,6 +75,7 @@ "2f0a8211a72e29aa": "Перезапустить", "116a21f6cc215e5f": "Ошибка проверки обновлений", "32c88cd9421abf33": "Не удалось проверить обновления.", + "9e5ada64a94c10de": "Эта сборка {build} не может сама обновиться с канала «{saved}». Верните канал обновлений на «{build}» или нажмите «Ревью» рядом с «Канал обновлений», чтобы повторить переход на «{saved}».", "b37aca07d3c644d9": "Произошла неизвестная ошибка. Повторите попытку позже.", "c8c23435e780a60c": "Обновления недоступны", "aecf7c98b81bef7a": "Автоматические обновления сейчас недоступны.", diff --git a/apps/desktop/src/i18n/translations/sv.json b/apps/desktop/src/i18n/translations/sv.json index aa30b26073b39..4b3aa74306fea 100644 --- a/apps/desktop/src/i18n/translations/sv.json +++ b/apps/desktop/src/i18n/translations/sv.json @@ -54,6 +54,8 @@ "6994444f4fec4070": "Förhandsvisning i webbläsaren", "49de6209699eb616": "Namnlös lösenordsnyckel", "b4a5bb1075d95154": "Välj en lösenordsnyckel", + "61aa0109862ff7ca": "Nightly", + "f3430cac09a505a0": "Stable", "1f12213f4d809e89": "Du har den senaste versionen!", "c6399b55619e2f67": "T3 Code {version} är den senaste tillgängliga versionen.", "b6e5b31255e011c5": "OK", @@ -73,6 +75,7 @@ "2f0a8211a72e29aa": "Starta om", "116a21f6cc215e5f": "Sökningen efter uppdateringar misslyckades", "32c88cd9421abf33": "Kunde inte söka efter uppdateringar.", + "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.", "b37aca07d3c644d9": "Ett okänt fel inträffade. Försök igen senare.", "c8c23435e780a60c": "Uppdateringar är inte tillgängliga", "aecf7c98b81bef7a": "Automatiska uppdateringar är inte tillgängliga just nu.", diff --git a/apps/desktop/src/i18n/translations/zh.json b/apps/desktop/src/i18n/translations/zh.json index f8c6a6e6be217..13e5b6fd884fa 100644 --- a/apps/desktop/src/i18n/translations/zh.json +++ b/apps/desktop/src/i18n/translations/zh.json @@ -54,6 +54,8 @@ "6994444f4fec4070": "浏览器预览", "49de6209699eb616": "未命名通行密钥", "b4a5bb1075d95154": "选择通行密钥", + "61aa0109862ff7ca": "Nightly 版", + "f3430cac09a505a0": "稳定版", "1f12213f4d809e89": "已是最新版本!", "c6399b55619e2f67": "T3 Code {version} 已是最新版本。", "b6e5b31255e011c5": "确定", @@ -73,6 +75,7 @@ "2f0a8211a72e29aa": "重启", "116a21f6cc215e5f": "检查更新失败", "32c88cd9421abf33": "无法检查更新。", + "9e5ada64a94c10de": "此 {build} 构建无法自行从 {saved} 通道更新。请将更新通道切回 {build},或使用“更新通道”旁的“查看”重新尝试切换到 {saved}。", "b37aca07d3c644d9": "发生未知错误,请稍后重试。", "c8c23435e780a60c": "更新不可用", "aecf7c98b81bef7a": "目前无法自动更新。", diff --git a/apps/desktop/src/updates/DesktopUpdates.test.ts b/apps/desktop/src/updates/DesktopUpdates.test.ts index 9b034385d88e0..c81d7b94bffe1 100644 --- a/apps/desktop/src/updates/DesktopUpdates.test.ts +++ b/apps/desktop/src/updates/DesktopUpdates.test.ts @@ -1200,6 +1200,7 @@ describe("DesktopUpdates", () => { assert.equal(state.status, "error"); assert.equal(state.errorContext, "check"); assert.isTrue(state.canRetry); + assert.deepEqual(state.trackMismatch, { buildChannel: "latest" }); assert.deepEqual(harness.checkAllowedDowngrade, [false]); }), ).pipe(Effect.provide(Layer.merge(TestClock.layer(), harness.layer))); @@ -1220,6 +1221,19 @@ describe("DesktopUpdates", () => { assert.equal(state.status, "error"); assert.equal(state.errorContext, "check"); assert.isTrue(state.canRetry); + assert.deepEqual(state.trackMismatch, { buildChannel: "latest" }); + + // A later failure has its own reason, so the mismatch must not stay attached to it. + harness.emit("error", new Error("background updater failure")); + yield* flushCallbacks; + assert.isUndefined((yield* updates.getState).trackMismatch); + + harness.emit("update-not-available"); + yield* flushCallbacks; + assert.isDefined((yield* updates.getState).trackMismatch); + yield* updates.check("menu"); + assert.equal((yield* updates.getState).status, "checking"); + assert.isUndefined((yield* updates.getState).trackMismatch); }), ).pipe(Effect.provide(Layer.merge(TestClock.layer(), harness.layer))); }); diff --git a/apps/desktop/src/updates/DesktopUpdates.ts b/apps/desktop/src/updates/DesktopUpdates.ts index d6e66fec4e800..a265533e2a2e9 100644 --- a/apps/desktop/src/updates/DesktopUpdates.ts +++ b/apps/desktop/src/updates/DesktopUpdates.ts @@ -371,6 +371,7 @@ function getAutoUpdateDisabledReason(args: { const trackLabel = (channel: DesktopUpdateChannel) => channel === "nightly" ? "Nightly" : "Stable"; +// Clients localize `trackMismatch`; this English text serves older renderers and remote reports. const trackMismatchMessage = (build: DesktopUpdateChannel, saved: DesktopUpdateChannel) => `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)}.`; @@ -433,6 +434,7 @@ export const make = Effect.gen(function* () { state, trackMismatchMessage(buildChannel, state.channel), checkedAt, + { buildChannel }, ) : reduceDesktopUpdateStateOnNoUpdate(state, checkedAt); }); @@ -1164,7 +1166,7 @@ export const make = Effect.gen(function* () { if (Option.isNone(activeAction)) { const checkedAt = yield* currentIsoTimestamp; - yield* updateState((current) => ({ + yield* updateState(({ trackMismatch: _trackMismatch, ...current }) => ({ ...current, status: "error", message: error.message, diff --git a/apps/desktop/src/updates/updateMachine.ts b/apps/desktop/src/updates/updateMachine.ts index 4d3852446b189..80751315657c0 100644 --- a/apps/desktop/src/updates/updateMachine.ts +++ b/apps/desktop/src/updates/updateMachine.ts @@ -11,6 +11,14 @@ function nextStatusAfterDownloadFailure( return currentState.availableVersion ? "available" : "error"; } +// A mismatch describes only the check that found it. +function withoutTrackMismatch({ + trackMismatch: _trackMismatch, + ...state +}: DesktopUpdateState): DesktopUpdateState { + return state; +} + function getCanRetryAfterDownloadFailure(currentState: DesktopUpdateState): boolean { return currentState.availableVersion !== null; } @@ -46,7 +54,7 @@ export function reduceDesktopUpdateStateOnCheckStart( ): DesktopUpdateState { const hasDownloadedUpdate = state.downloadedVersion !== null; return { - ...state, + ...withoutTrackMismatch(state), status: "checking", checkedAt, releaseNotes: hasDownloadedUpdate ? state.releaseNotes : [], @@ -62,10 +70,11 @@ export function reduceDesktopUpdateStateOnCheckFailure( state: DesktopUpdateState, message: string, checkedAt: string, + trackMismatch?: DesktopUpdateState["trackMismatch"], ): DesktopUpdateState { if (state.downloadedVersion !== null) { return { - ...state, + ...withoutTrackMismatch(state), status: "downloaded", message: null, checkedAt, @@ -76,13 +85,14 @@ export function reduceDesktopUpdateStateOnCheckFailure( } return { - ...state, + ...withoutTrackMismatch(state), status: "error", message, checkedAt, downloadPercent: null, errorContext: "check", canRetry: true, + ...(trackMismatch === undefined ? {} : { trackMismatch }), }; } @@ -96,7 +106,7 @@ export function reduceDesktopUpdateStateOnUpdateAvailable( const isDownloadedVersion = state.downloadedVersion === version; const preserveReleaseNotes = isDownloadedVersion && releaseNotes.length === 0; return { - ...state, + ...withoutTrackMismatch(state), status: isDownloadedVersion ? "downloaded" : "available", availableVersion: version, downloadedVersion: isDownloadedVersion ? version : null, @@ -116,7 +126,7 @@ export function reduceDesktopUpdateStateOnNoUpdate( ): DesktopUpdateState { if (state.downloadedVersion !== null) { return { - ...state, + ...withoutTrackMismatch(state), status: "downloaded", availableVersion: state.downloadedVersion, downloadPercent: 100, @@ -128,7 +138,7 @@ export function reduceDesktopUpdateStateOnNoUpdate( } return { - ...state, + ...withoutTrackMismatch(state), status: "up-to-date", availableVersion: null, downloadedVersion: null, @@ -146,7 +156,7 @@ export function reduceDesktopUpdateStateOnDownloadStart( state: DesktopUpdateState, ): DesktopUpdateState { return { - ...state, + ...withoutTrackMismatch(state), status: "downloading", downloadPercent: 0, message: null, @@ -160,7 +170,7 @@ export function reduceDesktopUpdateStateOnDownloadFailure( message: string, ): DesktopUpdateState { return { - ...state, + ...withoutTrackMismatch(state), status: nextStatusAfterDownloadFailure(state), message, downloadPercent: null, @@ -174,7 +184,7 @@ export function reduceDesktopUpdateStateOnDownloadProgress( percent: number, ): DesktopUpdateState { return { - ...state, + ...withoutTrackMismatch(state), status: "downloading", downloadPercent: percent, message: null, @@ -188,7 +198,7 @@ export function reduceDesktopUpdateStateOnDownloadComplete( version: string, ): DesktopUpdateState { return { - ...state, + ...withoutTrackMismatch(state), status: "downloaded", availableVersion: version, downloadedVersion: version, @@ -204,7 +214,7 @@ export function reduceDesktopUpdateStateOnInstallFailure( message: string, ): DesktopUpdateState { return { - ...state, + ...withoutTrackMismatch(state), status: "downloaded", message, errorContext: "install", diff --git a/apps/desktop/src/window/DesktopApplicationMenu.ts b/apps/desktop/src/window/DesktopApplicationMenu.ts index 4c5475f8a6023..ff9f2305cd5bc 100644 --- a/apps/desktop/src/window/DesktopApplicationMenu.ts +++ b/apps/desktop/src/window/DesktopApplicationMenu.ts @@ -4,6 +4,7 @@ import * as Layer from "effect/Layer"; import * as Option from "effect/Option"; import * as Schema from "effect/Schema"; +import type { DesktopUpdateChannel } from "@t3tools/contracts"; import * as Electron from "electron"; import { msg } from "gt-i18n"; @@ -68,6 +69,11 @@ const runMainContentsCommand = Effect.fn("desktop.menu.runMainContentsCommand")( yield* desktopWindow.runMainContentsCommand(command); }); +const trackLabel = (channel: DesktopUpdateChannel) => + channel === "nightly" + ? m(msg("Nightly", { $context: "release track" })) + : m(msg("Stable", { $context: "release track" })); + const checkForUpdatesFromMenu = Effect.gen(function* () { const updates = yield* DesktopUpdates.DesktopUpdates; const electronDialog = yield* ElectronDialog.ElectronDialog; @@ -134,7 +140,18 @@ const checkForUpdatesFromMenu = Effect.gen(function* () { type: "warning", title: m(msg("Update check failed")), message: m(msg("Could not check for updates.")), - detail: updateState.message ?? m(msg("An unknown error occurred. Please try again later.")), + detail: + updateState.trackMismatch !== undefined + ? m( + msg( + "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}.", + ), + { + build: trackLabel(updateState.trackMismatch.buildChannel), + saved: trackLabel(updateState.channel), + }, + ) + : (updateState.message ?? m(msg("An unknown error occurred. Please try again later."))), buttons: [m(msg("OK"))], }); } diff --git a/apps/mobile/src/i18n/translations/de.json b/apps/mobile/src/i18n/translations/de.json index c9d43d96b3eb8..11bd1d28cb98f 100644 --- a/apps/mobile/src/i18n/translations/de.json +++ b/apps/mobile/src/i18n/translations/de.json @@ -680,6 +680,8 @@ "b50da99bbfd59a6d": "Das Update auf t3@{version} wurde zurückgerollt.", "31dc4da5813e0846": "Das Update auf t3@{version} ist fehlgeschlagen.", "b060872e18e91755": "Server-Update fehlgeschlagen.", + "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.", + "43ed503038717b90": "Server-Update fehlgeschlagen:", "a8cb0a2b46270859": "Die Umgebungsdaten konnten nicht synchronisiert werden.", "4731d4616735186c": "{count, plural, one {{count} Subagent gestartet} other {{count} Subagenten gestartet}}", "885110d4e416d2cd": "{count, plural, one {{count} Subagent ausgeführt} other {{count} Subagenten ausgeführt}}", diff --git a/apps/mobile/src/i18n/translations/en.json b/apps/mobile/src/i18n/translations/en.json index 7a89a1cf37c22..8c0e40873bec3 100644 --- a/apps/mobile/src/i18n/translations/en.json +++ b/apps/mobile/src/i18n/translations/en.json @@ -680,6 +680,8 @@ "b50da99bbfd59a6d": "The t3@{version} update rolled-back.", "31dc4da5813e0846": "The t3@{version} update failed.", "b060872e18e91755": "Server update failed.", + "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}}.", + "43ed503038717b90": "Server update failed:", "a8cb0a2b46270859": "Could not synchronize environment data.", "4731d4616735186c": "{count, plural, one {Kicked off {count} subagent} other {Kicked off {count} subagents}}", "885110d4e416d2cd": "{count, plural, one {Ran {count} subagent} other {Ran {count} subagents}}", diff --git a/apps/mobile/src/i18n/translations/es.json b/apps/mobile/src/i18n/translations/es.json index 288dbfc7da2cf..a404a9e6a9707 100644 --- a/apps/mobile/src/i18n/translations/es.json +++ b/apps/mobile/src/i18n/translations/es.json @@ -680,6 +680,8 @@ "b50da99bbfd59a6d": "La actualización a t3@{version} se revirtió.", "31dc4da5813e0846": "La actualización a t3@{version} falló.", "b060872e18e91755": "Falló la actualización del servidor.", + "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}}.", + "43ed503038717b90": "Falló la actualización del servidor:", "a8cb0a2b46270859": "No se pudieron sincronizar los datos del entorno.", "4731d4616735186c": "{count, plural, one {Se inició {count} subagente} other {Se iniciaron {count} subagentes}}", "885110d4e416d2cd": "{count, plural, one {Se ejecutó {count} subagente} other {Se ejecutaron {count} subagentes}}", diff --git a/apps/mobile/src/i18n/translations/fr.json b/apps/mobile/src/i18n/translations/fr.json index 28ec2284fca74..0de752ada1053 100644 --- a/apps/mobile/src/i18n/translations/fr.json +++ b/apps/mobile/src/i18n/translations/fr.json @@ -680,6 +680,8 @@ "b50da99bbfd59a6d": "La mise à jour t3@{version} a été annulée.", "31dc4da5813e0846": "La mise à jour t3@{version} a échoué.", "b060872e18e91755": "Échec de la mise à jour du serveur.", + "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}}.", + "43ed503038717b90": "Échec de la mise à jour du serveur :", "a8cb0a2b46270859": "Impossible de synchroniser les données de l’environnement.", "4731d4616735186c": "{count, plural, one {{count} sous-agent lancé} other {{count} sous-agents lancés}}", "885110d4e416d2cd": "{count, plural, one {{count} sous-agent exécuté} other {{count} sous-agents exécutés}}", diff --git a/apps/mobile/src/i18n/translations/ja.json b/apps/mobile/src/i18n/translations/ja.json index f6741fdb8b775..80054a52631f0 100644 --- a/apps/mobile/src/i18n/translations/ja.json +++ b/apps/mobile/src/i18n/translations/ja.json @@ -680,6 +680,8 @@ "b50da99bbfd59a6d": "t3@{version} の更新はロールバックされました。", "31dc4da5813e0846": "t3@{version} の更新に失敗しました。", "b060872e18e91755": "サーバーの更新に失敗しました。", + "77231250643f4943": "この {build, select, nightly {Nightly} other {安定版}} ビルドは {saved, select, nightly {Nightly} other {安定版}} トラックから単独では更新できません。更新トラックを {build, select, nightly {Nightly} other {安定版}} に戻すか、更新トラックの横にある「レビュー」を使って {saved, select, nightly {Nightly} other {安定版}} への切り替えを再試行してください。", + "43ed503038717b90": "サーバーの更新に失敗しました:", "a8cb0a2b46270859": "環境のデータを同期できませんでした。", "4731d4616735186c": "{count, plural, other {{count} 個のサブエージェントを開始しました}}", "885110d4e416d2cd": "{count, plural, other {{count} 個のサブエージェントを実行しました}}", diff --git a/apps/mobile/src/i18n/translations/ko.json b/apps/mobile/src/i18n/translations/ko.json index b1ef20ba0f347..678d29a5c0204 100644 --- a/apps/mobile/src/i18n/translations/ko.json +++ b/apps/mobile/src/i18n/translations/ko.json @@ -680,6 +680,8 @@ "b50da99bbfd59a6d": "t3@{version} 업데이트가 롤백되었습니다.", "31dc4da5813e0846": "t3@{version} 업데이트에 실패했습니다.", "b060872e18e91755": "서버 업데이트에 실패했습니다.", + "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}}(으)로 전환을 다시 시도하세요.", + "43ed503038717b90": "서버 업데이트에 실패했습니다:", "a8cb0a2b46270859": "환경 데이터를 동기화할 수 없습니다.", "4731d4616735186c": "{count, plural, other {서브에이전트 {count}개 시작함}}", "885110d4e416d2cd": "{count, plural, other {서브에이전트 {count}개 실행함}}", diff --git a/apps/mobile/src/i18n/translations/pt-BR.json b/apps/mobile/src/i18n/translations/pt-BR.json index b40494fca3885..adc1b637d66d5 100644 --- a/apps/mobile/src/i18n/translations/pt-BR.json +++ b/apps/mobile/src/i18n/translations/pt-BR.json @@ -680,6 +680,8 @@ "b50da99bbfd59a6d": "A atualização t3@{version} foi revertida.", "31dc4da5813e0846": "A atualização t3@{version} falhou.", "b060872e18e91755": "Falha ao atualizar o servidor.", + "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}}.", + "43ed503038717b90": "Falha ao atualizar o servidor:", "a8cb0a2b46270859": "Não foi possível sincronizar os dados do ambiente.", "4731d4616735186c": "{count, plural, one {{count} subagente iniciado} other {{count} subagentes iniciados}}", "885110d4e416d2cd": "{count, plural, one {{count} subagente executado} other {{count} subagentes executados}}", diff --git a/apps/mobile/src/i18n/translations/ru.json b/apps/mobile/src/i18n/translations/ru.json index cadf07e57eda9..e367e26460f47 100644 --- a/apps/mobile/src/i18n/translations/ru.json +++ b/apps/mobile/src/i18n/translations/ru.json @@ -680,6 +680,8 @@ "b50da99bbfd59a6d": "Обновление t3@{version} откачено.", "31dc4da5813e0846": "Ошибка обновления t3@{version}.", "b060872e18e91755": "Не удалось обновить сервер.", + "77231250643f4943": "Эта сборка {build, select, nightly {Nightly} other {Стабильный}} не может сама обновиться с канала «{saved, select, nightly {Nightly} other {Стабильный}}». Верните канал обновлений на «{build, select, nightly {Nightly} other {Стабильный}}» или нажмите «Ревью» рядом с «Канал обновлений», чтобы повторить переход на «{saved, select, nightly {Nightly} other {Стабильный}}».", + "43ed503038717b90": "Не удалось обновить сервер:", "a8cb0a2b46270859": "Не удалось синхронизировать данные окружения.", "4731d4616735186c": "{count, plural, one {Запущен {count} субагент} few {Запущено {count} субагента} many {Запущено {count} субагентов} other {Запущено {count} субагента}}", "885110d4e416d2cd": "{count, plural, one {Отработал {count} субагент} few {Отработали {count} субагента} many {Отработали {count} субагентов} other {Отработали {count} субагента}}", diff --git a/apps/mobile/src/i18n/translations/sv.json b/apps/mobile/src/i18n/translations/sv.json index 3a0273aef36fd..42e34a3980654 100644 --- a/apps/mobile/src/i18n/translations/sv.json +++ b/apps/mobile/src/i18n/translations/sv.json @@ -680,6 +680,8 @@ "b50da99bbfd59a6d": "Uppdateringen till t3@{version} återställdes.", "31dc4da5813e0846": "Uppdateringen till t3@{version} misslyckades.", "b060872e18e91755": "Serveruppdateringen misslyckades.", + "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.", + "43ed503038717b90": "Serveruppdateringen misslyckades:", "a8cb0a2b46270859": "Kunde inte synkronisera miljöns data.", "4731d4616735186c": "{count, plural, one {Startade {count} subagent} other {Startade {count} subagenter}}", "885110d4e416d2cd": "{count, plural, one {Körde {count} subagent} other {Körde {count} subagenter}}", diff --git a/apps/mobile/src/i18n/translations/zh.json b/apps/mobile/src/i18n/translations/zh.json index f1c394c60c606..747880d70fc5a 100644 --- a/apps/mobile/src/i18n/translations/zh.json +++ b/apps/mobile/src/i18n/translations/zh.json @@ -680,6 +680,8 @@ "b50da99bbfd59a6d": "t3@{version} 更新已回滚。", "31dc4da5813e0846": "t3@{version} 更新失败。", "b060872e18e91755": "服务器更新失败。", + "77231250643f4943": "此 {build, select, nightly {Nightly 版} other {稳定版}} 构建无法自行从 {saved, select, nightly {Nightly 版} other {稳定版}} 通道更新。请将更新通道切回 {build, select, nightly {Nightly 版} other {稳定版}},或使用“更新通道”旁的“查看”重新尝试切换到 {saved, select, nightly {Nightly 版} other {稳定版}}。", + "43ed503038717b90": "服务器更新失败:", "a8cb0a2b46270859": "无法同步环境数据。", "4731d4616735186c": "{count, plural, other {已启动 {count} 个子智能体}}", "885110d4e416d2cd": "{count, plural, other {已运行 {count} 个子智能体}}", diff --git a/apps/server/src/desktopUpdate/DesktopAppUpdate.test.ts b/apps/server/src/desktopUpdate/DesktopAppUpdate.test.ts index b38dc6efb66d3..4d447ff7e85fa 100644 --- a/apps/server/src/desktopUpdate/DesktopAppUpdate.test.ts +++ b/apps/server/src/desktopUpdate/DesktopAppUpdate.test.ts @@ -204,6 +204,35 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("desktop app upda }), ); + it.effect.each([true, false])( + "carries the track mismatch only for its own failure (%s)", + (matchingReason) => + Effect.gen(function* () { + const mismatch = "This Stable build can't update from the Nightly track on its own."; + const reason = matchingReason ? mismatch : "The desktop update was cancelled."; + const { service } = yield* makeHarness({ + reports: (requestId) => [ + report( + requestId, + makeState({ + status: "error", + channel: "nightly", + message: mismatch, + errorContext: "check", + trackMismatch: { buildChannel: "latest" }, + }), + { outcome: "failed", reason }, + ), + ], + }); + const error = yield* service.run(() => Effect.void).pipe(Effect.flip); + expect(error.reason).toBe(reason); + expect(error.trackMismatch).toEqual( + matchingReason ? { buildChannel: "latest", savedChannel: "nightly" } : undefined, + ); + }), + ); + it.effect("fails when the desktop stops reporting before a terminal outcome", () => Effect.gen(function* () { const { service } = yield* makeHarness({ diff --git a/apps/server/src/desktopUpdate/DesktopAppUpdate.ts b/apps/server/src/desktopUpdate/DesktopAppUpdate.ts index 4963c09b2f6e5..ed1d3bba7f822 100644 --- a/apps/server/src/desktopUpdate/DesktopAppUpdate.ts +++ b/apps/server/src/desktopUpdate/DesktopAppUpdate.ts @@ -137,9 +137,18 @@ export const make = Effect.fn("desktopUpdate.desktopAppUpdate.make")(function* ( `The T3 Code desktop app on this machine is already up to date on ${report.state.currentVersion}.`, ); } - return yield* failWith( - report.reason ?? report.state.message ?? "The desktop app update failed.", - ); + const reason = report.reason ?? report.state.message ?? "The desktop app update failed."; + const mismatch = report.state.trackMismatch; + if (mismatch !== undefined && reason === report.state.message) { + return yield* new ServerSelfUpdateError({ + reason, + trackMismatch: { + buildChannel: mismatch.buildChannel, + savedChannel: report.state.channel, + }, + }); + } + return yield* failWith(reason); }); const run: DesktopAppUpdate["Service"]["run"] = Effect.fn("desktopUpdate.desktopAppUpdate.run")( diff --git a/apps/web/src/components/desktopUpdate.logic.ts b/apps/web/src/components/desktopUpdate.logic.ts index b6018a592c0ff..0deeeba2b3265 100644 --- a/apps/web/src/components/desktopUpdate.logic.ts +++ b/apps/web/src/components/desktopUpdate.logic.ts @@ -1,3 +1,4 @@ +import { desktopTrackMismatchText } from "@t3tools/client-runtime/state/server"; import type { DesktopUpdateActionResult, DesktopUpdateState } from "@t3tools/contracts"; import { msg } from "gt-react"; @@ -157,6 +158,14 @@ export function getDesktopUpdateButtonTooltip( }), ); } + if (state.trackMismatch !== undefined) { + return resolve( + desktopTrackMismatchText({ + buildChannel: state.trackMismatch.buildChannel, + savedChannel: state.channel, + }), + ); + } return state.message ?? resolve(msg("Update failed")); } return resolve(msg("Up to date")); diff --git a/apps/web/src/i18n/translations/de.json b/apps/web/src/i18n/translations/de.json index 648fd58859dbe..8add006bffc28 100644 --- a/apps/web/src/i18n/translations/de.json +++ b/apps/web/src/i18n/translations/de.json @@ -680,6 +680,8 @@ "b50da99bbfd59a6d": "Das Update auf t3@{version} wurde zurückgerollt.", "31dc4da5813e0846": "Das Update auf t3@{version} ist fehlgeschlagen.", "b060872e18e91755": "Server-Update fehlgeschlagen.", + "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.", + "43ed503038717b90": "Server-Update fehlgeschlagen:", "a8cb0a2b46270859": "Die Umgebungsdaten konnten nicht synchronisiert werden.", "4731d4616735186c": "{count, plural, one {{count} Subagent gestartet} other {{count} Subagenten gestartet}}", "885110d4e416d2cd": "{count, plural, one {{count} Subagent ausgeführt} other {{count} Subagenten ausgeführt}}", diff --git a/apps/web/src/i18n/translations/en.json b/apps/web/src/i18n/translations/en.json index 599944358b5bb..ab3df41cdfcc6 100644 --- a/apps/web/src/i18n/translations/en.json +++ b/apps/web/src/i18n/translations/en.json @@ -680,6 +680,8 @@ "b50da99bbfd59a6d": "The t3@{version} update rolled-back.", "31dc4da5813e0846": "The t3@{version} update failed.", "b060872e18e91755": "Server update failed.", + "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}}.", + "43ed503038717b90": "Server update failed:", "a8cb0a2b46270859": "Could not synchronize environment data.", "4731d4616735186c": "{count, plural, one {Kicked off {count} subagent} other {Kicked off {count} subagents}}", "885110d4e416d2cd": "{count, plural, one {Ran {count} subagent} other {Ran {count} subagents}}", diff --git a/apps/web/src/i18n/translations/es.json b/apps/web/src/i18n/translations/es.json index 956f4e17a9617..12921654b394e 100644 --- a/apps/web/src/i18n/translations/es.json +++ b/apps/web/src/i18n/translations/es.json @@ -680,6 +680,8 @@ "b50da99bbfd59a6d": "La actualización a t3@{version} se revirtió.", "31dc4da5813e0846": "La actualización a t3@{version} falló.", "b060872e18e91755": "Falló la actualización del servidor.", + "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}}.", + "43ed503038717b90": "Falló la actualización del servidor:", "a8cb0a2b46270859": "No se pudieron sincronizar los datos del entorno.", "4731d4616735186c": "{count, plural, one {Se inició {count} subagente} other {Se iniciaron {count} subagentes}}", "885110d4e416d2cd": "{count, plural, one {Se ejecutó {count} subagente} other {Se ejecutaron {count} subagentes}}", diff --git a/apps/web/src/i18n/translations/fr.json b/apps/web/src/i18n/translations/fr.json index 1c982cc6d6f58..0c75c65a975cd 100644 --- a/apps/web/src/i18n/translations/fr.json +++ b/apps/web/src/i18n/translations/fr.json @@ -680,6 +680,8 @@ "b50da99bbfd59a6d": "La mise à jour t3@{version} a été annulée.", "31dc4da5813e0846": "La mise à jour t3@{version} a échoué.", "b060872e18e91755": "Échec de la mise à jour du serveur.", + "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}}.", + "43ed503038717b90": "Échec de la mise à jour du serveur :", "a8cb0a2b46270859": "Impossible de synchroniser les données de l’environnement.", "4731d4616735186c": "{count, plural, one {{count} sous-agent lancé} other {{count} sous-agents lancés}}", "885110d4e416d2cd": "{count, plural, one {{count} sous-agent exécuté} other {{count} sous-agents exécutés}}", diff --git a/apps/web/src/i18n/translations/ja.json b/apps/web/src/i18n/translations/ja.json index 879531a396d2a..7c4f6526d2d5f 100644 --- a/apps/web/src/i18n/translations/ja.json +++ b/apps/web/src/i18n/translations/ja.json @@ -680,6 +680,8 @@ "b50da99bbfd59a6d": "t3@{version} の更新はロールバックされました。", "31dc4da5813e0846": "t3@{version} の更新に失敗しました。", "b060872e18e91755": "サーバーの更新に失敗しました。", + "77231250643f4943": "この {build, select, nightly {Nightly} other {安定版}} ビルドは {saved, select, nightly {Nightly} other {安定版}} トラックから単独では更新できません。更新トラックを {build, select, nightly {Nightly} other {安定版}} に戻すか、更新トラックの横にある「レビュー」を使って {saved, select, nightly {Nightly} other {安定版}} への切り替えを再試行してください。", + "43ed503038717b90": "サーバーの更新に失敗しました:", "a8cb0a2b46270859": "環境のデータを同期できませんでした。", "4731d4616735186c": "{count, plural, other {{count} 個のサブエージェントを開始しました}}", "885110d4e416d2cd": "{count, plural, other {{count} 個のサブエージェントを実行しました}}", diff --git a/apps/web/src/i18n/translations/ko.json b/apps/web/src/i18n/translations/ko.json index fae8ce2ec6fc4..5d6ab5bfd4c1c 100644 --- a/apps/web/src/i18n/translations/ko.json +++ b/apps/web/src/i18n/translations/ko.json @@ -680,6 +680,8 @@ "b50da99bbfd59a6d": "t3@{version} 업데이트가 롤백되었습니다.", "31dc4da5813e0846": "t3@{version} 업데이트에 실패했습니다.", "b060872e18e91755": "서버 업데이트에 실패했습니다.", + "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}}(으)로 전환을 다시 시도하세요.", + "43ed503038717b90": "서버 업데이트에 실패했습니다:", "a8cb0a2b46270859": "환경 데이터를 동기화할 수 없습니다.", "4731d4616735186c": "{count, plural, other {서브에이전트 {count}개 시작함}}", "885110d4e416d2cd": "{count, plural, other {서브에이전트 {count}개 실행함}}", diff --git a/apps/web/src/i18n/translations/pt-BR.json b/apps/web/src/i18n/translations/pt-BR.json index 7010bef288b16..e82f597cd415a 100644 --- a/apps/web/src/i18n/translations/pt-BR.json +++ b/apps/web/src/i18n/translations/pt-BR.json @@ -680,6 +680,8 @@ "b50da99bbfd59a6d": "A atualização t3@{version} foi revertida.", "31dc4da5813e0846": "A atualização t3@{version} falhou.", "b060872e18e91755": "Falha ao atualizar o servidor.", + "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}}.", + "43ed503038717b90": "Falha ao atualizar o servidor:", "a8cb0a2b46270859": "Não foi possível sincronizar os dados do ambiente.", "4731d4616735186c": "{count, plural, one {{count} subagente iniciado} other {{count} subagentes iniciados}}", "885110d4e416d2cd": "{count, plural, one {{count} subagente executado} other {{count} subagentes executados}}", diff --git a/apps/web/src/i18n/translations/ru.json b/apps/web/src/i18n/translations/ru.json index 0766d953dd02d..faa734bc43bf5 100644 --- a/apps/web/src/i18n/translations/ru.json +++ b/apps/web/src/i18n/translations/ru.json @@ -680,6 +680,8 @@ "b50da99bbfd59a6d": "Обновление t3@{version} откачено.", "31dc4da5813e0846": "Ошибка обновления t3@{version}.", "b060872e18e91755": "Не удалось обновить сервер.", + "77231250643f4943": "Эта сборка {build, select, nightly {Nightly} other {Стабильный}} не может сама обновиться с канала «{saved, select, nightly {Nightly} other {Стабильный}}». Верните канал обновлений на «{build, select, nightly {Nightly} other {Стабильный}}» или нажмите «Ревью» рядом с «Канал обновлений», чтобы повторить переход на «{saved, select, nightly {Nightly} other {Стабильный}}».", + "43ed503038717b90": "Не удалось обновить сервер:", "a8cb0a2b46270859": "Не удалось синхронизировать данные окружения.", "4731d4616735186c": "{count, plural, one {Запущен {count} субагент} few {Запущено {count} субагента} many {Запущено {count} субагентов} other {Запущено {count} субагента}}", "885110d4e416d2cd": "{count, plural, one {Отработал {count} субагент} few {Отработали {count} субагента} many {Отработали {count} субагентов} other {Отработали {count} субагента}}", diff --git a/apps/web/src/i18n/translations/sv.json b/apps/web/src/i18n/translations/sv.json index 5e6d1607edf31..e8d287c12932a 100644 --- a/apps/web/src/i18n/translations/sv.json +++ b/apps/web/src/i18n/translations/sv.json @@ -680,6 +680,8 @@ "b50da99bbfd59a6d": "Uppdateringen till t3@{version} återställdes.", "31dc4da5813e0846": "Uppdateringen till t3@{version} misslyckades.", "b060872e18e91755": "Serveruppdateringen misslyckades.", + "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.", + "43ed503038717b90": "Serveruppdateringen misslyckades:", "a8cb0a2b46270859": "Kunde inte synkronisera miljöns data.", "4731d4616735186c": "{count, plural, one {Startade {count} subagent} other {Startade {count} subagenter}}", "885110d4e416d2cd": "{count, plural, one {Körde {count} subagent} other {Körde {count} subagenter}}", diff --git a/apps/web/src/i18n/translations/zh.json b/apps/web/src/i18n/translations/zh.json index c86b9e6c55e41..937386cb14438 100644 --- a/apps/web/src/i18n/translations/zh.json +++ b/apps/web/src/i18n/translations/zh.json @@ -680,6 +680,8 @@ "b50da99bbfd59a6d": "t3@{version} 更新已回滚。", "31dc4da5813e0846": "t3@{version} 更新失败。", "b060872e18e91755": "服务器更新失败。", + "77231250643f4943": "此 {build, select, nightly {Nightly 版} other {稳定版}} 构建无法自行从 {saved, select, nightly {Nightly 版} other {稳定版}} 通道更新。请将更新通道切回 {build, select, nightly {Nightly 版} other {稳定版}},或使用“更新通道”旁的“查看”重新尝试切换到 {saved, select, nightly {Nightly 版} other {稳定版}}。", + "43ed503038717b90": "服务器更新失败:", "a8cb0a2b46270859": "无法同步环境数据。", "4731d4616735186c": "{count, plural, other {已启动 {count} 个子智能体}}", "885110d4e416d2cd": "{count, plural, other {已运行 {count} 个子智能体}}", diff --git a/packages/client-runtime/src/connection/outdatedHostUpdate.ts b/packages/client-runtime/src/connection/outdatedHostUpdate.ts index 442a54b928ada..0af68e0edc892 100644 --- a/packages/client-runtime/src/connection/outdatedHostUpdate.ts +++ b/packages/client-runtime/src/connection/outdatedHostUpdate.ts @@ -24,7 +24,11 @@ import * as Socket from "effect/socket/Socket"; import { fetchRemoteEnvironmentDescriptor } from "../environment/descriptor.ts"; import { makeWsRpcProtocolClient, PING_TIMEOUT } from "../rpc/protocol.ts"; -import { isLegacyUpdateHandoffLoss, resolveServerUpdateProgressResult } from "../state/server.ts"; +import { + isLegacyUpdateHandoffLoss, + localizeServerSelfUpdateError, + resolveServerUpdateProgressResult, +} from "../state/server.ts"; import * as RelayEnvironmentDiscovery from "../relay/discovery.ts"; import * as ConnectionResolver from "./resolver.ts"; import * as EnvironmentRegistry from "./registry.ts"; @@ -206,7 +210,7 @@ export const updateOutdatedHost = Effect.fn("clientRuntime.connection.updateOutd } return updateResult; }), - ); + ).pipe(Effect.mapError(localizeServerSelfUpdateError)); yield* onStage("resuming"); const pollUrls = [ diff --git a/packages/client-runtime/src/state/server.test.ts b/packages/client-runtime/src/state/server.test.ts index e6ce1725cc15f..24af6cf26fe5c 100644 --- a/packages/client-runtime/src/state/server.test.ts +++ b/packages/client-runtime/src/state/server.test.ts @@ -66,12 +66,14 @@ import { resolveServerUpdateProgressResult, serverUpdateStateForProgressEvent, serverUpdateStateAtom, + serverUpdateFailureText, serverUpdateStateForServerVersion, validateServerUpdateReadyEvent, waitForNextEnvironmentReconnect, waitForDesktopUpdateTarget, runDesktopCommitWithReconnectObserver, } from "./server.ts"; +import { errorDisplayMessage, errorI18nMessage } from "../errors/translatable.ts"; import { applyServerConfigProjection } from "./serverConfigProjection.ts"; const CONFIG = { @@ -238,14 +240,21 @@ describe("accepted server update recovery", () => { { loss: "interrupt", resumes: true }, { loss: "socket", resumes: true }, { loss: "server_error", resumes: false }, + { loss: "track_mismatch", method: "desktop-managed", resumes: false }, + { loss: "track_mismatch", method: "desktop-managed", unary: true, resumes: false }, { loss: "no_progress", resumes: false }, { loss: "cancel", resumes: false }, { loss: "socket", method: "respawn", resumes: true }, { loss: "socket", method: "desktop-managed", resumes: false }, - ] as const)("handles $loss with $method and recovery=$resumes", (scenario) => + ] as const)("handles $loss with $method, unary=$unary and recovery=$resumes", (scenario) => Effect.gen(function* () { const { loss, resumes } = scenario; const method = "method" in scenario ? scenario.method : "boot-service"; + const trackMismatch = new ServerSelfUpdateError({ + reason: + "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.", + trackMismatch: { buildChannel: "latest", savedChannel: "nightly" }, + }); const observing = yield* Deferred.make(); const cancelFiber = yield* Deferred.make>(); const oldReadyObserved = yield* Deferred.make(); @@ -256,7 +265,10 @@ describe("accepted server update recovery", () => { environment: { ...CONFIG.environment, serverVersion: "0.0.30", - capabilities: { serverSelfUpdate: method, serverSelfUpdateProgress: true }, + capabilities: { + serverSelfUpdate: method, + serverSelfUpdateProgress: !("unary" in scenario), + }, }, } as ServerConfig; const ready = (serverVersion: string) => @@ -282,6 +294,7 @@ describe("accepted server update recovery", () => { ), ) : Stream.make(ready("0.0.30")).pipe(Stream.concat(Stream.never)), + [WS_METHODS.serverUpdateServer]: () => Effect.fail(trackMismatch), [WS_METHODS.serverUpdateServerWithProgress]: () => Stream.unwrap( Effect.sync(() => { @@ -305,9 +318,11 @@ describe("accepted server update recovery", () => { ? new ServerSelfUpdateError({ reason: "Archive verification failed.", }) - : new RpcClientError.RpcClientError({ - reason: new Socket.SocketCloseError({ code: 1006 }), - }), + : loss === "track_mismatch" + ? trackMismatch + : new RpcClientError.RpcClientError({ + reason: new Socket.SocketCloseError({ code: 1006 }), + }), ), ), ), @@ -372,10 +387,22 @@ describe("accepted server update recovery", () => { ); if (!resumes) { expect(first).toBe("settled"); - expect(AsyncResult.isFailure(yield* Effect.promise(() => pending))).toBe(true); - expect(registry.get(serverUpdateStateAtom(TARGET.environmentId))).toMatchObject({ - status: "failed", - }); + const failure = yield* Effect.promise(() => pending); + expect(AsyncResult.isFailure(failure)).toBe(true); + const failed = registry.get(serverUpdateStateAtom(TARGET.environmentId)); + expect(failed).toMatchObject({ status: "failed" }); + if ( + loss === "track_mismatch" && + AsyncResult.isFailure(failure) && + failed.status === "failed" + ) { + const cause = Cause.squash(failure.cause); + const marked = errorI18nMessage(cause); + expect(marked).toHaveLength(2); + expect(failed.i18nMessage).toEqual(marked); + expect(errorDisplayMessage(cause)).toBe(trackMismatch.message); + expect(serverUpdateFailureText(failed)).toBe(trackMismatch.message); + } return; } expect(first).toBe("observing"); diff --git a/packages/client-runtime/src/state/server.ts b/packages/client-runtime/src/state/server.ts index cb02405722fe0..1ec0c32aa25ec 100644 --- a/packages/client-runtime/src/state/server.ts +++ b/packages/client-runtime/src/state/server.ts @@ -4,8 +4,10 @@ import { markedTextEnglish, resolveMarkedText, thrownErrorMessage, + withI18nMessage, } from "../errors/translatable.ts"; import { + type DesktopUpdateChannel, type EnvironmentId, type ProviderInstanceId, type ServerConfig, @@ -13,6 +15,7 @@ import { type ServerLifecycleWelcomePayload, type ServerLifecycleStreamReadyEvent, type ServerProviderWorkspaceSnapshot, + ServerSelfUpdateError, type ServerSelfUpdateProgressEvent, type ServerSelfUpdateResult, shouldRecommendDatabaseCompaction, @@ -389,6 +392,29 @@ export function serverUpdateFailure(error: unknown): { : { message: serverUpdateFailureMessage(error), i18nMessage }; } +/** Marked text for a desktop app whose build track differs from its saved update track. */ +export function desktopTrackMismatchText(mismatch: { + readonly buildChannel: DesktopUpdateChannel; + readonly savedChannel: DesktopUpdateChannel; +}): string { + return msg( + "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}}.", + { build: mismatch.buildChannel, saved: mismatch.savedChannel }, + ); +} + +const isServerSelfUpdateError = Schema.is(ServerSelfUpdateError); + +/** Gives a host's track mismatch marked text; older hosts send only the English `reason`. */ +export function localizeServerSelfUpdateError(error: E): E { + if (!isServerSelfUpdateError(error) || error.trackMismatch === undefined) return error; + return withI18nMessage( + error, + msg("Server update failed:"), + desktopTrackMismatchText(error.trackMismatch), + ); +} + export function serverUpdateFailureText( state: Extract, resolve: MFunctionType = mFallback, @@ -1220,7 +1246,7 @@ export function createServerEnvironmentAtoms( targetVersion, }); return updateResult; - }), + }).pipe(Effect.mapError(localizeServerSelfUpdateError)), ); // A track switch's desktop host already on its track's newest build only saved the diff --git a/packages/contracts/src/ipc.ts b/packages/contracts/src/ipc.ts index b44f8e77f239a..e29a4f929d036 100644 --- a/packages/contracts/src/ipc.ts +++ b/packages/contracts/src/ipc.ts @@ -292,6 +292,8 @@ export interface DesktopUpdateState { notAppliedVersion?: string; /** Off only because a managed policy rules out this channel; switching channels turns it on. */ channelBlockedByPolicy?: true; + /** The check failed only because this build's track differs from the saved `channel`. */ + trackMismatch?: { readonly buildChannel: DesktopUpdateChannel }; } export interface DesktopUpdateReleaseNote { @@ -336,6 +338,7 @@ export const DesktopUpdateStateSchema = Schema.Struct({ canRetry: Schema.Boolean, notAppliedVersion: Schema.optionalKey(Schema.String), channelBlockedByPolicy: Schema.optionalKey(Schema.Literal(true)), + trackMismatch: Schema.optionalKey(Schema.Struct({ buildChannel: DesktopUpdateChannelSchema })), }); export const DesktopCliCommandStateSchema = Schema.Struct({ diff --git a/packages/contracts/src/server.ts b/packages/contracts/src/server.ts index 6ba3a09f8053b..93b69646fdb06 100644 --- a/packages/contracts/src/server.ts +++ b/packages/contracts/src/server.ts @@ -1058,6 +1058,13 @@ export class ServerSelfUpdateError extends Schema.TaggedError Date: Wed, 18 Nov 2026 22:05:52 +0000 Subject: [PATCH 5/5] fix(desktop): mismatch checks wait for the published state and never name a blocked track The no-offer case named the build's track even when managed policy blocks it, so the suggested switch always failed. A blocked build track now reports the policy message instead. The mismatch tests await the state the handler publishes rather than yielding once. Model and harness: Claude Opus 5.5 via T3 Code (Claude Code harness). Co-Authored-By: Claude Haiku 5.5 --- .../src/updates/DesktopUpdates.test.ts | 57 ++++++++++++++----- apps/desktop/src/updates/DesktopUpdates.ts | 34 ++++++----- 2 files changed, 63 insertions(+), 28 deletions(-) diff --git a/apps/desktop/src/updates/DesktopUpdates.test.ts b/apps/desktop/src/updates/DesktopUpdates.test.ts index c81d7b94bffe1..535e1123d2911 100644 --- a/apps/desktop/src/updates/DesktopUpdates.test.ts +++ b/apps/desktop/src/updates/DesktopUpdates.test.ts @@ -79,6 +79,17 @@ const stableUpdateInfo = ( }; }; +// Subscribes before emitting, so the state the emit publishes is the one awaited, not a scheduler yield. +const nextPublishedState = (emit: () => void) => + Effect.gen(function* () { + const updates = yield* DesktopUpdates.DesktopUpdates; + const { changes } = yield* updates.subscribe; + const published = yield* Stream.runHead(changes).pipe(Effect.forkChild); + emit(); + yield* Fiber.join(published); + return yield* updates.getState; + }); + describe("DesktopUpdates", () => { it.effect("updates Linux .deb installs and leaves other non-AppImage installs off", () => Effect.gen(function* () { @@ -1191,10 +1202,9 @@ describe("DesktopUpdates", () => { const updates = yield* DesktopUpdates.DesktopUpdates; yield* updates.configure; yield* updates.check("startup"); - harness.emit("update-available", { version: "1.2.4-nightly.20261027.1" }); - yield* flushCallbacks; - - const state = yield* updates.getState; + const state = yield* nextPublishedState(() => + harness.emit("update-available", { version: "1.2.4-nightly.20261027.1" }), + ); assert.equal(state.channel, "nightly"); assert.isNull(state.availableVersion); assert.equal(state.status, "error"); @@ -1214,23 +1224,20 @@ describe("DesktopUpdates", () => { const updates = yield* DesktopUpdates.DesktopUpdates; yield* updates.configure; yield* updates.check("startup"); - harness.emit("update-not-available"); - yield* flushCallbacks; - - const state = yield* updates.getState; + const state = yield* nextPublishedState(() => harness.emit("update-not-available")); assert.equal(state.status, "error"); assert.equal(state.errorContext, "check"); assert.isTrue(state.canRetry); assert.deepEqual(state.trackMismatch, { buildChannel: "latest" }); // A later failure has its own reason, so the mismatch must not stay attached to it. - harness.emit("error", new Error("background updater failure")); - yield* flushCallbacks; - assert.isUndefined((yield* updates.getState).trackMismatch); + const failed = yield* nextPublishedState(() => + harness.emit("error", new Error("background updater failure")), + ); + assert.isUndefined(failed.trackMismatch); - harness.emit("update-not-available"); - yield* flushCallbacks; - assert.isDefined((yield* updates.getState).trackMismatch); + const mismatched = yield* nextPublishedState(() => harness.emit("update-not-available")); + assert.isDefined(mismatched.trackMismatch); yield* updates.check("menu"); assert.equal((yield* updates.getState).status, "checking"); assert.isUndefined((yield* updates.getState).trackMismatch); @@ -1426,6 +1433,28 @@ describe("DesktopUpdates under a managed policy", () => { ).pipe(Effect.provide(Layer.merge(TestClock.layer(), harness.layer))); }); + it.effect("does not name a blocked build track as the one to switch back to", () => { + const harness = makeHarness({ + appVersion: "1.2.4-nightly.20261027.1", + savedChannel: "latest", + policy: managed({ allowNightly: false, feedUrl: "https://updates.example.com/t3code" }), + }); + + return Effect.scoped( + Effect.gen(function* () { + const updates = yield* DesktopUpdates.DesktopUpdates; + yield* updates.configure; + yield* updates.check("startup"); + const state = yield* nextPublishedState(() => harness.emit("update-not-available")); + + assert.equal(state.channel, "latest"); + assert.equal(state.status, "error"); + assert.equal(state.errorContext, "check"); + assert.isUndefined(state.trackMismatch); + }), + ).pipe(Effect.provide(Layer.merge(TestClock.layer(), harness.layer))); + }); + it.effect("does not report the channel as the only block when updates are off anyway", () => { const harness = makeHarness({ appVersion: "1.2.3-nightly.20261028.1", diff --git a/apps/desktop/src/updates/DesktopUpdates.ts b/apps/desktop/src/updates/DesktopUpdates.ts index a265533e2a2e9..7976503d9e761 100644 --- a/apps/desktop/src/updates/DesktopUpdates.ts +++ b/apps/desktop/src/updates/DesktopUpdates.ts @@ -425,20 +425,6 @@ export const make = Effect.gen(function* () { ), ); - // Without a release floor, a build on another track than its saved one never offers anything. - const noOfferState = (state: DesktopUpdateState, checkedAt: string) => - Effect.map(Ref.get(releaseFloorRef), (floor) => { - const buildChannel = desktopUpdateChannelOf(environment.appVersion); - return Option.isNone(floor) && buildChannel !== state.channel - ? reduceDesktopUpdateStateOnCheckFailure( - state, - trackMismatchMessage(buildChannel, state.channel), - checkedAt, - { buildChannel }, - ) - : reduceDesktopUpdateStateOnNoUpdate(state, checkedAt); - }); - const stateChanges = yield* PubSub.sliding(16); // Serialize writes and publishes against subscription so snapshots cannot overlap the first change. const stateMutex = yield* Semaphore.make(1); @@ -517,6 +503,26 @@ export const make = Effect.gen(function* () { ) : Option.none(); + // Without a release floor, a build on another track than its saved one never offers anything. + // A track the policy blocks is never named as the one to switch to. + const noOfferState = (state: DesktopUpdateState, checkedAt: string) => + Effect.map(Ref.get(releaseFloorRef), (floor) => { + const buildChannel = desktopUpdateChannelOf(environment.appVersion); + if (Option.isSome(floor) || buildChannel === state.channel) { + return reduceDesktopUpdateStateOnNoUpdate(state, checkedAt); + } + const blocked = channelBlockedReason(buildChannel); + if (Option.isSome(blocked)) { + return reduceDesktopUpdateStateOnCheckFailure(state, blocked.value, checkedAt); + } + return reduceDesktopUpdateStateOnCheckFailure( + state, + trackMismatchMessage(buildChannel, state.channel), + checkedAt, + { buildChannel }, + ); + }); + const resolveStateDisabledReason = (channel: DesktopUpdateChannel) => resolveDisabledReason.pipe(Effect.map(Option.orElse(() => channelBlockedReason(channel))));