diff --git a/apps/mobile/src/features/settings/SettingsProviderAccountsRouteScreen.tsx b/apps/mobile/src/features/settings/SettingsProviderAccountsRouteScreen.tsx index 76f8ecd032657..0e6cdd3bc82cd 100644 --- a/apps/mobile/src/features/settings/SettingsProviderAccountsRouteScreen.tsx +++ b/apps/mobile/src/features/settings/SettingsProviderAccountsRouteScreen.tsx @@ -137,7 +137,9 @@ function managedProviders( function canManageProvider(provider: ServerProvider) { return Boolean( - provider.setup?.canAuthenticate || (provider.driver === "acpRegistry" && provider.installed), + provider.setup?.canAuthenticate || + provider.setup?.canInstall || + (provider.driver === "acpRegistry" && provider.installed), ); } @@ -155,6 +157,10 @@ function ProviderAccount({ const instanceId = provider.instanceId; const target = { environmentId, input: { instanceId } }; const auth = useEnvironmentQuery(serverEnvironment.providerAuthState(target)); + const installation = useEnvironmentQuery( + provider.setup?.canInstall ? serverEnvironment.providerInstallState(target) : null, + ); + const [installationDetailsOpen, setInstallationDetailsOpen] = useState(false); const options = { reportFailure: false, reportDefect: false }; const start = useAtomCommand(serverEnvironment.startProviderAuth, options); const respond = useAtomCommand(serverEnvironment.respondProviderAuth, options); @@ -438,6 +444,66 @@ function ProviderAccount({ {trailing} + {installation.data?.phase === "failed" && installation.data.diagnostics ? ( + + + {installation.data.message} + + setInstallationDetailsOpen((open) => !open)} + > + + Installation details + + + {installationDetailsOpen ? ( + <> + + {installation.data.diagnostics.step} + + {installation.data.operationId ? ( + + + Attempt: {installation.data.operationId} + + + ) : null} + {installation.data.diagnostics.systemError ? ( + + {installation.data.diagnostics.systemError} + + ) : null} + {installation.data.diagnostics.exitCode !== null ? ( + + + Exit code: {installation.data.diagnostics.exitCode} + + + ) : null} + {installation.data.diagnostics.signal !== null ? ( + + + Exit signal: {installation.data.diagnostics.signal} + + + ) : null} + + + {installation.data.diagnostics.stderr || + gt("No startup error output was captured for this check.")} + + + {installation.data.diagnostics.truncated ? ( + + Some startup output was omitted or truncated. + + ) : null} + + ) : null} + + ) : null} {interaction?.type === "deviceCode" || interaction?.type === "terminal" || interaction?.type === "credentials" || diff --git a/apps/mobile/src/i18n/translations/de.json b/apps/mobile/src/i18n/translations/de.json index 30116da93d8aa..07ee29a2af1fa 100644 --- a/apps/mobile/src/i18n/translations/de.json +++ b/apps/mobile/src/i18n/translations/de.json @@ -5299,5 +5299,32 @@ "ad208e3e32c85029": "Alle ausblenden", "3328503592789bed": "Zen", "856812e7e1fc445e": "Tool-Aufrufe im Chat", - "8d545d54c0a9e950": "Die Befehle, Bearbeitungen und Suchen ausblenden, die Agenten ausführen. „Erfolgreiche ausblenden“ behält Fehler. „Zen“ zeigt nur endgültige Antworten. Genehmigungen, Fragen und Fehler werden immer angezeigt." + "8d545d54c0a9e950": "Die Befehle, Bearbeitungen und Suchen ausblenden, die Agenten ausführen. „Erfolgreiche ausblenden“ behält Fehler. „Zen“ zeigt nur endgültige Antworten. Genehmigungen, Fragen und Fehler werden immer angezeigt.", + "26e91fbabd6c471d": "Bei dieser Prüfung wurden keine Startfehlermeldungen erfasst.", + "2d7af575422e95d4": "Installationsdetails", + "bedf6a1ed148ba26": [ + "Versuch: ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "0997ec42c0537aa5": [ + "Exitcode: ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "1286d1de58e9c93b": [ + "Exit-Signal: ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "bb673f99be9e5122": "Ein Teil der Startausgabe wurde ausgelassen oder gekürzt." } diff --git a/apps/mobile/src/i18n/translations/en.json b/apps/mobile/src/i18n/translations/en.json index a7433f8a74360..015fecc7612de 100644 --- a/apps/mobile/src/i18n/translations/en.json +++ b/apps/mobile/src/i18n/translations/en.json @@ -5300,5 +5300,32 @@ "ad208e3e32c85029": "Hide all", "3328503592789bed": "Zen", "856812e7e1fc445e": "Tool calls in chat", - "8d545d54c0a9e950": "Hide the commands, edits, and searches agents run. Hide successful keeps failures. Zen shows only final answers. Approvals, questions, and errors always show." + "8d545d54c0a9e950": "Hide the commands, edits, and searches agents run. Hide successful keeps failures. Zen shows only final answers. Approvals, questions, and errors always show.", + "26e91fbabd6c471d": "No startup error output was captured for this check.", + "2d7af575422e95d4": "Installation details", + "bedf6a1ed148ba26": [ + "Attempt: ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "0997ec42c0537aa5": [ + "Exit code: ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "1286d1de58e9c93b": [ + "Exit signal: ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "bb673f99be9e5122": "Some startup output was omitted or truncated." } diff --git a/apps/mobile/src/i18n/translations/es.json b/apps/mobile/src/i18n/translations/es.json index 5b7e4a1df6b1f..3fd838b320213 100644 --- a/apps/mobile/src/i18n/translations/es.json +++ b/apps/mobile/src/i18n/translations/es.json @@ -5293,5 +5293,32 @@ "ad208e3e32c85029": "Ocultar todo", "3328503592789bed": "Zen", "856812e7e1fc445e": "Llamadas a herramientas en el chat", - "8d545d54c0a9e950": "Oculta los comandos, ediciones y búsquedas que ejecutan los agentes. Ocultar las correctas mantiene los fallos. Zen solo muestra las respuestas finales. Las aprobaciones, preguntas y errores siempre se muestran." + "8d545d54c0a9e950": "Oculta los comandos, ediciones y búsquedas que ejecutan los agentes. Ocultar las correctas mantiene los fallos. Zen solo muestra las respuestas finales. Las aprobaciones, preguntas y errores siempre se muestran.", + "26e91fbabd6c471d": "No se registraron errores de inicio durante esta comprobación.", + "2d7af575422e95d4": "Detalles de instalación", + "bedf6a1ed148ba26": [ + "Intento: ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "0997ec42c0537aa5": [ + "Código de salida: ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "1286d1de58e9c93b": [ + "Señal de salida: ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "bb673f99be9e5122": "Parte de la salida de inicio se omitió o se truncó." } diff --git a/apps/mobile/src/i18n/translations/fr.json b/apps/mobile/src/i18n/translations/fr.json index 791e9bdbb1bdd..bf59773452535 100644 --- a/apps/mobile/src/i18n/translations/fr.json +++ b/apps/mobile/src/i18n/translations/fr.json @@ -5293,5 +5293,32 @@ "ad208e3e32c85029": "Tout masquer", "3328503592789bed": "Zen", "856812e7e1fc445e": "Appels d’outils dans la discussion", - "8d545d54c0a9e950": "Masque les commandes, modifications et recherches lancées par les agents. Masquer les réussis garde les échecs. Zen n’affiche que les réponses finales. Les approbations, questions et erreurs s’affichent toujours." + "8d545d54c0a9e950": "Masque les commandes, modifications et recherches lancées par les agents. Masquer les réussis garde les échecs. Zen n’affiche que les réponses finales. Les approbations, questions et erreurs s’affichent toujours.", + "26e91fbabd6c471d": "Aucune sortie d’erreur au démarrage n’a été capturée pour cette vérification.", + "2d7af575422e95d4": "Détails de l’installation", + "bedf6a1ed148ba26": [ + "Tentative : ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "0997ec42c0537aa5": [ + "Code de sortie : ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "1286d1de58e9c93b": [ + "Signal de sortie : ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "bb673f99be9e5122": "Une partie de la sortie de démarrage a été omise ou tronquée." } diff --git a/apps/mobile/src/i18n/translations/ja.json b/apps/mobile/src/i18n/translations/ja.json index 991bb7852b731..0be82a7d48965 100644 --- a/apps/mobile/src/i18n/translations/ja.json +++ b/apps/mobile/src/i18n/translations/ja.json @@ -5275,5 +5275,32 @@ "ad208e3e32c85029": "すべて非表示", "3328503592789bed": "Zen", "856812e7e1fc445e": "チャット内のツール呼び出し", - "8d545d54c0a9e950": "エージェントが実行するコマンド、編集、検索を非表示にします。「成功したものを非表示」では失敗は表示されます。Zen では最終的な回答だけを表示します。承認、質問、エラーは常に表示されます。" + "8d545d54c0a9e950": "エージェントが実行するコマンド、編集、検索を非表示にします。「成功したものを非表示」では失敗は表示されます。Zen では最終的な回答だけを表示します。承認、質問、エラーは常に表示されます。", + "26e91fbabd6c471d": "このチェックでは起動時のエラー出力は取得されませんでした。", + "2d7af575422e95d4": "インストールの詳細", + "bedf6a1ed148ba26": [ + "試行: ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "0997ec42c0537aa5": [ + "終了コード: ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "1286d1de58e9c93b": [ + "終了シグナル: ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "bb673f99be9e5122": "起動時の出力の一部が省略または切り詰められました。" } diff --git a/apps/mobile/src/i18n/translations/ko.json b/apps/mobile/src/i18n/translations/ko.json index 6b91487ccbbc5..54690ad12f9af 100644 --- a/apps/mobile/src/i18n/translations/ko.json +++ b/apps/mobile/src/i18n/translations/ko.json @@ -5279,5 +5279,32 @@ "ad208e3e32c85029": "모두 숨기기", "3328503592789bed": "Zen", "856812e7e1fc445e": "채팅의 도구 호출", - "8d545d54c0a9e950": "에이전트가 실행하는 명령, 편집, 검색을 숨깁니다. 성공한 항목 숨기기는 실패를 남겨 둡니다. Zen은 최종 답변만 표시합니다. 승인, 질문, 오류는 항상 표시됩니다." + "8d545d54c0a9e950": "에이전트가 실행하는 명령, 편집, 검색을 숨깁니다. 성공한 항목 숨기기는 실패를 남겨 둡니다. Zen은 최종 답변만 표시합니다. 승인, 질문, 오류는 항상 표시됩니다.", + "26e91fbabd6c471d": "이 검사에서는 시작 오류 출력이 수집되지 않았습니다.", + "2d7af575422e95d4": "설치 세부 정보", + "bedf6a1ed148ba26": [ + "시도: ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "0997ec42c0537aa5": [ + "종료 코드: ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "1286d1de58e9c93b": [ + "종료 신호: ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "bb673f99be9e5122": "시작 출력의 일부가 생략되거나 잘렸습니다." } diff --git a/apps/mobile/src/i18n/translations/pt-BR.json b/apps/mobile/src/i18n/translations/pt-BR.json index 251993b1b9210..7f0f63c4eb21c 100644 --- a/apps/mobile/src/i18n/translations/pt-BR.json +++ b/apps/mobile/src/i18n/translations/pt-BR.json @@ -5293,5 +5293,32 @@ "ad208e3e32c85029": "Ocultar todas", "3328503592789bed": "Zen", "856812e7e1fc445e": "Chamadas de ferramentas no chat", - "8d545d54c0a9e950": "Oculta os comandos, edições e pesquisas que os agentes executam. \"Ocultar bem-sucedidas\" mantém as falhas. Zen mostra só as respostas finais. Aprovações, perguntas e erros sempre aparecem." + "8d545d54c0a9e950": "Oculta os comandos, edições e pesquisas que os agentes executam. \"Ocultar bem-sucedidas\" mantém as falhas. Zen mostra só as respostas finais. Aprovações, perguntas e erros sempre aparecem.", + "26e91fbabd6c471d": "Nenhuma saída de erro na inicialização foi capturada nesta verificação.", + "2d7af575422e95d4": "Detalhes da instalação", + "bedf6a1ed148ba26": [ + "Tentativa: ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "0997ec42c0537aa5": [ + "Código de saída: ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "1286d1de58e9c93b": [ + "Sinal de saída: ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "bb673f99be9e5122": "Parte da saída de inicialização foi omitida ou truncada." } diff --git a/apps/mobile/src/i18n/translations/ru.json b/apps/mobile/src/i18n/translations/ru.json index eb53bc6a85093..b14c23b9e7c17 100644 --- a/apps/mobile/src/i18n/translations/ru.json +++ b/apps/mobile/src/i18n/translations/ru.json @@ -5373,5 +5373,32 @@ "ad208e3e32c85029": "Скрывать все", "3328503592789bed": "Дзен", "856812e7e1fc445e": "Вызовы инструментов в чате", - "8d545d54c0a9e950": "Скрывать команды, правки и поиски, которые выполняют агенты. «Скрывать успешные» оставляет ошибки. «Дзен» показывает только итоговые ответы. Запросы подтверждения, вопросы и ошибки показываются всегда." + "8d545d54c0a9e950": "Скрывать команды, правки и поиски, которые выполняют агенты. «Скрывать успешные» оставляет ошибки. «Дзен» показывает только итоговые ответы. Запросы подтверждения, вопросы и ошибки показываются всегда.", + "26e91fbabd6c471d": "При этой проверке вывод ошибок запуска не был получен.", + "2d7af575422e95d4": "Сведения об установке", + "bedf6a1ed148ba26": [ + "Попытка: ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "0997ec42c0537aa5": [ + "Код завершения: ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "1286d1de58e9c93b": [ + "Сигнал завершения: ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "bb673f99be9e5122": "Часть вывода при запуске была пропущена или обрезана." } diff --git a/apps/mobile/src/i18n/translations/sv.json b/apps/mobile/src/i18n/translations/sv.json index 0b335f057cdce..04bae514bd701 100644 --- a/apps/mobile/src/i18n/translations/sv.json +++ b/apps/mobile/src/i18n/translations/sv.json @@ -5299,5 +5299,32 @@ "ad208e3e32c85029": "Dölj alla", "3328503592789bed": "Zen", "856812e7e1fc445e": "Verktygsanrop i chatten", - "8d545d54c0a9e950": "Dölj kommandon, redigeringar och sökningar som agenter kör. Dölj lyckade behåller misslyckanden. Zen visar bara slutliga svar. Godkännanden, frågor och fel visas alltid." + "8d545d54c0a9e950": "Dölj kommandon, redigeringar och sökningar som agenter kör. Dölj lyckade behåller misslyckanden. Zen visar bara slutliga svar. Godkännanden, frågor och fel visas alltid.", + "26e91fbabd6c471d": "Inga startfelmeddelanden fångades vid den här kontrollen.", + "2d7af575422e95d4": "Installationsdetaljer", + "bedf6a1ed148ba26": [ + "Försök: ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "0997ec42c0537aa5": [ + "Avslutningskod: ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "1286d1de58e9c93b": [ + "Avslutningssignal: ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "bb673f99be9e5122": "En del av startutdata utelämnades eller förkortades." } diff --git a/apps/mobile/src/i18n/translations/zh.json b/apps/mobile/src/i18n/translations/zh.json index 9002438aed15e..881eb026943ef 100644 --- a/apps/mobile/src/i18n/translations/zh.json +++ b/apps/mobile/src/i18n/translations/zh.json @@ -5284,5 +5284,32 @@ "ad208e3e32c85029": "全部隐藏", "3328503592789bed": "专注模式", "856812e7e1fc445e": "聊天中的工具调用", - "8d545d54c0a9e950": "隐藏智能体执行的命令、编辑和搜索。“隐藏成功的调用”仍保留失败项;“专注模式”仅显示最终回答。审批、提问和错误始终显示。" + "8d545d54c0a9e950": "隐藏智能体执行的命令、编辑和搜索。“隐藏成功的调用”仍保留失败项;“专注模式”仅显示最终回答。审批、提问和错误始终显示。", + "26e91fbabd6c471d": "此项检查未捕获到启动错误输出。", + "2d7af575422e95d4": "安装详情", + "bedf6a1ed148ba26": [ + "尝试:", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "0997ec42c0537aa5": [ + "退出代码:", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "1286d1de58e9c93b": [ + "退出信号:", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "bb673f99be9e5122": "部分启动输出已省略或截断。" } diff --git a/apps/server/src/provider/AntigravityInstallation.test.ts b/apps/server/src/provider/AntigravityInstallation.test.ts index c6d4ec31ac4be..c3e16fe354408 100644 --- a/apps/server/src/provider/AntigravityInstallation.test.ts +++ b/apps/server/src/provider/AntigravityInstallation.test.ts @@ -25,6 +25,7 @@ import * as ChildProcessSpawner from "effect/process/ChildProcessSpawner"; import * as AntigravityInstallation from "./AntigravityInstallation.ts"; import * as ModelManifest from "./ModelManifest.ts"; +import { ANTIGRAVITY_AUTH_BROWSER_MARKER } from "./antigravityAuthSupport.ts"; import { type AntigravityReleaseAsset } from "./antigravityRelease.ts"; const serverContents = "antigravity runtime\n"; @@ -719,6 +720,67 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("Antigravity inst }), ); + it.effect("retains startup diagnostics when ACP initialization times out", () => + Effect.gen(function* () { + const entered = yield* Deferred.make(); + const encoder = new TextEncoder(); + const preflightUrl = "https://example.invalid/t3-antigravity-browser-preflight"; + const spawner = ChildProcessSpawner.make((command) => { + const preflight = + ChildProcess.isStandardCommand(command) && command.args.at(-1) === preflightUrl; + return Effect.succeed( + ChildProcessSpawner.makeHandle({ + pid: ChildProcessSpawner.ProcessId(1), + exitCode: preflight ? Effect.succeed(ChildProcessSpawner.ExitCode(0)) : Effect.never, + isRunning: Effect.succeed(true), + kill: () => Effect.void, + unref: Effect.succeed(Effect.void), + stdin: Sink.drain, + stdout: preflight ? Stream.empty : Stream.never, + stderr: preflight + ? Stream.succeed( + encoder.encode(`${ANTIGRAVITY_AUTH_BROWSER_MARKER}"${preflightUrl}"\n`), + ) + : Stream.succeed( + encoder.encode( + "Could not initialize local harness\nAuthorization: Bearer private-fixture-token\n", + ), + ).pipe(Stream.tap(() => Deferred.succeed(entered, undefined))), + all: Stream.empty, + getInputFd: () => Sink.drain, + getOutputFd: () => Stream.empty, + }), + ); + }); + const { installation } = yield* makeHarness({ + previous: true, + useDefaultValidation: true, + spawner, + }); + yield* installation.start; + yield* Deferred.await(entered); + yield* TestClock.adjust("90 seconds"); + const failed = yield* terminalState(installation); + expect(failed).toMatchObject({ + phase: "failed", + message: expect.stringContaining( + "Antigravity runtime verification timed out after 90 seconds.", + ), + diagnostics: { + step: "Antigravity initialization", + stderr: "Could not initialize local harness\nAuthorization: [redacted]", + exitCode: null, + signal: null, + truncated: false, + }, + }); + yield* expectPreviousRelease(installation); + expect((yield* installation.start).diagnostics).toBeNull(); + const running = yield* installation.state; + expect((yield* installation.cancel(running.operationId!)).diagnostics).toBeNull(); + }), + ); + it.effect.each(["downloaded", "existing", "concurrent"] as const)( "reports a verification timeout for a %s runtime without changing the active release", (source) => @@ -766,8 +828,9 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("Antigravity inst yield* TestClock.adjust("90 seconds"); expect(yield* terminalState(installation)).toMatchObject({ phase: "failed", - message: - "Antigravity runtime verification timed out after 90 seconds. Check this environment's server logs for startup errors, then retry installation.", + message: expect.stringContaining( + "Antigravity runtime verification timed out after 90 seconds.", + ), }); if (source !== "existing") yield* Deferred.await(stagingReleased); yield* expectPreviousRelease(installation); diff --git a/apps/server/src/provider/AntigravityInstallation.ts b/apps/server/src/provider/AntigravityInstallation.ts index 0953323e2dbc5..c1b14bef0c23d 100644 --- a/apps/server/src/provider/AntigravityInstallation.ts +++ b/apps/server/src/provider/AntigravityInstallation.ts @@ -5,7 +5,11 @@ import { resolveProviderCompatibility } from "./providerCompatibility.ts"; import { cliArchiveTarCommand } from "@t3tools/shared/cliRelease"; import { compareSemverVersions } from "@t3tools/shared/semver"; import * as EffectNodeStream from "@effect/platform-node/NodeStream"; -import { ProviderDriverKind, type ProviderInstallState } from "@t3tools/contracts"; +import { + ProviderDriverKind, + type ProviderInstallDiagnostics, + type ProviderInstallState, +} from "@t3tools/contracts"; import * as HostProcess from "@t3tools/shared/HostProcess"; import { resolveNodeExecutable, nodeRuntimeUnavailableMessage } from "@t3tools/shared/nodeRuntime"; import { resolveCommandPath } from "@t3tools/shared/shell"; @@ -26,6 +30,7 @@ import * as Schedule from "effect/Schedule"; import * as Scope from "effect/Scope"; import * as Semaphore from "effect/Semaphore"; import * as Stream from "effect/Stream"; +import * as Ref from "effect/Ref"; import * as SubscriptionRef from "effect/SubscriptionRef"; import { HttpClient, HttpClientError, HttpClientRequest, HttpClientResponse } from "effect/http"; import * as ChildProcess from "effect/process/ChildProcess"; @@ -49,6 +54,7 @@ import { prepareAntigravityProfile, } from "./antigravityAuthSupport.ts"; import { type AntigravityReleaseAsset } from "./antigravityRelease.ts"; +import { makeInstallationDiagnostics } from "./installationDiagnostics.ts"; const DRIVER = ProviderDriverKind.make("antigravity"); const DOWNLOAD_TIMEOUT = "45 minutes"; @@ -206,6 +212,7 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma const platform = yield* HostProcess.Platform; const arch = yield* HostProcess.Architecture; const environment = yield* HostProcess.Environment; + const homeDirectory = yield* HostProcess.HomeDirectory; let releaseAsset = options.releaseAsset ?? null; const supported = options.releaseAsset === undefined @@ -494,20 +501,19 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma ), ); + const validationTimeoutError = installationError( + "verify", + "Antigravity runtime verification timed out after 90 seconds. Review Installation details or this environment's server log, then retry installation.", + ); const withValidationTimeout = Effect.timeoutOrElse({ duration: VALIDATION_TIMEOUT, - orElse: () => - Effect.fail( - installationError( - "verify", - "Antigravity runtime verification timed out after 90 seconds. Check this environment's server logs for startup errors, then retry installation.", - ), - ), + orElse: () => Effect.fail(validationTimeoutError), }); - const validate = + const validateRuntime = options.validate ?? Effect.fn("AntigravityInstallation.validate")( function* (executable: AntigravityExecutable, expectedVersion: string) { + const runtimeSpawner = yield* ChildProcessSpawner.ChildProcessSpawner; const validationScope = yield* Effect.scope; const profileDirectory = yield* Effect.acquireRelease( fs.makeTempDirectory({ prefix: "t3-antigravity-validate-" }), @@ -522,7 +528,7 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma baseEnv: environment, // A shallow scoped profile cleans up unpacked files within Windows' path limit. tempDirectory: profileDirectory, - }); + }).pipe(Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner)); const runtime = yield* makeAntigravityAcpRuntime({ runtimeVersion: expectedVersion, spawn: buildAntigravityAcpSpawnInput({ @@ -536,7 +542,7 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma platform === "win32" ? ChildProcessSpawner.make( Effect.fnUntraced(function* (command) { - const child = yield* spawner.spawn(command); + const child = yield* runtimeSpawner.spawn(command); // Stop PyInstaller's tree before ACP closes pipes; after launcher exit, taskkill cannot reach children holding DLLs open. yield* Scope.addFinalizer( validationScope, @@ -545,7 +551,7 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma return child; }), ) - : spawner, + : runtimeSpawner, }); const initialized = yield* runtime.initialize(); if ( @@ -568,7 +574,6 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma }, Effect.provideService(FileSystem.FileSystem, fs), Effect.provideService(Path.Path, path), - Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner), Effect.provideService(SecureRandom.SecureRandom, random), Effect.mapError((cause) => { if (isInstallationError(cause)) return cause; @@ -582,6 +587,42 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma }), ); + const validate = Effect.fn("AntigravityInstallation.verify")(function* ( + executable: AntigravityExecutable, + expectedVersion: string, + verificationDiagnostics: Ref.Ref, + ) { + const capture = yield* makeInstallationDiagnostics("Antigravity initialization").pipe( + Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner), + Effect.provideService(HostProcess.Environment, environment), + Effect.provideService(HostProcess.HomeDirectory, homeDirectory), + ); + return yield* validateRuntime(executable, expectedVersion).pipe( + Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, capture.spawner), + Effect.scoped, + withValidationTimeout, + Effect.tapError((error) => + Effect.gen(function* () { + const diagnostics = { + ...capture.snapshot(isAcpProcessExitedError(error.cause) ? error.cause : undefined), + ...(error === validationTimeoutError ? { exitCode: null, signal: null } : {}), + }; + yield* Ref.set(verificationDiagnostics, diagnostics); + const { operationId } = yield* SubscriptionRef.get(state); + yield* Effect.logWarning("Managed runtime verification failed", { + driver: DRIVER, + operationId, + step: diagnostics.step, + exitCode: diagnostics.exitCode, + signal: diagnostics.signal, + systemError: diagnostics.systemError, + stderrChars: diagnostics.stderr.length, + truncated: diagnostics.truncated, + }); + }), + ), + ); + }); // Each update lands in its own directory. Best effort: a busy gate means a session is // resolving, so the next start or update finishes the cleanup. const pruneInactiveReleases = Effect.gen(function* () { @@ -599,7 +640,10 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma ); const install = Effect.fn("AntigravityInstallation.install")( - function* (asset: AntigravityReleaseAsset | AntigravityCliReleaseAsset) { + function* ( + asset: AntigravityReleaseAsset | AntigravityCliReleaseAsset, + verificationDiagnostics: Ref.Ref, + ) { yield* ensureEligible(asset.version); const cli = "sha512" in asset; // Existing installation records use 64-character IDs, including native SHA-512 prefixes. @@ -674,7 +718,7 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma ); } yield* report("verifying", "Checking the installed runtime."); - yield* validate(existing, asset.version).pipe(Effect.scoped, withValidationTimeout); + yield* validate(existing, asset.version, verificationDiagnostics); yield* activate(); return; } @@ -931,7 +975,8 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma managedVersionDirectory: pairDirectory, }, asset.version, - ).pipe(Effect.scoped, withValidationTimeout); + verificationDiagnostics, + ); const record: InstalledRelease = { releaseId, version: asset.version, @@ -955,7 +1000,7 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma completedRelease(releaseId).pipe( Effect.flatMap((existing) => existing.version === asset.version - ? validate(existing, asset.version).pipe(Effect.scoped, withValidationTimeout) + ? validate(existing, asset.version, verificationDiagnostics) : Effect.fail( installationError( "activate", @@ -1073,18 +1118,18 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma version: reuse?.version ?? asset?.version ?? null, installedVersion: current.installedVersion, canRemove: current.canRemove, + diagnostics: null, message: reuse === undefined ? "Downloading Google's official Antigravity runtime." : "Checking the installed runtime.", }; yield* SubscriptionRef.set(state, next); + const verificationDiagnostics = yield* Ref.make(null); const work = ( reuse === undefined - ? install(asset!) - : validate(reuse, reuse.version!).pipe( - Effect.scoped, - withValidationTimeout, + ? install(asset!, verificationDiagnostics) + : validate(reuse, reuse.version!, verificationDiagnostics).pipe( Effect.andThen(ensureEligible(reuse.version!)), Effect.andThen( SubscriptionRef.update(state, (value) => ({ @@ -1101,21 +1146,26 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma ), Effect.onExit((exit) => Exit.isFailure(exit) - ? SubscriptionRef.update(state, (value) => { - if (value.operationId !== operationId || value.phase === "succeeded") - return value; - const error = Cause.findErrorOption(exit.cause); - const cancelled = Cause.hasInterruptsOnly(exit.cause); - return { - ...value, - phase: cancelled ? "cancelled" : "failed", - message: cancelled - ? "Installation cancelled. The previous runtime is unchanged." - : Option.isSome(error) - ? error.value.detail - : "Could not finish the Antigravity installation. Check disk space and directory access.", - } satisfies ProviderInstallState; - }) + ? Ref.get(verificationDiagnostics).pipe( + Effect.flatMap((diagnostics) => + SubscriptionRef.update(state, (value) => { + if (value.operationId !== operationId || value.phase === "succeeded") + return value; + const error = Cause.findErrorOption(exit.cause); + const cancelled = Cause.hasInterruptsOnly(exit.cause); + return { + ...value, + phase: cancelled ? "cancelled" : "failed", + diagnostics: cancelled ? null : diagnostics, + message: cancelled + ? "Installation cancelled. The previous runtime is unchanged." + : Option.isSome(error) + ? error.value.detail + : "Could not finish the Antigravity installation. Check disk space and directory access.", + } satisfies ProviderInstallState; + }), + ), + ) : Effect.void, ), Effect.ignoreCause, @@ -1193,6 +1243,7 @@ export const makeAntigravityInstallation = Effect.fn("AntigravityInstallation.ma installedVersion: null, canRemove: false, message: null, + diagnostics: null, }) satisfies ProviderInstallState, ); }).pipe(Effect.uninterruptible), diff --git a/apps/server/src/provider/CodexInstallation.test.ts b/apps/server/src/provider/CodexInstallation.test.ts index a000aacb103d3..40477414f775e 100644 --- a/apps/server/src/provider/CodexInstallation.test.ts +++ b/apps/server/src/provider/CodexInstallation.test.ts @@ -14,6 +14,7 @@ import * as PlatformError from "effect/PlatformError"; import * as Exit from "effect/Exit"; import * as Queue from "effect/Queue"; import * as Scope from "effect/Scope"; +import * as Sink from "effect/Sink"; import * as Stream from "effect/Stream"; import { HttpClient, HttpClientError, HttpClientRequest, HttpClientResponse } from "effect/http"; import * as TestClock from "effect/testing/TestClock"; @@ -40,6 +41,7 @@ const makeHarness = Effect.fn("test.makeCodexInstallation")(function* ( local?: { version: string; appServerFails?: boolean; versionFails?: boolean }; platform?: NodeJS.Platform; spawner?: ChildProcessSpawner.ChildProcessSpawner["Service"]; + useDefaultValidation?: boolean; runtimeRenameFailures?: number; /** Served by URL instead of the pinned package. */ responses?: Readonly Response>>; @@ -89,7 +91,7 @@ const makeHarness = Effect.fn("test.makeCodexInstallation")(function* ( const installation = yield* CodexInstallation.makeCodexInstallation({ baseDir, releaseAsset: { ...asset, sha256 }, - validate: () => Effect.void, + ...(input.useDefaultValidation ? {} : { validate: () => Effect.void }), ...input.options, }).pipe( Effect.provideService(ModelManifest.ModelManifest, { @@ -461,9 +463,14 @@ it.effect( }).pipe(Effect.scoped, Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))), ); -it.effect.each(["cached update", "reverify"] as const)( - "reports a verification timeout during %s and preserves the managed runtime", - (operation) => +it.effect.each([ + { operation: "cached update", exits: false }, + { operation: "reverify", exits: false }, + { operation: "cached update", exits: true }, + { operation: "cached update", exits: true, pipesOpen: true }, +])( + "reports verification diagnostics during $operation (exited: $exits) and preserves the managed runtime", + ({ operation, exits, pipesOpen }) => Effect.gen(function* () { const fs = yield* FileSystem.FileSystem; const baseDir = yield* fs.makeTempDirectoryScoped({ prefix: "t3-codex-verify-test-" }); @@ -490,9 +497,41 @@ it.effect.each(["cached update", "reverify"] as const)( const pointer = JSON.stringify({ version: installedVersion }); yield* fs.writeFileString(`${managed}/active.json`, pointer); const entered = yield* Deferred.make(); + const exited = yield* Deferred.make(); + const spawner = ChildProcessSpawner.make(() => + Effect.succeed( + ChildProcessSpawner.makeHandle({ + pid: ChildProcessSpawner.ProcessId(1), + exitCode: exits + ? Deferred.await(entered).pipe( + Effect.andThen(Deferred.succeed(exited, undefined)), + Effect.as(ChildProcessSpawner.ExitCode(3)), + ) + : Effect.never, + isRunning: Effect.succeed(true), + kill: () => Effect.void, + unref: Effect.succeed(Effect.void), + stdin: Sink.drain, + stdout: Stream.empty, + stderr: Stream.succeed( + new TextEncoder().encode( + "Startup library missing\nAuthorization: Bearer private-fixture-token\n", + ), + ).pipe( + Stream.tap(() => Deferred.succeed(entered, undefined)), + (stream) => (pipesOpen ? Stream.concat(stream, Stream.never) : stream), + ), + all: Stream.empty, + getInputFd: () => Sink.drain, + getOutputFd: () => Stream.empty, + }), + ), + ); const h = yield* makeHarness({ baseDir, platform: "win32", + spawner, + useDefaultValidation: true, manifestCurrent: Effect.succeed({ ...ModelManifest.BUNDLED_MODEL_MANIFEST, compatibility: [ @@ -505,21 +544,35 @@ it.effect.each(["cached update", "reverify"] as const)( }), options: { releaseAsset: operation === "reverify" ? null : { ...asset, target, sha256: checksum }, - validate: () => Deferred.succeed(entered, undefined).pipe(Effect.andThen(Effect.never)), }, }); yield* h.installation.start; yield* Deferred.await(entered); - yield* TestClock.adjust("90 seconds"); + if (pipesOpen) yield* Deferred.await(exited); + if (!exits || pipesOpen) yield* TestClock.adjust("90 seconds"); expect(yield* terminalState(h.installation)).toMatchObject({ phase: "failed", installedVersion, message: - "Codex runtime verification timed out after 90 seconds. Check this environment's server logs for startup errors, then retry installation.", + exits && !pipesOpen + ? "Could not unpack or start the downloaded Codex package." + : expect.stringContaining("Codex runtime verification timed out after 90 seconds."), + diagnostics: { + step: "Codex version check", + stderr: "Startup library missing\nAuthorization: [redacted]", + exitCode: exits ? 3 : null, + signal: null, + truncated: false, + }, }); expect(yield* fs.readFileString(`${managed}/active.json`)).toBe(pointer); expect((yield* h.installation.resolve()).version).toBe(installedVersion); expect(h.downloads()).toBe(0); + if (!exits) { + expect((yield* h.installation.start).diagnostics).toBeNull(); + const running = yield* h.installation.state; + expect((yield* h.installation.cancel(running.operationId!)).diagnostics).toBeNull(); + } }).pipe(Effect.scoped, Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))), ); diff --git a/apps/server/src/provider/CodexInstallation.ts b/apps/server/src/provider/CodexInstallation.ts index 87660f0c41800..8a8441c87cfe9 100644 --- a/apps/server/src/provider/CodexInstallation.ts +++ b/apps/server/src/provider/CodexInstallation.ts @@ -1,6 +1,7 @@ // @effect-diagnostics nodeBuiltinImport:off - Effect has no incremental digest. import { ProviderDriverKind, + type ProviderInstallDiagnostics, type ProviderInstallState, type ServerProviderCompatibilityAdvisory, } from "@t3tools/contracts"; @@ -24,6 +25,7 @@ import * as Schema from "effect/Schema"; import * as Scope from "effect/Scope"; import * as Semaphore from "effect/Semaphore"; import * as Stream from "effect/Stream"; +import * as Ref from "effect/Ref"; import * as SubscriptionRef from "effect/SubscriptionRef"; import { HttpClient, HttpClientRequest, HttpClientResponse } from "effect/http"; import { ChildProcess, ChildProcessSpawner } from "effect/process"; @@ -32,6 +34,7 @@ import * as ServerConfig from "../config.ts"; import { selectManagedRelease } from "./managedRelease.ts"; import * as ModelManifest from "./ModelManifest.ts"; import { resolveProviderCompatibility } from "./providerCompatibility.ts"; +import { makeInstallationDiagnostics } from "./installationDiagnostics.ts"; const DRIVER = ProviderDriverKind.make("codex"); const STAGING_STALE_AFTER_MS = 24 * 60 * 60_000; @@ -191,6 +194,7 @@ export const makeCodexInstallation = Effect.fn("makeCodexInstallation")(function const serviceScope = yield* Effect.scope; const platform = yield* HostProcess.Platform; const environment = yield* HostProcess.Environment; + const homeDirectory = yield* HostProcess.HomeDirectory; const arch = yield* HostProcess.Architecture; const asset = options.releaseAsset === undefined @@ -417,7 +421,8 @@ export const makeCodexInstallation = Effect.fn("makeCodexInstallation")(function const resolved = yield* resolveSpawnCommand(command, args).pipe( Effect.provideService(HostProcess.Platform, platform), ); - const child = yield* spawner.spawn( + const commandSpawner = yield* ChildProcessSpawner.ChildProcessSpawner; + const child = yield* commandSpawner.spawn( ChildProcess.make(resolved.command, resolved.args, { shell: resolved.shell }), ); const [output, , exitCode] = yield* Effect.all( @@ -521,6 +526,7 @@ export const makeCodexInstallation = Effect.fn("makeCodexInstallation")(function const advisory = yield* compatibility(executable.version); return advisory?.status === "supported" ? executable : null; }, + Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner), Effect.orElseSucceed(() => null), ); const resolve = Effect.fn("CodexInstallation.resolve")(function* () { @@ -543,21 +549,27 @@ export const makeCodexInstallation = Effect.fn("makeCodexInstallation")(function downloadedBytes: 0, totalBytes: null, message: null, + diagnostics: null, }) satisfies ProviderInstallState, ); return true; }); + const validationTimeoutError = installationError( + "verify", + "Codex runtime verification timed out after 90 seconds. Review Installation details or this environment's server log, then retry installation.", + ); const withValidationTimeout = Effect.timeoutOrElse({ duration: "90 seconds", - orElse: () => - Effect.fail( - installationError( - "verify", - "Codex runtime verification timed out after 90 seconds. Check this environment's server logs for startup errors, then retry installation.", - ), - ), + orElse: () => Effect.fail(validationTimeoutError), }); - const validate = + const validateRuntime: ( + executable: CodexExecutable, + version: string, + ) => Effect.Effect< + void, + CodexInstallationError, + Scope.Scope | ChildProcessSpawner.ChildProcessSpawner + > = options.validate ?? Effect.fn("CodexInstallation.validate")( function* (executable: CodexExecutable, version: string) { @@ -570,6 +582,39 @@ export const makeCodexInstallation = Effect.fn("makeCodexInstallation")(function }, Effect.mapError(wrapFailure("verify", "The downloaded Codex runtime could not start.")), ); + const validate = Effect.fn("CodexInstallation.verify")(function* ( + executable: CodexExecutable, + version: string, + verificationDiagnostics: Ref.Ref, + ) { + const capture = yield* makeInstallationDiagnostics("Codex version check").pipe( + Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner), + Effect.provideService(HostProcess.Environment, environment), + Effect.provideService(HostProcess.HomeDirectory, homeDirectory), + ); + return yield* validateRuntime(executable, version).pipe( + Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, capture.spawner), + Effect.scoped, + withValidationTimeout, + Effect.tapError(() => + Effect.gen(function* () { + const diagnostics = capture.snapshot(); + yield* Ref.set(verificationDiagnostics, diagnostics); + const { operationId } = yield* SubscriptionRef.get(state); + yield* Effect.logWarning("Managed runtime verification failed", { + driver: DRIVER, + operationId, + step: diagnostics.step, + exitCode: diagnostics.exitCode, + signal: diagnostics.signal, + systemError: diagnostics.systemError, + stderrChars: diagnostics.stderr.length, + truncated: diagnostics.truncated, + }); + }), + ), + ); + }); // Each update lands in its own directory. Best effort: a busy gate means a session is // resolving, so the next start or update finishes the cleanup. const pruneInactiveReleases = Effect.gen(function* () { @@ -591,7 +636,10 @@ export const makeCodexInstallation = Effect.fn("makeCodexInstallation")(function ); const install = Effect.fn("CodexInstallation.install")( - function* (release: CodexReleaseAsset) { + function* ( + release: CodexReleaseAsset, + verificationDiagnostics: Ref.Ref, + ) { const ensureEligible = Effect.fn("CodexInstallation.ensureEligible")(function* () { if (release.version !== asset?.version && !(yield* isSupported(release.version))) { return yield* installationError( @@ -648,7 +696,7 @@ export const makeCodexInstallation = Effect.fn("makeCodexInstallation")(function "The existing managed Codex release differs from the official package. Remove it and reinstall.", ); yield* ensureEligible(); - yield* validate(existing, release.version).pipe(Effect.scoped, withValidationTimeout); + yield* validate(existing, release.version, verificationDiagnostics); yield* activate(); return; } @@ -742,7 +790,7 @@ export const makeCodexInstallation = Effect.fn("makeCodexInstallation")(function ); const executable = yield* fromDirectory(runtime, release.version, release.target); yield* ensureEligible(); - yield* validate(executable, release.version).pipe(Effect.scoped, withValidationTimeout); + yield* validate(executable, release.version, verificationDiagnostics); yield* fs.writeFileString( path.join(runtime, ".install-complete.json"), yield* encodeRecord({ @@ -774,6 +822,7 @@ export const makeCodexInstallation = Effect.fn("makeCodexInstallation")(function }); }, }), + Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner), Effect.mapError( wrapFailure( "install", @@ -784,10 +833,10 @@ export const makeCodexInstallation = Effect.fn("makeCodexInstallation")(function // Nothing newer is known, so "reinstall" re-checks the active runtime rather // than replacing it with an older pinned release. const reverify = Effect.fn("CodexInstallation.reverify")( - function* () { + function* (verificationDiagnostics: Ref.Ref) { const active = yield* readRecord(activePath, ActiveRelease); const executable = yield* completedRelease(active.version); - yield* validate(executable, executable.version).pipe(Effect.scoped, withValidationTimeout); + yield* validate(executable, executable.version, verificationDiagnostics); const kept = yield* keptInstall(executable.version); if (kept === null) { yield* SubscriptionRef.update(state, (current) => ({ ...current, ...offer(kept) })); @@ -839,26 +888,35 @@ export const makeCodexInstallation = Effect.fn("makeCodexInstallation")(function downloadedBytes: 0, ...offer(installedVersion), message: release ? "Downloading Codex." : "Checking Codex.", + diagnostics: null, }; yield* SubscriptionRef.set(state, next); - const work = (release ? install(release) : reverify()).pipe( + const verificationDiagnostics = yield* Ref.make(null); + const work = ( + release ? install(release, verificationDiagnostics) : reverify(verificationDiagnostics) + ).pipe( Effect.onExit((exit) => Exit.isFailure(exit) - ? SubscriptionRef.update(state, (value) => { - if (value.operationId !== operationId || value.phase === "succeeded") - return value; - const error = Cause.findErrorOption(exit.cause); - const cancelled = Cause.hasInterruptsOnly(exit.cause); - return { - ...value, - phase: cancelled ? "cancelled" : "failed", - message: cancelled - ? "Installation cancelled. The previous runtime is unchanged." - : Option.isSome(error) - ? error.value.detail - : "Could not finish the Codex installation. Check disk space and directory access.", - } satisfies ProviderInstallState; - }) + ? Ref.get(verificationDiagnostics).pipe( + Effect.flatMap((diagnostics) => + SubscriptionRef.update(state, (value) => { + if (value.operationId !== operationId || value.phase === "succeeded") + return value; + const error = Cause.findErrorOption(exit.cause); + const cancelled = Cause.hasInterruptsOnly(exit.cause); + return { + ...value, + phase: cancelled ? "cancelled" : "failed", + diagnostics: cancelled ? null : diagnostics, + message: cancelled + ? "Installation cancelled. The previous runtime is unchanged." + : Option.isSome(error) + ? error.value.detail + : "Could not finish the Codex installation. Check disk space and directory access.", + } satisfies ProviderInstallState; + }), + ), + ) : Effect.void, ), Effect.ignoreCause, @@ -930,6 +988,7 @@ export const makeCodexInstallation = Effect.fn("makeCodexInstallation")(function source: null, canRemove: false, message: null, + diagnostics: null, }) satisfies ProviderInstallState, ); yield* reuseLocal(); diff --git a/apps/server/src/provider/installationDiagnostics.test.ts b/apps/server/src/provider/installationDiagnostics.test.ts new file mode 100644 index 0000000000000..a528f047dfa73 --- /dev/null +++ b/apps/server/src/provider/installationDiagnostics.test.ts @@ -0,0 +1,135 @@ +import * as NodeServices from "@effect/platform-node/NodeServices"; +import { expect, it } from "@effect/vitest"; +import * as HostProcess from "@t3tools/shared/HostProcess"; +import * as Effect from "effect/Effect"; +import * as PlatformError from "effect/PlatformError"; +import * as Result from "effect/Result"; +import * as Sink from "effect/Sink"; +import * as Stream from "effect/Stream"; +import { ChildProcess, ChildProcessSpawner } from "effect/process"; +import { makeInstallationDiagnostics } from "./installationDiagnostics.ts"; + +it.effect("bounds diagnostic retention while draining and redacting split startup output", () => + Effect.gen(function* () { + const footer = new TextEncoder().encode( + "\u001b[31mStartup failed: café\u001b[0m\nC:\\Users\\Private\\runtime\nc:/users/private/runtime\n" + + "Authorization: Bearer secret-fixture\npassword=private-value\n" + + "opaque-environment-\u001b[31msecret\u001b[0m\nC:\\Users\\Private\\credential-file\nhttps://example.test/auth?code=private-code#private-fragment\n" + + 'Authorization: Token alternate-secret\nsecret="unfinished secret value', + ); + const chunks = [ + new TextEncoder().encode("earlier log\n".repeat(500)), + new TextEncoder().encode("x".repeat(100_000) + "\n"), + ...Array.from(footer, (byte) => new Uint8Array([byte])), + ]; + let drained = 0; + const underlying = ChildProcessSpawner.make(() => + Effect.succeed( + ChildProcessSpawner.makeHandle({ + pid: ChildProcessSpawner.ProcessId(1), + exitCode: Effect.succeed(ChildProcessSpawner.ExitCode(3)), + isRunning: Effect.succeed(false), + kill: () => Effect.void, + unref: Effect.succeed(Effect.void), + stdin: Sink.drain, + stdout: Stream.empty, + stderr: Stream.fromIterable(chunks).pipe( + Stream.tap(() => + Effect.sync(() => { + drained++; + }), + ), + ), + all: Stream.empty, + getInputFd: () => Sink.drain, + getOutputFd: () => Stream.empty, + }), + ), + ); + const capture = yield* makeInstallationDiagnostics("Runtime check").pipe( + Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, underlying), + Effect.provideService(HostProcess.HomeDirectory, "C:\\Users\\Private"), + Effect.provideService(HostProcess.Environment, { + API_KEY: "opaque-environment-secret", + SECRET_PATH: "C:\\Users\\Private\\credential-file", + }), + ); + const child = yield* capture.spawner.spawn(ChildProcess.make("fixture")); + yield* child.stderr.pipe(Stream.runDrain); + yield* child.exitCode; + const diagnostics = capture.snapshot(); + expect(drained).toBe(chunks.length); + expect(diagnostics.stderr.length).toBeLessThanOrEqual(2_000); + expect(diagnostics).toMatchObject({ step: "Runtime check", exitCode: 3, truncated: true }); + expect(diagnostics.stderr).toContain("Startup failed: café"); + expect(diagnostics.stderr).toContain("~\\runtime"); + expect(diagnostics.stderr).toContain("[oversized diagnostic line omitted]"); + for (const privateText of [ + "secret-fixture", + "private-value", + "opaque-environment-secret", + "private-code", + "Private", + "c:/users/private", + "credential-file", + "\u001b", + "alternate-secret", + "unfinished secret value", + ]) { + expect(diagnostics.stderr).not.toContain(privateText); + } + }), +); + +it.effect.each(["NotFound", "PermissionDenied"] as const)( + "reports a %s spawn failure even when no startup stream exists", + (reason) => + Effect.gen(function* () { + const spawner = ChildProcessSpawner.make(() => + Effect.fail( + PlatformError.systemError({ + _tag: reason, + module: "ChildProcess", + method: "spawn", + }), + ), + ); + const capture = yield* makeInstallationDiagnostics("Runtime check").pipe( + Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner), + ); + const result = yield* capture.spawner.spawn(ChildProcess.make("fixture")).pipe(Effect.result); + expect(Result.isFailure(result)).toBe(true); + expect(capture.snapshot()).toMatchObject({ + stderr: "", + exitCode: null, + systemError: + reason === "NotFound" + ? "The runtime executable could not be found." + : "The operating system denied permission to start the runtime.", + }); + }), +); + +it.live("captures a real failed child process without mixing stdout into diagnostics", () => + Effect.gen(function* () { + const executable = yield* HostProcess.ExecutablePath; + const capture = yield* makeInstallationDiagnostics("Runtime check"); + const child = yield* capture.spawner.spawn( + ChildProcess.make(executable, [ + "-e", + "process.stdout.write('private-protocol-payload'); process.stderr.write('Missing startup library\\n'); process.exitCode = 3;", + ]), + ); + yield* Effect.all( + [child.stdout.pipe(Stream.runDrain), child.stderr.pipe(Stream.runDrain), child.exitCode], + { concurrency: "unbounded" }, + ); + expect(capture.snapshot()).toEqual({ + step: "Runtime check", + stderr: "Missing startup library", + exitCode: 3, + signal: null, + truncated: false, + }); + }).pipe(Effect.scoped, Effect.provide(NodeServices.layer)), +); diff --git a/apps/server/src/provider/installationDiagnostics.ts b/apps/server/src/provider/installationDiagnostics.ts new file mode 100644 index 0000000000000..c4030f1c52d8a --- /dev/null +++ b/apps/server/src/provider/installationDiagnostics.ts @@ -0,0 +1,133 @@ +// @effect-diagnostics nodeBuiltinImport:off -- terminal escape sequences must not reach setup details. +import type { ProviderInstallDiagnostics } from "@t3tools/contracts"; +import * as HostProcess from "@t3tools/shared/HostProcess"; +import { sanitizeAcpStderrExcerpt } from "@t3tools/provider-acp/server/stderr"; +import * as Effect from "effect/Effect"; +import * as Stream from "effect/Stream"; +import * as ChildProcessSpawner from "effect/process/ChildProcessSpawner"; +import * as NodeUtil from "node:util"; + +const MAX_DIAGNOSTIC_CHARS = 2_000; +const MAX_LINE_CHARS = 8_192; + +export const makeInstallationDiagnostics = Effect.fn("InstallationDiagnostics.make")(function* ( + step: string, +) { + const spawner = yield* ChildProcessSpawner.ChildProcessSpawner; + const environment = yield* HostProcess.Environment; + const homeDirectory = yield* HostProcess.HomeDirectory; + const homePatterns = [...new Set([homeDirectory, environment.HOME, environment.USERPROFILE])] + .filter((home): home is string => typeof home === "string" && home.length > 1) + .map( + (home) => + new RegExp( + home + .split(/[\\/]/u) + .map((part) => part.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&")) + .join("[\\\\/]"), + "giu", + ), + ); + const normalize = (text: string) => NodeUtil.stripVTControlCharacters(text).replaceAll("\r", ""); + const secrets = Object.entries(environment).flatMap(([name, value]) => + /token|password|secret|credential|api[_-]?key|authorization/i.test(name) && value + ? value.split(/\r?\n/u).map(normalize).filter(Boolean) + : [], + ); + const sanitize = (text: string) => { + let result = normalize(text); + for (const secret of secrets) result = result.split(secret).join("[redacted]"); + for (const pattern of homePatterns) result = result.replace(pattern, "~"); + return sanitizeAcpStderrExcerpt(result, homeDirectory, environment) + .replace(/\bauthorization["']?\s*[:=].*/giu, "Authorization: [redacted]") + .replace(/https?:\/\/[^\s"'<>]+/giu, "[url redacted]") + .replace( + /\b(access[_-]?token|refresh[_-]?token|id[_-]?token|api[_-]?key|password|secret|token)(["']?\s*[:=]\s*)(?:"[^"]*(?:"|$)|'[^']*(?:'|$)|[^\s,;]+)/giu, + "$1$2[redacted]", + ); + }; + let tail = ""; + let pending = ""; + let skippingLine = false; + let truncated = false; + let exitCode: number | null = null; + let systemError: string | undefined; + const append = (text: string) => { + const lines = text.split("\n"); + for (let index = 0; index < lines.length; index++) { + const part = lines[index]!; + if (!skippingLine) { + if (pending.length + part.length > MAX_LINE_CHARS) { + pending = ""; + skippingLine = true; + truncated = true; + } else pending += part; + } + if (index < lines.length - 1) { + const line = skippingLine ? "[oversized diagnostic line omitted]" : sanitize(pending); + tail += `${line}\n`; + if (tail.length > MAX_DIAGNOSTIC_CHARS) { + tail = tail.slice(-MAX_DIAGNOSTIC_CHARS); + truncated = true; + } + pending = ""; + skippingLine = false; + } + } + }; + return { + spawner: ChildProcessSpawner.make( + Effect.fn("InstallationDiagnostics.spawn")(function* (command) { + exitCode = null; + systemError = undefined; + const child = yield* spawner.spawn(command).pipe( + Effect.tapError((error) => + Effect.sync(() => { + systemError = + error.reason._tag === "NotFound" + ? "The runtime executable could not be found." + : error.reason._tag === "PermissionDenied" + ? "The operating system denied permission to start the runtime." + : `The operating system could not start the runtime (${error.reason._tag}).`; + }), + ), + ); + const decoder = new TextDecoder(); + return ChildProcessSpawner.makeHandle({ + ...child, + stderr: child.stderr.pipe( + Stream.tap((chunk) => + Effect.sync(() => append(decoder.decode(chunk, { stream: true }))), + ), + Stream.ensuring(Effect.sync(() => append(decoder.decode()))), + ), + exitCode: child.exitCode.pipe( + Effect.tap((code) => + Effect.sync(() => { + exitCode = Number(code); + }), + ), + ), + }); + }), + ), + snapshot: (exit?: { + readonly code?: number | undefined; + readonly signal?: string | undefined; + }): ProviderInstallDiagnostics => { + const lastLine = skippingLine ? "[oversized diagnostic line omitted]" : sanitize(pending); + const text = `${tail}${lastLine}`.trim(); + return { + step, + stderr: text.slice(-MAX_DIAGNOSTIC_CHARS), + exitCode: exit?.code ?? exitCode, + signal: + exit?.signal && exit.signal.length <= 32 && /^SIG[A-Z0-9]+$/u.test(exit.signal) + ? exit.signal + : null, + ...(systemError === undefined ? {} : { systemError }), + truncated: truncated || text.length > MAX_DIAGNOSTIC_CHARS, + }; + }, + }; +}); diff --git a/apps/web/src/components/settings/CodexSetupSection.tsx b/apps/web/src/components/settings/CodexSetupSection.tsx index 9982a9a37c3cf..95bd5da3c1089 100644 --- a/apps/web/src/components/settings/CodexSetupSection.tsx +++ b/apps/web/src/components/settings/CodexSetupSection.tsx @@ -44,6 +44,7 @@ import { waitForQuerySettled } from "../../state/waitForQuerySettled"; import { Button } from "../ui/button"; import { ChatGptConnectionButton } from "./ChatGptConnectionButton"; import { ChatGptUsageButton } from "./ChatGptUsageButton"; +import { ProviderInstallationDetails } from "./ProviderInstallationDetails"; import { ChatGptAccountPicker } from "./ChatGptAccountPicker"; import { Input } from "../ui/input"; import { OpenAI } from "../Icons"; @@ -971,6 +972,12 @@ function ManagedCodexSetup({ {setupError}

) : null} + {installation?.phase === "failed" ? ( + + ) : null} ); @@ -1116,6 +1123,14 @@ function ManagedCodexSetup({ : gt("Could not read Codex setup status. Reconnect and try again."))}

) : null} + {installation?.phase === "failed" ? ( +
+ +
+ ) : null} ); } diff --git a/apps/web/src/components/settings/ProviderInstallationDetails.tsx b/apps/web/src/components/settings/ProviderInstallationDetails.tsx new file mode 100644 index 0000000000000..ce46896ed4a09 --- /dev/null +++ b/apps/web/src/components/settings/ProviderInstallationDetails.tsx @@ -0,0 +1,52 @@ +import type { ProviderInstallDiagnostics } from "@t3tools/contracts"; +import { T, Var } from "gt-react"; + +export function ProviderInstallationDetails({ + diagnostics, + operationId, +}: { + readonly diagnostics: ProviderInstallDiagnostics | null | undefined; + readonly operationId: string | null; +}) { + if (!diagnostics) return null; + return ( +
+ + Installation details + +
+

{diagnostics.step}

+ {operationId ? ( +

+ + Attempt: {operationId} + +

+ ) : null} + {diagnostics.systemError ?

{diagnostics.systemError}

: null} + {diagnostics.exitCode !== null ? ( +

+ + Exit code: {diagnostics.exitCode} + +

+ ) : null} + {diagnostics.signal !== null ? ( +

+ + Exit signal: {diagnostics.signal} + +

+ ) : null} +
+          {diagnostics.stderr || No startup error output was captured for this check.}
+        
+ {diagnostics.truncated ? ( +

+ Some startup output was omitted or truncated. +

+ ) : null} +
+
+ ); +} diff --git a/apps/web/src/components/settings/ProviderSetupSection.browser.test.tsx b/apps/web/src/components/settings/ProviderSetupSection.browser.test.tsx index e9404773f731f..f68d236212e89 100644 --- a/apps/web/src/components/settings/ProviderSetupSection.browser.test.tsx +++ b/apps/web/src/components/settings/ProviderSetupSection.browser.test.tsx @@ -181,6 +181,28 @@ function resetSetup() { } describe("Antigravity setup", () => { + it("shows the failed environment's startup details and clears them on a new attempt", async () => { + resetSetup(); + setup.installation = { + ...setup.installation!, + phase: "failed", + message: "Runtime verification timed out.", + diagnostics: { + step: "Antigravity initialization", + stderr: "Local harness failed to initialize", + exitCode: null, + signal: null, + truncated: false, + }, + }; + await using screen = await renderSetup(); + await userEvent.click(screen.getByText("Installation details")); + await expect.element(screen.getByText("Local harness failed to initialize")).toBeVisible(); + setup.installation = { ...setup.installation!, phase: "verifying", diagnostics: null }; + await publish(); + await expect.element(screen.getByText("Installation details")).not.toBeInTheDocument(); + }); + it("can start installation before the first install snapshot arrives", async () => { resetSetup(); setup.auth = authState({ phase: "idle", flowId: null, authorizationUrl: null }); diff --git a/apps/web/src/components/settings/ProviderSetupSection.tsx b/apps/web/src/components/settings/ProviderSetupSection.tsx index 5c887e7a3aee1..379fcccd4435a 100644 --- a/apps/web/src/components/settings/ProviderSetupSection.tsx +++ b/apps/web/src/components/settings/ProviderSetupSection.tsx @@ -25,6 +25,7 @@ import { Button } from "../ui/button"; import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip"; import { SettingsRow } from "./settingsLayout"; import { ProviderAuthenticationSection } from "./ProviderAuthenticationSection"; +import { ProviderInstallationDetails } from "./ProviderInstallationDetails"; interface ProviderSetupSectionProps { readonly environmentId: EnvironmentId; @@ -267,6 +268,12 @@ function ProviderSetupActions({ {installation.message}

) : null} + {installation?.phase === "failed" ? ( + + ) : null}
{installActive && installation.operationId ? ( diff --git a/apps/web/src/i18n/translations/de.json b/apps/web/src/i18n/translations/de.json index 46df7424ab0f2..169c8a391ab21 100644 --- a/apps/web/src/i18n/translations/de.json +++ b/apps/web/src/i18n/translations/de.json @@ -12140,5 +12140,32 @@ "27d76249d09eb69f": "Review-Leitfaden bereit", "faa3bb26abb39c93": "Review-Leitfaden fehlgeschlagen", "b7df38b7d8792d78": "Leitfaden öffnen", - "9e91e9a77b664e4e": "Review-Leitfaden konnte nicht gestartet werden" + "9e91e9a77b664e4e": "Review-Leitfaden konnte nicht gestartet werden", + "2d7af575422e95d4": "Installationsdetails", + "bedf6a1ed148ba26": [ + "Versuch: ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "0997ec42c0537aa5": [ + "Exitcode: ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "1286d1de58e9c93b": [ + "Exit-Signal: ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "33139f49ca313a62": "Bei dieser Prüfung wurden keine Startfehlermeldungen erfasst.", + "bb673f99be9e5122": "Ein Teil der Startausgabe wurde ausgelassen oder gekürzt." } diff --git a/apps/web/src/i18n/translations/en.json b/apps/web/src/i18n/translations/en.json index fc971dba6e051..f7c6aaff7807a 100644 --- a/apps/web/src/i18n/translations/en.json +++ b/apps/web/src/i18n/translations/en.json @@ -12149,5 +12149,32 @@ "27d76249d09eb69f": "Review guide ready", "faa3bb26abb39c93": "Review guide failed", "b7df38b7d8792d78": "Open guide", - "9e91e9a77b664e4e": "Could not start a review guide" + "9e91e9a77b664e4e": "Could not start a review guide", + "2d7af575422e95d4": "Installation details", + "bedf6a1ed148ba26": [ + "Attempt: ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "0997ec42c0537aa5": [ + "Exit code: ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "1286d1de58e9c93b": [ + "Exit signal: ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "33139f49ca313a62": "No startup error output was captured for this check.", + "bb673f99be9e5122": "Some startup output was omitted or truncated." } diff --git a/apps/web/src/i18n/translations/es.json b/apps/web/src/i18n/translations/es.json index 797888016bd4a..a8869267d1ccf 100644 --- a/apps/web/src/i18n/translations/es.json +++ b/apps/web/src/i18n/translations/es.json @@ -12135,5 +12135,32 @@ "27d76249d09eb69f": "Guía de revisión lista", "faa3bb26abb39c93": "Falló la guía de revisión", "b7df38b7d8792d78": "Abrir guía", - "9e91e9a77b664e4e": "No se pudo iniciar una guía de revisión" + "9e91e9a77b664e4e": "No se pudo iniciar una guía de revisión", + "2d7af575422e95d4": "Detalles de instalación", + "bedf6a1ed148ba26": [ + "Intento: ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "0997ec42c0537aa5": [ + "Código de salida: ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "1286d1de58e9c93b": [ + "Señal de salida: ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "33139f49ca313a62": "No se registraron errores de inicio durante esta comprobación.", + "bb673f99be9e5122": "Parte de la salida de inicio se omitió o se truncó." } diff --git a/apps/web/src/i18n/translations/fr.json b/apps/web/src/i18n/translations/fr.json index e06cde54989bd..1dd6aed83cd4e 100644 --- a/apps/web/src/i18n/translations/fr.json +++ b/apps/web/src/i18n/translations/fr.json @@ -12140,5 +12140,32 @@ "27d76249d09eb69f": "Guide de revue prêt", "faa3bb26abb39c93": "Échec du guide de revue", "b7df38b7d8792d78": "Ouvrir le guide", - "9e91e9a77b664e4e": "Impossible de démarrer un guide de revue" + "9e91e9a77b664e4e": "Impossible de démarrer un guide de revue", + "2d7af575422e95d4": "Détails de l’installation", + "bedf6a1ed148ba26": [ + "Tentative : ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "0997ec42c0537aa5": [ + "Code de sortie : ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "1286d1de58e9c93b": [ + "Signal de sortie : ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "33139f49ca313a62": "Aucune sortie d’erreur au démarrage n’a été capturée pour cette vérification.", + "bb673f99be9e5122": "Une partie de la sortie de démarrage a été omise ou tronquée." } diff --git a/apps/web/src/i18n/translations/ja.json b/apps/web/src/i18n/translations/ja.json index 4473bff3ddef1..804cdff0b24e8 100644 --- a/apps/web/src/i18n/translations/ja.json +++ b/apps/web/src/i18n/translations/ja.json @@ -12088,5 +12088,32 @@ "27d76249d09eb69f": "レビューガイドの準備ができました", "faa3bb26abb39c93": "レビューガイドの作成に失敗しました", "b7df38b7d8792d78": "ガイドを開く", - "9e91e9a77b664e4e": "レビューガイドを開始できませんでした" + "9e91e9a77b664e4e": "レビューガイドを開始できませんでした", + "2d7af575422e95d4": "インストールの詳細", + "bedf6a1ed148ba26": [ + "試行: ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "0997ec42c0537aa5": [ + "終了コード: ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "1286d1de58e9c93b": [ + "終了シグナル: ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "33139f49ca313a62": "このチェックでは起動時のエラー出力は取得されませんでした。", + "bb673f99be9e5122": "起動時の出力の一部が省略または切り詰められました。" } diff --git a/apps/web/src/i18n/translations/ko.json b/apps/web/src/i18n/translations/ko.json index 68f0b20794362..fc567989614ec 100644 --- a/apps/web/src/i18n/translations/ko.json +++ b/apps/web/src/i18n/translations/ko.json @@ -12084,5 +12084,32 @@ "27d76249d09eb69f": "검토 가이드 준비됨", "faa3bb26abb39c93": "검토 가이드 실패", "b7df38b7d8792d78": "가이드 열기", - "9e91e9a77b664e4e": "검토 가이드를 시작할 수 없습니다" + "9e91e9a77b664e4e": "검토 가이드를 시작할 수 없습니다", + "2d7af575422e95d4": "설치 세부 정보", + "bedf6a1ed148ba26": [ + "시도: ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "0997ec42c0537aa5": [ + "종료 코드: ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "1286d1de58e9c93b": [ + "종료 신호: ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "33139f49ca313a62": "이 검사에서는 시작 오류 출력이 수집되지 않았습니다.", + "bb673f99be9e5122": "시작 출력의 일부가 생략되거나 잘렸습니다." } diff --git a/apps/web/src/i18n/translations/pt-BR.json b/apps/web/src/i18n/translations/pt-BR.json index 5a18a359ecb2a..170ee2f0ca3d8 100644 --- a/apps/web/src/i18n/translations/pt-BR.json +++ b/apps/web/src/i18n/translations/pt-BR.json @@ -12139,5 +12139,32 @@ "27d76249d09eb69f": "Guia de revisão pronto", "faa3bb26abb39c93": "O guia de revisão falhou", "b7df38b7d8792d78": "Abrir guia", - "9e91e9a77b664e4e": "Não foi possível iniciar um guia de revisão" + "9e91e9a77b664e4e": "Não foi possível iniciar um guia de revisão", + "2d7af575422e95d4": "Detalhes da instalação", + "bedf6a1ed148ba26": [ + "Tentativa: ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "0997ec42c0537aa5": [ + "Código de saída: ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "1286d1de58e9c93b": [ + "Sinal de saída: ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "33139f49ca313a62": "Nenhuma saída de erro na inicialização foi capturada nesta verificação.", + "bb673f99be9e5122": "Parte da saída de inicialização foi omitida ou truncada." } diff --git a/apps/web/src/i18n/translations/ru.json b/apps/web/src/i18n/translations/ru.json index 6c7fa00a15455..ffb6f8f6c0ed2 100644 --- a/apps/web/src/i18n/translations/ru.json +++ b/apps/web/src/i18n/translations/ru.json @@ -12139,5 +12139,32 @@ "27d76249d09eb69f": "Гид по ревью готов", "faa3bb26abb39c93": "Не удалось создать гид по ревью", "b7df38b7d8792d78": "Открыть гид", - "9e91e9a77b664e4e": "Не удалось запустить гид по ревью" + "9e91e9a77b664e4e": "Не удалось запустить гид по ревью", + "2d7af575422e95d4": "Сведения об установке", + "bedf6a1ed148ba26": [ + "Попытка: ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "0997ec42c0537aa5": [ + "Код завершения: ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "1286d1de58e9c93b": [ + "Сигнал завершения: ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "33139f49ca313a62": "При этой проверке вывод ошибок запуска не был получен.", + "bb673f99be9e5122": "Часть вывода при запуске была пропущена или обрезана." } diff --git a/apps/web/src/i18n/translations/sv.json b/apps/web/src/i18n/translations/sv.json index d02de62557d73..d9d5aa12a499e 100644 --- a/apps/web/src/i18n/translations/sv.json +++ b/apps/web/src/i18n/translations/sv.json @@ -12147,5 +12147,32 @@ "27d76249d09eb69f": "Granskningsguiden är klar", "faa3bb26abb39c93": "Granskningsguiden misslyckades", "b7df38b7d8792d78": "Öppna guiden", - "9e91e9a77b664e4e": "Kunde inte starta en granskningsguide" + "9e91e9a77b664e4e": "Kunde inte starta en granskningsguide", + "2d7af575422e95d4": "Installationsdetaljer", + "bedf6a1ed148ba26": [ + "Försök: ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "0997ec42c0537aa5": [ + "Avslutningskod: ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "1286d1de58e9c93b": [ + "Avslutningssignal: ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "33139f49ca313a62": "Inga startfelmeddelanden fångades vid den här kontrollen.", + "bb673f99be9e5122": "En del av startutdata utelämnades eller förkortades." } diff --git a/apps/web/src/i18n/translations/zh.json b/apps/web/src/i18n/translations/zh.json index acf5ce3045376..4ae77f30686d4 100644 --- a/apps/web/src/i18n/translations/zh.json +++ b/apps/web/src/i18n/translations/zh.json @@ -12165,5 +12165,32 @@ "27d76249d09eb69f": "审查导览已就绪", "faa3bb26abb39c93": "审查导览生成失败", "b7df38b7d8792d78": "打开导览", - "9e91e9a77b664e4e": "无法开始生成审查导览" + "9e91e9a77b664e4e": "无法开始生成审查导览", + "2d7af575422e95d4": "安装详情", + "bedf6a1ed148ba26": [ + "尝试:", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "0997ec42c0537aa5": [ + "退出代码:", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "1286d1de58e9c93b": [ + "退出信号:", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], + "33139f49ca313a62": "此项检查未捕获到启动错误输出。", + "bb673f99be9e5122": "部分启动输出已省略或截断。" } diff --git a/docs/user/providers-antigravity.md b/docs/user/providers-antigravity.md index c22a20a2ca540..0bdd1473db531 100644 --- a/docs/user/providers-antigravity.md +++ b/docs/user/providers-antigravity.md @@ -160,6 +160,11 @@ T3 does not support Antigravity goal status, pause, resume, or clear commands. ## Check access and troubleshoot +If **Installation details** is available, expand it in provider settings to see the +failed check, any reported exit status, and redacted startup output from that +environment. Mobile **Settings > Providers** can also show these details. Retry +clears the previous attempt's output. + Open **Usage > Limits** to see the remaining Gemini and shared Claude/GPT allowances for Google sign-ins. Each group has separate five-hour and weekly limits and reset times. Limits refresh with provider status and include usage outside T3 Code. diff --git a/docs/user/providers-codex.md b/docs/user/providers-codex.md index f77dff53dabbe..140ab46a7ec47 100644 --- a/docs/user/providers-codex.md +++ b/docs/user/providers-codex.md @@ -137,6 +137,12 @@ over to new threads. Custom models do not offer it. If Codex rejects a turn because your login lacks the program, switch Cyber Access back to Standard or sign in to Codex with an account that has it. +## Troubleshoot runtime installation + +If **Installation details** is available, expand it in Codex setup to see the +failed check, any reported exit status, and redacted startup output from that +environment. Mobile **Settings > Providers** can also show these details. + ## Codex says I hit a usage limit When Codex stops on a usage limit, the thread names the window that ran out and diff --git a/packages/contracts/src/providerSetup.test.ts b/packages/contracts/src/providerSetup.test.ts index 1fc3046fb047b..f2b80c5b1ffba 100644 --- a/packages/contracts/src/providerSetup.test.ts +++ b/packages/contracts/src/providerSetup.test.ts @@ -1,9 +1,25 @@ import { describe, expect, it } from "vite-plus/test"; import * as Schema from "effect/Schema"; -import { ProviderAuthState } from "./providerSetup.ts"; +import { ProviderAuthState, ProviderInstallState } from "./providerSetup.ts"; const decodeState = Schema.decodeUnknownSync(ProviderAuthState); +const decodeInstallState = Schema.decodeUnknownSync(ProviderInstallState); + +it("accepts installation state from servers that predate startup diagnostics", () => { + const state = { + driver: "codex", + operationId: "attempt", + phase: "failed", + downloadedBytes: 0, + totalBytes: null, + version: null, + installedVersion: null, + canRemove: false, + message: "Verification failed.", + }; + expect(decodeInstallState(state)).toEqual(state); +}); describe("provider auth state", () => { it("drops auth variants from newer servers instead of rejecting the state", () => { diff --git a/packages/contracts/src/providerSetup.ts b/packages/contracts/src/providerSetup.ts index 2693b8aa7a918..adb2cfb4eb164 100644 --- a/packages/contracts/src/providerSetup.ts +++ b/packages/contracts/src/providerSetup.ts @@ -151,6 +151,18 @@ export type ProviderAuthCancelInput = typeof ProviderAuthCancelInput.Type; const ByteCount = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)); +export const ProviderInstallDiagnostics = Schema.Struct({ + step: TrimmedNonEmptyString.check(Schema.isMaxLength(128)), + stderr: Schema.String.check(Schema.isMaxLength(2_000)), + exitCode: Schema.NullOr(Schema.Int), + signal: Schema.NullOr( + Schema.String.check(Schema.isMaxLength(32), Schema.isPattern(/^SIG[A-Z0-9]+$/u)), + ), + systemError: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(128))), + truncated: Schema.Boolean, +}); +export type ProviderInstallDiagnostics = typeof ProviderInstallDiagnostics.Type; + export const ProviderInstallState = Schema.Struct({ driver: ProviderDriverKind, operationId: Schema.NullOr(SetupOperationId), @@ -171,6 +183,7 @@ export const ProviderInstallState = Schema.Struct({ source: Schema.optionalKey(Schema.NullOr(Schema.Literals(["managed", "local"]))), canRemove: Schema.Boolean, message: Schema.NullOr(Schema.String), + diagnostics: Schema.optionalKey(Schema.NullOr(ProviderInstallDiagnostics)), }); export type ProviderInstallState = typeof ProviderInstallState.Type;