From 977e3d4807e0ba50dd174cb402a9175ee1b79f85 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Thu, 19 Nov 2026 01:00:11 -0800 Subject: [PATCH 001/201] fix(mobile): localhost pages say when the environment's T3 Code is too old to tunnel (#39035) --- .../modules/t3previewtunnel/SocksListener.kt | 32 +++++++++++++++++++ .../t3previewtunnel/T3TunnelWebView.kt | 15 +++++++-- .../ios/T3SocksListener.swift | 22 ++++++++++--- .../browser/LocalPreviewRouteScreen.tsx | 29 +++++++++++------ .../src/features/browser/TunnelWebView.tsx | 14 ++++---- apps/mobile/src/i18n/translations/de.json | 6 ++-- apps/mobile/src/i18n/translations/en.json | 6 ++-- apps/mobile/src/i18n/translations/es.json | 6 ++-- apps/mobile/src/i18n/translations/fr.json | 6 ++-- apps/mobile/src/i18n/translations/ja.json | 6 ++-- apps/mobile/src/i18n/translations/ko.json | 6 ++-- apps/mobile/src/i18n/translations/pt-BR.json | 6 ++-- apps/mobile/src/i18n/translations/ru.json | 6 ++-- apps/mobile/src/i18n/translations/sv.json | 6 ++-- apps/mobile/src/i18n/translations/zh.json | 6 ++-- 15 files changed, 127 insertions(+), 45 deletions(-) diff --git a/apps/mobile/modules/t3-preview-tunnel/android/src/main/java/expo/modules/t3previewtunnel/SocksListener.kt b/apps/mobile/modules/t3-preview-tunnel/android/src/main/java/expo/modules/t3previewtunnel/SocksListener.kt index 83264890e4ead..13d52e890b28c 100644 --- a/apps/mobile/modules/t3-preview-tunnel/android/src/main/java/expo/modules/t3previewtunnel/SocksListener.kt +++ b/apps/mobile/modules/t3-preview-tunnel/android/src/main/java/expo/modules/t3previewtunnel/SocksListener.kt @@ -23,6 +23,24 @@ private const val HANDSHAKE_TIMEOUT_MS = 10_000 private const val MAX_CONNECTIONS = 64 private const val MAX_SOCKS4_STRING = 255 +internal enum class TunnelFailure(val cause: String) { + ENVIRONMENT("environment"), + PORT("port"), + OUTDATED("outdated"); + + companion object { + /** + * The environment marks a dead or blocked port. A server from before the tunnel answers the + * route like any other page; anything else, such as a proxy's 502, means it is out of reach. + */ + fun classify(status: Int?, portRefused: Boolean): TunnelFailure = when { + portRefused -> PORT + status != null && (status in 200..299 || status == 404) -> OUTDATED + else -> ENVIRONMENT + } + } +} + private val client = OkHttpClient.Builder().readTimeout(0, TimeUnit.MILLISECONDS).build() // The webview names the host as typed, so IP literals can also arrive as domain names. @@ -48,6 +66,10 @@ internal class SocksListener(private val requestAccess: () -> String?) { ) val port: Int = server.localPort + /** Why the latest tunnel failed, or null once one opened. The page's error alone can't tell. */ + @Volatile var lastFailure: TunnelFailure? = null + private set + init { Thread({ while (!server.isClosed) { @@ -110,6 +132,7 @@ internal class SocksListener(private val requestAccess: () -> String?) { ) { val base = requestAccess() if (base == null) { + lastFailure = TunnelFailure.ENVIRONMENT output.write(handshake.reply(false)) } else { tunnel(socket, input, output, base, handshake) @@ -184,6 +207,7 @@ internal class SocksListener(private val requestAccess: () -> String?) { return } val opened = CompletableFuture() + var failure = TunnelFailure.ENVIRONMENT val replied = CompletableFuture() val closed = CompletableFuture() @@ -217,12 +241,19 @@ internal class SocksListener(private val requestAccess: () -> String?) { } override fun onFailure(webSocket: WebSocket, t: Throwable, response: Response?) { + if (!opened.isDone) { + failure = TunnelFailure.classify( + response?.code, + response?.header("x-t3-tunnel-port-refused") != null + ) + } opened.complete(false) closed.complete(Unit) } } ) if (!runCatching { opened.get(15, TimeUnit.SECONDS) }.getOrDefault(false)) { + lastFailure = failure replied.completeExceptionally(java.io.IOException("tunnel did not open")) webSocket.cancel() output.write(handshake.reply(false)) @@ -235,6 +266,7 @@ internal class SocksListener(private val requestAccess: () -> String?) { webSocket.cancel() return } + lastFailure = null replied.complete(Unit) socket.soTimeout = 0 val reader = Thread({ sendPageBytes(input, webSocket, closed) }, "t3-preview-tunnel-up") diff --git a/apps/mobile/modules/t3-preview-tunnel/android/src/main/java/expo/modules/t3previewtunnel/T3TunnelWebView.kt b/apps/mobile/modules/t3-preview-tunnel/android/src/main/java/expo/modules/t3previewtunnel/T3TunnelWebView.kt index 09076542faea7..d581779dc7177 100644 --- a/apps/mobile/modules/t3-preview-tunnel/android/src/main/java/expo/modules/t3previewtunnel/T3TunnelWebView.kt +++ b/apps/mobile/modules/t3-preview-tunnel/android/src/main/java/expo/modules/t3previewtunnel/T3TunnelWebView.kt @@ -73,7 +73,9 @@ class T3TunnelWebView(context: Context, appContext: AppContext) : ExpoView(conte request: WebResourceRequest, error: WebResourceError ) { - if (request.isForMainFrame) fail(error.description.toString(), request.url.toString()) + if (request.isForMainFrame) { + fail(error.description.toString(), request.url.toString(), listener?.lastFailure) + } } } webView.webChromeClient = object : WebChromeClient() { @@ -85,8 +87,15 @@ class T3TunnelWebView(context: Context, appContext: AppContext) : ExpoView(conte pendingUrl?.let { loadUrl(it) } } - private fun fail(description: String, url: String = "") { - onLoadError(mapOf("code" to -1, "description" to description, "url" to url)) + private fun fail(description: String, url: String = "", failure: TunnelFailure? = null) { + onLoadError( + mapOf( + "code" to -1, + "description" to description, + "url" to url, + "cause" to (failure?.cause ?: "") + ) + ) } /** Reports the page's scroll position in steps, enough for the bar to follow its direction. */ diff --git a/apps/mobile/modules/t3-preview-tunnel/ios/T3SocksListener.swift b/apps/mobile/modules/t3-preview-tunnel/ios/T3SocksListener.swift index 78253ced9bf23..318fde127aace 100644 --- a/apps/mobile/modules/t3-preview-tunnel/ios/T3SocksListener.swift +++ b/apps/mobile/modules/t3-preview-tunnel/ios/T3SocksListener.swift @@ -73,6 +73,17 @@ final class T3SocksListener { enum T3TunnelFailure: String { case environment case port + case outdated +} + +extension T3TunnelFailure { + /// The environment marks a dead or blocked port. A server from before the tunnel answers the + /// route like any other page; anything else, such as a proxy's 502, means it is out of reach. + static func classify(status: Int?, portRefused: Bool) -> T3TunnelFailure { + if portRefused { return .port } + guard let status else { return .environment } + return (200..<300).contains(status) || status == 404 ? .outdated : .environment + } } private let replySucceeded: UInt8 = 0 @@ -231,11 +242,12 @@ private final class T3SocksConnection { self?.queue.async { guard let self, !self.closed else { return } if error != nil { - // The environment marks a dead or blocked port; any other failure, including a proxy's - // 502 while the environment is down, means the environment itself is out of reach. - let portRefused = (tunnel.response as? HTTPURLResponse)? - .value(forHTTPHeaderField: "x-t3-tunnel-port-refused") != nil - self.onOutcome(portRefused ? .port : .environment) + let response = tunnel.response as? HTTPURLResponse + self.onOutcome( + T3TunnelFailure.classify( + status: response?.statusCode, + portRefused: response?.value(forHTTPHeaderField: "x-t3-tunnel-port-refused") != nil + )) return self.finish(socksReply(replyFailure)) } self.onOutcome(nil) diff --git a/apps/mobile/src/features/browser/LocalPreviewRouteScreen.tsx b/apps/mobile/src/features/browser/LocalPreviewRouteScreen.tsx index 781370919d8e3..e8750bcf74349 100644 --- a/apps/mobile/src/features/browser/LocalPreviewRouteScreen.tsx +++ b/apps/mobile/src/features/browser/LocalPreviewRouteScreen.tsx @@ -54,6 +54,7 @@ export function LocalPreviewScreen(props: { const [page, setPage] = useState(null); const [failed, setFailed] = useState(false); const [disconnected, setDisconnected] = useState(false); + const [outdated, setOutdated] = useState(false); const [debug, setDebug] = useState(undefined); const [unsupported, setUnsupported] = useState(null); // After a failed load the webview reports no URL, so the address stays on the one asked for. @@ -120,8 +121,9 @@ export function LocalPreviewScreen(props: { // A link to another port fails with that port's address, not the one typed earlier. if (failure.url) setRequested(failure.url); setDebug(failure.debug); - // Android reports no cause, so a refused tunnel request stands in for it there. + // Without a cause, a refused tunnel request reported through onAccess stands in. if (failure.cause) setDisconnected(failure.cause === "environment"); + setOutdated(failure.cause === "outdated"); setFailed(true); }} /> @@ -150,20 +152,27 @@ export function LocalPreviewScreen(props: { Promise; readonly goBack: () => Promise; @@ -80,10 +83,10 @@ export function TunnelWebView({ /** What the native proxy saw, shown with the error so a report carries it. iOS only. */ readonly debug?: string; /** - * iOS only: whether the environment itself was out of reach (`environment`) or answered that - * nothing listens on the port (`port`). + * Whether the environment itself was out of reach (`environment`), answered that nothing + * listens on the port (`port`), or runs a T3 Code server without the tunnel (`outdated`). */ - readonly cause?: "environment" | "port"; + readonly cause?: TunnelFailureCause; }) => void; /** Whether the last connection could get into the environment's tunnel at all. */ readonly onAccess?: (available: boolean) => void; @@ -121,10 +124,7 @@ export function TunnelWebView({ unsupported: nativeEvent.code === -1 && nativeEvent.url === "", description: nativeEvent.description, debug: nativeEvent.debug, - cause: - nativeEvent.cause === "environment" || nativeEvent.cause === "port" - ? nativeEvent.cause - : undefined, + cause: TUNNEL_FAILURE_CAUSES.find((cause) => cause === nativeEvent.cause), }) } /> diff --git a/apps/mobile/src/i18n/translations/de.json b/apps/mobile/src/i18n/translations/de.json index 30116da93d8aa..cabb9a34dbe9a 100644 --- a/apps/mobile/src/i18n/translations/de.json +++ b/apps/mobile/src/i18n/translations/de.json @@ -1782,8 +1782,10 @@ "27025b00be488485": "die Umgebung", "e1ffd0532d64e52c": "Dieses Gerät kann keine localhost-Seiten öffnen", "f72cc72b321f93a5": "{reason} Für diesen Tab kannst du weiterhin den gestreamten Browser verwenden.", + "6bf09d4b7e4ba53b": "T3 Code auf {environment} aktualisieren", "663465f828e70345": "Keine Verbindung zu {environment}", "d14ca43d8ae95c78": "{host} nicht erreichbar", + "b42f0ff267623384": "Auf {environment} läuft eine T3 Code-Version, die ihre localhost-Seiten nicht auf diesem Gerät öffnen kann. Aktualisiere sie dort und versuche es dann erneut.", "69e9c247d0266e9f": "Seiten auf dem localhost von {environment} laden über dessen Verbindung. Versuche es erneut, sobald die Verbindung wieder steht.", "301045c720839f4d": "Auf {environment} lauscht nichts auf Port {port}. Starte dort den Server und versuche es dann erneut.", "0b16434dff468d30": "Der Upload wurde abgelehnt.", @@ -1888,14 +1890,14 @@ "c15d8570b0ac8ae5": "Die Umgebung meldete HTTP {status}.", "b87f2217123b4cbf": "Die Live-Aktivitätseinstellung der Umgebung konnte nicht geändert werden.", "2f18d65ea9f178da": "Die Live-Aktivitätseinstellung der Umgebung konnte nicht geändert werden: {detail}", + "013df8bdb9ca9096": "Die Veröffentlichung der Agentenaktivität konnte nicht aktiviert werden.", + "7247ede5160a0154": "Die Veröffentlichung der Agentenaktivität konnte nicht aktiviert werden: {detail}", "52c4bcf188d1af36": "Die ID des Mobilgeräts konnte nicht geladen werden.", "473457b89661c874": "Die ID des Mobilgeräts konnte nicht geladen werden: {detail}", "01da8c5b0a52e84a": "Der Nachweis für die Umgebungsverknüpfung konnte nicht abgerufen werden.", "20732c0363a295a8": "Verknüpfungsnachweis der Umgebung konnte nicht abgerufen werden: {detail}", "78bf018d20589722": "Der Relay-Zugriff der Umgebung konnte nicht konfiguriert werden.", "a5e3ff0d1a60b766": "Relay-Zugriff der Umgebung konnte nicht konfiguriert werden: {detail}", - "013df8bdb9ca9096": "Die Veröffentlichung der Agentenaktivität konnte nicht aktiviert werden.", - "7247ede5160a0154": "Die Veröffentlichung der Agentenaktivität konnte nicht aktiviert werden: {detail}", "7d508fe978cb0f3b": "Aus", "3ae222ec888dd171": "Trace-ID:", "be00d572b18076d8": "Lange drücken, um von diesem Gerät zu entfernen", diff --git a/apps/mobile/src/i18n/translations/en.json b/apps/mobile/src/i18n/translations/en.json index a7433f8a74360..fa572328fc871 100644 --- a/apps/mobile/src/i18n/translations/en.json +++ b/apps/mobile/src/i18n/translations/en.json @@ -1782,8 +1782,10 @@ "27025b00be488485": "the environment", "e1ffd0532d64e52c": "This device can't open localhost pages", "f72cc72b321f93a5": "{reason} You can still use the streamed browser for this tab.", + "6bf09d4b7e4ba53b": "Update T3 Code on {environment}", "663465f828e70345": "Not connected to {environment}", "d14ca43d8ae95c78": "Can't reach {host}", + "b42f0ff267623384": "{environment} runs a version of T3 Code that can't open its localhost pages on this device. Update it there, then try again.", "69e9c247d0266e9f": "Pages on {environment}’s localhost load through its connection. Try again once it reconnects.", "301045c720839f4d": "Nothing is listening on port {port} on {environment}. Start the server there, then try again.", "0b16434dff468d30": "The upload was refused.", @@ -1888,14 +1890,14 @@ "c15d8570b0ac8ae5": "Environment returned HTTP {status}.", "b87f2217123b4cbf": "Could not update the environment's Live Activity preference.", "2f18d65ea9f178da": "Could not update the environment's Live Activity preference: {detail}", + "013df8bdb9ca9096": "Could not turn on agent activity publishing.", + "7247ede5160a0154": "Could not turn on agent activity publishing: {detail}", "52c4bcf188d1af36": "Could not load the mobile device id.", "473457b89661c874": "Could not load the mobile device id: {detail}", "01da8c5b0a52e84a": "Could not obtain environment link proof.", "20732c0363a295a8": "Could not obtain environment link proof: {detail}", "78bf018d20589722": "Could not configure environment relay access.", "a5e3ff0d1a60b766": "Could not configure environment relay access: {detail}", - "013df8bdb9ca9096": "Could not turn on agent activity publishing.", - "7247ede5160a0154": "Could not turn on agent activity publishing: {detail}", "7d508fe978cb0f3b": "Off", "3ae222ec888dd171": "Trace ID:", "be00d572b18076d8": "Long press to remove from this device", diff --git a/apps/mobile/src/i18n/translations/es.json b/apps/mobile/src/i18n/translations/es.json index 5b7e4a1df6b1f..aaeb8230bc83e 100644 --- a/apps/mobile/src/i18n/translations/es.json +++ b/apps/mobile/src/i18n/translations/es.json @@ -1782,8 +1782,10 @@ "27025b00be488485": "el entorno", "e1ffd0532d64e52c": "Este dispositivo no puede abrir páginas de localhost", "f72cc72b321f93a5": "{reason} Aún puedes usar el navegador transmitido para esta pestaña.", + "6bf09d4b7e4ba53b": "Actualiza T3 Code en {environment}", "663465f828e70345": "Sin conexión con {environment}", "d14ca43d8ae95c78": "No se puede acceder a {host}", + "b42f0ff267623384": "{environment} ejecuta una versión de T3 Code que no puede abrir sus páginas de localhost en este dispositivo. Actualízala allí y vuelve a intentarlo.", "69e9c247d0266e9f": "Las páginas del localhost de {environment} se cargan a través de su conexión. Vuelve a intentarlo cuando se reconecte.", "301045c720839f4d": "Nada escucha en el puerto {port} de {environment}. Inicia el servidor allí y vuelve a intentarlo.", "0b16434dff468d30": "Se rechazó la subida.", @@ -1888,14 +1890,14 @@ "c15d8570b0ac8ae5": "El entorno devolvió HTTP {status}.", "b87f2217123b4cbf": "No se pudo actualizar la preferencia de actividades en directo del entorno.", "2f18d65ea9f178da": "No se pudo actualizar la preferencia de actividades en directo del entorno: {detail}", + "013df8bdb9ca9096": "No se pudo activar la publicación de la actividad del agente.", + "7247ede5160a0154": "No se pudo activar la publicación de la actividad del agente: {detail}", "52c4bcf188d1af36": "No se pudo cargar el ID del dispositivo móvil.", "473457b89661c874": "No se pudo cargar el ID del dispositivo móvil: {detail}", "01da8c5b0a52e84a": "No se pudo obtener la prueba de vinculación del entorno.", "20732c0363a295a8": "No se pudo obtener la prueba de vinculación del entorno: {detail}", "78bf018d20589722": "No se pudo configurar el acceso del entorno al relay.", "a5e3ff0d1a60b766": "No se pudo configurar el acceso del entorno al relay: {detail}", - "013df8bdb9ca9096": "No se pudo activar la publicación de la actividad del agente.", - "7247ede5160a0154": "No se pudo activar la publicación de la actividad del agente: {detail}", "7d508fe978cb0f3b": "Apagado", "3ae222ec888dd171": "ID de traza:", "be00d572b18076d8": "Mantén pulsado para quitarlo de este dispositivo", diff --git a/apps/mobile/src/i18n/translations/fr.json b/apps/mobile/src/i18n/translations/fr.json index 791e9bdbb1bdd..371ab3d7532dd 100644 --- a/apps/mobile/src/i18n/translations/fr.json +++ b/apps/mobile/src/i18n/translations/fr.json @@ -1782,8 +1782,10 @@ "27025b00be488485": "l’environnement", "e1ffd0532d64e52c": "Cet appareil ne peut pas ouvrir les pages localhost", "f72cc72b321f93a5": "{reason} Tu peux toujours utiliser le navigateur diffusé pour cet onglet.", + "6bf09d4b7e4ba53b": "Mettez à jour T3 Code sur {environment}", "663465f828e70345": "Non connecté à {environment}", "d14ca43d8ae95c78": "Impossible d’atteindre {host}", + "b42f0ff267623384": "{environment} exécute une version de T3 Code qui ne peut pas ouvrir ses pages localhost sur cet appareil. Mettez-la à jour là-bas, puis réessayez.", "69e9c247d0266e9f": "Les pages du localhost de {environment} passent par sa connexion. Réessaie une fois la connexion rétablie.", "301045c720839f4d": "Rien n’écoute sur le port {port} de {environment}. Démarre le serveur là-bas, puis réessaie.", "0b16434dff468d30": "L’envoi a été refusé.", @@ -1888,14 +1890,14 @@ "c15d8570b0ac8ae5": "L’environnement a renvoyé HTTP {status}.", "b87f2217123b4cbf": "Impossible de mettre à jour la préférence d’activités en direct de l’environnement.", "2f18d65ea9f178da": "Impossible de mettre à jour la préférence d’activités en direct de l’environnement : {detail}", + "013df8bdb9ca9096": "Impossible d’activer la publication de l’activité de l’agent.", + "7247ede5160a0154": "Impossible d’activer la publication de l’activité de l’agent : {detail}", "52c4bcf188d1af36": "Impossible de charger l’ID de l’appareil mobile.", "473457b89661c874": "Impossible de charger l’ID de l’appareil mobile : {detail}", "01da8c5b0a52e84a": "Impossible d’obtenir la preuve d’association de l’environnement.", "20732c0363a295a8": "Impossible d’obtenir la preuve d’association de l’environnement : {detail}", "78bf018d20589722": "Impossible de configurer l’accès relais de l’environnement.", "a5e3ff0d1a60b766": "Impossible de configurer l’accès au relais de l’environnement : {detail}", - "013df8bdb9ca9096": "Impossible d’activer la publication de l’activité de l’agent.", - "7247ede5160a0154": "Impossible d’activer la publication de l’activité de l’agent : {detail}", "7d508fe978cb0f3b": "Éteint", "3ae222ec888dd171": "ID de trace :", "be00d572b18076d8": "Appuyez longuement pour retirer de cet appareil", diff --git a/apps/mobile/src/i18n/translations/ja.json b/apps/mobile/src/i18n/translations/ja.json index 991bb7852b731..32b5c4d8f9748 100644 --- a/apps/mobile/src/i18n/translations/ja.json +++ b/apps/mobile/src/i18n/translations/ja.json @@ -1782,8 +1782,10 @@ "27025b00be488485": "環境", "e1ffd0532d64e52c": "このデバイスでは localhost のページを開けません", "f72cc72b321f93a5": "{reason} このタブではストリーミングブラウザを引き続き使えます。", + "6bf09d4b7e4ba53b": "{environment} の T3 Code を更新してください", "663465f828e70345": "{environment} に接続されていません", "d14ca43d8ae95c78": "{host} に到達できません", + "b42f0ff267623384": "{environment} で実行中の T3 Code は、この端末で localhost ページを開けないバージョンです。そちらで更新してから、もう一度お試しください。", "69e9c247d0266e9f": "{environment} の localhost のページは、その接続を通じて読み込まれます。再接続されたらもう一度お試しください。", "301045c720839f4d": "{environment} のポート {port} で待ち受けているものはありません。そこでサーバーを起動してから、もう一度お試しください。", "0b16434dff468d30": "アップロードは拒否されました。", @@ -1888,14 +1890,14 @@ "c15d8570b0ac8ae5": "環境から HTTP {status} が返されました。", "b87f2217123b4cbf": "環境のライブアクティビティ設定を更新できませんでした。", "2f18d65ea9f178da": "環境のライブアクティビティ設定を更新できませんでした: {detail}", + "013df8bdb9ca9096": "エージェントのアクティビティの公開をオンにできませんでした。", + "7247ede5160a0154": "エージェントのアクティビティの公開をオンにできませんでした: {detail}", "52c4bcf188d1af36": "モバイルデバイスの ID を読み込めませんでした。", "473457b89661c874": "モバイルデバイスの ID を読み込めませんでした: {detail}", "01da8c5b0a52e84a": "環境リンク証明を取得できませんでした。", "20732c0363a295a8": "環境のリンク証明を取得できませんでした: {detail}", "78bf018d20589722": "環境のリレーアクセスを構成できませんでした。", "a5e3ff0d1a60b766": "環境のリレーアクセスを構成できませんでした: {detail}", - "013df8bdb9ca9096": "エージェントのアクティビティの公開をオンにできませんでした。", - "7247ede5160a0154": "エージェントのアクティビティの公開をオンにできませんでした: {detail}", "7d508fe978cb0f3b": "オフ", "3ae222ec888dd171": "トレース ID:", "be00d572b18076d8": "長押しでこのデバイスから削除", diff --git a/apps/mobile/src/i18n/translations/ko.json b/apps/mobile/src/i18n/translations/ko.json index 6b91487ccbbc5..0cd8713696dc5 100644 --- a/apps/mobile/src/i18n/translations/ko.json +++ b/apps/mobile/src/i18n/translations/ko.json @@ -1782,8 +1782,10 @@ "27025b00be488485": "환경", "e1ffd0532d64e52c": "이 기기에서는 localhost 페이지를 열 수 없습니다", "f72cc72b321f93a5": "{reason} 이 탭에서는 스트리밍 브라우저를 계속 사용할 수 있습니다.", + "6bf09d4b7e4ba53b": "{environment}의 T3 Code를 업데이트하세요", "663465f828e70345": "{environment}에 연결되지 않음", "d14ca43d8ae95c78": "{host}에 연결할 수 없음", + "b42f0ff267623384": "{environment}에서 실행 중인 T3 Code 버전은 이 기기에서 localhost 페이지를 열 수 없습니다. 그곳에서 업데이트한 후 다시 시도하세요.", "69e9c247d0266e9f": "{environment}의 localhost 페이지는 해당 연결을 통해 로드됩니다. 다시 연결되면 다시 시도하세요.", "301045c720839f4d": "{environment}의 포트 {port}에서 수신 대기 중인 항목이 없습니다. 그곳에서 서버를 시작한 다음 다시 시도하세요.", "0b16434dff468d30": "업로드가 거부되었습니다.", @@ -1889,14 +1891,14 @@ "c15d8570b0ac8ae5": "환경에서 HTTP {status}를 반환했습니다.", "b87f2217123b4cbf": "환경의 실시간 현황 설정을 업데이트하지 못했습니다.", "2f18d65ea9f178da": "환경의 실시간 현황 설정을 업데이트하지 못했습니다: {detail}", + "013df8bdb9ca9096": "에이전트 활동 게시를 켤 수 없습니다.", + "7247ede5160a0154": "에이전트 활동 게시를 켤 수 없습니다: {detail}", "52c4bcf188d1af36": "모바일 기기 ID를 불러올 수 없습니다.", "473457b89661c874": "모바일 기기 ID를 불러올 수 없습니다: {detail}", "01da8c5b0a52e84a": "환경 연결 증명을 얻을 수 없습니다.", "20732c0363a295a8": "환경 연결 증명을 가져올 수 없습니다: {detail}", "78bf018d20589722": "환경 릴레이 액세스를 구성할 수 없습니다.", "a5e3ff0d1a60b766": "환경 릴레이 액세스를 구성할 수 없습니다: {detail}", - "013df8bdb9ca9096": "에이전트 활동 게시를 켤 수 없습니다.", - "7247ede5160a0154": "에이전트 활동 게시를 켤 수 없습니다: {detail}", "7d508fe978cb0f3b": "꺼짐", "3ae222ec888dd171": "추적 ID:", "be00d572b18076d8": "길게 눌러 이 기기에서 제거", diff --git a/apps/mobile/src/i18n/translations/pt-BR.json b/apps/mobile/src/i18n/translations/pt-BR.json index 251993b1b9210..caac483484c2e 100644 --- a/apps/mobile/src/i18n/translations/pt-BR.json +++ b/apps/mobile/src/i18n/translations/pt-BR.json @@ -1782,8 +1782,10 @@ "27025b00be488485": "o ambiente", "e1ffd0532d64e52c": "Este dispositivo não consegue abrir páginas de localhost", "f72cc72b321f93a5": "{reason} Você ainda pode usar o navegador transmitido para esta aba.", + "6bf09d4b7e4ba53b": "Atualize o T3 Code em {environment}", "663465f828e70345": "Sem conexão com {environment}", "d14ca43d8ae95c78": "Não é possível acessar {host}", + "b42f0ff267623384": "{environment} executa uma versão do T3 Code que não consegue abrir as páginas de localhost dele neste dispositivo. Atualize-o lá e tente novamente.", "69e9c247d0266e9f": "As páginas do localhost de {environment} carregam pela conexão dele. Tente novamente quando ela se reconectar.", "301045c720839f4d": "Nada está escutando na porta {port} de {environment}. Inicie o servidor lá e tente novamente.", "0b16434dff468d30": "O envio foi recusado.", @@ -1888,14 +1890,14 @@ "c15d8570b0ac8ae5": "O ambiente retornou HTTP {status}.", "b87f2217123b4cbf": "Não foi possível atualizar a preferência de Atividades ao Vivo do ambiente.", "2f18d65ea9f178da": "Não foi possível atualizar a preferência de Atividades ao Vivo do ambiente: {detail}", + "013df8bdb9ca9096": "Não foi possível ativar a publicação da atividade do agente.", + "7247ede5160a0154": "Não foi possível ativar a publicação da atividade do agente: {detail}", "52c4bcf188d1af36": "Não foi possível carregar o ID do dispositivo móvel.", "473457b89661c874": "Não foi possível carregar o ID do dispositivo móvel: {detail}", "01da8c5b0a52e84a": "Não foi possível obter a prova de vínculo do ambiente.", "20732c0363a295a8": "Não foi possível obter a prova de vínculo do ambiente: {detail}", "78bf018d20589722": "Não foi possível configurar o acesso do ambiente ao relay.", "a5e3ff0d1a60b766": "Não foi possível configurar o acesso do ambiente ao relay: {detail}", - "013df8bdb9ca9096": "Não foi possível ativar a publicação da atividade do agente.", - "7247ede5160a0154": "Não foi possível ativar a publicação da atividade do agente: {detail}", "7d508fe978cb0f3b": "Desligado", "3ae222ec888dd171": "ID do trace:", "be00d572b18076d8": "Mantenha pressionado para remover deste dispositivo", diff --git a/apps/mobile/src/i18n/translations/ru.json b/apps/mobile/src/i18n/translations/ru.json index eb53bc6a85093..d5439f9698130 100644 --- a/apps/mobile/src/i18n/translations/ru.json +++ b/apps/mobile/src/i18n/translations/ru.json @@ -1782,8 +1782,10 @@ "27025b00be488485": "окружение", "e1ffd0532d64e52c": "Это устройство не может открывать страницы localhost", "f72cc72b321f93a5": "{reason} Для этой вкладки можно по-прежнему использовать транслируемый браузер.", + "6bf09d4b7e4ba53b": "Обновите T3 Code на {environment}", "663465f828e70345": "Нет подключения к {environment}", "d14ca43d8ae95c78": "Не удаётся открыть {host}", + "b42f0ff267623384": "На {environment} работает версия T3 Code, которая не может открывать свои страницы localhost на этом устройстве. Обновите её там и попробуйте снова.", "69e9c247d0266e9f": "Страницы localhost окружения {environment} загружаются через его подключение. Повторите попытку, когда оно восстановится.", "301045c720839f4d": "На порту {port} в {environment} ничего не слушает. Запустите там сервер и повторите попытку.", "0b16434dff468d30": "Загрузка отклонена.", @@ -1912,14 +1914,14 @@ "c15d8570b0ac8ae5": "Среда вернула HTTP {status}.", "b87f2217123b4cbf": "Не удалось обновить настройку «Эфир активности» для среды.", "2f18d65ea9f178da": "Не удалось обновить настройку «Эфир активности» для среды: {detail}", + "013df8bdb9ca9096": "Не удалось включить публикацию активности агента.", + "7247ede5160a0154": "Не удалось включить публикацию активности агента: {detail}", "52c4bcf188d1af36": "Не удалось загрузить ID мобильного устройства.", "473457b89661c874": "Не удалось загрузить ID мобильного устройства: {detail}", "01da8c5b0a52e84a": "Не удалось получить подтверждение привязки окружения.", "20732c0363a295a8": "Не удалось получить подтверждение привязки окружения: {detail}", "78bf018d20589722": "Не удалось настроить доступ окружения к relay.", "a5e3ff0d1a60b766": "Не удалось настроить доступ окружения к relay: {detail}", - "013df8bdb9ca9096": "Не удалось включить публикацию активности агента.", - "7247ede5160a0154": "Не удалось включить публикацию активности агента: {detail}", "7d508fe978cb0f3b": "Выкл.", "3ae222ec888dd171": "ID трассировки:", "be00d572b18076d8": "Нажмите и удерживайте, чтобы удалить с этого устройства", diff --git a/apps/mobile/src/i18n/translations/sv.json b/apps/mobile/src/i18n/translations/sv.json index 0b335f057cdce..7a634bcab134f 100644 --- a/apps/mobile/src/i18n/translations/sv.json +++ b/apps/mobile/src/i18n/translations/sv.json @@ -1782,8 +1782,10 @@ "27025b00be488485": "miljön", "e1ffd0532d64e52c": "Den här enheten kan inte öppna localhost-sidor", "f72cc72b321f93a5": "{reason} Du kan fortfarande använda den strömmade webbläsaren för den här fliken.", + "6bf09d4b7e4ba53b": "Uppdatera T3 Code på {environment}", "663465f828e70345": "Inte ansluten till {environment}", "d14ca43d8ae95c78": "Kan inte nå {host}", + "b42f0ff267623384": "{environment} kör en version av T3 Code som inte kan öppna sina localhost-sidor på den här enheten. Uppdatera den där och försök sedan igen.", "69e9c247d0266e9f": "Sidor på localhost i {environment} laddas via dess anslutning. Försök igen när den har återanslutit.", "301045c720839f4d": "Inget lyssnar på port {port} i {environment}. Starta servern där och försök sedan igen.", "0b16434dff468d30": "Uppladdningen nekades.", @@ -1888,14 +1890,14 @@ "c15d8570b0ac8ae5": "Miljön returnerade HTTP {status}.", "b87f2217123b4cbf": "Det gick inte att uppdatera miljöns inställning för liveaktiviteter.", "2f18d65ea9f178da": "Det gick inte att uppdatera miljöns inställning för liveaktiviteter: {detail}", + "013df8bdb9ca9096": "Det gick inte att aktivera publicering av agentaktivitet.", + "7247ede5160a0154": "Det gick inte att aktivera publicering av agentaktivitet: {detail}", "52c4bcf188d1af36": "Kunde inte läsa in den mobila enhetens id.", "473457b89661c874": "Kunde inte läsa in den mobila enhetens id: {detail}", "01da8c5b0a52e84a": "Kunde inte hämta bevis för miljölänken.", "20732c0363a295a8": "Kunde inte hämta miljöns länkbevis: {detail}", "78bf018d20589722": "Kunde inte konfigurera miljöns reläåtkomst.", "a5e3ff0d1a60b766": "Kunde inte konfigurera miljöns reläåtkomst: {detail}", - "013df8bdb9ca9096": "Det gick inte att aktivera publicering av agentaktivitet.", - "7247ede5160a0154": "Det gick inte att aktivera publicering av agentaktivitet: {detail}", "7d508fe978cb0f3b": "Av", "3ae222ec888dd171": "Spårnings-id:", "be00d572b18076d8": "Tryck länge för att ta bort från den här enheten", diff --git a/apps/mobile/src/i18n/translations/zh.json b/apps/mobile/src/i18n/translations/zh.json index 9002438aed15e..98b946c76f028 100644 --- a/apps/mobile/src/i18n/translations/zh.json +++ b/apps/mobile/src/i18n/translations/zh.json @@ -1783,8 +1783,10 @@ "27025b00be488485": "该环境", "e1ffd0532d64e52c": "此设备无法打开 localhost 页面", "f72cc72b321f93a5": "{reason} 你仍可以为此标签页使用流式浏览器。", + "6bf09d4b7e4ba53b": "请更新 {environment} 上的 T3 Code", "663465f828e70345": "未连接到 {environment}", "d14ca43d8ae95c78": "无法访问 {host}", + "b42f0ff267623384": "{environment} 运行的 T3 Code 版本无法在此设备上打开其 localhost 页面。请在那里更新后重试。", "69e9c247d0266e9f": "{environment} 上的 localhost 页面通过其连接加载。重新连接后请再试一次。", "301045c720839f4d": "{environment} 上的端口 {port} 没有任何服务在监听。请在那里启动服务器,然后再试一次。", "0b16434dff468d30": "上传被拒绝。", @@ -1890,14 +1892,14 @@ "c15d8570b0ac8ae5": "环境返回了 HTTP {status}。", "b87f2217123b4cbf": "无法更新该环境的实时活动偏好设置。", "2f18d65ea9f178da": "无法更新该环境的实时活动偏好设置:{detail}", + "013df8bdb9ca9096": "无法开启代理活动发布。", + "7247ede5160a0154": "无法开启代理活动发布:{detail}", "52c4bcf188d1af36": "无法加载移动设备 ID。", "473457b89661c874": "无法加载移动设备 ID:{detail}", "01da8c5b0a52e84a": "无法获取环境关联凭证。", "20732c0363a295a8": "无法获取环境关联证明:{detail}", "78bf018d20589722": "无法配置环境中继访问。", "a5e3ff0d1a60b766": "无法配置环境的中继访问:{detail}", - "013df8bdb9ca9096": "无法开启代理活动发布。", - "7247ede5160a0154": "无法开启代理活动发布:{detail}", "7d508fe978cb0f3b": "关闭", "3ae222ec888dd171": "追踪 ID:", "be00d572b18076d8": "长按以从此设备移除", From c9359f6535f8f5abdc54d2ce0b13357433b91082 Mon Sep 17 00:00:00 2001 From: Wout Stiens <71498452+StiensWout@users.noreply.github.com> Date: Thu, 19 Nov 2026 10:12:09 +0100 Subject: [PATCH 002/201] fix(mobile): project picker starts a chat in an open copy, not an archived one (#38984) Co-authored-by: Grok 4.7 Co-authored-by: Julius Marminge --- .../new-task-project-selection.test.ts | 25 ++++++- .../threads/new-task-project-selection.ts | 65 +++++++++++-------- .../CommandPalette.browser.test.tsx | 42 ++++++++++++ apps/web/src/components/CommandPalette.tsx | 18 +++-- apps/web/src/environmentGrouping.test.ts | 28 ++++++++ apps/web/src/sidebarProjectGrouping.ts | 13 ++-- .../src/state/projectGrouping.ts | 6 +- 7 files changed, 154 insertions(+), 43 deletions(-) diff --git a/apps/mobile/src/features/threads/new-task-project-selection.test.ts b/apps/mobile/src/features/threads/new-task-project-selection.test.ts index 3105158237d67..2cf6e5ea679ed 100644 --- a/apps/mobile/src/features/threads/new-task-project-selection.test.ts +++ b/apps/mobile/src/features/threads/new-task-project-selection.test.ts @@ -2,7 +2,7 @@ import { EnvironmentId, ProjectId } from "@t3tools/contracts"; import { describe, expect, it } from "vite-plus/test"; import type { EnvironmentProject } from "@t3tools/client-runtime/state/shell"; -import type { HomeProjectScope } from "../home/homeThreadList"; +import { buildHomeProjectScopes, type HomeProjectScope } from "../home/homeThreadList"; import { getProjectScopeSelectionTarget, isSameRepository, @@ -60,6 +60,29 @@ function makeScope(projects: ReadonlyArray): HomeProjectScop } describe("getProjectScopeSelectionTarget", () => { + it("chooses an open copy of a repository over an archived copy on the preferred machine", () => { + const repo = { repositoryKey: "github.com/t3tools/t3code" }; + const archived = { + ...makeProject("archived-copy", "mac", repo), + archivedAt: "2026-07-02T00:00:00.000Z", + }; + const open = makeProject("open-copy", "server", repo); + const [scope] = buildHomeProjectScopes({ + projects: [archived, open], + environmentId: null, + projectGroupingMode: "repository", + }); + if (!scope || scope.archived) throw new Error("Expected a pickable repository group"); + + expect( + getProjectScopeSelectionTarget( + scope, + archived.environmentId, + new Set([archived.environmentId, open.environmentId]), + ).id, + ).toBe(open.id); + }); + it("prefers a connected copy of a project that spans environments", () => { const mac = makeProject("t3code", "mac"); const server = makeProject("t3code", "server"); diff --git a/apps/mobile/src/features/threads/new-task-project-selection.ts b/apps/mobile/src/features/threads/new-task-project-selection.ts index 58f7adcf27b64..8ca977ceea1cc 100644 --- a/apps/mobile/src/features/threads/new-task-project-selection.ts +++ b/apps/mobile/src/features/threads/new-task-project-selection.ts @@ -1,34 +1,54 @@ import type { EnvironmentConnectionPhase } from "@t3tools/client-runtime/connection"; import { availableScratchWorkspaceRoot } from "@t3tools/client-runtime/operations/projects"; +import { isPickableProjectMember } from "@t3tools/client-runtime/state/project-grouping"; import type { EnvironmentProject } from "@t3tools/client-runtime/state/shell"; import { repositoryGroupingKeyOf, type EnvironmentId, type ServerConfig } from "@t3tools/contracts"; import { scopedProjectKey } from "../../lib/scopedEntities"; import type { HomeProjectScope } from "../home/homeThreadList"; +type ProjectRef = { readonly environmentId: string; readonly projectId: string }; + type DraftProjectSelectionResolution = | { readonly kind: "preserve" } | { readonly kind: "select"; readonly project: EnvironmentProject } | { readonly kind: "pick" } | { readonly kind: "dismiss" }; -/** - * The copy of a project a new thread starts in: the preferred environment's, then the - * representative. A connected copy wins over a disconnected one. - */ -export function getProjectScopeSelectionTarget( +function selectOpenProjectScopeMember( scope: HomeProjectScope, preferredEnvironmentId: EnvironmentId | null, connectedEnvironmentIds: ReadonlySet, -): EnvironmentProject { + lastProject?: ProjectRef, +): EnvironmentProject | undefined { + const open = scope.projects.filter(isPickableProjectMember); + const remembered = + lastProject && + open.find( + (project) => + project.environmentId === lastProject.environmentId && project.id === lastProject.projectId, + ); + if (remembered) return remembered; + const rank = (project: EnvironmentProject) => project.environmentId === preferredEnvironmentId ? 0 : project === scope.representative ? 1 : 2; - const ordered = [...scope.projects].sort((left, right) => rank(left) - rank(right)); - return ( - ordered.find((project) => connectedEnvironmentIds.has(project.environmentId)) ?? - ordered[0] ?? - scope.representative + open.sort((left, right) => rank(left) - rank(right)); + return open.find((project) => connectedEnvironmentIds.has(project.environmentId)) ?? open[0]; +} + +/** Picker scopes have an open copy; prefer a connected one, then the selected environment. */ +export function getProjectScopeSelectionTarget( + scope: HomeProjectScope, + preferredEnvironmentId: EnvironmentId | null, + connectedEnvironmentIds: ReadonlySet, +): EnvironmentProject { + const project = selectOpenProjectScopeMember( + scope, + preferredEnvironmentId, + connectedEnvironmentIds, ); + if (!project) throw new Error("A pickable project group must have an open workspace"); + return project; } export function filterProjectScopes( @@ -174,8 +194,6 @@ export function resolveDraftProjectSelection( return onlyScope ? { kind: "select", project: onlyScope.representative } : { kind: "pick" }; } -type ProjectRef = { readonly environmentId: string; readonly projectId: string }; - /** The live copy of the thread list's filtered project a new thread starts in: the remembered one if it is a copy. */ export function newTaskFilteredProject( scope: HomeProjectScope, @@ -183,20 +201,13 @@ export function newTaskFilteredProject( connectedEnvironmentIds: ReadonlySet, lastProject: ProjectRef | undefined, ): ProjectRef | undefined { - const live = scope.projects.filter((project) => project.archivedAt == null); - if (live.length === 0) return undefined; - const project = - live.find( - (candidate) => - candidate.environmentId === lastProject?.environmentId && - candidate.id === lastProject.projectId, - ) ?? - getProjectScopeSelectionTarget( - { ...scope, projects: live }, - preferredEnvironmentId, - connectedEnvironmentIds, - ); - return { environmentId: project.environmentId, projectId: project.id }; + const project = selectOpenProjectScopeMember( + scope, + preferredEnvironmentId, + connectedEnvironmentIds, + lastProject, + ); + return project && { environmentId: project.environmentId, projectId: project.id }; } export function newTaskDestination(options: { diff --git a/apps/web/src/components/CommandPalette.browser.test.tsx b/apps/web/src/components/CommandPalette.browser.test.tsx index d53e02a5a0df3..f29feada58e0a 100644 --- a/apps/web/src/components/CommandPalette.browser.test.tsx +++ b/apps/web/src/components/CommandPalette.browser.test.tsx @@ -15,6 +15,7 @@ import { CommandPalette } from "./CommandPalette"; const entities = vi.hoisted(() => ({ projects: [] as ReadonlyArray, threads: [] as ReadonlyArray, + activeThread: undefined as Thread | undefined, delegatedUnderParent: new Set() as ReadonlySet, handleNewThread: vi.fn(async () => undefined), })); @@ -38,6 +39,7 @@ vi.mock("../hooks/useHandleNewThread", async (original) => { ...actual, useHandleNewThread: () => ({ ...actual.useHandleNewThread(), + activeThread: entities.activeThread, handleNewThread: entities.handleNewThread, }), }; @@ -56,6 +58,7 @@ function setup(state: Partial = {}) { useCommandPaletteStore.setState(useCommandPaletteStore.getInitialState(), true); entities.projects = state.projects ?? []; entities.threads = state.threads ?? []; + entities.activeThread = state.activeThread; entities.delegatedUnderParent = state.delegatedUnderParent ?? new Set(); entities.handleNewThread.mockClear(); } @@ -248,6 +251,45 @@ describe("CommandPalette open intents", () => { await vi.waitFor(() => expect(screen.router?.state.location.pathname).toBe("/local/parent")); }); + it("starts a thread in an open copy when the current project's copy is archived", async () => { + const repositoryIdentity = { + canonicalKey: "github.com/example/acme", + locator: { + source: "git-remote" as const, + remoteName: "origin", + remoteUrl: "https://github.com/example/acme.git", + }, + }; + const archived = { + ...makeProject("acme"), + repositoryIdentity, + archivedAt: "2026-03-02T00:00:00.000Z", + }; + const open = { + ...makeProject("acme"), + environmentId: EnvironmentId.make("remote"), + repositoryIdentity, + }; + setup({ + projects: [archived, open], + activeThread: makeThreadFixture({ + environmentId: archived.environmentId, + projectId: archived.id, + }), + }); + await using _screen = await render({null}); + + openCommandPalette({ open: "new-thread-in" }); + await page.getByRole("option", { name: /acme/i }).click(); + + await vi.waitFor(() => + expect(entities.handleNewThread).toHaveBeenCalledWith({ + environmentId: open.environmentId, + projectId: open.id, + }), + ); + }); + it("numbers filtered New thread in... rows from 1 and jumps to them", async () => { using _platform = vi.spyOn(navigator, "platform", "get").mockReturnValue("Linux x86_64"); setup({ projects: [makeProject("server"), makeProject("lima")] }); diff --git a/apps/web/src/components/CommandPalette.tsx b/apps/web/src/components/CommandPalette.tsx index a7a86ca21752e..1eb1a9bcba599 100644 --- a/apps/web/src/components/CommandPalette.tsx +++ b/apps/web/src/components/CommandPalette.tsx @@ -277,7 +277,10 @@ import { suggestAppAccessForRemote } from "./sourceControlAppAccessToast"; import { Tooltip, TooltipPopup, TooltipTrigger } from "./ui/tooltip"; import { ComposerHandleContext, useComposerHandleContext } from "../composerHandleContext"; import type { ChatComposerHandle } from "./chat/ChatComposer"; -import { pickableProjectGroups } from "@t3tools/client-runtime/state/project-grouping"; +import { + isPickableProjectMember, + pickableProjectGroups, +} from "@t3tools/client-runtime/state/project-grouping"; import { buildSidebarProjectPickerEntries } from "../sidebarProjectGrouping"; import { PullRequestGlyph } from "~/components/pullRequest/pullRequestIcons"; import { readPullRequestListPreferences } from "~/components/pullRequest/pullRequestListPreferences"; @@ -893,15 +896,16 @@ function OpenCommandPaletteDialog(props: { pin: projectPin, runProject: async (project) => { const group = projectGroupByTargetKey.get(`${project.environmentId}:${project.id}`); - const contextualRefBelongsToGroup = + const contextualProjectIsEligible = contextualProjectRef !== null && - group?.memberProjectRefs.some( - (projectRef) => - projectRef.environmentId === contextualProjectRef.environmentId && - projectRef.projectId === contextualProjectRef.projectId, + group?.memberProjects.some( + (member) => + member.environmentId === contextualProjectRef.environmentId && + member.id === contextualProjectRef.projectId && + isPickableProjectMember(member), ); await handleNewThread( - contextualRefBelongsToGroup + contextualProjectIsEligible ? contextualProjectRef : scopeProjectRef(project.environmentId, project.id), ); diff --git a/apps/web/src/environmentGrouping.test.ts b/apps/web/src/environmentGrouping.test.ts index b2081b4b8fe9a..9a531c3b76ad6 100644 --- a/apps/web/src/environmentGrouping.test.ts +++ b/apps/web/src/environmentGrouping.test.ts @@ -279,6 +279,34 @@ describe("environment grouping", () => { }); }); + it("targets an open copy when the preferred project is archived", () => { + const archived = makeProject({ + repositoryIdentity, + archivedAt: "2026-01-02T00:00:00.000Z", + }); + const open = makeProject({ + id: ProjectId.make("open-copy"), + environmentId: remoteEnvironmentId, + repositoryIdentity, + }); + const groups = buildSidebarProjectSnapshots({ + projects: [archived, open], + settings: defaultGroupingSettings, + primaryEnvironmentId, + resolveEnvironmentLabel: () => null, + }); + const [entry] = buildSidebarProjectPickerEntries({ + groups: pickableProjectGroups(groups), + preferredProjectRef: { environmentId: archived.environmentId, projectId: archived.id }, + }); + + expect(entry?.targetProject).toMatchObject({ environmentId: open.environmentId, id: open.id }); + expect(entry?.group.memberProjectRefs).toContainEqual({ + environmentId: archived.environmentId, + projectId: archived.id, + }); + }); + it("puts the preferred project before pinned projects", () => { const project = (title: string, pinnedAt: string | null = null) => makeProject({ diff --git a/apps/web/src/sidebarProjectGrouping.ts b/apps/web/src/sidebarProjectGrouping.ts index b8931f32051d1..9a28f40855aa4 100644 --- a/apps/web/src/sidebarProjectGrouping.ts +++ b/apps/web/src/sidebarProjectGrouping.ts @@ -6,6 +6,7 @@ import type { import { buildProjectGroups, derivePhysicalProjectKey, + isPickableProjectMember, resolveScratchProjectScopeKey, type ProjectGroupingSettings, } from "@t3tools/client-runtime/state/project-grouping"; @@ -221,6 +222,7 @@ export function buildSidebarProjectPickerEntries(input: { }) { const preferredProjectRef = input.preferredProjectRef; const entries = input.groups.flatMap((group): SidebarProjectPickerEntry[] => { + const members = group.memberProjects.filter(isPickableProjectMember); const isPreferred = preferredProjectRef ? group.memberProjectRefs.some( (projectRef) => @@ -229,21 +231,18 @@ export function buildSidebarProjectPickerEntries(input: { ) : false; const preferredProject = preferredProjectRef - ? (group.memberProjects.find( + ? (members.find( (project) => project.environmentId === preferredProjectRef.environmentId && project.id === preferredProjectRef.projectId, - ) ?? - group.memberProjects.find( - (project) => project.environmentId === preferredProjectRef.environmentId, - )) + ) ?? members.find((project) => project.environmentId === preferredProjectRef.environmentId)) : null; const targetProject = preferredProject ?? - group.memberProjects.find( + members.find( (project) => project.environmentId === group.environmentId && project.id === group.id, ) ?? - group.memberProjects[0]; + members[0]; if (!targetProject) return []; return [{ group, targetProject, isPreferred }]; diff --git a/packages/client-runtime/src/state/projectGrouping.ts b/packages/client-runtime/src/state/projectGrouping.ts index 3fcddf3d0580c..2ae5fb99f5022 100644 --- a/packages/client-runtime/src/state/projectGrouping.ts +++ b/packages/client-runtime/src/state/projectGrouping.ts @@ -273,6 +273,10 @@ export function pickableProjectGroups< return [...open.filter((group) => group.pinned), ...open.filter((group) => !group.pinned)]; } +export function isPickableProjectMember(member: Pick): boolean { + return member.archivedAt == null; +} + function projectFreshnessTime(project: EnvironmentProject): number { const updatedAtTime = Date.parse(project.updatedAt); if (Number.isFinite(updatedAtTime)) { @@ -397,7 +401,7 @@ export function buildProjectGroups( members, memberProjectRefs: projectRefsByLogicalKey.get(key) ?? [], pinned: members.some((member) => member.project.pinnedAt != null), - archived: members.every((member) => member.project.archivedAt != null), + archived: !members.some(({ project }) => isPickableProjectMember(project)), }; }); } From bb234221cefe1dfdc64d754ee14d0456c5d09ec6 Mon Sep 17 00:00:00 2001 From: fatih akyon <34196005+fcakyon@users.noreply.github.com> Date: Thu, 19 Nov 2026 12:29:15 +0300 Subject: [PATCH 003/201] fix(server): Antigravity refreshes no longer erase scanned folders' project skills (#39037) --- .../src/provider/ProviderRegistry.test.ts | 49 +++++++++++++++++++ apps/server/src/provider/ProviderRegistry.ts | 20 ++++++-- 2 files changed, 64 insertions(+), 5 deletions(-) diff --git a/apps/server/src/provider/ProviderRegistry.test.ts b/apps/server/src/provider/ProviderRegistry.test.ts index dcbadc9d49aaa..617fb4731e085 100644 --- a/apps/server/src/provider/ProviderRegistry.test.ts +++ b/apps/server/src/provider/ProviderRegistry.test.ts @@ -2117,6 +2117,55 @@ it.layer( signedIn.auth, ); }); + + it("keeps scanned folders through health checks until Antigravity cannot run", () => { + const scanned = ["/project", "/plain"].reduce( + (provider, cwd) => + ProviderRegistry.upsertProviderWorkspaceSnapshot(provider, cwd, { + ...signedIn, + skills: [{ name: "review", path: `${cwd}/SKILL.md`, enabled: true }], + }), + signedIn, + ); + const healthCheck = { ...signedIn, checkedAt: "2026-09-05T00:01:00.000Z" }; + const sessionFolder = { + cwd: "/project", + checkedAt: healthCheck.checkedAt, + slashCommands: [{ name: "swarm" }], + skills: [], + }; + const kept = [ + healthCheck, + restartProbe, + { ...restartProbe, installed: false, version: null }, + ] satisfies ReadonlyArray; + for (const next of kept) { + assert.deepStrictEqual( + ProviderRegistry.mergeProviderSnapshot(scanned, { ...next, workspaceSnapshots: [] }) + .workspaceSnapshots, + scanned.workspaceSnapshots, + ); + } + assert.deepStrictEqual( + ProviderRegistry.mergeProviderSnapshot(scanned, { + ...healthCheck, + workspaceSnapshots: [sessionFolder], + }).workspaceSnapshots, + [...scanned.workspaceSnapshots!.slice(1), sessionFolder], + ); + const cleared = [ + { ...healthCheck, auth: { status: "unauthenticated" } }, + { ...healthCheck, status: "disabled", enabled: false }, + { ...healthCheck, status: "error", installed: false }, + ] satisfies ReadonlyArray; + for (const next of cleared) { + assert.deepStrictEqual( + ProviderRegistry.mergeProviderSnapshot(scanned, { ...next, workspaceSnapshots: [] }) + .workspaceSnapshots, + [], + ); + } + }); }); it("fills missing capabilities from the previous provider snapshot", () => { diff --git a/apps/server/src/provider/ProviderRegistry.ts b/apps/server/src/provider/ProviderRegistry.ts index f832e5f186fb4..062ae300275d1 100644 --- a/apps/server/src/provider/ProviderRegistry.ts +++ b/apps/server/src/provider/ProviderRegistry.ts @@ -337,15 +337,25 @@ export const mergeProviderSnapshot = ( ...snapshot, modelsPending: true, })); + const nextWorkspaceSnapshots = nextProvider.workspaceSnapshots; + // A provider reports only folders its own sessions saw, so registry scans of other folders stay. + const workspaceSnapshots = + nextWorkspaceSnapshots === undefined || + !nextProvider.enabled || + nextProvider.auth.status === "unauthenticated" || + (!nextProvider.installed && nextProvider.status === "error") + ? (nextWorkspaceSnapshots ?? previousWorkspaceSnapshots) + : [ + ...(previousWorkspaceSnapshots ?? []).filter( + ({ cwd }) => !nextWorkspaceSnapshots.some((snapshot) => snapshot.cwd === cwd), + ), + ...nextWorkspaceSnapshots, + ].slice(-MAX_WORKSPACE_SNAPSHOTS_PER_PROVIDER); return { ...(savedAccount?.status === "ready" ? nextWithoutMessage : nextProvider), ...savedAccount, models, - ...(nextProvider.workspaceSnapshots !== undefined - ? { workspaceSnapshots: nextProvider.workspaceSnapshots } - : previousWorkspaceSnapshots !== undefined - ? { workspaceSnapshots: previousWorkspaceSnapshots } - : {}), + ...(workspaceSnapshots === undefined ? {} : { workspaceSnapshots }), ...(nextProvider.workspaceRescannedAt === undefined && previousProvider.workspaceRescannedAt !== undefined ? { workspaceRescannedAt: previousProvider.workspaceRescannedAt } From aced664ed93911657dc84da5b438b961e31be4ec Mon Sep 17 00:00:00 2001 From: Helmi Pradita <50313181+helmipradita@users.noreply.github.com> Date: Thu, 19 Nov 2026 16:45:01 +0700 Subject: [PATCH 004/201] fix(client-runtime): prefer newer completed compaction over stale liveUsage (#39024) Co-authored-by: Julius Marminge --- .../Adapters/OpenCode2AdapterV2.test.ts | 48 +++++++ apps/web/src/lib/contextWindow.test.ts | 45 +++++++ .../client-runtime/src/state/contextWindow.ts | 126 +++++++++++------- .../src/server/adapter.test.ts | 88 ++++++++++++ .../provider-opencode/src/server/adapter.ts | 5 + .../src/server/v2/adapter.ts | 10 ++ 6 files changed, 276 insertions(+), 46 deletions(-) diff --git a/apps/server/src/orchestration-v2/Adapters/OpenCode2AdapterV2.test.ts b/apps/server/src/orchestration-v2/Adapters/OpenCode2AdapterV2.test.ts index cd1bdc9044a5c..3a5729aa71f5a 100644 --- a/apps/server/src/orchestration-v2/Adapters/OpenCode2AdapterV2.test.ts +++ b/apps/server/src/orchestration-v2/Adapters/OpenCode2AdapterV2.test.ts @@ -330,6 +330,7 @@ const resumed = ( readonly lastRunOrdinal?: number; readonly pendingBackgroundTasks?: OrchestrationV2ProviderThread["pendingBackgroundTasks"]; readonly goal?: OrchestrationV2ProviderThread["goal"]; + readonly contextUsage?: OrchestrationV2ProviderThread["contextUsage"]; readonly external?: boolean; readonly supervised?: boolean; readonly processExit?: Effect.Effect; @@ -398,6 +399,7 @@ const resumed = ( ? {} : { lastRunOrdinal: options.lastRunOrdinal }), ...(options?.goal === undefined ? {} : { goal: options.goal }), + ...(options?.contextUsage === undefined ? {} : { contextUsage: options.contextUsage }), ...(options?.pendingBackgroundTasks === undefined ? {} : { pendingBackgroundTasks: options.pendingBackgroundTasks }), @@ -509,6 +511,52 @@ it.layer(McpProviderSessions.layer)("OpenCode2 adapter", (it) => { }), ); + it.effect("drops context usage carried over from before a completed compaction", () => + Effect.gen(function* () { + const { runtime, thread } = yield* resumed( + [ + out("session.prompt", { sessionID: SESSION, text: "" }), + promptAccepted, + event("session.step.ended", { + sessionID: SESSION, + assistantMessageID: "msg_0eb735d5b001oAFVeY5jz3WD4Z", + finish: "stop", + cost: 0, + tokens: { input: 150_000, output: 40, reasoning: 0, cache: { read: 0, write: 0 } }, + }), + event("session.compaction.started", { sessionID: SESSION, reason: "manual", recent: "" }), + event("session.compaction.ended", { + sessionID: SESSION, + reason: "manual", + text: "Summary", + recent: "", + }), + event("session.execution.succeeded", { sessionID: SESSION }), + ], + { contextUsage: { usedTokens: 150_000, maxTokens: 160_000 } }, + ); + assert.equal(thread.contextUsage?.usedTokens, 150_000); + const collected = yield* runtime.events.pipe( + Stream.takeUntil((event) => event.type === "turn.terminal"), + Stream.runCollect, + Effect.forkScoped, + ); + yield* runtime.startTurn(turnInput(thread)); + const seen = yield* Fiber.join(collected); + const usage = seen.flatMap((event) => + event.type === "provider_thread.updated" ? [event.providerThread.contextUsage] : [], + ); + assert.isNull(usage.at(-1)); + const settled = seen.findLast( + (event) => + event.type === "provider_turn.updated" && event.providerTurn.completedAt !== null, + ); + assert.isUndefined( + settled?.type === "provider_turn.updated" ? settled.providerTurn.tokenUsage : "missing", + ); + }), + ); + it.effect("never sends a saved variant the catalog model does not list", () => Effect.gen(function* () { const { runtime, thread } = yield* resumed([ diff --git a/apps/web/src/lib/contextWindow.test.ts b/apps/web/src/lib/contextWindow.test.ts index 91cdf18682e2a..a9bef5448ff6d 100644 --- a/apps/web/src/lib/contextWindow.test.ts +++ b/apps/web/src/lib/contextWindow.test.ts @@ -70,6 +70,51 @@ describe("V2 context window presentation", () => { ?.usedTokens, ).toBe(2_000); }); + + it("prefers a completed compaction over usage reported before it", () => { + const usageBeforeCompaction = decodeTokenUsage({ + usedTokens: 985_000, + maxTokens: 1_000_000, + updatedAt: "2026-06-19T23:55:00.000Z", + }); + const snapshot = deriveLatestContextWindowSnapshot( + [compactionEntry(null)], + usageBeforeCompaction, + ); + expect(snapshot?.usedTokens).toBe(2_000); + expect(snapshot?.maxTokens).toBe(1_000_000); + + // A report in the compaction's own millisecond is the provider's post-compaction usage. + const reportedWithCompaction = decodeTokenUsage({ + usedTokens: 2_000, + maxTokens: 1_000_000, + autoCompactThreshold: 900_000, + updatedAt: "2026-06-20T00:00:00.000Z", + }); + expect( + deriveLatestContextWindowSnapshot([compactionEntry(null)], reportedWithCompaction) + ?.autoCompactThreshold, + ).toBe(900_000); + + const { afterTokenCount: _, ...withoutCount } = compactionEntry(null).item; + expect( + deriveLatestContextWindowSnapshot([{ item: withoutCount }], usageBeforeCompaction), + ).toBeNull(); + // A metadata-only provider thread update reports no usage, so an older count stays hidden. + const olderCompaction = { + item: { + ...compactionEntry(null).item, + updatedAt: DateTime.makeUnsafe("2026-06-19T00:00:00.000Z"), + }, + }; + expect( + deriveLatestContextWindowSnapshot([olderCompaction, { item: withoutCount }], null, { + id: ProviderThreadId.make("thread"), + contextUsage: null, + updatedAt: DateTime.makeUnsafe("2026-06-21T00:00:00.000Z"), + }), + ).toBeNull(); + }); }); describe("live provider-turn usage (#8144)", () => { diff --git a/packages/client-runtime/src/state/contextWindow.ts b/packages/client-runtime/src/state/contextWindow.ts index a8f7e0f88c355..37374b79b1b04 100644 --- a/packages/client-runtime/src/state/contextWindow.ts +++ b/packages/client-runtime/src/state/contextWindow.ts @@ -76,6 +76,54 @@ export function latestProviderTurnTokenUsage( ); } +type CompactionItem = Extract; + +// A retired provider thread's items say nothing about the active conversation. +function isRetiredProviderThreadItem( + item: CompactionItem, + providerThread: Pick | null | undefined, +): boolean { + return ( + providerThread != null && + item.providerThreadId != null && + item.providerThreadId !== providerThread.id + ); +} + +function compactionSnapshot( + item: CompactionItem, + maxTokens: number | null, + updatedAt: string, +): ContextWindowSnapshot | null { + const usedTokens = asFiniteNumber(item.afterTokenCount); + if (usedTokens === null || usedTokens < 0) return null; + const usedPercentage = + maxTokens !== null && maxTokens > 0 ? Math.min(100, (usedTokens / maxTokens) * 100) : null; + return { + usedTokens, + totalProcessedTokens: asFiniteNumber(item.beforeTokenCount), + maxTokens, + remainingTokens: maxTokens !== null ? Math.max(0, Math.round(maxTokens - usedTokens)) : null, + usedPercentage, + remainingPercentage: usedPercentage !== null ? Math.max(0, 100 - usedPercentage) : null, + inputTokens: null, + cachedInputTokens: null, + outputTokens: null, + reasoningOutputTokens: null, + lastUsedTokens: null, + lastInputTokens: null, + lastCachedInputTokens: null, + lastOutputTokens: null, + lastReasoningOutputTokens: null, + toolUses: null, + durationMs: null, + compactsAutomatically: true, + autoCompactThreshold: null, + cost: null, + updatedAt, + }; +} + export function deriveLatestContextWindowSnapshot( entries: ReadonlyArray<{ readonly item: ThreadStructureTurnItem; @@ -83,6 +131,30 @@ export function deriveLatestContextWindowSnapshot( liveUsage?: OrchestrationV2ProviderTurnTokenUsage | null, providerThread?: Pick | null, ): ContextWindowSnapshot | null { + const latestCompletedCompaction = entries.findLast( + (entry): entry is { readonly item: CompactionItem } => + entry.item.type === "compaction" && + entry.item.status === "completed" && + !isRetiredProviderThreadItem(entry.item, providerThread), + )?.item; + const usageUpdatedAt = + liveUsage?.updatedAt ?? + (providerThread?.contextUsage != null ? DateTime.formatIso(providerThread.updatedAt) : null); + if (latestCompletedCompaction !== undefined) { + const compactedAt = DateTime.formatIso( + latestCompletedCompaction.completedAt ?? latestCompletedCompaction.updatedAt, + ); + // Usage reported before the compaction describes the context it just discarded; usage at + // the same instant is the provider's own post-compaction report. + if (usageUpdatedAt === null || Date.parse(compactedAt) > Date.parse(usageUpdatedAt)) { + return compactionSnapshot( + latestCompletedCompaction, + liveUsage?.maxTokens ?? asFiniteNumber(providerThread?.contextUsage?.maxTokens), + compactedAt, + ); + } + } + if (liveUsage != null) { const usedTokens = Math.max(0, liveUsage.usedTokens); const maxTokens = liveUsage.maxTokens ?? null; @@ -151,54 +223,16 @@ export function deriveLatestContextWindowSnapshot( }; } for (let index = entries.length - 1; index >= 0; index -= 1) { - const entry = entries[index]; - if (!entry || entry.item.type !== "compaction") { - continue; - } - const payload = entry.item; - // A retired provider thread's compaction says nothing about the active conversation. - if ( - providerThread != null && - payload.providerThreadId != null && - payload.providerThreadId !== providerThread.id - ) { - continue; - } - const usedTokens = asFiniteNumber(payload.afterTokenCount); - if (usedTokens === null || usedTokens < 0) { + const item = entries[index]?.item; + if (item?.type !== "compaction" || isRetiredProviderThreadItem(item, providerThread)) { continue; } - - const maxTokens = null; - const usedPercentage = - maxTokens !== null && maxTokens > 0 ? Math.min(100, (usedTokens / maxTokens) * 100) : null; - const remainingTokens = - maxTokens !== null ? Math.max(0, Math.round(maxTokens - usedTokens)) : null; - const remainingPercentage = usedPercentage !== null ? Math.max(0, 100 - usedPercentage) : null; - - return { - usedTokens, - totalProcessedTokens: asFiniteNumber(payload.beforeTokenCount), - maxTokens, - remainingTokens, - usedPercentage, - remainingPercentage, - inputTokens: null, - cachedInputTokens: null, - outputTokens: null, - reasoningOutputTokens: null, - lastUsedTokens: null, - lastInputTokens: null, - lastCachedInputTokens: null, - lastOutputTokens: null, - lastReasoningOutputTokens: null, - toolUses: null, - durationMs: null, - compactsAutomatically: true, - autoCompactThreshold: null, - cost: null, - updatedAt: DateTime.formatIso(payload.startedAt ?? payload.updatedAt), - }; + const snapshot = compactionSnapshot( + item, + null, + DateTime.formatIso(item.startedAt ?? item.updatedAt), + ); + if (snapshot !== null) return snapshot; } return null; diff --git a/packages/provider-opencode/src/server/adapter.test.ts b/packages/provider-opencode/src/server/adapter.test.ts index 76ba68319384c..96e6cd7aa4ae7 100644 --- a/packages/provider-opencode/src/server/adapter.test.ts +++ b/packages/provider-opencode/src/server/adapter.test.ts @@ -1082,6 +1082,94 @@ describe("OpenCodeAdapterV2", () => { }).pipe(Effect.provide(Layer.merge(IdAllocator.layer, McpProviderSessions.layer))), ); + it.effect("drops context usage carried over from before a completed compaction", () => + Effect.gen(function* () { + const nativeEvents = asyncEventStream(); + let promptId = ""; + const harness = yield* makeOpenCodeRuntimeHarness("compaction-usage", "root", { + event: { subscribe: async () => ({ stream: nativeEvents.stream }) }, + session: { + create: async () => ({ data: { id: "root", time: { created: 1, updated: 1 } } }), + get: async () => ({ data: { id: "root", time: { created: 1, updated: 1 } } }), + promptAsync: async (input: { messageID: string }) => { + promptId = input.messageID; + return { data: true }; + }, + abort: async () => ({ data: true }), + children: async () => ({ data: [] }), + }, + }); + const inherited = yield* harness.runtime.resumeThread({ + providerThread: { + ...harness.providerThread, + contextUsage: { usedTokens: 150_000, maxTokens: 160_000 }, + }, + }); + const received = yield* harness.runtime.events.pipe( + Stream.takeUntil((event) => event.type === "turn.terminal"), + Stream.runCollect, + Effect.forkScoped, + ); + yield* harness.startTurn("hello", inherited); + const status = (type: "busy" | "idle") => ({ + type: "session.status", + properties: { sessionID: "root", status: { type } }, + }); + yield* Effect.promise(() => + nativeEvents.push({ + type: "message.updated", + properties: { + sessionID: "root", + info: { id: promptId, role: "user", time: { created: 1 } }, + }, + }), + ); + yield* Effect.promise(() => nativeEvents.push(status("busy"))); + yield* Effect.promise(() => + nativeEvents.push({ + type: "message.updated", + properties: { + sessionID: "root", + info: { id: "assistant", role: "assistant", time: { created: 1 }, parentID: promptId }, + }, + }), + ); + yield* Effect.promise(() => + nativeEvents.push({ + type: "message.part.updated", + properties: { + part: { + type: "step-finish", + id: "pre-compaction-step", + sessionID: "root", + messageID: "assistant", + reason: "stop", + cost: 0, + tokens: { input: 150_000, output: 40, reasoning: 0, cache: { read: 0, write: 0 } }, + }, + }, + }), + ); + yield* Effect.promise(() => + nativeEvents.push({ type: "session.compacted", properties: { sessionID: "root" } }), + ); + yield* Effect.promise(() => nativeEvents.push(status("idle"))); + + const events = Array.from(yield* Fiber.join(received)); + const usage = events.flatMap((event) => + event.type === "provider_thread.updated" ? [event.providerThread.contextUsage] : [], + ); + assert.isNull(usage.at(-1)); + const settled = events.findLast( + (event) => + event.type === "provider_turn.updated" && event.providerTurn.completedAt !== null, + ); + assert.isUndefined( + settled?.type === "provider_turn.updated" ? settled.providerTurn.tokenUsage : "missing", + ); + }).pipe(Effect.provide(Layer.merge(IdAllocator.layer, McpProviderSessions.layer))), + ); + it.effect("fails an explicit compaction that OpenCode reports as a context overflow", () => Effect.gen(function* () { const nativeEvents = asyncEventStream(); diff --git a/packages/provider-opencode/src/server/adapter.ts b/packages/provider-opencode/src/server/adapter.ts index 0f817ca7242b8..38fd4070566a3 100644 --- a/packages/provider-opencode/src/server/adapter.ts +++ b/packages/provider-opencode/src/server/adapter.ts @@ -2637,6 +2637,11 @@ export const makeOpenCodeAdapterV2 = Effect.fn("makeOpenCodeAdapterV2")(function updatedAt: now, }, }); + // The pre-compaction step would otherwise settle the turn as its newest usage. + turn.usage.lastStep = null; + if (state.providerThread.contextUsage !== null) { + yield* updateProviderThread(state, { contextUsage: null }); + } }); const handleMessageUpdated = Effect.fnUntraced(function* ( diff --git a/packages/provider-opencode/src/server/v2/adapter.ts b/packages/provider-opencode/src/server/v2/adapter.ts index 0072f9d1897b7..0da481a474b37 100644 --- a/packages/provider-opencode/src/server/v2/adapter.ts +++ b/packages/provider-opencode/src/server/v2/adapter.ts @@ -1499,6 +1499,16 @@ export const make = Effect.fn("OpenCode2Adapter.make")(function* (instanceId: Pr ...(summary === undefined || summary.length === 0 ? {} : { summary }), }, }); + // The pre-compaction step would otherwise settle the turn as its newest usage. + if (status === "completed") turn.lastStep = undefined; + if (status === "completed" && state.providerThread.contextUsage !== null) { + state.providerThread = { + ...state.providerThread, + contextUsage: null, + updatedAt, + }; + yield* emitProviderThread(state); + } if (status !== "running") turn.compaction = undefined; }); From bc6062805db775019cf6f13cc543e694ad9e20fc Mon Sep 17 00:00:00 2001 From: magnificentcritter22 <125306644+magnificentcritter22@users.noreply.github.com> Date: Thu, 19 Nov 2026 13:08:25 +0300 Subject: [PATCH 005/201] fix(web): preserve file preview selection after scrolling back (#39057) Co-authored-by: Julius Marminge --- .../ReadOnlySourcePreview.browser.test.tsx | 58 +++++++++++-------- .../src/components/files/sourceSelection.ts | 33 ++++++++++- 2 files changed, 63 insertions(+), 28 deletions(-) diff --git a/apps/web/src/components/files/ReadOnlySourcePreview.browser.test.tsx b/apps/web/src/components/files/ReadOnlySourcePreview.browser.test.tsx index a64cb3cbb3996..db283737bc142 100644 --- a/apps/web/src/components/files/ReadOnlySourcePreview.browser.test.tsx +++ b/apps/web/src/components/files/ReadOnlySourcePreview.browser.test.tsx @@ -88,31 +88,39 @@ describe("ReadOnlySourcePreview", () => { expect(copiedText(rows()[0]!)).toBe(contents); }); - it("copies a partial selection after its rows scroll out of the mounted window", async () => { - await getSyntaxHighlighterPromise("text"); - await using screen = await render( -
- -
, - ); - const root = screen.container.querySelector("diffs-container")!.shadowRoot!; - const rows = () => root.querySelectorAll("[data-line]"); - await vi.waitFor(() => expect(rows()[0]?.textContent).toBe("line 1")); - - const rowText = (line: number) => - [...rows()].find((row) => row.textContent === `line ${line}`)!.querySelector("span")! - .firstChild!; - document.getSelection()!.setBaseAndExtent(rowText(5), 0, rowText(20), "line 20".length); - const selected = Array.from({ length: 16 }, (_, index) => `line ${index + 5}`).join("\n"); - - const scroller = screen.container.querySelector(".file-preview-virtualizer")!; - scroller.scrollTop = scroller.scrollHeight; - await vi.waitFor(() => expect(rows()[0]?.textContent).not.toBe("line 1")); - scroller.scrollTop = 0; - await vi.waitFor(() => expect(rows()[0]?.textContent).toBe("line 1")); - - expect(copiedText(rows()[0]!) ?? document.getSelection()!.toString()).toBe(selected); - }); + it.each([ + { contents: text, height: 400 }, + // Short enough that rows of the selection stay mounted with the preview scrolled to the bottom. + { contents: text.split("\n").slice(0, 163).join("\n"), height: 800 }, + ])( + "restores and copies a partial selection after scrolling away and back ($height px)", + async ({ contents, height }) => { + await getSyntaxHighlighterPromise("text"); + await using screen = await render( +
+ +
, + ); + const root = screen.container.querySelector("diffs-container")!.shadowRoot!; + const rows = () => root.querySelectorAll("[data-line]"); + await vi.waitFor(() => expect(rows()[0]?.textContent).toBe("line 1")); + + const rowText = (line: number) => + [...rows()].find((row) => row.textContent === `line ${line}`)!.querySelector("span")! + .firstChild!; + document.getSelection()!.setBaseAndExtent(rowText(5), 0, rowText(20), "line 20".length); + const selected = Array.from({ length: 16 }, (_, index) => `line ${index + 5}`).join("\n"); + + const scroller = screen.container.querySelector(".file-preview-virtualizer")!; + scroller.scrollTop = scroller.scrollHeight; + await vi.waitFor(() => expect(rows()[0]?.textContent).not.toBe("line 1")); + scroller.scrollTop = 0; + await vi.waitFor(() => expect(rows()[0]?.textContent).toBe("line 1")); + + expect(document.getSelection()!.toString()).toBe(selected); + expect(copiedText(rows()[0]!) ?? document.getSelection()!.toString()).toBe(selected); + }, + ); it("drops a selection scrolled out of the mounted window when a click lands on its edge", async () => { await getSyntaxHighlighterPromise("text"); diff --git a/apps/web/src/components/files/sourceSelection.ts b/apps/web/src/components/files/sourceSelection.ts index f88e114826183..a9f9de0d3e654 100644 --- a/apps/web/src/components/files/sourceSelection.ts +++ b/apps/web/src/components/files/sourceSelection.ts @@ -51,8 +51,13 @@ export class SourceSelection { #pressed = false; /** A press that places a caret, where a collapsed selection is the click's and never a kept one. */ #clicking = false; - /** The browser's selection as a render left it during a press, when nothing was drawn over it. */ - #parked: { readonly range: StaticRange | undefined } | undefined; + /** + * The browser's selection as last left: by a render during a press when nothing was drawn over it, + * or (`clippedByRender`) as drawn clipped to the mounted rows, which must not be read back as the ends. + */ + #parked: + | { readonly range: StaticRange | undefined; readonly clippedByRender: boolean } + | undefined; #use(text: string) { if (text === this.#text) return; @@ -156,6 +161,14 @@ export class SourceSelection { this.#ends = undefined; return undefined; } + const parked = this.#parked; + if ( + parked?.clippedByRender && + (sameRange(range, parked.range) || (afterRender && !this.#pressed)) + ) { + return this.#mounted(root); + } + if (parked?.clippedByRender) this.#parked = undefined; if (range && !(root.contains(range.startContainer) && root.contains(range.endContainer))) { this.#ends = undefined; return undefined; @@ -222,10 +235,15 @@ export class SourceSelection { const focus = this.#pointAt(this.#ends.focus, mounted); const selection = document.getSelection(); const range = selection?.getComposedRanges({ shadowRoots: [root] })[0]; + const { anchor: anchorOffset, focus: focusOffset } = this.#ends; + const clipped = + anchorOffset !== focusOffset && + (Math.min(anchorOffset, focusOffset) < mounted.start || + Math.max(anchorOffset, focusOffset) > mounted.end); if (this.#pressed && anchor.node === focus.node && anchor.offset === focus.offset) { // Chromium stops extending a drag once a script collapses its selection, so a drag whose // ends are both unmounted keeps what the browser has left of it. - this.#parked = { range }; + this.#parked = { range, clippedByRender: false }; return; } const [start, end] = selection?.direction === "backward" ? [focus, anchor] : [anchor, focus]; @@ -235,9 +253,17 @@ export class SourceSelection { range.endContainer === end.node && range.endOffset === end.offset ) { + if (clipped) this.#parked = { range, clippedByRender: true }; return; } selection?.setBaseAndExtent(anchor.node, anchor.offset, focus.node, focus.offset); + if (clipped) { + // A projected endpoint can become an interior point when its DOM row survives the next render. + this.#parked = { + range: selection?.getComposedRanges({ shadowRoots: [root] })[0], + clippedByRender: true, + }; + } } /** Call after rows mount or unmount, to draw the selection onto the rows now there. */ @@ -249,6 +275,7 @@ export class SourceSelection { press(extending: boolean) { this.#pressed = true; this.#clicking = !extending; + if (!extending) this.#parked = undefined; } release(root: ShadowRoot, text: string) { From 693e8c7db41e1090ada14f1cb16a91ce9886909b Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Thu, 19 Nov 2026 02:21:53 -0800 Subject: [PATCH 006/201] fix(server): released provider sessions no longer stay on the heap (#39049) --- .../ProviderSessionManager.test.ts | 53 +++++++++++++++++-- .../ProviderSessionManager.ts | 10 +++- 2 files changed, 58 insertions(+), 5 deletions(-) diff --git a/apps/server/src/orchestration-v2/ProviderSessionManager.test.ts b/apps/server/src/orchestration-v2/ProviderSessionManager.test.ts index 0fef80c4e0361..185bf0f019bbe 100644 --- a/apps/server/src/orchestration-v2/ProviderSessionManager.test.ts +++ b/apps/server/src/orchestration-v2/ProviderSessionManager.test.ts @@ -157,6 +157,31 @@ const layerPausingAttachEventSink = (pause: { }), ).pipe(Layer.provide(layerTestEventSink)); +const layerReleaseRecordedEventSink = (recorded: Deferred.Deferred) => + Layer.effect( + EventSink.EventSinkV2, + Effect.gen(function* () { + const delegate = yield* EventSink.EventSinkV2; + return EventSink.EventSinkV2.of({ + ...delegate, + write: (input) => + delegate + .write(input) + .pipe( + Effect.tap(() => + input.events.some( + (event) => + event.type === "provider-session.updated" && + (event.payload.status === "stopped" || event.payload.status === "error"), + ) + ? Deferred.succeed(recorded, undefined) + : Effect.void, + ), + ), + }); + }), + ).pipe(Layer.provide(layerTestEventSink)); + const layerBeforeUnchangedWriteEventSink = ( before: Ref.Ref>, // One effect runs before each turn-item write, in order. @@ -466,6 +491,7 @@ const makeProviderAdapter = Effect.fnUntraced(function* ( readonly archive?: Effect.Effect; readonly spawnBeforeOpen?: boolean; readonly scopeCloseReached?: Deferred.Deferred; + readonly eventStreamsEnded?: Queue.Queue; } = {}, ) { const mcpSessions = yield* McpProviderSessions.McpProviderSessions; @@ -558,6 +584,11 @@ const makeProviderAdapter = Effect.fnUntraced(function* ( if (event.type === "provider_session.updated") session = event.providerSession; }), ), + Stream.ensuring( + options.eventStreamsEnded === undefined + ? Effect.void + : Queue.offer(options.eventStreamsEnded, input.providerSessionId), + ), ), ...(options.backgroundTasksEndWithProcess === false ? {} @@ -648,6 +679,8 @@ function layerTest(input: { readonly archive?: Effect.Effect; readonly spawnBeforeOpen?: boolean; readonly scopeCloseReached?: Deferred.Deferred; + readonly eventStreamsEnded?: Queue.Queue; + readonly releaseRecorded?: Deferred.Deferred; readonly serverSettingsLayer?: ReturnType; readonly projectServiceLayer?: Layer.Layer; readonly installationGateLayer?: Layer.Layer; @@ -664,7 +697,9 @@ function layerTest(input: { ) : input.failReleaseEventWrites ? layerFailingReleaseEventSink - : layerTestEventSink; + : input.releaseRecorded !== undefined + ? layerReleaseRecordedEventSink(input.releaseRecorded) + : layerTestEventSink; const layerRegistry = Layer.unwrap( makeProviderAdapter(input.state, { failEventStream: input.failEventStream ?? false, @@ -698,6 +733,9 @@ function layerTest(input: { ...(input.scopeCloseReached === undefined ? {} : { scopeCloseReached: input.scopeCloseReached }), + ...(input.eventStreamsEnded === undefined + ? {} + : { eventStreamsEnded: input.eventStreamsEnded }), }).pipe(Effect.map(ProviderAdapterRegistry.layerSingle)), ); const layerConfiguredMcpRegistry = @@ -1099,6 +1137,7 @@ it.effect("ProviderSessionManagerV2 opens independent sessions concurrently", () it.effect("ProviderSessionManagerV2 closes every live session for a provider instance", () => Effect.gen(function* () { const state = yield* Ref.make(emptyState); + const eventStreamsEnded = yield* Queue.unbounded(); const effect = Effect.gen(function* () { const eventSink = yield* EventSink.EventSinkV2; const idAllocator = yield* IdAllocator.IdAllocatorV2; @@ -1139,6 +1178,9 @@ it.effect("ProviderSessionManagerV2 closes every live session for a provider ins assert.isTrue(Option.isNone(yield* manager.get(firstProviderSessionId))); assert.isTrue(Option.isNone(yield* manager.get(secondProviderSessionId))); assert.equal((yield* Ref.get(state)).closeCount, 2); + // Like Codex and Claude, the fake adapter never ends its event queue; release must still stop the pump. + const ended = [yield* Queue.take(eventStreamsEnded), yield* Queue.take(eventStreamsEnded)]; + assert.sameMembers(ended, [firstProviderSessionId, secondProviderSessionId]); }); yield* effect.pipe( @@ -1146,6 +1188,7 @@ it.effect("ProviderSessionManagerV2 closes every live session for a provider ins layerTest({ state, idleTimeoutMs: 60_000, + eventStreamsEnded, }), ), ); @@ -2216,6 +2259,7 @@ it.effect("ProviderSessionManagerV2 interrupts event subscriptions on server shu it.effect("ProviderSessionManagerV2 drains subscribers when the provider stops", () => Effect.gen(function* () { const state = yield* Ref.make(emptyState); + const unloads = yield* Queue.unbounded(); const effect = Effect.gen(function* () { const eventSink = yield* EventSink.EventSinkV2; const idAllocator = yield* IdAllocator.IdAllocatorV2; @@ -2273,11 +2317,12 @@ it.effect("ProviderSessionManagerV2 drains subscribers when the provider stops", events.map((event) => event.type), ["turn.terminal", "provider_session.updated"], ); + assert.equal(yield* Queue.take(unloads), "close"); assert.isTrue(Option.isNone(yield* manager.get(providerSessionId))); assert.equal((yield* Ref.get(state)).closeCount, 1); }); - yield* effect.pipe(Effect.provide(layerTest({ state, idleTimeoutMs: 60_000 }))); + yield* effect.pipe(Effect.provide(layerTest({ state, idleTimeoutMs: 60_000, unloads }))); }), ); @@ -3847,6 +3892,7 @@ it.effect( it.effect("ProviderSessionManagerV2 releases sessions when provider event streams fail", () => Effect.gen(function* () { const state = yield* Ref.make(emptyState); + const releaseRecorded = yield* Deferred.make(); const effect = Effect.gen(function* () { const eventSink = yield* EventSink.EventSinkV2; const idAllocator = yield* IdAllocator.IdAllocatorV2; @@ -3875,7 +3921,7 @@ it.effect("ProviderSessionManagerV2 releases sessions when provider event stream runtimePolicy, }); yield* runtime.events.pipe(Stream.runDrain, Effect.ignore, Effect.forkScoped); - yield* Effect.yieldNow; + yield* Deferred.await(releaseRecorded); const liveSession = yield* manager.get(providerSessionId); const runtimeState = yield* Ref.get(state); @@ -3896,6 +3942,7 @@ it.effect("ProviderSessionManagerV2 releases sessions when provider event stream state, idleTimeoutMs: 1000, failEventStream: true, + releaseRecorded, }), ), ); diff --git a/apps/server/src/orchestration-v2/ProviderSessionManager.ts b/apps/server/src/orchestration-v2/ProviderSessionManager.ts index 113821ea5a134..4df9d60b545d7 100644 --- a/apps/server/src/orchestration-v2/ProviderSessionManager.ts +++ b/apps/server/src/orchestration-v2/ProviderSessionManager.ts @@ -23,6 +23,7 @@ import * as Cause from "effect/Cause"; import * as Clock from "effect/Clock"; import * as Context from "effect/Context"; import * as DateTime from "effect/DateTime"; +import * as Deferred from "effect/Deferred"; import * as Duration from "effect/Duration"; import * as Effect from "effect/Effect"; import * as Exit from "effect/Exit"; @@ -2774,11 +2775,13 @@ export const layerWithOptions = ( }; }; - const startEventPump = (entry: LiveSessionEntry) => { + const startEventPump = (entry: LiveSessionEntry, sessionClosed: Deferred.Deferred) => { let stoppedByProvider = false; let lastSessionStatus = entry.runtime.providerSession.status; const retryStalls = makeRetryStallWatch(entry); return entry.runtime.events.pipe( + // Several adapters never end their event stream, and a parked pump retains the whole session. + Stream.interruptWhen(Deferred.await(sessionClosed)), Stream.runForEach((nativeEvent) => { if (shutdownSignal.received) return Effect.void; // Live output bypasses persistence and subscribers so floods cannot delay domain events. @@ -3043,6 +3046,9 @@ export const layerWithOptions = ( } }); const sessionScope = yield* Scope.fork(sessionScopes); + // Added before the adapter's finalizers so it runs after them: the pump drains shutdown events first. + const sessionClosed = yield* Deferred.make(); + yield* Scope.addFinalizer(sessionScope, Deferred.done(sessionClosed, Exit.void)); yield* agentScope.clear(input.threadId); const runtime = yield* installationGate .execute( @@ -3157,7 +3163,7 @@ export const layerWithOptions = ( ).pipe(logReleaseFailure(input.providerSessionId)), ), ); - yield* startEventPump(entry); + yield* startEventPump(entry, sessionClosed); yield* scheduleIdleRelease(input.providerSessionId); return exposedRuntime; }), From 2f577fa397340c591ec8c43cb55e717b5981ae0c Mon Sep 17 00:00:00 2001 From: Wout Stiens <71498452+StiensWout@users.noreply.github.com> Date: Thu, 19 Nov 2026 11:25:58 +0100 Subject: [PATCH 007/201] test(server): wait for the settings watcher before restoring the directory (#39056) Co-authored-by: Julius Marminge --- apps/server/src/serverSettings.test.ts | 173 ++++++++++++++++++ apps/server/src/serverSettings.ts | 117 ++++++++---- ...tored-settings-directory-stays-live.e2e.ts | 102 +++++++++++ 3 files changed, 361 insertions(+), 31 deletions(-) create mode 100644 scripts/scenarios/restored-settings-directory-stays-live.e2e.ts diff --git a/apps/server/src/serverSettings.test.ts b/apps/server/src/serverSettings.test.ts index 10d0b3fe6c1e6..f837fd8ca9722 100644 --- a/apps/server/src/serverSettings.test.ts +++ b/apps/server/src/serverSettings.test.ts @@ -32,6 +32,7 @@ import * as Schema from "effect/Schema"; import * as Stream from "effect/Stream"; import * as SchemaAST from "effect/SchemaAST"; import * as SqlClient from "effect/sql/SqlClient"; +import * as TestClock from "effect/testing/TestClock"; import * as ServerSecretStore from "./auth/ServerSecretStore.ts"; import { sourceControlHostSecretName } from "./sourceControl/sourceControlHostSecrets.ts"; import * as ServerConfig from "./config.ts"; @@ -3121,3 +3122,175 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))( ); }, ); + +it.live("reloads a symlinked settings file after its target directory is replaced", () => + Effect.gen(function* () { + const config = yield* ServerConfig.ServerConfig; + const fs = yield* FileSystem.FileSystem; + const path = yield* Path.Path; + const service = yield* ServerSettingsModule.ServerSettingsService; + const dotfiles = yield* fs.makeTempDirectoryScoped({ prefix: "t3-settings-dotfiles-" }); + const active = path.join(dotfiles, "active"); + const restored = path.join(dotfiles, "restored"); + yield* fs.makeDirectory(active); + yield* fs.makeDirectory(restored); + yield* fs.writeFileString( + path.join(active, "settings.json"), + `{ "responseStreamingMode": "turn" }`, + ); + yield* fs.writeFileString( + path.join(restored, "settings.json"), + `{ "responseStreamingMode": "turn" }`, + ); + yield* fs.remove(config.settingsPath, { force: true }); + yield* fs.symlink(path.join(active, "settings.json"), config.settingsPath); + yield* service.start; + const changes = yield* service.subscribeChanges; + + yield* fs.writeFileString( + path.join(restored, "settings.json"), + `{ "responseStreamingMode": "turn", "defaultAutoPull": true }`, + ); + yield* fs.rename(active, path.join(dotfiles, "previous")); + yield* fs.rename(restored, active); + + const restoredSettings = yield* changes.pipe( + Stream.filter((settings) => settings.defaultAutoPull), + Stream.runHead, + ); + assert.isTrue(Option.isSome(restoredSettings)); + + yield* fs.writeFileString( + path.join(active, "settings.json"), + `{ "responseStreamingMode": "paragraph" }`, + ); + + const reloaded = yield* changes.pipe( + Stream.filter((settings) => settings.responseStreamingMode === "paragraph"), + Stream.runHead, + ); + assert.isTrue(Option.isSome(reloaded)); + }).pipe( + Effect.scoped, + // @effect-diagnostics-next-line multipleEffectProvide:off -- the settings layer reads the Node services provided below. + Effect.provide(layerServerSettings()), + Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer)), + ), +); + +it.effect("starts with symlinked settings when the settings directory watch fails", () => + Effect.gen(function* () { + const fs = yield* FileSystem.FileSystem; + const path = yield* Path.Path; + let settingsDirectory: string | undefined; + const watchFailure = PlatformError.systemError({ + _tag: "Unknown", + module: "FileSystem", + method: "watch", + description: "No file watches available.", + }); + const failingFileSystem = FileSystem.FileSystem.of({ + ...fs, + watch: (directory, options) => + directory === settingsDirectory ? Stream.fail(watchFailure) : fs.watch(directory, options), + }); + const settingsLayer = layerServerSettings().pipe( + Layer.provide(Layer.succeed(FileSystem.FileSystem, failingFileSystem)), + ); + + yield* Effect.gen(function* () { + const config = yield* ServerConfig.ServerConfig; + const service = yield* ServerSettingsModule.ServerSettingsService; + settingsDirectory = path.dirname(config.settingsPath); + const dotfiles = yield* fs.makeTempDirectoryScoped({ prefix: "t3-settings-dotfiles-" }); + const target = path.join(dotfiles, "settings.json"); + yield* fs.writeFileString(target, `{ "responseStreamingMode": "paragraph" }`); + yield* fs.remove(config.settingsPath, { force: true }); + yield* fs.symlink(target, config.settingsPath); + + yield* service.start; + + const settings = yield* service.getSettings; + assert.equal(settings.responseStreamingMode, "paragraph"); + }).pipe(Effect.provide(settingsLayer)); + }).pipe(Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))), +); + +it.effect("publishes edits made before the restored settings watch is registered", () => + Effect.gen(function* () { + const fs = yield* FileSystem.FileSystem; + const path = yield* Path.Path; + const dotfiles = yield* fs.makeTempDirectoryScoped({ prefix: "t3-settings-dotfiles-" }); + const active = path.join(dotfiles, "active"); + const restored = path.join(dotfiles, "restored"); + const target = path.join(active, "settings.json"); + yield* fs.makeDirectory(active); + yield* fs.makeDirectory(restored); + yield* fs.writeFileString(target, `{ "responseStreamingMode": "turn" }`); + yield* fs.writeFileString( + path.join(restored, "settings.json"), + `{ "responseStreamingMode": "turn" }`, + ); + + const replaced = yield* Deferred.make(); + const registering = yield* Deferred.make(); + const allowRegistration = yield* Deferred.make(); + const settingsLayer = layerServerSettings().pipe( + Layer.provide( + Layer.succeed( + FileSystem.FileSystem, + FileSystem.FileSystem.of({ + ...fs, + watch: (directory, options) => + Stream.unwrap( + Effect.gen(function* () { + if (directory === dotfiles) { + options?.onReady?.(); + return Stream.fromEffect(Deferred.await(replaced)).pipe( + Stream.as({ _tag: "Create", path: "active" } as const), + Stream.concat(Stream.never), + ); + } + if (directory !== active) return fs.watch(directory, options); + if (yield* Deferred.isDone(replaced)) { + yield* Deferred.succeed(registering, undefined); + yield* Deferred.await(allowRegistration); + } + options?.onReady?.(); + return Stream.never; + }), + ), + }), + ), + ), + ); + + yield* Effect.gen(function* () { + const config = yield* ServerConfig.ServerConfig; + const service = yield* ServerSettingsModule.ServerSettingsService; + yield* fs.symlink(target, config.settingsPath); + yield* service.start; + const changes = yield* service.subscribeChanges; + + yield* fs.rename(active, path.join(dotfiles, "previous")); + yield* fs.rename(restored, active); + // Deliver the event on the test clock so it drains the watcher and any eager debounce. + yield* Deferred.succeed(replaced, undefined).pipe( + Effect.delay(1), + Effect.forkScoped({ startImmediately: true }), + ); + yield* TestClock.adjust("1 second"); + yield* Deferred.await(registering); + yield* service.withSettingsSnapshot(() => Effect.void); + yield* fs.writeFileString(target, `{ "responseStreamingMode": "paragraph" }`); + yield* Deferred.succeed(allowRegistration, undefined).pipe( + Effect.delay(1), + Effect.forkScoped({ startImmediately: true }), + ); + yield* TestClock.adjust("1 second"); + + const published = yield* changes.pipe(Stream.runHead); + assert.equal(Option.getOrThrow(published).responseStreamingMode, "paragraph"); + }).pipe(Effect.provide(settingsLayer)); + }).pipe(Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))), +); diff --git a/apps/server/src/serverSettings.ts b/apps/server/src/serverSettings.ts index e720fea50886d..66f0595aab3a8 100644 --- a/apps/server/src/serverSettings.ts +++ b/apps/server/src/serverSettings.ts @@ -1277,22 +1277,63 @@ const make = Effect.gen(function* () { }), ); - const watchFileChanges = (filePath: string) => { + // `ready` completes once the watch is registered, or once it fails to be. + const watchFileChanges = (filePath: string, ready: Deferred.Deferred) => { const directory = pathService.dirname(filePath); const fileName = pathService.basename(filePath); const resolvedFilePath = pathService.resolve(filePath); - return fs - .watch(directory) - .pipe( - Stream.filter( - (event) => - event.path === fileName || - event.path === filePath || - pathService.resolve(directory, event.path) === resolvedFilePath, - ), - ); + const markReady = () => Deferred.doneUnsafe(ready, Exit.void); + return fs.watch(directory, { onReady: markReady }).pipe( + Stream.filter( + (event) => + event.path === fileName || + event.path === filePath || + pathService.resolve(directory, event.path) === resolvedFilePath, + ), + Stream.as(undefined), + Stream.ensuring(Effect.sync(markReady)), + ); }; + // A directory watch follows the directory's inode, so when the target's + // directory is renamed away and another takes its path, watch the new one. + const watchLinkTargetChanges = (linkTargetPath: string, ready: Deferred.Deferred) => + Stream.unwrap( + Effect.gen(function* () { + const parentReady = yield* Deferred.make(); + const replacements = yield* watchFileChanges( + pathService.dirname(linkTargetPath), + parentReady, + ).pipe( + // Native watch registration can throw, including when the OS runs out of watches. + Stream.ignoreCause({ log: true }), + Stream.toQueue({ capacity: 1, strategy: "sliding" }), + ); + // Start buffering replacements before attaching to the target directory's inode. + yield* Deferred.await(parentReady); + + const targetChanges = Stream.unwrap( + Effect.gen(function* () { + const registered = yield* Deferred.make(); + return Stream.merge( + watchFileChanges(linkTargetPath, registered).pipe(Stream.ignoreCause({ log: true })), + // Startup reloads once ready. Later watches trigger their own reload. + Stream.fromEffect( + Deferred.await(registered).pipe(Effect.andThen(Deferred.succeed(ready, undefined))), + ).pipe( + Stream.filter((completedStartup) => !completedStartup), + Stream.as(undefined), + ), + ); + }), + ); + return Stream.make(targetChanges).pipe( + Stream.concat(Stream.fromQueue(replacements).pipe(Stream.as(targetChanges))), + Stream.switchMap((changes) => changes), + ); + }), + ); + const startWatcher = Effect.gen(function* () { const settingsDir = pathService.dirname(settingsPath); @@ -1324,30 +1365,44 @@ const make = Effect.gen(function* () { return Option.some(linkTargetPath); }).pipe(Effect.orElseSucceed(() => Option.none())); - const initialLinkTarget = yield* watchLinkTarget; - const linkTargetEvents = Stream.make(initialLinkTarget).pipe( - Stream.concat(watchFileChanges(settingsPath).pipe(Stream.mapEffect(() => watchLinkTarget))), - Stream.changes, - Stream.switchMap( - Option.match({ - onNone: () => Stream.empty, - onSome: (linkTargetPath) => - watchFileChanges(linkTargetPath).pipe(Stream.ignore({ log: true })), - }), - ), - ); - - // Saves emit multiple events; fs.watch may fire before content is flushed. - const debouncedSettingsEvents = Stream.merge( - watchFileChanges(settingsPath), - linkTargetEvents, - ).pipe(Stream.debounce(Duration.millis(100))); + const settingsReady = yield* Deferred.make(); + const linkTargetReady = yield* Deferred.make(); + yield* Effect.gen(function* () { + const [settingsEvents, resolveEvents] = yield* watchFileChanges( + settingsPath, + settingsReady, + ).pipe( + Stream.ignoreCause({ log: true }), + Stream.broadcastN({ n: 2, capacity: 1, strategy: "sliding" }), + ); + // Buffer settings path changes while resolving the first target. + const linkTargetEvents = Stream.fromEffect( + Deferred.await(settingsReady).pipe(Effect.andThen(watchLinkTarget)), + ).pipe( + Stream.concat(resolveEvents.pipe(Stream.mapEffect(() => watchLinkTarget))), + Stream.changes, + Stream.switchMap( + Option.match({ + onNone: () => + Stream.fromEffect(Deferred.succeed(linkTargetReady, undefined)).pipe(Stream.drain), + onSome: (linkTargetPath) => watchLinkTargetChanges(linkTargetPath, linkTargetReady), + }), + ), + ); - yield* Stream.runForEach(debouncedSettingsEvents, () => revalidateAndEmitSafely).pipe( + // Saves emit multiple events; fs.watch may fire before content is flushed. + yield* Stream.merge(settingsEvents, linkTargetEvents).pipe( + Stream.debounce(Duration.millis(100)), + Stream.runForEach(() => revalidateAndEmitSafely), + ); + }).pipe( + Effect.scoped, Effect.ignoreCause({ log: true }), + Effect.ensuring(Deferred.succeed(linkTargetReady, undefined)), Effect.forkIn(watcherScope), - Effect.asVoid, ); + // Edits made once `start` returns must reach a registered watch. + yield* Deferred.await(linkTargetReady); }); const start = Effect.gen(function* () { diff --git a/scripts/scenarios/restored-settings-directory-stays-live.e2e.ts b/scripts/scenarios/restored-settings-directory-stays-live.e2e.ts new file mode 100644 index 0000000000000..a7385da3acd85 --- /dev/null +++ b/scripts/scenarios/restored-settings-directory-stays-live.e2e.ts @@ -0,0 +1,102 @@ +import { expect } from "e2e"; +import * as Effect from "effect/Effect"; +import * as FileSystem from "effect/FileSystem"; +import * as Schema from "effect/Schema"; + +import { T3_HOME } from "../e2e.config.ts"; +import { runPromise, test, WEB } from "./t3.ts"; + +const decodeSettings = Schema.decodeSync( + Schema.fromJsonString(Schema.Record(Schema.String, Schema.Unknown)), +); + +test( + "Maintenance reflects edits to a symlinked settings file after restoring its directory", + WEB, + async ({ t3, app, screen }) => { + await t3.project("settings-restore"); + const settingsPath = `${T3_HOME}/userdata/settings.json`; + const active = `${T3_HOME}/active-settings`; + const previous = `${T3_HOME}/old-settings`; + const restored = `${T3_HOME}/restored-settings`; + const original = await runPromise( + Effect.gen(function* () { + const fs = yield* FileSystem.FileSystem; + return yield* fs.readFileString(settingsPath); + }), + ); + const settings = decodeSettings(original); + const contents = (days: number) => + JSON.stringify({ + ...settings, + storageCleanup: { logsAfterDays: days }, + }); + + await runPromise( + Effect.gen(function* () { + const fs = yield* FileSystem.FileSystem; + yield* fs.makeDirectory(active); + yield* fs.makeDirectory(restored); + yield* fs.writeFileString(`${active}/settings.json`, contents(5)); + yield* fs.writeFileString(`${restored}/settings.json`, contents(7)); + yield* fs.symlink(`${active}/settings.json`, `${settingsPath}.link`); + yield* fs.rename(`${settingsPath}.link`, settingsPath); + }), + ); + try { + await t3.open("/settings/maintenance"); + const days = screen.getByLabel("Delete old rotated logs in days"); + await days.scrollIntoView(); + await expect(days).toHaveValue("5"); + await runPromise( + Effect.flatMap(FileSystem.FileSystem, (fs) => + fs.writeFileString(`${active}/settings.json`, contents(7)), + ), + ); + await expect(days).toHaveValue("7"); + + await runPromise( + Effect.gen(function* () { + const fs = yield* FileSystem.FileSystem; + yield* fs.writeFileString(`${restored}/settings.json`, contents(8)); + yield* fs.rename(active, previous); + yield* fs.rename(restored, active); + }), + ); + try { + await expect(days).toHaveValue("8"); + } catch (error) { + await app.screenshot("retention-after-settings-directory-restore"); + throw error; + } + await runPromise( + Effect.gen(function* () { + const fs = yield* FileSystem.FileSystem; + yield* fs.writeFileString(`${active}/settings.json`, contents(9)); + }), + ); + try { + await expect(days).toHaveValue("9"); + await runPromise( + Effect.flatMap(FileSystem.FileSystem, (fs) => + fs.writeFileString(`${active}/settings.json`, contents(11)), + ), + ); + await expect(days).toHaveValue("11"); + } finally { + await app.screenshot("retention-after-settings-directory-restore"); + } + } finally { + await runPromise( + Effect.gen(function* () { + const fs = yield* FileSystem.FileSystem; + yield* fs.writeFileString(`${settingsPath}.original`, original); + yield* fs.rename(`${settingsPath}.original`, settingsPath); + for (const directory of [active, previous, restored]) { + yield* fs.remove(directory, { recursive: true, force: true }); + } + }), + ); + } + }, +); From 67692a75491618c2282d431b93d40f2e72b6b6b9 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Thu, 19 Nov 2026 02:39:09 -0800 Subject: [PATCH 008/201] fix(server): ACP Registry Antigravity no longer leaves unpacked temp folders (#39028) --- .../src/server/AcpRegistrySupport.test.ts | 49 +++++++++++ .../src/server/AcpRegistrySupport.ts | 84 ++++++++++++++++++- 2 files changed, 131 insertions(+), 2 deletions(-) diff --git a/packages/provider-acp-registry/src/server/AcpRegistrySupport.test.ts b/packages/provider-acp-registry/src/server/AcpRegistrySupport.test.ts index db1deda3355ea..beb10b6fa89e8 100644 --- a/packages/provider-acp-registry/src/server/AcpRegistrySupport.test.ts +++ b/packages/provider-acp-registry/src/server/AcpRegistrySupport.test.ts @@ -792,6 +792,55 @@ describe("AcpRegistrySupport", () => { ); }); + it.effect("gives Antigravity a T3-owned temp directory that is removed with the process", () => { + const agent = { + ...makeAgent({ binary: { "linux-x86_64": { archive: archiveUrl, cmd: "./agy" } } }), + id: "antigravity-acp", + }; + return Effect.gen(function* () { + const fileSystem = yield* FileSystem.FileSystem; + const cacheDir = yield* fileSystem.makeTempDirectoryScoped({ + prefix: "t3-acp-registry-runtime-temp-", + }); + const runtimeTempDir = `${cacheDir}/antigravity-tmp/acp-registry`; + yield* fileSystem.makeDirectory(`${runtimeTempDir}/run-killed/_MEI123`, { recursive: true }); + const resolver = yield* AcpRegistrySupport.makeAcpRegistryCatalog({ + cacheDir, + toolsDir: `${cacheDir}/tools`, + runtimeTempDir, + registryUrl, + }); + expect(yield* fileSystem.exists(`${runtimeTempDir}/run-killed`)).toBe(false); + + const temp = yield* Effect.scoped( + Effect.gen(function* () { + const resolved = yield* resolver.resolve( + settings({ agentId: "antigravity-acp" }), + "/workspace", + { TMPDIR: "/tmp" }, + ); + const directory = resolved.spawn.env?.TMPDIR ?? ""; + expect(directory.startsWith(`${runtimeTempDir}/run-`)).toBe(true); + expect(yield* fileSystem.exists(directory)).toBe(true); + return directory; + }), + ); + expect(yield* fileSystem.exists(temp)).toBe(false); + }).pipe( + Effect.scoped, + Effect.provide( + layerResolver((request) => + Effect.succeed( + HttpClientResponse.fromWeb( + request, + new Response(request.url === registryUrl ? makeRegistry(agent) : "#!/bin/sh\n"), + ), + ), + ), + ), + ); + }); + it.effect("installs a contained binary whose name starts with two dots", () => { const agent = makeAgent({ binary: { "linux-x86_64": { archive: archiveUrl, cmd: "..example-agent" } }, diff --git a/packages/provider-acp-registry/src/server/AcpRegistrySupport.ts b/packages/provider-acp-registry/src/server/AcpRegistrySupport.ts index 370331ef5b890..42f2e38433f5d 100644 --- a/packages/provider-acp-registry/src/server/AcpRegistrySupport.ts +++ b/packages/provider-acp-registry/src/server/AcpRegistrySupport.ts @@ -34,6 +34,8 @@ import * as Path from "effect/Path"; import * as AcpRegistryRuntimeCoordinator from "./AcpRegistryRuntimeCoordinator.ts"; import * as PlatformError from "effect/PlatformError"; import * as Ref from "effect/Ref"; +import * as Schedule from "effect/Schedule"; +import type * as Scope from "effect/Scope"; import * as Schema from "effect/Schema"; import * as Semaphore from "effect/Semaphore"; import * as Stream from "effect/Stream"; @@ -531,7 +533,7 @@ export class AcpRegistryCatalog extends Context.Service< settings: AcpRegistrySettings, cwd: string, environment?: NodeJS.ProcessEnv, - ) => Effect.Effect; + ) => Effect.Effect; readonly uninstallManagedBinary: ( input: AcpRegistryManagedBinaryUninstallInput, ) => Effect.Effect; @@ -549,6 +551,8 @@ export const layerFromHost = Layer.merge( return layer({ cacheDir: paths.providerStatusCacheDir, toolsDir: path.join(paths.baseDir, "tools"), + // Beside the built-in driver's runtime temp, short for Windows' 260-character path limit. + runtimeTempDir: path.join(paths.stateDir, "antigravity-tmp", "acp-registry"), }); }), ), @@ -558,9 +562,14 @@ export const layerFromHost = Layer.merge( export interface AcpRegistryCatalogOptions { readonly cacheDir: string; readonly toolsDir: string; + /** Owns the temp files of agents whose unpacker cannot clean up after a kill. */ + readonly runtimeTempDir?: string; readonly registryUrl?: string; } +// Unpacks about 140 MB into TEMP on every launch and cannot remove it when the process is killed. +const UNPACKING_AGENT_IDS: ReadonlySet = new Set(["antigravity-acp"]); + const INSTALL_LOCK_RETRY_COUNT = 300; const INSTALL_LOCK_RETRY_DELAY = "100 millis"; const INSTALL_LOCK_STALE_MS = 5 * 60 * 1_000; @@ -693,6 +702,73 @@ export const makeAcpRegistryCatalog = Effect.fn("AcpRegistryCatalog.make")(funct }; const preparedBinaryReservations = yield* Ref.make>(new Map()); + const runtimeTempDir = input.runtimeTempDir; + if (runtimeTempDir !== undefined) { + // Move leftovers of a previous server aside so the slow delete cannot race new runs. + const parent = path.dirname(runtimeTempDir); + const prefix = `${path.basename(runtimeTempDir)}.old-`; + const retire = Effect.gen(function* () { + if (yield* fileSystem.exists(runtimeTempDir)) { + yield* fileSystem.makeTempDirectory({ directory: parent, prefix }).pipe( + Effect.flatMap((retired) => + fileSystem.rename(runtimeTempDir, path.join(retired, "runtime")), + ), + Effect.catch(() => fileSystem.remove(runtimeTempDir, { recursive: true, force: true })), + ); + } + return yield* fileSystem.readDirectory(parent); + }).pipe(Effect.orElseSucceed((): ReadonlyArray => [])); + const retired = (yield* retire).filter((entry) => entry.startsWith(prefix)); + yield* Effect.forkDetach( + Effect.forEach( + retired, + (entry) => + fileSystem + .remove(path.join(parent, entry), { recursive: true, force: true }) + .pipe( + Effect.catch(() => + Effect.logWarning("Could not remove leftover ACP agent temp files."), + ), + ), + { discard: true }, + ), + ); + } + + // One directory per process, removed after it exits; the next server start sweeps what Windows kept. + const acquireRuntimeTempEnvironment = Effect.fn("AcpRegistryCatalog.acquireRuntimeTemp")( + function* (root: string, environment: NodeJS.ProcessEnv) { + const directory = yield* Effect.acquireRelease( + fileSystem.makeDirectory(root, { recursive: true }).pipe( + Effect.andThen(fileSystem.makeTempDirectory({ directory: root, prefix: "run-" })), + Effect.mapError( + (cause) => + new AcpRegistryError({ + reason: "install_failed", + detail: "Could not create a temp directory for the ACP agent.", + cause, + }), + ), + ), + (directory) => { + const remove = fileSystem.remove(directory, { recursive: true, force: true }); + // Windows keeps a killed process's files locked for a few seconds after it exits. + const retry = remove.pipe( + Effect.retry({ schedule: Schedule.spaced("2 seconds"), times: 30 }), + Effect.catch(() => Effect.logWarning("Could not remove an ACP agent temp directory.")), + ); + return remove.pipe(Effect.catch(() => Effect.asVoid(Effect.forkDetach(retry)))); + }, + ); + if (platform !== "win32") return { ...environment, TMPDIR: directory }; + // Windows env keys are case-insensitive; drop aliases so ours win. + const rest = Object.fromEntries( + Object.entries(environment).filter(([key]) => !["temp", "tmp"].includes(key.toLowerCase())), + ); + return { ...rest, TEMP: directory, TMP: directory }; + }, + ); + const managerBinDirectory = Effect.fn("AcpRegistryCatalog.managerBinDirectory")(function* ( runner: string, ) { @@ -1938,10 +2014,14 @@ export const makeAcpRegistryCatalog = Effect.fn("AcpRegistryCatalog.make")(funct ...effectiveEnvironment, ...distribution.env, }; - const spawnEnvironment = + const pathEnvironment = commandBinDirectory === undefined ? baseSpawnEnvironment : withPreferredPath(baseSpawnEnvironment, commandBinDirectory, platform); + const spawnEnvironment = + runtimeTempDir !== undefined && UNPACKING_AGENT_IDS.has(agent.id) + ? yield* acquireRuntimeTempEnvironment(runtimeTempDir, pathEnvironment) + : pathEnvironment; return { agent, From 475ae52ac279152dd2c13a86a59227d3e1441e3d Mon Sep 17 00:00:00 2001 From: Wout Stiens <71498452+StiensWout@users.noreply.github.com> Date: Thu, 19 Nov 2026 11:42:57 +0100 Subject: [PATCH 009/201] fix(web): a corrected telemetry URL can be tested while an earlier check runs (#39067) Co-authored-by: Julius Marminge --- .../TelemetryExportSettings.browser.test.tsx | 37 +++++++++++- .../settings/TelemetryExportSettings.tsx | 16 ++++-- ...rrected-telemetry-url-can-be-tested.e2e.ts | 56 +++++++++++++++++++ scripts/scenarios/t3.ts | 2 +- 4 files changed, 103 insertions(+), 8 deletions(-) create mode 100644 scripts/scenarios/corrected-telemetry-url-can-be-tested.e2e.ts diff --git a/apps/web/src/components/settings/TelemetryExportSettings.browser.test.tsx b/apps/web/src/components/settings/TelemetryExportSettings.browser.test.tsx index d5f66e6731b0f..49b03b2a1b20b 100644 --- a/apps/web/src/components/settings/TelemetryExportSettings.browser.test.tsx +++ b/apps/web/src/components/settings/TelemetryExportSettings.browser.test.tsx @@ -63,7 +63,7 @@ import { TelemetryExportSettings } from "./TelemetryExportSettings"; function setup() { updateSettings.mockClear(); - checkOtlpEndpoint.mockClear(); + checkOtlpEndpoint.mockReset(); state.serverConfig = { environment: { capabilities: {} } }; } @@ -139,4 +139,39 @@ describe("TelemetryExportSettings", () => { input: { signal: "traces", url: "http://collector/v1/traces" }, }); }); + + it("can test a corrected URL and reports only the latest attempt when a URL is reused", async () => { + setup(); + state.observability = { ...DEFAULT_SERVER_SETTINGS.observability, otlpTracesUrl: "" }; + state.serverConfig = { environment: { capabilities: { otlpEndpointCheck: true } } }; + const first = Promise.withResolvers>>(); + const corrected = Promise.withResolvers>>(); + const latest = Promise.withResolvers>>(); + checkOtlpEndpoint + .mockReturnValueOnce(first.promise) + .mockReturnValueOnce(corrected.promise) + .mockReturnValueOnce(latest.promise); + await using screen = await render(); + + const traces = screen.getByLabelText("Traces endpoint"); + const testTraces = screen.getByRole("button", { name: "Test" }).first(); + await userEvent.fill(traces, "http://first/v1/traces"); + await userEvent.click(testTraces); + await expect.element(testTraces).toBeDisabled(); + + await userEvent.fill(traces, "http://corrected/v1/traces"); + await expect.element(testTraces).toBeEnabled(); + await userEvent.click(testTraces); + await expect.element(testTraces).toBeDisabled(); + + await userEvent.fill(traces, "http://first/v1/traces"); + await userEvent.click(testTraces); + await expect.element(testTraces).toBeDisabled(); + + corrected.resolve({ _tag: "Success", value: { _tag: "Accepted", latencyMs: 22 } }); + first.resolve({ _tag: "Success", value: { _tag: "Accepted", latencyMs: 11 } }); + latest.resolve({ _tag: "Success", value: { _tag: "Accepted", latencyMs: 33 } }); + + await expect.element(screen.getByText("Connected · 33 ms")).toBeInTheDocument(); + }); }); diff --git a/apps/web/src/components/settings/TelemetryExportSettings.tsx b/apps/web/src/components/settings/TelemetryExportSettings.tsx index c839630a4d0d0..2e7b02c47a263 100644 --- a/apps/web/src/components/settings/TelemetryExportSettings.tsx +++ b/apps/web/src/components/settings/TelemetryExportSettings.tsx @@ -141,11 +141,12 @@ function TelemetryExportForm() { const changedSignals = SIGNALS.filter(({ key }) => values[key].trim() !== saved[key]); const changed = changedSignals.length > 0; - const sendCheck = async (key: SignalKey, signal: OtlpSignal, url: string) => { + const sendCheck = async (key: SignalKey, signal: OtlpSignal, attempt: EndpointCheck) => { if (!environmentId) return; + const { url } = attempt; const response = await checkOtlpEndpoint({ environmentId, input: { signal, url } }); setChecks((previous) => { - if (previous[key]?.url !== url || previous[key].result !== null) return previous; + if (previous[key] !== attempt) return previous; const next = { ...previous }; if (response._tag === "Success") next[key] = { url, result: response.value }; else delete next[key]; @@ -155,14 +156,15 @@ function TelemetryExportForm() { const checkEndpoint = (key: SignalKey, signal: OtlpSignal, url: string) => { if (!isHttpUrl(url)) return; - setChecks((previous) => ({ ...previous, [key]: { url, result: null } })); - void sendCheck(key, signal, url); + const attempt = { url, result: null }; + setChecks((previous) => ({ ...previous, [key]: attempt })); + void sendCheck(key, signal, attempt); }; const sendPendingChecks = useEffectEvent(() => { for (const { key, signal } of SIGNALS) { const check = checks[key]; - if (check?.result === null) void sendCheck(key, signal, check.url); + if (check?.result === null) void sendCheck(key, signal, check); } }); // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- sends pending endpoint check requests once the environment can run them @@ -260,7 +262,9 @@ function TelemetryExportForm() { type="button" size="sm" variant="outline" - disabled={!isHttpUrl(url) || checks[key]?.result === null} + disabled={ + !isHttpUrl(url) || (checks[key]?.url === url && checks[key].result === null) + } onClick={() => void checkEndpoint(key, signal, url)} > Test diff --git a/scripts/scenarios/corrected-telemetry-url-can-be-tested.e2e.ts b/scripts/scenarios/corrected-telemetry-url-can-be-tested.e2e.ts new file mode 100644 index 0000000000000..d9ea77179750f --- /dev/null +++ b/scripts/scenarios/corrected-telemetry-url-can-be-tested.e2e.ts @@ -0,0 +1,56 @@ +// @effect-diagnostics-next-line nodeBuiltinImport:off -- The test runs a loopback OTLP receiver. +import * as NodeHttp from "node:http"; +import { expect } from "e2e"; + +import { environmentId, runPromise, test, WEB } from "./t3.ts"; + +test( + "The corrected traces endpoint can be tested while the previous URL is still checking", + WEB, + async ({ t3, app, browser }) => { + const firstProbe = Promise.withResolvers(); + let slowProbeClosed = false; + const collector = NodeHttp.createServer((request, response) => { + request.resume(); + if (request.url === "/slow/v1/traces") { + response.once("close", () => { + slowProbeClosed = true; + }); + firstProbe.resolve(); + return; + } + response.writeHead(200).end(); + }); + try { + await new Promise((resolve) => collector.listen(0, "127.0.0.1", resolve)); + const address = collector.address(); + if (address === null || typeof address === "string") throw new Error("No collector port"); + const origin = `http://127.0.0.1:${address.port}`; + + await t3.project("demo"); + const environment = await runPromise(environmentId(app.baseUrl ?? "")); + await t3.open( + `/settings/diagnostics?machine=${encodeURIComponent(environment)}#telemetry-export`, + ); + + const traces = browser.locator("#otlpTracesUrl"); + const exportSection = browser.locator("#telemetry-export"); + const testTraces = exportSection.getByRole("button", "Test").first(); + await traces.fill(`${origin}/slow/v1/traces`); + await testTraces.tap(); + await firstProbe.promise; + await traces.fill(`${origin}/v1/traces`); + await exportSection.getByText("Not checked", { exact: true }).waitFor(); + + // Sample the screen before the old request reaches its server timeout. + const canTestCorrectedUrl = await testTraces.isEnabled(); + if (slowProbeClosed) + throw new Error("The slow telemetry probe closed before the button check"); + await app.screenshot("corrected-traces-url"); + expect(canTestCorrectedUrl, "The corrected traces URL can be tested immediately").toBe(true); + } finally { + collector.close(); + collector.closeAllConnections(); + } + }, +); diff --git a/scripts/scenarios/t3.ts b/scripts/scenarios/t3.ts index 29a05573b3425..fab377de1028b 100644 --- a/scripts/scenarios/t3.ts +++ b/scripts/scenarios/t3.ts @@ -235,7 +235,7 @@ const readPairingPath = Effect.gen(function* () { }); /** The id every thread link starts with, asked of the server the app talks to. */ -const environmentId = (baseUrl: string) => +export const environmentId = (baseUrl: string) => HttpClient.get(`${baseUrl}/.well-known/t3/environment`).pipe( Effect.flatMap(HttpClientResponse.filterStatusOk), Effect.flatMap( From bc6621d73ade6ad8be7547745299e840d2237eda Mon Sep 17 00:00:00 2001 From: James C <134711311+Exotic209093@users.noreply.github.com> Date: Thu, 19 Nov 2026 11:40:35 +0000 Subject: [PATCH 010/201] fix(server): Windows backend refuses projects on a WSL share (#39068) Co-authored-by: Julius Marminge --- .../server/src/project/ProjectService.test.ts | 48 +++++++++++++++++++ apps/server/src/project/ProjectService.ts | 19 ++++++++ packages/shared/src/path.test.ts | 13 +++++ packages/shared/src/path.ts | 5 ++ 4 files changed, 85 insertions(+) diff --git a/apps/server/src/project/ProjectService.test.ts b/apps/server/src/project/ProjectService.test.ts index 492379beecc26..dbc866dd5c3e9 100644 --- a/apps/server/src/project/ProjectService.test.ts +++ b/apps/server/src/project/ProjectService.test.ts @@ -6,6 +6,7 @@ import { assert, it } from "@effect/vitest"; import * as NodeCrypto from "@effect/platform-node/NodeCrypto"; import * as NodeServices from "@effect/platform-node/NodeServices"; import { CommandId, type Project, ProjectId, ProviderInstanceId } from "@t3tools/contracts"; +import * as HostProcess from "@t3tools/shared/HostProcess"; import * as Deferred from "effect/Deferred"; import * as Effect from "effect/Effect"; import * as Fiber from "effect/Fiber"; @@ -512,6 +513,53 @@ it.layer(layerTest)("ProjectService", (it) => { }), ); + it.effect("refuses a WSL share path on Windows and allows it elsewhere", () => + Effect.gen(function* () { + const service = yield* ProjectService.ProjectService; + const onWindows = (effect: Effect.Effect) => + effect.pipe(Effect.provideService(HostProcess.Platform, "win32")); + const projectId = ProjectId.make("project:wsl-share"); + const refused = yield* onWindows( + service.create({ + commandId: CommandId.make("command:wsl-share"), + projectId, + title: "WSL", + workspaceRoot: "\\\\wsl$\\Ubuntu\\home\\ubuntu\\repo", + }), + ).pipe(Effect.flip); + assert.equal(refused._tag, "ProjectInvalidError"); + assert.isTrue(Option.isNone(yield* service.getById(projectId))); + + const mover = ProjectId.make("project:wsl-share:mover"); + yield* onWindows( + service.create({ + commandId: CommandId.make("command:wsl-share:mover"), + projectId: mover, + title: "Mover", + workspaceRoot: "C:\\work\\wsl-share-mover", + }), + ); + const move = yield* onWindows( + service.update({ + commandId: CommandId.make("command:wsl-share:move"), + projectId: mover, + workspaceRoot: "\\\\wsl.localhost\\Ubuntu\\home\\ubuntu\\repo", + }), + ).pipe(Effect.flip); + assert.equal(move._tag, "ProjectInvalidError"); + + const linux = yield* service + .create({ + commandId: CommandId.make("command:wsl-share:linux"), + projectId: ProjectId.make("project:wsl-share:linux"), + title: "Linux", + workspaceRoot: "\\\\wsl.localhost\\Ubuntu\\home\\ubuntu\\repo", + }) + .pipe(Effect.provideService(HostProcess.Platform, "linux")); + assert.equal(linux.title, "Linux"); + }), + ); + it.effect("replays a workspace conflict after the workspace frees up", () => Effect.gen(function* () { const service = yield* ProjectService.ProjectService; diff --git a/apps/server/src/project/ProjectService.ts b/apps/server/src/project/ProjectService.ts index 1db031456f2d7..873760a820eaf 100644 --- a/apps/server/src/project/ProjectService.ts +++ b/apps/server/src/project/ProjectService.ts @@ -8,7 +8,9 @@ import { type ProjectSnapshot, type ThreadId, } from "@t3tools/contracts"; +import * as HostProcess from "@t3tools/shared/HostProcess"; import * as KeyedLock from "@t3tools/shared/KeyedLock"; +import { isWslSharePath } from "@t3tools/shared/path"; import * as Context from "effect/Context"; import * as DateTime from "effect/DateTime"; import * as Effect from "effect/Effect"; @@ -261,6 +263,19 @@ export const make = Effect.gen(function* () { }); }); + // Git for Windows can't trust an index written inside the distro and rereads every file across the + // share, so git status can hit its timeout. Checked before normalizing, which already stats the share. + const rejectWslSharePath = Effect.fn("ProjectService.rejectWslSharePath")(function* ( + projectId: ProjectId, + workspaceRoot: string, + ) { + if (!isWslSharePath(workspaceRoot) || !(yield* HostProcess.isWindows)) return; + return yield* new ProjectInvalidError({ + projectId, + detail: `${workspaceRoot.trim()} is inside WSL. Add it to the WSL backend instead of the Windows one.`, + }); + }); + const commit = Effect.fn("ProjectService.commit")(function* (command: ProjectCommand) { const { projectId } = command; const dispatchError = (cause: unknown) => @@ -395,6 +410,7 @@ export const make = Effect.gen(function* () { const create: ProjectService["Service"]["create"] = Effect.fn("ProjectService.create")( function* (input) { + yield* rejectWslSharePath(input.projectId, input.workspaceRoot); const workspaceRoot = yield* normalizeWorkspaceRoot({ projectId: input.projectId, workspaceRoot: input.workspaceRoot, @@ -421,6 +437,9 @@ export const make = Effect.gen(function* () { return yield* new ProjectNotFoundError({ projectId: input.projectId }); } const previousRoot = existing.value.workspaceRoot; + if (input.workspaceRoot !== undefined && input.workspaceRoot !== previousRoot) { + yield* rejectWslSharePath(input.projectId, input.workspaceRoot); + } const workspaceRoot = input.workspaceRoot === undefined ? previousRoot diff --git a/packages/shared/src/path.test.ts b/packages/shared/src/path.test.ts index a48592a797ee5..f8a4c4358b5eb 100644 --- a/packages/shared/src/path.test.ts +++ b/packages/shared/src/path.test.ts @@ -1,5 +1,6 @@ import { describe, expect, it } from "vite-plus/test"; import { + isWslSharePath, workspaceRelativeFilePath, newProjectFolderName, normalizeProjectPathForComparison, @@ -9,6 +10,18 @@ import { } from "./path.ts"; describe("path helpers", () => { + it("recognizes WSL shares and nothing else", () => { + expect(isWslSharePath("\\\\wsl.localhost\\Ubuntu\\home")).toBe(true); + expect(isWslSharePath("\\\\wsl$\\Ubuntu")).toBe(true); + expect(isWslSharePath(" //WSL.LOCALHOST/Ubuntu/home")).toBe(true); + expect(isWslSharePath("\\\\?\\UNC\\wsl.localhost\\Ubuntu\\repo")).toBe(true); + expect(isWslSharePath("\\\\.\\UNC\\wsl$\\Ubuntu\\repo")).toBe(true); + expect(isWslSharePath("\\\\?\\C:\\work\\repo")).toBe(false); + expect(isWslSharePath("\\\\wslserver\\share")).toBe(false); + expect(isWslSharePath("\\\\fileserver\\wsl.localhost")).toBe(false); + expect(isWslSharePath("C:\\work\\repo")).toBe(false); + }); + // regression: #17923 literal colons in names are kept, not parsed as positions it.each([ ["report:123", "/workspace", "/workspace/report:123"], diff --git a/packages/shared/src/path.ts b/packages/shared/src/path.ts index f13d78dc4f2e3..977da578b20bd 100644 --- a/packages/shared/src/path.ts +++ b/packages/shared/src/path.ts @@ -15,6 +15,11 @@ export function isNetworkPath(value: string): boolean { return /^[\\/]{2}/.test(value); } +/** A `\\wsl.localhost\` or `\\wsl$\` share: a WSL distro's files seen from Windows over 9P. */ +export function isWslSharePath(value: string): boolean { + return /^[\\/]{2}(?:[?.][\\/]UNC[\\/])?wsl(?:\.localhost|\$)[\\/]/i.test(value.trim()); +} + export function isWindowsAbsolutePath(value: string): boolean { return isUncPath(value) || isWindowsDrivePath(value); } From 2c7bfcec8484f635afcdcee6d6119acbad54f9ea Mon Sep 17 00:00:00 2001 From: Adamulek123 Date: Thu, 19 Nov 2026 12:49:22 +0100 Subject: [PATCH 011/201] fix(desktop): restore clicks across the floating dictation controls (#38225) Co-authored-by: Julius Marminge --- apps/web/src/components/chat/GlobalVoiceInputIndicator.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/web/src/components/chat/GlobalVoiceInputIndicator.tsx b/apps/web/src/components/chat/GlobalVoiceInputIndicator.tsx index 8b16b6f451cd2..dbe0453df2e9a 100644 --- a/apps/web/src/components/chat/GlobalVoiceInputIndicator.tsx +++ b/apps/web/src/components/chat/GlobalVoiceInputIndicator.tsx @@ -27,7 +27,7 @@ export function GlobalVoiceInputIndicator({ hidden = false }: { hidden?: boolean return (
-
+
- ) : ( - - {icon} - - )} + ) : null} + + {restartSeconds !== null ? `${restartSeconds}s` : icon} +
@@ -183,16 +191,16 @@ export function SidebarUpdateCapsule({ ) : null}
))} - {settled && failed ? ( + {view.action !== null ? (
- {view.action === "retry" ? ( - + {settled && failed && view.action !== "dismiss" ? ( + ) : null} -
) : null}
diff --git a/apps/web/src/components/sidebar/SidebarUpdatePill.tsx b/apps/web/src/components/sidebar/SidebarUpdatePill.tsx index ce45fe8bf73a4..71fce36f3ed43 100644 --- a/apps/web/src/components/sidebar/SidebarUpdatePill.tsx +++ b/apps/web/src/components/sidebar/SidebarUpdatePill.tsx @@ -441,7 +441,7 @@ function SidebarUpdateControl() { ? { status: "downloading", percent: state.downloadPercent } : { status: "waiting" }; return ( - + Date: Thu, 19 Nov 2026 19:45:07 +0400 Subject: [PATCH 122/201] fix(web): localize compact restart countdown (cherry picked from commit e5dc6ef974cf8c1d2f429e4922a34eb5f29bce4d) --- apps/web/src/components/sidebar/SidebarUpdateCapsule.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/web/src/components/sidebar/SidebarUpdateCapsule.tsx b/apps/web/src/components/sidebar/SidebarUpdateCapsule.tsx index d59d33927915a..d789cea9fd070 100644 --- a/apps/web/src/components/sidebar/SidebarUpdateCapsule.tsx +++ b/apps/web/src/components/sidebar/SidebarUpdateCapsule.tsx @@ -146,7 +146,7 @@ export function SidebarUpdateCapsule({ "rounded-full text-xs font-medium tabular-nums ring-1 ring-current/22 ring-inset", )} > - {restartSeconds !== null ? `${restartSeconds}s` : icon} + {restartSeconds !== null ? m(msg("{seconds}s", { seconds: restartSeconds })) : icon}
From 98af8803fe6b21b05320786479836b50735fb0aa Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Thu, 19 Nov 2026 18:08:51 +0000 Subject: [PATCH 123/201] refactor(web): share restart countdown seconds in update capsule Co-Authored-By: Claude Opus 5.5 --- .../sidebar/SidebarUpdateCapsule.tsx | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/apps/web/src/components/sidebar/SidebarUpdateCapsule.tsx b/apps/web/src/components/sidebar/SidebarUpdateCapsule.tsx index d789cea9fd070..2e6cbe19390cc 100644 --- a/apps/web/src/components/sidebar/SidebarUpdateCapsule.tsx +++ b/apps/web/src/components/sidebar/SidebarUpdateCapsule.tsx @@ -46,19 +46,20 @@ function useUpdateRunMachineViews(run: UpdateEverythingRun): ReadonlyArray status === "failed"); const settled = !hasActiveMachine && run.localVersion === null; - const restartSeconds = - run.phase === "countdown" && run.restartAt !== null - ? Math.max(0, Math.ceil((run.restartAt - now) / 1000)) - : null; + const restartSeconds = restartSecondsLeft(run, now); const actionLabel = view.action === "later" ? gt("Later") : view.action === "retry" ? gt("Retry") : gt("Dismiss"); From 02c5270a116f8317e5c0917a37b17c58c6251461 Mon Sep 17 00:00:00 2001 From: Wout Stiens <71498452+StiensWout@users.noreply.github.com> Date: Thu, 19 Nov 2026 21:42:45 +0100 Subject: [PATCH 124/201] fix(web): keep SSH connection checks pending until they finish (#39328) Co-authored-by: Julius Marminge --- .../settings/DeviceSourcesSettings.tsx | 28 ++++-- .../settings/useHostConnectionChecks.ts | 9 +- ...vice-host-test-keeps-pending-status.e2e.ts | 97 +++++++++++++++++++ 3 files changed, 120 insertions(+), 14 deletions(-) create mode 100644 scripts/scenarios/device-host-test-keeps-pending-status.e2e.ts diff --git a/apps/web/src/components/settings/DeviceSourcesSettings.tsx b/apps/web/src/components/settings/DeviceSourcesSettings.tsx index 5102d9ffdbf8d..98a88b7e5aaba 100644 --- a/apps/web/src/components/settings/DeviceSourcesSettings.tsx +++ b/apps/web/src/components/settings/DeviceSourcesSettings.tsx @@ -33,7 +33,11 @@ import { Spinner } from "../ui/spinner"; import { toastManager } from "../ui/toast"; import { incompleteListings } from "../device/DeviceSetup"; import { DeviceHostEditor } from "./DeviceHostEditor"; -import { updateDeviceHosts, groupDeviceHosts } from "./deviceHostsSettings.logic"; +import { + updateDeviceHosts, + groupDeviceHosts, + type DeviceHostGroup, +} from "./deviceHostsSettings.logic"; import { EasDeviceHostEditor } from "./EasDeviceHostEditor"; import { easSessionLimits, @@ -320,17 +324,20 @@ export function DeviceSourcesSettings(props: { gt("Simlock host not removed everywhere"), ); - const [testing, setTesting] = useState>(new Set()); - const testSsh = async (host: SshDeviceHostConfig) => { - setTesting((current) => new Set(current).add(host.id)); - const checked = await testConnection(host).finally(() => - setTesting((current) => { + const [testingHosts, setTestingHosts] = useState>(new Set()); + const testSsh = async ({ host, members }: DeviceHostGroup) => { + const check = testConnection(host); + if (!check) return; + // Every member's id, so the row that remains after an environment drops out stays pending. + const ids = members.map((member) => member.host.id); + setTestingHosts((current) => new Set([...current, ...ids])); + const checked = await check.finally(() => + setTestingHosts((current) => { const next = new Set(current); - next.delete(host.id); + for (const id of ids) next.delete(id); return next; }), ); - if (!checked) return; const failed = targets.filter((target) => checked[target.environmentId]?.status === "failed"); toastManager.add({ type: failed.length ? "error" : "success", @@ -435,6 +442,7 @@ export function DeviceSourcesSettings(props: { for (const group of sshGroups) { const host = group.host; const holders = new Set(group.members.map((member) => member.environmentId)); + const testing = group.members.some((member) => testingHosts.has(member.host.id)); rows.push({ key: `ssh:${host.id}:${group.members.map((member) => member.environmentId).join(",")}`, shared: true, @@ -447,7 +455,7 @@ export function DeviceSourcesSettings(props: { ); if (!held) return { environmentId: member.environmentId, label: member.label, added: false }; - const status = testing.has(host.id) + const status = testing ? ({ tone: "pending", label: gt("Testing connection") } as const) : hostStatus(member.state, held.host.id, m); return { @@ -472,7 +480,7 @@ export function DeviceSourcesSettings(props: { () => setEditing({ kind: "ssh", host, original: host, ...(grouped ? {} : { only: holders }) }), () => void saveSsh(host, true, host, holders), - void testSsh(host)}> + void testSsh(group)}> Test connection , ), diff --git a/apps/web/src/components/settings/useHostConnectionChecks.ts b/apps/web/src/components/settings/useHostConnectionChecks.ts index 4765477036a38..11b804444a44c 100644 --- a/apps/web/src/components/settings/useHostConnectionChecks.ts +++ b/apps/web/src/components/settings/useHostConnectionChecks.ts @@ -18,13 +18,13 @@ export function useHostConnectionChecks(targets: ReadonlyArray>>({}); const running = useRef(new Set()); - const testConnection = async (host: SshDeviceHostConfig) => { + const testConnection = (host: SshDeviceHostConfig) => { const key = deviceHostConnectionKey(host); if (running.current.has(key)) return; running.current.add(key); setChecks((current) => ({ ...current, [key]: {} })); const results: Record = {}; - await checkDeviceHostConnections( + return checkDeviceHostConnections( targets, host, async (environmentId, input) => { @@ -42,8 +42,9 @@ export function useHostConnectionChecks(targets: ReadonlyArray running.current.delete(key)); - return results; + ) + .then(() => results) + .finally(() => running.current.delete(key)); }; return { checks, testConnection }; } diff --git a/scripts/scenarios/device-host-test-keeps-pending-status.e2e.ts b/scripts/scenarios/device-host-test-keeps-pending-status.e2e.ts new file mode 100644 index 0000000000000..8f4b09d77dd96 --- /dev/null +++ b/scripts/scenarios/device-host-test-keeps-pending-status.e2e.ts @@ -0,0 +1,97 @@ +/// +import { expect } from "e2e"; +import * as Effect from "effect/Effect"; + +import { T3_HOME } from "../e2e.config.ts"; +import { environmentId, rpcClient, runPromise, test, WEB } from "./t3.ts"; + +declare global { + interface Window { + deviceHostProbeGate?: { readonly started: Promise; readonly release: () => void }; + } +} + +test( + "A second SSH connection check keeps the pending status visible", + WEB, + async ({ t3, app, browser, screen }) => { + const origin = app.baseUrl ?? ""; + const environment = await runPromise(environmentId(origin)); + await t3.project("demo"); + await runPromise( + Effect.gen(function* () { + const client = yield* rpcClient(T3_HOME, origin); + yield* client["server.updateSettings"]({ + patch: { + enableDeviceSupport: true, + deviceHosts: [ + { kind: "ssh", id: "slow-host", label: "Slow host", target: "127.0.0.1", port: 1 }, + ], + }, + }); + }).pipe(Effect.scoped), + ); + + // Delay just the explicit probe at the transport boundary until after the UI sample. + await browser.addInitScript(() => { + const held: Array<() => void> = []; + const started = Promise.withResolvers(); + let delaying = true; + const send = WebSocket.prototype.send; + WebSocket.prototype.send = function (this: WebSocket, data) { + if (!delaying || typeof data !== "string") return send.call(this, data); + const parsed = JSON.parse(data); + const messages = [parsed].flat(); + const isProbe = (message: { _tag?: string; tag?: string }) => + message?._tag === "Request" && message.tag === "device.testHost"; + if (!messages.some(isProbe)) return send.call(this, data); + const probes = messages.filter(isProbe); + const other = messages.filter((message) => !isProbe(message)); + if (other.length) send.call(this, JSON.stringify(other)); + held.push(() => send.call(this, Array.isArray(parsed) ? JSON.stringify(probes) : data)); + started.resolve(); + }; + window.deviceHostProbeGate = { + started: started.promise, + release: () => { + delaying = false; + for (const release of held.splice(0)) release(); + }, + }; + }); + + await t3.open(`/settings/devices?machine=${encodeURIComponent(environment)}#device-sources`); + const more = browser.locator("#device-sources").getByRole("button", "More", { exact: true }); + const testConnection = screen.getByRole("menuitem", "Test connection", { exact: true }); + const pending = screen.getByText("Testing connection", { exact: true }); + try { + await more.tap(); + await testConnection.tap(); + await pending.waitFor(); + await browser.evaluate(async () => { + await window.deviceHostProbeGate!.started; + return null; + }); + if (await more.isEnabled()) { + await more.tap(); + await screen.getByRole("menu").waitFor(); + if ((await testConnection.isVisible()) && (await testConnection.isEnabled())) { + await testConnection.tap(); + await testConnection.waitFor({ state: "hidden" }); + } else { + await browser.keyboard.press("Escape"); + } + } + + await app.screenshot("second-connection-check"); + expect(await pending.isVisible(), "The SSH connection check still shows as pending").toBe( + true, + ); + } finally { + await browser.evaluate(() => { + window.deviceHostProbeGate?.release(); + return null; + }); + } + }, +); From b5bef4d9391117ad0d95b3a8f91a63200861ed54 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Thu, 19 Nov 2026 12:43:01 -0800 Subject: [PATCH 125/201] fix(server): /logout in chat needs providers:manage (#39027) --- apps/server/src/auth/RpcAuthorization.test.ts | 78 +++++++++++++++++++ apps/server/src/auth/RpcAuthorization.ts | 35 ++++++++- apps/server/src/mcp/toolkits/core.test.ts | 39 ++++++++-- .../src/mcp/toolkits/thread/handlers.ts | 21 ++++- .../src/orchestration-v2/CommandPolicy.ts | 11 +++ .../ProviderTurnStartService.test.ts | 28 ++++++- .../ProviderTurnStartService.ts | 4 + .../ThreadLaunchService.test.ts | 11 ++- .../ThreadMessageIntake.test.ts | 72 ++++++++++++++++- .../orchestration-v2/ThreadMessageIntake.ts | 51 +++++++++++- .../src/provider/ProviderAuthService.test.ts | 41 +++++++++- .../src/provider/ProviderAuthService.ts | 14 +++- apps/server/src/ws.ts | 6 ++ docs/user/providers-antigravity.md | 2 + 14 files changed, 391 insertions(+), 22 deletions(-) diff --git a/apps/server/src/auth/RpcAuthorization.test.ts b/apps/server/src/auth/RpcAuthorization.test.ts index 8afe47e715a9f..1d38610692965 100644 --- a/apps/server/src/auth/RpcAuthorization.test.ts +++ b/apps/server/src/auth/RpcAuthorization.test.ts @@ -17,6 +17,10 @@ import { AuthSourceControlWriteScope, AuthTerminalReadScope, AuthTerminalOperateScope, + CommandId, + MessageId, + ORCHESTRATION_V2_WS_METHODS, + RunId, WS_METHODS, WsRpcGroup, } from "@t3tools/contracts"; @@ -606,3 +610,77 @@ it.effect("denies manual cleanup before the handler without settings permission" expect(handled).toBe(false); }), ); + +it.effect("requires provider management to send /logout through chat", () => + Effect.gen(function* () { + const group = WsRpcGroup.omit( + ...[...WsRpcGroup.requests.keys()].filter( + ( + tag, + ): tag is Exclude< + keyof typeof RPC_REQUIRED_SCOPES, + typeof ORCHESTRATION_V2_WS_METHODS.dispatchCommand + > => tag !== ORCHESTRATION_V2_WS_METHODS.dispatchCommand, + ), + ); + const handled: string[] = []; + const handler = group.toLayerHandler(ORCHESTRATION_V2_WS_METHODS.dispatchCommand, (command) => + Effect.sync(() => { + handled.push(command.commandId); + return { sequence: 1 }; + }), + ); + const message = (commandId: string, text: string) => ({ + type: "message.dispatch" as const, + createdBy: "user" as const, + creationSource: "web" as const, + commandId: CommandId.make(commandId), + threadId: ThreadId.make("thread"), + messageId: MessageId.make(commandId), + text, + attachments: [], + dispatchMode: { type: "start_immediately" as const }, + }); + const edit = (commandId: string) => ({ + type: "queued-run.edit" as const, + commandId: CommandId.make(commandId), + threadId: ThreadId.make("thread"), + runId: RunId.make("run"), + text: "/logout", + }); + // With an attachment, `/logout` reaches the provider as a prompt, not a sign-out. + const attachments = [ + { type: "image" as const, id: "shot", name: "shot.png", mimeType: "image/png", sizeBytes: 1 }, + ]; + const operator = yield* RpcTest.makeClient(group).pipe( + Effect.provide(Layer.merge(handler, RpcAuthorization.layer([AuthOrchestrationOperateScope]))), + ); + const dispatch = operator[ORCHESTRATION_V2_WS_METHODS.dispatchCommand]; + yield* dispatch(message("hello", "hello")); + yield* dispatch({ ...message("attached", "/logout"), attachments }); + yield* dispatch({ ...edit("attached-edit"), attachments }); + // This edit keeps the queued attachments; message intake decides it. + yield* dispatch(edit("kept-attachments-edit")); + for (const command of [message("logout", " /LOGOUT "), { ...edit("edit"), attachments: [] }]) { + expect(yield* dispatch(command).pipe(Effect.flip)).toMatchObject({ + requiredPermission: AuthProvidersManageScope, + }); + } + const manager = yield* RpcTest.makeClient(group).pipe( + Effect.provide( + Layer.merge( + handler, + RpcAuthorization.layer([AuthOrchestrationOperateScope, AuthProvidersManageScope]), + ), + ), + ); + yield* manager[ORCHESTRATION_V2_WS_METHODS.dispatchCommand](message("manager", "/logout")); + expect(handled).toEqual([ + "hello", + "attached", + "attached-edit", + "kept-attachments-edit", + "manager", + ]); + }).pipe(Effect.scoped), +); diff --git a/apps/server/src/auth/RpcAuthorization.ts b/apps/server/src/auth/RpcAuthorization.ts index 2e73a401caaff..859beb21d354a 100644 --- a/apps/server/src/auth/RpcAuthorization.ts +++ b/apps/server/src/auth/RpcAuthorization.ts @@ -24,6 +24,8 @@ import { AuthRelayWriteScope, AuthTerminalOperateScope, ORCHESTRATION_V2_WS_METHODS, + type OrchestrationV2Command, + type OrchestrationV2ThreadLaunchInput, AuthTerminalReadScope, type AuthEnvironmentScope, EnvironmentAuthorizationError, @@ -35,6 +37,7 @@ import * as Effect from "effect/Effect"; import * as Schema from "effect/Schema"; import * as Layer from "effect/Layer"; import type * as RpcGroup from "effect/rpc/RpcGroup"; +import { isProviderSignOutPrompt } from "../orchestration-v2/CommandPolicy.ts"; type WsRpcMethod = RpcGroup.Rpcs["_tag"]; @@ -265,6 +268,32 @@ const requiredScopesForSettingsUpdate = (payload: unknown) => { const decodeProjectMutation = Schema.decodeUnknownSync(ProjectMutation); const decodeAssetCreateUrlInput = Schema.decodeUnknownSync(AssetCreateUrlInput); +/** + * A queued edit that omits `attachments` keeps the queued ones, which a payload cannot show; + * ThreadMessageIntake.dispatchCommand decides that case. + */ +const sendsProviderSignOutPrompt = (method: string, payload: unknown): boolean => { + if (method === ORCHESTRATION_V2_WS_METHODS.launchThread) { + const message = (payload as OrchestrationV2ThreadLaunchInput).initialMessage; + return message !== undefined && isProviderSignOutPrompt(message); + } + if (method !== ORCHESTRATION_V2_WS_METHODS.dispatchCommand) return false; + const command = payload as OrchestrationV2Command; + switch (command.type) { + case "message.dispatch": + return isProviderSignOutPrompt(command); + case "queued-run.edit": + return ( + command.attachments !== undefined && + isProviderSignOutPrompt({ text: command.text, attachments: command.attachments }) + ); + case "delegated_task.request": + return isProviderSignOutPrompt({ text: command.task, attachments: [] }); + default: + return false; + } +}; + const requiredScopesForRpcCall = ( method: string, payload: unknown, @@ -297,8 +326,10 @@ const requiredScopesForRpcCall = ( return requiredScopesForProjectMutation(decodeProjectMutation(payload)); } const guarded = clientRpcRequiredScopes(method, payload); - if (guarded.length > 0) return guarded; - return [requiredScopeForRpcMethod(method)]; + const scopes = guarded.length > 0 ? guarded : [requiredScopeForRpcMethod(method)]; + return sendsProviderSignOutPrompt(method, payload) + ? [...scopes, AuthProvidersManageScope] + : scopes; }; /** diff --git a/apps/server/src/mcp/toolkits/core.test.ts b/apps/server/src/mcp/toolkits/core.test.ts index af2501b295c56..daadff0e09d54 100644 --- a/apps/server/src/mcp/toolkits/core.test.ts +++ b/apps/server/src/mcp/toolkits/core.test.ts @@ -473,7 +473,10 @@ it.effect("records only failed calls of tools that hand off no work", () => { }); // A thread read whose runs or messages are bounded by nothing but the thread. -const historyReads = (reads: Array) => { +const historyReads = ( + reads: Array, + queued?: { readonly attachments: ReadonlyArray; readonly dispatched: Array }, +) => { const record = ( fields: ReadonlyArray, filter: ProjectionStore.ProjectionRecordFilter | undefined, @@ -499,9 +502,20 @@ const historyReads = (reads: Array) => { getProjectThreadRecords: (_target, fields, filter) => Effect.sync(() => record(fields, filter)).pipe(Effect.as(projection as never)), getThreadRecords: (_id, fields, filter) => - Effect.sync(() => record(fields, filter)).pipe(Effect.as(projection as never)), - getMessagesById: () => Effect.succeed(new Map()), - dispatch: () => Effect.succeed({ sequence: 1 } as never), + Effect.sync(() => record(fields, filter)).pipe( + Effect.as({ + ...projection, + runs: + queued === undefined + ? projection.runs + : [{ id: "run:queued", status: "queued", userMessageId: "message:queued" }], + } as never), + ), + getMessagesById: () => + Effect.succeed(new Map(queued === undefined ? [] : [["message:queued", queued]]) as never), + hasReceipt: () => Effect.succeed(false), + dispatch: (command) => + Effect.sync(() => queued?.dispatched.push(command)).pipe(Effect.as({ sequence: 1 } as never)), }); }; @@ -532,6 +546,8 @@ it.effect("t3_queue list and read load only the queued runs and their messages", it.effect("handoff analytics read only the caller's active run and its message", () => { const reads: Array = []; + const attachments = [{ type: "image", id: "shot", name: "shot.png" }]; + const dispatched: Array = []; const recorded = Deferred.makeUnsafe(); return Effect.gen(function* () { const server = yield* McpServer.McpServer; @@ -546,12 +562,25 @@ it.effect("handoff analytics read only the caller's active run and its message", ); yield* Deferred.await(recorded); expect(reads).toEqual([]); + // The edit keeps the queued image, so `/logout` stays an ordinary prompt and is not refused. + const attached = yield* server + .callTool({ + name: "t3_queue", + arguments: { action: "edit", queuedRunId: "run:queued", text: " /LOGOUT " }, + }) + .pipe( + Effect.provideService(McpInvocationContext.McpInvocationContext, scope), + Effect.provideService(McpSchema.McpServerClient, client), + ); + expect(attached.isError).not.toBe(true); + expect(dispatched).toMatchObject([{ text: "Edited" }, { text: " /LOGOUT ", attachments }]); + expect(dispatched[0]).not.toHaveProperty("attachments"); }).pipe( Effect.provide( layerThreadToolkit.pipe( Layer.provideMerge(McpHttpServer.layerInProcessMcpServer), Layer.provide(NodeCrypto.layer), - Layer.provide(historyReads(reads)), + Layer.provide(historyReads(reads, { attachments, dispatched })), Layer.provide( Layer.succeed( AnalyticsService.AnalyticsService, diff --git a/apps/server/src/mcp/toolkits/thread/handlers.ts b/apps/server/src/mcp/toolkits/thread/handlers.ts index 972174638e10f..190cbe3eac2b1 100644 --- a/apps/server/src/mcp/toolkits/thread/handlers.ts +++ b/apps/server/src/mcp/toolkits/thread/handlers.ts @@ -21,6 +21,7 @@ import { unavailable, } from "../../threadAccess.ts"; import type * as ThreadManagement from "../../../orchestration-v2/ThreadManagementService.ts"; +import * as ThreadMessageIntake from "../../../orchestration-v2/ThreadMessageIntake.ts"; import * as ThreadSearch from "../../../orchestration-v2/ThreadSearch.ts"; import * as ScheduledTasks from "../../../scheduledTasks/ScheduledTaskService.ts"; import { queuedRunsInDeliveryOrder } from "../../../orchestration-v2/QueuedRunOrder.ts"; @@ -324,12 +325,26 @@ export const layer = McpToolAccess.toLayer(ThreadToolkit, { switch (input.action) { case "edit": { const text = yield* required(input.text, "text"); - return yield* dispatch(input.threadId, (common) => ({ - ...common, + const { threads, projection } = yield* readThread(input.threadId); + // An agent must not turn a person's queued message into a provider sign-out. + const command = yield* ThreadMessageIntake.withQueuedAttachmentsOnSignOutText({ type: "queued-run.edit", + commandId: yield* newCommandId(), + threadId: projection.thread.id, runId, text, - })); + }).pipe( + Effect.mapError((error) => + error._tag === "EnvironmentAuthorizationError" + ? new OrchestratorMcpFailure({ + code: "invalid_request", + message: "A queued message cannot be edited into a provider sign-out.", + }) + : dispatchFailure(error), + ), + ); + const result = yield* threads.dispatch(command).pipe(Effect.mapError(dispatchFailure)); + return { sequence: result.sequence }; } case "reorder": { const beforeRunId = yield* required(input.beforeRunId, "beforeRunId"); diff --git a/apps/server/src/orchestration-v2/CommandPolicy.ts b/apps/server/src/orchestration-v2/CommandPolicy.ts index 0191163e8bc75..451ca978b9e51 100644 --- a/apps/server/src/orchestration-v2/CommandPolicy.ts +++ b/apps/server/src/orchestration-v2/CommandPolicy.ts @@ -59,6 +59,17 @@ type MessageDispatchMode = Extract< { readonly type: "message.dispatch" } >["dispatchMode"]; +/** + * A message that signs a provider account out at turn start, as `providerAuthLogout` does. + * With attachments the same text is an ordinary prompt. + */ +export function isProviderSignOutPrompt(message: { + readonly text: string; + readonly attachments: ReadonlyArray; +}): boolean { + return message.attachments.length === 0 && message.text.trim().toLowerCase() === "/logout"; +} + export function isNativeMaintenanceCommand(message: { readonly text: string; readonly attachments: ReadonlyArray; diff --git a/apps/server/src/orchestration-v2/ProviderTurnStartService.test.ts b/apps/server/src/orchestration-v2/ProviderTurnStartService.test.ts index f83fa70ca6bae..e4edafd70942b 100644 --- a/apps/server/src/orchestration-v2/ProviderTurnStartService.test.ts +++ b/apps/server/src/orchestration-v2/ProviderTurnStartService.test.ts @@ -467,6 +467,8 @@ function makeLocalCommandHarness(input: { readonly fileSystem?: FileSystem.FileSystem; readonly previousNativeSession?: boolean; readonly previousMessages?: ReadonlyArray; + readonly createdBy?: "agent" | "system"; + readonly scheduledTaskId?: ScheduledTaskId; readonly logoutFailure?: string; readonly openFailure?: unknown; readonly ensureThreadFailure?: unknown; @@ -565,8 +567,9 @@ function makeLocalCommandHarness(input: { text: input.text, attachments: [], streaming: false, - createdBy: "user", - creationSource: "web", + createdBy: input.createdBy ?? "user", + creationSource: input.createdBy === undefined ? "web" : "mcp", + ...(input.scheduledTaskId === undefined ? {} : { scheduledTaskId: input.scheduledTaskId }), createdAt: now, updatedAt: now, }; @@ -3301,6 +3304,7 @@ effectIt.effect.each(["not_loaded", "error"] as const)( instanceId: harness.oldInstanceId, text: "/logout", hasAttachments: false, + sentByPerson: true, }); expect(harness.open).not.toHaveBeenCalled(); expect(harness.startRootRun).not.toHaveBeenCalled(); @@ -3324,6 +3328,26 @@ effectIt.effect.each(["not_loaded", "error"] as const)( }), ); +effectIt.effect.each([ + { name: "an agent", createdBy: "agent" as const }, + // A scheduled delivery keeps its task author's createdBy. + { name: "a scheduled task", scheduledTaskId: ScheduledTaskId.make("task") }, +])("does not let $name sign a provider out", ({ name: _name, ...sender }) => + Effect.gen(function* () { + const harness = makeLocalCommandHarness({ + text: "/logout", + ...sender, + previousNativeSession: true, + }); + + yield* harness.start; + + expect(harness.tryHandlePromptCommand).toHaveBeenCalledExactlyOnceWith( + expect.objectContaining({ sentByPerson: false }), + ); + }), +); + for (const previousMessages of [[], ["/compact", " /COMPACT "]]) { effectIt.effect( `rejects compaction without conversation context after ${previousMessages.length} prior compactions`, diff --git a/apps/server/src/orchestration-v2/ProviderTurnStartService.ts b/apps/server/src/orchestration-v2/ProviderTurnStartService.ts index 8c2c4eb3bea04..fded9011c9137 100644 --- a/apps/server/src/orchestration-v2/ProviderTurnStartService.ts +++ b/apps/server/src/orchestration-v2/ProviderTurnStartService.ts @@ -741,6 +741,10 @@ export const layer: Layer.Layer< records: providerMessage.context?.records ?? [], }), hasAttachments: false, + // A scheduled delivery keeps its task author's createdBy. + sentByPerson: + providerMessage.createdBy === "user" && + providerMessage.scheduledTaskId === undefined, }), ); if (isEmptyCompaction || authResult?._tag === "Failure" || authResult?.success) { diff --git a/apps/server/src/orchestration-v2/ThreadLaunchService.test.ts b/apps/server/src/orchestration-v2/ThreadLaunchService.test.ts index 9f40a5a176923..cabd1dce197a8 100644 --- a/apps/server/src/orchestration-v2/ThreadLaunchService.test.ts +++ b/apps/server/src/orchestration-v2/ThreadLaunchService.test.ts @@ -77,6 +77,9 @@ import type * as ProviderAdapter from "@t3tools/provider-core/server/ProviderAda const projectId = ProjectId.make("project:launch-test"); const otherProjectId = ProjectId.make("project:launch-other"); const encodeThreadProjection = Schema.encodeEffect(OrchestrationV2ThreadProjectionJson); +const dispatchIntakeCommand = ( + command: Parameters[0], +) => ThreadMessageIntake.dispatchCommand(command, { managesProviders: true }); const modelSelection = { instanceId: ProviderInstanceId.make("codex"), model: "gpt-5.1-codex", @@ -2672,7 +2675,7 @@ it.effect("shared intake preserves durable attachment bytes after a lost launch }).pipe(Effect.flip); assert.equal(missingProject._tag, "ThreadLaunchError"); assert.equal((yield* claimedFiles).length, 1); - const missingThread = yield* ThreadMessageIntake.dispatchCommand({ + const missingThread = yield* dispatchIntakeCommand({ type: "message.dispatch", commandId: CommandId.make("intake-no-thread"), threadId: ThreadId.make("missing-thread"), @@ -2686,7 +2689,7 @@ it.effect("shared intake preserves durable attachment bytes after a lost launch assert.equal(missingThread._tag, "OrchestratorProjectionError"); assert.equal((yield* claimedFiles).length, 1); - const dispatch = ThreadMessageIntake.dispatchCommand({ + const dispatch = dispatchIntakeCommand({ type: "message.dispatch", commandId: CommandId.make("intake-dispatch"), threadId: input.threadId, @@ -2722,7 +2725,7 @@ it.effect("shared intake preserves durable attachment bytes after a lost launch }); assert.isNotNull(filePath); yield* fs.writeFile(filePath, new Uint8Array([5, 6, 7, 8])); - const edit = ThreadMessageIntake.dispatchCommand({ + const edit = dispatchIntakeCommand({ type: "queued-run.edit", commandId: CommandId.make("intake-edit"), threadId: input.threadId, @@ -2748,7 +2751,7 @@ it.effect("shared intake preserves durable attachment bytes after a lost launch assert.deepEqual(yield* fs.readFile(durableFilePath), new Uint8Array([5, 6, 7, 8])); assert.deepEqual(yield* fs.readFile(filePath), new Uint8Array([5, 6, 7, 8])); const beforeRejectedEdit = (yield* claimedFiles).length; - const rejectedEdit = yield* ThreadMessageIntake.dispatchCommand({ + const rejectedEdit = yield* dispatchIntakeCommand({ type: "queued-run.edit", commandId: CommandId.make("intake-edit-rejected"), threadId: input.threadId, diff --git a/apps/server/src/orchestration-v2/ThreadMessageIntake.test.ts b/apps/server/src/orchestration-v2/ThreadMessageIntake.test.ts index a92cdd22aa515..81fc56150d7fd 100644 --- a/apps/server/src/orchestration-v2/ThreadMessageIntake.test.ts +++ b/apps/server/src/orchestration-v2/ThreadMessageIntake.test.ts @@ -34,7 +34,10 @@ import { OrchestratorDispatchError, } from "./Orchestrator.ts"; import * as ThreadManagementService from "./ThreadManagementService.ts"; -import { dispatchCommand } from "./ThreadMessageIntake.ts"; +import * as ThreadMessageIntake from "./ThreadMessageIntake.ts"; + +const dispatchCommand = (command: OrchestrationV2Command, sender = { managesProviders: true }) => + ThreadMessageIntake.dispatchCommand(command, sender); const layerIntakeTest = ServerConfig.layerTest(process.cwd(), { prefix: "t3-question-intake-", @@ -475,3 +478,70 @@ it.effect("refuses a queued edit that keeps a file another edit already deleted" expect(captured).toHaveLength(2); }).pipe(Effect.provide(layerIntakeTest)), ); + +it.effect("a queued /logout edit without provider management must keep an attachment", () => + Effect.gen(function* () { + const threadId = ThreadId.make("thread-sign-out-edit"); + const image = { + type: "image" as const, + id: ChatAttachmentId.make(createAttachmentId(threadId)!), + name: "shot.png", + mimeType: "image/png", + sizeBytes: 3, + }; + const config = yield* ServerConfig.ServerConfig; + NodeFS.writeFileSync( + NodePath.join(config.attachmentsDir, `${image.id}.png`), + new Uint8Array([1, 2, 3]), + ); + const captured: OrchestrationV2ServerCommand[] = []; + // The edit omits `attachments`, as an older client's does, so the queued ones stay. + const edit = (run: string, managesProviders: boolean) => + dispatchCommand( + { + type: "queued-run.edit", + commandId: CommandId.make(`edit-${run}-${managesProviders}`), + threadId, + runId: RunId.make(run), + text: " /LOGOUT ", + }, + { managesProviders }, + ).pipe( + Effect.provide( + Layer.mock(ThreadManagementService.ThreadManagementService)({ + dispatch: layerFailingDispatchHandler(captured), + hasReceipt: (commandId) => Effect.succeed(commandId === "edit-replayed-false"), + getThreadRecords: () => + Effect.succeed({ + runs: ["attached", "bare"].map((id) => ({ + id: RunId.make(id), + status: "queued", + userMessageId: MessageId.make(id), + })), + } as never), + getMessagesById: (_threadId, [id]) => + Effect.succeed( + new Map([[id, { attachments: id === "attached" ? [image] : [] }]]) as never, + ), + }), + ), + Effect.flip, + ); + + expect((yield* edit("bare", false))._tag).toBe("EnvironmentAuthorizationError"); + expect((yield* edit("started", false))._tag).toBe("EnvironmentAuthorizationError"); + expect(captured).toEqual([]); + yield* edit("attached", false); + yield* edit("bare", true); + // A retry of an accepted edit reaches its receipt after its run left the queue. + yield* edit("replayed", false); + // The kept files are pinned, so an edit racing this one cannot strip them afterwards. + expect(captured).toMatchObject([ + { runId: "attached", attachments: [image] }, + { runId: "bare" }, + { runId: "replayed" }, + ]); + expect(captured[1]).not.toHaveProperty("attachments"); + expect(captured[2]).not.toHaveProperty("attachments"); + }).pipe(Effect.provide(layerIntakeTest)), +); diff --git a/apps/server/src/orchestration-v2/ThreadMessageIntake.ts b/apps/server/src/orchestration-v2/ThreadMessageIntake.ts index 6e9fd503baec5..5d9ec263b0b0d 100644 --- a/apps/server/src/orchestration-v2/ThreadMessageIntake.ts +++ b/apps/server/src/orchestration-v2/ThreadMessageIntake.ts @@ -1,14 +1,20 @@ import { remapComposerContextAttachments } from "@t3tools/shared/composerContextReferences"; import { appendUserInputAttachmentPaths } from "../provider/userInputAttachments.ts"; -import type { ChatAttachment, OrchestrationV2Command } from "@t3tools/contracts"; +import { + AuthProvidersManageScope, + type ChatAttachment, + type OrchestrationV2Command, +} from "@t3tools/contracts"; import * as Effect from "effect/Effect"; import * as FileSystem from "effect/FileSystem"; import * as Schema from "effect/Schema"; import { resolveAttachmentPath } from "../attachmentStore.ts"; +import { rpcAuthorizationError } from "../auth/RpcAuthorization.ts"; import * as ServerConfig from "../config.ts"; import * as Orchestrator from "./Orchestrator.ts"; import * as AttachmentClaims from "./AttachmentClaims.ts"; +import { isProviderSignOutPrompt } from "./CommandPolicy.ts"; import * as ThreadLaunch from "./ThreadLaunchService.ts"; import * as ThreadManagement from "./ThreadManagementService.ts"; @@ -85,11 +91,52 @@ const withGuestAttachments = Effect.fn("ThreadMessageIntake.withGuestAttachments return { ...command, attachments: message?.attachments ?? [] }; }); +/** + * For a caller without `providers:manage`. An edit that omits `attachments` keeps the queued + * ones, so `/logout` signs out only when the queued message has none. The edit goes on with + * the files read here, so an edit racing this one cannot strip them afterwards. + */ +export const withQueuedAttachmentsOnSignOutText = Effect.fn( + "ThreadMessageIntake.withQueuedAttachmentsOnSignOutText", +)(function* (command: Extract) { + if ( + command.attachments !== undefined || + !isProviderSignOutPrompt({ text: command.text, attachments: [] }) + ) { + return command; + } + const threads = yield* ThreadManagement.ThreadManagementService; + // A retry of an accepted edit replays its receipt, even after its run left the queue. + if (yield* threads.hasReceipt(command.commandId)) return command; + const { runs } = yield* threads.getThreadRecords(command.threadId, ["runs"], { + runIds: [command.runId], + }); + const queuedRun = runs.find((run) => run.id === command.runId && run.status === "queued"); + const attachments = + queuedRun === undefined + ? [] + : ((yield* threads.getMessagesById(command.threadId, [queuedRun.userMessageId])).get( + queuedRun.userMessageId, + )?.attachments ?? []); + if (attachments.length === 0) return yield* rpcAuthorizationError(AuthProvidersManageScope); + return { ...command, attachments }; +}); + +/** + * `sender.managesProviders` is whether the caller holds `providers:manage`. RPC authorization + * has already checked every command whose payload shows a provider sign-out; a queued edit + * that keeps its attachments is the one case decided here. + */ export const dispatchCommand = Effect.fn("ThreadMessageIntake.dispatchCommand")(function* ( incoming: OrchestrationV2Command, + sender: { readonly managesProviders: boolean }, ) { const command = - incoming.type === "message.dispatch" ? yield* withGuestAttachments(incoming) : incoming; + incoming.type === "message.dispatch" + ? yield* withGuestAttachments(incoming) + : incoming.type === "queued-run.edit" && !sender.managesProviders + ? yield* withQueuedAttachmentsOnSignOutText(incoming) + : incoming; const threads = yield* ThreadManagement.ThreadManagementService; if (command.type === "runtime-request.respond" && command.attachmentsByQuestionId) { const config = yield* ServerConfig.ServerConfig; diff --git a/apps/server/src/provider/ProviderAuthService.test.ts b/apps/server/src/provider/ProviderAuthService.test.ts index 603df5e7e4bcd..0186f79fac768 100644 --- a/apps/server/src/provider/ProviderAuthService.test.ts +++ b/apps/server/src/provider/ProviderAuthService.test.ts @@ -679,6 +679,32 @@ describe("ProviderAuthService", () => { }), ); + it.effect("refuses a chat sign-out that no person sent", () => + Effect.gen(function* () { + const { service, actions } = yield* makeHarness({}); + const error = yield* Effect.flip( + service.tryHandlePromptCommand({ + instanceId, + text: "/logout", + hasAttachments: false, + sentByPerson: false, + }), + ); + + assert.strictEqual(error.operation, "logout"); + assert.deepStrictEqual(actions, []); + // Any other prompt still goes to the provider. + assert.isFalse( + yield* service.tryHandlePromptCommand({ + instanceId, + text: "hello", + hasAttachments: false, + sentByPerson: false, + }), + ); + }), + ); + it.effect("does not log out or consume the command when stopping a session fails", () => Effect.gen(function* () { const { service, actions, released } = yield* makeHarness({ @@ -687,7 +713,12 @@ describe("ProviderAuthService", () => { stopError: true, }); const error = yield* Effect.flip( - service.tryHandlePromptCommand({ instanceId, text: "/logout", hasAttachments: false }), + service.tryHandlePromptCommand({ + instanceId, + text: "/logout", + hasAttachments: false, + sentByPerson: true, + }), ); assert.instanceOf(error, ProviderSetupError); @@ -722,7 +753,12 @@ it.effect("queued logout prompts resolve the current controller after provider r yield* Deferred.await(entered); observeLookup = true; const queued = yield* harness.service - .tryHandlePromptCommand({ instanceId, text: "/logout", hasAttachments: false }) + .tryHandlePromptCommand({ + instanceId, + text: "/logout", + hasAttachments: false, + sentByPerson: true, + }) .pipe(Effect.forkChild); yield* Deferred.await(lookup); let replacementLoggedOut = false; @@ -787,6 +823,7 @@ it.effect.each(["start", "logout", "prompt"] as const)( instanceId, text: "/logout", hasAttachments: false, + sentByPerson: true, }); const running = yield* operation.pipe(Effect.forkChild); yield* Deferred.await(checked); diff --git a/apps/server/src/provider/ProviderAuthService.ts b/apps/server/src/provider/ProviderAuthService.ts index b09a60ffc1be0..625a4ae77c683 100644 --- a/apps/server/src/provider/ProviderAuthService.ts +++ b/apps/server/src/provider/ProviderAuthService.ts @@ -62,7 +62,12 @@ export class ProviderAuthService extends Context.Service< ownerSessionId: string, ) => Stream.Stream; readonly tryHandlePromptCommand: ( - input: ProviderAuthTarget & { readonly text: string; readonly hasAttachments: boolean }, + input: ProviderAuthTarget & { + readonly text: string; + readonly hasAttachments: boolean; + /** False for agent, system and scheduled messages: no RPC scope check covered them. */ + readonly sentByPerson: boolean; + }, ) => Effect.Effect; } >()("t3/provider/ProviderAuthService") {} @@ -306,6 +311,13 @@ export const makeProviderAuthService = Effect.gen(function* () { if (!instance?.auth?.isLogoutPrompt?.(input.text, input.hasAttachments)) { return false; } + if (!input.sentByPerson) { + return yield* new ProviderSetupError({ + instanceId: input.instanceId, + operation: "logout", + detail: "Only a person can sign out of a provider from chat. Sign out in Settings.", + }); + } return yield* credentialChanges.withPermit( Effect.gen(function* () { const auth = yield* getController(input.instanceId, "logout"); diff --git a/apps/server/src/ws.ts b/apps/server/src/ws.ts index 63d45c48816e4..9408127f5a2b3 100644 --- a/apps/server/src/ws.ts +++ b/apps/server/src/ws.ts @@ -31,6 +31,7 @@ import { AuthAccessStreamError, type AuthAccessStreamEvent, AuthOrchestrationOperateScope, + AuthProvidersManageScope, type AuthEnvironmentScope, type ScheduledTaskListResult, AuthSessionId, @@ -2018,6 +2019,10 @@ export const layerWsRpc = ( creationSource: "creationSource" in command ? command.creationSource : "web", }), + { + managesProviders: + currentSession.scopes.includes(AuthProvidersManageScope), + }, ) ).pipe(Effect.provide(intakeContext)), ) @@ -2027,6 +2032,7 @@ export const layerWsRpc = ( ), Effect.map((result) => ({ sequence: result.sequence })), Effect.mapError((cause) => { + if (cause._tag === "EnvironmentAuthorizationError") return cause; const detail = userFacingDispatchErrorMessage(cause); return new OrchestrationV2DispatchCommandError({ commandId: command.commandId, diff --git a/docs/user/providers-antigravity.md b/docs/user/providers-antigravity.md index 8935439c0a63d..db2a06661c8e7 100644 --- a/docs/user/providers-antigravity.md +++ b/docs/user/providers-antigravity.md @@ -142,6 +142,8 @@ runtimes are shared on the environment. All three keep thread history and workspace files. Sending `/logout` by itself in a thread signs out its instance, including stopping that instance's other sessions. +That needs a client allowed to manage providers, and it has to be your own message: +`/logout` from an agent or a scheduled task is refused. Sign out, then sign in again to replace an account. Before removing a managed runtime, disable its instances and cancel any active From f8d7f4891385cdf178271a1fd0dc8c5842b483a6 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Thu, 19 Nov 2026 12:43:13 -0800 Subject: [PATCH 126/201] fix(ssh): desktop SSH reaches hosts with a one-time code through a signed-in ControlMaster (#30616) --- docs/user/remote-access.md | 12 ++++ packages/ssh/src/command.ts | 36 +++++++++++- packages/ssh/src/tunnel.test.ts | 77 ++++++++++++++++++++++++++ packages/ssh/src/tunnel.ts | 97 +++++++++++++++++++++++++++------ 4 files changed, 203 insertions(+), 19 deletions(-) diff --git a/docs/user/remote-access.md b/docs/user/remote-access.md index 7a6731d9ebe10..8a8e87fe0ba57 100644 --- a/docs/user/remote-access.md +++ b/docs/user/remote-access.md @@ -259,6 +259,18 @@ check with: ssh user@example.com 'sh -lc "command -v claude codex"' ``` +T3 Code cannot answer a second sign-in prompt such as a Duo code. On macOS and +Linux it can reuse a connection you signed in to in a terminal instead: turn on +connection sharing for the host in `~/.ssh/config`, run `ssh `, then +connect. When that connection closes, sign in again in a terminal and retry. + +```sshconfig +Host + ControlMaster auto + ControlPath ~/.ssh/cm-%C + ControlPersist 8h +``` + If SSH reconnecting fails after an app update, retry the launch once. Removing the connection stops a server that T3 Code launched; a server that was already running is left alone. diff --git a/packages/ssh/src/command.ts b/packages/ssh/src/command.ts index 8a225ab05a15d..4d1534bf96b43 100644 --- a/packages/ssh/src/command.ts +++ b/packages/ssh/src/command.ts @@ -43,7 +43,7 @@ export interface RunSshCommandOptions extends SshAuthOptions { readonly keepErrorOutputTail?: boolean; } -export function parseSshResolveOutput(alias: string, stdout: string): DesktopSshEnvironmentTarget { +function parseSshConfigOutput(stdout: string): Map { const values = new Map(); for (const line of stdout.split(/\r?\n/u)) { const trimmed = line.trim(); @@ -56,6 +56,11 @@ export function parseSshResolveOutput(alias: string, stdout: string): DesktopSsh } values.set(key, rest.join(" ").trim()); } + return values; +} + +export function parseSshResolveOutput(alias: string, stdout: string): DesktopSshEnvironmentTarget { + const values = parseSshConfigOutput(stdout); const hostname = values.get("hostname")?.trim() || alias; const username = values.get("user")?.trim() || null; @@ -123,6 +128,12 @@ export function baseSshArgs( ]; } +// `-F none` keeps the user's configured forwards out of T3's requests, and ProxyCommand=false +// fails closed instead of dialing the host directly once the master is gone. +export function controlMasterArgs(controlPath: string): string[] { + return ["-F", "none", "-o", `ControlPath=${controlPath}`, "-o", "ProxyCommand=false"]; +} + export function getLastNonEmptyOutputLine(stdout: string): string | null { return ( stdout @@ -442,3 +453,26 @@ export const resolveSshTarget = Effect.fn("ssh/command.resolveSshTarget")(functi ), ); }); + +/** The control path of the user's signed-in ControlMaster for `target`, or null when none is live. */ +export const findLiveControlPath = Effect.fn("ssh/command.findLiveControlPath")(function* ( + target: DesktopSshEnvironmentTarget, +): Effect.fn.Return< + string | null, + never, + ChildProcessSpawner.ChildProcessSpawner | FileSystem.FileSystem | Path.Path +> { + const resolved = yield* runSshCommand(target, { preHostArgs: ["-G"] }).pipe(Effect.option); + const controlPath = Option.isSome(resolved) + ? parseSshConfigOutput(resolved.value.stdout).get("controlpath") + : undefined; + if (controlPath === undefined || controlPath === "none") { + return null; + } + return yield* runSshCommand(target, { + preHostArgs: [...controlMasterArgs(controlPath), "-O", "check"], + }).pipe( + Effect.as(controlPath), + Effect.orElseSucceed(() => null), + ); +}); diff --git a/packages/ssh/src/tunnel.test.ts b/packages/ssh/src/tunnel.test.ts index ca7b4ce85ac51..6c8ffd5a6151c 100644 --- a/packages/ssh/src/tunnel.test.ts +++ b/packages/ssh/src/tunnel.test.ts @@ -1187,6 +1187,83 @@ describe("ssh tunnel scripts", () => { }), ); + it.effect.each([ + { name: "rides a live ControlMaster", masterLive: true }, + { name: "keeps the auth failure without a live ControlMaster", masterLive: false }, + ])("when the tunnel cannot sign in again, $name", ({ masterLive }) => + Effect.gen(function* () { + const denied = "julius@devbox: Permission denied (publickey,keyboard-interactive).\n"; + const openedForwards: Array = []; + const cancelledForwards: Array = []; + const spawner = ChildProcessSpawner.make((command) => + Effect.sync(() => { + const args = commandArgs(command); + const forward = args.includes("-L") ? args[args.indexOf("-L") + 1] : undefined; + const muxCommand = args.includes("-O") ? args[args.indexOf("-O") + 1] : undefined; + const failed = (stderr: string) => ({ + ...makeSuccessfulProcess(""), + exitCode: Effect.succeed(ChildProcessSpawner.ExitCode(255)), + stderr: Stream.make(new TextEncoder().encode(stderr)), + }); + if (args.includes("-G")) { + return makeSuccessfulProcess("hostname devbox\ncontrolpath /tmp/t3-cm\n"); + } + if (muxCommand === "check") { + return masterLive + ? makeSuccessfulProcess("") + : failed("Control socket connect: ENOENT\n"); + } + if (muxCommand === "cancel") { + cancelledForwards.push(forward); + return makeSuccessfulProcess(""); + } + if (forward !== undefined) { + // Only the signed-in master can pass the host's one-time-code prompt. + if (!masterLive || args.includes("ControlPath=none")) return failed(denied); + openedForwards.push(forward); + return muxCommand === "forward" + ? makeSuccessfulProcess("") + : makeRunningProcess(() => undefined); + } + return makeSuccessfulProcess('{"remotePort":3773}\n'); + }), + ); + const layer = Layer.mergeAll( + NodeServices.layer, + NodeCrypto.layer, + Layer.succeed(ChildProcessSpawner.ChildProcessSpawner, spawner), + Layer.succeed( + HttpClient.HttpClient, + HttpClient.make((request) => + openedForwards.length > 0 ? testHttpClient.execute(request) : Effect.never, + ), + ), + Layer.succeed(NetService.NetService, testNetService), + SshAuth.SshPasswordPrompt.disabledLayer, + SshTunnel.SshEnvironmentManager.layer({ resolveCliRunner: Effect.succeed(ARCHIVE) }), + ); + const target = { alias: "devbox", hostname: "devbox", username: null, port: null }; + yield* Effect.gen(function* () { + const manager = yield* SshTunnel.SshEnvironmentManager; + const result = yield* Effect.result(manager.ensureEnvironment(target)); + if (!masterLive) { + assert.isTrue(Result.isFailure(result)); + if (Result.isFailure(result)) { + assert.instanceOf(result.failure, SshCommandError); + assert.include(result.failure.message, "Permission denied"); + } + assert.deepEqual(openedForwards, []); + return; + } + assert.equal(Result.isFailure(result) ? result.failure.message : "connected", "connected"); + assert.lengthOf(openedForwards, 1); + yield* manager.disconnectEnvironment(target); + // The master keeps a forward after the client that asked for it exits. + assert.deepEqual(cancelledForwards, openedForwards); + }).pipe(Effect.provide(layer), Effect.scoped); + }), + ); + it.live("concurrent launches on one remote home record the server that owns it", () => // The second row's server never publishes server-runtime.json. Effect.forEach([1_500, null, "wrapper"] as const, (variant) => diff --git a/packages/ssh/src/tunnel.ts b/packages/ssh/src/tunnel.ts index 522fb23625286..a4b865385f81e 100644 --- a/packages/ssh/src/tunnel.ts +++ b/packages/ssh/src/tunnel.ts @@ -32,6 +32,8 @@ import * as SshAuth from "./auth.ts"; import { baseSshArgs, buildSshHostSpecEffect, + controlMasterArgs, + findLiveControlPath, getLastNonEmptyOutputLine, remoteStateKey, resolveSshCommand, @@ -1471,6 +1473,8 @@ const startSshTunnel = Effect.fn("ssh/tunnel.startSshTunnel")(function* (input: readonly httpBaseUrl: string; readonly wsBaseUrl: string; readonly authOptions: SshAuth.SshAuthOptions; + /** Forward through this live ControlMaster instead of signing in again. */ + readonly controlPath: string | null; readonly remoteServerKind: "external" | "managed" | null; readonly scope: Scope.Closeable; }): Effect.fn.Return< @@ -1503,7 +1507,7 @@ const startSshTunnel = Effect.fn("ssh/tunnel.startSshTunnel")(function* (input: }), ), ); - const args = [ + const directArgs = [ ...baseSshArgs(input.resolvedTarget, { batchMode: input.authOptions.batchMode ?? "no", }), @@ -1526,10 +1530,56 @@ const startSshTunnel = Effect.fn("ssh/tunnel.startSshTunnel")(function* (input: "--", hostSpec, ]; + const { controlPath, scope } = input; + // The master's own GatewayPorts would otherwise decide the bind address. + const controlMasterForward = `127.0.0.1:${input.localPort}:127.0.0.1:${input.remotePort}`; + const { args, stdin } = + controlPath === null + ? { args: directArgs, stdin: { stream: Stream.empty, endOnDone: true } } + : { + // A mux client with -N exits once the master takes the forward, so hold a session + // open on stdin to keep a process whose exit means the tunnel is gone. + args: [ + ...baseSshArgs(input.resolvedTarget, { batchMode: "yes" }), + ...controlMasterArgs(controlPath), + "-o", + "ExitOnForwardFailure=yes", + "-o", + "ControlMaster=no", + "-T", + "-L", + controlMasterForward, + "--", + hostSpec, + "sh -c 'exec cat >/dev/null'", + ], + stdin: "pipe" as const, + }; const sshCommand = yield* resolveSshCommand; const tunnelCommand = [sshCommand, ...args]; const spawner = yield* ChildProcessSpawner.ChildProcessSpawner; - const { scope } = input; + if (controlPath !== null) { + const fileSystemService = yield* FileSystem.FileSystem; + const pathService = yield* Path.Path; + // The master keeps a forward after the mux client that asked for it exits. + yield* Scope.addFinalizer( + scope, + runSshCommand(input.resolvedTarget, { + preHostArgs: [ + ...controlMasterArgs(controlPath), + "-O", + "cancel", + "-L", + controlMasterForward, + ], + }).pipe( + Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner), + Effect.provideService(FileSystem.FileSystem, fileSystemService), + Effect.provideService(Path.Path, pathService), + Effect.ignore, + ), + ); + } yield* Effect.logDebug("ssh.tunnel.spawn.start", { ...sshTargetLogFields(input.resolvedTarget), command: tunnelCommand, @@ -1543,10 +1593,7 @@ const startSshTunnel = Effect.fn("ssh/tunnel.startSshTunnel")(function* (input: ChildProcess.make(sshCommand, args, { env: childEnvironment, extendEnv: true, - stdin: { - stream: Stream.empty, - endOnDone: true, - }, + stdin, }), ) .pipe( @@ -1908,18 +1955,32 @@ const makeSshEnvironmentManager = Effect.fn("ssh/tunnel.SshEnvironmentManager.ma const tunnelEntry = yield* runWithSshAuth({ key: input.key, target: input.resolvedTarget, - operation: (authOptions) => - startSshTunnel({ - key: input.key, - resolvedTarget: input.resolvedTarget, - remotePort, - localPort, - httpBaseUrl, - wsBaseUrl, - authOptions, - remoteServerKind: remoteLaunch.remoteServerKind, - scope: entryScope, - }), + operation: (authOptions) => { + const start = (controlPath: string | null) => + startSshTunnel({ + key: input.key, + resolvedTarget: input.resolvedTarget, + remotePort, + localPort, + httpBaseUrl, + wsBaseUrl, + authOptions, + controlPath, + remoteServerKind: remoteLaunch.remoteServerKind, + scope: entryScope, + }); + // A fresh login cannot answer a second factor such as Duo, but the user's signed-in + // ControlMaster already has. Without one, the auth failure goes on to the password prompt. + return start(null).pipe( + Effect.catchIf(SshAuth.isSshAuthFailure, (error) => + findLiveControlPath(input.resolvedTarget).pipe( + Effect.flatMap((controlPath) => + controlPath === null ? Effect.fail(error) : start(controlPath), + ), + ), + ), + ); + }, }).pipe( Effect.onExit((exit) => Exit.isSuccess(exit) ? Effect.void : Scope.close(entryScope, Exit.void).pipe(Effect.ignore), From 34a7ab3641d39dd4eb5e863f2d6f38bc09b9bcbf Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Thu, 19 Nov 2026 12:43:35 -0800 Subject: [PATCH 127/201] fix(pi): T3 tools are callable by Pi's own mcp__t3_code__ names (#26845) --- .../orchestrator-mcp-server.md | 9 +- .../src/server/mcpBridge.testkit.ts | 57 ++++++++ .../src/server/mcpExtensionSource.test.ts | 122 ++++++++++++++++-- .../src/server/mcpExtensionSource.ts | 50 +++++-- 4 files changed, 212 insertions(+), 26 deletions(-) diff --git a/docs/orchestration-v2/orchestrator-mcp-server.md b/docs/orchestration-v2/orchestrator-mcp-server.md index 6c1150fbfc023..5f48ed4a2c14f 100644 --- a/docs/orchestration-v2/orchestrator-mcp-server.md +++ b/docs/orchestration-v2/orchestrator-mcp-server.md @@ -167,9 +167,12 @@ T3_MCP_BEARER_TOKEN= ``` The extension preserves public names under `mcp__t3-code__` for saved loadouts -and tool selectors. Modern Pi also receives hidden `mcp__t3_code__` aliases, -which reserve the normalized namespace against configured MCP servers without -adding declarations or search results. On Pi 0.99+, +and tool selectors. Modern Pi also receives `mcp__t3_code__` aliases, Pi's own +name for the server, which reserve it against configured MCP servers. They are +`model-only` and hide their own declarations, so the model can call them without +added declarations, search results, or codemode entries. An alias follows its +public tool: dropped when that tool is excluded, and off while a direct one is +off. Pi's `hidden` exposure would make them unreachable. On Pi 0.99+, `orchestrator_capabilities`, `delegate_task`, and `task_status` remain directly available; optional tools are discovered through Pi's builtin `tool_search`. On older Pi or without builtin search, all tools remain directly available. diff --git a/packages/provider-pi/src/server/mcpBridge.testkit.ts b/packages/provider-pi/src/server/mcpBridge.testkit.ts index 98ef74bb862cc..759c8346ba037 100644 --- a/packages/provider-pi/src/server/mcpBridge.testkit.ts +++ b/packages/provider-pi/src/server/mcpBridge.testkit.ts @@ -13,6 +13,12 @@ interface RegisteredTool { readonly exposure?: string; readonly promptSnippet?: string; readonly promptGuidelines?: ReadonlyArray; + readonly prepareLoadout?: (loadout: { + readonly declared: ReadonlyArray; + readonly callable: ReadonlyArray; + readonly registered: ReadonlyArray; + readonly getExposure: (name: string) => string; + }) => { readonly hiddenDeclarations?: ReadonlyArray } | undefined; readonly execute: ( id: string, args: Record, @@ -40,12 +46,20 @@ type AgentStartHook = ( }, ) => Promise<{ systemPrompt: string } | undefined>; +function activatesOnRegistration(tool: RegisteredTool) { + return ( + tool.exposure === undefined || tool.exposure === "direct" || tool.exposure === "model-only" + ); +} + export async function loadMcpBridge( options: { readonly modern?: boolean; readonly result?: unknown; readonly toolSearchAvailable?: boolean; readonly toolSearchDisabled?: boolean; + // Pi activates direct and model-only tools when they are registered. + readonly activatesOnRegistration?: boolean; readonly allowsTool?: (name: string) => boolean; readonly runtimeMode?: string; readonly inputSchema?: Record; @@ -131,8 +145,17 @@ export async function loadMcpBridge( registerTool: (tool: RegisteredTool) => { if (options.allowsTool && !options.allowsTool(tool.name)) return; const index = tools.findIndex((current) => current.name === tool.name); + const previous = index === -1 ? undefined : tools[index]; if (index === -1) tools.push(tool); else tools[index] = tool; + if ( + options.activatesOnRegistration && + activatesOnRegistration(tool) && + (previous === undefined || !activatesOnRegistration(previous)) && + !activeTools.includes(tool.name) + ) { + activeTools = [...activeTools, tool.name]; + } }, getActiveTools: () => activeTools, setActiveTools: (names: string[]) => { @@ -155,9 +178,43 @@ export async function loadMcpBridge( : {}), }, }); + const exposureOf = (name: string) => + tools.find((tool) => tool.name === name)?.exposure ?? "direct"; + // Pi resolves model tool calls against the active, non-hidden tools only. + const modelTools = () => + tools.filter((tool) => activeTools.includes(tool.name) && exposureOf(tool.name) !== "hidden"); + // Pi's ctx.executeTool() catalog, which codemode scripts search and list. + const callableTools = () => + tools.filter( + (tool) => + ["codemode", "deferred"].includes(exposureOf(tool.name)) || + (exposureOf(tool.name) === "direct" && activeTools.includes(tool.name)), + ); + const declaredTools = () => { + const active = modelTools(); + const loadout = { + declared: active, + callable: callableTools(), + registered: tools, + getExposure: exposureOf, + }; + const hidden = new Set( + active.flatMap((tool) => tool.prepareLoadout?.(loadout)?.hiddenDeclarations ?? []), + ); + return active.map((tool) => tool.name).filter((name) => !hidden.has(name)); + }; return { handlers, tools, + declaredTools, + callableTools: () => callableTools().map((tool) => tool.name), + callModelTool: async (name: string, args: Record) => { + const tool = modelTools().find((candidate) => candidate.name === name); + if (tool === undefined) { + return { content: [{ type: "text", text: `Tool ${name} not found` }], isError: true }; + } + return tool.execute("model-call", args); + }, setBridgeSourcePath: (path: string) => { bridgeSourcePath = path; }, diff --git a/packages/provider-pi/src/server/mcpExtensionSource.test.ts b/packages/provider-pi/src/server/mcpExtensionSource.test.ts index 63556422bf41a..7506f155ab229 100644 --- a/packages/provider-pi/src/server/mcpExtensionSource.test.ts +++ b/packages/provider-pi/src/server/mcpExtensionSource.test.ts @@ -183,7 +183,11 @@ describe("Pi MCP tool exposure", () => { }; it("keeps orchestration direct and optional bridge tools discoverable on modern Pi", async () => { - const bridge = await loadMcpBridge({ modern: true, toolSearchAvailable: true }); + const bridge = await loadMcpBridge({ + modern: true, + toolSearchAvailable: true, + activatesOnRegistration: true, + }); await bridge.handlers.get("session_start")!({ systemPrompt: "" }, discoveryContext); const start = bridge.handlers.get("before_agent_start"); assert.isDefined(start); @@ -191,10 +195,27 @@ describe("Pi MCP tool exposure", () => { assert.include(prompt?.systemPrompt ?? "", "orchestrator_capabilities"); assert.equal(bridge.servers.length, 0); assert.equal(bridge.tools.length, 8); - assert.deepEqual(bridge.getActiveTools(), ["read", "tool_search"]); + const aliases = [ + "mcp__t3_code__orchestrator_capabilities", + "mcp__t3_code__delegate_task", + "mcp__t3_code__task_status", + "mcp__t3_code__preview_snapshot", + ]; + const publicDirect = [ + "mcp__t3-code__orchestrator_capabilities", + "mcp__t3-code__delegate_task", + "mcp__t3-code__task_status", + ]; + assert.sameMembers(bridge.getActiveTools(), [ + "read", + "tool_search", + ...publicDirect, + ...aliases, + ]); + assert.deepEqual(bridge.declaredTools(), publicDirect); assert.deepEqual( bridge.tools - .filter((tool) => tool.exposure !== "hidden") + .filter((tool) => tool.name.startsWith("mcp__t3-code__")) .map((tool) => [tool.name, tool.exposure]), [ ["mcp__t3-code__orchestrator_capabilities", "direct"], @@ -204,13 +225,10 @@ describe("Pi MCP tool exposure", () => { ], ); assert.deepEqual( - bridge.tools.filter((tool) => tool.exposure === "hidden").map((tool) => tool.name), - [ - "mcp__t3_code__orchestrator_capabilities", - "mcp__t3_code__delegate_task", - "mcp__t3_code__task_status", - "mcp__t3_code__preview_snapshot", - ], + bridge.tools + .filter((tool) => tool.name.startsWith("mcp__t3_code__")) + .map((tool) => [tool.name, tool.exposure]), + aliases.map((name) => [name, "model-only"]), ); const result = await bridge.tools .find((tool) => tool.name === "mcp__t3-code__preview_snapshot")! @@ -224,9 +242,11 @@ describe("Pi MCP tool exposure", () => { modern: true, toolSearchAvailable: true, allowsTool: (name) => name !== "mcp__t3-code__delegate_task", + activatesOnRegistration: true, }); const event = { systemPrompt: "" }; await bridge.handlers.get("session_start")!(event, discoveryContext); + assert.notInclude(bridge.getActiveTools(), "mcp__t3_code__delegate_task"); const gatewayContext = { model: { api: "openai-completions" }, ui: { notify: assert.fail } }; await bridge.handlers.get("model_select")!(event, gatewayContext); bridge.restoreActiveTools(["read", "mcp__t3-code__task_status"]); @@ -237,6 +257,9 @@ describe("Pi MCP tool exposure", () => { "tool_search", "mcp__t3-code__orchestrator_capabilities", "mcp__t3-code__preview_snapshot", + "mcp__t3_code__orchestrator_capabilities", + "mcp__t3_code__task_status", + "mcp__t3_code__preview_snapshot", ]); await bridge.handlers.get("model_select")!(event, discoveryContext); assert.equal( @@ -246,6 +269,74 @@ describe("Pi MCP tool exposure", () => { assert.include(bridge.getActiveTools(), "mcp__t3-code__preview_snapshot"); }); + it("keeps Pi's canonical MCP tool names callable by the model without declaring them twice", async () => { + const bridge = await loadMcpBridge({ + modern: true, + toolSearchAvailable: true, + activatesOnRegistration: true, + }); + const canonicalNames = [ + "mcp__t3_code__orchestrator_capabilities", + "mcp__t3_code__delegate_task", + "mcp__t3_code__task_status", + "mcp__t3_code__preview_snapshot", + ]; + const unreachableCanonicalNames = async () => { + const unreachable: string[] = []; + for (const name of canonicalNames) { + const result = await bridge.callModelTool(name, {}); + if (result.isError === true) unreachable.push(name); + } + return unreachable; + }; + const declaredCanonicalNames = () => + bridge.declaredTools().filter((name) => name.startsWith("mcp__t3_code__")); + const event = { systemPrompt: "" }; + + await bridge.handlers.get("session_start")!(event, discoveryContext); + assert.deepEqual( + await unreachableCanonicalNames(), + [], + "model calls to these names fail with Tool not found after session start", + ); + assert.deepEqual(declaredCanonicalNames(), [], "declared twice after session start"); + assert.equal(bridge.requests.at(-1)?.method, "tools/call"); + + bridge.restoreActiveTools([ + "read", + "mcp__t3-code__orchestrator_capabilities", + "mcp__t3-code__delegate_task", + "mcp__t3-code__task_status", + ]); + await bridge.handlers.get("session_tree")!(event, discoveryContext); + assert.deepEqual( + await unreachableCanonicalNames(), + [], + "model calls to these names fail with Tool not found after an older tree loadout", + ); + assert.deepEqual(declaredCanonicalNames(), [], "declared twice after an older tree loadout"); + assert.isFalse( + bridge.callableTools().some((name) => name.startsWith("mcp__t3_code__")), + "aliases duplicate the codemode catalog", + ); + + const requestCount = bridge.requests.length; + bridge.restoreActiveTools( + bridge.getActiveTools().filter((name) => name !== "mcp__t3-code__delegate_task"), + ); + const late = await bridge.callModelTool("mcp__t3_code__delegate_task", {}); + assert.isTrue(late.isError, "an alias runs after its public tool was switched off"); + assert.equal(bridge.requests.length, requestCount); + + bridge.restoreActiveTools(["read", "mcp__t3-code__task_status"]); + await bridge.handlers.get("session_tree")!(event, discoveryContext); + assert.deepEqual( + await unreachableCanonicalNames(), + ["mcp__t3_code__orchestrator_capabilities", "mcp__t3_code__delegate_task"], + "an alias stays callable while its direct public tool is off", + ); + }); + it.each(["legacy Pi", "disabled tool search"])( "keeps tool execution available with %s", async (mode) => { @@ -258,11 +349,16 @@ describe("Pi MCP tool exposure", () => { const start = bridge.handlers.get("session_start"); await start!({ systemPrompt: "Pi system prompt" }, discoveryContext); } - assert.equal(bridge.tools.filter((tool) => tool.exposure !== "hidden").length, 4); + const publicTools = bridge.tools.filter((tool) => tool.name.startsWith("mcp__t3-code__")); + assert.equal(publicTools.length, 4); assert.isTrue( + publicTools.every((tool) => tool.exposure === undefined || tool.exposure === "direct"), + ); + assert.deepEqual( bridge.tools - .filter((tool) => tool.exposure !== "hidden") - .every((tool) => tool.exposure === undefined || tool.exposure === "direct"), + .filter((tool) => tool.name.startsWith("mcp__t3_code__")) + .map((tool) => tool.exposure), + mode === "legacy Pi" ? [] : ["model-only", "model-only", "model-only", "model-only"], ); const tool = bridge.tools.find((tool) => tool.name === "mcp__t3-code__preview_snapshot"); assert.isDefined(tool); diff --git a/packages/provider-pi/src/server/mcpExtensionSource.ts b/packages/provider-pi/src/server/mcpExtensionSource.ts index 2e7844a23ac94..e934ce60e6ba6 100644 --- a/packages/provider-pi/src/server/mcpExtensionSource.ts +++ b/packages/provider-pi/src/server/mcpExtensionSource.ts @@ -397,31 +397,52 @@ export default async function t3McpExtension(pi: ExtensionAPI) { // bridge as the credential owner: mcp.json overrides native registrations. const supportsExposure = "registerMcpServer" in pi && typeof pi.registerMcpServer === "function"; const directTools = new Set(["orchestrator_capabilities", "delegate_task", "task_status"]); + const ALIAS_PREFIX = "mcp__t3_code__"; let deferOptionalTools = supportsExposure; + const isDeferred = (name: string) => deferOptionalTools && !directTools.has(name); + // An alias follows its public tool: gone when --exclude-tools removed it, + // off while a direct one is off. + const followsPublicTool = ( + name: string, + registered: ReadonlySet, + active: ReadonlyArray, + ) => + registered.has("mcp__t3-code__" + name) && + (isDeferred(name) || active.includes("mcp__t3-code__" + name)); let catalog: ReadonlyArray = []; const client = createMcpClient(endpoint, token); let started: Promise | undefined; const registerTools = () => { - // Preserve public names for saved loadouts and tool selectors. Hidden - // canonical names reserve ownership against Pi's configured MCP servers. - const prefixes = supportsExposure ? ["mcp__t3-code__", "mcp__t3_code__"] : ["mcp__t3-code__"]; + // Preserve public names for saved loadouts and tool selectors. The alias, + // Pi's own MCP name for T3, reserves it against Pi's configured MCP servers. + // model-only keeps it out of codemode; it hides its own declaration. + const prefixes = supportsExposure ? ["mcp__t3-code__", ALIAS_PREFIX] : ["mcp__t3-code__"]; readOnlyMcpTools.clear(); for (const tool of catalog) { const name = tool.name; for (const prefix of prefixes) { - if (tool.annotations?.readOnlyHint === true) readOnlyMcpTools.add(\`\${prefix}\${name}\`); - const exposure = prefix === "mcp__t3_code__" ? "hidden" : - deferOptionalTools && !directTools.has(name) ? "deferred" : "direct"; + const toolName = \`\${prefix}\${name}\`; + if (tool.annotations?.readOnlyHint === true) readOnlyMcpTools.add(toolName); + const isAlias = prefix === ALIAS_PREFIX; + const exposure = isAlias ? "model-only" : isDeferred(name) ? "deferred" : "direct"; pi.registerTool({ - name: \`\${prefix}\${name}\`, + name: toolName, label: name, description: tool.description ?? name, parameters: jsonSchemaToTypebox(tool.inputSchema), ...(supportsExposure ? { outputSchema: mcpOutputSchema(tool) } : {}), ...(supportsExposure ? { exposure } : {}), + ...(isAlias ? { prepareLoadout: () => ({ hiddenDeclarations: [toolName] }) } : {}), async execute(_toolCallId, params, signal) { + // Another extension may switch the public tool off after reconciliation. + if ( + isAlias && + !followsPublicTool(name, new Set(pi.getAllTools().map((tool) => tool.name)), pi.getActiveTools()) + ) { + return { content: [{ type: "text", text: \`Tool \${toolName} not found\` }], details: {}, isError: true }; + } const result = await client.callTool( name, (params ?? {}) as Record, @@ -470,7 +491,6 @@ export default async function t3McpExtension(pi: ExtensionAPI) { const exposureChanged = deferOptionalTools !== hasToolSearch; deferOptionalTools = hasToolSearch; if (exposureChanged) registerTools(); - const active = pi.getActiveTools(); // Completion gateways can silently drop calls to undeclared tools named // in history or guidance. Eagerly load T3 schemas, including after tree // restores, while retaining deferred exposure for Pi's allowlist rules. @@ -479,8 +499,18 @@ export default async function t3McpExtension(pi: ExtensionAPI) { ...(hasToolSearch ? ["tool_search"] : []), ...(ctx.model?.api === "openai-completions" ? catalog.map((tool) => "mcp__t3-code__" + tool.name) : []), ]; - const missing = required.filter((name) => !active.includes(name)); - if (missing.length > 0) pi.setActiveTools([...active, ...missing]); + const current = pi.getActiveTools(); + const missing = required.filter((name) => !current.includes(name)); + if (missing.length > 0) pi.setActiveTools([...current, ...missing]); + // An alias is callable only while active. + const registered = new Set(pi.getAllTools().map((tool) => tool.name)); + const loaded = pi.getActiveTools(); + const aliases = catalog + .filter((tool) => registered.has(ALIAS_PREFIX + tool.name) && followsPublicTool(tool.name, registered, loaded)) + .map((tool) => ALIAS_PREFIX + tool.name); + const kept = loaded.filter((name) => !name.startsWith(ALIAS_PREFIX) || aliases.includes(name)); + const added = aliases.filter((name) => !loaded.includes(name)); + if (added.length > 0 || kept.length !== loaded.length) pi.setActiveTools([...kept, ...added]); }; // Tree navigation restores its saved loadout after session_start. From f9e45e436317417bea136f3461662a0f51ea10b9 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Thu, 19 Nov 2026 12:44:04 -0800 Subject: [PATCH 128/201] fix(server): agents on hosts without swap are OOM-killed instead of throttled for hours (#39287) --- apps/server/src/process/agentScope.test.ts | 15 ++++++++++--- apps/server/src/process/agentScope.ts | 25 ++++++++++++++-------- 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/apps/server/src/process/agentScope.test.ts b/apps/server/src/process/agentScope.test.ts index 49674354b2532..033d83bc5f5c0 100644 --- a/apps/server/src/process/agentScope.test.ts +++ b/apps/server/src/process/agentScope.test.ts @@ -21,7 +21,7 @@ import * as ProviderProcesses from "./providerProcesses.ts"; import { classifyScope, make, ownedAgentSlice, type ScopeState } from "./agentScope.ts"; const GiB = 1024 ** 3; -const memory = vi.hoisted(() => ({ total: 16 * 1024 ** 3 })); +const memory = vi.hoisted(() => ({ total: 16 * 1024 ** 3, swapKb: 2 * 1024 ** 2 })); vi.mock("node:os", async (importOriginal) => ({ ...(await importOriginal()), totalmem: () => memory.total, @@ -133,7 +133,9 @@ const withFakeSystemd = ( Effect.provideService(FileSystem.FileSystem, { ...fileSystem, readFileString: (path, encoding) => - fileSystem.readFileString(path.replace("/sys/fs/cgroup", cgroupRoot), encoding), + path === "/proc/meminfo" + ? Effect.sync(() => `MemTotal: 16384 kB\nSwapTotal: ${memory.swapKb} kB\n`) + : fileSystem.readFileString(path.replace("/sys/fs/cgroup", cgroupRoot), encoding), writeFileString: (path, data, options) => fileSystem.writeFileString(path.replace("/sys/fs/cgroup", cgroupRoot), data, options), }), @@ -331,8 +333,9 @@ describe("AgentScope service", () => { ), ); - it.effect("follows a live memory change at the next launch", () => { + it.effect("follows a live memory or swap change at the next launch", () => { memory.total = 16 * GiB; + memory.swapKb = 2 * 1024 ** 2; return withFakeSystemd(({ scope, calls, failingVerbs }) => Effect.gen(function* () { const launch = scope.wrap({ command: "agent", args: [], name: "t", threadId: "a" }); @@ -361,6 +364,12 @@ describe("AgentScope service", () => { grown, grown, ]); + + // Without swap, MemoryHigh only throttles; MemoryMax must OOM-kill the runaway. + memory.swapKb = 0; + yield* launch; + expect(memoryLimits().at(-1)).toEqual(["MemoryHigh=infinity", `MemoryMax=${18 * GiB}`]); + memory.swapKb = 2 * 1024 ** 2; }), ); }); diff --git a/apps/server/src/process/agentScope.ts b/apps/server/src/process/agentScope.ts index 1e52e680b6f8d..4bbb7d159cf0b 100644 --- a/apps/server/src/process/agentScope.ts +++ b/apps/server/src/process/agentScope.ts @@ -36,14 +36,13 @@ export function ownedAgentSlice(stateDir: string): string { const GiB = 1024 ** 3; /** - * Agents together leave about 6 GB free before they are throttled and 4 GB - * before the kernel kills one, so the server, sshd, and tailscaled keep - * working. Small machines still give agents at least half of RAM before - * throttling and three quarters before a kill. + * Agents leave about 6 GB free before throttling and 4 GB before an OOM kill (at + * least half and three quarters of RAM go to agents) so the server and sshd keep + * working. Without swap, MemoryHigh stalls every agent and never reaches the kill. */ -function agentSliceMemoryLimits(totalBytes: number) { +function agentSliceMemoryLimits(totalBytes: number, hasSwap: boolean) { return { - high: Math.max(totalBytes - 6 * GiB, Math.floor(totalBytes / 2)), + high: hasSwap ? Math.max(totalBytes - 6 * GiB, Math.floor(totalBytes / 2)) : "infinity", max: Math.max(totalBytes - 4 * GiB, Math.floor(totalBytes * 0.75)), }; } @@ -204,13 +203,20 @@ export const make = Effect.gen(function* () { }); // VMs and containers can resize RAM live, so each launch re-checks the total // the limits came from. A failed update is retried by the next launch. + // An unreadable meminfo keeps the throttle, as before swap was checked. + const readHasSwap = fileSystem.readFileString("/proc/meminfo").pipe( + Effect.map((text) => /^SwapTotal:\s*0 kB$/m.exec(text) === null), + Effect.orElseSucceed(() => true), + ); let appliedTotal: number | undefined; + let appliedHasSwap: boolean | undefined; const memoryLimitsLock = yield* Semaphore.make(1); const applyMemoryLimits = memoryLimitsLock.withPermits(1)( Effect.gen(function* () { const total = NodeOS.totalmem(); - if (total === appliedTotal) return; - const limits = agentSliceMemoryLimits(total); + const hasSwap = yield* readHasSwap; + if (total === appliedTotal && hasSwap === appliedHasSwap) return; + const limits = agentSliceMemoryLimits(total, hasSwap); const applied = yield* setProperties(AGENT_SLICE, [ `MemoryHigh=${limits.high}`, `MemoryMax=${limits.max}`, @@ -225,13 +231,14 @@ export const make = Effect.gen(function* () { }); } appliedTotal = total; + appliedHasSwap = hasSwap; }), ); yield* applyMemoryLimits; yield* setProperties(AGENTS_PARENT_SLICE, AGENTS_PARENT_PROPERTIES); yield* Effect.logInfo("Agent scopes are on", { slice: AGENT_SLICE, - ...agentSliceMemoryLimits(NodeOS.totalmem()), + ...agentSliceMemoryLimits(NodeOS.totalmem(), yield* readHasSwap), oomPolicy: supportsOomPolicy, }); return { From c4419dadd91249d9eeff4a26c1098517e71736f0 Mon Sep 17 00:00:00 2001 From: Bilal Bakr <62337003+Bil0000@users.noreply.github.com> Date: Thu, 19 Nov 2026 23:47:58 +0300 Subject: [PATCH 129/201] fix(server): threads stay in Working when Claude or OpenCode marks a background wait between turns (#38638) Co-authored-by: Claude Opus 5.5 Co-authored-by: Julius Marminge --- apps/server/src/mcp/toolkits/core.test.ts | 40 +++++ .../src/mcp/toolkits/orchestrator/handlers.ts | 3 +- .../Adapters/OpenCode2AdapterV2.test.ts | 145 ++++++++++++++++++ .../src/server/v2/adapter.ts | 101 ++++++++++-- 4 files changed, 276 insertions(+), 13 deletions(-) diff --git a/apps/server/src/mcp/toolkits/core.test.ts b/apps/server/src/mcp/toolkits/core.test.ts index daadff0e09d54..bdd48dda82817 100644 --- a/apps/server/src/mcp/toolkits/core.test.ts +++ b/apps/server/src/mcp/toolkits/core.test.ts @@ -1291,6 +1291,46 @@ it.effect.each(["t3_thread_interrupt", "t3_workflow_stop"])( ), ); +it.effect( + "t3_background_wait marks work from a turn Claude started before T3 started its run", + () => + Effect.gen(function* () { + const server = yield* McpServer.McpServer; + const result = yield* server + .callTool({ name: "t3_background_wait", arguments: { taskIds: ["checks"] } }) + .pipe( + Effect.provideService(McpInvocationContext.McpInvocationContext, scope), + Effect.provideService(McpSchema.McpServerClient, client), + ); + expect(result.structuredContent).toEqual({ matched: ["checks"], unmatched: [] }); + }).pipe( + Effect.provide( + layerOrchestratorToolkit.pipe( + Layer.provideMerge(McpHttpServer.layerInProcessMcpServer), + Layer.provide(NodeCrypto.layer), + Layer.provide( + Layer.mock(ThreadManagement.ThreadManagementService)({ + getThreadShell: (id) => + Effect.succeed(McpToolAccessTestkit.liveThreadShell(id, { activeRunId: null })), + awaitBackgroundTasks: ({ taskIds }) => + Effect.succeed({ matched: taskIds, unmatched: [] }), + }), + ), + Layer.provide(ServerSettings.layerTest()), + Layer.provide(Layer.mock(ProviderRegistry.ProviderRegistry)({})), + Layer.provide(Layer.mock(ProviderAdapterRegistry.ProviderAdapterRegistryV2)({})), + Layer.provide(Layer.mock(ScheduledTaskService.ScheduledTaskService)({})), + Layer.provide(Layer.mock(ProjectService.ProjectService)({})), + Layer.provide(Layer.mock(SecretRequests.SecretRequests)({})), + Layer.provide(Layer.mock(RemoteDelegation.RemoteDelegation)({})), + Layer.provide(Layer.mock(PeerForwarding.PeerForwarding)({})), + Layer.provide(Layer.mock(PeerLinkRequests.PeerLinkRequests)({})), + Layer.provide(Layer.mock(PeerLinks.PeerLinks)({})), + ), + ), + ), +); + it.effect("discovers workflow stop targets and requires orchestration capability", () => { const threadId = ThreadId.make("workflow-parent"); const shell = McpToolAccessTestkit.liveThreadShell(threadId); diff --git a/apps/server/src/mcp/toolkits/orchestrator/handlers.ts b/apps/server/src/mcp/toolkits/orchestrator/handlers.ts index dfa1ad58545ee..d90a118be468e 100644 --- a/apps/server/src/mcp/toolkits/orchestrator/handlers.ts +++ b/apps/server/src/mcp/toolkits/orchestrator/handlers.ts @@ -61,7 +61,8 @@ const handlers = { ); }), ), - t3_background_wait: McpToolAccess.actsAsCaller((input) => + // Claude can start a turn by itself before T3 starts its run, so a live-run check would refuse the mark. + t3_background_wait: McpToolAccess.readsAsCaller((input) => Effect.gen(function* () { const { scope, threads } = yield* readCaller(); const caller = yield* McpInvocationContext.requireThreadScope(scope, "t3_background_wait"); diff --git a/apps/server/src/orchestration-v2/Adapters/OpenCode2AdapterV2.test.ts b/apps/server/src/orchestration-v2/Adapters/OpenCode2AdapterV2.test.ts index 3b82ff9a69754..5dbaf3628b11d 100644 --- a/apps/server/src/orchestration-v2/Adapters/OpenCode2AdapterV2.test.ts +++ b/apps/server/src/orchestration-v2/Adapters/OpenCode2AdapterV2.test.ts @@ -2342,6 +2342,151 @@ it.layer(McpProviderSessions.layer)("OpenCode2 adapter", (it) => { }), ); + it.effect.each(["running", "exited", "timeout", "held", "sync"] as const)( + "marks a shell OpenCode started on its own before T3 runs the wake, shell %s", + (shell) => + Effect.gen(function* () { + const shellID = "sh_wake"; + const tool = { sessionID: SESSION, assistantMessageID: "msg_wake", id: "call-wake-shell" }; + const offers: Array = []; + const shellReport = (state: string, extra: Record = {}) => + event("session.inbox.enqueued", { + inboxID: "msg_shell_report", + sessionID: SESSION, + item: { + type: "synthetic", + payload: { + text: `done`, + description: "vp test", + metadata: { source: "shell", shellID, state, ...extra }, + }, + delivery: "steer", + }, + }); + const { runtime, thread } = yield* resumed([ + ...backgroundLaunch(CHILD), + event("session.execution.succeeded", { sessionID: SESSION }), + event("session.execution.succeeded", { sessionID: CHILD }), + childReport("msg_report", "CHILD_OK"), + event("session.execution.started", { sessionID: SESSION }), + event("session.tool.input.started", { ...tool, name: "shell" }), + event("session.tool.called", { + ...tool, + name: "shell", + input: { command: "vp test", background: true }, + executed: false, + }), + event( + "session.tool.success", + { + ...tool, + content: [{ type: "text", text: "Launched" }], + // A foreground shell's result already carries its exit. + metadata: shell === "sync" ? { shellID, exit: 0 } : { shellID }, + executed: false, + }, + undefined, + 2, + ), + event("shell.created", { + info: { + id: shellID, + status: "running", + command: "vp test", + cwd: WORK, + shell: "bash", + file: "/tmp/sh_wake.log", + metadata: { sessionID: SESSION }, + time: { started: 1 }, + }, + }), + ...(shell === "held" ? [shellReport("completed")] : []), + event("session.execution.succeeded", { sessionID: SESSION }), + ...(shell === "exited" + ? [ + event("shell.exited", { id: shellID, exit: 7, status: "exited" }), + shellReport("error"), + ] + : []), + ...(shell === "timeout" + ? [ + event("shell.exited", { id: shellID, status: "timeout" }), + shellReport("completed", { timeout: true }), + ] + : []), + // Routed once the held execution ended, so its update proves the launch reached the adapter. + event("session.model.selected", { + sessionID: SESSION, + model: { providerID: "opencode", id: "big-pickle", variant: "thinking" }, + }), + ...Array.from({ length: shell === "held" ? 2 : shell === "sync" ? 0 : 1 }, () => [ + out("shell.output", ""), + reply("shell.output", { + location: { directory: WORK }, + data: { output: "", cursor: 0, size: 0, truncated: false }, + }), + ]).flat(), + ]).pipe( + Effect.provideService(ProviderContinuationRequests.ProviderContinuationRequests, { + offer: (request) => + Effect.sync(() => { + offers.push(request); + }), + take: Effect.never, + }), + ); + // One reader: the runtime's event queue hands each event to only one taker. + const launchSeen = yield* Deferred.make(); + const marked = yield* Deferred.make(); + const settled = + yield* Deferred.make(); + yield* runtime.events.pipe( + Stream.tap((e) => + e.type === "turn_item.updated" && + e.turnItem.type === "command_execution" && + e.turnItem.status !== "running" + ? Deferred.succeed(settled, e.turnItem) + : e.type !== "provider_thread.updated" + ? Effect.void + : Effect.gen(function* () { + const variant = + e.providerThread.nativeMetadata?.modelSelection?.options?.[0]?.value; + if (variant === "thinking") yield* Deferred.succeed(launchSeen, undefined); + const listed = e.providerThread.pendingBackgroundTasks?.find( + (task) => task.taskId === shellID, + ); + // The first roster that lists the shell must hold the thread already. + if (listed !== undefined) yield* Deferred.succeed(marked, listed.awaited); + }), + ), + Stream.runDrain, + Effect.forkScoped, + ); + yield* runtime.startTurn(withLineage(thread)); + yield* Deferred.await(launchSeen); + assert.deepEqual( + yield* runtime.awaitBackgroundTasks!({ + providerThread: thread, + taskIds: [shellID], + awaited: true, + }), + { matched: shell === "running" ? [shellID] : [] }, + ); + if (shell === "sync") return; + yield* runtime.startTurn(continuationTurn(thread, offers[0]!)); + if (shell === "running") return assert.isTrue(yield* Deferred.await(marked)); + // A shell that ended before the wake ran never holds the thread. + assert.deepInclude( + yield* Deferred.await(settled), + shell === "exited" + ? { status: "failed", exitCode: 7 } + : { status: shell === "timeout" ? "failed" : "completed" }, + ); + const listed = yield* Deferred.poll(marked); + if (Option.isSome(listed)) assert.notStrictEqual(yield* listed.value, true); + }), + ); + it.effect("clears the caller's pending work when a called session's held wake runs", () => Effect.gen(function* () { const OTHER = "ses_other00000000000000000000"; diff --git a/packages/provider-opencode/src/server/v2/adapter.ts b/packages/provider-opencode/src/server/v2/adapter.ts index 862144b12fa4f..9815a3caa96bf 100644 --- a/packages/provider-opencode/src/server/v2/adapter.ts +++ b/packages/provider-opencode/src/server/v2/adapter.ts @@ -313,6 +313,12 @@ interface Wake { readonly after: string | undefined; readonly first: string | undefined; readonly children: Set; + readonly awaited: Set; + /** Held shell launches whose end report arrived first; the report already cleared their status. */ + readonly ended: Map< + string, + { readonly status: "completed" | "failed" | "interrupted"; readonly exit?: number } + >; } interface OpenBlock { @@ -1011,6 +1017,38 @@ export const make = Effect.fn("OpenCode2Adapter.make")(function* (instanceId: Pr } >(); + // A held wake routes its shell launches only when T3 starts its run, so marks wait on the wake. + const heldLaunch = (state: ThreadState, taskId: string) => + sessionsOf(state) + .flatMap((session) => session.wakes) + .find((wake) => + wake.events.some( + (event) => + event.type === "session.tool.success" && + stringField(event.data.metadata, "shellID") === taskId && + event.data.metadata?.["exit"] === undefined && + event.data.metadata?.["signal"] === undefined && + event.data.metadata?.["timeout"] !== true, + ), + ); + const wakeLaunchingShell = (state: ThreadState, taskId: string) => { + const wake = heldLaunch(state, taskId); + return wake === undefined || + wake.ended.has(taskId) || + (shellInfo.get(taskId)?.status ?? "running") !== "running" || + // An end report held with the launch replays after it. + wake.events.some( + (event) => + event.type === "session.inbox.enqueued" && + event.data.item.type === "synthetic" && + stringField(event.data.item.payload.metadata, "source") === "shell" && + stringField(event.data.item.payload.metadata, "shellID") === taskId, + ) + ? undefined + : wake; + }; + let replaying: Wake | undefined; + const owesWork = (state: ThreadState) => [...shells.values()].some((shell) => shell.state === state && shell.running) || [...state.imageJobs.values()].some((job) => job.status === "running") || @@ -1966,7 +2004,7 @@ export const make = Effect.fn("OpenCode2Adapter.make")(function* (instanceId: Pr awaited: state.providerThread.pendingBackgroundTasks?.some( (task) => task.taskId === info.id && task.awaited === true, - ) === true, + ) === true || wakeLaunchingShell(state, info.id)?.awaited.has(info.id) === true, running: true, output: "", cursor: 0, @@ -2863,25 +2901,30 @@ export const make = Effect.fn("OpenCode2Adapter.make")(function* (instanceId: Pr toolId: event.data.id, tool, command: stringField(tool.input, "command") ?? "Shell command", + ...(replaying?.awaited.has(shellId) === true ? { awaited: true } : {}), running: true, output: "", cursor: 0, }); - yield* readShellOutput(shellId).pipe(Effect.ignore({ log: true })); const known = shellInfo.get(shellId); + const ended = replaying?.ended.get(shellId); const tracked = shells.get(shellId)!; - tracked.running = known === undefined || known.status === "running"; + tracked.running = + ended === undefined && (known === undefined || known.status === "running"); + yield* readShellOutput(shellId, !tracked.running).pipe(Effect.ignore({ log: true })); yield* emitShell( shellId, tracked.running ? "running" - : known?.status === "killed" - ? "interrupted" - : known?.exit === 0 - ? "completed" - : "failed", - known?.exit, + : (ended?.status ?? + (known?.status === "killed" + ? "interrupted" + : known?.exit === 0 + ? "completed" + : "failed")), + ended?.exit ?? known?.exit, ); + if (ended !== undefined) shells.delete(shellId); yield* syncRosterAncestors(state); return; } @@ -3009,6 +3052,8 @@ export const make = Effect.fn("OpenCode2Adapter.make")(function* (instanceId: Pr after: delivered.at(-1)?.inboxId, first: leading ?? delivered[0]?.inboxId, children: new Set(), + awaited: new Set(), + ended: new Map(), }; state.wakes.push(wake); yield* Effect.logInfo("OpenCode started a turn on its own; asking for a continuation.", { @@ -3119,6 +3164,27 @@ export const make = Effect.fn("OpenCode2Adapter.make")(function* (instanceId: Pr outcome: reportOutcome(stringField(payload.metadata, "state")), }, }); + if (id !== undefined && shell === undefined) { + const outcome = reportOutcome(stringField(payload.metadata, "state")); + const known = shellInfo.get(id); + const exit = known?.exit; + // A known exit outranks the report, which says "completed" for a timeout. + heldLaunch(state, id)?.ended.set(id, { + status: + known !== undefined && known.status !== "running" + ? known.status === "killed" + ? "interrupted" + : exit === 0 + ? "completed" + : "failed" + : outcome === "failed" + ? "failed" + : outcome === "cancelled" + ? "interrupted" + : "completed", + ...(exit === undefined ? {} : { exit }), + }); + } if (id !== undefined && shell?.stopping !== true) { if (shell?.running === true && shell.state === state) { yield* readShellOutput(id, true).pipe(Effect.ignore({ log: true })); @@ -4424,7 +4490,10 @@ export const make = Effect.fn("OpenCode2Adapter.make")(function* (instanceId: Pr const replay = Effect.fnUntraced(function* (wake: Wake) { wake.dropped = true; - for (const event of wake.events) yield* route(event, sessionOfEvent(event), true); + replaying = wake; + yield* Effect.forEach(wake.events, (event) => route(event, sessionOfEvent(event), true), { + discard: true, + }).pipe(Effect.ensuring(Effect.sync(() => (replaying = undefined)))); }); const discardWakes = (caller: ThreadState, wakes: ReadonlyArray) => { @@ -5153,11 +5222,19 @@ export const make = Effect.fn("OpenCode2Adapter.make")(function* (instanceId: Pr const sessions = sessionsOf(state); const matched = [...new Set(taskIds)].filter((taskId) => { const shell = shells.get(taskId); - return shell !== undefined && shell.running && sessions.includes(shell.state); + return shell === undefined + ? wakeLaunchingShell(state, taskId) !== undefined + : shell.running && sessions.includes(shell.state); }); if (matched.length === 0) return { matched }; for (const taskId of matched) { - const shell = shells.get(taskId)!; + const shell = shells.get(taskId); + if (shell === undefined) { + const held = wakeLaunchingShell(state, taskId)!.awaited; + if (awaited) held.add(taskId); + else held.delete(taskId); + continue; + } shell.awaited = awaited; yield* syncRosterAncestors(shell.state); } From b111b6310ab55011e3500172377a770123c7b655 Mon Sep 17 00:00:00 2001 From: Bilal Bakr <62337003+Bil0000@users.noreply.github.com> Date: Thu, 19 Nov 2026 23:51:43 +0300 Subject: [PATCH 130/201] fix(web): collapse extra linked issues in thread details (#39232) --- .../components/chat/ThreadDetailsControl.tsx | 34 ++++++++++++++- .../chat/ThreadDetailsIssueRows.tsx | 41 ++++++++++++------ .../chat/ThreadDetailsPrRow.browser.test.tsx | 42 ++++++++++++------- .../components/chat/ThreadDetailsPrRows.tsx | 32 ++++---------- 4 files changed, 96 insertions(+), 53 deletions(-) diff --git a/apps/web/src/components/chat/ThreadDetailsControl.tsx b/apps/web/src/components/chat/ThreadDetailsControl.tsx index b2f1ce0cfe12e..576ac3ff719a6 100644 --- a/apps/web/src/components/chat/ThreadDetailsControl.tsx +++ b/apps/web/src/components/chat/ThreadDetailsControl.tsx @@ -1,5 +1,6 @@ import { mergeProps } from "@base-ui/react/merge-props"; import { useRender } from "@base-ui/react/use-render"; +import { T, Var } from "gt-react"; import type { ComponentProps } from "react"; import { cn } from "~/lib/utils"; @@ -15,7 +16,7 @@ import { THREAD_DETAILS_PANEL_SELECT_LABEL_CLASS, THREAD_DETAILS_PANEL_SELECT_ICON_CLASS, } from "./threadDetailsPanelStyles"; -import { ChevronDownIcon } from "lucide-react"; +import { ChevronDownIcon, ChevronUpIcon } from "lucide-react"; const parts = { row: THREAD_DETAILS_PANEL_ROW_CLASS, @@ -107,3 +108,34 @@ export function ThreadDetailsControl({ } return control; } + +export function ThreadDetailsMoreButton({ + expanded, + remaining, + onToggle, +}: { + expanded: boolean; + remaining: number; + onToggle: () => void; +}) { + const Icon = expanded ? ChevronUpIcon : ChevronDownIcon; + return ( + + + {expanded ? ( + Show less + ) : ( + + Show {remaining} more + + )} + + ); +} diff --git a/apps/web/src/components/chat/ThreadDetailsIssueRows.tsx b/apps/web/src/components/chat/ThreadDetailsIssueRows.tsx index da3eb6e22994b..5726d1edeca14 100644 --- a/apps/web/src/components/chat/ThreadDetailsIssueRows.tsx +++ b/apps/web/src/components/chat/ThreadDetailsIssueRows.tsx @@ -1,7 +1,8 @@ import { threadIssueKeyOf, type ScopedThreadRef, type ThreadIssueLink } from "@t3tools/contracts"; +import { scopedThreadKey } from "@t3tools/client-runtime/environment"; import { useGT } from "gt-react"; import { MessageSquareIcon } from "lucide-react"; -import type { MouseEvent } from "react"; +import { useState, type MouseEvent } from "react"; import { cn } from "~/lib/utils"; import { useRightPanelStore } from "~/rightPanelStore"; @@ -19,7 +20,7 @@ import { PullRequestRowLines, } from "../pullRequest/PullRequestListRow"; import { PullRequestActorLabel } from "../pullRequest/pullRequestPresentation"; -import { ThreadDetailsControl } from "./ThreadDetailsControl"; +import { ThreadDetailsControl, ThreadDetailsMoreButton } from "./ThreadDetailsControl"; import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip"; function LinkedIssueRow({ @@ -156,14 +157,30 @@ export function ThreadDetailsIssueRows({ mountScope?: "thread-details" | "linked-items" | "sidebar-tooltip"; onOpen?: () => void; }) { - return links.map((link) => ( - - )); + const [expandedThread, setExpandedThread] = useState(null); + const threadKey = scopedThreadKey(threadRef); + const expanded = expandedThread === threadKey; + const hasMore = compact && links.length > 1; + const visibleLinks = hasMore && !expanded ? links.slice(0, 1) : links; + return ( + <> + {visibleLinks.map((link) => ( + + ))} + {hasMore ? ( + setExpandedThread(expanded ? null : threadKey)} + /> + ) : null} + + ); } diff --git a/apps/web/src/components/chat/ThreadDetailsPrRow.browser.test.tsx b/apps/web/src/components/chat/ThreadDetailsPrRow.browser.test.tsx index fd3d0cc702d4c..b17067affb96f 100644 --- a/apps/web/src/components/chat/ThreadDetailsPrRow.browser.test.tsx +++ b/apps/web/src/components/chat/ThreadDetailsPrRow.browser.test.tsx @@ -8,6 +8,7 @@ import { ThreadId, type PullRequestCheck, type ScopedThreadRef, + type ThreadIssueLink, } from "@t3tools/contracts"; import { DraftId } from "~/composerDraftStore"; import { AsyncResult } from "effect/reactivity"; @@ -387,29 +388,34 @@ it("names a linked pull request row by its kind, number and title, not its URL", expect(exposedNumbers).toHaveLength(0); }); -it("names a linked issue row by its kind, number and title, not its URL", async () => { +it("names the first linked issue and reveals more issues on demand", async () => { await using screen = await setup(); + const issue: ThreadIssueLink = { + tracker: IssueTrackerKind.make("github"), + host: "github.com", + scope: "owner/repo", + key: "123", + projectId: ProjectId.make("repository"), + url: "https://github.com/owner/repo/issues/123", + source: "manual", + linkedAt: "2026-10-30T00:00:00.000Z", + displayKey: "#123", + title: "Sidebar flickers on resize", + }; await act(async () => { await screen.rerender( , ); }); @@ -433,6 +439,12 @@ it("names a linked issue row by its kind, number and title, not its URL", async row.dispatchEvent(externalClick); }); expect(externalClick.defaultPrevented).toBe(false); + const extra = screen.getByRole("link", { name: "Issue #124: Tab list jumps" }); + await expect.element(extra).not.toBeInTheDocument(); + await screen.getByRole("button", { name: "Show 1 more" }).click(); + await expect.element(extra).toBeVisible(); + await screen.getByRole("button", { name: "Show less" }).click(); + await expect.element(extra).not.toBeInTheDocument(); }); it("keeps Ready pending when refreshed detail becomes mergeable before the action settles", async () => { diff --git a/apps/web/src/components/chat/ThreadDetailsPrRows.tsx b/apps/web/src/components/chat/ThreadDetailsPrRows.tsx index 51b167a427b52..6a3132df72603 100644 --- a/apps/web/src/components/chat/ThreadDetailsPrRows.tsx +++ b/apps/web/src/components/chat/ThreadDetailsPrRows.tsx @@ -1,5 +1,5 @@ import { pipe } from "effect/Function"; -import { ThreadDetailsControl } from "./ThreadDetailsControl"; +import { ThreadDetailsMoreButton } from "./ThreadDetailsControl"; import type { EnvironmentId, ScopedThreadRef, @@ -13,8 +13,7 @@ import { threadPullRequestKeyOf, visibleThreadPullRequests, } from "@t3tools/client-runtime/thread-pull-requests"; -import { T, useMessages, Var } from "gt-react"; -import { ChevronDownIcon, ChevronUpIcon } from "lucide-react"; +import { useMessages } from "gt-react"; import { useState, type ComponentProps, type MouseEvent as ReactMouseEvent } from "react"; import { sourceControlClients } from "@t3tools/client-runtime/source-control-clients"; @@ -136,28 +135,11 @@ function ThreadDetailsPrRows({ ))} ) : null} - setExpanded(!expanded)} - part="row" - tone="muted" - className="w-full active:scale-100" - > - {/* Chevrons, not plus and minus: the plus already means "add" in this card. */} - {expanded ? ( - - ) : ( - - )} - {expanded ? ( - Show less - ) : ( - - Show {rest.length} more - - )} - + setExpanded(!expanded)} + /> ); } From cae24a6f0ef6c65be44a457940494e0d4f0c3b97 Mon Sep 17 00:00:00 2001 From: Theo Browne Date: Thu, 19 Nov 2026 12:54:13 -0800 Subject: [PATCH 131/201] fix(release): update feed check waits for a just-published nightly (#39192) Co-authored-by: Claude Opus 5.5 --- .github/scripts/check-nightly-release.cjs | 34 +++++++++++++------ .../scripts/check-nightly-release.test.cjs | 16 ++++++++- docs/operations/release.md | 5 +-- 3 files changed, 42 insertions(+), 13 deletions(-) diff --git a/.github/scripts/check-nightly-release.cjs b/.github/scripts/check-nightly-release.cjs index a9502b26c8c81..4d2d039696322 100644 --- a/.github/scripts/check-nightly-release.cjs +++ b/.github/scripts/check-nightly-release.cjs @@ -124,7 +124,12 @@ async function resolveLatestNightlyCommit({ github, context, core }) { // The two places a nightly install looks for an update: the `update-feed` pointer, and // releases.atom, which holds the 10 newest git tags of any kind. Older installs take the first // nightly in the feed. Reports what each names beside the newest published nightly. -async function readNightlyUpdateFeed({ github, context, fetch = globalThis.fetch }) { +async function readNightlyUpdateFeed({ + github, + context, + fetch = globalThis.fetch, + sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)), +}) { const latest = await findLatestNightly({ github, context }); if (!latest) return {}; @@ -150,19 +155,28 @@ async function readNightlyUpdateFeed({ github, context, fetch = globalThis.fetch // An unreadable feed leaves `feedTags` unset, so the pointer is still repaired. An error page // can answer HTTP 200, so only an Atom document counts as read. - let feedTags; - try { - const feed = await fetch(`${base}/releases.atom`, { signal: signal() }); - const body = feed.ok ? await feed.text() : ""; - if (/]/.test(body)) { - feedTags = Array.from(body.matchAll(/href="[^"]*\/releases\/tag\/([^"]+)"/g), (match) => + const readFeed = async () => { + try { + const feed = await fetch(`${base}/releases.atom`, { signal: signal() }); + const body = feed.ok ? await feed.text() : ""; + if (!/]/.test(body)) return {}; + const feedTags = Array.from(body.matchAll(/href="[^"]*\/releases\/tag\/([^"]+)"/g), (match) => decodeURIComponent(match[1]), ); + const feedNightly = feedTags.find((tag) => /^v?\d+\.\d+\.\d+-nightly\./.test(tag)); + return { feedTags, feedNightly }; + } catch { + return {}; } - } catch {} - const feedNightly = feedTags?.find((tag) => /^v?\d+\.\d+\.\d+-nightly\./.test(tag)); + }; + // The feed can lag a release published seconds ago, so read it again before calling it hidden. + let feed = await readFeed(); + for (let retry = 0; retry < 3 && feed.feedTags && feed.feedNightly !== latest.tagName; retry++) { + await sleep(30_000); + feed = await readFeed(); + } - return { tag: latest.tagName, pointerTag, feedNightly, feedTags }; + return { tag: latest.tagName, pointerTag, ...feed }; } module.exports = { diff --git a/.github/scripts/check-nightly-release.test.cjs b/.github/scripts/check-nightly-release.test.cjs index 2f3d385755ca6..82decf82747da 100644 --- a/.github/scripts/check-nightly-release.test.cjs +++ b/.github/scripts/check-nightly-release.test.cjs @@ -247,19 +247,33 @@ const atomFeed = (tags) => new Response(`${tags.map(atomEntry).join("")} url === "https://github.com/example/app/releases.atom" - ? feed + ? (feeds.length > 1 ? feeds.shift() : feeds[0]).clone() : url === "https://github.com/example/app/releases/download/update-feed/nightly.json" ? pointer : assert.fail(`unexpected fetch ${url}`); + options.sleeps = []; + options.sleep = async (ms) => void options.sleeps.push(ms); return options; } +test("update feed check waits for a nightly published moments ago to reach the feed", async () => { + const options = updateFeedFixture({ + feed: [atomFeed([OLDER]), atomFeed([NEWEST, OLDER])], + pointer: Response.json({ tag_name: NEWEST }), + }); + const { feedNightly } = await readNightlyUpdateFeed(options); + assert.equal(feedNightly, NEWEST); + assert.deepEqual(options.sleeps, [30_000]); +}); + const missing = () => new Response("Not Found", { status: 404 }); // HTTP 200, then the connection drops before the body arrives. const brokenBody = () => diff --git a/docs/operations/release.md b/docs/operations/release.md index 4e98e516e46be..831c70cf27763 100644 --- a/docs/operations/release.md +++ b/docs/operations/release.md @@ -484,8 +484,9 @@ A nightly install finds the newest nightly in up to three places. The release workflow's `Check the update feed` job runs on every scheduled tick, unless `PAUSE_NIGHTLY` is set, and after every nightly. It waits in the same queue as nightlies and previews. It rewrites a missing or outdated pointer. Its last step fails when the first nightly -in the feed is not the newest one. A feed it could not read is only a warning: that says nothing -about the tags, and the next tick reads it again. +in the feed is not the newest one. The feed can lag a release published seconds earlier, so the +job first reads it up to three more times, 30 seconds apart. A feed it could not read is only a +warning: that says nothing about the tags, and the next tick reads it again. When that step fails, installs that read only the feed cannot reach the newest nightly. If the feed still names an older nightly first, installs from `4603` up to the first build with the From cdeacd547afac554a12bbdc7eb122a7bcec4c395 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Thu, 19 Nov 2026 13:20:20 -0800 Subject: [PATCH 132/201] perf(server): turn start reads a long thread's restart-note history once (#39241) --- .../ProviderTurnStartService.ts | 56 ++++---- .../RestartBackgroundNote.test.ts | 12 +- .../orchestration-v2/RestartBackgroundNote.ts | 135 ++++++++++++------ 3 files changed, 126 insertions(+), 77 deletions(-) diff --git a/apps/server/src/orchestration-v2/ProviderTurnStartService.ts b/apps/server/src/orchestration-v2/ProviderTurnStartService.ts index fded9011c9137..8add83f213c8e 100644 --- a/apps/server/src/orchestration-v2/ProviderTurnStartService.ts +++ b/apps/server/src/orchestration-v2/ProviderTurnStartService.ts @@ -1005,15 +1005,16 @@ export const layer: Layer.Layer< const restartCancelledWork = pendingRestartCancelledBackgroundWork({ runs: projection.runs, providerTurns: projection.providerTurns, - compactionMessageIds: new Set( - projection.messages - .filter( - (candidate) => - isCompactionCommandMessage(candidate) || - (goalDriver && parseGoalCommand(candidate) !== null), - ) - .map((candidate) => candidate.id), - ), + compactionMessageIds: () => + new Set( + projection.messages + .filter( + (candidate) => + isCompactionCommandMessage(candidate) || + (goalDriver && parseGoalCommand(candidate) !== null), + ) + .map((candidate) => candidate.id), + ), run, attempts: projection.attempts, }); @@ -1213,27 +1214,26 @@ export const layer: Layer.Layer< // History delivery (inline or injected) is text only, so missed images ride on prompts // until a later run's is accepted. Compaction and /goal starts carry none. A missed run's // own accepted attempt predates its unsent steering input, so it does not count. - const lastPromptOrdinal = Math.max( - 0, - ...acceptedAttempts.flatMap((attempt) => { - if (missedRunIds.has(attempt.runId)) return []; - const source = projection.runs.find((candidate) => candidate.id === attempt.runId); - const message = projection.messages.find( - (candidate) => candidate.id === source?.userMessageId, - ); - return source === undefined || - (message !== undefined && - (isCompactionCommandMessage(message) || - (goalDriver && parseGoalCommand(message) !== null))) - ? [] - : [source.ordinal]; - }), - ); + const runsById = new Map(projection.runs.map((source) => [source.id, source])); + const messagesById = new Map(projection.messages.map((message) => [message.id, message])); + let lastPromptOrdinal = 0; + for (const attempt of acceptedAttempts) { + if (missedRunIds.has(attempt.runId)) continue; + const source = runsById.get(attempt.runId); + if (source === undefined) continue; + const message = messagesById.get(source.userMessageId); + if ( + message !== undefined && + (isCompactionCommandMessage(message) || + (goalDriver && parseGoalCommand(message) !== null)) + ) + continue; + lastPromptOrdinal = Math.max(lastPromptOrdinal, source.ordinal); + } const attachments = missedHistory.flatMap((item) => item.type === "user_message" && - missedRuns.some( - (source) => source.id === item.runId && source.ordinal > lastPromptOrdinal, - ) + item.runId !== null && + (runsById.get(item.runId)?.ordinal ?? 0) > lastPromptOrdinal ? item.attachments : [], ); diff --git a/apps/server/src/orchestration-v2/RestartBackgroundNote.test.ts b/apps/server/src/orchestration-v2/RestartBackgroundNote.test.ts index 25e844f9c1dba..b5b3a033789dd 100644 --- a/apps/server/src/orchestration-v2/RestartBackgroundNote.test.ts +++ b/apps/server/src/orchestration-v2/RestartBackgroundNote.test.ts @@ -52,7 +52,7 @@ it("keeps the note for the provider thread that lost the work across a provider pendingRestartCancelledBackgroundWork({ runs, providerTurns: runs.filter((source) => source.id !== target.id).map(turnFor), - compactionMessageIds: new Set(), + compactionMessageIds: () => new Set(), run: target, attempts: [{ id: target.activeAttemptId!, runId: target.id }], }); @@ -77,7 +77,7 @@ it("delivers a resumed queued run's note even after a higher-ordinal run", () => pendingRestartCancelledBackgroundWork({ runs, providerTurns: [resumed, ranFirst].map(turnFor), - compactionMessageIds: new Set(), + compactionMessageIds: () => new Set(), run: next, attempts: [{ id: next.activeAttemptId!, runId: next.id }], }), @@ -198,7 +198,7 @@ it("does not repeat the note when a steer restarts the run on a new attempt", () ] : []), ], - compactionMessageIds: new Set(), + compactionMessageIds: () => new Set(), run: steered, attempts: runAttemptIds.map((id) => ({ id, runId: steered.id })), }); @@ -225,7 +225,7 @@ it("counts a prompted mid-turn or chained continuation as delivering the note", pendingRestartCancelledBackgroundWork({ runs: [cut, continuation, later], providerTurns: [cutTurn, ...(delivered ? [turnFor(continuation)] : [])], - compactionMessageIds: new Set(), + compactionMessageIds: () => new Set(), run: later, attempts: [{ id: later.activeAttemptId!, runId: later.id }], }); @@ -249,7 +249,7 @@ it("counts a prompted mid-turn or chained continuation as delivering the note", pendingRestartCancelledBackgroundWork({ runs: [cut, unstarted, later], providerTurns: turns, - compactionMessageIds: new Set(), + compactionMessageIds: () => new Set(), run: later, attempts: [{ id: later.activeAttemptId!, runId: later.id }], }), @@ -270,7 +270,7 @@ it("counts a prompted mid-turn or chained continuation as delivering the note", pendingRestartCancelledBackgroundWork({ runs: [cut, steered, later], providerTurns: turns, - compactionMessageIds: new Set(), + compactionMessageIds: () => new Set(), run: later, attempts, }), diff --git a/apps/server/src/orchestration-v2/RestartBackgroundNote.ts b/apps/server/src/orchestration-v2/RestartBackgroundNote.ts index efee98938d413..ae7dba05c106a 100644 --- a/apps/server/src/orchestration-v2/RestartBackgroundNote.ts +++ b/apps/server/src/orchestration-v2/RestartBackgroundNote.ts @@ -151,6 +151,15 @@ type ProviderTurnState = Pick< export function isRestartNoteSource( source: Pick, providerTurns: ReadonlyArray>, +): boolean { + return isNoteSource(source, (attemptId) => + providerTurns.some((turn) => turn.runAttemptId === attemptId && turn.status === "cancelled"), + ); +} + +function isNoteSource( + source: Pick, + attemptCancelled: (attemptId: OrchestrationV2Run["activeAttemptId"]) => boolean, ): boolean { return ( // Failed and interrupted turns never continue; recovery-cancelled waiting runs still qualify. @@ -158,9 +167,7 @@ export function isRestartNoteSource( source.status === "waiting" || source.status === "cancelled") && (source.restartCancelledBackgroundWork?.length ?? 0) > 0 && - !providerTurns.some( - (turn) => turn.runAttemptId === source.activeAttemptId && turn.status === "cancelled", - ) + !attemptCancelled(source.activeAttemptId) ); } @@ -326,6 +333,28 @@ export function isRestartContinuationSource( : source.status === "cancelled"; } +/** Built once per call so long threads are read a bounded number of times, not once per run. */ +function continuationLookup( + runs: ReadonlyArray, + providerTurns: ReadonlyArray>, + attempts: ReadonlyArray, +) { + const runsById = new Map(); + for (const run of runs) if (!runsById.has(run.id)) runsById.set(run.id, run); + const completedAttempts = new Set(); + const cancelledAttempts = new Set(); + for (const turn of providerTurns) { + if (turn.status === "completed") completedAttempts.add(turn.runAttemptId); + else if (turn.status === "cancelled") cancelledAttempts.add(turn.runAttemptId); + } + const completedRuns = new Set(); + for (const attempt of attempts) + if (completedAttempts.has(attempt.id)) completedRuns.add(attempt.runId); + return { runsById, completedAttempts, cancelledAttempts, completedRuns }; +} + +type ContinuationLookup = ReturnType; + /** Running does not prove prompt acceptance; carry continuation notes until a completed turn proves delivery. */ export function restartContinuationNote( source: OrchestrationV2Run, @@ -333,12 +362,13 @@ export function restartContinuationNote( providerTurns: ReadonlyArray>, attempts: ReadonlyArray, ): { readonly work: ReadonlyArray; readonly settled: boolean } { - const completedAttempts = new Set( - providerTurns.filter((turn) => turn.status === "completed").map((turn) => turn.runAttemptId), - ); - const completedRuns = new Set( - attempts.filter((attempt) => completedAttempts.has(attempt.id)).map((attempt) => attempt.runId), - ); + return continuationNote(source, continuationLookup(runs, providerTurns, attempts)); +} + +function continuationNote( + source: OrchestrationV2Run, + { runsById, completedAttempts, cancelledAttempts, completedRuns }: ContinuationLookup, +): { readonly work: ReadonlyArray; readonly settled: boolean } { let current = source; let work = current.restartCancelledBackgroundWork ?? []; const visited = new Set([current.id]); @@ -347,13 +377,16 @@ export function restartContinuationNote( !completedRuns.has(current.id) && !(current.activeAttemptId !== null && completedAttempts.has(current.activeAttemptId)) ) { - const previous = runs.find((candidate) => candidate.id === current.restartContinuationOfRunId); + const previous = runsById.get(current.restartContinuationOfRunId); if (previous === undefined || visited.has(previous.id)) break; visited.add(previous.id); current = previous; work = mergeRestartCancelledBackgroundWork(current.restartCancelledBackgroundWork ?? [], work); } - return { work, settled: isRestartNoteSource(current, providerTurns) }; + return { + work, + settled: isNoteSource(current, (attemptId) => cancelledAttempts.has(attemptId)), + }; } export function isRestartNoteContinuation( @@ -361,22 +394,30 @@ export function isRestartNoteContinuation( runs: ReadonlyArray, providerTurns: ReadonlyArray>, attempts: ReadonlyArray, +): boolean { + return ( + run.restartContinuationOfRunId !== undefined && + isNoteContinuation(run, continuationLookup(runs, providerTurns, attempts)) + ); +} + +function isNoteContinuation( + run: Pick, + lookup: ContinuationLookup, ): boolean { const source = run.restartContinuationOfRunId === undefined ? undefined - : runs.find((candidate) => candidate.id === run.restartContinuationOfRunId); - return ( - source !== undefined && - restartContinuationNote(source, runs, providerTurns, attempts).work.length > 0 - ); + : lookup.runsById.get(run.restartContinuationOfRunId); + return source !== undefined && continuationNote(source, lookup).work.length > 0; } /** Derive delivery from later completed turns on the same provider thread, excluding compactions, resumes, and rolled-back runs. */ export function pendingRestartCancelledBackgroundWork(input: { readonly runs: ReadonlyArray; readonly providerTurns: ReadonlyArray; - readonly compactionMessageIds: ReadonlySet; + /** Called only when an earlier run on the provider thread carries restart-note work. */ + readonly compactionMessageIds: () => ReadonlySet; readonly run: Pick< OrchestrationV2Run, | "id" @@ -390,33 +431,24 @@ export function pendingRestartCancelledBackgroundWork(input: { readonly attempts: ReadonlyArray; }): ReadonlyArray { - const isCompaction = (run: typeof input.run) => input.compactionMessageIds.has(run.userMessageId); - if ( - input.run.providerThreadId === null || - input.run.restartContinuationOfRunId !== undefined || - isCompaction(input.run) - ) + if (input.run.providerThreadId === null || input.run.restartContinuationOfRunId !== undefined) return []; const providerThreadId = input.run.providerThreadId; + const sameThread = input.runs.filter((run) => run.providerThreadId === providerThreadId); + const sources = sameThread.filter( + (source) => + (source.restartCancelledBackgroundWork?.length ?? 0) > 0 && runRanAfter(input.run, source), + ); + // Threads whose server never restarted carry no notes; skip every other lookup for them. + if (sources.length === 0) return []; + const compactionMessageIds = input.compactionMessageIds(); + const isCompaction = (run: typeof input.run) => compactionMessageIds.has(run.userMessageId); + if (isCompaction(input.run)) return []; const deliveredAttemptIds = new Set( input.providerTurns .filter((turn) => turn.providerThreadId === providerThreadId && turn.status === "completed") .map((turn) => turn.runAttemptId), ); - const sameThread = input.runs.filter((run) => run.providerThreadId === providerThreadId); - const prompted = sameThread.filter( - (candidate) => - candidate.id !== input.run.id && - candidate.activeAttemptId !== null && - candidate.status !== "rolled_back" && - (deliveredAttemptIds.has(candidate.activeAttemptId) || - input.attempts.some( - (attempt) => attempt.runId === candidate.id && deliveredAttemptIds.has(attempt.id), - )) && - !isCompaction(candidate) && - (candidate.restartContinuationOfRunId === undefined || - isRestartNoteContinuation(candidate, input.runs, input.providerTurns, input.attempts)), - ); // Earlier attempts may already have delivered the note; a steer's replacement attempt must not repeat it. const alreadyDelivered = input.attempts.some( (attempt) => @@ -425,13 +457,30 @@ export function pendingRestartCancelledBackgroundWork(input: { deliveredAttemptIds.has(attempt.id), ); if (alreadyDelivered) return []; - return sameThread - .filter( - (source) => - runRanAfter(input.run, source) && - (source.restartCancelledBackgroundWork?.length ?? 0) > 0 && - !prompted.some((later) => runRanAfter(later, source)), + const deliveredRunIds = new Set(); + for (const attempt of input.attempts) + if (deliveredAttemptIds.has(attempt.id)) deliveredRunIds.add(attempt.runId); + let lookup: ContinuationLookup | undefined; + // runRanAfter is a total order, so a source precedes some prompted run iff it precedes the latest one. + let latestPrompted: OrchestrationV2Run | undefined; + for (const candidate of sameThread) { + if ( + candidate.id !== input.run.id && + candidate.activeAttemptId !== null && + candidate.status !== "rolled_back" && + (deliveredAttemptIds.has(candidate.activeAttemptId) || deliveredRunIds.has(candidate.id)) && + !isCompaction(candidate) && + (candidate.restartContinuationOfRunId === undefined || + isNoteContinuation( + candidate, + (lookup ??= continuationLookup(input.runs, input.providerTurns, input.attempts)), + )) && + (latestPrompted === undefined || runRanAfter(candidate, latestPrompted)) ) + latestPrompted = candidate; + } + return sources + .filter((source) => latestPrompted === undefined || !runRanAfter(latestPrompted, source)) .reduce>( (work, source) => mergeRestartCancelledBackgroundWork(work, source.restartCancelledBackgroundWork ?? []), From 296f9131f72cdc65fab7852e4b2d7709dcce0f7b Mon Sep 17 00:00:00 2001 From: Ernest0N Date: Fri, 20 Nov 2026 01:21:34 +0400 Subject: [PATCH 133/201] fix(web): Cmd+W closes the browser tab when the page has focus (#39340) Co-authored-by: Julius Marminge --- apps/web/src/components/ChatView.tsx | 17 ++++++++++++++--- .../ReopenClosedViewShortcut.browser.test.tsx | 12 ++++++++---- .../src/components/ReopenClosedViewShortcut.tsx | 1 + 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx index e6f0fc79ecb62..1e1646e3123e6 100644 --- a/apps/web/src/components/ChatView.tsx +++ b/apps/web/src/components/ChatView.tsx @@ -2832,15 +2832,26 @@ export default function ChatView(props: ChatViewProps) { }, }); + const closeActiveRightPanelSurfaceStable = useStableCallback(() => { + if (activeRightPanelSurface) closeRightPanelSurface(activeRightPanelSurface); + }); + // A focused desktop browser page forwards these chords as menu actions. - // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to desktop bridge menu actions that toggle the right panel + // oxlint-disable-next-line t3code/no-unreasoned-state-sync -- subscribes to desktop bridge menu actions that toggle or close the right panel useEffect(() => { - if (embedded) return; + if (embedded || backgroundThread) return; return window.desktopBridge?.onMenuAction((action) => { if (action === "rightPanel.toggle") toggleRightPanelStable(); else if (action === "rightPanel.toggleMaximized") toggleRightPanelMaximizedStable(); + else if (action === "rightPanel.close") closeActiveRightPanelSurfaceStable(); }); - }, [embedded, toggleRightPanelStable, toggleRightPanelMaximizedStable]); + }, [ + embedded, + backgroundThread, + toggleRightPanelStable, + toggleRightPanelMaximizedStable, + closeActiveRightPanelSurfaceStable, + ]); usePasteToFocusComposer(embedded ? null : activeThreadId, composerRef); // A delegated task is a remote thread's subagent. diff --git a/apps/web/src/components/ReopenClosedViewShortcut.browser.test.tsx b/apps/web/src/components/ReopenClosedViewShortcut.browser.test.tsx index dd12cedfbdefd..0830d218945ab 100644 --- a/apps/web/src/components/ReopenClosedViewShortcut.browser.test.tsx +++ b/apps/web/src/components/ReopenClosedViewShortcut.browser.test.tsx @@ -265,14 +265,18 @@ describe("root reopen shortcut", () => { expect(useClosedViewStore.getState().entries).toEqual([]); }, ); - it("forwards address-bar focus and zoom from a focused desktop page", async () => { + it("forwards address-bar focus, zoom, and panel close from a focused desktop page", async () => { setup(); await using _shortcut = await renderShortcut(); expect(state.setShortcuts).toHaveBeenLastCalledWith( expect.arrayContaining( - ["preview.focusUrl", "preview.zoomIn", "preview.zoomOut", "preview.resetZoom"].map( - (command) => expect.objectContaining({ command }), - ), + [ + "preview.focusUrl", + "preview.zoomIn", + "preview.zoomOut", + "preview.resetZoom", + "rightPanel.close", + ].map((command) => expect.objectContaining({ command })), ), ); }); diff --git a/apps/web/src/components/ReopenClosedViewShortcut.tsx b/apps/web/src/components/ReopenClosedViewShortcut.tsx index 5723ff357d3d7..8c4e7d7c5a80c 100644 --- a/apps/web/src/components/ReopenClosedViewShortcut.tsx +++ b/apps/web/src/components/ReopenClosedViewShortcut.tsx @@ -54,6 +54,7 @@ const PREVIEW_FORWARDED_COMMANDS = [ "sidebar.toggle", "rightPanel.toggle", "rightPanel.toggleMaximized", + "rightPanel.close", "preview.focusUrl", "preview.zoomIn", "preview.zoomOut", From b0b2c4f952d3a12a886e915ad8ffe7e82ebc1fb4 Mon Sep 17 00:00:00 2001 From: Bilal Bakr <62337003+Bil0000@users.noreply.github.com> Date: Fri, 20 Nov 2026 00:33:15 +0300 Subject: [PATCH 134/201] fix(server): agents can tell another agent's message from the user's (#39306) Co-authored-by: Julius Marminge --- .../ProviderTurnControlService.test.ts | 11 +++- .../ProviderTurnControlService.ts | 12 ++-- .../ProviderTurnStartService.ts | 12 ++-- .../SteeringCompletion.integration.test.ts | 19 ++++++- .../codex_transcript.ndjson | 6 +- .../contracts/src/orchestrationV2.test.ts | 56 ++++++++++++++++++- packages/contracts/src/orchestrationV2.ts | 32 +++++++++++ .../provider-core/src/server/handoffBudget.ts | 3 + 8 files changed, 133 insertions(+), 18 deletions(-) diff --git a/apps/server/src/orchestration-v2/ProviderTurnControlService.test.ts b/apps/server/src/orchestration-v2/ProviderTurnControlService.test.ts index 10cc4b10b7130..df80f2ded5836 100644 --- a/apps/server/src/orchestration-v2/ProviderTurnControlService.test.ts +++ b/apps/server/src/orchestration-v2/ProviderTurnControlService.test.ts @@ -379,7 +379,7 @@ it.effect( }), ); -it.effect("steers a running turn with the thread's MCP app model context", () => +it.effect("steers a running turn with its sender and the thread's MCP app model context", () => Effect.gen(function* () { const now = yield* DateTime.now; const threadId = ThreadId.make("thread:steer-app-context"); @@ -413,8 +413,9 @@ it.effect("steers a running turn with the thread's MCP app model context", () => id: MessageId.make("message:steer-app-context"), text: "What did the app report?", attachments: [], - createdBy: "user", - creationSource: "web", + createdBy: "agent", + creationSource: "mcp", + senderThreadId: ThreadId.make("thread:steer-sender"), } as unknown as NonNullable< ProjectionStore.ProjectionProviderControlContext["message"] >, @@ -454,6 +455,10 @@ it.effect("steers a running turn with the thread's MCP app model context", () => }).pipe(Effect.provide(layerControl)); assert.equal(steered.length, 1); + assert.equal( + steered[0]!.message.text, + '[T3 Code: the agent in T3 thread "thread:steer-sender" sent this message, not the user.]\n\nWhat did the app report?', + ); assert.deepEqual("appContext" in steered[0]! ? steered[0].appContext : undefined, [ { key: "mcp_app_turn-item_call-1", text: "Pressed: blue" }, ]); diff --git a/apps/server/src/orchestration-v2/ProviderTurnControlService.ts b/apps/server/src/orchestration-v2/ProviderTurnControlService.ts index 25df164788e76..088b4d386d177 100644 --- a/apps/server/src/orchestration-v2/ProviderTurnControlService.ts +++ b/apps/server/src/orchestration-v2/ProviderTurnControlService.ts @@ -8,6 +8,7 @@ import { ProviderTurnId, RunAttemptId, ThreadId, + withMessageSenderNote, } from "@t3tools/contracts"; import type * as DateTime from "effect/DateTime"; import * as Context from "effect/Context"; @@ -463,10 +464,13 @@ export const layer: Layer.Layer< ...(appContext.length === 0 ? {} : { appContext }), message: { messageId: message.id, - text: projectComposerContextForProvider({ - text: message.text, - records: message.context?.records ?? [], - }), + text: withMessageSenderNote( + message, + projectComposerContextForProvider({ + text: message.text, + records: message.context?.records ?? [], + }), + ), attachments: message.attachments, createdBy: message.createdBy, creationSource: message.creationSource, diff --git a/apps/server/src/orchestration-v2/ProviderTurnStartService.ts b/apps/server/src/orchestration-v2/ProviderTurnStartService.ts index 8add83f213c8e..d423d0c2ea675 100644 --- a/apps/server/src/orchestration-v2/ProviderTurnStartService.ts +++ b/apps/server/src/orchestration-v2/ProviderTurnStartService.ts @@ -5,6 +5,7 @@ import { CommandId, PROVIDER_SEND_TURN_MAX_INPUT_CHARS, latestProviderTurnForAttempt, + withMessageSenderNote, type OrchestrationV2DomainEvent, type OrchestrationV2ContextHandoff, type OrchestrationV2ExecutionNode, @@ -985,10 +986,13 @@ export const layer: Layer.Layer< }); let effectiveHandoffs = handoffs; let resumeFellBack = false; - const userText = projectComposerContextForProvider({ - text: providerMessage.text, - records: providerMessage.context?.records ?? [], - }); + const userText = withMessageSenderNote( + providerMessage, + projectComposerContextForProvider({ + text: providerMessage.text, + records: providerMessage.context?.records ?? [], + }), + ); // Native goal commands go verbatim; handoff history waits a turn. const goalDriver = session.driver === "codex" || diff --git a/apps/server/src/orchestration-v2/SteeringCompletion.integration.test.ts b/apps/server/src/orchestration-v2/SteeringCompletion.integration.test.ts index ca794563234d7..ebe5e7215bcbd 100644 --- a/apps/server/src/orchestration-v2/SteeringCompletion.integration.test.ts +++ b/apps/server/src/orchestration-v2/SteeringCompletion.integration.test.ts @@ -2427,7 +2427,9 @@ it.effect("steers a promoted scheduled delivery with the thread's current select yield* worker.drain(); const projection = yield* orchestrator.getThreadProjection(threadId); - assert.deepEqual(steered, ["scheduled"]); + assert.deepEqual(steered, [ + '[T3 Code: scheduled task "task:scheduled" sent this prompt, not the user typing in this chat.]\n\nscheduled', + ]); assert.deepEqual(projection.thread.modelSelection, composerSelection); }).pipe(Effect.provide(layer)); }), @@ -3180,7 +3182,16 @@ it.effect("starts a restart that stops the running turn ahead of an older held q const { queue, started: startedTexts } = yield* read(threadId); assert.deepEqual( { queue, started: startedTexts }, - { queue: ["queued"], started: ["first", "second", "do this instead"] }, + { + queue: ["queued"], + started: [ + "first", + ...["second", "do this instead"].map( + (text) => + `[T3 Code: this message came through T3 Code's tools, not from the user typing in this chat.]\n\n${text}`, + ), + ], + }, ); }).pipe(Effect.provide(layer)); }), @@ -3300,7 +3311,9 @@ it.effect("replays an accepted steer after its target turn completes", () => .pipe(Effect.flip); assert.equal(fresh._tag, "ThreadManagementNoSteerableRunError"); yield* worker.drain(); - assert.deepEqual(steered, [input.text]); + assert.deepEqual(steered, [ + `[T3 Code: this message came through T3 Code's tools, not from the user typing in this chat.]\n\n${input.text}`, + ]); assert.lengthOf(started, 1); }).pipe( Effect.provide( diff --git a/apps/server/src/orchestration-v2/testkit/fixtures/delegated_task_status/codex_transcript.ndjson b/apps/server/src/orchestration-v2/testkit/fixtures/delegated_task_status/codex_transcript.ndjson index 95427ba136636..e40c278285055 100644 --- a/apps/server/src/orchestration-v2/testkit/fixtures/delegated_task_status/codex_transcript.ndjson +++ b/apps/server/src/orchestration-v2/testkit/fixtures/delegated_task_status/codex_transcript.ndjson @@ -21,7 +21,7 @@ {"type":"emit_inbound","label":"thread/name/updated","frame":{"method":"thread/name/updated","params":{"threadId":"019f1000-0000-7000-8000-000000000003","threadName":"Replay fixture: delegated_task_status"}}} {"type":"expect_outbound","label":"config/read","frame":{"id":8,"method":"config/read","params":{"cwd":"","includeLayers":false}}} {"type":"emit_inbound","label":"config/read","frame":{"id":8,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"child.original.turn/start","frame":{"id":9,"method":"turn/start","params":{"approvalPolicy":"never","cwd":"","input":[{"text":"Inspect the delegated API boundary and return the result.","type":"text"}],"model":"gpt-5.4","sandboxPolicy":{"type":"dangerFullAccess"},"threadId":"019f1000-0000-7000-8000-000000000003","approvalsReviewer":"user","summary":"auto","collaborationMode":{"mode":"default","settings":{"model":"gpt-5.4"}}}}} +{"type":"expect_outbound","label":"child.original.turn/start","frame":{"id":9,"method":"turn/start","params":{"approvalPolicy":"never","cwd":"","input":[{"text":"[T3 Code: the agent in T3 thread \"thread:mcp-orchestrator-parent\" sent this message, not the user.]\n\nInspect the delegated API boundary and return the result.","type":"text"}],"model":"gpt-5.4","sandboxPolicy":{"type":"dangerFullAccess"},"threadId":"019f1000-0000-7000-8000-000000000003","approvalsReviewer":"user","summary":"auto","collaborationMode":{"mode":"default","settings":{"model":"gpt-5.4"}}}}} {"type":"emit_inbound","label":"child.thread/started","frame":{"method":"thread/started","params":{"thread":{"id":"019f1000-0000-7000-8000-000000000003","forkedFromId":null,"preview":"","ephemeral":false,"modelProvider":"openai","createdAt":1776739468,"updatedAt":1776739468,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/delegated-task-status-child.jsonl","cwd":"/home/replay-user/t3code","cliVersion":"0.120.0","source":"vscode","agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"turns":[]}}}} {"type":"emit_inbound","label":"child.original.turn/start","frame":{"id":9,"result":{"turn":{"id":"019f1000-0000-7000-8000-000000000004","items":[],"status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"child.original.thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"019f1000-0000-7000-8000-000000000003","status":{"type":"active","activeFlags":[]}}}} @@ -33,7 +33,7 @@ {"type":"emit_inbound","label":"child.original.turn/completed","frame":{"method":"turn/completed","params":{"threadId":"019f1000-0000-7000-8000-000000000003","turn":{"id":"019f1000-0000-7000-8000-000000000004","items":[],"status":"completed","error":null,"startedAt":1776739468,"completedAt":1776739469,"durationMs":1000}}}} {"type":"expect_outbound","label":"config/read","frame":{"id":10,"method":"config/read","params":{"cwd":"","includeLayers":false}}} {"type":"emit_inbound","label":"config/read","frame":{"id":10,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"child.running.turn/start","frame":{"id":11,"method":"turn/start","params":{"approvalPolicy":"never","cwd":"","input":[{"text":"Remain active until the parent cancels this delegated task.","type":"text"}],"model":"gpt-5.4","sandboxPolicy":{"type":"dangerFullAccess"},"threadId":"019f1000-0000-7000-8000-000000000003","approvalsReviewer":"user","summary":"auto","collaborationMode":{"mode":"default","settings":{"model":"gpt-5.4"}}}}} +{"type":"expect_outbound","label":"child.running.turn/start","frame":{"id":11,"method":"turn/start","params":{"approvalPolicy":"never","cwd":"","input":[{"text":"[T3 Code: the agent in T3 thread \"thread:mcp-orchestrator-parent\" sent this message, not the user.]\n\nRemain active until the parent cancels this delegated task.","type":"text"}],"model":"gpt-5.4","sandboxPolicy":{"type":"dangerFullAccess"},"threadId":"019f1000-0000-7000-8000-000000000003","approvalsReviewer":"user","summary":"auto","collaborationMode":{"mode":"default","settings":{"model":"gpt-5.4"}}}}} {"type":"emit_inbound","label":"child.running.turn/start","frame":{"id":11,"result":{"turn":{"id":"019f1000-0000-7000-8000-000000000005","items":[],"status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"child.running.thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"019f1000-0000-7000-8000-000000000003","status":{"type":"active","activeFlags":[]}}}} {"type":"emit_inbound","label":"child.running.turn/started","frame":{"method":"turn/started","params":{"threadId":"019f1000-0000-7000-8000-000000000003","turn":{"id":"019f1000-0000-7000-8000-000000000005","items":[],"status":"inProgress","error":null,"startedAt":1776739470,"completedAt":null,"durationMs":null}}}} @@ -43,7 +43,7 @@ {"type":"emit_inbound","label":"child.running.turn/completed","frame":{"method":"turn/completed","params":{"threadId":"019f1000-0000-7000-8000-000000000003","turn":{"id":"019f1000-0000-7000-8000-000000000005","items":[],"status":"interrupted","error":null,"startedAt":1776739470,"completedAt":1776739471,"durationMs":1000}}}} {"type":"expect_outbound","label":"config/read","frame":{"id":13,"method":"config/read","params":{"cwd":"","includeLayers":false}}} {"type":"emit_inbound","label":"config/read","frame":{"id":13,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"child.queued.turn/start","frame":{"id":14,"method":"turn/start","params":{"approvalPolicy":"never","cwd":"","input":[{"text":"Complete the queued follow-up and return the final result.","type":"text"}],"model":"gpt-5.4","sandboxPolicy":{"type":"dangerFullAccess"},"threadId":"019f1000-0000-7000-8000-000000000003","approvalsReviewer":"user","summary":"auto","collaborationMode":{"mode":"default","settings":{"model":"gpt-5.4"}}}}} +{"type":"expect_outbound","label":"child.queued.turn/start","frame":{"id":14,"method":"turn/start","params":{"approvalPolicy":"never","cwd":"","input":[{"text":"[T3 Code: the agent in T3 thread \"thread:mcp-orchestrator-parent\" sent this message, not the user.]\n\nComplete the queued follow-up and return the final result.","type":"text"}],"model":"gpt-5.4","sandboxPolicy":{"type":"dangerFullAccess"},"threadId":"019f1000-0000-7000-8000-000000000003","approvalsReviewer":"user","summary":"auto","collaborationMode":{"mode":"default","settings":{"model":"gpt-5.4"}}}}} {"type":"emit_inbound","label":"child.queued.turn/start","frame":{"id":14,"result":{"turn":{"id":"019f1000-0000-7000-8000-000000000006","items":[],"status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"child.queued.thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"019f1000-0000-7000-8000-000000000003","status":{"type":"active","activeFlags":[]}}}} {"type":"emit_inbound","label":"child.queued.turn/started","frame":{"method":"turn/started","params":{"threadId":"019f1000-0000-7000-8000-000000000003","turn":{"id":"019f1000-0000-7000-8000-000000000006","items":[],"status":"inProgress","error":null,"startedAt":1776739472,"completedAt":null,"durationMs":null}}}} diff --git a/packages/contracts/src/orchestrationV2.test.ts b/packages/contracts/src/orchestrationV2.test.ts index 76f78f536d7c5..bacf812ab8057 100644 --- a/packages/contracts/src/orchestrationV2.test.ts +++ b/packages/contracts/src/orchestrationV2.test.ts @@ -2,7 +2,14 @@ import { describe, expect, it } from "@effect/vitest"; import * as DateTime from "effect/DateTime"; import * as Schema from "effect/Schema"; -import { NodeId, RunAttemptId, TrimmedNonEmptyString } from "./index.ts"; +import { + EnvironmentId, + NodeId, + RunAttemptId, + ScheduledTaskId, + ThreadId, + TrimmedNonEmptyString, +} from "./index.ts"; import { latestProviderTurnForAttempt, OrchestrationV2CheckpointFileSummary, @@ -16,6 +23,7 @@ import { OrchestrationV2ThreadHistoryPage, OrchestrationV2TurnItem, OrchestrationV2TurnItemJson, + withMessageSenderNote, } from "./orchestrationV2.ts"; const now = DateTime.makeUnsafe("2026-04-20T00:00:00.000Z"); @@ -650,3 +658,49 @@ describe("latestProviderTurnForAttempt", () => { expect(latestProviderTurnForAttempt(turns, null)).toBeUndefined(); }); }); + +describe("withMessageSenderNote", () => { + const thread = { + createdBy: "agent", + creationSource: "mcp", + senderThreadId: ThreadId.make("t"), + } as const; + it.each([ + [thread, "Hi", '[T3 Code: the agent in T3 thread "t" sent this message, not the user.]\n\nHi'], + [thread, "", '[T3 Code: the agent in T3 thread "t" sent this message, not the user.]'], + [thread, " /git/review staged", " /git/review staged"], + [thread, "$deploy ship it", "$deploy ship it"], + [ + thread, + "$25 left", + '[T3 Code: the agent in T3 thread "t" sent this message, not the user.]\n\n$25 left', + ], + [ + { + createdBy: "agent", + creationSource: "mcp", + linkedSender: { + environmentId: EnvironmentId.make("e"), + threadId: ThreadId.make("r"), + title: "x", + }, + }, + "Hi", + '[T3 Code: the agent in T3 thread "r" on linked environment "e" sent this message, not the user.]\n\nHi', + ], + [ + { createdBy: "user", creationSource: "web", scheduledTaskId: ScheduledTaskId.make("s") }, + "Hi", + '[T3 Code: scheduled task "s" sent this prompt, not the user typing in this chat.]\n\nHi', + ], + [ + { createdBy: "agent", creationSource: "mcp" }, + "Hi", + "[T3 Code: this message came through T3 Code's tools, not from the user typing in this chat.]\n\nHi", + ], + [{ createdBy: "user", creationSource: "web" }, "Hi", "Hi"], + [{ createdBy: "agent", creationSource: "server" }, "Hi", "Hi"], + ] as const)("labels %j's message %j for the provider", (message, text, expected) => { + expect(withMessageSenderNote(message, text)).toBe(expected); + }); +}); diff --git a/packages/contracts/src/orchestrationV2.ts b/packages/contracts/src/orchestrationV2.ts index 33242f8dcdeac..573607abc7e97 100644 --- a/packages/contracts/src/orchestrationV2.ts +++ b/packages/contracts/src/orchestrationV2.ts @@ -602,6 +602,38 @@ export function isCompactionCommandMessage(message: CompactionMessageFields): bo ); } +const LEADING_COMMAND = /^\s*(?:\/|\p{Sc}[a-zA-Z0-9:_-]*[a-zA-Z])/u; + +/** + * Who sent a message, in a line the model reads before its text, or the text unchanged when a + * person typed it. Providers parse slash commands and skill mentions such as `$deploy` from the + * start of a prompt, so those stay as sent. + */ +export function withMessageSenderNote( + message: { + readonly createdBy: OrchestrationV2Actor; + readonly creationSource: OrchestrationV2CreationSource; + readonly scheduledTaskId?: ScheduledTaskId | undefined; + readonly senderThreadId?: ThreadId | undefined; + readonly linkedSender?: OrchestrationV2LinkedSender | undefined; + }, + text: string, +): string { + const agent = message.createdBy === "agent"; + const note = + agent && message.linkedSender !== undefined + ? `[T3 Code: the agent in T3 thread ${JSON.stringify(message.linkedSender.threadId)} on linked environment ${JSON.stringify(message.linkedSender.environmentId)} sent this message, not the user.]` + : agent && message.senderThreadId !== undefined + ? `[T3 Code: the agent in T3 thread ${JSON.stringify(message.senderThreadId)} sent this message, not the user.]` + : message.scheduledTaskId !== undefined + ? `[T3 Code: scheduled task ${JSON.stringify(message.scheduledTaskId)} sent this prompt, not the user typing in this chat.]` + : agent && message.creationSource === "mcp" + ? "[T3 Code: this message came through T3 Code's tools, not from the user typing in this chat.]" + : undefined; + if (note === undefined || LEADING_COMMAND.test(text)) return text; + return text === "" ? note : `${note}\n\n${text}`; +} + export type OrchestrationV2GoalCommand = | { readonly type: "show" } | { readonly type: "clear" } diff --git a/packages/provider-core/src/server/handoffBudget.ts b/packages/provider-core/src/server/handoffBudget.ts index 18bd5fb1fd284..ddf9b692c337c 100644 --- a/packages/provider-core/src/server/handoffBudget.ts +++ b/packages/provider-core/src/server/handoffBudget.ts @@ -8,6 +8,7 @@ import type { OrchestrationV2ProviderThread, OrchestrationV2TurnItem, } from "@t3tools/contracts"; +import { withMessageSenderNote } from "@t3tools/contracts"; import * as Config from "effect/Config"; @@ -137,6 +138,8 @@ export function historicalMessage( let text: string; switch (item.type) { case "user_message": + text = withMessageSenderNote(item, item.text); + break; case "assistant_message": text = item.text; break; From 6455fc1a74c752a732f1458718f67f6fd083914b Mon Sep 17 00:00:00 2001 From: Mike Olson Date: Thu, 19 Nov 2026 16:42:31 -0500 Subject: [PATCH 135/201] fix(mobile): Composer says why Send is disabled after an attachment upload fails (#38395) Co-authored-by: Julius Marminge --- .../src/components/ComposerAttachmentStrip.tsx | 7 +++++++ .../src/features/threads/ThreadComposer.tsx | 17 +++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/apps/mobile/src/components/ComposerAttachmentStrip.tsx b/apps/mobile/src/components/ComposerAttachmentStrip.tsx index 767a689568131..ba7d9790c4120 100644 --- a/apps/mobile/src/components/ComposerAttachmentStrip.tsx +++ b/apps/mobile/src/components/ComposerAttachmentStrip.tsx @@ -66,6 +66,13 @@ export function ComposerAttachmentThumbnail(props: ComposerAttachmentThumbnailPr return ( + {upload?.status === "failed" ? ( + + ) : null} {upload && upload.status !== "ready" ? ( {isExpanded ? editingAttachments : null} + {attachmentBlockReason !== null ? ( + + + + {attachmentBlockReason} + + + ) : null} { compactEditor.onRowLayout(event); From 2c2191789ae7f07b8b2d485f138b4dc7fefce9da Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Thu, 19 Nov 2026 13:43:27 -0800 Subject: [PATCH 136/201] fix(mobile): SVG text with font-variation-settings no longer crashes Android (#39334) --- patches/react-native-svg@15.16.1.patch | 82 ++++++++++++++++++++++++++ pnpm-lock.yaml | 12 ++-- 2 files changed, 88 insertions(+), 6 deletions(-) diff --git a/patches/react-native-svg@15.16.1.patch b/patches/react-native-svg@15.16.1.patch index 5431d95cfc4e9..69c2888efd40d 100644 --- a/patches/react-native-svg@15.16.1.patch +++ b/patches/react-native-svg@15.16.1.patch @@ -38,3 +38,85 @@ index 8c796236f9f4b58717ac3fbab65e33d11ba032f2..d886e13d2cd1390a396716ecf4a37920 markerTransform.preRotate(degrees); boolean useStrokeWidth = "strokeWidth".equals(mMarkerUnits); +diff --git a/android/src/main/java/com/horcrux/svg/TSpanView.java b/android/src/main/java/com/horcrux/svg/TSpanView.java +index b6e0a3892eb5416b1badf447d4f8c4e4baef828c..4660fb4b7b49ec44e78fb413a543dd5f9f93ed6a 100644 +--- a/android/src/main/java/com/horcrux/svg/TSpanView.java ++++ b/android/src/main/java/com/horcrux/svg/TSpanView.java +@@ -21,6 +21,7 @@ import static com.horcrux.svg.TextProperties.TextPathMidLine; + import static com.horcrux.svg.TextProperties.TextPathSide; + + import android.annotation.SuppressLint; ++import android.annotation.TargetApi; + import android.content.res.AssetManager; + import android.graphics.Canvas; + import android.graphics.Matrix; +@@ -290,6 +291,33 @@ class TSpanView extends TextView { + static final String additionalLigatures = "'hlig', 'cala', "; + static final String fontWeightTag = "'wght' "; + ++ static String fontVariationSettings(int weight, String extra) { ++ String weightAxis = fontWeightTag + weight; ++ return extra == null || extra.trim().isEmpty() ? weightAxis : weightAxis + ", " + extra; ++ } ++ ++ // Android throws IllegalArgumentException on settings it cannot parse, which would crash the ++ // draw; fall back to the weight axis alone. ++ @TargetApi(Build.VERSION_CODES.O) ++ private static void setPaintFontVariationSettings(Paint paint, FontData font) { ++ try { ++ paint.setFontVariationSettings( ++ fontVariationSettings(font.absoluteFontWeight, font.fontVariationSettings)); ++ } catch (IllegalArgumentException e) { ++ paint.setFontVariationSettings(fontWeightTag + font.absoluteFontWeight); ++ } ++ } ++ ++ @TargetApi(Build.VERSION_CODES.O) ++ private static void setBuilderFontVariationSettings( ++ Typeface.Builder builder, int weight, String extra) { ++ try { ++ builder.setFontVariationSettings(fontVariationSettings(weight, extra)); ++ } catch (IllegalArgumentException e) { ++ builder.setFontVariationSettings(fontWeightTag + weight); ++ } ++ } ++ + private void applySpacingAndFeatures(Paint paint, FontData font) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + double letterSpacing = font.letterSpacing; +@@ -307,8 +335,7 @@ class TSpanView extends TextView { + } + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { +- paint.setFontVariationSettings( +- fontWeightTag + font.absoluteFontWeight + font.fontVariationSettings); ++ setPaintFontVariationSettings(paint, font); + } + } + } +@@ -487,8 +514,7 @@ class TSpanView extends TextView { + } + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { +- paint.setFontVariationSettings( +- fontWeightTag + font.absoluteFontWeight + font.fontVariationSettings); ++ setPaintFontVariationSettings(paint, font); + } + } + // OpenType.js font data +@@ -1147,13 +1173,13 @@ class TSpanView extends TextView { + String ttfpath = FONTS + fontFamily + TTF; + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + Typeface.Builder builder = new Typeface.Builder(assets, otfpath); +- builder.setFontVariationSettings("'wght' " + weight + font.fontVariationSettings); ++ setBuilderFontVariationSettings(builder, weight, font.fontVariationSettings); + builder.setWeight(weight); + builder.setItalic(isItalic); + typeface = builder.build(); + if (typeface == null) { + builder = new Typeface.Builder(assets, ttfpath); +- builder.setFontVariationSettings("'wght' " + weight + font.fontVariationSettings); ++ setBuilderFontVariationSettings(builder, weight, font.fontVariationSettings); + builder.setWeight(weight); + builder.setItalic(isItalic); + typeface = builder.build(); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 54437f3d0434c..08a6a213597b0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -396,7 +396,7 @@ patchedDependencies: react-native-keyboard-controller@1.23.0: 1c7c80317ef050e08d4aabe034a0813d03b497dff2dc8b37fb5f4a6e3b20fddb react-native-pdf-jsi@6.1.0: d29e6b69813548de641a09db705dd94823d3f96832821ae9c3f6a196dd15cb68 react-native-reanimated@4.7.1: 95ee26e5fcab5f50bc4b4c47b3f7e6278a0b20850205efb9f6ee7e70a22d2b59 - react-native-svg@15.16.1: 110f9243ffad03654ce40dd1cdb09f01af16b8fa2ccb2b2cd3d62e682c180399 + react-native-svg@15.16.1: 7f94d240fc19418233c96f9a637dfd248846446657476c204f3614fd2847900e react-native-webview@14.0.1: 71009983c76818bd5e73d4ca597f76efd04101600c84cd4b4c5d920781c048ae importers: @@ -623,7 +623,7 @@ importers: version: link:../../packages/shared '@tabler/icons-react-native': specifier: ^3.44.0 - version: 3.44.0(react-native-svg@15.16.1(patch_hash=110f9243ffad03654ce40dd1cdb09f01af16b8fa2ccb2b2cd3d62e682c180399)(react-native@0.88.1(@babel/core@7.29.7(supports-color@8.1.1))(@react-native/metro-config@0.88.1(@babel/core@7.29.7(supports-color@8.1.1))(bufferutil@4.1.0)(supports-color@8.1.1)(utf-8-validate@6.0.6))(@types/react@19.3.0)(bufferutil@4.1.0)(react@19.3.0)(supports-color@8.1.1)(utf-8-validate@6.0.6))(react@19.3.0))(react@19.3.0) + version: 3.44.0(react-native-svg@15.16.1(patch_hash=7f94d240fc19418233c96f9a637dfd248846446657476c204f3614fd2847900e)(react-native@0.88.1(@babel/core@7.29.7(supports-color@8.1.1))(@react-native/metro-config@0.88.1(@babel/core@7.29.7(supports-color@8.1.1))(bufferutil@4.1.0)(supports-color@8.1.1)(utf-8-validate@6.0.6))(@types/react@19.3.0)(bufferutil@4.1.0)(react@19.3.0)(supports-color@8.1.1)(utf-8-validate@6.0.6))(react@19.3.0))(react@19.3.0) clsx: specifier: ^2.1.1 version: 2.1.1 @@ -791,7 +791,7 @@ importers: version: file:apps/mobile/deps/react-native-screens-5.0.0-t3.61.tgz(react-native@0.88.1(@babel/core@7.29.7(supports-color@8.1.1))(@react-native/metro-config@0.88.1(@babel/core@7.29.7(supports-color@8.1.1))(bufferutil@4.1.0)(supports-color@8.1.1)(utf-8-validate@6.0.6))(@types/react@19.3.0)(bufferutil@4.1.0)(react@19.3.0)(supports-color@8.1.1)(utf-8-validate@6.0.6))(react@19.3.0) react-native-svg: specifier: 15.16.1 - version: 15.16.1(patch_hash=110f9243ffad03654ce40dd1cdb09f01af16b8fa2ccb2b2cd3d62e682c180399)(react-native@0.88.1(@babel/core@7.29.7(supports-color@8.1.1))(@react-native/metro-config@0.88.1(@babel/core@7.29.7(supports-color@8.1.1))(bufferutil@4.1.0)(supports-color@8.1.1)(utf-8-validate@6.0.6))(@types/react@19.3.0)(bufferutil@4.1.0)(react@19.3.0)(supports-color@8.1.1)(utf-8-validate@6.0.6))(react@19.3.0) + version: 15.16.1(patch_hash=7f94d240fc19418233c96f9a637dfd248846446657476c204f3614fd2847900e)(react-native@0.88.1(@babel/core@7.29.7(supports-color@8.1.1))(@react-native/metro-config@0.88.1(@babel/core@7.29.7(supports-color@8.1.1))(bufferutil@4.1.0)(supports-color@8.1.1)(utf-8-validate@6.0.6))(@types/react@19.3.0)(bufferutil@4.1.0)(react@19.3.0)(supports-color@8.1.1)(utf-8-validate@6.0.6))(react@19.3.0) react-native-webview: specifier: 14.0.1 version: 14.0.1(patch_hash=71009983c76818bd5e73d4ca597f76efd04101600c84cd4b4c5d920781c048ae)(react-native@0.88.1(@babel/core@7.29.7(supports-color@8.1.1))(@react-native/metro-config@0.88.1(@babel/core@7.29.7(supports-color@8.1.1))(bufferutil@4.1.0)(supports-color@8.1.1)(utf-8-validate@6.0.6))(@types/react@19.3.0)(bufferutil@4.1.0)(react@19.3.0)(supports-color@8.1.1)(utf-8-validate@6.0.6))(react@19.3.0) @@ -16972,11 +16972,11 @@ snapshots: '@t3tools/mobile-terminal-native@file:apps/mobile/modules/t3-terminal': {} - '@tabler/icons-react-native@3.44.0(react-native-svg@15.16.1(patch_hash=110f9243ffad03654ce40dd1cdb09f01af16b8fa2ccb2b2cd3d62e682c180399)(react-native@0.88.1(@babel/core@7.29.7(supports-color@8.1.1))(@react-native/metro-config@0.88.1(@babel/core@7.29.7(supports-color@8.1.1))(bufferutil@4.1.0)(supports-color@8.1.1)(utf-8-validate@6.0.6))(@types/react@19.3.0)(bufferutil@4.1.0)(react@19.3.0)(supports-color@8.1.1)(utf-8-validate@6.0.6))(react@19.3.0))(react@19.3.0)': + '@tabler/icons-react-native@3.44.0(react-native-svg@15.16.1(patch_hash=7f94d240fc19418233c96f9a637dfd248846446657476c204f3614fd2847900e)(react-native@0.88.1(@babel/core@7.29.7(supports-color@8.1.1))(@react-native/metro-config@0.88.1(@babel/core@7.29.7(supports-color@8.1.1))(bufferutil@4.1.0)(supports-color@8.1.1)(utf-8-validate@6.0.6))(@types/react@19.3.0)(bufferutil@4.1.0)(react@19.3.0)(supports-color@8.1.1)(utf-8-validate@6.0.6))(react@19.3.0))(react@19.3.0)': dependencies: '@tabler/icons': 3.44.0 react: 19.3.0 - react-native-svg: 15.16.1(patch_hash=110f9243ffad03654ce40dd1cdb09f01af16b8fa2ccb2b2cd3d62e682c180399)(react-native@0.88.1(@babel/core@7.29.7(supports-color@8.1.1))(@react-native/metro-config@0.88.1(@babel/core@7.29.7(supports-color@8.1.1))(bufferutil@4.1.0)(supports-color@8.1.1)(utf-8-validate@6.0.6))(@types/react@19.3.0)(bufferutil@4.1.0)(react@19.3.0)(supports-color@8.1.1)(utf-8-validate@6.0.6))(react@19.3.0) + react-native-svg: 15.16.1(patch_hash=7f94d240fc19418233c96f9a637dfd248846446657476c204f3614fd2847900e)(react-native@0.88.1(@babel/core@7.29.7(supports-color@8.1.1))(@react-native/metro-config@0.88.1(@babel/core@7.29.7(supports-color@8.1.1))(bufferutil@4.1.0)(supports-color@8.1.1)(utf-8-validate@6.0.6))(@types/react@19.3.0)(bufferutil@4.1.0)(react@19.3.0)(supports-color@8.1.1)(utf-8-validate@6.0.6))(react@19.3.0) '@tabler/icons@3.44.0': {} @@ -22604,7 +22604,7 @@ snapshots: react-native: 0.88.1(@babel/core@7.29.7(supports-color@8.1.1))(@react-native/metro-config@0.88.1(@babel/core@7.29.7(supports-color@8.1.1))(bufferutil@4.1.0)(supports-color@8.1.1)(utf-8-validate@6.0.6))(@types/react@19.3.0)(bufferutil@4.1.0)(react@19.3.0)(supports-color@8.1.1)(utf-8-validate@6.0.6) warn-once: 0.1.1 - react-native-svg@15.16.1(patch_hash=110f9243ffad03654ce40dd1cdb09f01af16b8fa2ccb2b2cd3d62e682c180399)(react-native@0.88.1(@babel/core@7.29.7(supports-color@8.1.1))(@react-native/metro-config@0.88.1(@babel/core@7.29.7(supports-color@8.1.1))(bufferutil@4.1.0)(supports-color@8.1.1)(utf-8-validate@6.0.6))(@types/react@19.3.0)(bufferutil@4.1.0)(react@19.3.0)(supports-color@8.1.1)(utf-8-validate@6.0.6))(react@19.3.0): + react-native-svg@15.16.1(patch_hash=7f94d240fc19418233c96f9a637dfd248846446657476c204f3614fd2847900e)(react-native@0.88.1(@babel/core@7.29.7(supports-color@8.1.1))(@react-native/metro-config@0.88.1(@babel/core@7.29.7(supports-color@8.1.1))(bufferutil@4.1.0)(supports-color@8.1.1)(utf-8-validate@6.0.6))(@types/react@19.3.0)(bufferutil@4.1.0)(react@19.3.0)(supports-color@8.1.1)(utf-8-validate@6.0.6))(react@19.3.0): dependencies: css-select: 5.2.2 css-tree: 1.1.3 From babc83baf1cdf850182f20f53abad59ae3820a85 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Thu, 19 Nov 2026 13:43:52 -0800 Subject: [PATCH 137/201] fix(web): PR viewer renders GitHub :emoji: shortcodes (#39315) --- .../pull-requests/PullRequestMarkdown.tsx | 28 +- .../pullRequestAutolinks.test.ts | 23 +- .../pull-requests/pullRequestAutolinks.ts | 72 +- .../pullRequest/PullRequestSummaryTab.tsx | 2 +- .../pullRequestMarkdown.logic.test.ts | 30 +- .../pullRequest/pullRequestMarkdown.logic.ts | 33 +- .../client-runtime/src/githubEmojiAliases.ts | 1917 +++++++++++++++++ .../client-runtime/src/pullRequestMarkdown.ts | 37 + third-party-licenses.config.json | 12 + 9 files changed, 2109 insertions(+), 45 deletions(-) create mode 100644 packages/client-runtime/src/githubEmojiAliases.ts diff --git a/apps/mobile/src/features/pull-requests/PullRequestMarkdown.tsx b/apps/mobile/src/features/pull-requests/PullRequestMarkdown.tsx index 05fe4b444a6ef..3654cfd87bb42 100644 --- a/apps/mobile/src/features/pull-requests/PullRequestMarkdown.tsx +++ b/apps/mobile/src/features/pull-requests/PullRequestMarkdown.tsx @@ -22,7 +22,7 @@ import { sourceControlClients, type ReferenceAutolink, } from "@t3tools/client-runtime/source-control-clients"; -import { linkReferenceAutolinks } from "./pullRequestAutolinks"; +import { nativePullRequestMarkdown } from "./pullRequestAutolinks"; import { useOpenPullRequest } from "../../native/useOpenPullRequest"; import { SelectableMarkdownText } from "../../native/SelectableMarkdownText"; @@ -43,6 +43,7 @@ const AutolinksContext = createContext<((text: string) => ReadonlyArray(null); export function PullRequestMarkdownRepository(props: { @@ -69,11 +70,13 @@ export function PullRequestMarkdownRepository(props: { : null; return ( - - - {props.children} - - + + + + {props.children} + + + ); } @@ -160,18 +163,21 @@ function PullRequestBodySegmentView(props: { readonly onTaskListUndone: () => void; }) { const { segment, onTaskListChange } = props; + const autolinks = useContext(AutolinksContext); + const githubEmoji = useContext(GithubEmojiContext); if (segment.kind === "markdown") { + const prose = nativePullRequestMarkdown(segment.text, autolinks, githubEmoji); return ( { const offset = markdownTaskMarkerOffset( - segment.text, + prose.markdown, event.index, event.text, event.checked, @@ -179,7 +185,7 @@ function PullRequestBodySegmentView(props: { const kept = offset !== null && onTaskListChange({ - markerOffset: segment.sourceOffset + offset, + markerOffset: segment.sourceOffset + prose.sourceOffset(offset), checked: event.checked, }); if (!kept) props.onTaskListUndone(); @@ -218,12 +224,10 @@ function PullRequestMarkdownContent(props: { readonly onTaskListItemPress?: SelectableMarkdownTextProps["onTaskListItemPress"]; }) { const hostLineBreaks = useContext(LineBreaksContext); - const autolinks = useContext(AutolinksContext); const mediaContext = useContext(PullRequestMediaContext); const changeRequestUrl = useContext(ChangeRequestUrlContext); const resolveMediaUrl = (href: string) => changeRequestUrl ? resolveChangeRequestMediaUrl(href, changeRequestUrl) : href; - const markdown = linkReferenceAutolinks(props.markdown, autolinks); const openPullRequest = useOpenPullRequest(); const openLink = (href: string) => { void openPullRequest(href); @@ -236,7 +240,7 @@ function PullRequestMarkdownContent(props: { return ( { +describe("nativePullRequestMarkdown", () => { it("links the host's references in prose", () => { - expect(linkReferenceAutolinks("Closes #123, see @julius", github)).toBe( + expect(nativePullRequestMarkdown("Closes #123, see @julius", github, false).markdown).toBe( "Closes [#123](https://github.com/team/repo/issues/123), see [@julius](https://github.com/julius)", ); }); @@ -18,12 +18,12 @@ describe("linkReferenceAutolinks", () => { it("leaves code, links, images, escapes and definitions alone", () => { const text = "`#123 @person abc1234`\n\n```\n#123\n```\n\n[#123](https://example.com) ![#123](image.png) https://example.com/#123 user@example.com \\#123 1234567\n\n[ref]: https://example.com/#123"; - expect(linkReferenceAutolinks(text, github)).toBe(text); + expect(nativePullRequestMarkdown(text, github, false).markdown).toBe(text); }); it("does not nest links inside HTML anchors or code", () => { const text = 'See #12 and #13, then #14.'; - expect(linkReferenceAutolinks(text, github)).toBe( + expect(nativePullRequestMarkdown(text, github, false).markdown).toBe( 'See #12 and #13, then [#14](https://github.com/team/repo/issues/14).', ); }); @@ -33,6 +33,17 @@ describe("linkReferenceAutolinks", () => { provider: "forgejo", url: "https://codeberg.org/acme/web/pulls/7", }); - expect(linkReferenceAutolinks("Closes #123", forgejo)).toBe("Closes #123"); + expect(nativePullRequestMarkdown("Closes #123", forgejo, false).markdown).toBe("Closes #123"); + }); + + it("expands GitHub emoji aliases in prose and link labels, mapping offsets back", () => { + const text = + "- [ ] Ship :tada: #1 `:tada:`\n- [ ] [:+1: docs](https://x.dev/:tada:) https://x.dev/:tada: :asterisk:"; + const native = nativePullRequestMarkdown(text, github, true); + expect(native.markdown).toBe( + "- [ ] Ship 🎉 [#1](https://github.com/team/repo/issues/1) `:tada:`\n- [ ] [👍 docs](https://x.dev/:tada:) https://x.dev/:tada: \\*️⃣", + ); + const marker = native.markdown.lastIndexOf("[ ]"); + expect(native.sourceOffset(marker)).toBe(text.lastIndexOf("[ ]")); }); }); diff --git a/apps/mobile/src/features/pull-requests/pullRequestAutolinks.ts b/apps/mobile/src/features/pull-requests/pullRequestAutolinks.ts index d46b2b11a665c..91268c797e808 100644 --- a/apps/mobile/src/features/pull-requests/pullRequestAutolinks.ts +++ b/apps/mobile/src/features/pull-requests/pullRequestAutolinks.ts @@ -1,3 +1,4 @@ +import { githubEmojiAliases } from "@t3tools/client-runtime/pull-request-markdown"; import type { ReferenceAutolink } from "@t3tools/client-runtime/source-control-clients"; import remarkGfm from "remark-gfm"; import remarkParse from "remark-parse"; @@ -26,29 +27,54 @@ const UNLINKED_TYPES = new Set([ "definition", ]); +const unchanged = (offset: number) => offset; + /** - * Rewrites the references `autolinks` finds in the markdown's prose as markdown links, because the - * native renderer takes markdown text. Text is searched as written, escapes included. + * Rewrites the references `autolinks` finds in the markdown's prose as markdown links, and GitHub's + * `:alias:` emoji as the emoji, because the native renderer takes markdown text. Text is searched + * as written, escapes included. `sourceOffset` maps an offset in the result back to `markdown`. */ -export function linkReferenceAutolinks( +export function nativePullRequestMarkdown( markdown: string, autolinks: ((text: string) => ReadonlyArray) | null, -): string { - if (autolinks === null) return markdown; + githubEmoji: boolean, +): { readonly markdown: string; readonly sourceOffset: (offset: number) => number } { + if (autolinks === null && !githubEmoji) return { markdown, sourceOffset: unchanged }; const edits: { start: number; end: number; value: string }[] = []; - const visit = (node: MarkdownNode) => { + const visit = (node: MarkdownNode, inLink: boolean) => { + // Only a bracketed label is prose; an autolink's text is its destination. + const labelled = markdown[node.position?.start.offset ?? -1] === "["; + if (node.type === "link" && labelled && !inLink) { + node.children?.forEach((child) => visit(child, true)); + return; + } if (UNLINKED_TYPES.has(node.type)) return; if (node.type === "text") { const start = node.position?.start.offset; const end = node.position?.end.offset; if (start === undefined || end === undefined) return; - for (const link of autolinks(markdown.slice(start, end))) { - edits.push({ + const text = markdown.slice(start, end); + const found: { start: number; end: number; value: string }[] = []; + for (const link of inLink ? [] : (autolinks?.(text) ?? [])) { + found.push({ start: start + link.index, end: start + link.index + link.text.length, value: `[${link.label}](${link.url})`, }); } + for (const alias of githubEmoji ? githubEmojiAliases(text) : []) { + // Keycap emoji start with `*`, which the native parser would read as emphasis. + const value = alias.emoji.replaceAll("*", "\\*"); + found.push({ + start: start + alias.index, + end: start + alias.index + alias.text.length, + value, + }); + } + found.sort((left, right) => left.start - right.start); + for (const edit of found) { + if (edit.start >= (edits.at(-1)?.end ?? 0)) edits.push(edit); + } } else if (node.children !== undefined) { let protectedHtmlDepth = 0; for (const child of node.children) { @@ -59,15 +85,31 @@ export function linkReferenceAutolinks( for (const match of tag.matchAll(/<(\/)?(?:a|code|pre|script|style)(?=[\s>])[^>]*>/giu)) { protectedHtmlDepth = Math.max(0, protectedHtmlDepth + (match[1] ? -1 : 1)); } - } else if (protectedHtmlDepth === 0) visit(child); + } else if (protectedHtmlDepth === 0) visit(child, inLink); } } }; - visit(parser.parse(markdown)); - let linked = markdown; - for (let index = edits.length - 1; index >= 0; index--) { - const edit = edits[index]!; - linked = linked.slice(0, edit.start) + edit.value + linked.slice(edit.end); + visit(parser.parse(markdown), false); + if (edits.length === 0) return { markdown, sourceOffset: unchanged }; + let rewritten = ""; + let cursor = 0; + // Where each edit ends in the result, and how far `markdown` is ahead from there on. + const shifts: { end: number; delta: number }[] = []; + for (const edit of edits) { + rewritten += markdown.slice(cursor, edit.start) + edit.value; + cursor = edit.end; + shifts.push({ end: rewritten.length, delta: edit.end - rewritten.length }); } - return linked; + rewritten += markdown.slice(cursor); + return { + markdown: rewritten, + sourceOffset(offset) { + let delta = 0; + for (const shift of shifts) { + if (shift.end > offset) break; + delta = shift.delta; + } + return offset + delta; + }, + }; } diff --git a/apps/web/src/components/pullRequest/PullRequestSummaryTab.tsx b/apps/web/src/components/pullRequest/PullRequestSummaryTab.tsx index 0e8a530c5bebb..5078a67759dec 100644 --- a/apps/web/src/components/pullRequest/PullRequestSummaryTab.tsx +++ b/apps/web/src/components/pullRequest/PullRequestSummaryTab.tsx @@ -342,7 +342,7 @@ function CollapsedComment({ className="mt-2 block w-full truncate text-left text-xs text-muted-foreground hover:text-foreground" onClick={() => statusTriggerRef.current?.focus({ preventScroll: true })} > - {pullRequestCommentPreview(body)} + {pullRequestCommentPreview(body, detail.provider)} ) : null} diff --git a/apps/web/src/components/pullRequest/pullRequestMarkdown.logic.test.ts b/apps/web/src/components/pullRequest/pullRequestMarkdown.logic.test.ts index c78617f221c1e..1655427b2d4e9 100644 --- a/apps/web/src/components/pullRequest/pullRequestMarkdown.logic.test.ts +++ b/apps/web/src/components/pullRequest/pullRequestMarkdown.logic.test.ts @@ -3,7 +3,11 @@ import remarkParse from "remark-parse"; import { unified } from "unified"; import { describe, expect, it } from "vite-plus/test"; -import { pullRequestCommentPreview, remarkPullRequestAutolinks } from "./pullRequestMarkdown.logic"; +import { + pullRequestCommentPreview, + pullRequestMarkdownPlugins, + remarkPullRequestAutolinks, +} from "./pullRequestMarkdown.logic"; type Node = { type: string; @@ -45,6 +49,24 @@ describe("remarkPullRequestAutolinks", () => { }); }); +describe("pullRequestMarkdownPlugins", () => { + it("renders GitHub emoji shortcodes in prose and leaves code literal", () => { + const processor = unified() + .use(remarkParse) + .use( + pullRequestMarkdownPlugins({ + provider: "github", + url: "https://github.com/team/repo/pull/8", + }), + ); + const tree = processor.runSync(processor.parse("Ship it :tada: :+1: `:tada:`")) as Node; + const text = (node: Node): string => + (node.type === "inlineCode" ? `\`${node.value}\`` : (node.value ?? "")) + + (node.children ?? []).map(text).join(""); + expect(text(tree)).toBe("Ship it 🎉 👍 `:tada:`"); + }); +}); + describe("pullRequestCommentPreview", () => { it.each([ ["\n> [!WARNING]\n**Guard** [this](https://example.com).", "Guard this."], @@ -68,7 +90,9 @@ describe("pullRequestCommentPreview", () => { "Review :codex-file-citation{purpose='output'} safely.", ], [":codex-followup[Prepare **print** version]", ":codex-followup[Prepare **print** version]"], - ])("extracts readable text from %s", (body, expected) => { - expect(pullRequestCommentPreview(body)).toBe(expected); + ["Approved :thumbsup: `:warning:`", "Approved 👍 :warning:"], + ["Approved :thumbsup:", "Approved :thumbsup:", "gitlab"], + ])("extracts readable text from %s", (body, expected, provider = "github") => { + expect(pullRequestCommentPreview(body, provider)).toBe(expected); }); }); diff --git a/apps/web/src/components/pullRequest/pullRequestMarkdown.logic.ts b/apps/web/src/components/pullRequest/pullRequestMarkdown.logic.ts index 40dc1473660de..21f3574838e06 100644 --- a/apps/web/src/components/pullRequest/pullRequestMarkdown.logic.ts +++ b/apps/web/src/components/pullRequest/pullRequestMarkdown.logic.ts @@ -1,5 +1,6 @@ import { changeRequestReferenceAutolinker, + expandGithubEmojiAliases, resolveChangeRequestMediaUrl, } from "@t3tools/client-runtime/pull-request-markdown"; import { @@ -78,6 +79,16 @@ function remarkChangeRequestMediaUrls(options: { readonly changeRequestUrl: stri return (tree: MarkdownNode) => visit(tree); } +/** GitHub renders `:alias:` emoji in prose; code keeps them, being `inlineCode`/`code`, not `text`. */ +function remarkGithubEmoji() { + const visit = (node: MarkdownNode): void => { + if (node.type === "text" && node.value !== undefined) + node.value = expandGithubEmojiAliases(node.value); + node.children?.forEach(visit); + }; + return (tree: MarkdownNode) => visit(tree); +} + const NO_PLUGINS: PluggableList = []; const markdownPlugins = new Map(); @@ -97,18 +108,23 @@ export function pullRequestMarkdownPlugins( if (plugins === undefined) { const autolinks = changeRequestReferenceAutolinker(changeRequest); plugins = [[remarkChangeRequestMediaUrls, { changeRequestUrl: repositoryUrl }]]; + if (changeRequest.provider === "github") plugins.push(remarkGithubEmoji); if (autolinks) plugins.push([remarkPullRequestAutolinks, { autolinks }]); markdownPlugins.set(key, plugins); } return plugins; } -const commentPreviewProcessor = unified() - .use(remarkParse) - .use(CHAT_MARKDOWN_REMARK_PLUGINS) - .use(remarkRehype, { allowDangerousHtml: true }) - .use(CHAT_MARKDOWN_REHYPE_PLUGINS) - .freeze(); +const commentPreviewProcessor = (plugins: PluggableList) => + unified() + .use(remarkParse) + .use(CHAT_MARKDOWN_REMARK_PLUGINS) + .use(plugins) + .use(remarkRehype, { allowDangerousHtml: true }) + .use(CHAT_MARKDOWN_REHYPE_PLUGINS) + .freeze(); +const commentPreview = commentPreviewProcessor(NO_PLUGINS); +const githubCommentPreview = commentPreviewProcessor([remarkGithubEmoji]); const PREVIEW_BLOCK_TAGS = new Set([ "blockquote", @@ -147,7 +163,8 @@ function commentPreviewText(node: Nodes): string { return node.type === "element" && PREVIEW_BLOCK_TAGS.has(node.tagName) ? ` ${text} ` : text; } -export function pullRequestCommentPreview(body: string): string { - const tree = commentPreviewProcessor.runSync(commentPreviewProcessor.parse(body), body); +export function pullRequestCommentPreview(body: string, provider: string): string { + const processor = provider === "github" ? githubCommentPreview : commentPreview; + const tree = processor.runSync(processor.parse(body), body); return commentPreviewText(tree).replace(/\s+/gu, " ").trim(); } diff --git a/packages/client-runtime/src/githubEmojiAliases.ts b/packages/client-runtime/src/githubEmojiAliases.ts new file mode 100644 index 0000000000000..fe43c554fecf2 --- /dev/null +++ b/packages/client-runtime/src/githubEmojiAliases.ts @@ -0,0 +1,1917 @@ +// GitHub's `:alias:` emoji, one `alias emoji` pair per line, from github/gemoji db/emoji.json at +// fadaeaf1f1a9be82b321316a6c5502e43138b2f6 (MIT, Copyright (c) 2019 GitHub, Inc.). +export const GITHUB_EMOJI_ALIASES = ` +grinning 😀 +smiley 😃 +smile 😄 +grin 😁 +laughing 😆 +satisfied 😆 +sweat_smile 😅 +rofl 🤣 +joy 😂 +slightly_smiling_face 🙂 +upside_down_face 🙃 +melting_face 🫠 +wink 😉 +blush 😊 +innocent 😇 +smiling_face_with_three_hearts 🥰 +heart_eyes 😍 +star_struck 🤩 +kissing_heart 😘 +kissing 😗 +relaxed ☺️ +kissing_closed_eyes 😚 +kissing_smiling_eyes 😙 +smiling_face_with_tear 🥲 +yum 😋 +stuck_out_tongue 😛 +stuck_out_tongue_winking_eye 😜 +zany_face 🤪 +stuck_out_tongue_closed_eyes 😝 +money_mouth_face 🤑 +hugs 🤗 +hand_over_mouth 🤭 +face_with_open_eyes_and_hand_over_mouth 🫢 +face_with_peeking_eye 🫣 +shushing_face 🤫 +thinking 🤔 +saluting_face 🫡 +zipper_mouth_face 🤐 +raised_eyebrow 🤨 +neutral_face 😐 +expressionless 😑 +no_mouth 😶 +dotted_line_face 🫥 +face_in_clouds 😶‍🌫️ +smirk 😏 +unamused 😒 +roll_eyes 🙄 +grimacing 😬 +face_exhaling 😮‍💨 +lying_face 🤥 +shaking_face 🫨 +relieved 😌 +pensive 😔 +sleepy 😪 +drooling_face 🤤 +sleeping 😴 +mask 😷 +face_with_thermometer 🤒 +face_with_head_bandage 🤕 +nauseated_face 🤢 +vomiting_face 🤮 +sneezing_face 🤧 +hot_face 🥵 +cold_face 🥶 +woozy_face 🥴 +dizzy_face 😵 +face_with_spiral_eyes 😵‍💫 +exploding_head 🤯 +cowboy_hat_face 🤠 +partying_face 🥳 +disguised_face 🥸 +sunglasses 😎 +nerd_face 🤓 +monocle_face 🧐 +confused 😕 +face_with_diagonal_mouth 🫤 +worried 😟 +slightly_frowning_face 🙁 +frowning_face ☹️ +open_mouth 😮 +hushed 😯 +astonished 😲 +flushed 😳 +pleading_face 🥺 +face_holding_back_tears 🥹 +frowning 😦 +anguished 😧 +fearful 😨 +cold_sweat 😰 +disappointed_relieved 😥 +cry 😢 +sob 😭 +scream 😱 +confounded 😖 +persevere 😣 +disappointed 😞 +sweat 😓 +weary 😩 +tired_face 😫 +yawning_face 🥱 +triumph 😤 +rage 😡 +pout 😡 +angry 😠 +cursing_face 🤬 +smiling_imp 😈 +imp 👿 +skull 💀 +skull_and_crossbones ☠️ +hankey 💩 +poop 💩 +shit 💩 +clown_face 🤡 +japanese_ogre 👹 +japanese_goblin 👺 +ghost 👻 +alien 👽 +space_invader 👾 +robot 🤖 +smiley_cat 😺 +smile_cat 😸 +joy_cat 😹 +heart_eyes_cat 😻 +smirk_cat 😼 +kissing_cat 😽 +scream_cat 🙀 +crying_cat_face 😿 +pouting_cat 😾 +see_no_evil 🙈 +hear_no_evil 🙉 +speak_no_evil 🙊 +love_letter 💌 +cupid 💘 +gift_heart 💝 +sparkling_heart 💖 +heartpulse 💗 +heartbeat 💓 +revolving_hearts 💞 +two_hearts 💕 +heart_decoration 💟 +heavy_heart_exclamation ❣️ +broken_heart 💔 +heart_on_fire ❤️‍🔥 +mending_heart ❤️‍🩹 +heart ❤️ +pink_heart 🩷 +orange_heart 🧡 +yellow_heart 💛 +green_heart 💚 +blue_heart 💙 +light_blue_heart 🩵 +purple_heart 💜 +brown_heart 🤎 +black_heart 🖤 +grey_heart 🩶 +white_heart 🤍 +kiss 💋 +100 💯 +anger 💢 +boom 💥 +collision 💥 +dizzy 💫 +sweat_drops 💦 +dash 💨 +hole 🕳️ +speech_balloon 💬 +eye_speech_bubble 👁️‍🗨️ +left_speech_bubble 🗨️ +right_anger_bubble 🗯️ +thought_balloon 💭 +zzz 💤 +wave 👋 +raised_back_of_hand 🤚 +raised_hand_with_fingers_splayed 🖐️ +hand ✋ +raised_hand ✋ +vulcan_salute 🖖 +rightwards_hand 🫱 +leftwards_hand 🫲 +palm_down_hand 🫳 +palm_up_hand 🫴 +leftwards_pushing_hand 🫷 +rightwards_pushing_hand 🫸 +ok_hand 👌 +pinched_fingers 🤌 +pinching_hand 🤏 +v ✌️ +crossed_fingers 🤞 +hand_with_index_finger_and_thumb_crossed 🫰 +love_you_gesture 🤟 +metal 🤘 +call_me_hand 🤙 +point_left 👈 +point_right 👉 +point_up_2 👆 +middle_finger 🖕 +fu 🖕 +point_down 👇 +point_up ☝️ +index_pointing_at_the_viewer 🫵 ++1 👍 +thumbsup 👍 +-1 👎 +thumbsdown 👎 +fist_raised ✊ +fist ✊ +fist_oncoming 👊 +facepunch 👊 +punch 👊 +fist_left 🤛 +fist_right 🤜 +clap 👏 +raised_hands 🙌 +heart_hands 🫶 +open_hands 👐 +palms_up_together 🤲 +handshake 🤝 +pray 🙏 +writing_hand ✍️ +nail_care 💅 +selfie 🤳 +muscle 💪 +mechanical_arm 🦾 +mechanical_leg 🦿 +leg 🦵 +foot 🦶 +ear 👂 +ear_with_hearing_aid 🦻 +nose 👃 +brain 🧠 +anatomical_heart 🫀 +lungs 🫁 +tooth 🦷 +bone 🦴 +eyes 👀 +eye 👁️ +tongue 👅 +lips 👄 +biting_lip 🫦 +baby 👶 +child 🧒 +boy 👦 +girl 👧 +adult 🧑 +blond_haired_person 👱 +man 👨 +bearded_person 🧔 +man_beard 🧔‍♂️ +woman_beard 🧔‍♀️ +red_haired_man 👨‍🦰 +curly_haired_man 👨‍🦱 +white_haired_man 👨‍🦳 +bald_man 👨‍🦲 +woman 👩 +red_haired_woman 👩‍🦰 +person_red_hair 🧑‍🦰 +curly_haired_woman 👩‍🦱 +person_curly_hair 🧑‍🦱 +white_haired_woman 👩‍🦳 +person_white_hair 🧑‍🦳 +bald_woman 👩‍🦲 +person_bald 🧑‍🦲 +blond_haired_woman 👱‍♀️ +blonde_woman 👱‍♀️ +blond_haired_man 👱‍♂️ +older_adult 🧓 +older_man 👴 +older_woman 👵 +frowning_person 🙍 +frowning_man 🙍‍♂️ +frowning_woman 🙍‍♀️ +pouting_face 🙎 +pouting_man 🙎‍♂️ +pouting_woman 🙎‍♀️ +no_good 🙅 +no_good_man 🙅‍♂️ +ng_man 🙅‍♂️ +no_good_woman 🙅‍♀️ +ng_woman 🙅‍♀️ +ok_person 🙆 +ok_man 🙆‍♂️ +ok_woman 🙆‍♀️ +tipping_hand_person 💁 +information_desk_person 💁 +tipping_hand_man 💁‍♂️ +sassy_man 💁‍♂️ +tipping_hand_woman 💁‍♀️ +sassy_woman 💁‍♀️ +raising_hand 🙋 +raising_hand_man 🙋‍♂️ +raising_hand_woman 🙋‍♀️ +deaf_person 🧏 +deaf_man 🧏‍♂️ +deaf_woman 🧏‍♀️ +bow 🙇 +bowing_man 🙇‍♂️ +bowing_woman 🙇‍♀️ +facepalm 🤦 +man_facepalming 🤦‍♂️ +woman_facepalming 🤦‍♀️ +shrug 🤷 +man_shrugging 🤷‍♂️ +woman_shrugging 🤷‍♀️ +health_worker 🧑‍⚕️ +man_health_worker 👨‍⚕️ +woman_health_worker 👩‍⚕️ +student 🧑‍🎓 +man_student 👨‍🎓 +woman_student 👩‍🎓 +teacher 🧑‍🏫 +man_teacher 👨‍🏫 +woman_teacher 👩‍🏫 +judge 🧑‍⚖️ +man_judge 👨‍⚖️ +woman_judge 👩‍⚖️ +farmer 🧑‍🌾 +man_farmer 👨‍🌾 +woman_farmer 👩‍🌾 +cook 🧑‍🍳 +man_cook 👨‍🍳 +woman_cook 👩‍🍳 +mechanic 🧑‍🔧 +man_mechanic 👨‍🔧 +woman_mechanic 👩‍🔧 +factory_worker 🧑‍🏭 +man_factory_worker 👨‍🏭 +woman_factory_worker 👩‍🏭 +office_worker 🧑‍💼 +man_office_worker 👨‍💼 +woman_office_worker 👩‍💼 +scientist 🧑‍🔬 +man_scientist 👨‍🔬 +woman_scientist 👩‍🔬 +technologist 🧑‍💻 +man_technologist 👨‍💻 +woman_technologist 👩‍💻 +singer 🧑‍🎤 +man_singer 👨‍🎤 +woman_singer 👩‍🎤 +artist 🧑‍🎨 +man_artist 👨‍🎨 +woman_artist 👩‍🎨 +pilot 🧑‍✈️ +man_pilot 👨‍✈️ +woman_pilot 👩‍✈️ +astronaut 🧑‍🚀 +man_astronaut 👨‍🚀 +woman_astronaut 👩‍🚀 +firefighter 🧑‍🚒 +man_firefighter 👨‍🚒 +woman_firefighter 👩‍🚒 +police_officer 👮 +cop 👮 +policeman 👮‍♂️ +policewoman 👮‍♀️ +detective 🕵️ +male_detective 🕵️‍♂️ +female_detective 🕵️‍♀️ +guard 💂 +guardsman 💂‍♂️ +guardswoman 💂‍♀️ +ninja 🥷 +construction_worker 👷 +construction_worker_man 👷‍♂️ +construction_worker_woman 👷‍♀️ +person_with_crown 🫅 +prince 🤴 +princess 👸 +person_with_turban 👳 +man_with_turban 👳‍♂️ +woman_with_turban 👳‍♀️ +man_with_gua_pi_mao 👲 +woman_with_headscarf 🧕 +person_in_tuxedo 🤵 +man_in_tuxedo 🤵‍♂️ +woman_in_tuxedo 🤵‍♀️ +person_with_veil 👰 +man_with_veil 👰‍♂️ +woman_with_veil 👰‍♀️ +bride_with_veil 👰‍♀️ +pregnant_woman 🤰 +pregnant_man 🫃 +pregnant_person 🫄 +breast_feeding 🤱 +woman_feeding_baby 👩‍🍼 +man_feeding_baby 👨‍🍼 +person_feeding_baby 🧑‍🍼 +angel 👼 +santa 🎅 +mrs_claus 🤶 +mx_claus 🧑‍🎄 +superhero 🦸 +superhero_man 🦸‍♂️ +superhero_woman 🦸‍♀️ +supervillain 🦹 +supervillain_man 🦹‍♂️ +supervillain_woman 🦹‍♀️ +mage 🧙 +mage_man 🧙‍♂️ +mage_woman 🧙‍♀️ +fairy 🧚 +fairy_man 🧚‍♂️ +fairy_woman 🧚‍♀️ +vampire 🧛 +vampire_man 🧛‍♂️ +vampire_woman 🧛‍♀️ +merperson 🧜 +merman 🧜‍♂️ +mermaid 🧜‍♀️ +elf 🧝 +elf_man 🧝‍♂️ +elf_woman 🧝‍♀️ +genie 🧞 +genie_man 🧞‍♂️ +genie_woman 🧞‍♀️ +zombie 🧟 +zombie_man 🧟‍♂️ +zombie_woman 🧟‍♀️ +troll 🧌 +massage 💆 +massage_man 💆‍♂️ +massage_woman 💆‍♀️ +haircut 💇 +haircut_man 💇‍♂️ +haircut_woman 💇‍♀️ +walking 🚶 +walking_man 🚶‍♂️ +walking_woman 🚶‍♀️ +standing_person 🧍 +standing_man 🧍‍♂️ +standing_woman 🧍‍♀️ +kneeling_person 🧎 +kneeling_man 🧎‍♂️ +kneeling_woman 🧎‍♀️ +person_with_probing_cane 🧑‍🦯 +man_with_probing_cane 👨‍🦯 +woman_with_probing_cane 👩‍🦯 +person_in_motorized_wheelchair 🧑‍🦼 +man_in_motorized_wheelchair 👨‍🦼 +woman_in_motorized_wheelchair 👩‍🦼 +person_in_manual_wheelchair 🧑‍🦽 +man_in_manual_wheelchair 👨‍🦽 +woman_in_manual_wheelchair 👩‍🦽 +runner 🏃 +running 🏃 +running_man 🏃‍♂️ +running_woman 🏃‍♀️ +woman_dancing 💃 +dancer 💃 +man_dancing 🕺 +business_suit_levitating 🕴️ +dancers 👯 +dancing_men 👯‍♂️ +dancing_women 👯‍♀️ +sauna_person 🧖 +sauna_man 🧖‍♂️ +sauna_woman 🧖‍♀️ +climbing 🧗 +climbing_man 🧗‍♂️ +climbing_woman 🧗‍♀️ +person_fencing 🤺 +horse_racing 🏇 +skier ⛷️ +snowboarder 🏂 +golfing 🏌️ +golfing_man 🏌️‍♂️ +golfing_woman 🏌️‍♀️ +surfer 🏄 +surfing_man 🏄‍♂️ +surfing_woman 🏄‍♀️ +rowboat 🚣 +rowing_man 🚣‍♂️ +rowing_woman 🚣‍♀️ +swimmer 🏊 +swimming_man 🏊‍♂️ +swimming_woman 🏊‍♀️ +bouncing_ball_person ⛹️ +bouncing_ball_man ⛹️‍♂️ +basketball_man ⛹️‍♂️ +bouncing_ball_woman ⛹️‍♀️ +basketball_woman ⛹️‍♀️ +weight_lifting 🏋️ +weight_lifting_man 🏋️‍♂️ +weight_lifting_woman 🏋️‍♀️ +bicyclist 🚴 +biking_man 🚴‍♂️ +biking_woman 🚴‍♀️ +mountain_bicyclist 🚵 +mountain_biking_man 🚵‍♂️ +mountain_biking_woman 🚵‍♀️ +cartwheeling 🤸 +man_cartwheeling 🤸‍♂️ +woman_cartwheeling 🤸‍♀️ +wrestling 🤼 +men_wrestling 🤼‍♂️ +women_wrestling 🤼‍♀️ +water_polo 🤽 +man_playing_water_polo 🤽‍♂️ +woman_playing_water_polo 🤽‍♀️ +handball_person 🤾 +man_playing_handball 🤾‍♂️ +woman_playing_handball 🤾‍♀️ +juggling_person 🤹 +man_juggling 🤹‍♂️ +woman_juggling 🤹‍♀️ +lotus_position 🧘 +lotus_position_man 🧘‍♂️ +lotus_position_woman 🧘‍♀️ +bath 🛀 +sleeping_bed 🛌 +people_holding_hands 🧑‍🤝‍🧑 +two_women_holding_hands 👭 +couple 👫 +two_men_holding_hands 👬 +couplekiss 💏 +couplekiss_man_woman 👩‍❤️‍💋‍👨 +couplekiss_man_man 👨‍❤️‍💋‍👨 +couplekiss_woman_woman 👩‍❤️‍💋‍👩 +couple_with_heart 💑 +couple_with_heart_woman_man 👩‍❤️‍👨 +couple_with_heart_man_man 👨‍❤️‍👨 +couple_with_heart_woman_woman 👩‍❤️‍👩 +family 👪 +family_man_woman_boy 👨‍👩‍👦 +family_man_woman_girl 👨‍👩‍👧 +family_man_woman_girl_boy 👨‍👩‍👧‍👦 +family_man_woman_boy_boy 👨‍👩‍👦‍👦 +family_man_woman_girl_girl 👨‍👩‍👧‍👧 +family_man_man_boy 👨‍👨‍👦 +family_man_man_girl 👨‍👨‍👧 +family_man_man_girl_boy 👨‍👨‍👧‍👦 +family_man_man_boy_boy 👨‍👨‍👦‍👦 +family_man_man_girl_girl 👨‍👨‍👧‍👧 +family_woman_woman_boy 👩‍👩‍👦 +family_woman_woman_girl 👩‍👩‍👧 +family_woman_woman_girl_boy 👩‍👩‍👧‍👦 +family_woman_woman_boy_boy 👩‍👩‍👦‍👦 +family_woman_woman_girl_girl 👩‍👩‍👧‍👧 +family_man_boy 👨‍👦 +family_man_boy_boy 👨‍👦‍👦 +family_man_girl 👨‍👧 +family_man_girl_boy 👨‍👧‍👦 +family_man_girl_girl 👨‍👧‍👧 +family_woman_boy 👩‍👦 +family_woman_boy_boy 👩‍👦‍👦 +family_woman_girl 👩‍👧 +family_woman_girl_boy 👩‍👧‍👦 +family_woman_girl_girl 👩‍👧‍👧 +speaking_head 🗣️ +bust_in_silhouette 👤 +busts_in_silhouette 👥 +people_hugging 🫂 +footprints 👣 +monkey_face 🐵 +monkey 🐒 +gorilla 🦍 +orangutan 🦧 +dog 🐶 +dog2 🐕 +guide_dog 🦮 +service_dog 🐕‍🦺 +poodle 🐩 +wolf 🐺 +fox_face 🦊 +raccoon 🦝 +cat 🐱 +cat2 🐈 +black_cat 🐈‍⬛ +lion 🦁 +tiger 🐯 +tiger2 🐅 +leopard 🐆 +horse 🐴 +moose 🫎 +donkey 🫏 +racehorse 🐎 +unicorn 🦄 +zebra 🦓 +deer 🦌 +bison 🦬 +cow 🐮 +ox 🐂 +water_buffalo 🐃 +cow2 🐄 +pig 🐷 +pig2 🐖 +boar 🐗 +pig_nose 🐽 +ram 🐏 +sheep 🐑 +goat 🐐 +dromedary_camel 🐪 +camel 🐫 +llama 🦙 +giraffe 🦒 +elephant 🐘 +mammoth 🦣 +rhinoceros 🦏 +hippopotamus 🦛 +mouse 🐭 +mouse2 🐁 +rat 🐀 +hamster 🐹 +rabbit 🐰 +rabbit2 🐇 +chipmunk 🐿️ +beaver 🦫 +hedgehog 🦔 +bat 🦇 +bear 🐻 +polar_bear 🐻‍❄️ +koala 🐨 +panda_face 🐼 +sloth 🦥 +otter 🦦 +skunk 🦨 +kangaroo 🦘 +badger 🦡 +feet 🐾 +paw_prints 🐾 +turkey 🦃 +chicken 🐔 +rooster 🐓 +hatching_chick 🐣 +baby_chick 🐤 +hatched_chick 🐥 +bird 🐦 +penguin 🐧 +dove 🕊️ +eagle 🦅 +duck 🦆 +swan 🦢 +owl 🦉 +dodo 🦤 +feather 🪶 +flamingo 🦩 +peacock 🦚 +parrot 🦜 +wing 🪽 +black_bird 🐦‍⬛ +goose 🪿 +frog 🐸 +crocodile 🐊 +turtle 🐢 +lizard 🦎 +snake 🐍 +dragon_face 🐲 +dragon 🐉 +sauropod 🦕 +t-rex 🦖 +whale 🐳 +whale2 🐋 +dolphin 🐬 +flipper 🐬 +seal 🦭 +fish 🐟 +tropical_fish 🐠 +blowfish 🐡 +shark 🦈 +octopus 🐙 +shell 🐚 +coral 🪸 +jellyfish 🪼 +snail 🐌 +butterfly 🦋 +bug 🐛 +ant 🐜 +bee 🐝 +honeybee 🐝 +beetle 🪲 +lady_beetle 🐞 +cricket 🦗 +cockroach 🪳 +spider 🕷️ +spider_web 🕸️ +scorpion 🦂 +mosquito 🦟 +fly 🪰 +worm 🪱 +microbe 🦠 +bouquet 💐 +cherry_blossom 🌸 +white_flower 💮 +lotus 🪷 +rosette 🏵️ +rose 🌹 +wilted_flower 🥀 +hibiscus 🌺 +sunflower 🌻 +blossom 🌼 +tulip 🌷 +hyacinth 🪻 +seedling 🌱 +potted_plant 🪴 +evergreen_tree 🌲 +deciduous_tree 🌳 +palm_tree 🌴 +cactus 🌵 +ear_of_rice 🌾 +herb 🌿 +shamrock ☘️ +four_leaf_clover 🍀 +maple_leaf 🍁 +fallen_leaf 🍂 +leaves 🍃 +empty_nest 🪹 +nest_with_eggs 🪺 +mushroom 🍄 +grapes 🍇 +melon 🍈 +watermelon 🍉 +tangerine 🍊 +orange 🍊 +mandarin 🍊 +lemon 🍋 +banana 🍌 +pineapple 🍍 +mango 🥭 +apple 🍎 +green_apple 🍏 +pear 🍐 +peach 🍑 +cherries 🍒 +strawberry 🍓 +blueberries 🫐 +kiwi_fruit 🥝 +tomato 🍅 +olive 🫒 +coconut 🥥 +avocado 🥑 +eggplant 🍆 +potato 🥔 +carrot 🥕 +corn 🌽 +hot_pepper 🌶️ +bell_pepper 🫑 +cucumber 🥒 +leafy_green 🥬 +broccoli 🥦 +garlic 🧄 +onion 🧅 +peanuts 🥜 +beans 🫘 +chestnut 🌰 +ginger_root 🫚 +pea_pod 🫛 +bread 🍞 +croissant 🥐 +baguette_bread 🥖 +flatbread 🫓 +pretzel 🥨 +bagel 🥯 +pancakes 🥞 +waffle 🧇 +cheese 🧀 +meat_on_bone 🍖 +poultry_leg 🍗 +cut_of_meat 🥩 +bacon 🥓 +hamburger 🍔 +fries 🍟 +pizza 🍕 +hotdog 🌭 +sandwich 🥪 +taco 🌮 +burrito 🌯 +tamale 🫔 +stuffed_flatbread 🥙 +falafel 🧆 +egg 🥚 +fried_egg 🍳 +shallow_pan_of_food 🥘 +stew 🍲 +fondue 🫕 +bowl_with_spoon 🥣 +green_salad 🥗 +popcorn 🍿 +butter 🧈 +salt 🧂 +canned_food 🥫 +bento 🍱 +rice_cracker 🍘 +rice_ball 🍙 +rice 🍚 +curry 🍛 +ramen 🍜 +spaghetti 🍝 +sweet_potato 🍠 +oden 🍢 +sushi 🍣 +fried_shrimp 🍤 +fish_cake 🍥 +moon_cake 🥮 +dango 🍡 +dumpling 🥟 +fortune_cookie 🥠 +takeout_box 🥡 +crab 🦀 +lobster 🦞 +shrimp 🦐 +squid 🦑 +oyster 🦪 +icecream 🍦 +shaved_ice 🍧 +ice_cream 🍨 +doughnut 🍩 +cookie 🍪 +birthday 🎂 +cake 🍰 +cupcake 🧁 +pie 🥧 +chocolate_bar 🍫 +candy 🍬 +lollipop 🍭 +custard 🍮 +honey_pot 🍯 +baby_bottle 🍼 +milk_glass 🥛 +coffee ☕ +teapot 🫖 +tea 🍵 +sake 🍶 +champagne 🍾 +wine_glass 🍷 +cocktail 🍸 +tropical_drink 🍹 +beer 🍺 +beers 🍻 +clinking_glasses 🥂 +tumbler_glass 🥃 +pouring_liquid 🫗 +cup_with_straw 🥤 +bubble_tea 🧋 +beverage_box 🧃 +mate 🧉 +ice_cube 🧊 +chopsticks 🥢 +plate_with_cutlery 🍽️ +fork_and_knife 🍴 +spoon 🥄 +hocho 🔪 +knife 🔪 +jar 🫙 +amphora 🏺 +earth_africa 🌍 +earth_americas 🌎 +earth_asia 🌏 +globe_with_meridians 🌐 +world_map 🗺️ +japan 🗾 +compass 🧭 +mountain_snow 🏔️ +mountain ⛰️ +volcano 🌋 +mount_fuji 🗻 +camping 🏕️ +beach_umbrella 🏖️ +desert 🏜️ +desert_island 🏝️ +national_park 🏞️ +stadium 🏟️ +classical_building 🏛️ +building_construction 🏗️ +bricks 🧱 +rock 🪨 +wood 🪵 +hut 🛖 +houses 🏘️ +derelict_house 🏚️ +house 🏠 +house_with_garden 🏡 +office 🏢 +post_office 🏣 +european_post_office 🏤 +hospital 🏥 +bank 🏦 +hotel 🏨 +love_hotel 🏩 +convenience_store 🏪 +school 🏫 +department_store 🏬 +factory 🏭 +japanese_castle 🏯 +european_castle 🏰 +wedding 💒 +tokyo_tower 🗼 +statue_of_liberty 🗽 +church ⛪ +mosque 🕌 +hindu_temple 🛕 +synagogue 🕍 +shinto_shrine ⛩️ +kaaba 🕋 +fountain ⛲ +tent ⛺ +foggy 🌁 +night_with_stars 🌃 +cityscape 🏙️ +sunrise_over_mountains 🌄 +sunrise 🌅 +city_sunset 🌆 +city_sunrise 🌇 +bridge_at_night 🌉 +hotsprings ♨️ +carousel_horse 🎠 +playground_slide 🛝 +ferris_wheel 🎡 +roller_coaster 🎢 +barber 💈 +circus_tent 🎪 +steam_locomotive 🚂 +railway_car 🚃 +bullettrain_side 🚄 +bullettrain_front 🚅 +train2 🚆 +metro 🚇 +light_rail 🚈 +station 🚉 +tram 🚊 +monorail 🚝 +mountain_railway 🚞 +train 🚋 +bus 🚌 +oncoming_bus 🚍 +trolleybus 🚎 +minibus 🚐 +ambulance 🚑 +fire_engine 🚒 +police_car 🚓 +oncoming_police_car 🚔 +taxi 🚕 +oncoming_taxi 🚖 +car 🚗 +red_car 🚗 +oncoming_automobile 🚘 +blue_car 🚙 +pickup_truck 🛻 +truck 🚚 +articulated_lorry 🚛 +tractor 🚜 +racing_car 🏎️ +motorcycle 🏍️ +motor_scooter 🛵 +manual_wheelchair 🦽 +motorized_wheelchair 🦼 +auto_rickshaw 🛺 +bike 🚲 +kick_scooter 🛴 +skateboard 🛹 +roller_skate 🛼 +busstop 🚏 +motorway 🛣️ +railway_track 🛤️ +oil_drum 🛢️ +fuelpump ⛽ +wheel 🛞 +rotating_light 🚨 +traffic_light 🚥 +vertical_traffic_light 🚦 +stop_sign 🛑 +construction 🚧 +anchor ⚓ +ring_buoy 🛟 +boat ⛵ +sailboat ⛵ +canoe 🛶 +speedboat 🚤 +passenger_ship 🛳️ +ferry ⛴️ +motor_boat 🛥️ +ship 🚢 +airplane ✈️ +small_airplane 🛩️ +flight_departure 🛫 +flight_arrival 🛬 +parachute 🪂 +seat 💺 +helicopter 🚁 +suspension_railway 🚟 +mountain_cableway 🚠 +aerial_tramway 🚡 +artificial_satellite 🛰️ +rocket 🚀 +flying_saucer 🛸 +bellhop_bell 🛎️ +luggage 🧳 +hourglass ⌛ +hourglass_flowing_sand ⏳ +watch ⌚ +alarm_clock ⏰ +stopwatch ⏱️ +timer_clock ⏲️ +mantelpiece_clock 🕰️ +clock12 🕛 +clock1230 🕧 +clock1 🕐 +clock130 🕜 +clock2 🕑 +clock230 🕝 +clock3 🕒 +clock330 🕞 +clock4 🕓 +clock430 🕟 +clock5 🕔 +clock530 🕠 +clock6 🕕 +clock630 🕡 +clock7 🕖 +clock730 🕢 +clock8 🕗 +clock830 🕣 +clock9 🕘 +clock930 🕤 +clock10 🕙 +clock1030 🕥 +clock11 🕚 +clock1130 🕦 +new_moon 🌑 +waxing_crescent_moon 🌒 +first_quarter_moon 🌓 +moon 🌔 +waxing_gibbous_moon 🌔 +full_moon 🌕 +waning_gibbous_moon 🌖 +last_quarter_moon 🌗 +waning_crescent_moon 🌘 +crescent_moon 🌙 +new_moon_with_face 🌚 +first_quarter_moon_with_face 🌛 +last_quarter_moon_with_face 🌜 +thermometer 🌡️ +sunny ☀️ +full_moon_with_face 🌝 +sun_with_face 🌞 +ringed_planet 🪐 +star ⭐ +star2 🌟 +stars 🌠 +milky_way 🌌 +cloud ☁️ +partly_sunny ⛅ +cloud_with_lightning_and_rain ⛈️ +sun_behind_small_cloud 🌤️ +sun_behind_large_cloud 🌥️ +sun_behind_rain_cloud 🌦️ +cloud_with_rain 🌧️ +cloud_with_snow 🌨️ +cloud_with_lightning 🌩️ +tornado 🌪️ +fog 🌫️ +wind_face 🌬️ +cyclone 🌀 +rainbow 🌈 +closed_umbrella 🌂 +open_umbrella ☂️ +umbrella ☔ +parasol_on_ground ⛱️ +zap ⚡ +snowflake ❄️ +snowman_with_snow ☃️ +snowman ⛄ +comet ☄️ +fire 🔥 +droplet 💧 +ocean 🌊 +jack_o_lantern 🎃 +christmas_tree 🎄 +fireworks 🎆 +sparkler 🎇 +firecracker 🧨 +sparkles ✨ +balloon 🎈 +tada 🎉 +confetti_ball 🎊 +tanabata_tree 🎋 +bamboo 🎍 +dolls 🎎 +flags 🎏 +wind_chime 🎐 +rice_scene 🎑 +red_envelope 🧧 +ribbon 🎀 +gift 🎁 +reminder_ribbon 🎗️ +tickets 🎟️ +ticket 🎫 +medal_military 🎖️ +trophy 🏆 +medal_sports 🏅 +1st_place_medal 🥇 +2nd_place_medal 🥈 +3rd_place_medal 🥉 +soccer ⚽ +baseball ⚾ +softball 🥎 +basketball 🏀 +volleyball 🏐 +football 🏈 +rugby_football 🏉 +tennis 🎾 +flying_disc 🥏 +bowling 🎳 +cricket_game 🏏 +field_hockey 🏑 +ice_hockey 🏒 +lacrosse 🥍 +ping_pong 🏓 +badminton 🏸 +boxing_glove 🥊 +martial_arts_uniform 🥋 +goal_net 🥅 +golf ⛳ +ice_skate ⛸️ +fishing_pole_and_fish 🎣 +diving_mask 🤿 +running_shirt_with_sash 🎽 +ski 🎿 +sled 🛷 +curling_stone 🥌 +dart 🎯 +yo_yo 🪀 +kite 🪁 +gun 🔫 +8ball 🎱 +crystal_ball 🔮 +magic_wand 🪄 +video_game 🎮 +joystick 🕹️ +slot_machine 🎰 +game_die 🎲 +jigsaw 🧩 +teddy_bear 🧸 +pinata 🪅 +mirror_ball 🪩 +nesting_dolls 🪆 +spades ♠️ +hearts ♥️ +diamonds ♦️ +clubs ♣️ +chess_pawn ♟️ +black_joker 🃏 +mahjong 🀄 +flower_playing_cards 🎴 +performing_arts 🎭 +framed_picture 🖼️ +art 🎨 +thread 🧵 +sewing_needle 🪡 +yarn 🧶 +knot 🪢 +eyeglasses 👓 +dark_sunglasses 🕶️ +goggles 🥽 +lab_coat 🥼 +safety_vest 🦺 +necktie 👔 +shirt 👕 +tshirt 👕 +jeans 👖 +scarf 🧣 +gloves 🧤 +coat 🧥 +socks 🧦 +dress 👗 +kimono 👘 +sari 🥻 +one_piece_swimsuit 🩱 +swim_brief 🩲 +shorts 🩳 +bikini 👙 +womans_clothes 👚 +folding_hand_fan 🪭 +purse 👛 +handbag 👜 +pouch 👝 +shopping 🛍️ +school_satchel 🎒 +thong_sandal 🩴 +mans_shoe 👞 +shoe 👞 +athletic_shoe 👟 +hiking_boot 🥾 +flat_shoe 🥿 +high_heel 👠 +sandal 👡 +ballet_shoes 🩰 +boot 👢 +hair_pick 🪮 +crown 👑 +womans_hat 👒 +tophat 🎩 +mortar_board 🎓 +billed_cap 🧢 +military_helmet 🪖 +rescue_worker_helmet ⛑️ +prayer_beads 📿 +lipstick 💄 +ring 💍 +gem 💎 +mute 🔇 +speaker 🔈 +sound 🔉 +loud_sound 🔊 +loudspeaker 📢 +mega 📣 +postal_horn 📯 +bell 🔔 +no_bell 🔕 +musical_score 🎼 +musical_note 🎵 +notes 🎶 +studio_microphone 🎙️ +level_slider 🎚️ +control_knobs 🎛️ +microphone 🎤 +headphones 🎧 +radio 📻 +saxophone 🎷 +accordion 🪗 +guitar 🎸 +musical_keyboard 🎹 +trumpet 🎺 +violin 🎻 +banjo 🪕 +drum 🥁 +long_drum 🪘 +maracas 🪇 +flute 🪈 +iphone 📱 +calling 📲 +phone ☎️ +telephone ☎️ +telephone_receiver 📞 +pager 📟 +fax 📠 +battery 🔋 +low_battery 🪫 +electric_plug 🔌 +computer 💻 +desktop_computer 🖥️ +printer 🖨️ +keyboard ⌨️ +computer_mouse 🖱️ +trackball 🖲️ +minidisc 💽 +floppy_disk 💾 +cd 💿 +dvd 📀 +abacus 🧮 +movie_camera 🎥 +film_strip 🎞️ +film_projector 📽️ +clapper 🎬 +tv 📺 +camera 📷 +camera_flash 📸 +video_camera 📹 +vhs 📼 +mag 🔍 +mag_right 🔎 +candle 🕯️ +bulb 💡 +flashlight 🔦 +izakaya_lantern 🏮 +lantern 🏮 +diya_lamp 🪔 +notebook_with_decorative_cover 📔 +closed_book 📕 +book 📖 +open_book 📖 +green_book 📗 +blue_book 📘 +orange_book 📙 +books 📚 +notebook 📓 +ledger 📒 +page_with_curl 📃 +scroll 📜 +page_facing_up 📄 +newspaper 📰 +newspaper_roll 🗞️ +bookmark_tabs 📑 +bookmark 🔖 +label 🏷️ +moneybag 💰 +coin 🪙 +yen 💴 +dollar 💵 +euro 💶 +pound 💷 +money_with_wings 💸 +credit_card 💳 +receipt 🧾 +chart 💹 +envelope ✉️ +email 📧 +e-mail 📧 +incoming_envelope 📨 +envelope_with_arrow 📩 +outbox_tray 📤 +inbox_tray 📥 +package 📦 +mailbox 📫 +mailbox_closed 📪 +mailbox_with_mail 📬 +mailbox_with_no_mail 📭 +postbox 📮 +ballot_box 🗳️ +pencil2 ✏️ +black_nib ✒️ +fountain_pen 🖋️ +pen 🖊️ +paintbrush 🖌️ +crayon 🖍️ +memo 📝 +pencil 📝 +briefcase 💼 +file_folder 📁 +open_file_folder 📂 +card_index_dividers 🗂️ +date 📅 +calendar 📆 +spiral_notepad 🗒️ +spiral_calendar 🗓️ +card_index 📇 +chart_with_upwards_trend 📈 +chart_with_downwards_trend 📉 +bar_chart 📊 +clipboard 📋 +pushpin 📌 +round_pushpin 📍 +paperclip 📎 +paperclips 🖇️ +straight_ruler 📏 +triangular_ruler 📐 +scissors ✂️ +card_file_box 🗃️ +file_cabinet 🗄️ +wastebasket 🗑️ +lock 🔒 +unlock 🔓 +lock_with_ink_pen 🔏 +closed_lock_with_key 🔐 +key 🔑 +old_key 🗝️ +hammer 🔨 +axe 🪓 +pick ⛏️ +hammer_and_pick ⚒️ +hammer_and_wrench 🛠️ +dagger 🗡️ +crossed_swords ⚔️ +bomb 💣 +boomerang 🪃 +bow_and_arrow 🏹 +shield 🛡️ +carpentry_saw 🪚 +wrench 🔧 +screwdriver 🪛 +nut_and_bolt 🔩 +gear ⚙️ +clamp 🗜️ +balance_scale ⚖️ +probing_cane 🦯 +link 🔗 +chains ⛓️ +hook 🪝 +toolbox 🧰 +magnet 🧲 +ladder 🪜 +alembic ⚗️ +test_tube 🧪 +petri_dish 🧫 +dna 🧬 +microscope 🔬 +telescope 🔭 +satellite 📡 +syringe 💉 +drop_of_blood 🩸 +pill 💊 +adhesive_bandage 🩹 +crutch 🩼 +stethoscope 🩺 +x_ray 🩻 +door 🚪 +elevator 🛗 +mirror 🪞 +window 🪟 +bed 🛏️ +couch_and_lamp 🛋️ +chair 🪑 +toilet 🚽 +plunger 🪠 +shower 🚿 +bathtub 🛁 +mouse_trap 🪤 +razor 🪒 +lotion_bottle 🧴 +safety_pin 🧷 +broom 🧹 +basket 🧺 +roll_of_paper 🧻 +bucket 🪣 +soap 🧼 +bubbles 🫧 +toothbrush 🪥 +sponge 🧽 +fire_extinguisher 🧯 +shopping_cart 🛒 +smoking 🚬 +coffin ⚰️ +headstone 🪦 +funeral_urn ⚱️ +nazar_amulet 🧿 +hamsa 🪬 +moyai 🗿 +placard 🪧 +identification_card 🪪 +atm 🏧 +put_litter_in_its_place 🚮 +potable_water 🚰 +wheelchair ♿ +mens 🚹 +womens 🚺 +restroom 🚻 +baby_symbol 🚼 +wc 🚾 +passport_control 🛂 +customs 🛃 +baggage_claim 🛄 +left_luggage 🛅 +warning ⚠️ +children_crossing 🚸 +no_entry ⛔ +no_entry_sign 🚫 +no_bicycles 🚳 +no_smoking 🚭 +do_not_litter 🚯 +non-potable_water 🚱 +no_pedestrians 🚷 +no_mobile_phones 📵 +underage 🔞 +radioactive ☢️ +biohazard ☣️ +arrow_up ⬆️ +arrow_upper_right ↗️ +arrow_right ➡️ +arrow_lower_right ↘️ +arrow_down ⬇️ +arrow_lower_left ↙️ +arrow_left ⬅️ +arrow_upper_left ↖️ +arrow_up_down ↕️ +left_right_arrow ↔️ +leftwards_arrow_with_hook ↩️ +arrow_right_hook ↪️ +arrow_heading_up ⤴️ +arrow_heading_down ⤵️ +arrows_clockwise 🔃 +arrows_counterclockwise 🔄 +back 🔙 +end 🔚 +on 🔛 +soon 🔜 +top 🔝 +place_of_worship 🛐 +atom_symbol ⚛️ +om 🕉️ +star_of_david ✡️ +wheel_of_dharma ☸️ +yin_yang ☯️ +latin_cross ✝️ +orthodox_cross ☦️ +star_and_crescent ☪️ +peace_symbol ☮️ +menorah 🕎 +six_pointed_star 🔯 +khanda 🪯 +aries ♈ +taurus ♉ +gemini ♊ +cancer ♋ +leo ♌ +virgo ♍ +libra ♎ +scorpius ♏ +sagittarius ♐ +capricorn ♑ +aquarius ♒ +pisces ♓ +ophiuchus ⛎ +twisted_rightwards_arrows 🔀 +repeat 🔁 +repeat_one 🔂 +arrow_forward ▶️ +fast_forward ⏩ +next_track_button ⏭️ +play_or_pause_button ⏯️ +arrow_backward ◀️ +rewind ⏪ +previous_track_button ⏮️ +arrow_up_small 🔼 +arrow_double_up ⏫ +arrow_down_small 🔽 +arrow_double_down ⏬ +pause_button ⏸️ +stop_button ⏹️ +record_button ⏺️ +eject_button ⏏️ +cinema 🎦 +low_brightness 🔅 +high_brightness 🔆 +signal_strength 📶 +wireless 🛜 +vibration_mode 📳 +mobile_phone_off 📴 +female_sign ♀️ +male_sign ♂️ +transgender_symbol ⚧️ +heavy_multiplication_x ✖️ +heavy_plus_sign ➕ +heavy_minus_sign ➖ +heavy_division_sign ➗ +heavy_equals_sign 🟰 +infinity ♾️ +bangbang ‼️ +interrobang ⁉️ +question ❓ +grey_question ❔ +grey_exclamation ❕ +exclamation ❗ +heavy_exclamation_mark ❗ +wavy_dash 〰️ +currency_exchange 💱 +heavy_dollar_sign 💲 +medical_symbol ⚕️ +recycle ♻️ +fleur_de_lis ⚜️ +trident 🔱 +name_badge 📛 +beginner 🔰 +o ⭕ +white_check_mark ✅ +ballot_box_with_check ☑️ +heavy_check_mark ✔️ +x ❌ +negative_squared_cross_mark ❎ +curly_loop ➰ +loop ➿ +part_alternation_mark 〽️ +eight_spoked_asterisk ✳️ +eight_pointed_black_star ✴️ +sparkle ❇️ +copyright ©️ +registered ®️ +tm ™️ +hash #️⃣ +asterisk *️⃣ +zero 0️⃣ +one 1️⃣ +two 2️⃣ +three 3️⃣ +four 4️⃣ +five 5️⃣ +six 6️⃣ +seven 7️⃣ +eight 8️⃣ +nine 9️⃣ +keycap_ten 🔟 +capital_abcd 🔠 +abcd 🔡 +1234 🔢 +symbols 🔣 +abc 🔤 +a 🅰️ +ab 🆎 +b 🅱️ +cl 🆑 +cool 🆒 +free 🆓 +information_source ℹ️ +id 🆔 +m Ⓜ️ +new 🆕 +ng 🆖 +o2 🅾️ +ok 🆗 +parking 🅿️ +sos 🆘 +up 🆙 +vs 🆚 +koko 🈁 +sa 🈂️ +u6708 🈷️ +u6709 🈶 +u6307 🈯 +ideograph_advantage 🉐 +u5272 🈹 +u7121 🈚 +u7981 🈲 +accept 🉑 +u7533 🈸 +u5408 🈴 +u7a7a 🈳 +congratulations ㊗️ +secret ㊙️ +u55b6 🈺 +u6e80 🈵 +red_circle 🔴 +orange_circle 🟠 +yellow_circle 🟡 +green_circle 🟢 +large_blue_circle 🔵 +purple_circle 🟣 +brown_circle 🟤 +black_circle ⚫ +white_circle ⚪ +red_square 🟥 +orange_square 🟧 +yellow_square 🟨 +green_square 🟩 +blue_square 🟦 +purple_square 🟪 +brown_square 🟫 +black_large_square ⬛ +white_large_square ⬜ +black_medium_square ◼️ +white_medium_square ◻️ +black_medium_small_square ◾ +white_medium_small_square ◽ +black_small_square ▪️ +white_small_square ▫️ +large_orange_diamond 🔶 +large_blue_diamond 🔷 +small_orange_diamond 🔸 +small_blue_diamond 🔹 +small_red_triangle 🔺 +small_red_triangle_down 🔻 +diamond_shape_with_a_dot_inside 💠 +radio_button 🔘 +white_square_button 🔳 +black_square_button 🔲 +checkered_flag 🏁 +triangular_flag_on_post 🚩 +crossed_flags 🎌 +black_flag 🏴 +white_flag 🏳️ +rainbow_flag 🏳️‍🌈 +transgender_flag 🏳️‍⚧️ +pirate_flag 🏴‍☠️ +ascension_island 🇦🇨 +andorra 🇦🇩 +united_arab_emirates 🇦🇪 +afghanistan 🇦🇫 +antigua_barbuda 🇦🇬 +anguilla 🇦🇮 +albania 🇦🇱 +armenia 🇦🇲 +angola 🇦🇴 +antarctica 🇦🇶 +argentina 🇦🇷 +american_samoa 🇦🇸 +austria 🇦🇹 +australia 🇦🇺 +aruba 🇦🇼 +aland_islands 🇦🇽 +azerbaijan 🇦🇿 +bosnia_herzegovina 🇧🇦 +barbados 🇧🇧 +bangladesh 🇧🇩 +belgium 🇧🇪 +burkina_faso 🇧🇫 +bulgaria 🇧🇬 +bahrain 🇧🇭 +burundi 🇧🇮 +benin 🇧🇯 +st_barthelemy 🇧🇱 +bermuda 🇧🇲 +brunei 🇧🇳 +bolivia 🇧🇴 +caribbean_netherlands 🇧🇶 +brazil 🇧🇷 +bahamas 🇧🇸 +bhutan 🇧🇹 +bouvet_island 🇧🇻 +botswana 🇧🇼 +belarus 🇧🇾 +belize 🇧🇿 +canada 🇨🇦 +cocos_islands 🇨🇨 +congo_kinshasa 🇨🇩 +central_african_republic 🇨🇫 +congo_brazzaville 🇨🇬 +switzerland 🇨🇭 +cote_divoire 🇨🇮 +cook_islands 🇨🇰 +chile 🇨🇱 +cameroon 🇨🇲 +cn 🇨🇳 +colombia 🇨🇴 +clipperton_island 🇨🇵 +costa_rica 🇨🇷 +cuba 🇨🇺 +cape_verde 🇨🇻 +curacao 🇨🇼 +christmas_island 🇨🇽 +cyprus 🇨🇾 +czech_republic 🇨🇿 +de 🇩🇪 +diego_garcia 🇩🇬 +djibouti 🇩🇯 +denmark 🇩🇰 +dominica 🇩🇲 +dominican_republic 🇩🇴 +algeria 🇩🇿 +ceuta_melilla 🇪🇦 +ecuador 🇪🇨 +estonia 🇪🇪 +egypt 🇪🇬 +western_sahara 🇪🇭 +eritrea 🇪🇷 +es 🇪🇸 +ethiopia 🇪🇹 +eu 🇪🇺 +european_union 🇪🇺 +finland 🇫🇮 +fiji 🇫🇯 +falkland_islands 🇫🇰 +micronesia 🇫🇲 +faroe_islands 🇫🇴 +fr 🇫🇷 +gabon 🇬🇦 +gb 🇬🇧 +uk 🇬🇧 +grenada 🇬🇩 +georgia 🇬🇪 +french_guiana 🇬🇫 +guernsey 🇬🇬 +ghana 🇬🇭 +gibraltar 🇬🇮 +greenland 🇬🇱 +gambia 🇬🇲 +guinea 🇬🇳 +guadeloupe 🇬🇵 +equatorial_guinea 🇬🇶 +greece 🇬🇷 +south_georgia_south_sandwich_islands 🇬🇸 +guatemala 🇬🇹 +guam 🇬🇺 +guinea_bissau 🇬🇼 +guyana 🇬🇾 +hong_kong 🇭🇰 +heard_mcdonald_islands 🇭🇲 +honduras 🇭🇳 +croatia 🇭🇷 +haiti 🇭🇹 +hungary 🇭🇺 +canary_islands 🇮🇨 +indonesia 🇮🇩 +ireland 🇮🇪 +israel 🇮🇱 +isle_of_man 🇮🇲 +india 🇮🇳 +british_indian_ocean_territory 🇮🇴 +iraq 🇮🇶 +iran 🇮🇷 +iceland 🇮🇸 +it 🇮🇹 +jersey 🇯🇪 +jamaica 🇯🇲 +jordan 🇯🇴 +jp 🇯🇵 +kenya 🇰🇪 +kyrgyzstan 🇰🇬 +cambodia 🇰🇭 +kiribati 🇰🇮 +comoros 🇰🇲 +st_kitts_nevis 🇰🇳 +north_korea 🇰🇵 +kr 🇰🇷 +kuwait 🇰🇼 +cayman_islands 🇰🇾 +kazakhstan 🇰🇿 +laos 🇱🇦 +lebanon 🇱🇧 +st_lucia 🇱🇨 +liechtenstein 🇱🇮 +sri_lanka 🇱🇰 +liberia 🇱🇷 +lesotho 🇱🇸 +lithuania 🇱🇹 +luxembourg 🇱🇺 +latvia 🇱🇻 +libya 🇱🇾 +morocco 🇲🇦 +monaco 🇲🇨 +moldova 🇲🇩 +montenegro 🇲🇪 +st_martin 🇲🇫 +madagascar 🇲🇬 +marshall_islands 🇲🇭 +macedonia 🇲🇰 +mali 🇲🇱 +myanmar 🇲🇲 +mongolia 🇲🇳 +macau 🇲🇴 +northern_mariana_islands 🇲🇵 +martinique 🇲🇶 +mauritania 🇲🇷 +montserrat 🇲🇸 +malta 🇲🇹 +mauritius 🇲🇺 +maldives 🇲🇻 +malawi 🇲🇼 +mexico 🇲🇽 +malaysia 🇲🇾 +mozambique 🇲🇿 +namibia 🇳🇦 +new_caledonia 🇳🇨 +niger 🇳🇪 +norfolk_island 🇳🇫 +nigeria 🇳🇬 +nicaragua 🇳🇮 +netherlands 🇳🇱 +norway 🇳🇴 +nepal 🇳🇵 +nauru 🇳🇷 +niue 🇳🇺 +new_zealand 🇳🇿 +oman 🇴🇲 +panama 🇵🇦 +peru 🇵🇪 +french_polynesia 🇵🇫 +papua_new_guinea 🇵🇬 +philippines 🇵🇭 +pakistan 🇵🇰 +poland 🇵🇱 +st_pierre_miquelon 🇵🇲 +pitcairn_islands 🇵🇳 +puerto_rico 🇵🇷 +palestinian_territories 🇵🇸 +portugal 🇵🇹 +palau 🇵🇼 +paraguay 🇵🇾 +qatar 🇶🇦 +reunion 🇷🇪 +romania 🇷🇴 +serbia 🇷🇸 +ru 🇷🇺 +rwanda 🇷🇼 +saudi_arabia 🇸🇦 +solomon_islands 🇸🇧 +seychelles 🇸🇨 +sudan 🇸🇩 +sweden 🇸🇪 +singapore 🇸🇬 +st_helena 🇸🇭 +slovenia 🇸🇮 +svalbard_jan_mayen 🇸🇯 +slovakia 🇸🇰 +sierra_leone 🇸🇱 +san_marino 🇸🇲 +senegal 🇸🇳 +somalia 🇸🇴 +suriname 🇸🇷 +south_sudan 🇸🇸 +sao_tome_principe 🇸🇹 +el_salvador 🇸🇻 +sint_maarten 🇸🇽 +syria 🇸🇾 +swaziland 🇸🇿 +tristan_da_cunha 🇹🇦 +turks_caicos_islands 🇹🇨 +chad 🇹🇩 +french_southern_territories 🇹🇫 +togo 🇹🇬 +thailand 🇹🇭 +tajikistan 🇹🇯 +tokelau 🇹🇰 +timor_leste 🇹🇱 +turkmenistan 🇹🇲 +tunisia 🇹🇳 +tonga 🇹🇴 +tr 🇹🇷 +trinidad_tobago 🇹🇹 +tuvalu 🇹🇻 +taiwan 🇹🇼 +tanzania 🇹🇿 +ukraine 🇺🇦 +uganda 🇺🇬 +us_outlying_islands 🇺🇲 +united_nations 🇺🇳 +us 🇺🇸 +uruguay 🇺🇾 +uzbekistan 🇺🇿 +vatican_city 🇻🇦 +st_vincent_grenadines 🇻🇨 +venezuela 🇻🇪 +british_virgin_islands 🇻🇬 +us_virgin_islands 🇻🇮 +vietnam 🇻🇳 +vanuatu 🇻🇺 +wallis_futuna 🇼🇫 +samoa 🇼🇸 +kosovo 🇽🇰 +yemen 🇾🇪 +mayotte 🇾🇹 +south_africa 🇿🇦 +zambia 🇿🇲 +zimbabwe 🇿🇼 +england 🏴󠁧󠁢󠁥󠁮󠁧󠁿 +scotland 🏴󠁧󠁢󠁳󠁣󠁴󠁿 +wales 🏴󠁧󠁢󠁷󠁬󠁳󠁿 +`; diff --git a/packages/client-runtime/src/pullRequestMarkdown.ts b/packages/client-runtime/src/pullRequestMarkdown.ts index 8ad710325a50c..688235c544fdb 100644 --- a/packages/client-runtime/src/pullRequestMarkdown.ts +++ b/packages/client-runtime/src/pullRequestMarkdown.ts @@ -3,6 +3,7 @@ import remarkGfm from "remark-gfm"; import remarkParse from "remark-parse"; import { unified } from "unified"; +import { GITHUB_EMOJI_ALIASES } from "./githubEmojiAliases.ts"; import { sourceControlClients, type ReferenceAutolink } from "./sourceControlClients.ts"; /** `id` is positional on purpose: the same attachment can be embedded twice in one body. */ @@ -369,3 +370,39 @@ export function resolveChangeRequestMediaUrl(url: string, changeRequestUrl: stri return url; } } + +let githubEmojiByAlias: ReadonlyMap | undefined; +const githubEmojiAlias = /:([a-z\d_+-]+)(?=:)/gu; + +/** GitHub's `:alias:` emoji in `text`; a colon closes one alias only, so `:tada:tada:` has one. */ +export function githubEmojiAliases( + text: string, +): ReadonlyArray<{ readonly index: number; readonly text: string; readonly emoji: string }> { + githubEmojiByAlias ??= new Map( + GITHUB_EMOJI_ALIASES.trim() + .split("\n") + .map((line) => { + const space = line.indexOf(" "); + return [line.slice(0, space), line.slice(space + 1)] as const; + }), + ); + const found: { index: number; text: string; emoji: string }[] = []; + let end = 0; + for (const match of text.matchAll(githubEmojiAlias)) { + const emoji = githubEmojiByAlias.get(match[1]!); + if (emoji === undefined || match.index < end) continue; + end = match.index + match[0].length + 1; + found.push({ index: match.index, text: `${match[0]}:`, emoji }); + } + return found; +} + +export function expandGithubEmojiAliases(text: string): string { + let expanded = ""; + let start = 0; + for (const alias of githubEmojiAliases(text)) { + expanded += text.slice(start, alias.index) + alias.emoji; + start = alias.index + alias.text.length; + } + return start === 0 ? text : expanded + text.slice(start); +} diff --git a/third-party-licenses.config.json b/third-party-licenses.config.json index 66eed772bebbf..2cfb7324d9eae 100644 --- a/third-party-licenses.config.json +++ b/third-party-licenses.config.json @@ -1,5 +1,17 @@ { "customNotices": [ + { + "bundles": ["desktop", "mobile", "web"], + "license": "MIT", + "name": "GitHub gemoji alias data", + "sourceUrl": "https://github.com/github/gemoji/blob/fadaeaf1f1a9be82b321316a6c5502e43138b2f6/db/emoji.json", + "generatedNotices": [ + { + "licenseId": "MIT", + "copyrights": ["Copyright (c) 2019 GitHub, Inc."] + } + ] + }, { "name": "opencode Office viewers", "bundles": ["web"], From 66b8a94f8d10e6ef123c134852c94642c4f1324c Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Thu, 19 Nov 2026 13:46:42 -0800 Subject: [PATCH 138/201] perf(server): finalizing a delegated task no longer reads the child's whole turn history (#39325) --- .../src/orchestration-v2/Orchestrator.ts | 164 +++++++++++++----- .../orchestration-v2/ProjectionStore.test.ts | 86 +++++++-- .../src/orchestration-v2/ProjectionStore.ts | 96 ++++++++++ .../ProviderTurnControlService.test.ts | 1 + .../orchestration-v2/delegatedTaskMessage.ts | 9 + apps/server/src/persistence/Migrations.ts | 2 + .../101_DelegatedTaskReadIndexes.ts | 22 +++ .../reconcileV2PreviewMigration.test.ts | 2 + .../src/server/subagentProjection.ts | 2 +- 9 files changed, 333 insertions(+), 51 deletions(-) create mode 100644 apps/server/src/orchestration-v2/delegatedTaskMessage.ts create mode 100644 apps/server/src/persistence/Migrations/101_DelegatedTaskReadIndexes.ts diff --git a/apps/server/src/orchestration-v2/Orchestrator.ts b/apps/server/src/orchestration-v2/Orchestrator.ts index 0a3424735a670..059671b306fa9 100644 --- a/apps/server/src/orchestration-v2/Orchestrator.ts +++ b/apps/server/src/orchestration-v2/Orchestrator.ts @@ -201,6 +201,7 @@ import { subagentResultForRun, delegatedTaskProgress, delegatedTaskReportRuns, + monitorUpdateRunIds, subagentThreadTitle, } from "@t3tools/provider-core/server/subagentProjection"; import { @@ -1286,6 +1287,41 @@ function runForSourcePoint( } } +const DELEGATED_CHILD_RUN_WINDOW = 20; + +type DelegatedChildControls = ProjectionRecords< + "runs" | "messages" | "subagents" | "providerThreads" +> & { + /** Set when `runs` holds only what ran since this run, plus older unfinished and task runs. */ + readonly runsFloor?: OrchestrationV2Run | undefined; +}; + +function ranSince(run: OrchestrationV2Run, floor: OrchestrationV2Run): boolean { + return run.id === floor.id || runRanAfter(run, floor); +} + +/** The walk back to a report is exact when it stops at a run that ran since the floor. */ +function reportRunsRead( + controls: DelegatedChildControls, + run: OrchestrationV2Run, + reportRuns: ReadonlyArray, +): boolean { + const floor = controls.runsFloor; + if (floor === undefined || run.status !== "completed") return true; + const oldest = reportRuns.at(-1) ?? run; + if (!ranSince(oldest, floor)) return false; + const monitorRuns = monitorUpdateRunIds(controls.messages); + return controls.runs.some( + (candidate) => + candidate.id !== run.id && + candidate.startedAt !== null && + candidate.status !== "rolled_back" && + !monitorRuns.has(candidate.id) && + runRanAfter(oldest, candidate) && + ranSince(candidate, floor), + ); +} + function providerThreadForRun( projection: Pick, run: OrchestrationV2Run, @@ -14621,23 +14657,24 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio // A finished delegate otherwise keeps its provider process until the idle timeout. Callers hold // the parent lock; the child lock orders this after any follow-up that started a run meanwhile. const releaseFinishedDelegateSessions = Effect.fn("Orchestrator.releaseFinishedDelegateSessions")( - function* (childThreadId: ThreadId, resultRunId: RunId) { + function* (childThreadId: ThreadId, resultRunId: RunId, taskId: NodeId) { yield* threadDispatch.withLock( childThreadId, Effect.gen(function* () { - const child = yield* projectionStore.getThreadRecords( - childThreadId, - ["runs", "messages", "subagents", "providerThreads", "providerSessions"], - { messageRoles: ["user"] }, - ); + const { controls: child, progress } = yield* readDelegatedChildControls(childThreadId, [ + taskId, + ]); // Unawaited background tasks still allow a result but die with the process; the idle // timer keeps their process pinned. if ( - delegatedTaskProgress(child).state !== "result_available" || + progress.state !== "result_available" || child.providerThreads.some((thread) => (thread.pendingBackgroundTasks ?? []).length > 0) ) return; - for (const session of child.providerSessions) { + const { providerSessions } = yield* projectionStore.getThreadRecords(childThreadId, [ + "providerSessions", + ]); + for (const session of providerSessions) { // Shared processes unload their threads themselves; only a per-thread process lingers. if ( session.status === "stopped" || @@ -14663,15 +14700,39 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio ), ); + const readAllDelegatedChildControls = (childThreadId: ThreadId) => + projectionStore.getThreadRecords( + childThreadId, + ["runs", "messages", "subagents", "providerThreads"], + { messageRoles: ["user"], delegatedTaskMessagesOnly: true }, + ); + + const readDelegatedChildControls = Effect.fn("Orchestrator.readDelegatedChildControls")( + function* (childThreadId: ThreadId, taskIds: ReadonlyArray) { + const controls: DelegatedChildControls = yield* projectionStore.getDelegatedChildControls( + childThreadId, + { taskIds, windowSize: DELEGATED_CHILD_RUN_WINDOW }, + ); + const progress = delegatedTaskProgress(controls); + // The latest result may have ended before the runs read above; then read them all. + if ( + controls.runsFloor !== undefined && + (progress.resultRun === undefined || !ranSince(progress.resultRun, controls.runsFloor)) + ) { + const all = yield* readAllDelegatedChildControls(childThreadId); + return { controls: all, progress: delegatedTaskProgress(all) }; + } + return { controls, progress }; + }, + ); + /** * Callers must hold the parent thread's dispatch lock: wake-policy updates the same * subagent row with full-row payloads, so unserialized writers clobber policy or terminal status. */ const finalizeAppOwnedSubagentTask = Effect.fn("Orchestrator.finalizeAppOwnedSubagentTask")( function* ( - childControls: ProjectionRecords< - "runs" | "messages" | "subagents" | "providerThreads" | "providerTurns" | "attempts" - >, + childControls: DelegatedChildControls, options: { readonly settledContinuationOf?: RunId; readonly syncRunId?: RunId; @@ -14776,23 +14837,45 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio } // A run queued behind the report can end the task without saying anything. - const reportRuns = delegatedTaskReportRuns(childControls, { ...childRun, status: outcome }); + const reportFrom = { ...childRun, status: outcome }; + let reportRuns = delegatedTaskReportRuns(childControls, reportFrom); + if (!reportRunsRead(childControls, reportFrom, reportRuns)) { + reportRuns = delegatedTaskReportRuns( + yield* readAllDelegatedChildControls(childThreadId), + reportFrom, + ); + } const resultRunIds = [childRun.id, ...reportRuns.map((run) => run.id)]; const childResult = yield* projectionStore.getThreadRecords( childThreadId, - ["messages", "turnItems"], + ["messages", "turnItems", "providerTurns", "attempts"], { messageRoles: ["assistant"], messageRunIds: resultRunIds, turnItemRunIds: resultRunIds, turnItemTypes: ["assistant_message", "error", "system_notice"], + providerTurnAttemptIds: [childRun, ...reportRuns].flatMap( + (run) => run.activeAttemptId ?? [], + ), + attemptIds: childRun.activeAttemptId === null ? [] : [childRun.activeAttemptId], }, ); + // A steered run's attempt can point at a provider turn that another attempt started. + const attemptTurnId = childResult.attempts[0]?.providerTurnId; + const steeredTurns = + attemptTurnId == null || + childResult.providerTurns.some((turn) => turn.runAttemptId === childRun.activeAttemptId) + ? [] + : (yield* projectionStore.getThreadRecords(childThreadId, ["providerTurns"], { + providerTurnIds: [attemptTurnId], + })).providerTurns; const childProjection = { ...childControls, runs: reportRuns, messages: childResult.messages, turnItems: childResult.turnItems, + providerTurns: [...childResult.providerTurns, ...steeredTurns], + attempts: childResult.attempts, }; const parentThreadId = childControls.thread.lineage.parentThreadId; // The task's node and turn item share its id. @@ -14957,7 +15040,7 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio }, ]; yield* writeSystemEvents(completionEvents, [], { updateDelegatedCompletionOnly: true }); - yield* releaseFinishedDelegateSessions(childThreadId, childRun.id); + yield* releaseFinishedDelegateSessions(childThreadId, childRun.id, task.id); if (completionPlan.offer && completionPlan.parentRun !== undefined) { yield* offerDelegatedCompletionDelivery(parentThreadId, completionPlan.parentRun.id); @@ -14978,41 +15061,41 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio childThreadId: ThreadId, options?: { readonly settledContinuationOf?: RunId; readonly syncRunId?: RunId }, ) { - const childControls = yield* projectionStore.getThreadRecords( - childThreadId, - ["runs", "messages", "subagents", "providerThreads", "providerTurns", "attempts"], - { messageRoles: ["user"] }, - ); - const parentThreadId = childControls.thread.lineage.parentThreadId; + const child = yield* projectionStore.getThreadRecords(childThreadId, ["contextTransfers"]); + const parentThreadId = child.thread.lineage.parentThreadId; + const forkedFrom = child.thread.forkedFrom; if ( - childControls.thread.lineage.relationshipToParent !== "subagent" || + child.thread.lineage.relationshipToParent !== "subagent" || parentThreadId === null || - childControls.thread.forkedFrom?.type !== "node" + forkedFrom?.type !== "node" ) return; - const progress = delegatedTaskProgress(childControls); // Each task of this child names it, so the parent's other tasks stay unread. const parent = yield* projectionStore.getThreadRecords(parentThreadId, ["subagents"], { subagentChildThreadIds: [childThreadId], }); - const { contextTransfers } = yield* projectionStore.getThreadRecords(childThreadId, [ - "contextTransfers", - ]); - for (const task of parent.subagents) { + const resultSent = child.contextTransfers.some( + (transfer) => + transfer.type === "subagent_result" && + transfer.sourceThreadId === childThreadId && + transfer.targetThreadId === parentThreadId, + ); + const openTasks = parent.subagents.filter( + (task) => + task.origin === "app_owned" && + task.childThreadId === childThreadId && + !(task.result !== null && resultSent), + ); + const { controls: childControls, progress } = yield* readDelegatedChildControls( + childThreadId, + openTasks.map((task) => task.id), + ); + for (const task of openTasks) { // A cancelled task does not wait for the work its cancel is stopping. const cancelled = task.cancelledRunId !== undefined; if ( - task.origin !== "app_owned" || - task.childThreadId !== childThreadId || - (task.id === childControls.thread.forkedFrom.nodeId && - (cancelled ? progress.state === "working" : progress.state !== "result_available")) || - (task.result !== null && - contextTransfers.some( - (transfer) => - transfer.type === "subagent_result" && - transfer.sourceThreadId === childThreadId && - transfer.targetThreadId === parentThreadId, - )) + task.id === forkedFrom.nodeId && + (cancelled ? progress.state === "working" : progress.state !== "result_available") ) continue; yield* finalizeAppOwnedSubagentTask(childControls, { @@ -15025,7 +15108,7 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio // Only the run a cancelled task settled from ends with it. The row read above has no // such run yet when this call settled the task, from the same result run. const { resultRun } = progress; - const resultTaskId = resultRun?.delegatedTaskId ?? childControls.thread.forkedFrom.nodeId; + const resultTaskId = resultRun?.delegatedTaskId ?? forkedFrom.nodeId; const resultTask = parent.subagents.find((task) => task.id === resultTaskId); const taskCancelled = resultTask?.cancelledRunId !== undefined && resultTask.cancelledRunId === resultRun?.id; @@ -15064,7 +15147,8 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio run = previousRunId === undefined ? undefined - : childControls.runs.find((candidate) => candidate.id === previousRunId); + : (childControls.runs.find((candidate) => candidate.id === previousRunId) ?? + (yield* projectionStore.getRun(childThreadId, previousRunId))); } for (const request of pendingQuestions) { if ( diff --git a/apps/server/src/orchestration-v2/ProjectionStore.test.ts b/apps/server/src/orchestration-v2/ProjectionStore.test.ts index 5a1baf63d997a..dabe53aeae46f 100644 --- a/apps/server/src/orchestration-v2/ProjectionStore.test.ts +++ b/apps/server/src/orchestration-v2/ProjectionStore.test.ts @@ -1385,6 +1385,7 @@ it.effect("record reads filter notification sources without dropping matching me ["monitor", "user", "monitor"], ["system", "user", "system"], ["assistant-monitor", "assistant", "monitor"], + ["wake", "user", "wake"], ] as const) { yield* store.apply({ id: EventId.make(`notification-filter:${id}`), @@ -1406,13 +1407,21 @@ it.effect("record reads filter notification sources without dropping matching me updatedAt: now, ...(kind === null ? {} - : { - notification: { - source: { kind }, - outcome: "updated", - summary: "Background notification", - }, - }), + : kind === "wake" + ? { + delegatedCompletion: { + parentRunId: RunId.make("run:wake-parent"), + generation: 1, + taskIds: [], + }, + } + : { + notification: { + source: { kind }, + outcome: "updated", + summary: "Background notification", + }, + }), }, }); } @@ -1424,11 +1433,19 @@ it.effect("record reads filter notification sources without dropping matching me matching.messages.map((message) => [message.id, message.text]), [["monitor", "Complete body for monitor"]], ); + const delegatedTaskMessages = yield* store.getThreadRecords(threadId, ["messages"], { + messageRoles: ["user"], + delegatedTaskMessagesOnly: true, + }); + assert.deepEqual( + delegatedTaskMessages.messages.map((message) => message.id), + ["monitor", "wake"], + ); const { statements, tracer } = traceSqlStatements(); const userMessages = yield* store .getThreadRecords(threadId, ["messages"], { messageRoles: ["user"] }) .pipe(Effect.withTracer(tracer)); - assert.lengthOf(userMessages.messages, 3); + assert.lengthOf(userMessages.messages, 4); const ordinalLookup = statements.find((statement) => statement.includes("MIN(ordinal)")); // User-only reads must seek the message-ordinal index instead of scanning every turn item. yield* assertReadsThroughMessageOrdinalIndex(ordinalLookup, ["thread_id=?", "=?"]); @@ -1442,7 +1459,7 @@ it.effect("record reads filter notification sources without dropping matching me .pipe(Effect.withTracer(withItems.tracer)); assert.deepEqual(ordered.messages, userMessages.messages); assert.isFalse(withItems.statements.some((statement) => statement.includes("MIN(ordinal)"))); - assert.lengthOf((yield* store.getThreadRecords(threadId, ["messages"])).messages, 4); + assert.lengthOf((yield* store.getThreadRecords(threadId, ["messages"])).messages, 5); assert.lengthOf( (yield* store.getThreadRecords(threadId, ["messages"], { monitorNotificationsOnly: true, @@ -1453,7 +1470,56 @@ it.effect("record reads filter notification sources without dropping matching me (yield* store.getThreadRecords(threadId, ["messages"], { monitorNotificationsOnly: false, })).messages, - 4, + 5, + ); + }).pipe(Effect.provide(layerTest)), +); + +it.effect("reads a delegated child's recent, unfinished and task runs without its history", () => + Effect.gen(function* () { + const store = yield* ProjectionStore.ProjectionStoreV2; + const threadId = yield* addRolledBackRecoveryCandidate("delegated-child-runs"); + const first = (yield* store.getThreadRecords(threadId, ["runs"])).runs[0]!; + const at = (minutes: number) => DateTime.add(first.requestedAt, { minutes: minutes + 60 }); + const id = (ordinal: number) => RunId.make(`run:delegated-child-runs:${ordinal}`); + const unstartedCancel = { status: "cancelled", startedAt: null } as const; + for (const [ordinal, patch] of [ + [3, { status: "running", completedAt: null }], + // Unstarted cancelled runs are outside the window's index: one ends after the floor. + [4, { ...unstartedCancel, completedAt: at(20) }], + [5, { ...unstartedCancel, completedAt: at(1) }], + ...[2, 6, 7, 8, 9, 10, 11, 12].map((ordinal) => [ordinal, {}] as const), + ] as const) { + yield* store.apply({ + id: EventId.make(`event:delegated-child-runs:${ordinal}`), + type: "run.created", + threadId, + runId: id(ordinal), + occurredAt: first.requestedAt, + payload: { + ...first, + id: id(ordinal), + ordinal, + status: "completed", + startedAt: at(ordinal), + completedAt: at(ordinal), + delegatedTaskId: NodeId.make(`node:delegated-child-runs:task:${ordinal}`), + ...patch, + }, + }); + } + const taskIds = [NodeId.make("node:delegated-child-runs:task:2")]; + const bounded = yield* store.getDelegatedChildControls(threadId, { taskIds, windowSize: 3 }); + assert.equal(bounded.runsFloor?.id, id(11)); + assert.deepEqual( + bounded.runs.map((run) => run.id), + [2, 3, 4, 11, 12].map(id), + ); + const whole = yield* store.getDelegatedChildControls(threadId, { taskIds, windowSize: 100 }); + assert.isUndefined(whole.runsFloor); + assert.deepEqual( + whole.runs.map((run) => run.id), + (yield* store.getThreadRecords(threadId, ["runs"])).runs.map((run) => run.id), ); }).pipe(Effect.provide(layerTest)), ); diff --git a/apps/server/src/orchestration-v2/ProjectionStore.ts b/apps/server/src/orchestration-v2/ProjectionStore.ts index 7824fce056c4f..930639b5d6bbe 100644 --- a/apps/server/src/orchestration-v2/ProjectionStore.ts +++ b/apps/server/src/orchestration-v2/ProjectionStore.ts @@ -103,6 +103,7 @@ import type * as Statement from "effect/sql/Statement"; import { MCP_APP_OUTPUT_KEY } from "@t3tools/shared/mcpApp"; import { threadHtmlRenderAttachmentIds } from "../attachmentStore.ts"; +import { DELEGATED_TASK_MESSAGE_CONDITION } from "./delegatedTaskMessage.ts"; import { DEFERRED_COMMAND_MESSAGE_CONDITION, JAVASCRIPT_TRIM_WHITESPACE, @@ -375,6 +376,8 @@ export interface ProjectionRecordFilter { readonly attemptIds?: ReadonlyArray; readonly messageRoles?: ReadonlyArray; readonly monitorNotificationsOnly?: boolean; + /** User messages that are monitor notifications or delegated-completion wakes, through their partial index. */ + readonly delegatedTaskMessagesOnly?: true; readonly turnItemRunId?: RunId; readonly messageIds?: ReadonlyArray; readonly messageRunIds?: ReadonlyArray; @@ -816,6 +819,20 @@ export interface ProjectionStoreV2Shape { threadId: ThreadId, runId: RunId, ) => Effect.Effect; + /** + * One snapshot: the `windowSize` runs that ended last, unfinished runs, the runs of `taskIds` and + * their wakes. `runsFloor` is set when older runs were left out; every run that ran after it is + * in `runs`. + */ + readonly getDelegatedChildControls: ( + threadId: ThreadId, + input: { readonly taskIds: ReadonlyArray; readonly windowSize: number }, + ) => Effect.Effect< + ProjectionRecords<"runs" | "messages" | "subagents" | "providerThreads"> & { + readonly runsFloor: OrchestrationV2Run | undefined; + }, + ProjectionStoreV2Error + >; readonly canStartQueuedRun: ( threadId: ThreadId, ) => Effect.Effect; @@ -4437,6 +4454,7 @@ export const layer: Layer.Layer = ${filter?.messageIds === undefined ? sql`` : sql`AND message_id IN (SELECT value FROM json_each(${encodeIdList(filter.messageIds)}))`} ${filter?.messageRoles === undefined ? sql`` : sql`AND role IN (SELECT value FROM json_each(${encodeIdList(filter.messageRoles)}))`} ${filter?.monitorNotificationsOnly === true ? sql`AND json_extract(payload_json, '$.notification.source.kind') = 'monitor'` : sql``} + ${filter?.delegatedTaskMessagesOnly === true ? sql`AND ${sql.literal(DELEGATED_TASK_MESSAGE_CONDITION)}` : sql``} ${filter?.messageRunIds === undefined ? sql`` : sql`AND run_id IN (SELECT value FROM json_each(${encodeIdList(filter.messageRunIds)}))`} ORDER BY created_at ASC, message_id ASC ` @@ -6475,6 +6493,83 @@ export const layer: Layer.Layer = ) .pipe(Effect.mapError(controlReadError(threadId))); + const getDelegatedChildControls: ProjectionStoreV2Shape["getDelegatedChildControls"] = ( + threadId, + { taskIds, windowSize }, + ) => + sql + .withTransaction( + Effect.gen(function* () { + const records = yield* getThreadRecords( + threadId, + ["messages", "subagents", "providerThreads"], + { messageRoles: ["user"], delegatedTaskMessagesOnly: true }, + ); + // Spells migration 84's order and predicate so the window walks that index. + const windowRows = yield* sql` + SELECT payload_json, completed_at FROM orchestration_v2_projection_runs + WHERE thread_id = ${threadId} + AND status <> 'queued' + AND NOT (status = 'cancelled' AND json_extract(payload_json, '$.startedAt') IS NULL) + ORDER BY (completed_at IS NULL) DESC, completed_at DESC, ordinal DESC, run_id DESC + LIMIT ${windowSize} + `; + const window = yield* decodeRows(decodeRunPayload, threadId)(windowRows); + const last = window.length < windowSize ? undefined : window.at(-1); + const floorCompletedAt = windowRows.at(-1)?.completed_at ?? null; + // A window ending in unfinished runs bounds nothing, so read the whole thread. + const floor = floorCompletedAt === null ? undefined : last; + const rest = yield* ( + last !== undefined && floor === undefined + ? sql` + SELECT payload_json FROM orchestration_v2_projection_runs + WHERE thread_id = ${threadId}` + : sql` + SELECT payload_json FROM orchestration_v2_projection_runs + WHERE thread_id = ${threadId} + AND status IN ('preparing', 'queued', 'starting', 'running', 'waiting') + UNION + SELECT payload_json FROM orchestration_v2_projection_runs + WHERE thread_id = ${threadId} AND json_valid(payload_json) + AND json_extract(payload_json, '$.delegatedTaskId') IS NOT NULL + AND json_extract(payload_json, '$.delegatedTaskId') + IN (SELECT value FROM json_each(${encodeIdList(taskIds)})) + UNION + -- Unstarted cancelled runs are outside the window's index. + SELECT payload_json FROM orchestration_v2_projection_runs + WHERE thread_id = ${threadId} AND status = 'cancelled' + ${floor === undefined ? sql`` : sql`AND (completed_at IS NULL OR completed_at >= ${floorCompletedAt})`}` + ).pipe(Effect.flatMap(decodeRows(decodeRunPayload, threadId))); + const runs = new Map([...window, ...rest].map((run) => [run.id, run])); + const requested = new Set(); + for (;;) { + const wakeRunIds = [ + ...new Set( + records.messages.flatMap((message) => + message.runId !== null && + message.delegatedCompletion !== undefined && + runs.has(message.delegatedCompletion.parentRunId) && + !runs.has(message.runId) && + !requested.has(message.runId) + ? [message.runId] + : [], + ), + ), + ]; + if (wakeRunIds.length === 0) break; + for (const id of wakeRunIds) requested.add(id); + const wakes = yield* getThreadRecords(threadId, ["runs"], { runIds: wakeRunIds }); + for (const run of wakes.runs) runs.set(run.id, run); + } + return { + ...records, + runs: [...runs.values()].toSorted((a, b) => a.ordinal - b.ordinal), + runsFloor: floor, + }; + }), + ) + .pipe(Effect.mapError(controlReadError(threadId))); + const getRun: ProjectionStoreV2Shape["getRun"] = (threadId, runId) => sql .withTransaction( @@ -9669,6 +9764,7 @@ export const layer: Layer.Layer = getCheckpointCaptureContext: readOnReader(getCheckpointCaptureContext), getCheckpointRollbackContext: readOnReader(getCheckpointRollbackContext), getRunMessage: readOnReader(getRunMessage), + getDelegatedChildControls: readOnReader(getDelegatedChildControls), getRun: readOnReader(getRun), canStartQueuedRun: readOnReader(canStartQueuedRun), getHeldQueuedRuns: readOnReader(getHeldQueuedRuns), diff --git a/apps/server/src/orchestration-v2/ProviderTurnControlService.test.ts b/apps/server/src/orchestration-v2/ProviderTurnControlService.test.ts index df80f2ded5836..51c38efa8a41a 100644 --- a/apps/server/src/orchestration-v2/ProviderTurnControlService.test.ts +++ b/apps/server/src/orchestration-v2/ProviderTurnControlService.test.ts @@ -187,6 +187,7 @@ function layerProjectionStore( getCheckpointRollbackContext: () => Effect.die("unused rollback context"), getCheckpointCaptureContext: () => Effect.die("not used"), getRunMessage: () => Effect.die("not used"), + getDelegatedChildControls: () => Effect.die("not used"), getRun: () => Effect.die("not used"), isNodeStored: () => Effect.die("not used"), canStartQueuedRun: () => Effect.die("not used"), diff --git a/apps/server/src/orchestration-v2/delegatedTaskMessage.ts b/apps/server/src/orchestration-v2/delegatedTaskMessage.ts new file mode 100644 index 0000000000000..df98b47dc3791 --- /dev/null +++ b/apps/server/src/orchestration-v2/delegatedTaskMessage.ts @@ -0,0 +1,9 @@ +/** + * A user message that marks its run as a monitor update or a delegated-completion wake: what + * `delegatedTaskProgress` and `delegatedTaskRuns` read. The partial index on it is only used when + * the read spells this text the same way. + */ +export const DELEGATED_TASK_MESSAGE_CONDITION = `role = 'user' AND json_valid(payload_json) AND ( + json_extract(payload_json, '$.notification.source.kind') = 'monitor' + OR json_extract(payload_json, '$.delegatedCompletion') IS NOT NULL +)`; diff --git a/apps/server/src/persistence/Migrations.ts b/apps/server/src/persistence/Migrations.ts index dcf435b670ca5..c3fc7aacef055 100644 --- a/apps/server/src/persistence/Migrations.ts +++ b/apps/server/src/persistence/Migrations.ts @@ -108,6 +108,7 @@ import Migration0097 from "./Migrations/097_IssueTrackerBindings.ts"; import Migration0098 from "./Migrations/098_ActiveShellIndexIndexes.ts"; import Migration0099 from "./Migrations/099_BackgroundRecoveryIndexes.ts"; import Migration0100 from "./Migrations/100_TurnStartReadIndexes.ts"; +import Migration0101 from "./Migrations/101_DelegatedTaskReadIndexes.ts"; const migrationEntries = [ [1, "OrchestrationEvents", Migration0001], @@ -211,6 +212,7 @@ const migrationEntries = [ [98, "ActiveShellIndexIndexes", Migration0098], [99, "BackgroundRecoveryIndexes", Migration0099], [100, "TurnStartReadIndexes", Migration0100], + [101, "DelegatedTaskReadIndexes", Migration0101], ] as const; export const migrationManifest = migrationEntries.map(([id, name]) => [id, name] as const); diff --git a/apps/server/src/persistence/Migrations/101_DelegatedTaskReadIndexes.ts b/apps/server/src/persistence/Migrations/101_DelegatedTaskReadIndexes.ts new file mode 100644 index 0000000000000..e057296dafab2 --- /dev/null +++ b/apps/server/src/persistence/Migrations/101_DelegatedTaskReadIndexes.ts @@ -0,0 +1,22 @@ +import * as Effect from "effect/Effect"; +import * as SqlClient from "effect/sql/SqlClient"; + +import { DELEGATED_TASK_MESSAGE_CONDITION } from "../../orchestration-v2/delegatedTaskMessage.ts"; + +export default Effect.gen(function* () { + const sql = yield* SqlClient.SqlClient; + + // Finalizing a delegated task finds its tasks' runs and the child's wakes without reading the + // child's history. ProjectionStore.getDelegatedChildControls and the delegatedTaskMessagesOnly read + // must spell the same expressions. + yield* sql` + CREATE INDEX IF NOT EXISTS orchestration_v2_projection_runs_delegated_task_idx + ON orchestration_v2_projection_runs(thread_id, json_extract(payload_json, '$.delegatedTaskId')) + WHERE json_valid(payload_json) AND json_extract(payload_json, '$.delegatedTaskId') IS NOT NULL + `; + yield* sql.unsafe(` + CREATE INDEX IF NOT EXISTS orchestration_v2_projection_messages_delegated_task_idx + ON orchestration_v2_projection_messages(thread_id, created_at, message_id) + WHERE ${DELEGATED_TASK_MESSAGE_CONDITION} + `); +}); diff --git a/apps/server/src/persistence/reconcileV2PreviewMigration.test.ts b/apps/server/src/persistence/reconcileV2PreviewMigration.test.ts index 982ea60a2b340..b9feabbf89b88 100644 --- a/apps/server/src/persistence/reconcileV2PreviewMigration.test.ts +++ b/apps/server/src/persistence/reconcileV2PreviewMigration.test.ts @@ -80,6 +80,7 @@ describe("V2 preview upgrade", () => { [98, "ActiveShellIndexIndexes"], [99, "BackgroundRecoveryIndexes"], [100, "TurnStartReadIndexes"], + [101, "DelegatedTaskReadIndexes"], ]); assert.deepStrictEqual(yield* runMigrations(), []); assert.deepStrictEqual(yield* sql`SELECT * FROM orchestration_v2_legacy_imports`, imports); @@ -203,6 +204,7 @@ describe("V2 preview upgrade", () => { [98, "ActiveShellIndexIndexes"], [99, "BackgroundRecoveryIndexes"], [100, "TurnStartReadIndexes"], + [101, "DelegatedTaskReadIndexes"], ]); }).pipe(Effect.provide(NodeSqliteClient.layer({ filename: ":memory:" }))), ); diff --git a/packages/provider-core/src/server/subagentProjection.ts b/packages/provider-core/src/server/subagentProjection.ts index 88b124bf5fb79..e0ac009f5731a 100644 --- a/packages/provider-core/src/server/subagentProjection.ts +++ b/packages/provider-core/src/server/subagentProjection.ts @@ -206,7 +206,7 @@ function stopNotice( type MonitorNotice = Pick; /** Runs that only acknowledge a monitor update are never a task's work. */ -function monitorUpdateRunIds(messages: ReadonlyArray) { +export function monitorUpdateRunIds(messages: ReadonlyArray) { return new Set( messages .filter( From 210996207d3c9327c1dcbb12cd958abdfa72e5ae Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Thu, 19 Nov 2026 14:09:09 -0800 Subject: [PATCH 139/201] feat(mobile): pull request files follow the same review order as web (#26760) --- .../pull-requests/PullRequestFiles.tsx | 39 +------- .../pull-requests/pullRequestDiffPages.ts | 6 +- .../pullRequestFileSections.test.ts | 22 +++++ .../pull-requests/pullRequestFileSections.ts | 37 ++++++++ .../web/src/components/diffs/DiffFileTree.tsx | 2 +- .../diffs/diffFileTree.logic.test.ts | 26 +---- .../components/diffs/diffFileTree.logic.ts | 43 --------- .../pullRequest/PullRequestCodeTab.tsx | 11 +-- packages/client-runtime/package.json | 4 + .../client-runtime/src/diffFileOrder.test.ts | 56 +++++++++-- .../client-runtime/src/diffFileOrder.ts | 94 +++++++++++++++---- 11 files changed, 198 insertions(+), 142 deletions(-) create mode 100644 apps/mobile/src/features/pull-requests/pullRequestFileSections.test.ts create mode 100644 apps/mobile/src/features/pull-requests/pullRequestFileSections.ts rename apps/web/src/components/pullRequest/pullRequestFileOrder.logic.test.ts => packages/client-runtime/src/diffFileOrder.test.ts (75%) rename apps/web/src/components/pullRequest/pullRequestFileOrder.logic.ts => packages/client-runtime/src/diffFileOrder.ts (68%) diff --git a/apps/mobile/src/features/pull-requests/PullRequestFiles.tsx b/apps/mobile/src/features/pull-requests/PullRequestFiles.tsx index b16313d8b8897..601f6e5c20b5a 100644 --- a/apps/mobile/src/features/pull-requests/PullRequestFiles.tsx +++ b/apps/mobile/src/features/pull-requests/PullRequestFiles.tsx @@ -32,6 +32,7 @@ import { import { usePullRequestFileFilter } from "./usePullRequestFileFilter"; import { usePullRequestFilesViewed } from "./usePullRequestFilesViewed"; import { requestPullRequestFileJump } from "./pullRequestFileJump"; +import { fileDirectory, groupByDirectory } from "./pullRequestFileSections"; import type { MessageResolver } from "../../i18n/messages"; const BREAKDOWN_LABELS = { @@ -42,11 +43,6 @@ const BREAKDOWN_LABELS = { docs: msg("Docs", { $context: "kind of changed file" }), } satisfies Record, string>; -function fileDirectory(path: string) { - const separator = path.lastIndexOf("/"); - return separator < 0 ? "" : path.slice(0, separator); -} - function useChangedFiles(params: PullRequestDiffParams) { const detail = useEnvironmentQuery(composerPullRequests.detail(pullRequestTarget(params))); // A commit's diff is part of the pull request, so the PR's file counts and viewed state don't apply. @@ -375,39 +371,6 @@ export function usePullRequestFilesSection(params: PullRequestParams) { }; } -type SheetItem = - | { - readonly kind: "directory"; - readonly key: string; - readonly directory: string; - readonly collapsed: boolean; - } - | { readonly kind: "file"; readonly key: string; readonly file: ReviewRenderableFile }; - -function groupByDirectory( - files: ReadonlyArray, - collapsed: ReadonlySet, -) { - const sorted = files - .map((file) => ({ file, directory: fileDirectory(file.path) })) - .sort( - (a, b) => a.directory.localeCompare(b.directory) || a.file.path.localeCompare(b.file.path), - ); - const items: SheetItem[] = []; - sorted.forEach(({ file, directory }, index) => { - if (directory !== sorted[index - 1]?.directory) { - items.push({ - kind: "directory", - key: `directory:${directory}`, - directory, - collapsed: collapsed.has(directory), - }); - } - if (!collapsed.has(directory)) items.push({ kind: "file", key: file.id, file }); - }); - return items; -} - function DirectoryRow(props: { readonly directory: string; readonly collapsed: boolean; diff --git a/apps/mobile/src/features/pull-requests/pullRequestDiffPages.ts b/apps/mobile/src/features/pull-requests/pullRequestDiffPages.ts index f4f33896e8bb4..914ee50df3c85 100644 --- a/apps/mobile/src/features/pull-requests/pullRequestDiffPages.ts +++ b/apps/mobile/src/features/pull-requests/pullRequestDiffPages.ts @@ -1,3 +1,4 @@ +import { orderDiffFilesForReview } from "@t3tools/client-runtime/diff-file-order"; import type { ChangeRequestTerminology } from "@t3tools/client-runtime/source-control-clients"; import { changeRequestTermKind } from "../../lib/changeRequestTerm"; import type { PullRequestDiffResult } from "@t3tools/contracts"; @@ -118,7 +119,10 @@ export function combinePullRequestDiffPages( cache.set(page.result, value); return value; }); - const files = parsed.flatMap((page) => (page.kind === "files" ? page.files : [])); + const files = orderDiffFilesForReview( + parsed.flatMap((page) => (page.kind === "files" ? page.files : [])), + (file) => file.path, + ); if (files.length === 0) return parsed[0] ?? { kind: "empty" }; return { kind: "files", diff --git a/apps/mobile/src/features/pull-requests/pullRequestFileSections.test.ts b/apps/mobile/src/features/pull-requests/pullRequestFileSections.test.ts new file mode 100644 index 0000000000000..0fcc778b91942 --- /dev/null +++ b/apps/mobile/src/features/pull-requests/pullRequestFileSections.test.ts @@ -0,0 +1,22 @@ +import { describe, expect, it } from "vite-plus/test"; +import { buildReviewParsedDiff } from "../review/reviewModel"; +import { groupByDirectory } from "./pullRequestFileSections"; + +function patch(path: string) { + return `diff --git a/${path} b/${path}\n--- a/${path}\n+++ b/${path}\n@@ -1 +1 @@\n-old\n+new\n`; +} + +describe("groupByDirectory", () => { + it("keeps review order when a parent directory resumes after a subdirectory", () => { + const parsed = buildReviewParsedDiff( + ["src/a.ts", "src/lib/b.ts", "src/z.ts"].map(patch).join("\n"), + "pr", + ); + if (parsed.kind !== "files") throw new Error("Expected files"); + const items = groupByDirectory(parsed.files, new Set()); + expect( + items.map((item) => (item.kind === "directory" ? `${item.directory}/` : item.file.path)), + ).toEqual(["src/", "src/a.ts", "src/lib/", "src/lib/b.ts", "src/", "src/z.ts"]); + expect(new Set(items.map((item) => item.key)).size).toBe(items.length); + }); +}); diff --git a/apps/mobile/src/features/pull-requests/pullRequestFileSections.ts b/apps/mobile/src/features/pull-requests/pullRequestFileSections.ts new file mode 100644 index 0000000000000..8ae0ca4c844db --- /dev/null +++ b/apps/mobile/src/features/pull-requests/pullRequestFileSections.ts @@ -0,0 +1,37 @@ +import type { ReviewRenderableFile } from "../review/reviewModel"; + +export function fileDirectory(path: string) { + const separator = path.lastIndexOf("/"); + return separator < 0 ? "" : path.slice(0, separator); +} + +type SheetItem = + | { + readonly kind: "directory"; + readonly key: string; + readonly directory: string; + readonly collapsed: boolean; + } + | { readonly kind: "file"; readonly key: string; readonly file: ReviewRenderableFile }; + +export function groupByDirectory( + files: ReadonlyArray, + collapsed: ReadonlySet, +) { + // Keep the shared review order: a directory gets a new header each time it resumes after a subdirectory. + const items: SheetItem[] = []; + files.forEach((file, index) => { + const directory = fileDirectory(file.path); + const previous = files[index - 1]; + if (!previous || directory !== fileDirectory(previous.path)) { + items.push({ + kind: "directory", + key: `directory:${directory}:${index}`, + directory, + collapsed: collapsed.has(directory), + }); + } + if (!collapsed.has(directory)) items.push({ kind: "file", key: file.id, file }); + }); + return items; +} diff --git a/apps/web/src/components/diffs/DiffFileTree.tsx b/apps/web/src/components/diffs/DiffFileTree.tsx index e59cf38f4c66c..ce48a468f66ec 100644 --- a/apps/web/src/components/diffs/DiffFileTree.tsx +++ b/apps/web/src/components/diffs/DiffFileTree.tsx @@ -21,9 +21,9 @@ import { compareDiffFileTreeEntries, collectDirectoryPaths, diffFileTreeModel, - diffFileTreePositions, type DiffFileTreeEntry, } from "./diffFileTree.logic"; +import { diffFileTreePositions } from "@t3tools/client-runtime/diff-file-order"; export type { DiffFileTreeEntry } from "./diffFileTree.logic"; diff --git a/apps/web/src/components/diffs/diffFileTree.logic.test.ts b/apps/web/src/components/diffs/diffFileTree.logic.test.ts index dea4b9981c8a6..757ab3f83de42 100644 --- a/apps/web/src/components/diffs/diffFileTree.logic.test.ts +++ b/apps/web/src/components/diffs/diffFileTree.logic.test.ts @@ -1,11 +1,7 @@ import type { FileDiffMetadata } from "@pierre/diffs"; import { describe, expect, it } from "vite-plus/test"; -import { - buildDiffFileTreeUpdates, - diffFileTreeEntries, - orderDiffFilesLikeTree, -} from "./diffFileTree.logic"; +import { buildDiffFileTreeUpdates, diffFileTreeEntries } from "./diffFileTree.logic"; function file(type: FileDiffMetadata["type"], name: string, prevName = name): FileDiffMetadata { return { type, name, prevName } as FileDiffMetadata; @@ -28,26 +24,6 @@ describe("diffFileTreeEntries", () => { }); }); -describe("orderDiffFilesLikeTree", () => { - it("pulls a test listed last into its directory, keeping the first-seen order", () => { - expect( - orderDiffFilesLikeTree([ - file("change", "server/device/Host.ts"), - file("change", "web/settings.ts"), - file("change", "server/ws.ts"), - file("change", "server/device/Host.test.ts"), - file("change", "web/settings.test.ts"), - ]).map((entry) => entry.name), - ).toEqual([ - "server/device/Host.ts", - "server/device/Host.test.ts", - "server/ws.ts", - "web/settings.ts", - "web/settings.test.ts", - ]); - }); -}); - describe("buildDiffFileTreeUpdates", () => { it("adds a new file's directories before the file", () => { expect(buildDiffFileTreeUpdates(["README.md"], ["README.md", "src/lib/a.ts"])).toEqual([ diff --git a/apps/web/src/components/diffs/diffFileTree.logic.ts b/apps/web/src/components/diffs/diffFileTree.logic.ts index 41d2a5e676e70..b819133d75da9 100644 --- a/apps/web/src/components/diffs/diffFileTree.logic.ts +++ b/apps/web/src/components/diffs/diffFileTree.logic.ts @@ -85,49 +85,6 @@ export function collectDirectoryPaths(paths: ReadonlyArray): ReadonlyArr return [...directories]; } -export function diffFileTreePositions(paths: ReadonlyArray): ReadonlyMap { - const positions = new Map(); - paths.forEach((path, index) => { - positions.set(path, index); - let directory = ""; - for (const segment of path.split("/").slice(0, -1)) { - directory += `${segment}/`; - if (!positions.has(directory)) positions.set(directory, index); - } - }); - return positions; -} - -// A flat list in tree order: each directory stays contiguous, siblings ranked as -// compareDiffFileTreeEntries ranks them, so the list never disagrees with the tree. -export function orderDiffFilesLikeTree( - files: ReadonlyArray, -): ReadonlyArray { - const paths = files.map(resolveFileDiffPath); - const positions = diffFileTreePositions(paths); - const keys = paths.map((path) => { - const key: number[] = []; - let directory = ""; - for (const segment of path.split("/").slice(0, -1)) { - directory += `${segment}/`; - key.push(positions.get(directory)!); - } - key.push(positions.get(path)!); - return key; - }); - return files - .map((file, index) => ({ file, key: keys[index]! })) - .toSorted((left, right) => { - const length = Math.min(left.key.length, right.key.length); - for (let index = 0; index < length; index++) { - const difference = left.key[index]! - right.key[index]!; - if (difference !== 0) return difference; - } - return left.key.length - right.key.length; - }) - .map(({ file }) => file); -} - export function compareDiffFileTreeEntries( getPositions: () => ReadonlyMap, ): FileTreeSortComparator { diff --git a/apps/web/src/components/pullRequest/PullRequestCodeTab.tsx b/apps/web/src/components/pullRequest/PullRequestCodeTab.tsx index a1c3404f25085..c847e55738405 100644 --- a/apps/web/src/components/pullRequest/PullRequestCodeTab.tsx +++ b/apps/web/src/components/pullRequest/PullRequestCodeTab.tsx @@ -81,8 +81,8 @@ import { } from "@t3tools/client-runtime/pull-request-editing"; import { fileDiffRows } from "@t3tools/client-runtime/review-guide-tour"; import { isTestChangedFile } from "@t3tools/shared/changedFileKind"; +import { orderDiffFilesForReview } from "@t3tools/client-runtime/diff-file-order"; import { isWorkspaceImagePreviewPath } from "@t3tools/shared/mediaPreview"; -import { orderDiffFiles } from "./pullRequestFileOrder.logic"; import { buildFileDiffIdentityKey, buildFileDiffRenderKey, @@ -116,7 +116,7 @@ import { DiffFileTree } from "../diffs/DiffFileTree"; import { FileExplorerPane } from "../files/FileExplorerPane"; import { useCodeViewFileReveal } from "../diffs/useCodeViewFileReveal"; import { useHideTestFiles } from "../diffs/useHideTestFiles"; -import { diffFileTreeEntries, orderDiffFilesLikeTree } from "../diffs/diffFileTree.logic"; +import { diffFileTreeEntries } from "../diffs/diffFileTree.logic"; import { StyledDiffCodeView } from "../diffs/StyledDiffCodeView"; import { Button } from "../ui/button"; import { Checkbox } from "../ui/checkbox"; @@ -261,10 +261,9 @@ function diffModel( }); const model: DiffModel = { parsedSlices, - loadedFiles: orderDiffFilesLikeTree( - parsedSlices.flatMap((parsed) => - parsed?.kind === "files" ? orderDiffFiles(parsed.files) : [], - ), + loadedFiles: orderDiffFilesForReview( + parsedSlices.flatMap((parsed) => (parsed?.kind === "files" ? parsed.files : [])), + resolveFileDiffPath, ), sourceFileStats: new Map( parsedSlices.flatMap((parsed) => diff --git a/packages/client-runtime/package.json b/packages/client-runtime/package.json index 900dfad694aba..003abc03ac65f 100644 --- a/packages/client-runtime/package.json +++ b/packages/client-runtime/package.json @@ -59,6 +59,10 @@ "types": "./src/imageAttachmentSize.ts", "default": "./src/imageAttachmentSize.ts" }, + "./diff-file-order": { + "types": "./src/diffFileOrder.ts", + "default": "./src/diffFileOrder.ts" + }, "./handoff": { "types": "./src/handoff.ts", "default": "./src/handoff.ts" diff --git a/apps/web/src/components/pullRequest/pullRequestFileOrder.logic.test.ts b/packages/client-runtime/src/diffFileOrder.test.ts similarity index 75% rename from apps/web/src/components/pullRequest/pullRequestFileOrder.logic.test.ts rename to packages/client-runtime/src/diffFileOrder.test.ts index 0626e463d751a..c00579ac63f16 100644 --- a/apps/web/src/components/pullRequest/pullRequestFileOrder.logic.test.ts +++ b/packages/client-runtime/src/diffFileOrder.test.ts @@ -1,17 +1,22 @@ -import type { FileDiffMetadata } from "@pierre/diffs"; import { describe, expect, it } from "vite-plus/test"; -import { orderDiffFiles } from "./pullRequestFileOrder.logic"; +import { orderDiffFilesForReview } from "./diffFileOrder.ts"; -function file(name: string, additionLines: ReadonlyArray = []): FileDiffMetadata { - return { name, hunks: [], additionLines, deletionLines: [] } as unknown as FileDiffMetadata; +interface TestFile { + readonly name: string; + readonly additionLines: ReadonlyArray; + readonly deletionLines: ReadonlyArray; } -function order(files: ReadonlyArray): Array { - return orderDiffFiles(files).map((entry) => entry.name); +function file(name: string, additionLines: ReadonlyArray = []): TestFile { + return { name, additionLines, deletionLines: [] }; } -describe("orderDiffFiles", () => { +function order(files: ReadonlyArray): Array { + return orderDiffFilesForReview(files, (entry) => entry.name).map((entry) => entry.name); +} + +describe("orderDiffFilesForReview", () => { it("places source before tests and generated files across path conventions", () => { const source = ["src/app.ts", "src/dist.ts", "src/testing.ts"]; const tests = [ @@ -33,7 +38,42 @@ describe("orderDiffFiles", () => { ]; expect( order([...generated, ...tests, ...source].toReversed().map((path) => file(path))), - ).toEqual([...source, ...tests, ...generated]); + ).toEqual([ + ...source, + ...tests.slice(0, 3), + // Generated files under src/ stay in src/ so the list matches the tree. + "src/__snapshots__/app.ts", + "src/api.generated.ts", + "src/app.test.ts.snap", + ...tests.slice(3), + ...generated.slice(0, 5), + ]); + }); + + it("keeps both entries of a path that changed type, such as a file replaced by a symlink", () => { + const deleted = { ...file("AGENTS.md"), additionLines: [], deletionLines: ["# Agents"] }; + const added = file("AGENTS.md", ["CLAUDE.md"]); + expect( + orderDiffFilesForReview([file("CLAUDE.md"), deleted, added], (entry) => entry.name), + ).toEqual([deleted, added, file("CLAUDE.md")]); + }); + + it("pulls a test listed last into its directory, keeping the first-seen order", () => { + expect( + order([ + file("server/device/Host.ts"), + file("web/settings.ts"), + file("server/ws.ts"), + file("server/device/Host.test.ts"), + file("web/settings.test.ts"), + ]), + ).toEqual([ + "server/device/Host.ts", + "server/device/Host.test.ts", + "server/ws.ts", + "web/settings.ts", + "web/settings.test.ts", + ]); }); it("resolves a specifier that climbs out of the importer's directory", () => { diff --git a/apps/web/src/components/pullRequest/pullRequestFileOrder.logic.ts b/packages/client-runtime/src/diffFileOrder.ts similarity index 68% rename from apps/web/src/components/pullRequest/pullRequestFileOrder.logic.ts rename to packages/client-runtime/src/diffFileOrder.ts index 41ee82ebdf85e..0fbe3c057eaff 100644 --- a/apps/web/src/components/pullRequest/pullRequestFileOrder.logic.ts +++ b/packages/client-runtime/src/diffFileOrder.ts @@ -1,8 +1,9 @@ -import type { FileDiffMetadata } from "@pierre/diffs"; - -import { resolveFileDiffPath } from "~/lib/diffRendering"; +interface OrderableDiffFile { + readonly additionLines: ReadonlyArray; + readonly deletionLines: ReadonlyArray; +} -export type DiffFileTier = "source" | "test" | "generated"; +type DiffFileTier = "source" | "test" | "generated"; const GENERATED_FILE_NAMES = new Set([ "pnpm-lock.yaml", @@ -139,11 +140,16 @@ function testedSourcePosition(path: string, sourcePositions: ReadonlyMap, -): ReadonlyArray { - const byPath = new Map(); - for (const file of files) byPath.set(resolveFileDiffPath(file), file); +function orderByImportsAndTier( + files: ReadonlyArray, + pathOf: (file: F) => string, +): ReadonlyArray { + // A type change (file to symlink) is a delete and an add under one path; keep both. + const byPath = new Map(); + for (const file of files) { + const path = pathOf(file); + byPath.set(path, [...(byPath.get(path) ?? []), file]); + } const tiers = new Map(); for (const path of byPath.keys()) tiers.set(path, diffFileTier(path)); @@ -161,16 +167,10 @@ export function orderDiffFiles( const imports = new Map>(); for (const path of sourcePaths) { - const file = byPath.get(path)!; - imports.set( - path, - importedPaths( - path, - [...file.additionLines, ...file.deletionLines], - byModulePath, - byModuleName, - ), - ); + const lines = byPath + .get(path)! + .flatMap((file) => [...file.additionLines, ...file.deletionLines]); + imports.set(path, importedPaths(path, lines, byModulePath, byModuleName)); } const orderedSource = orderByImports(sourcePaths, imports); @@ -192,5 +192,59 @@ export function orderDiffFiles( .filter((path) => tiers.get(path) === "generated") .sort((left, right) => left.localeCompare(right)); - return [...orderedSource, ...orderedTests, ...orderedGenerated].map((path) => byPath.get(path)!); + return [...orderedSource, ...orderedTests, ...orderedGenerated].flatMap((path) => + byPath.get(path)!, + ); +} + +/** Where each file, and each directory (with a trailing slash), first appears in `paths`. */ +export function diffFileTreePositions(paths: ReadonlyArray): ReadonlyMap { + const positions = new Map(); + paths.forEach((path, index) => { + positions.set(path, index); + let directory = ""; + for (const segment of path.split("/").slice(0, -1)) { + directory += `${segment}/`; + if (!positions.has(directory)) positions.set(directory, index); + } + }); + return positions; +} + +function orderLikeTree(files: ReadonlyArray, pathOf: (file: F) => string): ReadonlyArray { + const paths = files.map(pathOf); + const positions = diffFileTreePositions(paths); + const keys = paths.map((path) => { + const key: number[] = []; + let directory = ""; + for (const segment of path.split("/").slice(0, -1)) { + directory += `${segment}/`; + key.push(positions.get(directory)!); + } + key.push(positions.get(path)!); + return key; + }); + return files + .map((file, index) => ({ file, key: keys[index]! })) + .sort((left, right) => { + const length = Math.min(left.key.length, right.key.length); + for (let index = 0; index < length; index++) { + const difference = left.key[index]! - right.key[index]!; + if (difference !== 0) return difference; + } + return left.key.length - right.key.length; + }) + .map(({ file }) => file); +} + +/** + * Review order shared by every client: dependencies before dependents, tests after their source, + * generated files last, then regrouped so each directory stays contiguous and a file tree built + * from `diffFileTreePositions` lists files in the same order. + */ +export function orderDiffFilesForReview( + files: ReadonlyArray, + pathOf: (file: F) => string, +): ReadonlyArray { + return orderLikeTree(orderByImportsAndTier(files, pathOf), pathOf); } From 6b6950adfe2ea03b31894829ac8bfb369c9c35a2 Mon Sep 17 00:00:00 2001 From: Victor Date: Thu, 19 Nov 2026 16:22:44 -0600 Subject: [PATCH 140/201] fix(mobile): Android diff word highlights sit on the changed characters (#33568) Co-authored-by: Julius Marminge --- .../t3reviewdiff/ReviewDiffCanvasDrawing.kt | 177 ++++++++++-------- .../modules/t3reviewdiff/T3ReviewDiffView.kt | 5 +- .../t3reviewdiff/ReviewDiffGeometryTest.kt | 82 ++++++++ 3 files changed, 188 insertions(+), 76 deletions(-) diff --git a/apps/mobile/modules/t3-review-diff/android/src/main/java/expo/modules/t3reviewdiff/ReviewDiffCanvasDrawing.kt b/apps/mobile/modules/t3-review-diff/android/src/main/java/expo/modules/t3reviewdiff/ReviewDiffCanvasDrawing.kt index 2f1e4d9fd4a43..d86861018c77d 100644 --- a/apps/mobile/modules/t3-review-diff/android/src/main/java/expo/modules/t3reviewdiff/ReviewDiffCanvasDrawing.kt +++ b/apps/mobile/modules/t3-review-diff/android/src/main/java/expo/modules/t3reviewdiff/ReviewDiffCanvasDrawing.kt @@ -221,6 +221,7 @@ internal class ReviewDiffCanvasDrawing(context: Context) { private var measuredContentWidth = 0 private var asciiCharacterWidth = 0f private var asciiFixedPitch = false + private var wordDiffLefts = FloatArray(0) fun tokensChangeWidth( previous: Map>, @@ -332,14 +333,58 @@ internal class ReviewDiffCanvasDrawing(context: Context) { configureMonospacePaint(theme.hunkText, style.hunkFontSizePx, style.hunkFontWeight) return textPaint.measureText(row.text.ifEmpty { row.content }) } - val runs = if (tokens.isNullOrEmpty()) listOf(DiffToken(row.content, null, 0)) else tokens - var width = 0f - // Match drawCode's run boundaries and fonts, including fallback glyphs and tabs. - for (run in runs) { - configureCodePaint(run.color ?: theme.text, run.fontStyle, style) - width += textPaint.measureText(run.content) + val lines = CodeWrapLayout.NONE.lines(row) + return forEachCodePiece(row, tokens, style, lines) { text, start, end, _, _, _, _ -> + textPaint.measureText(text, start, end) } - return width + } + + /** Row width, highlights and drawCode share these drawText pieces so their positions agree. */ + private inline fun forEachCodePiece( + row: DiffRow, + tokens: List?, + style: DiffStyle, + lines: CodeLines, + piece: ( + text: String, + start: Int, + end: Int, + tokenStart: Int, + x: Float, + line: Int, + note: Boolean + ) -> Float + ): Float { + val noteStart = row.noteStart ?: Int.MAX_VALUE + var line = 0 + var x = 0f + var tokenStart = 0 + val runCount = if (tokens.isNullOrEmpty()) 1 else tokens.size + for (index in 0 until runCount) { + val run = tokens?.getOrNull(index) + val text = run?.content ?: row.content + var start = 0 + while (start < text.length) { + while (line + 1 < lines.starts.size && lines.starts[line + 1] <= tokenStart + start) { + line += 1 + x = 0f + } + val note = tokenStart + start >= noteStart + var end = min(text.length, lines.end(line, Int.MAX_VALUE) - tokenStart) + if (!note) end = min(end, noteStart - tokenStart) + if (start == 0 || tokenStart + start == noteStart) { + configureCodePaint( + if (note) theme.warningText else run?.color ?: theme.text, + run?.fontStyle ?: 0, + style, + ) + } + x += piece(text, start, end, tokenStart, x, line, note) + start = end + } + tokenStart += text.length + } + return x } fun lineNumberColor(change: String): Int = when (change) { @@ -368,34 +413,55 @@ internal class ReviewDiffCanvasDrawing(context: Context) { fun drawWordDiffRanges( canvas: Canvas, row: DiffRow, + tokens: List?, codeX: Float, top: Int, bottom: Int, - lines: CodeLines + lines: CodeLines, + style: DiffStyle ) { - if (lines.nativeLayout != null) return - if (row.wordDiffRanges.isEmpty() || (row.change != "add" && row.change != "delete")) return + val changed = row.change == "add" || row.change == "delete" + if (lines.nativeLayout != null || row.wordDiffRanges.isEmpty() || !changed) return val color = if (row.change == "add") theme.addBar else theme.deleteBar backgroundPaint.color = withAlpha(color, 71) - val characterWidth = textPaint.measureText("M") + configureCodePaint(theme.text, 0, style) val fontHeight = textPaint.fontMetrics.run { descent - ascent } val highlightHeight = max(4f * density, min(bottom - top - 4f * density, fontHeight)) val highlightTop = (top + bottom - highlightHeight) / 2f - row.wordDiffRanges.forEach { range -> - lines.starts.forEachIndexed { line, lineStart -> - val start = max(range.start, lineStart) - val end = min(range.end, lines.end(line, Int.MAX_VALUE)) - if (end <= start) return@forEachIndexed - val left = codeX + (start - lineStart) * characterWidth - val right = max(left + 2f * density, left + (end - start) * characterWidth) - val lineTop = highlightTop + line * lines.height - canvas.drawRoundRect( - RectF(left, lineTop, right, lineTop + highlightHeight), - 3f * density, - 3f * density, - backgroundPaint, - ) + if (wordDiffLefts.size < row.wordDiffRanges.size) { + wordDiffLefts = FloatArray(row.wordDiffRanges.size) + } + val lefts = wordDiffLefts + val lastEnd = row.wordDiffRanges.maxOf { it.end } + forEachCodePiece(row, tokens, style, lines) { text, start, end, tokenStart, x, line, _ -> + val pieceX = codeX + x + val advance = textPaint.measureText(text, start, end) + + // Inside a piece an edge keeps its kerning and clusters, as drawText shapes the whole piece; + // the piece's end is where drawCode starts the next one. + fun edge(at: Int) = if (at == end) { + pieceX + advance + } else { + pieceX + textPaint.getRunAdvance(text, start, end, start, end, false, at) + } + row.wordDiffRanges.forEachIndexed { index, range -> + val left = max(range.start, lines.starts[line]) - tokenStart + val right = min(range.end, lines.end(line, Int.MAX_VALUE)) - tokenStart + if (right <= left) return@forEachIndexed + if (left in start until end) lefts[index] = edge(left) + if (right in start + 1..end) { + val lineTop = highlightTop + line * lines.height + val rightX = max(lefts[index] + 2f * density, edge(right)) + canvas.drawRoundRect( + RectF(lefts[index], lineTop, rightX, lineTop + highlightHeight), + 3f * density, + 3f * density, + backgroundPaint, + ) + } } + if (tokenStart + end >= lastEnd) return + advance } } @@ -417,35 +483,19 @@ internal class ReviewDiffCanvasDrawing(context: Context) { canvas.restore() return } - val runs = if (tokens.isNullOrEmpty()) listOf(DiffToken(row.content, null, 0)) else tokens - var line = 0 - var x = codeX - var column = 0 - splitAtNote(runs, row.noteStart).forEach { (run, note) -> - configureCodePaint( - if (note) theme.warningText else run.color ?: theme.text, - run.fontStyle, - style, - ) - var start = 0 - while (start < run.content.length) { - while (line + 1 < lines.starts.size && lines.starts[line + 1] <= column + start) { - line += 1 - x = codeX - } - val end = min(run.content.length, lines.end(line, Int.MAX_VALUE) - column) - val lineBaseline = baseline + line * lines.height - if (lineBaseline + textPaint.fontMetrics.descent >= canvas.clipBounds.top && - lineBaseline + textPaint.fontMetrics.ascent <= canvas.clipBounds.bottom - ) { - val segmentWidth = textPaint.measureText(run.content, start, end) - fillNote(canvas, note, x, x + segmentWidth, lineBaseline) - canvas.drawText(run.content, start, end, x, lineBaseline, textPaint) - x += segmentWidth - } - start = end + forEachCodePiece(row, tokens, style, lines) { text, start, end, _, x, line, note -> + val lineBaseline = baseline + line * lines.height + if (lineBaseline + textPaint.fontMetrics.descent >= canvas.clipBounds.top && + lineBaseline + textPaint.fontMetrics.ascent <= canvas.clipBounds.bottom + ) { + val left = codeX + x + val segmentWidth = textPaint.measureText(text, start, end) + fillNote(canvas, note, left, left + segmentWidth, lineBaseline) + canvas.drawText(text, start, end, left, lineBaseline, textPaint) + segmentWidth + } else { + 0f } - column += run.content.length } } @@ -553,24 +603,3 @@ private object ReviewDiffTypefaces { else -> regular } } - -/** Splits color runs where a cut line's note starts; the flag marks the note's runs. */ -private fun splitAtNote(runs: List, noteStart: Int?): List> { - if (noteStart == null) return runs.map { it to false } - return buildList { - var offset = 0 - for (run in runs) { - val end = offset + run.content.length - when { - end <= noteStart -> add(run to false) - offset >= noteStart -> add(run to true) - else -> { - val cut = noteStart - offset - add(run.copy(content = run.content.substring(0, cut)) to false) - add(run.copy(content = run.content.substring(cut)) to true) - } - } - offset = end - } - } -} diff --git a/apps/mobile/modules/t3-review-diff/android/src/main/java/expo/modules/t3reviewdiff/T3ReviewDiffView.kt b/apps/mobile/modules/t3-review-diff/android/src/main/java/expo/modules/t3reviewdiff/T3ReviewDiffView.kt index 91bb6719ed8fa..8b0a84a952caf 100644 --- a/apps/mobile/modules/t3-review-diff/android/src/main/java/expo/modules/t3reviewdiff/T3ReviewDiffView.kt +++ b/apps/mobile/modules/t3-review-diff/android/src/main/java/expo/modules/t3reviewdiff/T3ReviewDiffView.kt @@ -1329,9 +1329,10 @@ private class DiffCanvasView(context: Context) : View(context) { val firstLineBottom = top + lines.firstHeight(style.rowHeightPx.toInt()) drawScrollableCode(canvas, top, bottom) { codeX -> drawing.configureCodePaint(theme.text, 0, style) - drawing.drawWordDiffRanges(canvas, row, codeX, top, firstLineBottom, lines) val baseline = lines.baseline(top, firstLineBottom, textPaint) - drawing.drawCode(canvas, row, tokensByRowId[row.id], codeX, baseline, style, lines) + val tokens = tokensByRowId[row.id] + drawing.drawWordDiffRanges(canvas, row, tokens, codeX, top, firstLineBottom, lines, style) + drawing.drawCode(canvas, row, tokens, codeX, baseline, style, lines) } drawLineNumber(canvas, row, top, firstLineBottom) diff --git a/apps/mobile/modules/t3-review-diff/tests/android/src/test/kotlin/expo/modules/t3reviewdiff/ReviewDiffGeometryTest.kt b/apps/mobile/modules/t3-review-diff/tests/android/src/test/kotlin/expo/modules/t3reviewdiff/ReviewDiffGeometryTest.kt index beac68f8e5357..f2992979bf522 100644 --- a/apps/mobile/modules/t3-review-diff/tests/android/src/test/kotlin/expo/modules/t3reviewdiff/ReviewDiffGeometryTest.kt +++ b/apps/mobile/modules/t3-review-diff/tests/android/src/test/kotlin/expo/modules/t3reviewdiff/ReviewDiffGeometryTest.kt @@ -1,6 +1,12 @@ package expo.modules.t3reviewdiff +import android.graphics.Bitmap +import android.graphics.Canvas import android.graphics.Color +import android.graphics.Paint +import android.graphics.RectF +import android.text.StaticLayout +import android.text.TextPaint import android.view.View import kotlin.math.ceil import expo.modules.kotlin.AppContext @@ -177,6 +183,82 @@ class ReviewDiffGeometryTest { } } + @Test + fun unwrappedWordDiffHighlightsCoverTheTextDrawCodeDraws() { + val drawing = ReviewDiffCanvasDrawing(RuntimeEnvironment.getApplication()) + val boxes = mutableListOf() + val texts = mutableMapOf() + val paints = mutableMapOf() + val bitmap = Bitmap.createBitmap(1000, 60, Bitmap.Config.ARGB_8888) + val canvas = object : Canvas(bitmap) { + override fun drawRoundRect(rect: RectF, rx: Float, ry: Float, paint: Paint) { + boxes += RectF(rect) + } + + override fun drawText( + text: String, + start: Int, + end: Int, + x: Float, + y: Float, + paint: Paint + ) { + texts[text.substring(start, end)] = x + paints[text.substring(start, end)] = TextPaint(paint) + } + } + + // The framework's caret position in the piece drawCode drew, kerning included. + fun caret(piece: String, offset: Int): Float { + val layout = StaticLayout.Builder.obtain(piece, 0, piece.length, paints.getValue(piece), 1000) + return texts.getValue(piece) + layout.build().getPrimaryHorizontal(offset) + } + val lines = CodeLines(intArrayOf(0), 0) + for (weight in listOf("medium", "regular")) { + val style = DiffStyle.defaults(1f).copy(codeFontWeight = weight, codeFontSizePx = 17f) + for (prefix in listOf("if ", "说明 ", "😀 ")) { + val tokens = listOf( + DiffToken(prefix, Color.RED, 2), + DiffToken("go ", Color.BLUE, 0), + DiffToken("1.27.3", Color.GREEN, 0), + DiffToken(";", Color.BLUE, 0), + DiffToken(" LTP.", Color.BLUE, 0), + DiffToken(" AV", Color.GREEN, 0), + DiffToken("LP.", Color.BLUE, 0), + ) + val content = tokens.joinToString("") { it.content } + val start = content.indexOf("1.27.3") + val kerned = content.indexOf("TP") + val crossing = content.indexOf("VLP") + val row = row("line", content).copy( + wordDiffRanges = listOf( + DiffWordDiffRange(start, start + "1.27.3".length), + DiffWordDiffRange(kerned, kerned + 2), + DiffWordDiffRange(crossing, crossing + 3), + ), + ) + boxes.clear() + texts.clear() + paints.clear() + drawing.configureCodePaint(Color.BLACK, 0, style) + drawing.drawWordDiffRanges(canvas, row, tokens, 10f, 0, 40, lines, style) + drawing.drawCode(canvas, row, tokens, 10f, 28f, style, lines) + assertEquals(3, boxes.size) + val (box, kernedBox, crossingBox) = boxes + val case = "weight=$weight prefix=$prefix" + assertEquals("$case left", requireNotNull(texts["1.27.3"]), box.left, 0.5f) + assertEquals("$case right", requireNotNull(texts[";"]), box.right, 0.5f) + val unkerned = texts.getValue(" LTP.") + paints.getValue(" LTP.").measureText(" L") + if (weight == "medium") assertTrue("$case L and T kern", caret(" LTP.", 2) < unkerned - 1f) + assertEquals("$case kerned left", caret(" LTP.", 2), kernedBox.left, 0.5f) + assertEquals("$case kerned right", caret(" LTP.", 4), kernedBox.right, 0.5f) + assertEquals("$case crossing left", caret(" AV", 2), crossingBox.left, 0.5f) + assertEquals("$case crossing right", caret("LP.", 2), crossingBox.right, 0.5f) + } + } + bitmap.recycle() + } + @Test fun lazyAsciiHeightAndLineStartsMatchTheExistingLayoutAtEveryBoundary() { val drawing = ReviewDiffCanvasDrawing(RuntimeEnvironment.getApplication()) From 57db750b8f379d6656ad774b11bb6039094ca873 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Thu, 19 Nov 2026 14:46:32 -0800 Subject: [PATCH 141/201] fix(server): Copilot subagent thinking and replies reach the subagent thread (#38896) --- .../Adapters/AcpAdapterV2.test.ts | 15 +++++++++++++-- .../src/server/copilotAcp.ts | 11 +++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.ts b/apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.ts index cc56b4c29abdf..c3d54f06719fa 100644 --- a/apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.ts +++ b/apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.ts @@ -4222,6 +4222,17 @@ describe("AcpAdapterV2", () => { }), ), ); + // Copilot 1.0.114 names the subagent only by agentId, on the delta and the chunk. + const agentChunk = (text: string, agentId: string) => + raw("assistant.message_delta", { deltaContent: text }, agentId).pipe( + Effect.andThen( + update({ + sessionUpdate: "agent_message_chunk", + content: { type: "text", text }, + _meta: { "github.com/copilot": { agentId } }, + }), + ), + ); const launch = (toolCallId: string, description: string, mode: string) => update({ sessionUpdate: "tool_call", @@ -4259,10 +4270,10 @@ describe("AcpAdapterV2", () => { _meta: { "github.com/copilot": { agentId: "agent-a" } }, }); yield* chunk("`a.txt` says", "task-a"); - yield* chunk("`b.txt` has", "task-b"); + yield* agentChunk("`b.txt` has", "agent-b"); yield* chunk(" hello.", "task-a"); yield* chunk("a.txt b.txt", "task-bg"); - yield* chunk(" three lines.", "task-b"); + yield* agentChunk(" three lines.", "agent-b"); for (const [task, agent, text] of [ ["task-a", "agent-a", "`a.txt` says hello."], ["task-b", "agent-b", "`b.txt` has three lines."], diff --git a/packages/provider-acp-registry/src/server/copilotAcp.ts b/packages/provider-acp-registry/src/server/copilotAcp.ts index 44723c79dc1d5..6594e5036cb02 100644 --- a/packages/provider-acp-registry/src/server/copilotAcp.ts +++ b/packages/provider-acp-registry/src/server/copilotAcp.ts @@ -109,12 +109,19 @@ export function makeCopilotSubagentRouting() { const registerExtensions = (context: AcpAdapterV2ExtensionContext) => context.runtime.handleExtNotification(COPILOT_SESSION_EVENT, CopilotSessionEvent, (event) => { const data = event.data ?? {}; - const task = typeof data.parentToolCallId === "string" ? data.parentToolCallId : undefined; switch (event.type) { case "assistant.message_delta": case "assistant.reasoning_delta": { if (typeof data.deltaContent !== "string") return Effect.void; - session(event.sessionId).delta = { + const current = session(event.sessionId); + // Copilot 1.0.114+ names a subagent's deltas only by agentId, without parentToolCallId. + const task = + typeof data.parentToolCallId === "string" + ? data.parentToolCallId + : event.agentId === undefined + ? undefined + : current.taskByAgentId.get(event.agentId); + current.delta = { kind: event.type, text: data.deltaContent, ...(task === undefined ? {} : { task }), From cb391b5b5741553ef136d93486a3f6cf89d0c026 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Thu, 19 Nov 2026 14:54:21 -0800 Subject: [PATCH 142/201] fix(server): agent activity publish keeps retrying after a network drop (#39402) --- .../src/relay/AgentAwarenessRelay.test.ts | 47 +++++++++++++++++-- apps/server/src/relay/AgentAwarenessRelay.ts | 16 +++++-- 2 files changed, 55 insertions(+), 8 deletions(-) diff --git a/apps/server/src/relay/AgentAwarenessRelay.test.ts b/apps/server/src/relay/AgentAwarenessRelay.test.ts index 5cde458a1cd30..da3b0f30a99cb 100644 --- a/apps/server/src/relay/AgentAwarenessRelay.test.ts +++ b/apps/server/src/relay/AgentAwarenessRelay.test.ts @@ -291,9 +291,13 @@ const makeTestRelay = Effect.fnUntraced(function* ( authorization: new Headers(init?.headers).get("authorization"), state: payload.state, }); - return Promise.resolve( - options.respond?.(publications.length) ?? Response.json({ ok: true, deliveries: [] }), - ); + try { + return Promise.resolve( + options.respond?.(publications.length) ?? Response.json({ ok: true, deliveries: [] }), + ); + } catch (error) { + return Promise.reject(error); + } }, { preconnect: () => {} }, ); @@ -972,6 +976,43 @@ describe("AgentAwarenessRelay", () => { }), ); + it.effect("delivers a completion once the network returns after the retry budget runs out", () => + Effect.gen(function* () { + let networkUp = true; + const delivered: Array = []; + const { relay, currentShell, publications } = yield* makeTestRelay({ + respond: (attempt) => { + if (!networkUp) throw new TypeError("fetch failed: getaddrinfo EAI_AGAIN"); + delivered.push(publications[attempt - 1]?.state?.phase ?? null); + return Response.json({ ok: true, deliveries: [] }); + }, + }); + yield* relay.publishThread(THREAD_ID); + networkUp = false; + yield* Ref.set(currentShell, shell({ status: "completed" })); + yield* relay.publishThread(THREAD_ID); + yield* TestClock.adjust("5 seconds"); + yield* relay.drain; + for (const delay of [ + "1 second", + "2 seconds", + "4 seconds", + "8 seconds", + "16 seconds", + ] as const) { + yield* TestClock.adjust(delay); + yield* relay.drain; + } + assert.equal(publications.length, 7); + assert.deepEqual(delivered, ["running"]); + + networkUp = true; + yield* TestClock.adjust("10 minutes"); + yield* relay.drain; + assert.deepEqual(delivered, ["running", "completed"]); + }), + ); + it.effect("keeps settled live work until its awaited monitor finishes", () => Effect.gen(function* () { const { relay, currentShell, publications } = yield* makeTestRelay(); diff --git a/apps/server/src/relay/AgentAwarenessRelay.ts b/apps/server/src/relay/AgentAwarenessRelay.ts index 75e84e7bb8c96..c9f38ed345ae9 100644 --- a/apps/server/src/relay/AgentAwarenessRelay.ts +++ b/apps/server/src/relay/AgentAwarenessRelay.ts @@ -205,6 +205,8 @@ function resolveAgentActivityPublishingStartupState(input: { const RELAY_AGENT_ACTIVITY_DETAIL_MAX_LENGTH = 160; const REDACTED_RELAY_AGENT_FAILURE_DETAIL = "The agent run failed."; const RELAY_AGENT_ACTIVITY_RETRY_DELAYS_MS = [1_000, 2_000, 4_000, 8_000, 16_000] as const; +// Nothing else re-queues a thread when the network returns, so a lost terminal state is retried until it lands. +const RELAY_AGENT_ACTIVITY_STEADY_RETRY_DELAY_MS = 60_000; function sanitizeRelayAgentActivityState( state: RelayAgentActivityState | null, @@ -820,11 +822,15 @@ export const make = Effect.gen(function* () { schedulePublishRetry = Effect.fnUntraced(function* (threadId: ThreadId) { const attempts = publishRetries.get(threadId)?.attempts ?? 0; - const delayMs = RELAY_AGENT_ACTIVITY_RETRY_DELAYS_MS[attempts]; - if (delayMs === undefined) { - // Retain exhausted budgets until activity or success resets them; old timers must not restart retries. - yield* Effect.logWarning("agent activity publish retry budget exhausted", { threadId }); - return; + const delayMs = + RELAY_AGENT_ACTIVITY_RETRY_DELAYS_MS[attempts] ?? RELAY_AGENT_ACTIVITY_STEADY_RETRY_DELAY_MS; + if (attempts === RELAY_AGENT_ACTIVITY_RETRY_DELAYS_MS.length) { + yield* Effect.logWarning( + "agent activity publish retry budget exhausted; retrying every minute", + { + threadId, + }, + ); } const retry = { attempts: attempts + 1, From 2bba2564cafd651a1ca36de1b2b8492ad9124498 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Thu, 19 Nov 2026 15:03:47 -0800 Subject: [PATCH 143/201] perf(server): thread shell item counts no longer sum every run the thread has had (#39391) --- .../orchestration-v2/ProjectionStore.test.ts | 4 + .../src/orchestration-v2/ProjectionStore.ts | 50 ++++---- apps/server/src/persistence/Migrations.ts | 2 + .../Migrations/102_ThreadItemCounts.test.ts | 89 ++++++++++++++ .../Migrations/102_ThreadItemCounts.ts | 112 ++++++++++++++++++ .../reconcileV2PreviewMigration.test.ts | 2 + 6 files changed, 235 insertions(+), 24 deletions(-) create mode 100644 apps/server/src/persistence/Migrations/102_ThreadItemCounts.test.ts create mode 100644 apps/server/src/persistence/Migrations/102_ThreadItemCounts.ts diff --git a/apps/server/src/orchestration-v2/ProjectionStore.test.ts b/apps/server/src/orchestration-v2/ProjectionStore.test.ts index dabe53aeae46f..79478def6dfd1 100644 --- a/apps/server/src/orchestration-v2/ProjectionStore.test.ts +++ b/apps/server/src/orchestration-v2/ProjectionStore.test.ts @@ -7178,6 +7178,10 @@ it.layer(layerTest)("ProjectionStoreV2", (it) => { if (/^SEARCH (r|run) /.test(detail)) { assert.include(detail, "COVERING INDEX", detail); } + // A thread's item count reads one count row per hidden run, not one per run it had. + if (detail.startsWith("SEARCH counts ")) { + assert.include(detail, "run_key=?", detail); + } if (detail.includes("orchestration_v2_projection_turn_items")) { // Only held input is read from the sparse index; transcript history stays unread. assert.include( diff --git a/apps/server/src/orchestration-v2/ProjectionStore.ts b/apps/server/src/orchestration-v2/ProjectionStore.ts index 930639b5d6bbe..a8d06679c801a 100644 --- a/apps/server/src/orchestration-v2/ProjectionStore.ts +++ b/apps/server/src/orchestration-v2/ProjectionStore.ts @@ -8565,30 +8565,32 @@ export const layer: Layer.Layer = const selectShellItemCounts = (threadIds: ReadonlyArray) => sql` - SELECT counts.thread_id, - SUM(CASE WHEN counts.run_key = '' OR r.status <> 'rolled_back' - THEN counts.item_count - CASE - WHEN r.status IN ('queued', 'cancelled') THEN ( - SELECT COUNT(*) - FROM orchestration_v2_projection_turn_items held - INDEXED BY orchestration_v2_projection_turn_items_queued_input_idx - WHERE held.run_id = counts.run_key - AND held.type = 'user_message' - AND json_valid(held.payload_json) - AND json_extract(held.payload_json, '$.inputIntent') = 'queued_turn' - ) - ELSE 0 - END - ELSE 0 END) AS item_count, - SUM(CASE WHEN counts.run_key = '' THEN counts.item_count ELSE 0 END) - AS runless_item_count - FROM orchestration_v2_projection_turn_item_counts counts - -- The primary key would load each run's whole row just for its status. - LEFT JOIN orchestration_v2_projection_runs r - INDEXED BY orchestration_v2_projection_runs_run_status_idx - ON r.run_id = counts.run_key - WHERE counts.thread_id IN (SELECT value FROM json_each(${encodeIdList(threadIds)})) - GROUP BY counts.thread_id + -- Only the thread's hidden runs are visited, so settled history costs nothing here. + SELECT totals.thread_id, + totals.item_count - COALESCE(( + SELECT SUM(CASE WHEN r.status = 'rolled_back' THEN counts.item_count ELSE ( + SELECT COUNT(*) + FROM orchestration_v2_projection_turn_items held + INDEXED BY orchestration_v2_projection_turn_items_queued_input_idx + WHERE held.run_id = counts.run_key + AND held.type = 'user_message' + AND json_valid(held.payload_json) + AND json_extract(held.payload_json, '$.inputIntent') = 'queued_turn' + ) END) + FROM orchestration_v2_projection_runs r + INDEXED BY orchestration_v2_projection_runs_hidden_items_idx + JOIN orchestration_v2_projection_turn_item_counts counts + ON counts.thread_id = r.thread_id AND counts.run_key = r.run_id + WHERE r.thread_id = totals.thread_id + AND r.status IN ('rolled_back', 'queued', 'cancelled') + ), 0) AS item_count, + COALESCE(( + SELECT runless.item_count + FROM orchestration_v2_projection_turn_item_counts runless + WHERE runless.thread_id = totals.thread_id AND runless.run_key = '' + ), 0) AS runless_item_count + FROM orchestration_v2_projection_thread_item_counts totals + WHERE totals.thread_id IN (SELECT value FROM json_each(${encodeIdList(threadIds)})) `; const selectShellProviderThreadRows = (threadIds?: ReadonlyArray) => diff --git a/apps/server/src/persistence/Migrations.ts b/apps/server/src/persistence/Migrations.ts index c3fc7aacef055..6f0b74e029606 100644 --- a/apps/server/src/persistence/Migrations.ts +++ b/apps/server/src/persistence/Migrations.ts @@ -109,6 +109,7 @@ import Migration0098 from "./Migrations/098_ActiveShellIndexIndexes.ts"; import Migration0099 from "./Migrations/099_BackgroundRecoveryIndexes.ts"; import Migration0100 from "./Migrations/100_TurnStartReadIndexes.ts"; import Migration0101 from "./Migrations/101_DelegatedTaskReadIndexes.ts"; +import Migration0102 from "./Migrations/102_ThreadItemCounts.ts"; const migrationEntries = [ [1, "OrchestrationEvents", Migration0001], @@ -213,6 +214,7 @@ const migrationEntries = [ [99, "BackgroundRecoveryIndexes", Migration0099], [100, "TurnStartReadIndexes", Migration0100], [101, "DelegatedTaskReadIndexes", Migration0101], + [102, "ThreadItemCounts", Migration0102], ] as const; export const migrationManifest = migrationEntries.map(([id, name]) => [id, name] as const); diff --git a/apps/server/src/persistence/Migrations/102_ThreadItemCounts.test.ts b/apps/server/src/persistence/Migrations/102_ThreadItemCounts.test.ts new file mode 100644 index 0000000000000..678186e55b81c --- /dev/null +++ b/apps/server/src/persistence/Migrations/102_ThreadItemCounts.test.ts @@ -0,0 +1,89 @@ +import { assert, it } from "@effect/vitest"; +import * as NodeSqliteClient from "@t3tools/shared/nodeSqliteClient"; +import * as Effect from "effect/Effect"; +import * as SqlClient from "effect/sql/SqlClient"; + +import { runMigrations } from "../Migrations.ts"; + +const layer = it.layer(NodeSqliteClient.layer({ filename: ":memory:" })); + +layer("102_ThreadItemCounts", (it) => { + it.effect("matches a recount of items without a run or with an existing run", () => + Effect.gen(function* () { + const sql = yield* SqlClient.SqlClient; + yield* runMigrations({ toMigrationInclusive: 101 }); + const upsertItem = (id: string, threadId: string, runId: string | null) => sql` + INSERT INTO orchestration_v2_projection_turn_items ( + turn_item_id, thread_id, run_id, ordinal, type, status, updated_at, payload_json + ) + VALUES ( + ${id}, ${threadId}, ${runId}, 1, 'assistant_message', 'completed', + '2026-11-19T00:00:00.000Z', '{}' + ) + ON CONFLICT(turn_item_id) DO UPDATE SET thread_id = excluded.thread_id, run_id = excluded.run_id + `; + const insertRun = (runId: string, threadId: string) => sql` + INSERT INTO orchestration_v2_projection_runs ( + run_id, thread_id, ordinal, provider, status, requested_at, payload_json + ) + VALUES ( + ${runId}, ${threadId}, + (SELECT COUNT(*) FROM orchestration_v2_projection_runs WHERE thread_id = ${threadId}), + 'codex', 'completed', '2026-11-19T00:00:00.000Z', '{}' + ) + `; + const totals = () => sql<{ readonly thread_id: string; readonly item_count: number }>` + SELECT thread_id, item_count FROM orchestration_v2_projection_thread_item_counts + ORDER BY thread_id + `; + const recount = () => sql<{ readonly thread_id: string; readonly item_count: number }>` + SELECT item.thread_id, COUNT(*) AS item_count + FROM orchestration_v2_projection_turn_items item + WHERE item.run_id IS NULL + OR EXISTS (SELECT 1 FROM orchestration_v2_projection_runs run WHERE run.run_id = item.run_id) + GROUP BY item.thread_id + ORDER BY item.thread_id + `; + const assertTotals = (expected: ReadonlyArray) => + Effect.gen(function* () { + const actual = yield* totals(); + assert.deepEqual(actual, yield* recount()); + assert.deepEqual( + actual.map((row) => [row.thread_id, row.item_count]), + expected.map(([threadId, count]) => [threadId, count]), + ); + }); + + yield* insertRun("run-1", "thread-1"); + yield* upsertItem("runless", "thread-1", null); + yield* upsertItem("run-1:a", "thread-1", "run-1"); + yield* upsertItem("late:a", "thread-1", "run-late"); + yield* runMigrations(); + yield* assertTotals([["thread-1", 2]]); + + yield* upsertItem("run-1:b", "thread-1", "run-1"); + yield* upsertItem("late:b", "thread-2", "run-late"); + yield* assertTotals([["thread-1", 3]]); + + yield* insertRun("run-late", "thread-1"); + yield* assertTotals([ + ["thread-1", 4], + ["thread-2", 1], + ]); + + yield* upsertItem("run-1:b", "thread-2", null); + yield* upsertItem("late:a", "thread-1", "run-missing"); + yield* assertTotals([ + ["thread-1", 2], + ["thread-2", 2], + ]); + + yield* sql`DELETE FROM orchestration_v2_projection_runs WHERE run_id = 'run-late'`; + yield* sql`DELETE FROM orchestration_v2_projection_turn_items WHERE turn_item_id = 'run-1:b'`; + yield* assertTotals([["thread-1", 2]]); + + yield* sql`DELETE FROM orchestration_v2_projection_turn_items WHERE thread_id = 'thread-1'`; + yield* assertTotals([]); + }), + ); +}); diff --git a/apps/server/src/persistence/Migrations/102_ThreadItemCounts.ts b/apps/server/src/persistence/Migrations/102_ThreadItemCounts.ts new file mode 100644 index 0000000000000..5cbfee859cd45 --- /dev/null +++ b/apps/server/src/persistence/Migrations/102_ThreadItemCounts.ts @@ -0,0 +1,112 @@ +import * as Effect from "effect/Effect"; +import * as SqlClient from "effect/sql/SqlClient"; + +/** + * One total per thread beside 085's per-run counts, so a shell read does not sum every run the + * thread has had. It holds the items without a run or with an existing run, the rows the shell + * read used to sum; the read still applies the run status rules. Triggers keep it exact. + */ +export default Effect.gen(function* () { + const sql = yield* SqlClient.SqlClient; + + yield* sql` + CREATE TABLE orchestration_v2_projection_thread_item_counts ( + thread_id TEXT PRIMARY KEY, + item_count INTEGER NOT NULL + ) WITHOUT ROWID + `; + yield* sql` + INSERT INTO orchestration_v2_projection_thread_item_counts (thread_id, item_count) + SELECT counts.thread_id, SUM(counts.item_count) + FROM orchestration_v2_projection_turn_item_counts counts + WHERE counts.run_key = '' + OR EXISTS (SELECT 1 FROM orchestration_v2_projection_runs WHERE run_id = counts.run_key) + GROUP BY counts.thread_id + `; + + // The shell read subtracts only these runs. ProjectionStore.selectShellItemCounts must spell + // the same predicate for SQLite to use this partial index. + yield* sql` + CREATE INDEX IF NOT EXISTS orchestration_v2_projection_runs_hidden_items_idx + ON orchestration_v2_projection_runs(thread_id, status, run_id) + WHERE status IN ('rolled_back', 'queued', 'cancelled') + `; + + // 085's triggers upsert per-run counts, so an item write fires the insert or the update here. + yield* sql` + CREATE TRIGGER orchestration_v2_thread_item_counts_count_insert + AFTER INSERT ON orchestration_v2_projection_turn_item_counts + WHEN new.run_key = '' + OR EXISTS (SELECT 1 FROM orchestration_v2_projection_runs WHERE run_id = new.run_key) + BEGIN + INSERT INTO orchestration_v2_projection_thread_item_counts (thread_id, item_count) + VALUES (new.thread_id, new.item_count) + ON CONFLICT (thread_id) DO UPDATE SET item_count = item_count + excluded.item_count; + END + `; + yield* sql` + CREATE TRIGGER orchestration_v2_thread_item_counts_count_update + AFTER UPDATE ON orchestration_v2_projection_turn_item_counts + BEGIN + UPDATE orchestration_v2_projection_thread_item_counts + SET item_count = item_count - old.item_count + WHERE thread_id = old.thread_id + AND (old.run_key = '' + OR EXISTS (SELECT 1 FROM orchestration_v2_projection_runs WHERE run_id = old.run_key)); + INSERT INTO orchestration_v2_projection_thread_item_counts (thread_id, item_count) + SELECT new.thread_id, new.item_count + WHERE new.run_key = '' + OR EXISTS (SELECT 1 FROM orchestration_v2_projection_runs WHERE run_id = new.run_key) + ON CONFLICT (thread_id) DO UPDATE SET item_count = item_count + excluded.item_count; + DELETE FROM orchestration_v2_projection_thread_item_counts + WHERE thread_id = old.thread_id AND item_count <= 0; + END + `; + yield* sql` + CREATE TRIGGER orchestration_v2_thread_item_counts_count_delete + AFTER DELETE ON orchestration_v2_projection_turn_item_counts + WHEN old.run_key = '' + OR EXISTS (SELECT 1 FROM orchestration_v2_projection_runs WHERE run_id = old.run_key) + BEGIN + UPDATE orchestration_v2_projection_thread_item_counts + SET item_count = item_count - old.item_count + WHERE thread_id = old.thread_id; + DELETE FROM orchestration_v2_projection_thread_item_counts + WHERE thread_id = old.thread_id AND item_count <= 0; + END + `; + + // Items can be written before their run; they count from when it exists. + yield* sql` + CREATE TRIGGER orchestration_v2_thread_item_counts_run_insert + AFTER INSERT ON orchestration_v2_projection_runs + BEGIN + INSERT INTO orchestration_v2_projection_thread_item_counts (thread_id, item_count) + SELECT thread_id, COUNT(*) + FROM orchestration_v2_projection_turn_items + WHERE run_id = new.run_id + GROUP BY thread_id + ON CONFLICT (thread_id) DO UPDATE SET item_count = item_count + excluded.item_count; + END + `; + yield* sql` + CREATE TRIGGER orchestration_v2_thread_item_counts_run_delete + AFTER DELETE ON orchestration_v2_projection_runs + BEGIN + UPDATE orchestration_v2_projection_thread_item_counts + SET item_count = item_count - ( + SELECT COUNT(*) + FROM orchestration_v2_projection_turn_items item + WHERE item.run_id = old.run_id + AND item.thread_id = orchestration_v2_projection_thread_item_counts.thread_id + ) + WHERE thread_id IN ( + SELECT thread_id FROM orchestration_v2_projection_turn_items WHERE run_id = old.run_id + ); + DELETE FROM orchestration_v2_projection_thread_item_counts + WHERE item_count <= 0 AND thread_id IN ( + SELECT thread_id FROM orchestration_v2_projection_turn_items WHERE run_id = old.run_id + ); + END + `; +}); diff --git a/apps/server/src/persistence/reconcileV2PreviewMigration.test.ts b/apps/server/src/persistence/reconcileV2PreviewMigration.test.ts index b9feabbf89b88..1703789b6b479 100644 --- a/apps/server/src/persistence/reconcileV2PreviewMigration.test.ts +++ b/apps/server/src/persistence/reconcileV2PreviewMigration.test.ts @@ -81,6 +81,7 @@ describe("V2 preview upgrade", () => { [99, "BackgroundRecoveryIndexes"], [100, "TurnStartReadIndexes"], [101, "DelegatedTaskReadIndexes"], + [102, "ThreadItemCounts"], ]); assert.deepStrictEqual(yield* runMigrations(), []); assert.deepStrictEqual(yield* sql`SELECT * FROM orchestration_v2_legacy_imports`, imports); @@ -205,6 +206,7 @@ describe("V2 preview upgrade", () => { [99, "BackgroundRecoveryIndexes"], [100, "TurnStartReadIndexes"], [101, "DelegatedTaskReadIndexes"], + [102, "ThreadItemCounts"], ]); }).pipe(Effect.provide(NodeSqliteClient.layer({ filename: ":memory:" }))), ); From 420d1b59003f5340624786e5e3c9e06d57db55b7 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Thu, 19 Nov 2026 15:09:06 -0800 Subject: [PATCH 144/201] feat(desktop): forward another environment's ports to this machine (#39393) Co-authored-by: Claude Opus 5.5 --- apps/desktop/src/ipc/channels.ts | 5 + apps/desktop/src/ipc/methods/preview.ts | 51 ++++ apps/desktop/src/preload.ts | 16 ++ .../src/preview/LoopbackTunnel.test.ts | 239 +++++++++++++++- apps/desktop/src/preview/LoopbackTunnel.ts | 254 +++++++++++++++++- apps/web/src/components/CommandPalette.tsx | 22 +- .../CommandPalettePortForwardItems.tsx | 215 +++++++++++++++ .../components/chat/ThreadServersPanel.tsx | 172 +++++++++--- apps/web/src/i18n/translations/de.json | 51 +++- apps/web/src/i18n/translations/en.json | 53 +++- apps/web/src/i18n/translations/es.json | 53 +++- apps/web/src/i18n/translations/fr.json | 53 +++- apps/web/src/i18n/translations/ja.json | 53 +++- apps/web/src/i18n/translations/ko.json | 51 +++- apps/web/src/i18n/translations/pt-BR.json | 51 +++- apps/web/src/i18n/translations/ru.json | 51 +++- apps/web/src/i18n/translations/sv.json | 53 +++- apps/web/src/i18n/translations/zh.json | 53 +++- apps/web/src/state/portForwards.ts | 152 +++++++++++ docs/user/remote-access.md | 17 ++ packages/client-runtime/src/state/session.ts | 1 + packages/contracts/src/ipc.ts | 25 +- 22 files changed, 1527 insertions(+), 164 deletions(-) create mode 100644 apps/web/src/components/CommandPalettePortForwardItems.tsx create mode 100644 apps/web/src/state/portForwards.ts diff --git a/apps/desktop/src/ipc/channels.ts b/apps/desktop/src/ipc/channels.ts index bb708a6ab7c88..4a99d52b0e79d 100644 --- a/apps/desktop/src/ipc/channels.ts +++ b/apps/desktop/src/ipc/channels.ts @@ -128,6 +128,11 @@ export const PREVIEW_OPEN_LINK_CHANNEL = "desktop:preview-open-link"; export const PREVIEW_FIND_RESULT_CHANNEL = "desktop:preview-find-result"; export const PREVIEW_TUNNEL_ACCESS_REQUEST_CHANNEL = "desktop:preview-tunnel-access-request"; export const PREVIEW_TUNNEL_ACCESS_RESOLVE_CHANNEL = "desktop:preview-tunnel-access-resolve"; +export const PORT_FORWARD_START_CHANNEL = "desktop:port-forward-start"; +export const PORT_FORWARD_STOP_CHANNEL = "desktop:port-forward-stop"; +export const PORT_FORWARD_LIST_CHANNEL = "desktop:port-forward-list"; +export const PORT_FORWARD_CHANGE_CHANNEL = "desktop:port-forward-change"; +export const PORT_FORWARD_SHARES_LOOPBACK_CHANNEL = "desktop:port-forward-shares-loopback"; export const MAC_PERMISSION_HELPER_CHANNEL = "desktop:mac-permission-helper"; diff --git a/apps/desktop/src/ipc/methods/preview.ts b/apps/desktop/src/ipc/methods/preview.ts index f06c26014f40e..9dc0465c1e55a 100644 --- a/apps/desktop/src/ipc/methods/preview.ts +++ b/apps/desktop/src/ipc/methods/preview.ts @@ -23,6 +23,9 @@ import { DesktopPreviewCreateTabInputSchema, DesktopPreviewTabInputSchema, DesktopPreviewTunnelAccessResolutionInputSchema, + DesktopPortForwardInputSchema, + DesktopPortForwardSchema, + DesktopSharesLoopbackInputSchema, DesktopPreviewWebviewConfigSchema, PreviewAnnotationSubmissionResultSchema, PreviewCaptureFailure, @@ -66,6 +69,10 @@ export const installPreviewEventForwarding = Effect.fn( yield* manager.subscribeFindResults((event) => electronWindow.sendAll(IpcChannels.PREVIEW_FIND_RESULT_CHANNEL, event), ); + const tunnel = yield* LoopbackTunnel.LoopbackTunnel; + yield* tunnel.subscribeForwards((forwards) => + electronWindow.sendAll(IpcChannels.PORT_FORWARD_CHANGE_CHANNEL, forwards), + ); }); const setForwardedShortcuts = DesktopIpc.makeIpcMethod({ @@ -379,6 +386,46 @@ const resolveTunnelAccess = DesktopIpc.makeIpcMethod({ }), }); +const forwardPort = DesktopIpc.makeIpcMethod({ + channel: IpcChannels.PORT_FORWARD_START_CHANNEL, + payload: DesktopPortForwardInputSchema, + result: DesktopPortForwardSchema, + handler: Effect.fn("desktop.ipc.preview.forwardPort")(function* (input) { + const tunnel = yield* LoopbackTunnel.LoopbackTunnel; + return yield* tunnel.forward(input); + }), +}); + +const stopPortForward = DesktopIpc.makeIpcMethod({ + channel: IpcChannels.PORT_FORWARD_STOP_CHANNEL, + payload: DesktopPortForwardInputSchema, + result: Schema.Void, + handler: Effect.fn("desktop.ipc.preview.stopPortForward")(function* (input) { + const tunnel = yield* LoopbackTunnel.LoopbackTunnel; + yield* tunnel.stopForward(input); + }), +}); + +const listPortForwards = DesktopIpc.makeIpcMethod({ + channel: IpcChannels.PORT_FORWARD_LIST_CHANNEL, + payload: Schema.Void, + result: Schema.Array(DesktopPortForwardSchema), + handler: Effect.fn("desktop.ipc.preview.listPortForwards")(function* () { + const tunnel = yield* LoopbackTunnel.LoopbackTunnel; + return yield* tunnel.forwards; + }), +}); + +const sharesLoopback = DesktopIpc.makeIpcMethod({ + channel: IpcChannels.PORT_FORWARD_SHARES_LOOPBACK_CHANNEL, + payload: DesktopSharesLoopbackInputSchema, + result: Schema.Boolean, + handler: Effect.fn("desktop.ipc.preview.sharesLoopback")(function* ({ environmentId }) { + const tunnel = yield* LoopbackTunnel.LoopbackTunnel; + return yield* tunnel.sharesLoopback(environmentId); + }), +}); + export const listBrowserImportSources = DesktopIpc.makeIpcMethod({ channel: IpcChannels.PREVIEW_IMPORT_SOURCES_CHANNEL, payload: Schema.Void, @@ -523,6 +570,10 @@ export const methods = [ clearCache, getPreviewConfig, resolveTunnelAccess, + forwardPort, + stopPortForward, + listPortForwards, + sharesLoopback, setAnnotationTheme, setAnnotationSendEnabled, pickElement, diff --git a/apps/desktop/src/preload.ts b/apps/desktop/src/preload.ts index b413656a15241..280c5ad6c6716 100644 --- a/apps/desktop/src/preload.ts +++ b/apps/desktop/src/preload.ts @@ -449,6 +449,22 @@ contextBridge.exposeInMainWorld("desktopBridge", { }, resolveTunnelAccess: (requestId, url) => ipcRenderer.invoke(IpcChannels.PREVIEW_TUNNEL_ACCESS_RESOLVE_CHANNEL, { requestId, url }), + forwardPort: (environmentId, remotePort) => + ipcRenderer.invoke(IpcChannels.PORT_FORWARD_START_CHANNEL, { environmentId, remotePort }), + stopPortForward: (environmentId, remotePort) => + ipcRenderer.invoke(IpcChannels.PORT_FORWARD_STOP_CHANNEL, { environmentId, remotePort }), + listPortForwards: () => ipcRenderer.invoke(IpcChannels.PORT_FORWARD_LIST_CHANNEL), + sharesLoopback: (environmentId) => + ipcRenderer.invoke(IpcChannels.PORT_FORWARD_SHARES_LOOPBACK_CHANNEL, { environmentId }), + onPortForwards: (listener) => { + const wrappedListener = (_event: Electron.IpcRendererEvent, forwards: unknown) => { + if (!Array.isArray(forwards)) return; + listener(forwards); + }; + ipcRenderer.on(IpcChannels.PORT_FORWARD_CHANGE_CHANNEL, wrappedListener); + return () => + ipcRenderer.removeListener(IpcChannels.PORT_FORWARD_CHANGE_CHANNEL, wrappedListener); + }, setAnnotationTheme: (theme) => ipcRenderer.invoke(IpcChannels.PREVIEW_SET_ANNOTATION_THEME_CHANNEL, { theme }), setAnnotationSendEnabled: (tabId, enabled) => diff --git a/apps/desktop/src/preview/LoopbackTunnel.test.ts b/apps/desktop/src/preview/LoopbackTunnel.test.ts index fb193e768e8d2..fe83817c0d5e8 100644 --- a/apps/desktop/src/preview/LoopbackTunnel.test.ts +++ b/apps/desktop/src/preview/LoopbackTunnel.test.ts @@ -1,5 +1,6 @@ import * as NodeFileSystem from "@effect/platform-node/NodeFileSystem"; import * as NodeWS from "@effect/platform-node/NodeWS"; +import { EnvironmentId } from "@t3tools/contracts"; import * as HostProcess from "@t3tools/shared/HostProcess"; import { expect, it } from "@effect/vitest"; import * as NodeNet from "node:net"; @@ -8,6 +9,8 @@ import * as Effect from "effect/Effect"; import * as FileSystem from "effect/FileSystem"; import * as Layer from "effect/Layer"; import * as Queue from "effect/Queue"; +import * as Result from "effect/Result"; +import * as SecureRandom from "effect/crypto/SecureRandom"; import * as ElectronWindow from "../electron/ElectronWindow.ts"; import * as LoopbackTunnel from "./LoopbackTunnel.ts"; @@ -74,9 +77,10 @@ const unusedPort = Effect.promise( }), ); -/** Routes a stand-in session through the tunnel and returns its SOCKS listener port. */ -const routeThroughTunnel = ( - tunnelUrl: string | null, +/** The tunnel service, with every access request answered with `tunnelUrl`. */ +const makeTunnel = ( + /** A function answers each access request with its current value. */ + tunnelUrl: string | null | (() => string | null), host?: Layer.Layer | Layer.Layer, ) => Effect.gen(function* () { @@ -96,6 +100,7 @@ const routeThroughTunnel = ( currentMainOrFirst: Effect.succeedSome(window as unknown as Electron.BrowserWindow), }), NodeFileSystem.layer, + SecureRandom.layerWebCrypto, host ?? Layer.empty, ), ), @@ -103,10 +108,25 @@ const routeThroughTunnel = ( ); const tunnel = Context.get(services, LoopbackTunnel.LoopbackTunnel); yield* Queue.take(accessRequests).pipe( - Effect.flatMap((requestId) => tunnel.resolveAccess({ requestId, url: tunnelUrl })), + Effect.flatMap((requestId) => + tunnel.resolveAccess({ + requestId, + url: typeof tunnelUrl === "function" ? tunnelUrl() : tunnelUrl, + }), + ), Effect.forever, Effect.forkScoped, ); + return tunnel; + }); + +/** Routes a stand-in session through the tunnel and returns its SOCKS listener port. */ +const routeThroughTunnel = ( + tunnelUrl: string | null, + host?: Layer.Layer | Layer.Layer, +) => + Effect.gen(function* () { + const tunnel = yield* makeTunnel(tunnelUrl, host); let proxyRules = ""; const session = { setProxy: async (config: Electron.ProxyConfig) => { @@ -284,3 +304,214 @@ it.effect("connects straight to the environment's own forwarded origin port", () expect(received).toEqual([7, 8]); }), ); + +/** Connects to a local port, sends `bytes`, and resolves with the first chunk back. */ +const exchange = (port: number, bytes: Uint8Array) => + Effect.promise( + () => + new Promise((resolve, reject) => { + const socket = NodeNet.connect(port, "127.0.0.1", () => socket.write(bytes)); + socket.once("data", (chunk) => { + resolve([...chunk]); + socket.destroy(); + }); + socket.on("error", reject); + }), + ); + +const refusesConnections = (port: number) => + Effect.promise( + () => + new Promise((resolve) => { + const socket = NodeNet.connect(port, "127.0.0.1", () => { + socket.destroy(); + resolve(false); + }); + socket.on("error", () => resolve(true)); + }), + ); + +it.effect("forwards a port over the tunnel on the same local port until stopped", () => + Effect.gen(function* () { + const endpoint = yield* listenEndpoint; + const remotePort = yield* unusedPort; + const tunnel = yield* makeTunnel( + `ws://127.0.0.1:${addressPort(endpoint.server)}/api/preview/tunnel?wsTicket=t`, + ); + const announced: number[][] = []; + yield* tunnel.subscribeForwards((forwards) => + Effect.sync(() => announced.push(forwards.map((forward) => forward.localPort))), + ); + const environmentId = EnvironmentId.make("remote"); + const forward = yield* tunnel.forward({ environmentId, remotePort }); + expect(forward).toEqual({ environmentId, remotePort, localPort: remotePort }); + + expect(yield* exchange(remotePort, Uint8Array.of(4, 5))).toEqual([0xee, 4, 5]); + // The first request is the same-machine probe. + expect(endpoint.requests.at(-1)).toBe(`/api/preview/tunnel?wsTicket=t&port=${remotePort}`); + + yield* tunnel.stopForward({ environmentId, remotePort }); + expect(yield* refusesConnections(remotePort)).toBe(true); + expect(yield* tunnel.forwards).toEqual([]); + expect(announced).toEqual([[remotePort], []]); + }), +); + +it.effect("moves a forward to a free port when its own is taken here", () => + Effect.gen(function* () { + const decoy = yield* listenDecoy; + const endpoint = yield* listenEndpoint; + const remotePort = addressPort(decoy.server); + const tunnel = yield* makeTunnel( + `ws://127.0.0.1:${addressPort(endpoint.server)}/api/preview/tunnel`, + ); + const forward = yield* tunnel.forward({ + environmentId: EnvironmentId.make("remote"), + remotePort, + }); + expect(forward.localPort).not.toBe(remotePort); + + expect(yield* exchange(forward.localPort, Uint8Array.of(6))).toEqual([0xee, 6]); + expect(endpoint.requests.at(-1)).toBe(`/api/preview/tunnel?port=${remotePort}`); + expect(decoy.connections()).toBe(0); + }), +); + +/** An environment on this machine: each tunnel connection dials the requested local port. */ +const listenSameMachineEndpoint = Effect.acquireRelease( + Effect.promise( + () => + new Promise((resolve) => { + const server: NodeWS.WebSocketServer = new NodeWS.WebSocketServer( + { port: 0, host: "127.0.0.1" }, + () => resolve(server), + ); + server.on("connection", (socket: NodeWS.WebSocket, request: { url?: string }) => { + const port = Number(new URL(request.url ?? "", "ws://x").searchParams.get("port")); + const local = NodeNet.connect(port, "127.0.0.1"); + local.on("data", (chunk) => socket.send(chunk)); + local.on("error", () => socket.close()); + socket.on("message", (data: Buffer) => local.write(data)); + socket.on("close", () => local.destroy()); + }); + }), + ), + closeServer, +); + +it.effect("refuses to forward from an environment that shares this machine's loopback", () => + Effect.gen(function* () { + const endpoint = yield* listenSameMachineEndpoint; + const remotePort = yield* unusedPort; + const tunnel = yield* makeTunnel(`ws://127.0.0.1:${addressPort(endpoint)}/api/preview/tunnel`); + const error = yield* tunnel + .forward({ environmentId: EnvironmentId.make("remote"), remotePort }) + .pipe(Effect.flip); + expect(error._tag).toBe("LoopbackTunnelSameMachineError"); + expect(yield* refusesConnections(remotePort)).toBe(true); + expect(yield* tunnel.forwards).toEqual([]); + }), +); + +it.effect( + "forwards nothing while the environment is out of reach, then forwards once it is back", + () => + Effect.gen(function* () { + const endpoint = yield* listenEndpoint; + const remotePort = yield* unusedPort; + let access: string | null = null; + const tunnel = yield* makeTunnel(() => access); + const environmentId = EnvironmentId.make("remote"); + + const unavailable = yield* tunnel.forward({ environmentId, remotePort }).pipe(Effect.flip); + expect(unavailable._tag).toBe("LoopbackTunnelUnavailableError"); + expect(yield* refusesConnections(remotePort)).toBe(true); + expect(yield* tunnel.forwards).toEqual([]); + + access = `ws://127.0.0.1:${addressPort(endpoint.server)}/api/preview/tunnel`; + const forward = yield* tunnel.forward({ environmentId, remotePort }); + expect(yield* exchange(forward.localPort, Uint8Array.of(9))).toEqual([0xee, 9]); + }), +); + +/** The environment's tunnel route refusing every port with a 502, as for a port nothing listens on. */ +const listenRefusingEndpoint = (headers: Record) => + Effect.acquireRelease( + Effect.promise( + () => + new Promise((resolve) => { + const server: NodeWS.WebSocketServer = new NodeWS.WebSocketServer( + { + port: 0, + host: "127.0.0.1", + verifyClient: (_info, done) => done(false, 502, "Bad Gateway", headers), + }, + () => resolve(server), + ); + }), + ), + closeServer, + ); + +it.effect.each([ + { case: "the environment reports nothing on the probe port", refused: true }, + { case: "the tunnel fails for another reason", refused: false }, +])("decides a forward's machine only on proof: $case", ({ refused }) => + Effect.gen(function* () { + const endpoint = yield* listenRefusingEndpoint( + refused ? { "x-t3-tunnel-port-refused": "1" } : {}, + ); + const remotePort = yield* unusedPort; + const tunnel = yield* makeTunnel(`ws://127.0.0.1:${addressPort(endpoint)}/api/preview/tunnel`); + const result = yield* tunnel + .forward({ environmentId: EnvironmentId.make("remote"), remotePort }) + .pipe(Effect.result); + if (refused) { + expect(Result.isSuccess(result)).toBe(true); + } else { + expect(Result.isFailure(result) && result.failure._tag).toBe( + "LoopbackTunnelUnavailableError", + ); + expect(yield* refusesConnections(remotePort)).toBe(true); + } + }), +); + +it.effect("closes connections beyond a forward's limit without tunnelling them", () => + Effect.gen(function* () { + const endpoint = yield* listenEndpoint; + const tunnel = yield* makeTunnel( + `ws://127.0.0.1:${addressPort(endpoint.server)}/api/preview/tunnel`, + ); + const forward = yield* tunnel.forward({ + environmentId: EnvironmentId.make("remote"), + remotePort: yield* unusedPort, + }); + const open = () => + Effect.acquireRelease( + Effect.promise( + () => + new Promise((resolve) => { + const socket = NodeNet.connect(forward.localPort, "127.0.0.1", () => { + socket.once("data", () => resolve(socket)); + socket.write(Uint8Array.of(1)); + }); + }), + ), + (socket) => Effect.sync(() => socket.destroy()), + ); + yield* Effect.forEach(Array.from({ length: 64 }), open, { concurrency: "unbounded" }); + const tunnelled = endpoint.requests.length; + const closed = yield* Effect.promise( + () => + new Promise((resolve) => { + const socket = NodeNet.connect(forward.localPort, "127.0.0.1"); + socket.on("close", () => resolve(true)); + socket.on("data", () => resolve(false)); + socket.write(Uint8Array.of(2)); + }), + ); + expect(closed).toBe(true); + expect(endpoint.requests.length).toBe(tunnelled); + }), +); diff --git a/apps/desktop/src/preview/LoopbackTunnel.ts b/apps/desktop/src/preview/LoopbackTunnel.ts index 6eff2dd70b345..1e06993fa54f0 100644 --- a/apps/desktop/src/preview/LoopbackTunnel.ts +++ b/apps/desktop/src/preview/LoopbackTunnel.ts @@ -1,21 +1,28 @@ // Renders another environment's localhost pages in a local webview: the partition's loopback // traffic goes to a SOCKS5 listener here, and each connection rides one WebSocket to the -// environment's /api/preview/tunnel. The page keeps its localhost origin. +// environment's /api/preview/tunnel. The page keeps its localhost origin. Forwarded ports take +// the same route from a plain listener, for any client on this machine. import * as NodeSocket from "@effect/platform-node/NodeSocket"; import * as NodeSocketServer from "@effect/platform-node/NodeSocketServer"; import * as NodeWS from "@effect/platform-node/NodeWS"; -import type { DesktopPreviewTunnelAccessRequest } from "@t3tools/contracts"; +import type { + DesktopPortForward, + DesktopPreviewTunnelAccessRequest, + EnvironmentId, +} from "@t3tools/contracts"; import * as HostProcess from "@t3tools/shared/HostProcess"; import type { NonEmptyReadonlyArray } from "effect/Array"; import * as Context from "effect/Context"; import * as Deferred from "effect/Deferred"; import * as Effect from "effect/Effect"; +import * as Exit from "effect/Exit"; import * as FileSystem from "effect/FileSystem"; import * as Layer from "effect/Layer"; import * as NetAddress from "effect/net/NetAddress"; import * as Option from "effect/Option"; import * as Result from "effect/Result"; import * as Schema from "effect/Schema"; +import * as SecureRandom from "effect/crypto/SecureRandom"; import * as Scope from "effect/Scope"; import * as Semaphore from "effect/Semaphore"; import * as Socket from "effect/socket/Socket"; @@ -24,6 +31,8 @@ import * as ElectronWindow from "../electron/ElectronWindow.ts"; import { PREVIEW_TUNNEL_ACCESS_REQUEST_CHANNEL } from "../ipc/channels.ts"; const ACCESS_TIMEOUT = "15 seconds"; +const PROBE_TIMEOUT = "3 seconds"; +const MAX_FORWARD_CONNECTIONS = 64; const CONNECT_TIMEOUT = "10 seconds"; const REPLY_SUCCEEDED = 0; @@ -127,9 +136,13 @@ const isTunnelEndpoint = (tunnelUrl: string, port: number) => { }; /** Opens a connection to the destination; `ws` pauses its socket, so a slow page slows the tunnel. */ +/** Set by the environment's /api/preview/tunnel when it reached the port and nothing listens. */ +const PORT_REFUSED_HEADER = "x-t3-tunnel-port-refused"; + const dialDestination = Effect.fn("LoopbackTunnel.dialDestination")(function* ( tunnelUrl: string, port: number, + onPortRefused?: () => void, ) { if (isTunnelEndpoint(tunnelUrl, port)) { const endpoint = yield* NodeSocket.makeNet({ @@ -141,10 +154,18 @@ const dialDestination = Effect.fn("LoopbackTunnel.dialDestination")(function* ( const url = new URL(tunnelUrl); url.searchParams.set("port", String(port)); const tunnel = yield* Effect.acquireRelease( - Effect.sync(() => + Effect.sync(() => { // Closing before the handshake finishes emits an error after Socket's listeners are gone. - new NodeWS.WebSocket(url).on("error", () => undefined), - ), + const tunnel = new NodeWS.WebSocket(url).on("error", () => undefined); + if (onPortRefused) { + tunnel.on("unexpected-response", (_request, response) => { + if (response.headers[PORT_REFUSED_HEADER] !== undefined) onPortRefused(); + // Handled here, so `ws` leaves aborting the handshake to us. + tunnel.terminate(); + }); + } + return tunnel; + }), (tunnel) => Effect.sync(() => tunnel.close()), ); const socket = yield* Socket.fromWebSocket(Effect.succeed(tunnel), { @@ -224,6 +245,33 @@ export class LoopbackTunnelRouteError extends Schema.TaggedError()( + "LoopbackTunnelForwardError", + { environmentId: Schema.String, port: Schema.Number, cause: Schema.Defect() }, +) { + override get message(): string { + return `Failed to forward port ${this.port} of environment "${this.environmentId}".`; + } +} + +export class LoopbackTunnelUnavailableError extends Schema.TaggedError()( + "LoopbackTunnelUnavailableError", + { environmentId: Schema.String }, +) { + override get message(): string { + return `Environment "${this.environmentId}" can't be reached through the tunnel right now.`; + } +} + +export class LoopbackTunnelSameMachineError extends Schema.TaggedError()( + "LoopbackTunnelSameMachineError", + { environmentId: Schema.String, port: Schema.Number }, +) { + override get message(): string { + return `This environment runs on this computer, so localhost:${this.port} already reaches it.`; + } +} + export class LoopbackTunnel extends Context.Service< LoopbackTunnel, { @@ -237,6 +285,26 @@ export class LoopbackTunnel extends Context.Service< readonly requestId: string; readonly url: string | null; }) => Effect.Effect; + /** Listens on this machine's loopback, on the same port when it is free. */ + readonly forward: (input: { + readonly environmentId: EnvironmentId; + readonly remotePort: number; + }) => Effect.Effect< + DesktopPortForward, + LoopbackTunnelForwardError | LoopbackTunnelSameMachineError | LoopbackTunnelUnavailableError + >; + readonly stopForward: (input: { + readonly environmentId: EnvironmentId; + readonly remotePort: number; + }) => Effect.Effect; + readonly forwards: Effect.Effect>; + /** Whether the environment's loopback is this machine's, so forwarding would only loop. */ + readonly sharesLoopback: ( + environmentId: EnvironmentId, + ) => Effect.Effect; + readonly subscribeForwards: ( + listener: (forwards: ReadonlyArray) => Effect.Effect, + ) => Effect.Effect; } >()("@t3tools/desktop/preview/LoopbackTunnel") {} @@ -245,8 +313,17 @@ const make = Effect.gen(function* () { const fileSystem = yield* FileSystem.FileSystem; const platform = yield* HostProcess.Platform; const userId = yield* HostProcess.UserId; + const random = yield* SecureRandom.SecureRandom; const listenerScope = yield* Effect.scope; const routing = yield* Semaphore.make(1); + const forwarding = yield* Semaphore.make(1); + const forwarded = new Map< + string, + { readonly forward: DesktopPortForward; readonly scope: Scope.Closeable } + >(); + const forwardListeners = new Set< + (forwards: ReadonlyArray) => Effect.Effect + >(); const pending = new Map>(); const listenerPorts = new Map(); const routed = new WeakSet(); @@ -318,6 +395,163 @@ const make = Effect.gen(function* () { (effect) => Effect.ignoreCause(effect), ); + /** Serves one connection to a forwarded port; closes it when the environment is out of reach. */ + const serveForward = (environmentId: string, port: number) => { + let active = 0; + return Effect.fn("LoopbackTunnel.serveForward")( + function* (socket: Socket.Socket) { + // Acquiring the socket ties it to this scope, so returning early closes it. + const pull = yield* Socket.readerBytes(socket); + const writer = yield* socket.writer; + // Closed at once, so a page hammering the port can't queue tunnels and access requests. + if (active >= MAX_FORWARD_CONNECTIONS) return; + active++; + yield* Effect.addFinalizer(() => Effect.sync(() => active--)); + if (!(yield* isOwnConnection())) return; + const tunnelUrl = yield* requestAccess(environmentId); + if (tunnelUrl === null) return; + const destination = yield* dialDestination(tunnelUrl, port); + return yield* Effect.raceFirst( + pump(pull, destination.writer.writeAll), + pump(destination.pull, writer.writeAll), + ); + }, + Effect.scoped, + (effect) => Effect.ignoreCause(effect), + ); + }; + + /** + * Whether the environment's loopback is this machine's, by tunnelling a nonce to a local probe. + * A forward there would accept the environment's own dials and loop through the tunnel. + */ + const sharesLoopback = Effect.fn("LoopbackTunnel.sharesLoopback")(function* ( + environmentId: string, + ) { + const tunnelUrl = yield* requestAccess(environmentId); + // Without access the answer is unknown, not "another machine": a forward could loop later. + if (tunnelUrl === null) return yield* new LoopbackTunnelUnavailableError({ environmentId }); + return yield* probeLoopback(environmentId, tunnelUrl); + }); + + /** + * True only when the nonce reaches this machine's probe; false only on proof the environment + * was reached and nothing listens on the probe port there. Anything else is unknown. + */ + const probeLoopback = Effect.fn("LoopbackTunnel.probeLoopback")( + function* (environmentId: string, tunnelUrl: string) { + const unavailable = new LoopbackTunnelUnavailableError({ environmentId }); + const nonce = new TextEncoder().encode(yield* random.uuidV4()); + const arrived = yield* Deferred.make(); + const probe = yield* NodeSocketServer.make({ port: 0, host: "127.0.0.1" }); + yield* probe + .run( + Effect.fnUntraced( + function* (socket: Socket.Socket) { + const pull = yield* Socket.readerBytes(socket); + let received = Buffer.alloc(0); + while (received.length < nonce.length) { + received = Buffer.concat([received, ...(yield* pull)]); + } + if (received.subarray(0, nonce.length).equals(nonce)) { + yield* Deferred.succeed(arrived, undefined); + } + }, + Effect.scoped, + (effect) => Effect.ignoreCause(effect), + ), + ) + .pipe(Effect.forkScoped); + let portRefused = false; + const destination = yield* dialDestination( + tunnelUrl, + (probe.address as NetAddress.InetAddress).port, + () => { + portRefused = true; + }, + ).pipe(Effect.option); + if (Option.isNone(destination)) { + if (portRefused) return false; + return yield* unavailable; + } + yield* destination.value.writer.write(nonce); + // An answer or a close means a service on another machine took the connection. + const answer = yield* Effect.raceFirst( + Deferred.await(arrived).pipe(Effect.as(true)), + destination.value.pull.pipe(Effect.as(false)), + ).pipe(Effect.timeoutOption(PROBE_TIMEOUT)); + if (Option.isNone(answer)) return yield* unavailable; + return answer.value; + }, + Effect.scoped, + (effect, environmentId) => + effect.pipe( + Effect.mapError((error) => + error._tag === "LoopbackTunnelUnavailableError" + ? error + : new LoopbackTunnelUnavailableError({ environmentId }), + ), + ), + ); + + const forwardKey = (environmentId: string, port: number) => `${environmentId}:${port}`; + const currentForwards = () => [...forwarded.values()].map(({ forward }) => forward); + const announceForwards = Effect.suspend(() => { + const forwards = currentForwards(); + return Effect.forEach([...forwardListeners], (listener) => listener(forwards), { + discard: true, + }); + }); + + const forward: LoopbackTunnel["Service"]["forward"] = Effect.fn("LoopbackTunnel.forward")( + function* ({ environmentId, remotePort }) { + const existing = forwarded.get(forwardKey(environmentId, remotePort)); + if (existing) return existing.forward; + if (yield* sharesLoopback(environmentId)) { + return yield* new LoopbackTunnelSameMachineError({ environmentId, port: remotePort }); + } + const scope = yield* Scope.fork(listenerScope); + const bind = (port: number) => + NodeSocketServer.make({ port, host: "127.0.0.1" }).pipe(Scope.provide(scope)); + const server = yield* bind(remotePort).pipe( + // Taken here, or privileged: any free port still reaches the environment's. + Effect.catch(() => bind(0)), + Effect.onError(() => Scope.close(scope, Exit.void)), + Effect.mapError( + (cause) => new LoopbackTunnelForwardError({ environmentId, port: remotePort, cause }), + ), + ); + yield* server.run(serveForward(environmentId, remotePort)).pipe(Effect.forkIn(scope)); + const forward = { + environmentId, + remotePort, + localPort: (server.address as NetAddress.InetAddress).port, + }; + forwarded.set(forwardKey(environmentId, remotePort), { forward, scope }); + yield* announceForwards; + return forward; + }, + forwarding.withPermits(1), + ); + + const stopForward: LoopbackTunnel["Service"]["stopForward"] = Effect.fn( + "LoopbackTunnel.stopForward", + )(function* ({ environmentId, remotePort }) { + const key = forwardKey(environmentId, remotePort); + const existing = forwarded.get(key); + if (!existing) return; + forwarded.delete(key); + // Closing the scope also ends the connections it carries. + yield* Scope.close(existing.scope, Exit.void); + yield* announceForwards; + }, forwarding.withPermits(1)); + + const subscribeForwards: LoopbackTunnel["Service"]["subscribeForwards"] = (listener) => + Effect.acquireRelease( + Effect.sync(() => forwardListeners.add(listener)), + () => Effect.sync(() => forwardListeners.delete(listener)), + ).pipe(Effect.asVoid); + const listen = Effect.fn("LoopbackTunnel.listen")(function* (environmentId: string) { const existing = listenerPorts.get(environmentId); if (existing !== undefined) return existing; @@ -375,7 +609,15 @@ const make = Effect.gen(function* () { return answer ? Deferred.succeed(answer, url).pipe(Effect.asVoid) : Effect.void; }; - return LoopbackTunnel.of({ route, resolveAccess }); + return LoopbackTunnel.of({ + route, + resolveAccess, + forward, + stopForward, + forwards: Effect.sync(currentForwards), + sharesLoopback, + subscribeForwards, + }); }); export const layer = Layer.effect(LoopbackTunnel, make); diff --git a/apps/web/src/components/CommandPalette.tsx b/apps/web/src/components/CommandPalette.tsx index 1eb1a9bcba599..3349902aeea05 100644 --- a/apps/web/src/components/CommandPalette.tsx +++ b/apps/web/src/components/CommandPalette.tsx @@ -255,6 +255,10 @@ import { } from "./CommandPaletteAddProject"; import { useCommandPaletteThreadItems } from "./CommandPaletteThreadItems"; import { useCommandPaletteThemeItems } from "./CommandPaletteThemeItems"; +import { + PORT_FORWARD_GROUP_PREFIX, + useCommandPalettePortForwardItem, +} from "./CommandPalettePortForwardItems"; import { CommandPaletteVirtualizedResults, scrollCommandPaletteRowIntoView, @@ -547,6 +551,10 @@ function OpenCommandPaletteDialog(props: { const keybindings = useAtomValue(primaryServerKeybindingsAtom); const providersByEnvironment = useEnvironmentProviders(); const { changeThemeItem, changeAppearanceItem, themeEditorItem } = useCommandPaletteThemeItems(); + const portForwardItem = useCommandPalettePortForwardItem({ + activeThread: activeThread ?? null, + query: deferredQuery, + }); const currentView = viewStack.at(-1)?.view ?? null; const threadSearchQuery = currentView === null && !isActionsOnly ? deferredQuery : ""; const [browseGeneration, setBrowseGeneration] = useState(0); @@ -1425,6 +1433,8 @@ function OpenCommandPaletteDialog(props: { }); } + if (portForwardItem) actionItems.push(portForwardItem); + const promptLinkTarget = paletteRouteTarget ? paletteRouteTarget.kind === "server" ? paletteRouteTarget.threadRef @@ -1884,11 +1894,13 @@ function OpenCommandPaletteDialog(props: { items: projectThreadItems.length > 0 ? projectThreadItems : [addProjectAction], }, ] - : currentView?.groups[0]?.value === "themes" - ? changeThemeItem.groups - : currentView?.groups[0]?.value === "appearance" - ? changeAppearanceItem.groups - : (currentView?.groups ?? rootGroups); + : currentView?.groups[0]?.value.startsWith(PORT_FORWARD_GROUP_PREFIX) && portForwardItem + ? portForwardItem.groups + : currentView?.groups[0]?.value === "themes" + ? changeThemeItem.groups + : currentView?.groups[0]?.value === "appearance" + ? changeAppearanceItem.groups + : (currentView?.groups ?? rootGroups); const isLinkedThreadSearch = linkedThreadSearch?.linkedThreads !== undefined && deferredQuery === linkedThreadSearch.query; diff --git a/apps/web/src/components/CommandPalettePortForwardItems.tsx b/apps/web/src/components/CommandPalettePortForwardItems.tsx new file mode 100644 index 0000000000000..2a03b19d300c1 --- /dev/null +++ b/apps/web/src/components/CommandPalettePortForwardItems.tsx @@ -0,0 +1,215 @@ +import { + AuthTerminalOperateScope, + type DesktopPortForward, + type EnvironmentId, + type ThreadId, +} from "@t3tools/contracts"; +import { useAtomValue } from "@effect/atom-react"; +import { useGT } from "gt-react"; +import { CableIcon, ClipboardCopyIcon, ExternalLinkIcon, SquareIcon } from "lucide-react"; + +import { writeTextToClipboard } from "../hooks/useCopyToClipboard"; +import { readLocalApi } from "../localApi"; +import { useThreadDiscoveredPorts } from "../portDiscoveryState"; +import { useEnvironments } from "../state/environments"; +import { + canForwardPorts, + findPortForward, + forwardedUrl, + forwardPort, + forwardLocalitiesAtom, + stopPortForward, + usePortForwards, +} from "../state/portForwards"; +import { environmentIdsKey } from "../state/environmentAtomList"; +import { useEnvironmentsWithScope } from "../state/session"; +import { + ADDON_ICON_CLASS, + ITEM_ICON_CLASS, + type CommandPaletteActionItem, + type CommandPaletteGroup, + type CommandPaletteSubmenuItem, +} from "./CommandPalette.logic"; +import { toastManager } from "./ui/toast"; + +/** Prefix of this submenu's group values; the palette rebuilds them live while it is open. */ +export const PORT_FORWARD_GROUP_PREFIX = "port-forwards:"; + +const parsePort = (query: string) => { + const trimmed = query.trim(); + if (!/^\d{1,5}$/.test(trimmed)) return null; + const port = Number(trimmed); + return port >= 1 && port <= 65_535 ? port : null; +}; + +/** "Forwarded ports": each forward with its actions, then ports to forward from the thread or the query. */ +export function useCommandPalettePortForwardItem(input: { + readonly activeThread: { + readonly environmentId: EnvironmentId; + readonly id: ThreadId; + } | null; + readonly query: string; +}): CommandPaletteSubmenuItem | null { + const gt = useGT(); + const forwards = usePortForwards(); + const { environments } = useEnvironments(); + const reachable = environments.filter( + (environment) => + environment.connection.phase === "connected" && canForwardPorts(environment.entry.target), + ); + const tunnelling = useEnvironmentsWithScope(reachable, AuthTerminalOperateScope); + const tunnelled = reachable.filter((environment) => tunnelling.has(environment.environmentId)); + const localities = useAtomValue( + forwardLocalitiesAtom(environmentIdsKey(tunnelled.map(({ environmentId }) => environmentId))), + ); + const sources = tunnelled.filter((_, index) => localities[index] === "remote"); + // Only a forwardable thread's servers are listed, so other clients never subscribe to them. + const threadEnvironmentId = sources.some( + (environment) => environment.environmentId === input.activeThread?.environmentId, + ) + ? (input.activeThread?.environmentId ?? null) + : null; + const threadServers = useThreadDiscoveredPorts({ + environmentId: threadEnvironmentId, + threadId: threadEnvironmentId === null ? null : (input.activeThread?.id ?? null), + }); + if (forwards.length === 0 && sources.length === 0) return null; + + const labelOf = (environmentId: EnvironmentId) => + environments.find((environment) => environment.environmentId === environmentId)?.label ?? + environmentId; + + const start = async (environmentId: EnvironmentId, remotePort: number) => { + const forward = await forwardPort(environmentId, remotePort); + toastManager.add({ + type: "success", + title: gt("Forwarded port {port}", { port: remotePort }), + description: gt("Apps on this machine reach it at localhost:{port}.", { + port: forward.localPort, + }), + }); + }; + + const forwardedItem = (forward: DesktopPortForward): CommandPaletteSubmenuItem => { + const address = `localhost:${forward.localPort}`; + const environment = labelOf(forward.environmentId); + return { + kind: "submenu", + value: `port-forward:${forward.environmentId}:${forward.remotePort}`, + title: address, + description: gt("Port {port} on {environment}", { port: forward.remotePort, environment }), + searchTerms: [address, String(forward.remotePort), environment, "forwarded port"], + icon: , + addonIcon: , + groups: [ + { + value: "port-forward-actions", + label: address, + items: [ + { + kind: "action", + value: "port-forward:open", + title: gt("Open in browser"), + searchTerms: ["open", "browser"], + icon: , + run: async () => { + await readLocalApi()?.shell.openExternal(forwardedUrl(forward)); + }, + }, + { + kind: "action", + value: "port-forward:copy", + title: gt("Copy address"), + searchTerms: ["copy", "address", "url"], + icon: , + run: async () => { + await writeTextToClipboard(forwardedUrl(forward)); + }, + }, + { + kind: "action", + value: "port-forward:stop", + title: gt("Stop forwarding"), + searchTerms: ["stop", "remove", "close"], + icon: , + run: () => stopPortForward(forward.environmentId, forward.remotePort), + }, + ], + }, + ], + }; + }; + + const startItems: CommandPaletteActionItem[] = []; + for (const server of threadServers) { + const environmentId = threadEnvironmentId; + if (environmentId === null) break; + if (findPortForward(forwards, environmentId, server.port)) continue; + startItems.push({ + kind: "action", + value: `port-forward:start:${environmentId}:${server.port}`, + title: gt("Forward localhost:{port}", { port: server.port }), + description: [labelOf(environmentId), server.processName].filter(Boolean).join(" · "), + searchTerms: [String(server.port), server.processName ?? "", "forward"], + icon: , + run: () => start(environmentId, server.port), + }); + } + const typedPort = parsePort(input.query); + if (typedPort !== null) { + for (const environment of sources) { + if (findPortForward(forwards, environment.environmentId, typedPort)) continue; + if ( + startItems.some((item) => item.value.endsWith(`:${environment.environmentId}:${typedPort}`)) + ) + continue; + startItems.push({ + kind: "action", + value: `port-forward:start:${environment.environmentId}:${typedPort}`, + title: gt("Forward port {port} from {environment}", { + port: typedPort, + environment: environment.label, + }), + searchTerms: [String(typedPort), "forward"], + icon: , + run: () => start(environment.environmentId, typedPort), + }); + } + } + + const groups: CommandPaletteGroup[] = []; + if (forwards.length > 0) { + groups.push({ + value: `${PORT_FORWARD_GROUP_PREFIX}forwarded`, + label: gt("Forwarded"), + items: forwards.map(forwardedItem), + }); + } + if (startItems.length === 0 && sources.length > 0) { + startItems.push({ + kind: "action", + value: "port-forward:hint", + title: gt("Type a port number to forward it"), + searchTerms: [], + icon: , + disabled: true, + run: async () => {}, + }); + } + // Always present, so the open submenu keeps a group to be recognized by. + groups.push({ + value: `${PORT_FORWARD_GROUP_PREFIX}start`, + label: startItems.length > 0 ? gt("Forward a port") : "", + items: startItems, + }); + + return { + kind: "submenu", + value: "action:port-forwards", + title: gt("Forwarded ports"), + searchTerms: ["forward port", "port forwarding", "forwarded ports", "ports", "tunnel"], + icon: , + addonIcon: , + groups, + }; +} diff --git a/apps/web/src/components/chat/ThreadServersPanel.tsx b/apps/web/src/components/chat/ThreadServersPanel.tsx index 10bfb11aa835a..b392a78f21b9a 100644 --- a/apps/web/src/components/chat/ThreadServersPanel.tsx +++ b/apps/web/src/components/chat/ThreadServersPanel.tsx @@ -3,6 +3,7 @@ import { thrownErrorMessage } from "@t3tools/client-runtime/errors"; import { scopeThreadRef } from "@t3tools/client-runtime/environment"; import { AuthPreviewOperateScope, + AuthTerminalOperateScope, type DiscoveredLocalServer, type EnvironmentId, type ThreadId, @@ -13,7 +14,7 @@ import { } from "@t3tools/client-runtime/state/runtime"; import { T, useGT, Var } from "gt-react"; import { m } from "~/i18n/messages"; -import { GlobeIcon, SquareIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react"; +import { CableIcon, GlobeIcon, SquareIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react"; import { type MouseEvent, useState } from "react"; import { resolveExternalServerUrl } from "../../browser/browserTargetResolver"; @@ -21,6 +22,15 @@ import { readLocalApi } from "../../localApi"; import { cn, isMacPlatform } from "../../lib/utils"; import { useThreadDiscoveredPorts } from "../../portDiscoveryState"; import { useEnvironment } from "../../state/environments"; +import { + canForwardPorts, + findPortForward, + forwardedUrl, + forwardPort, + stopPortForward, + useForwardLocality, + usePortForwards, +} from "../../state/portForwards"; import { previewEnvironment } from "../../state/preview"; import { useEnvironmentScope } from "../../state/session"; import { useAtomCommand } from "../../state/use-atom-command"; @@ -53,14 +63,21 @@ function ThreadServersList(props: ThreadServersPanelProps) { const canStop = useAtomValue( previewEnvironment.stopLocalServer.permissionAtom(props.environmentId), ); - const supportsStop = - useEnvironment(props.environmentId)?.serverConfig?.environment.capabilities.localServerStop === - true; + const environment = useEnvironment(props.environmentId); + const supportsStop = environment?.serverConfig?.environment.capabilities.localServerStop === true; + const forwards = usePortForwards(); + const forwardable = + useEnvironmentScope(props.environmentId, AuthTerminalOperateScope) && + environment?.connection.phase === "connected" && + canForwardPorts(environment.entry.target); + const locality = useForwardLocality(forwardable ? props.environmentId : null); + const canForward = locality === "remote"; const openPreview = useAtomCommand(previewEnvironment.open, { reportFailure: false }); const stopServer = useAtomCommand(previewEnvironment.stopLocalServer, { label: "thread server stop", }); const [stoppingKey, setStoppingKey] = useState(null); + const [forwardingPort, setForwardingPort] = useState(null); const [visibleCount, setVisibleCount] = useState(SERVER_PAGE_COUNT); if (servers.length === 0) return null; @@ -83,7 +100,19 @@ function ThreadServersList(props: ThreadServersPanelProps) { // Like links: modified and middle clicks go to the system browser. if (event.metaKey || event.ctrlKey || event.button === 1) { event.preventDefault(); - const url = resolveExternalServerUrl(props.environmentId, server.url); + // This machine's browser reaches another environment's loopback only through a forward. + // Starting a forward runs the probe; only a confirmed local environment opens directly. + const url = + forwardable && locality !== "local" + ? await forwardPort(props.environmentId, server.port).then( + (forward) => forwardedUrl(forward, server.url), + (error: unknown) => { + reportFailure(gt("Could not forward port {port}", { port: server.port }), error); + return null; + }, + ) + : resolveExternalServerUrl(props.environmentId, server.url); + if (url === null) return; await readLocalApi() ?.shell.openExternal(url) .catch((error: unknown) => reportFailure(gt("Unable to open in browser"), error)); @@ -108,6 +137,19 @@ function ThreadServersList(props: ThreadServersPanelProps) { } }; + const toggleForward = async (server: DiscoveredLocalServer, forwarded: boolean) => { + if (forwardingPort !== null) return; + setForwardingPort(server.port); + await ( + forwarded + ? stopPortForward(props.environmentId, server.port) + : forwardPort(props.environmentId, server.port) + ).catch((error: unknown) => + reportFailure(gt("Could not forward port {port}", { port: server.port }), error), + ); + setForwardingPort(null); + }; + return ( { const key = serverKey(server); const stoppable = canStop && supportsStop && server.pid !== null; + const forward = findPortForward(forwards, props.environmentId, server.port); + const actionCount = Number(stoppable) + Number(canForward); return (
  • {/* The end padding keeps text clear of the stop button. */} - + localhost:{server.port} {[ + // First, so the narrow panel truncates the less useful parts. + forward + ? gt("Forwarded to :{port}", { + $context: "a remote dev server reachable on this machine's port", + port: forward.localPort, + }) + : null, server.terminal === null ? gt("Agent", { $context: "who started a dev server" }) : gt("Terminal", { $context: "who started a dev server" }), @@ -162,32 +219,83 @@ function ThreadServersList(props: ThreadServersPanelProps) { - {stoppable ? ( -
    - - void stop(server)} - /> - } - > - {stoppingKey === key ? ( - - ) : ( - - )} - - - Stop server - - + {actionCount > 0 ? ( +
    + {canForward ? ( + + void toggleForward(server, forward !== undefined)} + /> + } + > + {forwardingPort === server.port ? ( + + ) : ( + + )} + + + {forward ? ( + + Forwarded to localhost:{forward.localPort} on this machine. + Click to stop. + + ) : ( + Forward to this machine, for any app here + )} + + + ) : null} + {stoppable ? ( + + void stop(server)} + /> + } + > + {stoppingKey === key ? ( + + ) : ( + + )} + + + Stop server + + + ) : null}
    ) : null}
  • diff --git a/apps/web/src/i18n/translations/de.json b/apps/web/src/i18n/translations/de.json index 22f9bcf953f2b..661098ee35afc 100644 --- a/apps/web/src/i18n/translations/de.json +++ b/apps/web/src/i18n/translations/de.json @@ -1840,6 +1840,18 @@ "480646ceb98c7163": "Schließen", "32fc9124998ebc18": "Lokal", "1c4158d741eec5da": "{label} (lokal)", + "a12a4958ca6b924b": "Port {port} weitergeleitet", + "0f14a51b016f825d": "Apps auf diesem Rechner erreichen ihn unter localhost:{port}.", + "4bdb9a086e77ee6d": "Port {port} auf {environment}", + "7a462e32dba47f4c": "Im Browser öffnen", + "4b8087450e97c995": "Adresse kopieren", + "c170720e67d01733": "Weiterleitung beenden", + "1e5c6d1c33667b17": "localhost:{port} weiterleiten", + "e76f45b6a412a0b6": "Port {port} von {environment} weiterleiten", + "ecf3b95b3d9e6e74": "Weitergeleitet", + "b3123e5b8602a134": "Gib eine Portnummer ein, um sie weiterzuleiten", + "1bdeef9819b4a055": "Port weiterleiten", + "de8a46b66f8ec455": "Weitergeleitete Ports", "f844c41fac2d339c": "Aktuell", "69154433587763c0": "Keine passenden Aktionen.", "90c3a382ecefa0ce": "Keine passenden Befehle, Projekte oder Threads.", @@ -2975,6 +2987,10 @@ "314cdccee9c14774": "Dieser Server unterstützt keine Registry-Abfragen. Aktualisiere ihn, bevor du den Kanal wechselst.", "22da1d00403ab2fd": "Die npm-Registry dieser Umgebung konnte nicht geprüft werden. Prüfe die Verbindung und die Registry-Einstellungen.", "2fc0f7a698c95c90": "Verbinde dich mit einem Server, um nach Releases zu suchen.", + "922269f8691aa3ba": "Es ließ sich nicht feststellen, ob diese Umgebung auf diesem Computer läuft.", + "35cade9cc8a01363": "Portweiterleitung braucht die Desktop-App.", + "9e303e0a794898d4": "Diese Umgebung läuft auf diesem Computer, daher erreicht localhost:{port} sie bereits.", + "2d49965e0e27e23b": "Diese Umgebung ist gerade nicht erreichbar. Versuche es erneut, sobald sie wieder verbunden ist.", "7280baf7517dad1c": "Refs konnten nicht geladen werden.", "567c0fed6ab8efc1": "Diese Verbindung kann keine Host-Dateien durchsuchen.", "5189720b9436f98c": "Die Suche ist auf {count} Zeichen begrenzt.", @@ -4024,6 +4040,15 @@ } ], "e58a1d884fa1d8f2": "Thread-Details", + "43c5fbd02c6f330a": "Weniger anzeigen", + "de45b075b016cb14": [ + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + }, + " weitere anzeigen" + ], "02d9667ff2c8e0b8": "Issue {key}: {title}", "4276743ee60a3c62": "{count, plural, one {{count} Kommentar} other {{count} Kommentare}}", "42f634397f3960aa": "In Thread-Details anzeigen", @@ -4063,15 +4088,6 @@ ], "159ddd0d146a0f22": "Beobachtet: Der Agent wird geweckt, wenn Checks fertig sind, jemand kommentiert oder der Branch Konflikte hat. Klicke zum Beenden.", "1cbc8b5db51b4c77": "Mergen", - "43c5fbd02c6f330a": "Weniger anzeigen", - "de45b075b016cb14": [ - { - "i": 1, - "k": "_gt_value_1", - "v": "v" - }, - " weitere anzeigen" - ], "a3d040c4ef4fc6e9": "Über dem Tempo", "b16fdf56b16d99c9": "Im Tempo", "90f977e97ae8b6c6": "Unter dem Tempo", @@ -4086,6 +4102,7 @@ "66be4fb43249bbd2": "{used} von {max} Tokens", "ee3ae58c8b38a425": "{left} % übrig", "ebb26f93fb83a71b": "{label}: {left} % übrig", + "1b16346722b65812": "{timeLeft} % des Zeitfensters übrig", "728c6cc1431e76c8": "Wird in {duration} zurückgesetzt · {time}", "e16b0b9b490c8bc7": "{label}: {value}", "ba67d0a9ff5dabf0": "Die Zwischenablage-API ist beim Kopieren der Admin-Anfrage nicht verfügbar.", @@ -4179,12 +4196,16 @@ ], "3237699bd13dd4bb": "Subagent stoppen", "075398ac562d74b0": "Agentensitzung trennen", + "1d2025060ba3d1c3": "Port {port} konnte nicht weitergeleitet werden", "086ecbb6f4c2e959": "Kann nicht im Browser geöffnet werden", "51052c00ab1ac8cc": "Vorschau kann nicht geöffnet werden", "0ccd37739f9cf2b6": "Server konnte nicht gestoppt werden", "a610a81c4061bb4c": "Server", + "253bc8b5e99002dc": "Weitergeleitet an :{port}", "bd1ca8ccb6d0b87c": "Agent", "e25e045607262b40": "Terminal", + "194a9791a83d3f79": "Weiterleitung von localhost:{port} beenden", + "95bbbac2f2e17273": "localhost:{port} an diesen Rechner weiterleiten", "95b263aa683271cc": "localhost:{port} stoppen", "f94866e17faddc05": [ "Im Browser-Panel öffnen. ", @@ -4195,6 +4216,16 @@ }, " für deinen Browser." ], + "781fba367a220012": [ + "An localhost:", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + }, + " auf diesem Rechner weitergeleitet. Klicke zum Beenden." + ], + "92347683e33e9f02": "An diesen Rechner weiterleiten, für jede App hier", "3c7763243445b28d": "Server stoppen", "991cc9fb37606c91": "(leere Antwort)", "36e4b8d2db087296": "Ab dieser Antwort forken", @@ -5932,7 +5963,6 @@ "a74538a7917c1c96": "Video abspielen", "11a5a4d340e6397d": "Original öffnen", "1b74242b0d303272": "Video herunterladen", - "7a462e32dba47f4c": "Im Browser öffnen", "f9ca1e61d515445e": "Nutzdaten der Data-URL fehlen.", "1b547c297573369c": "Dieses eingebettete Medium konnte nicht decodiert werden.", "84f7c359e5f050b1": "Die Datei konnte nicht abgerufen werden (HTTP {status}).", @@ -11860,7 +11890,6 @@ "0bd938825ffcf992": "+{percent} % des Kontingents", "09c0e00d7fb55402": "Reset-Guthaben wird verwendet…", "4df3ff1be768a7ab": "{name}: {remaining} % übrig", - "1b16346722b65812": "{timeLeft} % des Zeitfensters übrig", "7aaaff1c6484f25c": "Segment", "8bcab2ef61de6518": "0-$-Limit", "a16b48709357a5a7": "Nutzung verwalten", diff --git a/apps/web/src/i18n/translations/en.json b/apps/web/src/i18n/translations/en.json index 442486e2decb0..a873be091b0c9 100644 --- a/apps/web/src/i18n/translations/en.json +++ b/apps/web/src/i18n/translations/en.json @@ -1841,6 +1841,18 @@ "480646ceb98c7163": "Close", "32fc9124998ebc18": "Local", "1c4158d741eec5da": "{label} (Local)", + "a12a4958ca6b924b": "Forwarded port {port}", + "0f14a51b016f825d": "Apps on this machine reach it at localhost:{port}.", + "4bdb9a086e77ee6d": "Port {port} on {environment}", + "7a462e32dba47f4c": "Open in browser", + "4b8087450e97c995": "Copy address", + "c170720e67d01733": "Stop forwarding", + "1e5c6d1c33667b17": "Forward localhost:{port}", + "e76f45b6a412a0b6": "Forward port {port} from {environment}", + "ecf3b95b3d9e6e74": "Forwarded", + "b3123e5b8602a134": "Type a port number to forward it", + "1bdeef9819b4a055": "Forward a port", + "de8a46b66f8ec455": "Forwarded ports", "f844c41fac2d339c": "Current", "69154433587763c0": "No matching actions.", "90c3a382ecefa0ce": "No matching commands, projects, or threads.", @@ -2974,6 +2986,10 @@ "314cdccee9c14774": "This server does not support registry lookups. Update it before switching tracks.", "22da1d00403ab2fd": "Could not check this environment's npm registry. Check the connection and registry settings.", "2fc0f7a698c95c90": "Connect to a server to check releases.", + "922269f8691aa3ba": "Could not tell whether this environment runs on this computer.", + "35cade9cc8a01363": "Port forwarding needs the desktop app.", + "9e303e0a794898d4": "This environment runs on this computer, so localhost:{port} already reaches it.", + "2d49965e0e27e23b": "This environment can't be reached right now. Try again once it reconnects.", "7280baf7517dad1c": "Failed to load refs.", "567c0fed6ab8efc1": "This connection cannot search host files.", "5189720b9436f98c": "Search is limited to {count} characters.", @@ -4022,6 +4038,16 @@ } ], "e58a1d884fa1d8f2": "Thread details", + "43c5fbd02c6f330a": "Show less", + "de45b075b016cb14": [ + "Show ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + }, + " more" + ], "02d9667ff2c8e0b8": "Issue {key}: {title}", "4276743ee60a3c62": "{count, plural, one {{count} comment} other {{count} comments}}", "42f634397f3960aa": "Show in thread details", @@ -4061,16 +4087,6 @@ ], "159ddd0d146a0f22": "Watching: the agent wakes when checks finish, someone comments, or the branch conflicts. Click to stop.", "1cbc8b5db51b4c77": "Merge", - "43c5fbd02c6f330a": "Show less", - "de45b075b016cb14": [ - "Show ", - { - "i": 1, - "k": "_gt_value_1", - "v": "v" - }, - " more" - ], "a3d040c4ef4fc6e9": "Ahead of pace", "b16fdf56b16d99c9": "On pace", "90f977e97ae8b6c6": "Under pace", @@ -4085,6 +4101,7 @@ "66be4fb43249bbd2": "{used} of {max} tokens", "ee3ae58c8b38a425": "{left}% left", "ebb26f93fb83a71b": "{label}: {left}% left", + "1b16346722b65812": "{timeLeft}% of the window left", "728c6cc1431e76c8": "Resets in {duration} · {time}", "e16b0b9b490c8bc7": "{label}: {value}", "ba67d0a9ff5dabf0": "Clipboard API is unavailable while copying admin request.", @@ -4178,12 +4195,16 @@ ], "3237699bd13dd4bb": "Stop subagent", "075398ac562d74b0": "Disconnect agent session", + "1d2025060ba3d1c3": "Could not forward port {port}", "086ecbb6f4c2e959": "Unable to open in browser", "51052c00ab1ac8cc": "Unable to open preview", "0ccd37739f9cf2b6": "Could not stop server", "a610a81c4061bb4c": "Servers", + "253bc8b5e99002dc": "Forwarded to :{port}", "bd1ca8ccb6d0b87c": "Agent", "e25e045607262b40": "Terminal", + "194a9791a83d3f79": "Stop forwarding localhost:{port}", + "95bbbac2f2e17273": "Forward localhost:{port} to this machine", "95b263aa683271cc": "Stop localhost:{port}", "f94866e17faddc05": [ "Open in the browser panel. ", @@ -4194,6 +4215,16 @@ }, " for your browser." ], + "781fba367a220012": [ + "Forwarded to localhost:", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + }, + " on this machine. Click to stop." + ], + "92347683e33e9f02": "Forward to this machine, for any app here", "3c7763243445b28d": "Stop server", "991cc9fb37606c91": "(empty response)", "36e4b8d2db087296": "Fork from this response", @@ -5933,7 +5964,6 @@ "a74538a7917c1c96": "Play video", "11a5a4d340e6397d": "Open original", "1b74242b0d303272": "Download video", - "7a462e32dba47f4c": "Open in browser", "f9ca1e61d515445e": "Missing data URL payload.", "1b547c297573369c": "This inline media could not be decoded.", "84f7c359e5f050b1": "The file could not be fetched (HTTP {status}).", @@ -11868,7 +11898,6 @@ "0bd938825ffcf992": "+{percent}% of pool", "09c0e00d7fb55402": "Using reset credit…", "4df3ff1be768a7ab": "{name}: {remaining}% left", - "1b16346722b65812": "{timeLeft}% of the window left", "7aaaff1c6484f25c": "Segment", "8bcab2ef61de6518": "$0 cap", "a16b48709357a5a7": "Manage usage", diff --git a/apps/web/src/i18n/translations/es.json b/apps/web/src/i18n/translations/es.json index 87c7e9a861a93..3e730353316fe 100644 --- a/apps/web/src/i18n/translations/es.json +++ b/apps/web/src/i18n/translations/es.json @@ -1841,6 +1841,18 @@ "480646ceb98c7163": "Cerrar", "32fc9124998ebc18": "Local", "1c4158d741eec5da": "{label} (local)", + "a12a4958ca6b924b": "Puerto {port} reenviado", + "0f14a51b016f825d": "Las apps de este equipo lo alcanzan en localhost:{port}.", + "4bdb9a086e77ee6d": "Puerto {port} en {environment}", + "7a462e32dba47f4c": "Abrir en el navegador", + "4b8087450e97c995": "Copiar dirección", + "c170720e67d01733": "Dejar de reenviar", + "1e5c6d1c33667b17": "Reenviar localhost:{port}", + "e76f45b6a412a0b6": "Reenviar el puerto {port} desde {environment}", + "ecf3b95b3d9e6e74": "Reenviados", + "b3123e5b8602a134": "Escribe un número de puerto para reenviarlo", + "1bdeef9819b4a055": "Reenviar un puerto", + "de8a46b66f8ec455": "Puertos reenviados", "f844c41fac2d339c": "Actual", "69154433587763c0": "No hay acciones que coincidan.", "90c3a382ecefa0ce": "No hay comandos, proyectos ni hilos que coincidan.", @@ -2974,6 +2986,10 @@ "314cdccee9c14774": "Este servidor no permite consultas al registro. Actualízalo antes de cambiar de canal.", "22da1d00403ab2fd": "No se pudo comprobar el registro npm de este entorno. Revisa la conexión y los ajustes del registro.", "2fc0f7a698c95c90": "Conéctate a un servidor para comprobar las versiones.", + "922269f8691aa3ba": "No se pudo saber si este entorno se ejecuta en este equipo.", + "35cade9cc8a01363": "El reenvío de puertos necesita la app de escritorio.", + "9e303e0a794898d4": "Este entorno se ejecuta en este equipo, así que localhost:{port} ya lo alcanza.", + "2d49965e0e27e23b": "No se puede acceder a este entorno ahora. Inténtalo de nuevo cuando se vuelva a conectar.", "7280baf7517dad1c": "No se pudieron cargar las refs.", "567c0fed6ab8efc1": "Esta conexión no puede buscar archivos del host.", "5189720b9436f98c": "La búsqueda está limitada a {count} caracteres.", @@ -4020,6 +4036,16 @@ } ], "e58a1d884fa1d8f2": "Detalles del hilo", + "43c5fbd02c6f330a": "Mostrar menos", + "de45b075b016cb14": [ + "Mostrar ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + }, + " más" + ], "02d9667ff2c8e0b8": "Issue {key}: {title}", "4276743ee60a3c62": "{count, plural, one {{count} comentario} other {{count} comentarios}}", "42f634397f3960aa": "Mostrar en los detalles del hilo", @@ -4059,16 +4085,6 @@ ], "159ddd0d146a0f22": "Siguiendo: el agente se activa cuando terminan las comprobaciones, alguien comenta o la rama tiene conflictos. Haz clic para dejar de seguir.", "1cbc8b5db51b4c77": "Fusionar", - "43c5fbd02c6f330a": "Mostrar menos", - "de45b075b016cb14": [ - "Mostrar ", - { - "i": 1, - "k": "_gt_value_1", - "v": "v" - }, - " más" - ], "a3d040c4ef4fc6e9": "Por encima del ritmo", "b16fdf56b16d99c9": "Al ritmo", "90f977e97ae8b6c6": "Por debajo del ritmo", @@ -4083,6 +4099,7 @@ "66be4fb43249bbd2": "{used} de {max} tokens", "ee3ae58c8b38a425": "{left} % restante", "ebb26f93fb83a71b": "{label}: {left} % restante", + "1b16346722b65812": "Queda un {timeLeft}% de la ventana", "728c6cc1431e76c8": "Se restablece en {duration} · {time}", "e16b0b9b490c8bc7": "{label}: {value}", "ba67d0a9ff5dabf0": "La API del portapapeles no está disponible al copiar la solicitud de administrador.", @@ -4176,12 +4193,16 @@ ], "3237699bd13dd4bb": "Detener subagente", "075398ac562d74b0": "Desconectar la sesión del agente", + "1d2025060ba3d1c3": "No se pudo reenviar el puerto {port}", "086ecbb6f4c2e959": "No se puede abrir en el navegador", "51052c00ab1ac8cc": "No se puede abrir la vista previa", "0ccd37739f9cf2b6": "No se pudo detener el servidor", "a610a81c4061bb4c": "Servidores", + "253bc8b5e99002dc": "Reenviado a :{port}", "bd1ca8ccb6d0b87c": "Agente", "e25e045607262b40": "Terminal", + "194a9791a83d3f79": "Dejar de reenviar localhost:{port}", + "95bbbac2f2e17273": "Reenviar localhost:{port} a este equipo", "95b263aa683271cc": "Detener localhost:{port}", "f94866e17faddc05": [ "Abrir en el panel del navegador. ", @@ -4192,6 +4213,16 @@ }, " para tu navegador." ], + "781fba367a220012": [ + "Reenviado a localhost:", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + }, + " en este equipo. Haz clic para detenerlo." + ], + "92347683e33e9f02": "Reenviar a este equipo, para cualquier app aquí", "3c7763243445b28d": "Detener servidor", "991cc9fb37606c91": "(respuesta vacía)", "36e4b8d2db087296": "Bifurcar desde esta respuesta", @@ -5931,7 +5962,6 @@ "a74538a7917c1c96": "Reproducir vídeo", "11a5a4d340e6397d": "Abrir original", "1b74242b0d303272": "Descargar vídeo", - "7a462e32dba47f4c": "Abrir en el navegador", "f9ca1e61d515445e": "Falta el contenido de la URL de datos.", "1b547c297573369c": "No se pudo decodificar este contenido en línea.", "84f7c359e5f050b1": "No se pudo obtener el archivo (HTTP {status}).", @@ -11853,7 +11883,6 @@ "0bd938825ffcf992": "+{percent}% del total", "09c0e00d7fb55402": "Usando el crédito de restablecimiento…", "4df3ff1be768a7ab": "{name}: queda un {remaining}%", - "1b16346722b65812": "Queda un {timeLeft}% de la ventana", "7aaaff1c6484f25c": "Segmento", "8bcab2ef61de6518": "Límite de 0 $", "a16b48709357a5a7": "Gestionar uso", diff --git a/apps/web/src/i18n/translations/fr.json b/apps/web/src/i18n/translations/fr.json index a3a16e772103e..24dba2e932684 100644 --- a/apps/web/src/i18n/translations/fr.json +++ b/apps/web/src/i18n/translations/fr.json @@ -1841,6 +1841,18 @@ "480646ceb98c7163": "Fermer", "32fc9124998ebc18": "Local", "1c4158d741eec5da": "{label} (local)", + "a12a4958ca6b924b": "Port {port} redirigé", + "0f14a51b016f825d": "Les apps de cette machine l’atteignent sur localhost:{port}.", + "4bdb9a086e77ee6d": "Port {port} sur {environment}", + "7a462e32dba47f4c": "Ouvrir dans le navigateur", + "4b8087450e97c995": "Copier l’adresse", + "c170720e67d01733": "Arrêter la redirection", + "1e5c6d1c33667b17": "Rediriger localhost:{port}", + "e76f45b6a412a0b6": "Rediriger le port {port} depuis {environment}", + "ecf3b95b3d9e6e74": "Redirigés", + "b3123e5b8602a134": "Saisis un numéro de port pour le rediriger", + "1bdeef9819b4a055": "Rediriger un port", + "de8a46b66f8ec455": "Ports redirigés", "f844c41fac2d339c": "Actuel", "69154433587763c0": "Aucune action correspondante.", "90c3a382ecefa0ce": "Aucune commande, aucun projet ni aucun fil correspondant.", @@ -2974,6 +2986,10 @@ "314cdccee9c14774": "Ce serveur ne prend pas en charge les recherches dans le registre. Mettez-le à jour avant de changer de canal.", "22da1d00403ab2fd": "Impossible de vérifier le registre npm de cet environnement. Vérifiez la connexion et les paramètres du registre.", "2fc0f7a698c95c90": "Connectez-vous à un serveur pour vérifier les versions.", + "922269f8691aa3ba": "Impossible de savoir si cet environnement tourne sur cet ordinateur.", + "35cade9cc8a01363": "La redirection de ports nécessite l’app de bureau.", + "9e303e0a794898d4": "Cet environnement tourne sur cet ordinateur, donc localhost:{port} l’atteint déjà.", + "2d49965e0e27e23b": "Cet environnement est injoignable pour le moment. Réessaie une fois qu’il est reconnecté.", "7280baf7517dad1c": "Échec du chargement des refs.", "567c0fed6ab8efc1": "Cette connexion ne peut pas rechercher dans les fichiers de l’hôte.", "5189720b9436f98c": "La recherche est limitée à {count} caractères.", @@ -4021,6 +4037,16 @@ } ], "e58a1d884fa1d8f2": "Détails du fil", + "43c5fbd02c6f330a": "Afficher moins", + "de45b075b016cb14": [ + "Afficher ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + }, + " de plus" + ], "02d9667ff2c8e0b8": "Ticket {key} : {title}", "4276743ee60a3c62": "{count, plural, one {{count} commentaire} other {{count} commentaires}}", "42f634397f3960aa": "Afficher dans les détails du fil", @@ -4060,16 +4086,6 @@ ], "159ddd0d146a0f22": "Surveillance : l’agent se réveille quand les checks se terminent, que quelqu’un commente ou que la branche entre en conflit. Cliquez pour arrêter.", "1cbc8b5db51b4c77": "Fusionner", - "43c5fbd02c6f330a": "Afficher moins", - "de45b075b016cb14": [ - "Afficher ", - { - "i": 1, - "k": "_gt_value_1", - "v": "v" - }, - " de plus" - ], "a3d040c4ef4fc6e9": "En avance sur le rythme", "b16fdf56b16d99c9": "Dans le rythme", "90f977e97ae8b6c6": "En dessous du rythme", @@ -4084,6 +4100,7 @@ "66be4fb43249bbd2": "{used} tokens sur {max}", "ee3ae58c8b38a425": "{left} % restant", "ebb26f93fb83a71b": "{label} : {left} % restant", + "1b16346722b65812": "{timeLeft} % de la fenêtre restant", "728c6cc1431e76c8": "Réinitialisation dans {duration} · {time}", "e16b0b9b490c8bc7": "{label} : {value}", "ba67d0a9ff5dabf0": "L’API Presse-papiers n’est pas disponible pour copier la demande à l’administrateur.", @@ -4177,12 +4194,16 @@ ], "3237699bd13dd4bb": "Arrêter le sous-agent", "075398ac562d74b0": "Déconnecter la session de l’agent", + "1d2025060ba3d1c3": "Impossible de rediriger le port {port}", "086ecbb6f4c2e959": "Impossible d’ouvrir dans le navigateur", "51052c00ab1ac8cc": "Impossible d’ouvrir l’aperçu", "0ccd37739f9cf2b6": "Impossible d’arrêter le serveur", "a610a81c4061bb4c": "Serveurs", + "253bc8b5e99002dc": "Redirigé vers :{port}", "bd1ca8ccb6d0b87c": "Agent", "e25e045607262b40": "Terminal", + "194a9791a83d3f79": "Arrêter de rediriger localhost:{port}", + "95bbbac2f2e17273": "Rediriger localhost:{port} vers cette machine", "95b263aa683271cc": "Arrêter localhost:{port}", "f94866e17faddc05": [ "Ouvrir dans le panneau du navigateur. ", @@ -4193,6 +4214,16 @@ }, " pour votre navigateur." ], + "781fba367a220012": [ + "Redirigé vers localhost:", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + }, + " sur cette machine. Clique pour arrêter." + ], + "92347683e33e9f02": "Rediriger vers cette machine, pour toute app ici", "3c7763243445b28d": "Arrêter le serveur", "991cc9fb37606c91": "(réponse vide)", "36e4b8d2db087296": "Créer un fork depuis cette réponse", @@ -5932,7 +5963,6 @@ "a74538a7917c1c96": "Lire la vidéo", "11a5a4d340e6397d": "Ouvrir l’original", "1b74242b0d303272": "Télécharger la vidéo", - "7a462e32dba47f4c": "Ouvrir dans le navigateur", "f9ca1e61d515445e": "Contenu de la data URL manquant.", "1b547c297573369c": "Impossible de décoder ce média intégré.", "84f7c359e5f050b1": "Impossible de récupérer le fichier (HTTP {status}).", @@ -11858,7 +11888,6 @@ "0bd938825ffcf992": "+{percent} % du quota", "09c0e00d7fb55402": "Utilisation du crédit de réinitialisation…", "4df3ff1be768a7ab": "{name} : {remaining} % restant", - "1b16346722b65812": "{timeLeft} % de la fenêtre restant", "7aaaff1c6484f25c": "Segment", "8bcab2ef61de6518": "Plafond de 0 $", "a16b48709357a5a7": "Gérer l’utilisation", diff --git a/apps/web/src/i18n/translations/ja.json b/apps/web/src/i18n/translations/ja.json index 8459e9cf87854..e88cc490a8590 100644 --- a/apps/web/src/i18n/translations/ja.json +++ b/apps/web/src/i18n/translations/ja.json @@ -1839,6 +1839,18 @@ "480646ceb98c7163": "閉じる", "32fc9124998ebc18": "ローカル", "1c4158d741eec5da": "{label} (ローカル)", + "a12a4958ca6b924b": "ポート {port} を転送しました", + "0f14a51b016f825d": "このマシンのアプリから localhost:{port} でアクセスできます。", + "4bdb9a086e77ee6d": "{environment} のポート {port}", + "7a462e32dba47f4c": "ブラウザーで開く", + "4b8087450e97c995": "アドレスをコピー", + "c170720e67d01733": "転送を停止", + "1e5c6d1c33667b17": "localhost:{port} を転送", + "e76f45b6a412a0b6": "{environment} からポート {port} を転送", + "ecf3b95b3d9e6e74": "転送中", + "b3123e5b8602a134": "転送するポート番号を入力", + "1bdeef9819b4a055": "ポートを転送", + "de8a46b66f8ec455": "転送中のポート", "f844c41fac2d339c": "現在", "69154433587763c0": "一致するアクションはありません。", "90c3a382ecefa0ce": "一致するコマンド、プロジェクト、スレッドはありません。", @@ -2972,6 +2984,10 @@ "314cdccee9c14774": "このサーバーはレジストリの検索をサポートしていません。トラックを切り替える前に更新してください。", "22da1d00403ab2fd": "この環境の npm レジストリを確認できませんでした。接続とレジストリの設定を確認してください。", "2fc0f7a698c95c90": "リリースを確認するにはサーバーに接続してください。", + "922269f8691aa3ba": "この環境がこのコンピューターで動いているか判断できませんでした。", + "35cade9cc8a01363": "ポート転送にはデスクトップアプリが必要です。", + "9e303e0a794898d4": "この環境はこのコンピューターで動いているため、localhost:{port} で既にアクセスできます。", + "2d49965e0e27e23b": "現在この環境に接続できません。再接続されてからもう一度お試しください。", "7280baf7517dad1c": "ref を読み込めませんでした。", "567c0fed6ab8efc1": "この接続ではホストのファイルを検索できません。", "5189720b9436f98c": "検索は {count} 文字までです。", @@ -4011,6 +4027,16 @@ } ], "e58a1d884fa1d8f2": "スレッドの詳細", + "43c5fbd02c6f330a": "表示を減らす", + "de45b075b016cb14": [ + "さらに ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + }, + " 件を表示" + ], "02d9667ff2c8e0b8": "Issue {key}: {title}", "4276743ee60a3c62": "{count, plural, other {{count} 件のコメント}}", "42f634397f3960aa": "スレッドの詳細に表示", @@ -4050,16 +4076,6 @@ ], "159ddd0d146a0f22": "監視中: チェックの完了、コメントの追加、ブランチの競合が発生するとエージェントが起動します。クリックすると停止します。", "1cbc8b5db51b4c77": "マージ", - "43c5fbd02c6f330a": "表示を減らす", - "de45b075b016cb14": [ - "さらに ", - { - "i": 1, - "k": "_gt_value_1", - "v": "v" - }, - " 件を表示" - ], "a3d040c4ef4fc6e9": "ペースより速い", "b16fdf56b16d99c9": "ペースどおり", "90f977e97ae8b6c6": "ペースより遅い", @@ -4074,6 +4090,7 @@ "66be4fb43249bbd2": "{used} / {max} トークン", "ee3ae58c8b38a425": "残り {left}%", "ebb26f93fb83a71b": "{label}: 残り {left}%", + "1b16346722b65812": "期間の残り {timeLeft}%", "728c6cc1431e76c8": "{duration} 後にリセット · {time}", "e16b0b9b490c8bc7": "{label}: {value}", "ba67d0a9ff5dabf0": "管理者へのリクエストをコピーする際にクリップボード API を利用できませんでした。", @@ -4167,12 +4184,16 @@ ], "3237699bd13dd4bb": "サブエージェントを停止", "075398ac562d74b0": "エージェントのセッションを切断", + "1d2025060ba3d1c3": "ポート {port} を転送できませんでした", "086ecbb6f4c2e959": "ブラウザーで開けません", "51052c00ab1ac8cc": "プレビューを開けません", "0ccd37739f9cf2b6": "サーバーを停止できませんでした", "a610a81c4061bb4c": "サーバー", + "253bc8b5e99002dc": ":{port} に転送中", "bd1ca8ccb6d0b87c": "エージェント", "e25e045607262b40": "ターミナル", + "194a9791a83d3f79": "localhost:{port} の転送を停止", + "95bbbac2f2e17273": "localhost:{port} をこのマシンに転送", "95b263aa683271cc": "localhost:{port} を停止", "f94866e17faddc05": [ "ブラウザーパネルで開きます。", @@ -4183,6 +4204,16 @@ }, " で自分のブラウザーで開きます。" ], + "781fba367a220012": [ + "このマシンの localhost:", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + }, + " に転送中です。クリックで停止します。" + ], + "92347683e33e9f02": "このマシンに転送し、ここのどのアプリからも使えるようにする", "3c7763243445b28d": "サーバーを停止", "991cc9fb37606c91": "(空のレスポンス)", "36e4b8d2db087296": "この応答からフォーク", @@ -5913,7 +5944,6 @@ "a74538a7917c1c96": "動画を再生", "11a5a4d340e6397d": "元のファイルを開く", "1b74242b0d303272": "動画をダウンロード", - "7a462e32dba47f4c": "ブラウザーで開く", "f9ca1e61d515445e": "データ URL のペイロードがありません。", "1b547c297573369c": "このインラインメディアをデコードできませんでした。", "84f7c359e5f050b1": "ファイルを取得できませんでした (HTTP {status})。", @@ -11808,7 +11838,6 @@ "0bd938825ffcf992": "プールの +{percent}%", "09c0e00d7fb55402": "リセットクレジットを使用しています…", "4df3ff1be768a7ab": "{name}: 残り {remaining}%", - "1b16346722b65812": "期間の残り {timeLeft}%", "7aaaff1c6484f25c": "セグメント", "8bcab2ef61de6518": "上限 $0", "a16b48709357a5a7": "使用量を管理", diff --git a/apps/web/src/i18n/translations/ko.json b/apps/web/src/i18n/translations/ko.json index c523c5dc7b1fc..c80d5dc373208 100644 --- a/apps/web/src/i18n/translations/ko.json +++ b/apps/web/src/i18n/translations/ko.json @@ -1841,6 +1841,18 @@ "480646ceb98c7163": "닫기", "32fc9124998ebc18": "로컬", "1c4158d741eec5da": "{label}(로컬)", + "a12a4958ca6b924b": "포트 {port}을(를) 포워딩했습니다", + "0f14a51b016f825d": "이 컴퓨터의 앱에서 localhost:{port}로 접속할 수 있습니다.", + "4bdb9a086e77ee6d": "{environment}의 포트 {port}", + "7a462e32dba47f4c": "브라우저에서 열기", + "4b8087450e97c995": "주소 복사", + "c170720e67d01733": "포워딩 중지", + "1e5c6d1c33667b17": "localhost:{port} 포워딩", + "e76f45b6a412a0b6": "{environment}에서 포트 {port} 포워딩", + "ecf3b95b3d9e6e74": "포워딩됨", + "b3123e5b8602a134": "포워딩할 포트 번호를 입력하세요", + "1bdeef9819b4a055": "포트 포워딩", + "de8a46b66f8ec455": "포워딩된 포트", "f844c41fac2d339c": "현재", "69154433587763c0": "일치하는 작업이 없습니다.", "90c3a382ecefa0ce": "일치하는 명령, 프로젝트, 스레드가 없습니다.", @@ -2973,6 +2985,10 @@ "314cdccee9c14774": "이 서버는 레지스트리 조회를 지원하지 않습니다. 트랙을 전환하기 전에 업데이트하세요.", "22da1d00403ab2fd": "이 환경의 npm 레지스트리를 확인할 수 없습니다. 연결 및 레지스트리 설정을 확인하세요.", "2fc0f7a698c95c90": "릴리스를 확인하려면 서버에 연결하세요.", + "922269f8691aa3ba": "이 환경이 이 컴퓨터에서 실행 중인지 확인할 수 없습니다.", + "35cade9cc8a01363": "포트 포워딩은 데스크톱 앱이 필요합니다.", + "9e303e0a794898d4": "이 환경은 이 컴퓨터에서 실행 중이므로 localhost:{port}로 이미 접속할 수 있습니다.", + "2d49965e0e27e23b": "지금은 이 환경에 연결할 수 없습니다. 다시 연결되면 다시 시도하세요.", "7280baf7517dad1c": "참조를 불러오지 못했습니다.", "567c0fed6ab8efc1": "이 연결로는 호스트 파일을 검색할 수 없습니다.", "5189720b9436f98c": "검색어는 {count}자로 제한됩니다.", @@ -4009,6 +4025,15 @@ } ], "e58a1d884fa1d8f2": "스레드 세부 정보", + "43c5fbd02c6f330a": "간략히 보기", + "de45b075b016cb14": [ + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + }, + "개 더 보기" + ], "02d9667ff2c8e0b8": "이슈 {key}: {title}", "4276743ee60a3c62": "{count, plural, other {댓글 {count}개}}", "42f634397f3960aa": "스레드 세부 정보에 표시", @@ -4048,15 +4073,6 @@ ], "159ddd0d146a0f22": "지켜보는 중: 검사가 끝나거나, 누군가 댓글을 달거나, 브랜치가 충돌하면 에이전트가 깨어납니다. 클릭하여 중지하세요.", "1cbc8b5db51b4c77": "병합", - "43c5fbd02c6f330a": "간략히 보기", - "de45b075b016cb14": [ - { - "i": 1, - "k": "_gt_value_1", - "v": "v" - }, - "개 더 보기" - ], "a3d040c4ef4fc6e9": "예상보다 빠름", "b16fdf56b16d99c9": "예상대로", "90f977e97ae8b6c6": "예상보다 느림", @@ -4071,6 +4087,7 @@ "66be4fb43249bbd2": "토큰 {max}개 중 {used}개", "ee3ae58c8b38a425": "{left}% 남음", "ebb26f93fb83a71b": "{label}: {left}% 남음", + "1b16346722b65812": "기간 {timeLeft}% 남음", "728c6cc1431e76c8": "{duration} 후 초기화 · {time}", "e16b0b9b490c8bc7": "{label}: {value}", "ba67d0a9ff5dabf0": "관리자 요청을 복사하는 중 클립보드 API를 사용할 수 없습니다.", @@ -4164,12 +4181,16 @@ ], "3237699bd13dd4bb": "서브에이전트 중지", "075398ac562d74b0": "에이전트 세션 연결 끊기", + "1d2025060ba3d1c3": "포트 {port}을(를) 포워딩할 수 없습니다", "086ecbb6f4c2e959": "브라우저에서 열 수 없습니다", "51052c00ab1ac8cc": "미리 보기를 열 수 없습니다", "0ccd37739f9cf2b6": "서버를 중지할 수 없습니다", "a610a81c4061bb4c": "서버", + "253bc8b5e99002dc": ":{port}로 포워딩됨", "bd1ca8ccb6d0b87c": "에이전트", "e25e045607262b40": "터미널", + "194a9791a83d3f79": "localhost:{port} 포워딩 중지", + "95bbbac2f2e17273": "localhost:{port}을(를) 이 컴퓨터로 포워딩", "95b263aa683271cc": "localhost:{port} 중지", "f94866e17faddc05": [ "브라우저 패널에서 엽니다. ", @@ -4180,6 +4201,16 @@ }, "하면 내 브라우저에서 엽니다." ], + "781fba367a220012": [ + "이 컴퓨터의 localhost:", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + }, + "(으)로 포워딩 중입니다. 클릭하면 중지합니다." + ], + "92347683e33e9f02": "이 컴퓨터로 포워딩해 여기 있는 모든 앱에서 사용", "3c7763243445b28d": "서버 중지", "991cc9fb37606c91": "(빈 응답)", "36e4b8d2db087296": "이 응답에서 포크", @@ -5911,7 +5942,6 @@ "a74538a7917c1c96": "동영상 재생", "11a5a4d340e6397d": "원본 열기", "1b74242b0d303272": "동영상 다운로드", - "7a462e32dba47f4c": "브라우저에서 열기", "f9ca1e61d515445e": "데이터 URL 페이로드가 없습니다.", "1b547c297573369c": "이 인라인 미디어를 디코딩할 수 없습니다.", "84f7c359e5f050b1": "파일을 가져올 수 없습니다(HTTP {status}).", @@ -11805,7 +11835,6 @@ "0bd938825ffcf992": "풀의 +{percent}%", "09c0e00d7fb55402": "초기화 크레딧 사용 중…", "4df3ff1be768a7ab": "{name}: {remaining}% 남음", - "1b16346722b65812": "기간 {timeLeft}% 남음", "7aaaff1c6484f25c": "구간", "8bcab2ef61de6518": "$0 한도", "a16b48709357a5a7": "사용량 관리", diff --git a/apps/web/src/i18n/translations/pt-BR.json b/apps/web/src/i18n/translations/pt-BR.json index bd34cd96c3d8b..a2a2daa2b7ccc 100644 --- a/apps/web/src/i18n/translations/pt-BR.json +++ b/apps/web/src/i18n/translations/pt-BR.json @@ -1841,6 +1841,18 @@ "480646ceb98c7163": "Fechar", "32fc9124998ebc18": "Local", "1c4158d741eec5da": "{label} (local)", + "a12a4958ca6b924b": "Porta {port} encaminhada", + "0f14a51b016f825d": "Os apps desta máquina a acessam em localhost:{port}.", + "4bdb9a086e77ee6d": "Porta {port} em {environment}", + "7a462e32dba47f4c": "Abrir no navegador", + "4b8087450e97c995": "Copiar endereço", + "c170720e67d01733": "Parar de encaminhar", + "1e5c6d1c33667b17": "Encaminhar localhost:{port}", + "e76f45b6a412a0b6": "Encaminhar a porta {port} de {environment}", + "ecf3b95b3d9e6e74": "Encaminhadas", + "b3123e5b8602a134": "Digite um número de porta para encaminhá-la", + "1bdeef9819b4a055": "Encaminhar uma porta", + "de8a46b66f8ec455": "Portas encaminhadas", "f844c41fac2d339c": "Atual", "69154433587763c0": "Nenhuma ação correspondente.", "90c3a382ecefa0ce": "Nenhum comando, projeto ou thread correspondente.", @@ -2974,6 +2986,10 @@ "314cdccee9c14774": "Este servidor não permite consultas ao registro. Atualize-o antes de trocar de canal.", "22da1d00403ab2fd": "Não foi possível verificar o registro npm deste ambiente. Verifique a conexão e as configurações do registro.", "2fc0f7a698c95c90": "Conecte-se a um servidor para verificar as versões.", + "922269f8691aa3ba": "Não foi possível saber se este ambiente roda neste computador.", + "35cade9cc8a01363": "O encaminhamento de portas precisa do app para desktop.", + "9e303e0a794898d4": "Este ambiente roda neste computador, então localhost:{port} já o alcança.", + "2d49965e0e27e23b": "Não é possível acessar este ambiente agora. Tente novamente quando ele se reconectar.", "7280baf7517dad1c": "Falha ao carregar as refs.", "567c0fed6ab8efc1": "Esta conexão não pode pesquisar arquivos do host.", "5189720b9436f98c": "A pesquisa é limitada a {count} caracteres.", @@ -4021,6 +4037,15 @@ } ], "e58a1d884fa1d8f2": "Detalhes da thread", + "43c5fbd02c6f330a": "Mostrar menos", + "de45b075b016cb14": [ + "Mostrar mais ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], "02d9667ff2c8e0b8": "Issue {key}: {title}", "4276743ee60a3c62": "{count, plural, one {{count} comentário} other {{count} comentários}}", "42f634397f3960aa": "Mostrar nos detalhes da thread", @@ -4060,15 +4085,6 @@ ], "159ddd0d146a0f22": "Acompanhando: o agente é ativado quando as verificações terminam, alguém comenta ou o branch entra em conflito. Clique para parar.", "1cbc8b5db51b4c77": "Mesclar", - "43c5fbd02c6f330a": "Mostrar menos", - "de45b075b016cb14": [ - "Mostrar mais ", - { - "i": 1, - "k": "_gt_value_1", - "v": "v" - } - ], "a3d040c4ef4fc6e9": "Acima do ritmo", "b16fdf56b16d99c9": "No ritmo", "90f977e97ae8b6c6": "Abaixo do ritmo", @@ -4083,6 +4099,7 @@ "66be4fb43249bbd2": "{used} de {max} tokens", "ee3ae58c8b38a425": "{left}% restante", "ebb26f93fb83a71b": "{label}: {left}% restante", + "1b16346722b65812": "{timeLeft}% da janela restante", "728c6cc1431e76c8": "Renova em {duration} · {time}", "e16b0b9b490c8bc7": "{label}: {value}", "ba67d0a9ff5dabf0": "A API da área de transferência não está disponível ao copiar o pedido para o administrador.", @@ -4176,12 +4193,16 @@ ], "3237699bd13dd4bb": "Parar subagente", "075398ac562d74b0": "Desconectar a sessão do agente", + "1d2025060ba3d1c3": "Não foi possível encaminhar a porta {port}", "086ecbb6f4c2e959": "Não foi possível abrir no navegador", "51052c00ab1ac8cc": "Não foi possível abrir a pré-visualização", "0ccd37739f9cf2b6": "Não foi possível parar o servidor", "a610a81c4061bb4c": "Servidores", + "253bc8b5e99002dc": "Encaminhada para :{port}", "bd1ca8ccb6d0b87c": "Agente", "e25e045607262b40": "Terminal", + "194a9791a83d3f79": "Parar de encaminhar localhost:{port}", + "95bbbac2f2e17273": "Encaminhar localhost:{port} para esta máquina", "95b263aa683271cc": "Parar localhost:{port}", "f94866e17faddc05": [ "Abrir no painel do navegador. ", @@ -4192,6 +4213,16 @@ }, " para o seu navegador." ], + "781fba367a220012": [ + "Encaminhada para localhost:", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + }, + " nesta máquina. Clique para parar." + ], + "92347683e33e9f02": "Encaminhar para esta máquina, para qualquer app aqui", "3c7763243445b28d": "Parar servidor", "991cc9fb37606c91": "(resposta vazia)", "36e4b8d2db087296": "Criar fork a partir desta resposta", @@ -5931,7 +5962,6 @@ "a74538a7917c1c96": "Reproduzir vídeo", "11a5a4d340e6397d": "Abrir original", "1b74242b0d303272": "Baixar vídeo", - "7a462e32dba47f4c": "Abrir no navegador", "f9ca1e61d515445e": "Falta o conteúdo da data URL.", "1b547c297573369c": "Não foi possível decodificar esta mídia em linha.", "84f7c359e5f050b1": "Não foi possível buscar o arquivo (HTTP {status}).", @@ -11857,7 +11887,6 @@ "0bd938825ffcf992": "+{percent}% do total", "09c0e00d7fb55402": "Usando crédito de redefinição…", "4df3ff1be768a7ab": "{name}: {remaining}% restante", - "1b16346722b65812": "{timeLeft}% da janela restante", "7aaaff1c6484f25c": "Segmento", "8bcab2ef61de6518": "Limite de $0", "a16b48709357a5a7": "Gerenciar uso", diff --git a/apps/web/src/i18n/translations/ru.json b/apps/web/src/i18n/translations/ru.json index 4242d78d5f3c5..852b80217f746 100644 --- a/apps/web/src/i18n/translations/ru.json +++ b/apps/web/src/i18n/translations/ru.json @@ -1841,6 +1841,18 @@ "480646ceb98c7163": "Закрыть", "32fc9124998ebc18": "Локально", "1c4158d741eec5da": "{label} (локально)", + "a12a4958ca6b924b": "Порт {port} перенаправлен", + "0f14a51b016f825d": "Приложения на этом компьютере открывают его по адресу localhost:{port}.", + "4bdb9a086e77ee6d": "Порт {port} в {environment}", + "7a462e32dba47f4c": "Открыть в браузере", + "4b8087450e97c995": "Копировать адрес", + "c170720e67d01733": "Остановить перенаправление", + "1e5c6d1c33667b17": "Перенаправить localhost:{port}", + "e76f45b6a412a0b6": "Перенаправить порт {port} из {environment}", + "ecf3b95b3d9e6e74": "Перенаправленные", + "b3123e5b8602a134": "Введите номер порта, чтобы перенаправить его", + "1bdeef9819b4a055": "Перенаправить порт", + "de8a46b66f8ec455": "Перенаправленные порты", "f844c41fac2d339c": "Текущий", "69154433587763c0": "Нет подходящих действий.", "90c3a382ecefa0ce": "Нет подходящих команд, проектов или тредов.", @@ -2974,6 +2986,10 @@ "314cdccee9c14774": "Этот сервер не поддерживает запросы к реестру. Обновите его перед сменой канала.", "22da1d00403ab2fd": "Не удалось проверить реестр npm этого окружения. Проверьте подключение и настройки реестра.", "2fc0f7a698c95c90": "Подключитесь к серверу, чтобы проверить выпуски.", + "922269f8691aa3ba": "Не удалось определить, работает ли это окружение на этом компьютере.", + "35cade9cc8a01363": "Для перенаправления портов нужно приложение для компьютера.", + "9e303e0a794898d4": "Это окружение работает на этом компьютере, поэтому localhost:{port} уже ведёт к нему.", + "2d49965e0e27e23b": "Сейчас это окружение недоступно. Попробуйте снова, когда оно переподключится.", "7280baf7517dad1c": "Не удалось загрузить ссылки.", "567c0fed6ab8efc1": "Это подключение не может искать файлы на хосте.", "5189720b9436f98c": "Поиск ограничен {count} символами.", @@ -4021,6 +4037,15 @@ } ], "e58a1d884fa1d8f2": "Сведения о треде", + "43c5fbd02c6f330a": "Показать меньше", + "de45b075b016cb14": [ + "Показать ещё ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + } + ], "02d9667ff2c8e0b8": "Issue {key}: {title}", "4276743ee60a3c62": "{count, plural, one {{count} комментарий} few {{count} комментария} many {{count} комментариев} other {{count} комментария}}", "42f634397f3960aa": "Показывать в сведениях о треде", @@ -4060,15 +4085,6 @@ ], "159ddd0d146a0f22": "Отслеживается: агент проснётся, когда завершатся проверки, кто-то оставит комментарий или в ветке появится конфликт. Нажмите, чтобы прекратить.", "1cbc8b5db51b4c77": "Слить", - "43c5fbd02c6f330a": "Показать меньше", - "de45b075b016cb14": [ - "Показать ещё ", - { - "i": 1, - "k": "_gt_value_1", - "v": "v" - } - ], "a3d040c4ef4fc6e9": "Быстрее темпа", "b16fdf56b16d99c9": "В темпе", "90f977e97ae8b6c6": "Медленнее темпа", @@ -4083,6 +4099,7 @@ "66be4fb43249bbd2": "{used} из {max} токенов", "ee3ae58c8b38a425": "Осталось {left}%", "ebb26f93fb83a71b": "{label}: осталось {left}%", + "1b16346722b65812": "От окна осталось {timeLeft}%", "728c6cc1431e76c8": "Сброс через {duration} · {time}", "e16b0b9b490c8bc7": "{label}: {value}", "ba67d0a9ff5dabf0": "API буфера обмена недоступен при копировании запроса администратору.", @@ -4176,12 +4193,16 @@ ], "3237699bd13dd4bb": "Остановить субагента", "075398ac562d74b0": "Отключить сеанс агента", + "1d2025060ba3d1c3": "Не удалось перенаправить порт {port}", "086ecbb6f4c2e959": "Не удалось открыть в браузере", "51052c00ab1ac8cc": "Не удалось открыть предпросмотр", "0ccd37739f9cf2b6": "Не удалось остановить сервер", "a610a81c4061bb4c": "Серверы", + "253bc8b5e99002dc": "Перенаправлен на :{port}", "bd1ca8ccb6d0b87c": "Агент", "e25e045607262b40": "Терминал", + "194a9791a83d3f79": "Остановить перенаправление localhost:{port}", + "95bbbac2f2e17273": "Перенаправить localhost:{port} на этот компьютер", "95b263aa683271cc": "Остановить localhost:{port}", "f94866e17faddc05": [ "Открыть в панели браузера. ", @@ -4192,6 +4213,16 @@ }, " — в вашем браузере." ], + "781fba367a220012": [ + "Перенаправлен на localhost:", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + }, + " на этом компьютере. Нажмите, чтобы остановить." + ], + "92347683e33e9f02": "Перенаправить на этот компьютер для любых приложений", "3c7763243445b28d": "Остановить сервер", "991cc9fb37606c91": "(пустой ответ)", "36e4b8d2db087296": "Ответвить от этого ответа", @@ -5931,7 +5962,6 @@ "a74538a7917c1c96": "Воспроизвести видео", "11a5a4d340e6397d": "Открыть оригинал", "1b74242b0d303272": "Скачать видео", - "7a462e32dba47f4c": "Открыть в браузере", "f9ca1e61d515445e": "Нет данных data URL.", "1b547c297573369c": "Не удалось декодировать это встроенное медиа.", "84f7c359e5f050b1": "Не удалось получить файл (HTTP {status}).", @@ -11858,7 +11888,6 @@ "0bd938825ffcf992": "+{percent}% пула", "09c0e00d7fb55402": "Использование кредита на сброс…", "4df3ff1be768a7ab": "{name}: осталось {remaining}%", - "1b16346722b65812": "От окна осталось {timeLeft}%", "7aaaff1c6484f25c": "Сегмент", "8bcab2ef61de6518": "Лимит $0", "a16b48709357a5a7": "Управление использованием", diff --git a/apps/web/src/i18n/translations/sv.json b/apps/web/src/i18n/translations/sv.json index d3d7bec015020..f8c06f7408c75 100644 --- a/apps/web/src/i18n/translations/sv.json +++ b/apps/web/src/i18n/translations/sv.json @@ -1841,6 +1841,18 @@ "480646ceb98c7163": "Stäng", "32fc9124998ebc18": "Lokal", "1c4158d741eec5da": "{label} (lokal)", + "a12a4958ca6b924b": "Port {port} vidarebefordrad", + "0f14a51b016f825d": "Appar på den här datorn når den på localhost:{port}.", + "4bdb9a086e77ee6d": "Port {port} på {environment}", + "7a462e32dba47f4c": "Öppna i webbläsaren", + "4b8087450e97c995": "Kopiera adress", + "c170720e67d01733": "Sluta vidarebefordra", + "1e5c6d1c33667b17": "Vidarebefordra localhost:{port}", + "e76f45b6a412a0b6": "Vidarebefordra port {port} från {environment}", + "ecf3b95b3d9e6e74": "Vidarebefordrade", + "b3123e5b8602a134": "Skriv ett portnummer för att vidarebefordra det", + "1bdeef9819b4a055": "Vidarebefordra en port", + "de8a46b66f8ec455": "Vidarebefordrade portar", "f844c41fac2d339c": "Aktuellt", "69154433587763c0": "Inga matchande åtgärder.", "90c3a382ecefa0ce": "Inga matchande kommandon, projekt eller trådar.", @@ -2974,6 +2986,10 @@ "314cdccee9c14774": "Den här servern stöder inte registeruppslag. Uppdatera den innan du byter spår.", "22da1d00403ab2fd": "Kunde inte kontrollera den här miljöns npm-register. Kontrollera anslutningen och registerinställningarna.", "2fc0f7a698c95c90": "Anslut till en server för att söka efter versioner.", + "922269f8691aa3ba": "Det gick inte att avgöra om den här miljön körs på den här datorn.", + "35cade9cc8a01363": "Portvidarebefordring kräver skrivbordsappen.", + "9e303e0a794898d4": "Den här miljön körs på den här datorn, så localhost:{port} når den redan.", + "2d49965e0e27e23b": "Den här miljön går inte att nå just nu. Försök igen när den har anslutit igen.", "7280baf7517dad1c": "Det gick inte att läsa in refs.", "567c0fed6ab8efc1": "Den här anslutningen kan inte söka i värdens filer.", "5189720b9436f98c": "Sökningen är begränsad till {count} tecken.", @@ -4021,6 +4037,16 @@ } ], "e58a1d884fa1d8f2": "Tråddetaljer", + "43c5fbd02c6f330a": "Visa mindre", + "de45b075b016cb14": [ + "Visa ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + }, + " till" + ], "02d9667ff2c8e0b8": "Ärende {key}: {title}", "4276743ee60a3c62": "{count, plural, one {{count} kommentar} other {{count} kommentarer}}", "42f634397f3960aa": "Visa i tråddetaljer", @@ -4060,16 +4086,6 @@ ], "159ddd0d146a0f22": "Bevakar: agenten vaknar när kontrollerna är klara, någon kommenterar eller grenen får konflikter. Klicka för att sluta.", "1cbc8b5db51b4c77": "Merga", - "43c5fbd02c6f330a": "Visa mindre", - "de45b075b016cb14": [ - "Visa ", - { - "i": 1, - "k": "_gt_value_1", - "v": "v" - }, - " till" - ], "a3d040c4ef4fc6e9": "Före takten", "b16fdf56b16d99c9": "I takt", "90f977e97ae8b6c6": "Under takten", @@ -4084,6 +4100,7 @@ "66be4fb43249bbd2": "{used} av {max} token", "ee3ae58c8b38a425": "{left} % kvar", "ebb26f93fb83a71b": "{label}: {left} % kvar", + "1b16346722b65812": "{timeLeft} % av fönstret kvar", "728c6cc1431e76c8": "Återställs om {duration} · {time}", "e16b0b9b490c8bc7": "{label}: {value}", "ba67d0a9ff5dabf0": "Urklipps-API:t är inte tillgängligt vid kopiering av administratörsbegäran.", @@ -4177,12 +4194,16 @@ ], "3237699bd13dd4bb": "Stoppa subagent", "075398ac562d74b0": "Koppla från agentsession", + "1d2025060ba3d1c3": "Kunde inte vidarebefordra port {port}", "086ecbb6f4c2e959": "Det gick inte att öppna i webbläsaren", "51052c00ab1ac8cc": "Det gick inte att öppna förhandsvisningen", "0ccd37739f9cf2b6": "Kunde inte stoppa servern", "a610a81c4061bb4c": "Servrar", + "253bc8b5e99002dc": "Vidarebefordrad till :{port}", "bd1ca8ccb6d0b87c": "Agent", "e25e045607262b40": "Terminal", + "194a9791a83d3f79": "Sluta vidarebefordra localhost:{port}", + "95bbbac2f2e17273": "Vidarebefordra localhost:{port} till den här datorn", "95b263aa683271cc": "Stoppa localhost:{port}", "f94866e17faddc05": [ "Öppna i webbläsarpanelen. ", @@ -4193,6 +4214,16 @@ }, " för din webbläsare." ], + "781fba367a220012": [ + "Vidarebefordrad till localhost:", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + }, + " på den här datorn. Klicka för att stoppa." + ], + "92347683e33e9f02": "Vidarebefordra till den här datorn, för alla appar här", "3c7763243445b28d": "Stoppa server", "991cc9fb37606c91": "(tomt svar)", "36e4b8d2db087296": "Forka från det här svaret", @@ -5932,7 +5963,6 @@ "a74538a7917c1c96": "Spela upp video", "11a5a4d340e6397d": "Öppna original", "1b74242b0d303272": "Ladda ned video", - "7a462e32dba47f4c": "Öppna i webbläsaren", "f9ca1e61d515445e": "Data-URL:ens innehåll saknas.", "1b547c297573369c": "Det här inbäddade mediet kunde inte avkodas.", "84f7c359e5f050b1": "Filen kunde inte hämtas (HTTP {status}).", @@ -11866,7 +11896,6 @@ "0bd938825ffcf992": "+{percent} % av poolen", "09c0e00d7fb55402": "Använder återställningskredit…", "4df3ff1be768a7ab": "{name}: {remaining} % kvar", - "1b16346722b65812": "{timeLeft} % av fönstret kvar", "7aaaff1c6484f25c": "Segment", "8bcab2ef61de6518": "Tak på 0 $", "a16b48709357a5a7": "Hantera användning", diff --git a/apps/web/src/i18n/translations/zh.json b/apps/web/src/i18n/translations/zh.json index 5923adef292f5..74245c4e54300 100644 --- a/apps/web/src/i18n/translations/zh.json +++ b/apps/web/src/i18n/translations/zh.json @@ -1842,6 +1842,18 @@ "480646ceb98c7163": "关闭", "32fc9124998ebc18": "本地", "1c4158d741eec5da": "{label}(本地)", + "a12a4958ca6b924b": "已转发端口 {port}", + "0f14a51b016f825d": "本机上的应用可通过 localhost:{port} 访问它。", + "4bdb9a086e77ee6d": "{environment} 上的端口 {port}", + "7a462e32dba47f4c": "在浏览器中打开", + "4b8087450e97c995": "复制地址", + "c170720e67d01733": "停止转发", + "1e5c6d1c33667b17": "转发 localhost:{port}", + "e76f45b6a412a0b6": "从 {environment} 转发端口 {port}", + "ecf3b95b3d9e6e74": "已转发", + "b3123e5b8602a134": "输入端口号以转发", + "1bdeef9819b4a055": "转发端口", + "de8a46b66f8ec455": "已转发的端口", "f844c41fac2d339c": "当前", "69154433587763c0": "没有匹配的操作。", "90c3a382ecefa0ce": "没有匹配的命令、项目或会话。", @@ -2978,6 +2990,10 @@ "314cdccee9c14774": "此服务器不支持查询仓库。请先更新,再切换通道。", "22da1d00403ab2fd": "无法检查此环境的 npm 仓库。请检查连接和仓库设置。", "2fc0f7a698c95c90": "连接一个服务器以检查版本。", + "922269f8691aa3ba": "无法判断此环境是否运行在这台计算机上。", + "35cade9cc8a01363": "端口转发需要桌面应用。", + "9e303e0a794898d4": "此环境运行在这台计算机上,localhost:{port} 已经可以访问它。", + "2d49965e0e27e23b": "目前无法访问此环境。请在它重新连接后再试。", "7280baf7517dad1c": "无法加载引用。", "567c0fed6ab8efc1": "此连接无法搜索主机文件。", "5189720b9436f98c": "搜索最多 {count} 个字符。", @@ -4026,6 +4042,16 @@ } ], "e58a1d884fa1d8f2": "会话详情", + "43c5fbd02c6f330a": "收起", + "de45b075b016cb14": [ + "再显示 ", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + }, + " 个" + ], "02d9667ff2c8e0b8": "issue {key}:{title}", "4276743ee60a3c62": "{count, plural, other {{count} 条评论}}", "42f634397f3960aa": "在会话详情中显示", @@ -4066,16 +4092,6 @@ ], "159ddd0d146a0f22": "关注中:检查完成、有人评论或分支出现冲突时,智能体会被唤醒。点击停止关注。", "1cbc8b5db51b4c77": "合并", - "43c5fbd02c6f330a": "收起", - "de45b075b016cb14": [ - "再显示 ", - { - "i": 1, - "k": "_gt_value_1", - "v": "v" - }, - " 个" - ], "a3d040c4ef4fc6e9": "用量消耗偏快", "b16fdf56b16d99c9": "用量消耗适中", "90f977e97ae8b6c6": "用量消耗偏慢", @@ -4090,6 +4106,7 @@ "66be4fb43249bbd2": "{used} / {max} token", "ee3ae58c8b38a425": "剩余 {left}%", "ebb26f93fb83a71b": "{label}:剩余 {left}%", + "1b16346722b65812": "窗口剩余 {timeLeft}%", "728c6cc1431e76c8": "{duration} 后重置 · {time}", "e16b0b9b490c8bc7": "{label}:{value}", "ba67d0a9ff5dabf0": "复制管理员请求时剪贴板 API 不可用。", @@ -4183,12 +4200,16 @@ ], "3237699bd13dd4bb": "停止子智能体", "075398ac562d74b0": "断开智能体会话", + "1d2025060ba3d1c3": "无法转发端口 {port}", "086ecbb6f4c2e959": "无法在浏览器中打开", "51052c00ab1ac8cc": "无法打开预览", "0ccd37739f9cf2b6": "无法停止服务器", "a610a81c4061bb4c": "服务器", + "253bc8b5e99002dc": "已转发到 :{port}", "bd1ca8ccb6d0b87c": "智能体", "e25e045607262b40": "终端", + "194a9791a83d3f79": "停止转发 localhost:{port}", + "95bbbac2f2e17273": "将 localhost:{port} 转发到本机", "95b263aa683271cc": "停止 localhost:{port}", "f94866e17faddc05": [ "在浏览器面板中打开。", @@ -4199,6 +4220,16 @@ }, " 以在你的浏览器中打开。" ], + "781fba367a220012": [ + "已转发到本机的 localhost:", + { + "i": 1, + "k": "_gt_value_1", + "v": "v" + }, + "。点击停止。" + ], + "92347683e33e9f02": "转发到本机,供这里的任何应用使用", "3c7763243445b28d": "停止服务器", "991cc9fb37606c91": "(空响应)", "36e4b8d2db087296": "从这条回复分叉", @@ -5938,7 +5969,6 @@ "a74538a7917c1c96": "播放视频", "11a5a4d340e6397d": "打开原始链接", "1b74242b0d303272": "下载视频", - "7a462e32dba47f4c": "在浏览器中打开", "f9ca1e61d515445e": "缺少 data URL 数据。", "1b547c297573369c": "无法解码此内嵌媒体。", "84f7c359e5f050b1": "无法获取该文件(HTTP {status})。", @@ -11883,7 +11913,6 @@ "0bd938825ffcf992": "+{percent}%(按共享池总额度计算)", "09c0e00d7fb55402": "正在使用重置额度…", "4df3ff1be768a7ab": "{name}:剩余 {remaining}%", - "1b16346722b65812": "窗口剩余 {timeLeft}%", "7aaaff1c6484f25c": "分段", "8bcab2ef61de6518": "上限 $0", "a16b48709357a5a7": "管理用量", diff --git a/apps/web/src/state/portForwards.ts b/apps/web/src/state/portForwards.ts new file mode 100644 index 0000000000000..3a0c767791bfb --- /dev/null +++ b/apps/web/src/state/portForwards.ts @@ -0,0 +1,152 @@ +import { useAtomValue } from "@effect/atom-react"; +import type { DesktopPortForward, EnvironmentId } from "@t3tools/contracts"; +import * as Effect from "effect/Effect"; +import * as Option from "effect/Option"; +import * as Queue from "effect/Queue"; +import * as Schema from "effect/Schema"; +import * as Stream from "effect/Stream"; +import * as AsyncResult from "effect/reactivity/AsyncResult"; +import { Atom } from "effect/reactivity"; +import { msg } from "gt-react"; + +import type { ConnectionTarget } from "@t3tools/client-runtime/connection"; + +import { tunnelsEnvironmentLoopback } from "../browser/browserTargetResolver"; +import { m } from "../i18n/messages"; +import { environmentAtomList } from "./environmentAtomList"; +import { environmentSession } from "./session"; + +const EMPTY_FORWARDS: ReadonlyArray = []; + +const previewBridge = () => + typeof window === "undefined" ? undefined : window.desktopBridge?.preview; + +/** Ports of other environments the desktop app forwards to this machine; empty elsewhere. */ +const portForwardsAtom = Atom.make( + Stream.callback>((queue) => + Effect.gen(function* () { + const bridge = previewBridge(); + if (!bridge) return yield* Effect.never; + let changed = false; + yield* Effect.acquireRelease( + Effect.sync(() => + bridge.onPortForwards((forwards) => { + changed = true; + Queue.offerUnsafe(queue, forwards); + }), + ), + (unsubscribe) => Effect.sync(unsubscribe), + ); + const initial = yield* Effect.promise(() => bridge.listPortForwards()); + if (!changed) Queue.offerUnsafe(queue, initial); + return yield* Effect.never; + }), + ), + { initialValue: EMPTY_FORWARDS }, +).pipe(Atom.keepAlive, Atom.withLabel("desktop:port-forwards")); + +export function usePortForwards(): ReadonlyArray { + return AsyncResult.getOrElse(useAtomValue(portForwardsAtom), () => EMPTY_FORWARDS); +} + +/** Only the desktop app forwards, and only from environments it reaches through the tunnel. */ +export const canForwardPorts = (target: ConnectionTarget | undefined): boolean => + previewBridge() !== undefined && tunnelsEnvironmentLoopback(target); + +/** + * Whether the environment runs on another machine. A saved route can still lead back to this + * computer (its own Tailscale address, a relay), where a forward would only loop. + */ +export type ForwardLocality = "remote" | "local" | "pending" | "unknown"; + +class PortForwardLocalityError extends Schema.TaggedError()( + "PortForwardLocalityError", + { environmentId: Schema.String, cause: Schema.Defect() }, +) { + override get message(): string { + return m(msg("Could not tell whether this environment runs on this computer.")); + } +} + +const localityResultAtom = Atom.family((environmentId: EnvironmentId) => + Atom.make((get) => { + // Each established connection probes anew, so a failed probe never outlives a reconnect. + const connection = AsyncResult.getOrElse( + get(environmentSession.transportSessionAtom(environmentId)), + () => Option.none(), + ); + const bridge = previewBridge(); + if (Option.isNone(connection) || bridge === undefined) return Effect.never; + return Effect.tryPromise({ + try: () => bridge.sharesLoopback(environmentId), + catch: (cause) => new PortForwardLocalityError({ environmentId, cause }), + }).pipe(Effect.map((shares): ForwardLocality => (shares ? "local" : "remote"))); + }).pipe( + Atom.setIdleTTL(10 * 60_000), + Atom.withLabel(`desktop:port-forward-locality-probe:${environmentId}`), + ), +); + +const localityAtom = Atom.family((environmentId: EnvironmentId) => + Atom.make((get): ForwardLocality => { + const result = get(localityResultAtom(environmentId)); + if (AsyncResult.isSuccess(result)) return result.value; + return AsyncResult.isFailure(result) ? "unknown" : "pending"; + }).pipe(Atom.withLabel(`desktop:port-forward-locality:${environmentId}`)), +); + +const NO_LOCALITY = Atom.make("unknown").pipe( + Atom.withLabel("desktop:port-forward-locality:none"), +); + +/** Pass `null` for an environment the desktop doesn't tunnel to; that one never probes. */ +export function useForwardLocality(environmentId: EnvironmentId | null): ForwardLocality { + return useAtomValue(environmentId === null ? NO_LOCALITY : localityAtom(environmentId)); +} + +export const forwardLocalitiesAtom = environmentAtomList( + "desktop:port-forward-localities", + localityAtom, +); + +export const findPortForward = ( + forwards: ReadonlyArray, + environmentId: EnvironmentId, + remotePort: number, +) => + forwards.find( + (forward) => forward.environmentId === environmentId && forward.remotePort === remotePort, + ); + +export function forwardPort(environmentId: EnvironmentId, remotePort: number) { + const bridge = previewBridge(); + if (!bridge) return Promise.reject(new Error(m(msg("Port forwarding needs the desktop app.")))); + return bridge.forwardPort(environmentId, remotePort).catch((error: unknown) => { + // Electron flattens main-process errors into "Error invoking remote method '…': Tag: text". + const raw = error instanceof Error ? error.message : String(error); + throw new Error( + raw.includes("LoopbackTunnelSameMachineError") + ? m( + msg("This environment runs on this computer, so localhost:{port} already reaches it.", { + port: remotePort, + }), + ) + : raw.includes("LoopbackTunnelUnavailableError") + ? m(msg("This environment can't be reached right now. Try again once it reconnects.")) + : raw.replace(/^Error invoking remote method '[^']*':\s*(\w+Error:\s*)?/u, ""), + { cause: error }, + ); + }); +} + +export function stopPortForward(environmentId: EnvironmentId, remotePort: number) { + return previewBridge()?.stopPortForward(environmentId, remotePort) ?? Promise.resolve(); +} + +/** `url` with its host and port moved to the forward's end on this machine. */ +export function forwardedUrl(forward: DesktopPortForward, url?: string): string { + const local = new URL(url ?? "http://localhost/"); + local.hostname = "localhost"; + local.port = String(forward.localPort); + return local.toString(); +} diff --git a/docs/user/remote-access.md b/docs/user/remote-access.md index 8a8e87fe0ba57..17c6e36df1576 100644 --- a/docs/user/remote-access.md +++ b/docs/user/remote-access.md @@ -303,6 +303,23 @@ do. These tabs ignore your system proxy settings, so they can't reach a host you connect to only through a proxy or over HTTPS with a privately issued certificate. The web app keeps streaming. +The desktop app can also forward a port on the host to your computer, so any +app there, such as your own browser, `curl`, or a database client, reaches it +at `localhost`. Use the forward button on a server in the thread's **Servers** +list, or **Forwarded ports** in the command palette, where you can also type +any port number and stop forwards. A forward keeps the host's port number +unless that port is taken on your computer, in which case it uses a free one +and shows it. Forwards end when you stop them or quit the app. ⌘-click +(Ctrl-click on Windows and Linux) on a remote server forwards it and opens it +in your browser. + +A forwarded port behaves like a server running on your computer: anything on +your computer can reach it, including web pages open in your browser, so a +forwarded service is exposed the same way a local dev server is. Forwards +listen only on your computer's loopback, never on your network. On Linux they +accept only apps running as your user; on macOS and Windows, other users signed +in to the same computer can reach them too. + On iPhone, iPad, and Android, a tab showing one of the host's `localhost` pages has **Open on this device** in its menu. So does a long press on a `localhost` link in a chat. It opens the page in the phone's own browser view, at the same diff --git a/packages/client-runtime/src/state/session.ts b/packages/client-runtime/src/state/session.ts index 6fdec4bd91580..e6066910d36f4 100644 --- a/packages/client-runtime/src/state/session.ts +++ b/packages/client-runtime/src/state/session.ts @@ -271,6 +271,7 @@ function makeEnvironmentSessionAtoms( preparedConnectionValueAtom, sessionStateAtom, sessionStateValueAtom, + transportSessionAtom, }; } diff --git a/packages/contracts/src/ipc.ts b/packages/contracts/src/ipc.ts index a9dbc8b81de98..77a523c03608f 100644 --- a/packages/contracts/src/ipc.ts +++ b/packages/contracts/src/ipc.ts @@ -2,7 +2,7 @@ import * as Schema from "effect/Schema"; import type { PreviewCaptureFailureEncoded } from "./previewCapture.ts"; import { SnapShotSource } from "./chatAttachment.ts"; -import { EnvironmentId, TrimmedNonEmptyString } from "./baseSchemas.ts"; +import { EnvironmentId, PortSchema, TrimmedNonEmptyString } from "./baseSchemas.ts"; import { BrowserProfileId } from "./browserProfile.ts"; import type { BrowserImportResult, @@ -1002,6 +1002,22 @@ export const DesktopPreviewTunnelAccessResolutionInputSchema = Schema.Struct({ url: Schema.NullOr(Schema.String), }); +/** A loopback port of another environment, reachable on this machine's 127.0.0.1. */ +export const DesktopPortForwardSchema = Schema.Struct({ + environmentId: EnvironmentId, + remotePort: PortSchema, + /** The same as `remotePort` unless that port was taken here. */ + localPort: PortSchema, +}); +export type DesktopPortForward = typeof DesktopPortForwardSchema.Type; + +export const DesktopSharesLoopbackInputSchema = Schema.Struct({ environmentId: EnvironmentId }); + +export const DesktopPortForwardInputSchema = Schema.Struct({ + environmentId: EnvironmentId, + remotePort: PortSchema, +}); + export const DesktopPreviewClearDataInputSchema = Schema.Struct({ environmentId: EnvironmentId, /** Omit to clear every profile; otherwise only this profile's partition. */ @@ -1324,6 +1340,13 @@ export interface DesktopPreviewBridge { listener: (request: DesktopPreviewTunnelAccessRequest) => void, ) => () => void; resolveTunnelAccess: (requestId: string, url: string | null) => Promise; + /** Forwards an environment's loopback port to this machine until stopped or the app quits. */ + forwardPort: (environmentId: EnvironmentId, remotePort: number) => Promise; + stopPortForward: (environmentId: EnvironmentId, remotePort: number) => Promise; + listPortForwards: () => Promise>; + /** Whether the environment runs on this machine, where its ports need no forward. */ + sharesLoopback: (environmentId: EnvironmentId) => Promise; + onPortForwards: (listener: (forwards: ReadonlyArray) => void) => () => void; listBrowserImportSources: () => Promise>; importBrowserCookies: (input: { readonly environmentId: EnvironmentId; From 71e1bb2dcc07cbea4f73ada217b536c193d42405 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Thu, 19 Nov 2026 15:18:32 -0800 Subject: [PATCH 145/201] fix(server): Antigravity sign-in names a runtime crash instead of blaming Google (#28355) --- .../src/provider/AntigravityAuth.test.ts | 20 +++++++++++++++++++ apps/server/src/provider/AntigravityAuth.ts | 11 ++++++++++ 2 files changed, 31 insertions(+) diff --git a/apps/server/src/provider/AntigravityAuth.test.ts b/apps/server/src/provider/AntigravityAuth.test.ts index 936cfcb6bc06f..48cb3f1912da3 100644 --- a/apps/server/src/provider/AntigravityAuth.test.ts +++ b/apps/server/src/provider/AntigravityAuth.test.ts @@ -264,6 +264,26 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("AntigravityAuth" }), ); + it.effect("says Antigravity exited when its process dies during sign-in", () => + Effect.gen(function* () { + const harness = yield* makeHarness({ interactive: false }); + yield* harness.auth.controller.start(owner); + yield* Deferred.await(harness.authenticateCalled); + yield* Deferred.fail( + harness.authenticated, + new AcpErrors.AcpProcessExitedError({ + signal: "SIGILL", + stderr: `runtime crashed ${callbackUrl}`, + }), + ); + const failed = yield* phase(harness.auth, "failed"); + assert.include(failed.message ?? "", "exited"); + assert.include(failed.message ?? "", "SIGILL"); + assert.notInclude(failed.message ?? "", "Google sign-in failed"); + assert.notInclude(failed.message ?? "", "runtime crashed"); + }), + ); + it.effect("tells the user when the agent cannot reach Google", () => Effect.gen(function* () { const harness = yield* makeHarness({ interactive: false }); diff --git a/apps/server/src/provider/AntigravityAuth.ts b/apps/server/src/provider/AntigravityAuth.ts index fcaf41275de12..6e471dad4dc1a 100644 --- a/apps/server/src/provider/AntigravityAuth.ts +++ b/apps/server/src/provider/AntigravityAuth.ts @@ -47,6 +47,7 @@ const UNREACHABLE_MESSAGE = const FORWARDING_FAILED_MESSAGE = "Could not deliver the sign-in response. Start sign-in again."; const isSetupError = Schema.is(ProviderSetupError); const isAcpRequestError = Schema.is(AcpErrors.AcpRequestError); +const isAcpProcessExitedError = Schema.is(AcpErrors.AcpProcessExitedError); interface AuthSnapshot { readonly ownerSessionId: string | null; @@ -120,6 +121,16 @@ function safeAuthFailure(cause: Cause.Cause, usesBrowser: boolean): str if (isSetupError(error.value)) { return error.value.detail; } + if (isAcpProcessExitedError(error.value)) { + const { code, signal } = error.value; + const reason = + signal !== undefined + ? ` after signal ${signal}` + : code !== undefined + ? ` with code ${code}` + : ""; + return `Antigravity exited unexpectedly${reason}. Start sign-in again.`; + } if (isAcpRequestError(error.value)) { if (error.value.errorMessage.includes("SUBSCRIPTION_REQUIRED")) { return "Google requires an eligible Antigravity subscription for this account."; From 0a159c9fba55f2699b6f36d19f7318046063e3f9 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Thu, 19 Nov 2026 15:28:40 -0800 Subject: [PATCH 146/201] fix(server): agent messages queued behind /compact keep send order (#39417) --- .../src/orchestration-v2/Orchestrator.ts | 22 ++++ .../SteeringCompletion.integration.test.ts | 123 ++++++++++++++++++ 2 files changed, 145 insertions(+) diff --git a/apps/server/src/orchestration-v2/Orchestrator.ts b/apps/server/src/orchestration-v2/Orchestrator.ts index 059671b306fa9..73cf6e9782a22 100644 --- a/apps/server/src/orchestration-v2/Orchestrator.ts +++ b/apps/server/src/orchestration-v2/Orchestrator.ts @@ -7439,6 +7439,28 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio ) { dispatchMode = { type: "queue_after_active" }; } + // An agent's automatic send must not overtake an earlier agent message still queued + // (e.g. behind /compact), or the agent receives them out of send order. + if ( + command.deliveryIntent === "auto" && + command.createdBy === "agent" && + (dispatchMode.type === "steer_active" || dispatchMode.type === "restart_active") + ) { + const queuedRuns = projection.runs.filter( + (run) => run.status === "queued" && run.queueHeld !== true, + ); + if (queuedRuns.length > 0) { + const queuedMessages = yield* projectionStore + .getMessagesById( + command.threadId, + queuedRuns.map((run) => run.userMessageId), + ) + .pipe(mapDispatchError(command)); + if ([...queuedMessages.values()].some((message) => message.createdBy === "agent")) { + dispatchMode = { type: "queue_after_active" }; + } + } + } // An explicit restart that Stop reached has only its start left, so it // queues behind the stopping run like any other start. if ( diff --git a/apps/server/src/orchestration-v2/SteeringCompletion.integration.test.ts b/apps/server/src/orchestration-v2/SteeringCompletion.integration.test.ts index ebe5e7215bcbd..cc14fde257da8 100644 --- a/apps/server/src/orchestration-v2/SteeringCompletion.integration.test.ts +++ b/apps/server/src/orchestration-v2/SteeringCompletion.integration.test.ts @@ -1717,6 +1717,129 @@ it.effect("queues a steer until the turn ends when the provider cannot steer it" }), ); +// regression: #39404 a later agent message steers ahead of one queued behind /compact +it.effect("delivers agent messages queued behind /compact before a later one steers", () => + Effect.gen(function* () { + const { events, started, steered, layer, startFirstTurn } = yield* nextTurnSelectionHarness( + "agent-order-after-compact", + ); + yield* Effect.gen(function* () { + const orchestrator = yield* Orchestrator.OrchestratorV2; + const worker = yield* EffectWorker.OrchestrationEffectWorkerV2; + const threadId = yield* startFirstTurn; + const nextRunning = Effect.fn("nextRunning")(function* () { + return yield* orchestrator.streamDomainEvents.pipe( + Stream.filter( + (event) => event.type === "provider-turn.updated" && event.payload.status === "running", + ), + Stream.take(1), + Stream.runDrain, + Effect.forkScoped, + ); + }); + const lock = (yield* ThreadCommandExecutor.ThreadCommandExecutor).withLock( + threadId, + Effect.void, + ); + const finishTurn = Effect.fn("finishTurn")(function* (index: number) { + const turnInput = started[index]!; + const turn = (yield* orchestrator.getThreadProjection(threadId)).providerTurns.find( + (candidate) => candidate.runAttemptId === turnInput.attemptId, + )!; + const settled = yield* orchestrator.streamDomainEvents.pipe( + Stream.filter( + (event) => + event.type === "run.updated" && + event.payload.id === turnInput.runId && + (event.payload.status === "waiting" || event.payload.status === "completed"), + ), + Stream.take(1), + Stream.runDrain, + Effect.forkScoped, + ); + yield* Queue.offer(events, { + type: "provider_turn.updated", + driver, + providerTurn: { ...turn, status: "completed", completedAt: yield* DateTime.now }, + }); + yield* Queue.offer(events, { + type: "turn.terminal", + driver, + providerThreadId: turn.providerThreadId, + providerTurnId: turn.id, + runOrdinal: turnInput.runOrdinal, + status: "completed", + failure: null, + threadDisposition: "reusable", + }); + yield* Fiber.join(settled); + yield* worker.drain(); + yield* orchestrator.resumeQueuedRuns; + yield* worker.drain(); + }); + yield* finishTurn(0); + const compactRunning = yield* nextRunning(); + yield* orchestrator.dispatch({ + type: "message.dispatch", + commandId: CommandId.make("compact"), + threadId, + messageId: MessageId.make("message:compact"), + text: "/compact", + attachments: [], + dispatchMode: { type: "start_immediately" }, + createdBy: "user", + creationSource: "web", + }); + yield* worker.drain(); + yield* Fiber.join(compactRunning); + yield* lock; + const sendFromAgent = (codeword: string) => + Effect.gen(function* () { + const active = (yield* orchestrator.getThreadProjection(threadId)).runs.find( + (run) => run.status === "running", + )!; + yield* orchestrator.dispatch({ + type: "message.dispatch", + commandId: CommandId.make(`send-${codeword}`), + threadId, + messageId: MessageId.make(`message:${codeword}`), + text: codeword, + attachments: [], + dispatchMode: { type: "steer_active", targetRunId: active.id }, + deliveryIntent: "auto", + createdBy: "agent", + creationSource: "mcp", + senderThreadId: ThreadId.make("thread:orchestrator"), + }); + yield* worker.drain(); + }); + yield* sendFromAgent("ALPHA"); + yield* sendFromAgent("BRAVO"); + const queued = (yield* orchestrator.getThreadProjection(threadId)).runs.filter( + (run) => run.status === "queued", + ); + assert.lengthOf(queued, 2); + assert.deepEqual(steered, []); + + const alphaRunning = yield* nextRunning(); + yield* finishTurn(1); + yield* Fiber.join(alphaRunning); + yield* lock; + assert.deepEqual( + started.map((turn) => turn.message.text.split("\n").at(-1)), + ["first", "/compact", "ALPHA"], + ); + + yield* sendFromAgent("CHARLIE"); + const delivered = [...steered, ...started.slice(3).map((turn) => turn.message.text)] + .map((text) => text.split("\n").at(-1)) + .filter((text) => text === "BRAVO" || text === "CHARLIE"); + // Whatever reaches the agent so far does so in send order: CHARLIE never before BRAVO. + assert.deepEqual(delivered, ["BRAVO", "CHARLIE"].slice(0, delivered.length)); + }).pipe(Effect.provide(layer)); + }), +); + // regression: #33454 a steer that restarts a completion wake run left its cohort claimed forever const restartCompletionWake = Effect.fn("restartCompletionWake")(function* ( harness: Pick< From 5283f33ca9d3515058a5686ea9a4e40a57ef23da Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Thu, 19 Nov 2026 15:30:09 -0800 Subject: [PATCH 147/201] fix(server): Antigravity limits read the 1.5.x CLI's stored sign-in (#38957) --- .../provider/antigravityUsageLimits.test.ts | 108 ++++++++- .../src/provider/antigravityUsageLimits.ts | 219 ++++++++++++++---- 2 files changed, 286 insertions(+), 41 deletions(-) diff --git a/apps/server/src/provider/antigravityUsageLimits.test.ts b/apps/server/src/provider/antigravityUsageLimits.test.ts index 9defd9df90dce..6582fc2458577 100644 --- a/apps/server/src/provider/antigravityUsageLimits.test.ts +++ b/apps/server/src/provider/antigravityUsageLimits.test.ts @@ -1,5 +1,6 @@ import * as NodeCrypto from "@effect/platform-node/NodeCrypto"; import * as NodeServices from "@effect/platform-node/NodeServices"; +import * as HostProcess from "@t3tools/shared/HostProcess"; import * as Layer from "effect/Layer"; import { describe, expect, it } from "@effect/vitest"; import * as Context from "effect/Context"; @@ -10,7 +11,11 @@ import * as Path from "effect/Path"; import * as TestClock from "effect/testing/TestClock"; import { FetchHttpClient, HttpClient, HttpClientResponse } from "effect/http"; -import { makeAntigravityUsageProbe } from "./antigravityUsageLimits.ts"; +import { + decodeGoKeyringSecret, + makeAntigravityUsageProbe, + readWindowsCliCredential, +} from "./antigravityUsageLimits.ts"; const summary = { groups: [ @@ -66,6 +71,9 @@ const fixture = Effect.fn("AntigravityUsageTest.fixture")(function* ( userInfoAt?: number; missingToken?: boolean; authMethod?: "oauth-personal" | "oauth-business" | "gemini-api-key"; + keyringSecret?: string; + /** Reads the OS keyring instead of `keyringSecret`. */ + nativeKeyring?: boolean; } = {}, ) { const fs = yield* FileSystem.FileSystem; @@ -111,7 +119,7 @@ const fixture = Effect.fn("AntigravityUsageTest.fixture")(function* ( : Response.json({}, { status: 403 }), ); } - expect(JSON.parse(body)).toEqual({ project: "project-id" }); + expect(JSON.parse(body)).toEqual(options.missingToken ? {} : { project: "project-id" }); expect(request.headers["user-agent"]).toMatch(/^antigravity\/hub\/2\.24\.0 /); return HttpClientResponse.fromWeb( request, @@ -132,6 +140,7 @@ const fixture = Effect.fn("AntigravityUsageTest.fixture")(function* ( const usage = yield* makeAntigravityUsageProbe({ profileDirectory, authMethod: options.authMethod ?? "oauth-personal", + ...(options.nativeKeyring ? {} : { readKeyringSecret: Effect.succeed(options.keyringSecret) }), }).pipe(Effect.provideService(HttpClient.HttpClient, http)); return { ...usage, requests, writeToken, tokenPath }; }); @@ -654,6 +663,101 @@ describe("Antigravity subscription limits", () => { }).pipe(Effect.scoped, Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))), ); + it.effect("reads the native CLI's stored sign-in when acp_token.json is absent", () => + Effect.gen(function* () { + const fs = yield* FileSystem.FileSystem; + const path = yield* Path.Path; + const { probe, tokenPath } = yield* fixture({ missingToken: true }); + // The 1.5.x CLI never writes acp_token.json; without a keyring it stores this file instead. + yield* fs.writeFileString( + path.join(path.dirname(tokenPath), "antigravity-oauth-token"), + JSON.stringify({ + token: { + access_token: "access-token", + token_type: "Bearer", + refresh_token: "refresh-a", + expiry: "2099-01-01T00:00:00Z", + expires_in: 3600, + }, + auth_method: "consumer", + id_token_email: "someone@example.com", + }), + ); + const limits = yield* probe; + expect(limits.unavailable?.message).not.toBe( + "Sign in with Google to see Antigravity limits.", + ); + expect(limits.unavailable?.reason).not.toBe("unsupported"); + }).pipe(Effect.scoped, Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))), + ); + + it.effect("reads the native CLI's keyring sign-in and reports when it has expired", () => + Effect.gen(function* () { + yield* TestClock.setTime(DateTime.toEpochMillis(DateTime.makeUnsafe("2026-10-09T12:00:00Z"))); + const keyringSecret = (expiry: string) => + JSON.stringify({ token: { access_token: "access-token", refresh_token: "r", expiry } }); + const signedIn = yield* fixture({ + missingToken: true, + userId: "google-user-1", + keyringSecret: keyringSecret("2026-10-09T14:00:00.123456789+01:00"), + }); + const limits = yield* signedIn.probe; + expect(limits.unavailable).toBeUndefined(); + expect(limits.windows).toHaveLength(4); + expect(signedIn.requests.some((request) => request.url.endsWith("/token"))).toBe(false); + + const expired = yield* fixture({ + missingToken: true, + keyringSecret: keyringSecret("2026-10-09T12:00:30Z"), + }); + expect((yield* expired.probe).unavailable?.reason).toBe("probeFailed"); + expect(expired.requests).toEqual([]); + }).pipe(Effect.scoped, Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))), + ); + + it.effect.runIf(HostProcess.Platform.defaultValue() === "win32")( + "reads go-keyring's Windows credential target without changing it", + (ctx) => + Effect.gen(function* () { + // Never overwrite a real sign-in on a developer's machine. + if (readWindowsCliCredential(HostProcess.Architecture.defaultValue())) return ctx.skip(); + yield* TestClock.setTime( + DateTime.toEpochMillis(DateTime.makeUnsafe("2026-10-09T12:00:00Z")), + ); + const { AsyncEntry } = yield* Effect.promise(() => import("@napi-rs/keyring")); + // go-keyring writes the UTF-8 JSON at `:`. + const target = AsyncEntry.withTarget("gemini:antigravity", "gemini", "antigravity"); + const stored = new TextEncoder().encode( + JSON.stringify({ + token: { access_token: "access-token", expiry: "2026-10-09T14:00:00Z" }, + }), + ); + yield* Effect.acquireRelease( + Effect.promise(() => target.setSecret(stored)), + () => Effect.promise(() => target.deleteCredential()), + ); + const { probe } = yield* fixture({ missingToken: true, nativeKeyring: true }); + const limits = yield* probe; + expect(limits.unavailable).toBeUndefined(); + expect(limits.windows).toHaveLength(4); + expect(readWindowsCliCredential(HostProcess.Architecture.defaultValue())).toEqual( + Buffer.from(stored), + ); + }).pipe(Effect.scoped, Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))), + ); + + it("decodes go-keyring's macOS encodings", () => { + const value = '{"token":{}}'; + const bytes = (text: string) => new TextEncoder().encode(text); + expect(decodeGoKeyringSecret(bytes(value))).toBe(value); + expect( + decodeGoKeyringSecret(bytes(`go-keyring-base64:${Buffer.from(value).toString("base64")}`)), + ).toBe(value); + expect( + decodeGoKeyringSecret(bytes(`go-keyring-encoded:${Buffer.from(value).toString("hex")}`)), + ).toBe(value); + }); + it.effect("does not make network requests for API keys or missing sign-ins", () => Effect.gen(function* () { for (const options of [{ authMethod: "gemini-api-key" as const }, { missingToken: true }]) { diff --git a/apps/server/src/provider/antigravityUsageLimits.ts b/apps/server/src/provider/antigravityUsageLimits.ts index ede0e5c47d20e..77ac75c7a2f52 100644 --- a/apps/server/src/provider/antigravityUsageLimits.ts +++ b/apps/server/src/provider/antigravityUsageLimits.ts @@ -1,3 +1,5 @@ +import * as NodeModule from "node:module"; + import type { AntigravitySettings, ServerProviderUsageWindow } from "@t3tools/contracts"; import * as HostProcess from "@t3tools/shared/HostProcess"; import * as Clock from "effect/Clock"; @@ -38,6 +40,15 @@ const TokenFile = Schema.Struct({ refresh_token: Schema.NonEmptyString, project_id: Schema.optional(Schema.String), }); +// The 1.5.x CLI never writes acp_token.json: it keeps its sign-in in the OS keyring, or in +// antigravity-oauth-token without one. It stores no OAuth client, so T3 cannot refresh it. +const CliToken = Schema.Struct({ + token: Schema.Struct({ + access_token: Schema.NonEmptyString, + refresh_token: Schema.optional(Schema.String), + expiry: Schema.optional(Schema.String), + }), +}); const TokenResponse = Schema.Struct({ access_token: Schema.NonEmptyString, expires_in: Schema.Number.check(Schema.isGreaterThan(0)), @@ -78,6 +89,7 @@ const Models = Schema.Struct({ }); const decodeTokenFile = Schema.decodeEffect(Schema.fromJsonString(TokenFile)); +const decodeCliToken = Schema.decodeEffect(Schema.fromJsonString(CliToken)); const decodeTokenResponse = Schema.decodeUnknownEffect(TokenResponse); const decodeUserInfo = Schema.decodeUnknownEffect(UserInfo); const decodeSummary = Schema.decodeUnknownEffect(Summary); @@ -132,6 +144,104 @@ const sha256 = Effect.fnUntraced(function* (text: string) { return Array.from(digest, (byte) => byte.toString(16).padStart(2, "0")).join(""); }); +/** go-keyring stores UTF-8, which it prefixes and encodes on macOS. */ +export function decodeGoKeyringSecret(secret: ArrayLike): string { + // The binding resolves a plain number array at runtime despite its Uint8Array type. + const text = new TextDecoder().decode(Uint8Array.from(secret)); + if (text.startsWith("go-keyring-base64:")) { + return Buffer.from(text.slice("go-keyring-base64:".length), "base64").toString("utf8"); + } + if (text.startsWith("go-keyring-encoded:")) { + return Buffer.from(text.slice("go-keyring-encoded:".length), "hex").toString("utf8"); + } + return text; +} + +class AntigravityKeyringError extends Schema.TaggedError()( + "AntigravityKeyringError", + { cause: Schema.Defect() }, +) { + override get message(): string { + return "Could not read the Antigravity sign-in from the system keyring."; + } +} + +// A single-executable server resolves packages on disk only through `require`. +const requireExternal = NodeModule.createRequire(import.meta.url); + +/** + * go-keyring's Windows target is `gemini:antigravity`; @napi-rs/keyring reads `antigravity.gemini`, + * and its `withTarget` overwrites the target with an empty secret before reading. + */ +export function readWindowsCliCredential( + architecture: NodeJS.Architecture, +): Uint8Array | undefined { + // CREDENTIALW offsets and the pointers below are 64-bit. + if (architecture !== "x64" && architecture !== "arm64") { + throw new Error(`no credential access on ${architecture}`); + } + const { DataType, load, open } = requireExternal("ffi-rs") as typeof import("ffi-rs"); + open({ library: "t3-advapi32", path: "advapi32.dll" }); + open({ library: "t3-kernel32", path: "kernel32.dll" }); + const copy = (into: Buffer, from: bigint) => + load({ + library: "t3-kernel32", + funcName: "RtlMoveMemory", + retType: DataType.Void, + paramsType: [DataType.U8Array, DataType.BigInt, DataType.BigInt], + paramsValue: [into, from, BigInt(into.length)], + }); + const out = Buffer.alloc(8); + const read = load({ + library: "t3-advapi32", + funcName: "CredReadW", + retType: DataType.I32, + // CRED_TYPE_GENERIC + paramsType: [DataType.WString, DataType.U32, DataType.U32, DataType.U8Array], + paramsValue: ["gemini:antigravity", 1, 0, out], + errno: true as const, + }); + if (read.value === 0) { + // ERROR_NOT_FOUND + if (read.errnoCode === 1168) return undefined; + throw new Error(`CredReadW failed with Windows error ${read.errnoCode}`); + } + const credential = out.readBigUInt64LE(); + try { + // CredentialBlobSize is a DWORD at 32 and CredentialBlob a pointer at 40. + const header = Buffer.alloc(48); + copy(header, credential); + const size = header.readUInt32LE(32); + if (size === 0) return undefined; + const blob = Buffer.alloc(size); + copy(blob, header.readBigUInt64LE(40)); + return blob; + } finally { + load({ + library: "t3-advapi32", + funcName: "CredFree", + retType: DataType.Void, + paramsType: [DataType.BigInt], + paramsValue: [credential], + }); + } +} + +// Loaded lazily: a native binding that fails to load must not take the provider down. +const readCliKeyringSecret = (platform: NodeJS.Platform, architecture: NodeJS.Architecture) => + Effect.tryPromise({ + try: async () => { + const secret = + platform === "win32" + ? readWindowsCliCredential(architecture) + : await new ( + requireExternal("@napi-rs/keyring") as typeof import("@napi-rs/keyring") + ).AsyncEntry("gemini", "antigravity").getSecret(); + return secret ? decodeGoKeyringSecret(secret) : undefined; + }, + catch: (cause) => new AntigravityKeyringError({ cause }), + }); + /** Keys an account by its Google ID, which matches across machines and hubs; refresh tokens do not. */ export const antigravityAccountFingerprint = (userInfo: unknown) => decodeUserInfo(userInfo).pipe(Effect.flatMap((info) => sha256(`google-account\0${info.id}`))); @@ -210,6 +320,7 @@ function modelWindows(models: typeof Models.Type) { export const makeAntigravityUsageProbe = Effect.fn("makeAntigravityUsageProbe")(function* (input: { readonly profileDirectory: string; readonly authMethod: AntigravitySettings["authMethod"]; + readonly readKeyringSecret?: Effect.Effect; }) { const fs = yield* FileSystem.FileSystem; const path = yield* Path.Path; @@ -218,6 +329,12 @@ export const makeAntigravityUsageProbe = Effect.fn("makeAntigravityUsageProbe")( const platform = yield* HostProcess.Platform; const architecture = yield* HostProcess.Architecture; const tokenPath = path.join(input.profileDirectory, "antigravity-acp", "acp_token.json"); + const cliTokenPath = path.join( + input.profileDirectory, + "antigravity-acp", + "antigravity-oauth-token", + ); + const readKeyringSecret = input.readKeyringSecret ?? readCliKeyringSecret(platform, architecture); let cached: | { fingerprint: string; account: string; accessToken: string; expiresAt: number } | undefined; @@ -236,54 +353,80 @@ export const makeAntigravityUsageProbe = Effect.fn("makeAntigravityUsageProbe")( if (input.authMethod !== "oauth-personal" && input.authMethod !== "oauth-business") { return makeUnavailableUsageLimits({ checkedAt, reason: "unsupported" }); } - if (!(yield* fs.exists(tokenPath))) { - cached = undefined; - return makeUnavailableUsageLimits({ - checkedAt, - reason: "unsupported", - message: "Sign in with Google to see Antigravity limits.", - }); - } - const token = yield* fs.readFileString(tokenPath).pipe(Effect.flatMap(decodeTokenFile)); - const fingerprint = yield* sha256( - `${token.client_id}\0${token.refresh_token}\0${token.project_id ?? ""}`, - ); const now = yield* Clock.currentTimeMillis; let accessToken: string; let account: string; - if (cached?.fingerprint !== fingerprint || cached.expiresAt <= now + 60_000) { + let projectId: string | undefined; + if (!(yield* fs.exists(tokenPath))) { cached = undefined; - const refreshed = yield* request( - HttpClientRequest.post("https://oauth2.googleapis.com/token").pipe( - HttpClientRequest.bodyUrlParams({ - client_id: token.client_id, - client_secret: token.client_secret, - refresh_token: token.refresh_token, - grant_type: "refresh_token", - }), - ), - ).pipe(Effect.flatMap(decodeTokenResponse)); - accessToken = refreshed.access_token; - // Use Google account IDs to merge accounts across environments; refresh tokens differ per machine. + const stored = (yield* fs.exists(cliTokenPath)) + ? yield* fs.readFileString(cliTokenPath) + : yield* readKeyringSecret; + if (stored === undefined) { + return makeUnavailableUsageLimits({ + checkedAt, + reason: "unsupported", + message: "Sign in with Google to see Antigravity limits.", + }); + } + const { token } = yield* decodeCliToken(stored); + if (!(Date.parse(token.expiry ?? "") > now + 60_000)) { + return makeUnavailableUsageLimits({ + checkedAt, + reason: "probeFailed", + message: + "Antigravity's saved sign-in has expired. Start an Antigravity turn to renew it, then refresh limits.", + }); + } + accessToken = token.access_token; account = yield* request( HttpClientRequest.get("https://www.googleapis.com/oauth2/v2/userinfo").pipe( HttpClientRequest.setHeaders({ Authorization: `Bearer ${accessToken}` }), ), ).pipe( Effect.flatMap(antigravityAccountFingerprint), - Effect.orElseSucceed(() => fingerprint), + Effect.catch(() => sha256(`antigravity-cli\0${token.refresh_token || accessToken}`)), ); - if (generation === startedGeneration) { - cached = { - fingerprint, - account, - accessToken, - expiresAt: now + refreshed.expires_in * 1000, - }; - } } else { - accessToken = cached.accessToken; - account = cached.account; + const token = yield* fs.readFileString(tokenPath).pipe(Effect.flatMap(decodeTokenFile)); + projectId = token.project_id; + const fingerprint = yield* sha256( + `${token.client_id}\0${token.refresh_token}\0${token.project_id ?? ""}`, + ); + if (cached?.fingerprint !== fingerprint || cached.expiresAt <= now + 60_000) { + cached = undefined; + const refreshed = yield* request( + HttpClientRequest.post("https://oauth2.googleapis.com/token").pipe( + HttpClientRequest.bodyUrlParams({ + client_id: token.client_id, + client_secret: token.client_secret, + refresh_token: token.refresh_token, + grant_type: "refresh_token", + }), + ), + ).pipe(Effect.flatMap(decodeTokenResponse)); + accessToken = refreshed.access_token; + // Use Google account IDs to merge accounts across environments; refresh tokens differ per machine. + account = yield* request( + HttpClientRequest.get("https://www.googleapis.com/oauth2/v2/userinfo").pipe( + HttpClientRequest.setHeaders({ Authorization: `Bearer ${accessToken}` }), + ), + ).pipe( + Effect.flatMap(antigravityAccountFingerprint), + Effect.orElseSucceed(() => fingerprint), + ); + if (generation === startedGeneration) { + cached = { + fingerprint, + account, + accessToken, + expiresAt: now + refreshed.expires_in * 1000, + }; + } + } else { + accessToken = cached.accessToken; + account = cached.account; + } } const endpoints = ENDPOINTS[input.authMethod]; // Merge endpoints because quota groups differ; the metered host's reading of a bucket wins. @@ -306,9 +449,7 @@ export const makeAntigravityUsageProbe = Effect.fn("makeAntigravityUsageProbe")( Authorization: `Bearer ${accessToken}`, "User-Agent": antigravityUserAgent(platform, architecture), }), - HttpClientRequest.bodyJsonUnsafe( - token.project_id ? { project: token.project_id } : {}, - ), + HttpClientRequest.bodyJsonUnsafe(projectId ? { project: projectId } : {}), ), ).pipe( Effect.flatMap((response) => parse(response, requestedAt)), From 06eda8e36eb41d799bc4aec163148b596e4e4bbb Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Thu, 19 Nov 2026 15:35:47 -0800 Subject: [PATCH 148/201] fix(server): Codex stdio MCP servers receive T3CODE_THREAD_ID (#39414) --- .../Adapters/CodexAdapterV2.test.ts | 120 ++++++++++++++---- .../Adapters/CodexAdapterV2.ts | 64 +++++++++- .../codex_transcript.ndjson | 26 ++-- .../codex_transcript.ndjson | 18 +-- .../codex_transcript.ndjson | 56 ++++---- .../message_steering/codex_transcript.ndjson | 22 ++-- .../multi_turn/codex_transcript.ndjson | 26 ++-- .../plan_questions/codex_transcript.ndjson | 18 +-- .../proposed_plan/codex_transcript.ndjson | 18 +-- .../codex_transcript.ndjson | 36 +++--- .../queued_turn/codex_transcript.ndjson | 26 ++-- .../fixtures/simple/codex_transcript.ndjson | 18 +-- .../fixtures/subagent/codex_transcript.ndjson | 18 +-- .../subagent_continue/codex_transcript.ndjson | 26 ++-- .../subagent_v2/codex_transcript.ndjson | 18 +-- .../codex_transcript.ndjson | 18 +-- .../codex_transcript.ndjson | 18 +-- .../codex_transcript.ndjson | 18 +-- .../codex_transcript.ndjson | 44 ++++--- .../codex_transcript.ndjson | 78 ++++++------ .../thread_rollback/codex_transcript.ndjson | 46 +++---- .../codex_transcript.ndjson | 58 +++++---- .../codex_transcript.ndjson | 62 ++++----- .../todo_list/codex_transcript.ndjson | 18 +-- .../codex_transcript.ndjson | 18 +-- .../codex_transcript.ndjson | 18 +-- .../codex_transcript.ndjson | 18 +-- .../turn_interrupt/codex_transcript.ndjson | 22 ++-- .../codex_transcript.ndjson | 26 ++-- .../web_search/codex_transcript.ndjson | 18 +-- .../effect-codex-app-server/src/replay.ts | 11 +- 31 files changed, 602 insertions(+), 399 deletions(-) diff --git a/apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.test.ts b/apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.test.ts index cf5439e3eb254..67189ae9d7dee 100644 --- a/apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.test.ts +++ b/apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.test.ts @@ -805,7 +805,9 @@ function codexReplayPreamble(input: { /** * Every turn/start follows a config/read, and a thread's first turn on a connection names it - * unless the transcript names it itself. Inserts those exchanges and shifts later client ids. + * unless the transcript names it itself. A thread start, resume or fork follows a config/read + * unless it retries a failed request or the transcript reads config itself. Inserts those + * exchanges and shifts later client ids. */ function withConfigReadBeforeTurnStart( entries: ReadonlyArray, @@ -815,6 +817,9 @@ function withConfigReadBeforeTurnStart( let offset = 0; let clientIds = new Map(); let namedThreads = new Set(); + let transcriptReads = 0; + let previousOutbound: { readonly method: string; readonly id: number } | undefined; + let failedMethod: string | undefined; for (const entry of entries) { const frame = entry.type === "runtime_exit" ? undefined : entry.frame; if (!Predicate.isObject(frame) || typeof frame.id !== "number") { @@ -829,8 +834,25 @@ function withConfigReadBeforeTurnStart( namedThreads = new Set(); } if (frame.method === "thread/name/set") namedThreads.add(params.threadId); + const exchanges: Array = []; + const isThreadRequest = + frame.method === "thread/start" || + frame.method === "thread/resume" || + frame.method === "thread/fork"; + if (frame.method === "config/read") transcriptReads += 1; + else if (isThreadRequest && transcriptReads > 0) transcriptReads -= 1; + else if ( + isThreadRequest && + failedMethod !== frame.method && + previousOutbound?.method !== "thread/unarchive" + ) { + exchanges.push([ + "config/read", + { ...(params.cwd === undefined ? {} : { cwd: params.cwd }), includeLayers: false }, + { config: {}, origins: {} }, + ]); + } if (frame.method === "turn/start") { - const exchanges: Array = []; if (!namedThreads.has(params.threadId)) { namedThreads.add(params.threadId); exchanges.push(["thread/name/set", { threadId: params.threadId, name: threadName }, {}]); @@ -840,23 +862,28 @@ function withConfigReadBeforeTurnStart( { cwd: params.cwd, includeLayers: false }, { config: {}, origins: {} }, ]); - for (const [method, requestParams, response] of exchanges) { - const id = frame.id + offset; - result.push( - { - type: "expect_outbound", - label: method, - frame: { id, method, params: requestParams }, - }, - { type: "emit_inbound", label: method, frame: { id, result: response } }, - ); - offset += 1; - } } + for (const [method, requestParams, response] of exchanges) { + const id = frame.id + offset; + result.push( + { + type: "expect_outbound", + label: method, + frame: { id, method, params: requestParams }, + }, + { type: "emit_inbound", label: method, frame: { id, result: response } }, + ); + offset += 1; + } + previousOutbound = { method: frame.method, id: frame.id }; + failedMethod = undefined; clientIds.set(frame.id, frame.id + offset); result.push(withReplayRequestId(entry, frame.id + offset)); continue; } + if (entry.type === "emit_inbound" && frame.id === previousOutbound?.id && "error" in frame) { + failedMethod = previousOutbound.method; + } const mapped = clientIds.get(frame.id); result.push( entry.type === "emit_inbound" && frame.method === undefined && mapped !== undefined @@ -947,8 +974,8 @@ describe("CodexAdapterV2 process exit", () => { Predicate.isObject(entry.frame) && "id" in entry.frame, ); - if (response?.type === "emit_inbound") { - yield* emit(response.frame); + if (response?.type === "emit_inbound" && Predicate.isObject(response.frame)) { + yield* emit({ ...response.frame, id: frame.id }); } }), ).pipe(Sink.ensuring(Deferred.succeed(outputEnded, undefined))), @@ -1193,10 +1220,25 @@ describe("CodexAdapterV2 session initialize", () => { makeCodexReplayTranscript({ scenario: "concurrent-initialize", entries: [ - ...replayPreamble("concurrent-first").slice(0, 5), + ...replayPreamble("concurrent-first").slice(0, 3), + ...[2, 3].flatMap((id): Array => [ + { + type: "expect_outbound", + label: "config/read", + frame: { id, method: "config/read", params: { includeLayers: false } }, + }, + { + type: "emit_inbound", + label: "config/read", + frame: { id, result: { config: {}, origins: {} } }, + }, + ]), + ...replayPreamble("concurrent-first") + .slice(3, 5) + .map((entry) => withReplayRequestId(entry, 4)), ...replayPreamble("concurrent-second") .slice(3, 5) - .map((entry) => withReplayRequestId(entry, 3)), + .map((entry) => withReplayRequestId(entry, 5)), ], }), (entry) => @@ -2384,7 +2426,7 @@ describe("CodexAdapterV2 post-settle continuation", () => { ), ); - it.effect("adds the session MCP server without replacing launch-argument servers", () => + it.effect("adds the session MCP server and gives stdio servers the thread id", () => Effect.gen(function* () { const scenario = "launch-mcp-servers"; yield* (yield* McpProviderSessions.McpProviderSessions).set({ @@ -2397,14 +2439,40 @@ describe("CodexAdapterV2 post-settle continuation", () => { browserToolsAvailable: true, }); const requests: Array = []; + const preamble = codexReplayPreamble({ + nativeThreadId: "launch-mcp-thread", + nativeTurnId: "unused", + prompt: "unused", + }); yield* makeCodexReplayHarness( makeCodexReplayTranscript({ scenario, - entries: codexReplayPreamble({ - nativeThreadId: "launch-mcp-thread", - nativeTurnId: "unused", - prompt: "unused", - }).slice(0, 5), + entries: [ + ...preamble.slice(0, 3), + { + type: "expect_outbound", + label: "config/read", + frame: { id: 2, method: "config/read", params: { includeLayers: false } }, + }, + { + type: "emit_inbound", + label: "config/read", + frame: { + id: 2, + result: { + config: { + mcp_servers: { + envprobe: { command: "python3", env: { FOO: "bar" } }, + remote: { url: "https://example.com/mcp" }, + "dotted.name": { command: "node" }, + }, + }, + origins: {}, + }, + }, + }, + ...preamble.slice(3, 5).map((entry) => withReplayRequestId(entry, 3)), + ], }), () => Effect.void, (method, params) => @@ -2421,6 +2489,7 @@ describe("CodexAdapterV2 post-settle continuation", () => { mcp_optional_startup_grace_ms: 10_000, "features.concurrent_reasoning_summaries": true, "shell_environment_policy.set.T3CODE_THREAD_ID": `thread-${scenario}`, + "mcp_servers.envprobe.env.T3CODE_THREAD_ID": `thread-${scenario}`, "mcp_servers.t3-code": { url: "http://127.0.0.1:43123/mcp", tool_timeout_sec: 3_900, @@ -4455,7 +4524,8 @@ describe("CodexAdapterV2 post-settle continuation", () => { "cause.method", failAt === 4 ? "thread/unarchive" : "thread/resume", ); - assert.nestedPropertyVal(error, "cause.requestId", String(failAt)); + // The thread start and the resume each read config first. + assert.nestedPropertyVal(error, "cause.requestId", String(failAt + 2)); return; } const resumed = yield* resume; diff --git a/apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts b/apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts index 4474dd04273a0..c36c1772ae197 100644 --- a/apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts +++ b/apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts @@ -1507,9 +1507,25 @@ const CODEX_T3_MCP_TOOL_TIMEOUT_SEC = 65 * 60; const CODEX_T3_DIRECT_MCP_SERVER = "t3-code-direct"; const CODEX_DIRECT_ONLY_T3_TOOLS = ["t3_thread_wait", "delegate_task"]; +/** Names of the stdio MCP servers in a `config/read` config, the ones Codex starts per thread. */ +function codexStdioMcpServerNames(mcpServers: unknown): ReadonlyArray { + if (mcpServers === null || typeof mcpServers !== "object") return []; + return Object.entries(mcpServers) + .filter( + ([name, server]) => + // Codex splits config override keys on every dot. + !name.includes(".") && + server !== null && + typeof server === "object" && + typeof Reflect.get(server, "command") === "string", + ) + .map(([name]) => name); +} + function codexThreadRuntimeParams(input: { readonly threadId: ThreadId | null; readonly mcpSession: McpProviderSession.McpProviderSessionConfig | undefined; + readonly stdioMcpServers?: ReadonlyArray; readonly modelSelection?: { readonly model: string }; readonly runtimePolicy?: ProviderAdapter.ProviderAdapterV2RuntimePolicy; }): { @@ -1534,7 +1550,16 @@ function codexThreadRuntimeParams(input: { // One app-server serves many threads, so the id goes in per-thread shell config, not its env. ...(input.threadId === null ? {} - : { [`shell_environment_policy.set.${PortScanner.AGENT_THREAD_ENV}`]: input.threadId }), + : { + [`shell_environment_policy.set.${PortScanner.AGENT_THREAD_ENV}`]: input.threadId, + // Codex starts the user's stdio MCP servers per thread, outside the shell policy. + ...Object.fromEntries( + (input.stdioMcpServers ?? []).map((name) => [ + `mcp_servers.${name}.env.${PortScanner.AGENT_THREAD_ENV}`, + input.threadId, + ]), + ), + }), ...(t3Server === undefined ? {} : { @@ -2064,6 +2089,22 @@ export const makeCodexAdapterV2 = Effect.fn("makeCodexAdapterV2")(function* ( ); // A failed open is discarded, so the next turn spawns the updated binary. if (adapterOptions.compatibility !== undefined) yield* ensureInitialized; + // Read per thread: a workspace's project config can add its own servers. + const readStdioMcpServers = (cwd: string | null | undefined) => + ensureInitialized.pipe( + Effect.andThen( + client.request("config/read", { + ...(cwd == null ? {} : { cwd }), + includeLayers: false, + }), + ), + Effect.map((response) => codexStdioMcpServerNames(response.config.mcp_servers)), + Effect.catch(() => + Effect.logDebug("Codex config read failed.").pipe( + Effect.as>([]), + ), + ), + ); const now = yield* DateTime.now; const session = providerSession({ providerSessionId: input.providerSessionId, @@ -7795,13 +7836,17 @@ export const makeCodexAdapterV2 = Effect.fn("makeCodexAdapterV2")(function* ( ) => request.pipe( Effect.catchIf(isCodexThreadNotFoundError, () => - readMcpSession(providerThread.appThreadId).pipe( - Effect.flatMap((mcpSession) => + Effect.all([ + readMcpSession(providerThread.appThreadId), + readStdioMcpServers(undefined), + ]).pipe( + Effect.flatMap(([mcpSession, stdioMcpServers]) => resumeNativeThread(threadId, { excludeTurns: true, ...codexThreadRuntimeParams({ threadId: providerThread.appThreadId, mcpSession, + stdioMcpServers, }), }), ), @@ -7965,12 +8010,18 @@ export const makeCodexAdapterV2 = Effect.fn("makeCodexAdapterV2")(function* ( }), ensureThread: (threadInput) => ensureInitialized.pipe( - Effect.andThen(mcpSessions.read(threadInput.threadId)), - Effect.flatMap((mcpSession) => + Effect.andThen( + Effect.all([ + mcpSessions.read(threadInput.threadId), + readStdioMcpServers(threadInput.runtimePolicy.cwd), + ]), + ), + Effect.flatMap(([mcpSession, stdioMcpServers]) => client.request("thread/start", { ...codexThreadRuntimeParams({ threadId: threadInput.threadId, mcpSession, + stdioMcpServers, modelSelection: threadInput.modelSelection, runtimePolicy: threadInput.runtimePolicy, }), @@ -8008,6 +8059,7 @@ export const makeCodexAdapterV2 = Effect.fn("makeCodexAdapterV2")(function* ( ...codexThreadRuntimeParams({ threadId: appThreadId, mcpSession: yield* readMcpSession(appThreadId), + stdioMcpServers: yield* readStdioMcpServers(threadInput.runtimePolicy?.cwd), ...(threadInput.modelSelection === undefined ? {} : { modelSelection: threadInput.modelSelection }), @@ -8905,6 +8957,7 @@ export const makeCodexAdapterV2 = Effect.fn("makeCodexAdapterV2")(function* ( ...codexThreadRuntimeParams({ threadId: threadInput.providerThread.appThreadId, mcpSession: yield* readMcpSession(threadInput.providerThread.appThreadId), + stdioMcpServers: yield* readStdioMcpServers(undefined), }), }); } @@ -8953,6 +9006,7 @@ export const makeCodexAdapterV2 = Effect.fn("makeCodexAdapterV2")(function* ( ...codexThreadRuntimeParams({ threadId: threadInput.targetThreadId, mcpSession: yield* mcpSessions.read(threadInput.targetThreadId), + stdioMcpServers: yield* readStdioMcpServers(threadInput.runtimePolicy?.cwd), ...(threadInput.modelSelection === undefined ? {} : { modelSelection: threadInput.modelSelection }), diff --git a/apps/server/src/orchestration-v2/testkit/fixtures/codex_model_reroute/codex_transcript.ndjson b/apps/server/src/orchestration-v2/testkit/fixtures/codex_model_reroute/codex_transcript.ndjson index aa14fb3b08d50..43f96d949175f 100644 --- a/apps/server/src/orchestration-v2/testkit/fixtures/codex_model_reroute/codex_transcript.ndjson +++ b/apps/server/src/orchestration-v2/testkit/fixtures/codex_model_reroute/codex_transcript.ndjson @@ -2,20 +2,22 @@ {"type":"expect_outbound","label":"initialize","frame":{"id":1,"method":"initialize","params":{"capabilities":{"experimentalApi":true,"optOutNotificationMethods":["turn/diff/updated"],"extensions":{"io.modelcontextprotocol/ui":{"mimeTypes":["text/html;profile=mcp-app"]}}},"clientInfo":{"name":"T3 Code","title":"T3 Code","version":"0.0.44"}}}} {"type":"emit_inbound","label":"initialize","frame":{"id":1,"result":{"userAgent":"t3code_desktop/0.156.1 (Debian 13.0.0; x86_64) unknown (t3code_desktop; 0.1.0)","codexHome":"/home/replay-user/.codex","platformFamily":"unix","platformOs":"linux"}}} {"type":"expect_outbound","label":"initialized","frame":{"method":"initialized"}} -{"type":"expect_outbound","label":"thread/start","frame":{"id":2,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","model":"gpt-6-luna"}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":2,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":2,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"thread/start","frame":{"id":3,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","model":"gpt-6-luna"}}} {"type":"emit_inbound","label":"configWarning","frame":{"method":"configWarning","params":{"summary":"Codex could not find bubblewrap on PATH. Install bubblewrap with your OS package manager. See the sandbox prerequisites: https://developers.openai.com/codex/concepts/sandboxing#prerequisites. Codex will use the bundled bubblewrap in the meantime.","details":null},"emittedAtMs":1790295480414}} {"type":"emit_inbound","label":"remoteControl/status/changed","frame":{"method":"remoteControl/status/changed","params":{"status":"disabled","serverName":"replay-host","installationId":"00000000-0000-4000-8000-000000000000","environmentId":null},"emittedAtMs":1790295480414}} -{"type":"emit_inbound","label":"thread/start","frame":{"id":2,"result":{"thread":{"id":"01a0d5ed-187d-70c2-b4b6-b6881a68de09","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5ed-187d-70c2-b4b6-b6881a68de09","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790295480,"updatedAt":1790295480,"recencyAt":1790295480,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-18-00-01a0d5ed-187d-70c2-b4b6-b6881a68de09.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"],"instructionSources":["/home/replay-user/.codex/AGENTS.md","/home/replay-user/t3code/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} -{"type":"expect_outbound","label":"thread/name/set","frame":{"id":3,"method":"thread/name/set","params":{"name":"Replay fixture: codex_model_reroute","threadId":"01a0d5ed-187d-70c2-b4b6-b6881a68de09"}}} -{"type":"emit_inbound","label":"thread/name/set","frame":{"id":3,"result":{}}} +{"type":"emit_inbound","label":"thread/start","frame":{"id":3,"result":{"thread":{"id":"01a0d5ed-187d-70c2-b4b6-b6881a68de09","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5ed-187d-70c2-b4b6-b6881a68de09","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790295480,"updatedAt":1790295480,"recencyAt":1790295480,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-18-00-01a0d5ed-187d-70c2-b4b6-b6881a68de09.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"],"instructionSources":["/home/replay-user/.codex/AGENTS.md","/home/replay-user/t3code/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} +{"type":"expect_outbound","label":"thread/name/set","frame":{"id":4,"method":"thread/name/set","params":{"name":"Replay fixture: codex_model_reroute","threadId":"01a0d5ed-187d-70c2-b4b6-b6881a68de09"}}} +{"type":"emit_inbound","label":"thread/name/set","frame":{"id":4,"result":{}}} {"type":"emit_inbound","label":"thread/name/updated","frame":{"method":"thread/name/updated","params":{"threadId":"01a0d5ed-187d-70c2-b4b6-b6881a68de09","threadName":"Replay fixture: codex_model_reroute"}}} -{"type":"expect_outbound","label":"config/read","frame":{"id":4,"method":"config/read","params":{"cwd":"","includeLayers":false}}} -{"type":"emit_inbound","label":"config/read","frame":{"id":4,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"turn/start","frame":{"id":5,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Respond with exactly: first fixture turn complete","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0d5ed-187d-70c2-b4b6-b6881a68de09","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":5,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":5,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"turn/start","frame":{"id":6,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Respond with exactly: first fixture turn complete","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0d5ed-187d-70c2-b4b6-b6881a68de09","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} {"type":"emit_inbound","label":"thread/started","frame":{"method":"thread/started","params":{"thread":{"id":"01a0d5ed-187d-70c2-b4b6-b6881a68de09","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5ed-187d-70c2-b4b6-b6881a68de09","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790295480,"updatedAt":1790295480,"recencyAt":1790295480,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-18-00-01a0d5ed-187d-70c2-b4b6-b6881a68de09.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]}},"emittedAtMs":1790295480656}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0d5ed-187d-70c2-b4b6-b6881a68de09","name":"codex_apps","status":"starting","error":null,"failureReason":null},"emittedAtMs":1790295480656}} {"type":"emit_inbound","label":"thread/settings/updated","frame":{"method":"thread/settings/updated","params":{"threadId":"01a0d5ed-187d-70c2-b4b6-b6881a68de09","threadSettings":{"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","approvalPolicy":"never","approvalsReviewer":"user","sandboxPolicy":{"type":"dangerFullAccess"},"activePermissionProfile":null,"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"effort":null,"summary":"detailed","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna","reasoning_effort":null,"developer_instructions":null}},"multiAgentMode":"explicitRequestOnly","personality":null}},"emittedAtMs":1790295480666}} -{"type":"emit_inbound","label":"turn/start","frame":{"id":5,"result":{"turn":{"id":"01a0d5ed-1957-7a22-8399-d0172af342fd","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"emit_inbound","label":"turn/start","frame":{"id":6,"result":{"turn":{"id":"01a0d5ed-1957-7a22-8399-d0172af342fd","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0d5ed-187d-70c2-b4b6-b6881a68de09","status":{"type":"active","activeFlags":[]}},"emittedAtMs":1790295480718}} {"type":"emit_inbound","label":"turn/started","frame":{"method":"turn/started","params":{"threadId":"01a0d5ed-187d-70c2-b4b6-b6881a68de09","turn":{"id":"01a0d5ed-1957-7a22-8399-d0172af342fd","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":1790295480,"completedAt":null,"durationMs":null}},"emittedAtMs":1790295480718}} {"type":"emit_inbound","label":"model/rerouted","frame":{"method":"model/rerouted","params":{"threadId":"01a0d5ed-187d-70c2-b4b6-b6881a68de09","turnId":"01a0d5ed-1957-7a22-8399-d0172af342fd","fromModel":"gpt-6-luna","toModel":"gpt-6-astra","reason":"highRiskCyberActivity"}}} @@ -33,11 +35,11 @@ {"type":"emit_inbound","label":"thread/tokenUsage/updated","frame":{"method":"thread/tokenUsage/updated","params":{"threadId":"01a0d5ed-187d-70c2-b4b6-b6881a68de09","turnId":"01a0d5ed-1957-7a22-8399-d0172af342fd","tokenUsage":{"total":{"totalTokens":21426,"inputTokens":21418,"cachedInputTokens":6912,"cacheWriteInputTokens":0,"outputTokens":8,"reasoningOutputTokens":0},"last":{"totalTokens":21426,"inputTokens":21418,"cachedInputTokens":6912,"cacheWriteInputTokens":0,"outputTokens":8,"reasoningOutputTokens":0},"modelContextWindow":258400}},"emittedAtMs":1790295485211}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0d5ed-187d-70c2-b4b6-b6881a68de09","status":{"type":"idle"}},"emittedAtMs":1790295485220}} {"type":"emit_inbound","label":"turn/completed","frame":{"method":"turn/completed","params":{"threadId":"01a0d5ed-187d-70c2-b4b6-b6881a68de09","turn":{"id":"01a0d5ed-1957-7a22-8399-d0172af342fd","items":[{"type":"agentMessage","id":"msg_06900ecb02a780a6016ab5bdbcd76887d0ba52ca8fee9da2e1","text":"first fixture turn complete","phase":"final_answer","memoryCitation":null,"delivery":null,"questions":null}],"itemsView":"summary","status":"completed","error":null,"startedAt":1790295480,"completedAt":1790295485,"durationMs":4550}},"emittedAtMs":1790295485220}} -{"type":"expect_outbound","label":"config/read","frame":{"id":6,"method":"config/read","params":{"cwd":"","includeLayers":false}}} -{"type":"emit_inbound","label":"config/read","frame":{"id":6,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"turn/start","frame":{"id":7,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Respond with exactly: second fixture turn complete","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0d5ed-187d-70c2-b4b6-b6881a68de09","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":7,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":7,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"turn/start","frame":{"id":8,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Respond with exactly: second fixture turn complete","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0d5ed-187d-70c2-b4b6-b6881a68de09","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0d5ed-187d-70c2-b4b6-b6881a68de09","name":"xcodebuildmcp","status":"ready","error":null,"failureReason":null},"emittedAtMs":1790295485265}} -{"type":"emit_inbound","label":"turn/start","frame":{"id":7,"result":{"turn":{"id":"01a0d5ed-2b29-7353-a6d5-7745731173b7","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"emit_inbound","label":"turn/start","frame":{"id":8,"result":{"turn":{"id":"01a0d5ed-2b29-7353-a6d5-7745731173b7","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0d5ed-187d-70c2-b4b6-b6881a68de09","status":{"type":"active","activeFlags":[]}},"emittedAtMs":1790295485286}} {"type":"emit_inbound","label":"turn/started","frame":{"method":"turn/started","params":{"threadId":"01a0d5ed-187d-70c2-b4b6-b6881a68de09","turn":{"id":"01a0d5ed-2b29-7353-a6d5-7745731173b7","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":1790295485,"completedAt":null,"durationMs":null}},"emittedAtMs":1790295485286}} {"type":"emit_inbound","label":"item/started","frame":{"method":"item/started","params":{"item":{"type":"userMessage","id":"01a0d5ed-2bdf-7093-9e82-b961af1fe132","clientId":null,"content":[{"type":"text","text":"Respond with exactly: second fixture turn complete","text_elements":[]}]},"threadId":"01a0d5ed-187d-70c2-b4b6-b6881a68de09","turnId":"01a0d5ed-2b29-7353-a6d5-7745731173b7","startedAtMs":1790295485409},"emittedAtMs":1790295485409}} diff --git a/apps/server/src/orchestration-v2/testkit/fixtures/command_output_streaming/codex_transcript.ndjson b/apps/server/src/orchestration-v2/testkit/fixtures/command_output_streaming/codex_transcript.ndjson index 954c6e4a48f26..dc4f9ed7eaa80 100644 --- a/apps/server/src/orchestration-v2/testkit/fixtures/command_output_streaming/codex_transcript.ndjson +++ b/apps/server/src/orchestration-v2/testkit/fixtures/command_output_streaming/codex_transcript.ndjson @@ -2,15 +2,17 @@ {"type":"expect_outbound","label":"initialize","frame":{"id":1,"method":"initialize","params":{"capabilities":{"experimentalApi":true,"optOutNotificationMethods":["turn/diff/updated"],"extensions":{"io.modelcontextprotocol/ui":{"mimeTypes":["text/html;profile=mcp-app"]}}},"clientInfo":{"name":"T3 Code","title":"T3 Code","version":"0.0.45"}}}} {"type":"emit_inbound","label":"initialize","frame":{"id":1,"result":{"userAgent":"T3 Code/0.157.0 (Mac OS 27.0.0; arm64) unknown (T3 Code; 0.0.45)","codexHome":"/home/replay-user/.codex","platformFamily":"unix","platformOs":"macos"}}} {"type":"expect_outbound","label":"initialized","frame":{"method":"initialized"}} -{"type":"expect_outbound","label":"thread/start","frame":{"id":2,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","model":"gpt-6-luna"}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":2,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":2,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"thread/start","frame":{"id":3,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","model":"gpt-6-luna"}}} {"type":"emit_inbound","label":"remoteControl/status/changed","frame":{"method":"remoteControl/status/changed","params":{"status":"disabled","serverName":"replay-host","installationId":"00000000-0000-4000-8000-000000000000","environmentId":null},"emittedAtMs":1791001627148}} -{"type":"emit_inbound","label":"thread/start","frame":{"id":2,"result":{"thread":{"id":"01a10004-0a27-7421-852d-0f7f99ace2d6","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/apps/server","runtimeWorkspaceRoots":["/home/replay-user/t3code/apps/server"]}],"extra":null,"sessionId":"01a10004-0a27-7421-852d-0f7f99ace2d6","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"cpa","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1791001627,"updatedAt":1791001627,"recencyAt":1791001627,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/10/03/rollout-2026-10-03T00-27-07-01a10004-0a27-7421-852d-0f7f99ace2d6.jsonl","cwd":"/home/replay-user/t3code/apps/server","cliVersion":"0.157.0","originator":"T3 Code","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-luna","modelProvider":"cpa","serviceTier":"default","disabledPluginIds":[],"cwd":"/home/replay-user/t3code/apps/server","runtimeWorkspaceRoots":["/home/replay-user/t3code/apps/server"],"instructionSources":["/home/replay-user/.codex/AGENTS.md","/home/replay-user/t3code/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"readOnly","networkAccess":false},"activePermissionProfile":{"id":":read-only","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} -{"type":"expect_outbound","label":"thread/name/set","frame":{"id":3,"method":"thread/name/set","params":{"name":"Replay fixture: command_output_streaming","threadId":"01a10004-0a27-7421-852d-0f7f99ace2d6"}}} -{"type":"emit_inbound","label":"thread/name/set","frame":{"id":3,"result":{}}} +{"type":"emit_inbound","label":"thread/start","frame":{"id":3,"result":{"thread":{"id":"01a10004-0a27-7421-852d-0f7f99ace2d6","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/apps/server","runtimeWorkspaceRoots":["/home/replay-user/t3code/apps/server"]}],"extra":null,"sessionId":"01a10004-0a27-7421-852d-0f7f99ace2d6","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"cpa","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1791001627,"updatedAt":1791001627,"recencyAt":1791001627,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/10/03/rollout-2026-10-03T00-27-07-01a10004-0a27-7421-852d-0f7f99ace2d6.jsonl","cwd":"/home/replay-user/t3code/apps/server","cliVersion":"0.157.0","originator":"T3 Code","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-luna","modelProvider":"cpa","serviceTier":"default","disabledPluginIds":[],"cwd":"/home/replay-user/t3code/apps/server","runtimeWorkspaceRoots":["/home/replay-user/t3code/apps/server"],"instructionSources":["/home/replay-user/.codex/AGENTS.md","/home/replay-user/t3code/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"readOnly","networkAccess":false},"activePermissionProfile":{"id":":read-only","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} +{"type":"expect_outbound","label":"thread/name/set","frame":{"id":4,"method":"thread/name/set","params":{"name":"Replay fixture: command_output_streaming","threadId":"01a10004-0a27-7421-852d-0f7f99ace2d6"}}} +{"type":"emit_inbound","label":"thread/name/set","frame":{"id":4,"result":{}}} {"type":"emit_inbound","label":"thread/name/updated","frame":{"method":"thread/name/updated","params":{"threadId":"01a10004-0a27-7421-852d-0f7f99ace2d6","threadName":"Replay fixture: command_output_streaming"}}} -{"type":"expect_outbound","label":"config/read","frame":{"id":4,"method":"config/read","params":{"cwd":"","includeLayers":false}}} -{"type":"emit_inbound","label":"config/read","frame":{"id":4,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"turn/start","frame":{"id":5,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Run this exact shell command in the foreground and wait for it to finish: `for i in 1 2 3 4; do printf '\\033[32mstream line %s\\033[0m\\n' $i; sleep 1; done; printf 'progress 50%%\\rprogress 100%%\\n'`. Then respond exactly: command output fixture complete","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"networkAccess":false,"type":"workspaceWrite","writableRoots":[]},"summary":"auto","threadId":"01a10004-0a27-7421-852d-0f7f99ace2d6","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":5,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":5,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"turn/start","frame":{"id":6,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Run this exact shell command in the foreground and wait for it to finish: `for i in 1 2 3 4; do printf '\\033[32mstream line %s\\033[0m\\n' $i; sleep 1; done; printf 'progress 50%%\\rprogress 100%%\\n'`. Then respond exactly: command output fixture complete","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"networkAccess":false,"type":"workspaceWrite","writableRoots":[]},"summary":"auto","threadId":"01a10004-0a27-7421-852d-0f7f99ace2d6","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} {"type":"emit_inbound","label":"thread/started","frame":{"method":"thread/started","params":{"thread":{"id":"01a10004-0a27-7421-852d-0f7f99ace2d6","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/apps/server","runtimeWorkspaceRoots":["/home/replay-user/t3code/apps/server"]}],"extra":null,"sessionId":"01a10004-0a27-7421-852d-0f7f99ace2d6","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"cpa","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1791001627,"updatedAt":1791001627,"recencyAt":1791001627,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/10/03/rollout-2026-10-03T00-27-07-01a10004-0a27-7421-852d-0f7f99ace2d6.jsonl","cwd":"/home/replay-user/t3code/apps/server","cliVersion":"0.157.0","originator":"T3 Code","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]}},"emittedAtMs":1791001627410}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a10004-0a27-7421-852d-0f7f99ace2d6","name":"cua_repl","status":"starting","error":null,"failureReason":null},"emittedAtMs":1791001627411}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a10004-0a27-7421-852d-0f7f99ace2d6","name":"codex_apps","status":"starting","error":null,"failureReason":null},"emittedAtMs":1791001627411}} @@ -18,7 +20,7 @@ {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a10004-0a27-7421-852d-0f7f99ace2d6","name":"paper","status":"starting","error":null,"failureReason":null},"emittedAtMs":1791001627411}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a10004-0a27-7421-852d-0f7f99ace2d6","name":"node_repl","status":"starting","error":null,"failureReason":null},"emittedAtMs":1791001627411}} {"type":"emit_inbound","label":"thread/settings/updated","frame":{"method":"thread/settings/updated","params":{"threadId":"01a10004-0a27-7421-852d-0f7f99ace2d6","threadSettings":{"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/apps/server","approvalPolicy":"never","approvalsReviewer":"user","sandboxPolicy":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":null,"model":"gpt-6-luna","modelProvider":"cpa","serviceTier":"default","effort":null,"summary":"detailed","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna","reasoning_effort":null,"developer_instructions":null}},"multiAgentMode":"explicitRequestOnly","personality":null}},"emittedAtMs":1791001627437}} -{"type":"emit_inbound","label":"turn/start","frame":{"id":5,"result":{"turn":{"id":"01a10004-0b1b-78f0-a41c-b253bded078e","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"emit_inbound","label":"turn/start","frame":{"id":6,"result":{"turn":{"id":"01a10004-0b1b-78f0-a41c-b253bded078e","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"account/updated","frame":{"method":"account/updated","params":{"authMode":"chatgpt","planType":"unknown"},"emittedAtMs":1791001627550}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a10004-0a27-7421-852d-0f7f99ace2d6","status":{"type":"active","activeFlags":[]}},"emittedAtMs":1791001627553}} {"type":"emit_inbound","label":"turn/started","frame":{"method":"turn/started","params":{"threadId":"01a10004-0a27-7421-852d-0f7f99ace2d6","turn":{"id":"01a10004-0b1b-78f0-a41c-b253bded078e","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":1791001627,"completedAt":null,"durationMs":null}},"emittedAtMs":1791001627553}} diff --git a/apps/server/src/orchestration-v2/testkit/fixtures/delegated_task_status/codex_transcript.ndjson b/apps/server/src/orchestration-v2/testkit/fixtures/delegated_task_status/codex_transcript.ndjson index e40c278285055..0dd98394500b7 100644 --- a/apps/server/src/orchestration-v2/testkit/fixtures/delegated_task_status/codex_transcript.ndjson +++ b/apps/server/src/orchestration-v2/testkit/fixtures/delegated_task_status/codex_transcript.ndjson @@ -2,28 +2,32 @@ {"type":"expect_outbound","label":"initialize","frame":{"id":1,"method":"initialize","params":{"capabilities":{"experimentalApi":true,"optOutNotificationMethods":["turn/diff/updated"],"extensions":{"io.modelcontextprotocol/ui":{"mimeTypes":["text/html;profile=mcp-app"]}}},"clientInfo":{"name":"T3 Code","title":"T3 Code","version":"0.0.44"}}}} {"type":"emit_inbound","label":"initialize","frame":{"id":1,"result":{"userAgent":"t3code_desktop/0.120.0 (Mac OS 26.4.1; arm64) dumb (t3code_desktop; 0.1.0)","codexHome":"/home/replay-user/.codex","platformFamily":"unix","platformOs":"macos"}}} {"type":"expect_outbound","label":"initialized","frame":{"method":"initialized"}} -{"type":"expect_outbound","label":"parent.thread/start","frame":{"id":2,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true}}}} -{"type":"emit_inbound","label":"parent.thread/start","frame":{"id":2,"result":{"thread":{"id":"019f1000-0000-7000-8000-000000000001","forkedFromId":null,"preview":"","ephemeral":false,"modelProvider":"openai","createdAt":1776739467,"updatedAt":1776739467,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/delegated-task-status-parent.jsonl","cwd":"/home/replay-user/t3code","cliVersion":"0.120.0","source":"vscode","agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"turns":[]},"model":"gpt-5.4","modelProvider":"openai","serviceTier":"fast","cwd":"/home/replay-user/t3code","approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"readOnlyAccess":{"type":"fullAccess"},"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"reasoningEffort":"xhigh"}}} -{"type":"expect_outbound","label":"thread/name/set","frame":{"id":3,"method":"thread/name/set","params":{"name":"Replay fixture: delegated_task_status","threadId":"019f1000-0000-7000-8000-000000000001"}}} -{"type":"emit_inbound","label":"thread/name/set","frame":{"id":3,"result":{}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":2,"method":"config/read","params":{"includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":2,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"parent.thread/start","frame":{"id":3,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true}}}} +{"type":"emit_inbound","label":"parent.thread/start","frame":{"id":3,"result":{"thread":{"id":"019f1000-0000-7000-8000-000000000001","forkedFromId":null,"preview":"","ephemeral":false,"modelProvider":"openai","createdAt":1776739467,"updatedAt":1776739467,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/delegated-task-status-parent.jsonl","cwd":"/home/replay-user/t3code","cliVersion":"0.120.0","source":"vscode","agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"turns":[]},"model":"gpt-5.4","modelProvider":"openai","serviceTier":"fast","cwd":"/home/replay-user/t3code","approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"readOnlyAccess":{"type":"fullAccess"},"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"reasoningEffort":"xhigh"}}} +{"type":"expect_outbound","label":"thread/name/set","frame":{"id":4,"method":"thread/name/set","params":{"name":"Replay fixture: delegated_task_status","threadId":"019f1000-0000-7000-8000-000000000001"}}} +{"type":"emit_inbound","label":"thread/name/set","frame":{"id":4,"result":{}}} {"type":"emit_inbound","label":"thread/name/updated","frame":{"method":"thread/name/updated","params":{"threadId":"019f1000-0000-7000-8000-000000000001","threadName":"Replay fixture: delegated_task_status"}}} -{"type":"expect_outbound","label":"config/read","frame":{"id":4,"method":"config/read","params":{"cwd":"","includeLayers":false}}} -{"type":"emit_inbound","label":"config/read","frame":{"id":4,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"parent.turn/start","frame":{"id":5,"method":"turn/start","params":{"approvalPolicy":"never","cwd":"","input":[{"text":"Keep this parent turn active while orchestration tools are tested.","type":"text"}],"model":"gpt-5.4","sandboxPolicy":{"type":"dangerFullAccess"},"threadId":"019f1000-0000-7000-8000-000000000001","approvalsReviewer":"user","summary":"auto","collaborationMode":{"mode":"default","settings":{"model":"gpt-5.4"}}}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":5,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":5,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"parent.turn/start","frame":{"id":6,"method":"turn/start","params":{"approvalPolicy":"never","cwd":"","input":[{"text":"Keep this parent turn active while orchestration tools are tested.","type":"text"}],"model":"gpt-5.4","sandboxPolicy":{"type":"dangerFullAccess"},"threadId":"019f1000-0000-7000-8000-000000000001","approvalsReviewer":"user","summary":"auto","collaborationMode":{"mode":"default","settings":{"model":"gpt-5.4"}}}}} {"type":"emit_inbound","label":"parent.thread/started","frame":{"method":"thread/started","params":{"thread":{"id":"019f1000-0000-7000-8000-000000000001","forkedFromId":null,"preview":"","ephemeral":false,"modelProvider":"openai","createdAt":1776739467,"updatedAt":1776739467,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/delegated-task-status-parent.jsonl","cwd":"/home/replay-user/t3code","cliVersion":"0.120.0","source":"vscode","agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"turns":[]}}}} -{"type":"emit_inbound","label":"parent.turn/start","frame":{"id":5,"result":{"turn":{"id":"019f1000-0000-7000-8000-000000000002","items":[],"status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"emit_inbound","label":"parent.turn/start","frame":{"id":6,"result":{"turn":{"id":"019f1000-0000-7000-8000-000000000002","items":[],"status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"parent.thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"019f1000-0000-7000-8000-000000000001","status":{"type":"active","activeFlags":[]}}}} {"type":"emit_inbound","label":"parent.turn/started","frame":{"method":"turn/started","params":{"threadId":"019f1000-0000-7000-8000-000000000001","turn":{"id":"019f1000-0000-7000-8000-000000000002","items":[],"status":"inProgress","error":null,"startedAt":1776739467,"completedAt":null,"durationMs":null}}}} -{"type":"expect_outbound","label":"child.thread/start","frame":{"id":6,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"threadSource":"subagent"}}} -{"type":"emit_inbound","label":"child.thread/start","frame":{"id":6,"result":{"thread":{"id":"019f1000-0000-7000-8000-000000000003","forkedFromId":null,"preview":"","ephemeral":false,"modelProvider":"openai","createdAt":1776739468,"updatedAt":1776739468,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/delegated-task-status-child.jsonl","cwd":"/home/replay-user/t3code","cliVersion":"0.120.0","source":"vscode","agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"turns":[]},"model":"gpt-5.4","modelProvider":"openai","serviceTier":"fast","cwd":"/home/replay-user/t3code","approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"readOnlyAccess":{"type":"fullAccess"},"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"reasoningEffort":"xhigh"}}} -{"type":"expect_outbound","label":"thread/name/set","frame":{"id":7,"method":"thread/name/set","params":{"name":"Replay fixture: delegated_task_status","threadId":"019f1000-0000-7000-8000-000000000003"}}} -{"type":"emit_inbound","label":"thread/name/set","frame":{"id":7,"result":{}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":7,"method":"config/read","params":{"includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":7,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"child.thread/start","frame":{"id":8,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"threadSource":"subagent"}}} +{"type":"emit_inbound","label":"child.thread/start","frame":{"id":8,"result":{"thread":{"id":"019f1000-0000-7000-8000-000000000003","forkedFromId":null,"preview":"","ephemeral":false,"modelProvider":"openai","createdAt":1776739468,"updatedAt":1776739468,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/delegated-task-status-child.jsonl","cwd":"/home/replay-user/t3code","cliVersion":"0.120.0","source":"vscode","agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"turns":[]},"model":"gpt-5.4","modelProvider":"openai","serviceTier":"fast","cwd":"/home/replay-user/t3code","approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"readOnlyAccess":{"type":"fullAccess"},"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"reasoningEffort":"xhigh"}}} +{"type":"expect_outbound","label":"thread/name/set","frame":{"id":9,"method":"thread/name/set","params":{"name":"Replay fixture: delegated_task_status","threadId":"019f1000-0000-7000-8000-000000000003"}}} +{"type":"emit_inbound","label":"thread/name/set","frame":{"id":9,"result":{}}} {"type":"emit_inbound","label":"thread/name/updated","frame":{"method":"thread/name/updated","params":{"threadId":"019f1000-0000-7000-8000-000000000003","threadName":"Replay fixture: delegated_task_status"}}} -{"type":"expect_outbound","label":"config/read","frame":{"id":8,"method":"config/read","params":{"cwd":"","includeLayers":false}}} -{"type":"emit_inbound","label":"config/read","frame":{"id":8,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"child.original.turn/start","frame":{"id":9,"method":"turn/start","params":{"approvalPolicy":"never","cwd":"","input":[{"text":"[T3 Code: the agent in T3 thread \"thread:mcp-orchestrator-parent\" sent this message, not the user.]\n\nInspect the delegated API boundary and return the result.","type":"text"}],"model":"gpt-5.4","sandboxPolicy":{"type":"dangerFullAccess"},"threadId":"019f1000-0000-7000-8000-000000000003","approvalsReviewer":"user","summary":"auto","collaborationMode":{"mode":"default","settings":{"model":"gpt-5.4"}}}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":10,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":10,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"child.original.turn/start","frame":{"id":11,"method":"turn/start","params":{"approvalPolicy":"never","cwd":"","input":[{"text":"[T3 Code: the agent in T3 thread \"thread:mcp-orchestrator-parent\" sent this message, not the user.]\n\nInspect the delegated API boundary and return the result.","type":"text"}],"model":"gpt-5.4","sandboxPolicy":{"type":"dangerFullAccess"},"threadId":"019f1000-0000-7000-8000-000000000003","approvalsReviewer":"user","summary":"auto","collaborationMode":{"mode":"default","settings":{"model":"gpt-5.4"}}}}} {"type":"emit_inbound","label":"child.thread/started","frame":{"method":"thread/started","params":{"thread":{"id":"019f1000-0000-7000-8000-000000000003","forkedFromId":null,"preview":"","ephemeral":false,"modelProvider":"openai","createdAt":1776739468,"updatedAt":1776739468,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/delegated-task-status-child.jsonl","cwd":"/home/replay-user/t3code","cliVersion":"0.120.0","source":"vscode","agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"turns":[]}}}} -{"type":"emit_inbound","label":"child.original.turn/start","frame":{"id":9,"result":{"turn":{"id":"019f1000-0000-7000-8000-000000000004","items":[],"status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"emit_inbound","label":"child.original.turn/start","frame":{"id":11,"result":{"turn":{"id":"019f1000-0000-7000-8000-000000000004","items":[],"status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"child.original.thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"019f1000-0000-7000-8000-000000000003","status":{"type":"active","activeFlags":[]}}}} {"type":"emit_inbound","label":"child.original.turn/started","frame":{"method":"turn/started","params":{"threadId":"019f1000-0000-7000-8000-000000000003","turn":{"id":"019f1000-0000-7000-8000-000000000004","items":[],"status":"inProgress","error":null,"startedAt":1776739468,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"child.original.item/started","frame":{"method":"item/started","params":{"item":{"type":"agentMessage","id":"msg_delegated_task_status_original","text":"","phase":"final_answer","memoryCitation":null},"threadId":"019f1000-0000-7000-8000-000000000003","turnId":"019f1000-0000-7000-8000-000000000004"}}} @@ -31,20 +35,20 @@ {"type":"emit_inbound","label":"child.original.item/completed","frame":{"method":"item/completed","params":{"item":{"type":"agentMessage","id":"msg_delegated_task_status_original","text":"Delegated API boundary inspected.","phase":"final_answer","memoryCitation":null},"threadId":"019f1000-0000-7000-8000-000000000003","turnId":"019f1000-0000-7000-8000-000000000004"}}} {"type":"emit_inbound","label":"child.original.thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"019f1000-0000-7000-8000-000000000003","status":{"type":"idle"}}}} {"type":"emit_inbound","label":"child.original.turn/completed","frame":{"method":"turn/completed","params":{"threadId":"019f1000-0000-7000-8000-000000000003","turn":{"id":"019f1000-0000-7000-8000-000000000004","items":[],"status":"completed","error":null,"startedAt":1776739468,"completedAt":1776739469,"durationMs":1000}}}} -{"type":"expect_outbound","label":"config/read","frame":{"id":10,"method":"config/read","params":{"cwd":"","includeLayers":false}}} -{"type":"emit_inbound","label":"config/read","frame":{"id":10,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"child.running.turn/start","frame":{"id":11,"method":"turn/start","params":{"approvalPolicy":"never","cwd":"","input":[{"text":"[T3 Code: the agent in T3 thread \"thread:mcp-orchestrator-parent\" sent this message, not the user.]\n\nRemain active until the parent cancels this delegated task.","type":"text"}],"model":"gpt-5.4","sandboxPolicy":{"type":"dangerFullAccess"},"threadId":"019f1000-0000-7000-8000-000000000003","approvalsReviewer":"user","summary":"auto","collaborationMode":{"mode":"default","settings":{"model":"gpt-5.4"}}}}} -{"type":"emit_inbound","label":"child.running.turn/start","frame":{"id":11,"result":{"turn":{"id":"019f1000-0000-7000-8000-000000000005","items":[],"status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":12,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":12,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"child.running.turn/start","frame":{"id":13,"method":"turn/start","params":{"approvalPolicy":"never","cwd":"","input":[{"text":"[T3 Code: the agent in T3 thread \"thread:mcp-orchestrator-parent\" sent this message, not the user.]\n\nRemain active until the parent cancels this delegated task.","type":"text"}],"model":"gpt-5.4","sandboxPolicy":{"type":"dangerFullAccess"},"threadId":"019f1000-0000-7000-8000-000000000003","approvalsReviewer":"user","summary":"auto","collaborationMode":{"mode":"default","settings":{"model":"gpt-5.4"}}}}} +{"type":"emit_inbound","label":"child.running.turn/start","frame":{"id":13,"result":{"turn":{"id":"019f1000-0000-7000-8000-000000000005","items":[],"status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"child.running.thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"019f1000-0000-7000-8000-000000000003","status":{"type":"active","activeFlags":[]}}}} {"type":"emit_inbound","label":"child.running.turn/started","frame":{"method":"turn/started","params":{"threadId":"019f1000-0000-7000-8000-000000000003","turn":{"id":"019f1000-0000-7000-8000-000000000005","items":[],"status":"inProgress","error":null,"startedAt":1776739470,"completedAt":null,"durationMs":null}}}} -{"type":"expect_outbound","label":"child.running.turn/interrupt","frame":{"id":12,"method":"turn/interrupt","params":{"threadId":"019f1000-0000-7000-8000-000000000003","turnId":"019f1000-0000-7000-8000-000000000005"}}} -{"type":"emit_inbound","label":"child.running.turn/interrupt","frame":{"id":12,"result":{}}} +{"type":"expect_outbound","label":"child.running.turn/interrupt","frame":{"id":14,"method":"turn/interrupt","params":{"threadId":"019f1000-0000-7000-8000-000000000003","turnId":"019f1000-0000-7000-8000-000000000005"}}} +{"type":"emit_inbound","label":"child.running.turn/interrupt","frame":{"id":14,"result":{}}} {"type":"emit_inbound","label":"child.running.thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"019f1000-0000-7000-8000-000000000003","status":{"type":"idle"}}}} {"type":"emit_inbound","label":"child.running.turn/completed","frame":{"method":"turn/completed","params":{"threadId":"019f1000-0000-7000-8000-000000000003","turn":{"id":"019f1000-0000-7000-8000-000000000005","items":[],"status":"interrupted","error":null,"startedAt":1776739470,"completedAt":1776739471,"durationMs":1000}}}} -{"type":"expect_outbound","label":"config/read","frame":{"id":13,"method":"config/read","params":{"cwd":"","includeLayers":false}}} -{"type":"emit_inbound","label":"config/read","frame":{"id":13,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"child.queued.turn/start","frame":{"id":14,"method":"turn/start","params":{"approvalPolicy":"never","cwd":"","input":[{"text":"[T3 Code: the agent in T3 thread \"thread:mcp-orchestrator-parent\" sent this message, not the user.]\n\nComplete the queued follow-up and return the final result.","type":"text"}],"model":"gpt-5.4","sandboxPolicy":{"type":"dangerFullAccess"},"threadId":"019f1000-0000-7000-8000-000000000003","approvalsReviewer":"user","summary":"auto","collaborationMode":{"mode":"default","settings":{"model":"gpt-5.4"}}}}} -{"type":"emit_inbound","label":"child.queued.turn/start","frame":{"id":14,"result":{"turn":{"id":"019f1000-0000-7000-8000-000000000006","items":[],"status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":15,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":15,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"child.queued.turn/start","frame":{"id":16,"method":"turn/start","params":{"approvalPolicy":"never","cwd":"","input":[{"text":"[T3 Code: the agent in T3 thread \"thread:mcp-orchestrator-parent\" sent this message, not the user.]\n\nComplete the queued follow-up and return the final result.","type":"text"}],"model":"gpt-5.4","sandboxPolicy":{"type":"dangerFullAccess"},"threadId":"019f1000-0000-7000-8000-000000000003","approvalsReviewer":"user","summary":"auto","collaborationMode":{"mode":"default","settings":{"model":"gpt-5.4"}}}}} +{"type":"emit_inbound","label":"child.queued.turn/start","frame":{"id":16,"result":{"turn":{"id":"019f1000-0000-7000-8000-000000000006","items":[],"status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"child.queued.thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"019f1000-0000-7000-8000-000000000003","status":{"type":"active","activeFlags":[]}}}} {"type":"emit_inbound","label":"child.queued.turn/started","frame":{"method":"turn/started","params":{"threadId":"019f1000-0000-7000-8000-000000000003","turn":{"id":"019f1000-0000-7000-8000-000000000006","items":[],"status":"inProgress","error":null,"startedAt":1776739472,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"child.queued.item/started","frame":{"method":"item/started","params":{"item":{"type":"agentMessage","id":"msg_delegated_task_status_queued","text":"","phase":"final_answer","memoryCitation":null},"threadId":"019f1000-0000-7000-8000-000000000003","turnId":"019f1000-0000-7000-8000-000000000006"}}} diff --git a/apps/server/src/orchestration-v2/testkit/fixtures/message_steering/codex_transcript.ndjson b/apps/server/src/orchestration-v2/testkit/fixtures/message_steering/codex_transcript.ndjson index 04326cba7f59d..2afc2bf567e6e 100644 --- a/apps/server/src/orchestration-v2/testkit/fixtures/message_steering/codex_transcript.ndjson +++ b/apps/server/src/orchestration-v2/testkit/fixtures/message_steering/codex_transcript.ndjson @@ -2,24 +2,26 @@ {"type":"expect_outbound","label":"initialize","frame":{"id":1,"method":"initialize","params":{"capabilities":{"experimentalApi":true,"optOutNotificationMethods":["turn/diff/updated"],"extensions":{"io.modelcontextprotocol/ui":{"mimeTypes":["text/html;profile=mcp-app"]}}},"clientInfo":{"name":"T3 Code","title":"T3 Code","version":"0.0.44"}}}} {"type":"emit_inbound","label":"initialize","frame":{"id":1,"result":{"userAgent":"t3code_desktop/0.156.1 (Debian 13.0.0; x86_64) unknown (t3code_desktop; 0.1.0)","codexHome":"/home/replay-user/.codex","platformFamily":"unix","platformOs":"linux"}}} {"type":"expect_outbound","label":"initialized","frame":{"method":"initialized"}} -{"type":"expect_outbound","label":"thread/start","frame":{"id":2,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","model":"gpt-6-luna"}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":2,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":2,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"thread/start","frame":{"id":3,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","model":"gpt-6-luna"}}} {"type":"emit_inbound","label":"configWarning","frame":{"method":"configWarning","params":{"summary":"Codex could not find bubblewrap on PATH. Install bubblewrap with your OS package manager. See the sandbox prerequisites: https://developers.openai.com/codex/concepts/sandboxing#prerequisites. Codex will use the bundled bubblewrap in the meantime.","details":null},"emittedAtMs":1790295500250}} {"type":"emit_inbound","label":"remoteControl/status/changed","frame":{"method":"remoteControl/status/changed","params":{"status":"disabled","serverName":"replay-host","installationId":"00000000-0000-4000-8000-000000000000","environmentId":null},"emittedAtMs":1790295500250}} -{"type":"emit_inbound","label":"thread/start","frame":{"id":2,"result":{"thread":{"id":"01a0d5ed-65ea-7d42-b8e9-d06f045cfa86","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5ed-65ea-7d42-b8e9-d06f045cfa86","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790295500,"updatedAt":1790295500,"recencyAt":1790295500,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-18-20-01a0d5ed-65ea-7d42-b8e9-d06f045cfa86.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"],"instructionSources":["/home/replay-user/.codex/AGENTS.md","/home/replay-user/t3code/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} -{"type":"expect_outbound","label":"thread/name/set","frame":{"id":3,"method":"thread/name/set","params":{"name":"Replay fixture: message_steering","threadId":"01a0d5ed-65ea-7d42-b8e9-d06f045cfa86"}}} -{"type":"emit_inbound","label":"thread/name/set","frame":{"id":3,"result":{}}} +{"type":"emit_inbound","label":"thread/start","frame":{"id":3,"result":{"thread":{"id":"01a0d5ed-65ea-7d42-b8e9-d06f045cfa86","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5ed-65ea-7d42-b8e9-d06f045cfa86","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790295500,"updatedAt":1790295500,"recencyAt":1790295500,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-18-20-01a0d5ed-65ea-7d42-b8e9-d06f045cfa86.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"],"instructionSources":["/home/replay-user/.codex/AGENTS.md","/home/replay-user/t3code/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} +{"type":"expect_outbound","label":"thread/name/set","frame":{"id":4,"method":"thread/name/set","params":{"name":"Replay fixture: message_steering","threadId":"01a0d5ed-65ea-7d42-b8e9-d06f045cfa86"}}} +{"type":"emit_inbound","label":"thread/name/set","frame":{"id":4,"result":{}}} {"type":"emit_inbound","label":"thread/name/updated","frame":{"method":"thread/name/updated","params":{"threadId":"01a0d5ed-65ea-7d42-b8e9-d06f045cfa86","threadName":"Replay fixture: message_steering"}}} -{"type":"expect_outbound","label":"config/read","frame":{"id":4,"method":"config/read","params":{"cwd":"","includeLayers":false}}} -{"type":"emit_inbound","label":"config/read","frame":{"id":4,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"turn/start","frame":{"id":5,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Respond with exactly: steering fixture initial response","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0d5ed-65ea-7d42-b8e9-d06f045cfa86","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":5,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":5,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"turn/start","frame":{"id":6,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Respond with exactly: steering fixture initial response","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0d5ed-65ea-7d42-b8e9-d06f045cfa86","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} {"type":"emit_inbound","label":"thread/started","frame":{"method":"thread/started","params":{"thread":{"id":"01a0d5ed-65ea-7d42-b8e9-d06f045cfa86","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5ed-65ea-7d42-b8e9-d06f045cfa86","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790295500,"updatedAt":1790295500,"recencyAt":1790295500,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-18-20-01a0d5ed-65ea-7d42-b8e9-d06f045cfa86.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]}},"emittedAtMs":1790295500547}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0d5ed-65ea-7d42-b8e9-d06f045cfa86","name":"codex_apps","status":"starting","error":null,"failureReason":null},"emittedAtMs":1790295500547}} {"type":"emit_inbound","label":"thread/settings/updated","frame":{"method":"thread/settings/updated","params":{"threadId":"01a0d5ed-65ea-7d42-b8e9-d06f045cfa86","threadSettings":{"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","approvalPolicy":"never","approvalsReviewer":"user","sandboxPolicy":{"type":"dangerFullAccess"},"activePermissionProfile":null,"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"effort":null,"summary":"detailed","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna","reasoning_effort":null,"developer_instructions":null}},"multiAgentMode":"explicitRequestOnly","personality":null}},"emittedAtMs":1790295500567}} -{"type":"emit_inbound","label":"turn/start","frame":{"id":5,"result":{"turn":{"id":"01a0d5ed-670e-7032-9a87-707c736491a6","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"emit_inbound","label":"turn/start","frame":{"id":6,"result":{"turn":{"id":"01a0d5ed-670e-7032-9a87-707c736491a6","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0d5ed-65ea-7d42-b8e9-d06f045cfa86","status":{"type":"active","activeFlags":[]}},"emittedAtMs":1790295500626}} {"type":"emit_inbound","label":"turn/started","frame":{"method":"turn/started","params":{"threadId":"01a0d5ed-65ea-7d42-b8e9-d06f045cfa86","turn":{"id":"01a0d5ed-670e-7032-9a87-707c736491a6","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":1790295500,"completedAt":null,"durationMs":null}},"emittedAtMs":1790295500626}} -{"type":"expect_outbound","label":"turn/steer","frame":{"id":6,"method":"turn/steer","params":{"expectedTurnId":"01a0d5ed-670e-7032-9a87-707c736491a6","input":[{"text":"Actually, respond with exactly: steering fixture observed","type":"text"}],"threadId":"01a0d5ed-65ea-7d42-b8e9-d06f045cfa86"}}} -{"type":"emit_inbound","label":"turn/steer","frame":{"id":6,"result":{"turnId":"01a0d5ed-670e-7032-9a87-707c736491a6"}}} +{"type":"expect_outbound","label":"turn/steer","frame":{"id":7,"method":"turn/steer","params":{"expectedTurnId":"01a0d5ed-670e-7032-9a87-707c736491a6","input":[{"text":"Actually, respond with exactly: steering fixture observed","type":"text"}],"threadId":"01a0d5ed-65ea-7d42-b8e9-d06f045cfa86"}}} +{"type":"emit_inbound","label":"turn/steer","frame":{"id":7,"result":{"turnId":"01a0d5ed-670e-7032-9a87-707c736491a6"}}} {"type":"emit_inbound","label":"account/updated","frame":{"method":"account/updated","params":{"authMode":"chatgpt","planType":"unknown"},"emittedAtMs":1790295500936}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0d5ed-65ea-7d42-b8e9-d06f045cfa86","name":"xcodebuildmcp","status":"starting","error":null,"failureReason":null},"emittedAtMs":1790295501151}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0d5ed-65ea-7d42-b8e9-d06f045cfa86","name":"codex_apps","status":"ready","error":null,"failureReason":null},"emittedAtMs":1790295501388}} diff --git a/apps/server/src/orchestration-v2/testkit/fixtures/multi_turn/codex_transcript.ndjson b/apps/server/src/orchestration-v2/testkit/fixtures/multi_turn/codex_transcript.ndjson index 47194cff98a1d..58604e829fc67 100644 --- a/apps/server/src/orchestration-v2/testkit/fixtures/multi_turn/codex_transcript.ndjson +++ b/apps/server/src/orchestration-v2/testkit/fixtures/multi_turn/codex_transcript.ndjson @@ -2,20 +2,22 @@ {"type":"expect_outbound","label":"initialize","frame":{"id":1,"method":"initialize","params":{"capabilities":{"experimentalApi":true,"optOutNotificationMethods":["turn/diff/updated"],"extensions":{"io.modelcontextprotocol/ui":{"mimeTypes":["text/html;profile=mcp-app"]}}},"clientInfo":{"name":"T3 Code","title":"T3 Code","version":"0.0.44"}}}} {"type":"emit_inbound","label":"initialize","frame":{"id":1,"result":{"userAgent":"t3code_desktop/0.156.1 (Debian 13.0.0; x86_64) unknown (t3code_desktop; 0.1.0)","codexHome":"/home/replay-user/.codex","platformFamily":"unix","platformOs":"linux"}}} {"type":"expect_outbound","label":"initialized","frame":{"method":"initialized"}} -{"type":"expect_outbound","label":"thread/start","frame":{"id":2,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","model":"gpt-6-luna"}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":2,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":2,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"thread/start","frame":{"id":3,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","model":"gpt-6-luna"}}} {"type":"emit_inbound","label":"configWarning","frame":{"method":"configWarning","params":{"summary":"Codex could not find bubblewrap on PATH. Install bubblewrap with your OS package manager. See the sandbox prerequisites: https://developers.openai.com/codex/concepts/sandboxing#prerequisites. Codex will use the bundled bubblewrap in the meantime.","details":null},"emittedAtMs":1790295480414}} {"type":"emit_inbound","label":"remoteControl/status/changed","frame":{"method":"remoteControl/status/changed","params":{"status":"disabled","serverName":"replay-host","installationId":"00000000-0000-4000-8000-000000000000","environmentId":null},"emittedAtMs":1790295480414}} -{"type":"emit_inbound","label":"thread/start","frame":{"id":2,"result":{"thread":{"id":"01a0d5ed-187d-70c2-b4b6-b6881a68de09","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5ed-187d-70c2-b4b6-b6881a68de09","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790295480,"updatedAt":1790295480,"recencyAt":1790295480,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-18-00-01a0d5ed-187d-70c2-b4b6-b6881a68de09.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"],"instructionSources":["/home/replay-user/.codex/AGENTS.md","/home/replay-user/t3code/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} -{"type":"expect_outbound","label":"thread/name/set","frame":{"id":3,"method":"thread/name/set","params":{"name":"Replay fixture: multi_turn","threadId":"01a0d5ed-187d-70c2-b4b6-b6881a68de09"}}} -{"type":"emit_inbound","label":"thread/name/set","frame":{"id":3,"result":{}}} +{"type":"emit_inbound","label":"thread/start","frame":{"id":3,"result":{"thread":{"id":"01a0d5ed-187d-70c2-b4b6-b6881a68de09","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5ed-187d-70c2-b4b6-b6881a68de09","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790295480,"updatedAt":1790295480,"recencyAt":1790295480,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-18-00-01a0d5ed-187d-70c2-b4b6-b6881a68de09.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"],"instructionSources":["/home/replay-user/.codex/AGENTS.md","/home/replay-user/t3code/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} +{"type":"expect_outbound","label":"thread/name/set","frame":{"id":4,"method":"thread/name/set","params":{"name":"Replay fixture: multi_turn","threadId":"01a0d5ed-187d-70c2-b4b6-b6881a68de09"}}} +{"type":"emit_inbound","label":"thread/name/set","frame":{"id":4,"result":{}}} {"type":"emit_inbound","label":"thread/name/updated","frame":{"method":"thread/name/updated","params":{"threadId":"01a0d5ed-187d-70c2-b4b6-b6881a68de09","threadName":"Replay fixture: multi_turn"}}} -{"type":"expect_outbound","label":"config/read","frame":{"id":4,"method":"config/read","params":{"cwd":"","includeLayers":false}}} -{"type":"emit_inbound","label":"config/read","frame":{"id":4,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"turn/start","frame":{"id":5,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Respond with exactly: first fixture turn complete","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0d5ed-187d-70c2-b4b6-b6881a68de09","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":5,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":5,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"turn/start","frame":{"id":6,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Respond with exactly: first fixture turn complete","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0d5ed-187d-70c2-b4b6-b6881a68de09","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} {"type":"emit_inbound","label":"thread/started","frame":{"method":"thread/started","params":{"thread":{"id":"01a0d5ed-187d-70c2-b4b6-b6881a68de09","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5ed-187d-70c2-b4b6-b6881a68de09","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790295480,"updatedAt":1790295480,"recencyAt":1790295480,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-18-00-01a0d5ed-187d-70c2-b4b6-b6881a68de09.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]}},"emittedAtMs":1790295480656}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0d5ed-187d-70c2-b4b6-b6881a68de09","name":"codex_apps","status":"starting","error":null,"failureReason":null},"emittedAtMs":1790295480656}} {"type":"emit_inbound","label":"thread/settings/updated","frame":{"method":"thread/settings/updated","params":{"threadId":"01a0d5ed-187d-70c2-b4b6-b6881a68de09","threadSettings":{"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","approvalPolicy":"never","approvalsReviewer":"user","sandboxPolicy":{"type":"dangerFullAccess"},"activePermissionProfile":null,"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"effort":null,"summary":"detailed","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna","reasoning_effort":null,"developer_instructions":null}},"multiAgentMode":"explicitRequestOnly","personality":null}},"emittedAtMs":1790295480666}} -{"type":"emit_inbound","label":"turn/start","frame":{"id":5,"result":{"turn":{"id":"01a0d5ed-1957-7a22-8399-d0172af342fd","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"emit_inbound","label":"turn/start","frame":{"id":6,"result":{"turn":{"id":"01a0d5ed-1957-7a22-8399-d0172af342fd","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0d5ed-187d-70c2-b4b6-b6881a68de09","status":{"type":"active","activeFlags":[]}},"emittedAtMs":1790295480718}} {"type":"emit_inbound","label":"turn/started","frame":{"method":"turn/started","params":{"threadId":"01a0d5ed-187d-70c2-b4b6-b6881a68de09","turn":{"id":"01a0d5ed-1957-7a22-8399-d0172af342fd","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":1790295480,"completedAt":null,"durationMs":null}},"emittedAtMs":1790295480718}} {"type":"emit_inbound","label":"account/updated","frame":{"method":"account/updated","params":{"authMode":"chatgpt","planType":"unknown"},"emittedAtMs":1790295481015}} @@ -32,11 +34,11 @@ {"type":"emit_inbound","label":"thread/tokenUsage/updated","frame":{"method":"thread/tokenUsage/updated","params":{"threadId":"01a0d5ed-187d-70c2-b4b6-b6881a68de09","turnId":"01a0d5ed-1957-7a22-8399-d0172af342fd","tokenUsage":{"total":{"totalTokens":21426,"inputTokens":21418,"cachedInputTokens":6912,"cacheWriteInputTokens":0,"outputTokens":8,"reasoningOutputTokens":0},"last":{"totalTokens":21426,"inputTokens":21418,"cachedInputTokens":6912,"cacheWriteInputTokens":0,"outputTokens":8,"reasoningOutputTokens":0},"modelContextWindow":258400}},"emittedAtMs":1790295485211}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0d5ed-187d-70c2-b4b6-b6881a68de09","status":{"type":"idle"}},"emittedAtMs":1790295485220}} {"type":"emit_inbound","label":"turn/completed","frame":{"method":"turn/completed","params":{"threadId":"01a0d5ed-187d-70c2-b4b6-b6881a68de09","turn":{"id":"01a0d5ed-1957-7a22-8399-d0172af342fd","items":[{"type":"agentMessage","id":"msg_06900ecb02a780a6016ab5bdbcd76887d0ba52ca8fee9da2e1","text":"first fixture turn complete","phase":"final_answer","memoryCitation":null,"delivery":null,"questions":null}],"itemsView":"summary","status":"completed","error":null,"startedAt":1790295480,"completedAt":1790295485,"durationMs":4550}},"emittedAtMs":1790295485220}} -{"type":"expect_outbound","label":"config/read","frame":{"id":6,"method":"config/read","params":{"cwd":"","includeLayers":false}}} -{"type":"emit_inbound","label":"config/read","frame":{"id":6,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"turn/start","frame":{"id":7,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Respond with exactly: second fixture turn complete","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0d5ed-187d-70c2-b4b6-b6881a68de09","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":7,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":7,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"turn/start","frame":{"id":8,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Respond with exactly: second fixture turn complete","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0d5ed-187d-70c2-b4b6-b6881a68de09","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0d5ed-187d-70c2-b4b6-b6881a68de09","name":"xcodebuildmcp","status":"ready","error":null,"failureReason":null},"emittedAtMs":1790295485265}} -{"type":"emit_inbound","label":"turn/start","frame":{"id":7,"result":{"turn":{"id":"01a0d5ed-2b29-7353-a6d5-7745731173b7","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"emit_inbound","label":"turn/start","frame":{"id":8,"result":{"turn":{"id":"01a0d5ed-2b29-7353-a6d5-7745731173b7","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0d5ed-187d-70c2-b4b6-b6881a68de09","status":{"type":"active","activeFlags":[]}},"emittedAtMs":1790295485286}} {"type":"emit_inbound","label":"turn/started","frame":{"method":"turn/started","params":{"threadId":"01a0d5ed-187d-70c2-b4b6-b6881a68de09","turn":{"id":"01a0d5ed-2b29-7353-a6d5-7745731173b7","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":1790295485,"completedAt":null,"durationMs":null}},"emittedAtMs":1790295485286}} {"type":"emit_inbound","label":"item/started","frame":{"method":"item/started","params":{"item":{"type":"userMessage","id":"01a0d5ed-2bdf-7093-9e82-b961af1fe132","clientId":null,"content":[{"type":"text","text":"Respond with exactly: second fixture turn complete","text_elements":[]}]},"threadId":"01a0d5ed-187d-70c2-b4b6-b6881a68de09","turnId":"01a0d5ed-2b29-7353-a6d5-7745731173b7","startedAtMs":1790295485409},"emittedAtMs":1790295485409}} diff --git a/apps/server/src/orchestration-v2/testkit/fixtures/plan_questions/codex_transcript.ndjson b/apps/server/src/orchestration-v2/testkit/fixtures/plan_questions/codex_transcript.ndjson index b44351ebb9ce3..6d359da0b323f 100644 --- a/apps/server/src/orchestration-v2/testkit/fixtures/plan_questions/codex_transcript.ndjson +++ b/apps/server/src/orchestration-v2/testkit/fixtures/plan_questions/codex_transcript.ndjson @@ -2,20 +2,22 @@ {"type":"expect_outbound","label":"initialize","frame":{"id":1,"method":"initialize","params":{"capabilities":{"experimentalApi":true,"optOutNotificationMethods":["turn/diff/updated"],"extensions":{"io.modelcontextprotocol/ui":{"mimeTypes":["text/html;profile=mcp-app"]}}},"clientInfo":{"name":"T3 Code","title":"T3 Code","version":"0.0.44"}}}} {"type":"emit_inbound","label":"initialize","frame":{"id":1,"result":{"userAgent":"t3code_desktop/0.156.1 (Debian 13.0.0; x86_64) unknown (t3code_desktop; 0.1.0)","codexHome":"/home/replay-user/.codex","platformFamily":"unix","platformOs":"linux"}}} {"type":"expect_outbound","label":"initialized","frame":{"method":"initialized"}} -{"type":"expect_outbound","label":"thread/start","frame":{"id":2,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","model":"gpt-6-luna"}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":2,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":2,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"thread/start","frame":{"id":3,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","model":"gpt-6-luna"}}} {"type":"emit_inbound","label":"configWarning","frame":{"method":"configWarning","params":{"summary":"Codex could not find bubblewrap on PATH. Install bubblewrap with your OS package manager. See the sandbox prerequisites: https://developers.openai.com/codex/concepts/sandboxing#prerequisites. Codex will use the bundled bubblewrap in the meantime.","details":null},"emittedAtMs":1790295620180}} {"type":"emit_inbound","label":"remoteControl/status/changed","frame":{"method":"remoteControl/status/changed","params":{"status":"disabled","serverName":"replay-host","installationId":"00000000-0000-4000-8000-000000000000","environmentId":null},"emittedAtMs":1790295620180}} -{"type":"emit_inbound","label":"thread/start","frame":{"id":2,"result":{"thread":{"id":"01a0d5ef-3a6a-75d0-9942-61b29ab82328","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5ef-3a6a-75d0-9942-61b29ab82328","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790295620,"updatedAt":1790295620,"recencyAt":1790295620,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-20-20-01a0d5ef-3a6a-75d0-9942-61b29ab82328.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"],"instructionSources":["/home/replay-user/.codex/AGENTS.md","/home/replay-user/t3code/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} -{"type":"expect_outbound","label":"thread/name/set","frame":{"id":3,"method":"thread/name/set","params":{"name":"Replay fixture: plan_questions","threadId":"01a0d5ef-3a6a-75d0-9942-61b29ab82328"}}} -{"type":"emit_inbound","label":"thread/name/set","frame":{"id":3,"result":{}}} +{"type":"emit_inbound","label":"thread/start","frame":{"id":3,"result":{"thread":{"id":"01a0d5ef-3a6a-75d0-9942-61b29ab82328","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5ef-3a6a-75d0-9942-61b29ab82328","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790295620,"updatedAt":1790295620,"recencyAt":1790295620,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-20-20-01a0d5ef-3a6a-75d0-9942-61b29ab82328.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"],"instructionSources":["/home/replay-user/.codex/AGENTS.md","/home/replay-user/t3code/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} +{"type":"expect_outbound","label":"thread/name/set","frame":{"id":4,"method":"thread/name/set","params":{"name":"Replay fixture: plan_questions","threadId":"01a0d5ef-3a6a-75d0-9942-61b29ab82328"}}} +{"type":"emit_inbound","label":"thread/name/set","frame":{"id":4,"result":{}}} {"type":"emit_inbound","label":"thread/name/updated","frame":{"method":"thread/name/updated","params":{"threadId":"01a0d5ef-3a6a-75d0-9942-61b29ab82328","threadName":"Replay fixture: plan_questions"}}} -{"type":"expect_outbound","label":"config/read","frame":{"id":4,"method":"config/read","params":{"cwd":"","includeLayers":false}}} -{"type":"emit_inbound","label":"config/read","frame":{"id":4,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"turn/start","frame":{"id":5,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Use request_user_input to ask one multiple-choice clarifying question about whether this fixture should prefer strict schemas or UI flexibility. After receiving the answer, respond exactly: plan questions fixture complete","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"networkAccess":false,"type":"readOnly"},"summary":"auto","threadId":"01a0d5ef-3a6a-75d0-9942-61b29ab82328","collaborationMode":{"mode":"plan","settings":{"model":"gpt-6-luna"}}}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":5,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":5,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"turn/start","frame":{"id":6,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Use request_user_input to ask one multiple-choice clarifying question about whether this fixture should prefer strict schemas or UI flexibility. After receiving the answer, respond exactly: plan questions fixture complete","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"networkAccess":false,"type":"readOnly"},"summary":"auto","threadId":"01a0d5ef-3a6a-75d0-9942-61b29ab82328","collaborationMode":{"mode":"plan","settings":{"model":"gpt-6-luna"}}}}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0d5ef-3a6a-75d0-9942-61b29ab82328","name":"codex_apps","status":"starting","error":null,"failureReason":null},"emittedAtMs":1790295620428}} {"type":"emit_inbound","label":"thread/started","frame":{"method":"thread/started","params":{"thread":{"id":"01a0d5ef-3a6a-75d0-9942-61b29ab82328","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5ef-3a6a-75d0-9942-61b29ab82328","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790295620,"updatedAt":1790295620,"recencyAt":1790295620,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-20-20-01a0d5ef-3a6a-75d0-9942-61b29ab82328.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]}},"emittedAtMs":1790295620428}} {"type":"emit_inbound","label":"thread/settings/updated","frame":{"method":"thread/settings/updated","params":{"threadId":"01a0d5ef-3a6a-75d0-9942-61b29ab82328","threadSettings":{"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","approvalPolicy":"never","approvalsReviewer":"user","sandboxPolicy":{"type":"readOnly","networkAccess":false},"activePermissionProfile":null,"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"effort":"medium","summary":"detailed","collaborationMode":{"mode":"plan","settings":{"model":"gpt-6-luna","reasoning_effort":"medium","developer_instructions":"You are in Plan mode. Prefer request_user_input for clarifying questions. When presenting a complete plan, wrap it in and ."}},"multiAgentMode":"explicitRequestOnly","personality":null}},"emittedAtMs":1790295620457}} -{"type":"emit_inbound","label":"turn/start","frame":{"id":5,"result":{"turn":{"id":"01a0d5ef-3b5a-7bb2-9cd2-da112b6b158f","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"emit_inbound","label":"turn/start","frame":{"id":6,"result":{"turn":{"id":"01a0d5ef-3b5a-7bb2-9cd2-da112b6b158f","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0d5ef-3a6a-75d0-9942-61b29ab82328","status":{"type":"active","activeFlags":[]}},"emittedAtMs":1790295620520}} {"type":"emit_inbound","label":"turn/started","frame":{"method":"turn/started","params":{"threadId":"01a0d5ef-3a6a-75d0-9942-61b29ab82328","turn":{"id":"01a0d5ef-3b5a-7bb2-9cd2-da112b6b158f","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":1790295620,"completedAt":null,"durationMs":null}},"emittedAtMs":1790295620520}} {"type":"emit_inbound","label":"account/updated","frame":{"method":"account/updated","params":{"authMode":"chatgpt","planType":"unknown"},"emittedAtMs":1790295620774}} diff --git a/apps/server/src/orchestration-v2/testkit/fixtures/proposed_plan/codex_transcript.ndjson b/apps/server/src/orchestration-v2/testkit/fixtures/proposed_plan/codex_transcript.ndjson index 01e59956ea15f..6c8caa4672e61 100644 --- a/apps/server/src/orchestration-v2/testkit/fixtures/proposed_plan/codex_transcript.ndjson +++ b/apps/server/src/orchestration-v2/testkit/fixtures/proposed_plan/codex_transcript.ndjson @@ -2,20 +2,22 @@ {"type":"expect_outbound","label":"initialize","frame":{"id":1,"method":"initialize","params":{"capabilities":{"experimentalApi":true,"optOutNotificationMethods":["turn/diff/updated"],"extensions":{"io.modelcontextprotocol/ui":{"mimeTypes":["text/html;profile=mcp-app"]}}},"clientInfo":{"name":"T3 Code","title":"T3 Code","version":"0.0.44"}}}} {"type":"emit_inbound","label":"initialize","frame":{"id":1,"result":{"userAgent":"t3code_desktop/0.156.1 (Debian 13.0.0; x86_64) unknown (t3code_desktop; 0.1.0)","codexHome":"/home/replay-user/.codex","platformFamily":"unix","platformOs":"linux"}}} {"type":"expect_outbound","label":"initialized","frame":{"method":"initialized"}} -{"type":"expect_outbound","label":"thread/start","frame":{"id":2,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","model":"gpt-6-luna"}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":2,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":2,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"thread/start","frame":{"id":3,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","model":"gpt-6-luna"}}} {"type":"emit_inbound","label":"configWarning","frame":{"method":"configWarning","params":{"summary":"Codex could not find bubblewrap on PATH. Install bubblewrap with your OS package manager. See the sandbox prerequisites: https://developers.openai.com/codex/concepts/sandboxing#prerequisites. Codex will use the bundled bubblewrap in the meantime.","details":null},"emittedAtMs":1790295608195}} {"type":"emit_inbound","label":"remoteControl/status/changed","frame":{"method":"remoteControl/status/changed","params":{"status":"disabled","serverName":"replay-host","installationId":"00000000-0000-4000-8000-000000000000","environmentId":null},"emittedAtMs":1790295608195}} -{"type":"emit_inbound","label":"thread/start","frame":{"id":2,"result":{"thread":{"id":"01a0d5ef-0ba3-7552-b090-7cfbb328e278","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5ef-0ba3-7552-b090-7cfbb328e278","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790295608,"updatedAt":1790295608,"recencyAt":1790295608,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-20-08-01a0d5ef-0ba3-7552-b090-7cfbb328e278.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"],"instructionSources":["/home/replay-user/.codex/AGENTS.md","/home/replay-user/t3code/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} -{"type":"expect_outbound","label":"thread/name/set","frame":{"id":3,"method":"thread/name/set","params":{"name":"Replay fixture: proposed_plan","threadId":"01a0d5ef-0ba3-7552-b090-7cfbb328e278"}}} -{"type":"emit_inbound","label":"thread/name/set","frame":{"id":3,"result":{}}} +{"type":"emit_inbound","label":"thread/start","frame":{"id":3,"result":{"thread":{"id":"01a0d5ef-0ba3-7552-b090-7cfbb328e278","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5ef-0ba3-7552-b090-7cfbb328e278","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790295608,"updatedAt":1790295608,"recencyAt":1790295608,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-20-08-01a0d5ef-0ba3-7552-b090-7cfbb328e278.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"],"instructionSources":["/home/replay-user/.codex/AGENTS.md","/home/replay-user/t3code/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} +{"type":"expect_outbound","label":"thread/name/set","frame":{"id":4,"method":"thread/name/set","params":{"name":"Replay fixture: proposed_plan","threadId":"01a0d5ef-0ba3-7552-b090-7cfbb328e278"}}} +{"type":"emit_inbound","label":"thread/name/set","frame":{"id":4,"result":{}}} {"type":"emit_inbound","label":"thread/name/updated","frame":{"method":"thread/name/updated","params":{"threadId":"01a0d5ef-0ba3-7552-b090-7cfbb328e278","threadName":"Replay fixture: proposed_plan"}}} -{"type":"expect_outbound","label":"config/read","frame":{"id":4,"method":"config/read","params":{"cwd":"","includeLayers":false}}} -{"type":"emit_inbound","label":"config/read","frame":{"id":4,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"turn/start","frame":{"id":5,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Create a short implementation plan for adding deterministic replay fixtures. Do not ask questions. Present the final plan in a proposed plan block.","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"networkAccess":false,"type":"readOnly"},"summary":"auto","threadId":"01a0d5ef-0ba3-7552-b090-7cfbb328e278","collaborationMode":{"mode":"plan","settings":{"model":"gpt-6-luna"}}}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":5,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":5,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"turn/start","frame":{"id":6,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Create a short implementation plan for adding deterministic replay fixtures. Do not ask questions. Present the final plan in a proposed plan block.","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"networkAccess":false,"type":"readOnly"},"summary":"auto","threadId":"01a0d5ef-0ba3-7552-b090-7cfbb328e278","collaborationMode":{"mode":"plan","settings":{"model":"gpt-6-luna"}}}}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0d5ef-0ba3-7552-b090-7cfbb328e278","name":"codex_apps","status":"starting","error":null,"failureReason":null},"emittedAtMs":1790295608443}} {"type":"emit_inbound","label":"thread/started","frame":{"method":"thread/started","params":{"thread":{"id":"01a0d5ef-0ba3-7552-b090-7cfbb328e278","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5ef-0ba3-7552-b090-7cfbb328e278","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790295608,"updatedAt":1790295608,"recencyAt":1790295608,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-20-08-01a0d5ef-0ba3-7552-b090-7cfbb328e278.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]}},"emittedAtMs":1790295608443}} {"type":"emit_inbound","label":"thread/settings/updated","frame":{"method":"thread/settings/updated","params":{"threadId":"01a0d5ef-0ba3-7552-b090-7cfbb328e278","threadSettings":{"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","approvalPolicy":"never","approvalsReviewer":"user","sandboxPolicy":{"type":"readOnly","networkAccess":false},"activePermissionProfile":null,"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"effort":"medium","summary":"detailed","collaborationMode":{"mode":"plan","settings":{"model":"gpt-6-luna","reasoning_effort":"medium","developer_instructions":"You are in Plan mode. Prefer request_user_input for clarifying questions. When presenting a complete plan, wrap it in and ."}},"multiAgentMode":"explicitRequestOnly","personality":null}},"emittedAtMs":1790295608464}} -{"type":"emit_inbound","label":"turn/start","frame":{"id":5,"result":{"turn":{"id":"01a0d5ef-0c85-7f41-ad02-13753158be02","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"emit_inbound","label":"turn/start","frame":{"id":6,"result":{"turn":{"id":"01a0d5ef-0c85-7f41-ad02-13753158be02","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0d5ef-0ba3-7552-b090-7cfbb328e278","status":{"type":"active","activeFlags":[]}},"emittedAtMs":1790295608547}} {"type":"emit_inbound","label":"turn/started","frame":{"method":"turn/started","params":{"threadId":"01a0d5ef-0ba3-7552-b090-7cfbb328e278","turn":{"id":"01a0d5ef-0c85-7f41-ad02-13753158be02","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":1790295608,"completedAt":null,"durationMs":null}},"emittedAtMs":1790295608548}} {"type":"emit_inbound","label":"account/updated","frame":{"method":"account/updated","params":{"authMode":"chatgpt","planType":"unknown"},"emittedAtMs":1790295608936}} diff --git a/apps/server/src/orchestration-v2/testkit/fixtures/provider_thread_resume/codex_transcript.ndjson b/apps/server/src/orchestration-v2/testkit/fixtures/provider_thread_resume/codex_transcript.ndjson index 38a7a83c45fc5..46da729181c58 100644 --- a/apps/server/src/orchestration-v2/testkit/fixtures/provider_thread_resume/codex_transcript.ndjson +++ b/apps/server/src/orchestration-v2/testkit/fixtures/provider_thread_resume/codex_transcript.ndjson @@ -2,20 +2,22 @@ {"type":"expect_outbound","label":"initialize","frame":{"id":1,"method":"initialize","params":{"capabilities":{"experimentalApi":true,"optOutNotificationMethods":["turn/diff/updated"],"extensions":{"io.modelcontextprotocol/ui":{"mimeTypes":["text/html;profile=mcp-app"]}}},"clientInfo":{"name":"T3 Code","title":"T3 Code","version":"0.0.44"}}}} {"type":"emit_inbound","label":"initialize","frame":{"id":1,"result":{"userAgent":"t3code_desktop/0.156.1 (Debian 13.0.0; x86_64) unknown (t3code_desktop; 0.1.0)","codexHome":"/home/replay-user/.codex","platformFamily":"unix","platformOs":"linux"}}} {"type":"expect_outbound","label":"initialized","frame":{"method":"initialized"}} -{"type":"expect_outbound","label":"thread/start","frame":{"id":2,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","model":"gpt-6-luna"}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":2,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":2,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"thread/start","frame":{"id":3,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","model":"gpt-6-luna"}}} {"type":"emit_inbound","label":"configWarning","frame":{"method":"configWarning","params":{"summary":"Codex could not find bubblewrap on PATH. Install bubblewrap with your OS package manager. See the sandbox prerequisites: https://developers.openai.com/codex/concepts/sandboxing#prerequisites. Codex will use the bundled bubblewrap in the meantime.","details":null},"emittedAtMs":1790295630509}} {"type":"emit_inbound","label":"remoteControl/status/changed","frame":{"method":"remoteControl/status/changed","params":{"status":"disabled","serverName":"replay-host","installationId":"00000000-0000-4000-8000-000000000000","environmentId":null},"emittedAtMs":1790295630509}} -{"type":"emit_inbound","label":"thread/start","frame":{"id":2,"result":{"thread":{"id":"01a0d5ef-62bd-7c20-861b-0528ff7d86bd","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5ef-62bd-7c20-861b-0528ff7d86bd","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790295630,"updatedAt":1790295630,"recencyAt":1790295630,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-20-30-01a0d5ef-62bd-7c20-861b-0528ff7d86bd.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"],"instructionSources":["/home/replay-user/.codex/AGENTS.md","/home/replay-user/t3code/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} -{"type":"expect_outbound","label":"thread/name/set","frame":{"id":3,"method":"thread/name/set","params":{"name":"Replay fixture: provider_thread_resume","threadId":"01a0d5ef-62bd-7c20-861b-0528ff7d86bd"}}} -{"type":"emit_inbound","label":"thread/name/set","frame":{"id":3,"result":{}}} +{"type":"emit_inbound","label":"thread/start","frame":{"id":3,"result":{"thread":{"id":"01a0d5ef-62bd-7c20-861b-0528ff7d86bd","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5ef-62bd-7c20-861b-0528ff7d86bd","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790295630,"updatedAt":1790295630,"recencyAt":1790295630,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-20-30-01a0d5ef-62bd-7c20-861b-0528ff7d86bd.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"],"instructionSources":["/home/replay-user/.codex/AGENTS.md","/home/replay-user/t3code/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} +{"type":"expect_outbound","label":"thread/name/set","frame":{"id":4,"method":"thread/name/set","params":{"name":"Replay fixture: provider_thread_resume","threadId":"01a0d5ef-62bd-7c20-861b-0528ff7d86bd"}}} +{"type":"emit_inbound","label":"thread/name/set","frame":{"id":4,"result":{}}} {"type":"emit_inbound","label":"thread/name/updated","frame":{"method":"thread/name/updated","params":{"threadId":"01a0d5ef-62bd-7c20-861b-0528ff7d86bd","threadName":"Replay fixture: provider_thread_resume"}}} -{"type":"expect_outbound","label":"config/read","frame":{"id":4,"method":"config/read","params":{"cwd":"","includeLayers":false}}} -{"type":"emit_inbound","label":"config/read","frame":{"id":4,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"turn/start","frame":{"id":5,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Respond with exactly: provider thread resume fixture first turn complete","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0d5ef-62bd-7c20-861b-0528ff7d86bd","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":5,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":5,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"turn/start","frame":{"id":6,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Respond with exactly: provider thread resume fixture first turn complete","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0d5ef-62bd-7c20-861b-0528ff7d86bd","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0d5ef-62bd-7c20-861b-0528ff7d86bd","name":"codex_apps","status":"starting","error":null,"failureReason":null},"emittedAtMs":1790295630711}} {"type":"emit_inbound","label":"thread/started","frame":{"method":"thread/started","params":{"thread":{"id":"01a0d5ef-62bd-7c20-861b-0528ff7d86bd","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5ef-62bd-7c20-861b-0528ff7d86bd","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790295630,"updatedAt":1790295630,"recencyAt":1790295630,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-20-30-01a0d5ef-62bd-7c20-861b-0528ff7d86bd.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]}},"emittedAtMs":1790295630711}} {"type":"emit_inbound","label":"thread/settings/updated","frame":{"method":"thread/settings/updated","params":{"threadId":"01a0d5ef-62bd-7c20-861b-0528ff7d86bd","threadSettings":{"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","approvalPolicy":"never","approvalsReviewer":"user","sandboxPolicy":{"type":"dangerFullAccess"},"activePermissionProfile":null,"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"effort":null,"summary":"detailed","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna","reasoning_effort":null,"developer_instructions":null}},"multiAgentMode":"explicitRequestOnly","personality":null}},"emittedAtMs":1790295630725}} -{"type":"emit_inbound","label":"turn/start","frame":{"id":5,"result":{"turn":{"id":"01a0d5ef-637e-7ba2-bf9a-5534a6f98a83","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"emit_inbound","label":"turn/start","frame":{"id":6,"result":{"turn":{"id":"01a0d5ef-637e-7ba2-bf9a-5534a6f98a83","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0d5ef-62bd-7c20-861b-0528ff7d86bd","status":{"type":"active","activeFlags":[]}},"emittedAtMs":1790295630781}} {"type":"emit_inbound","label":"turn/started","frame":{"method":"turn/started","params":{"threadId":"01a0d5ef-62bd-7c20-861b-0528ff7d86bd","turn":{"id":"01a0d5ef-637e-7ba2-bf9a-5534a6f98a83","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":1790295630,"completedAt":null,"durationMs":null}},"emittedAtMs":1790295630781}} {"type":"emit_inbound","label":"account/updated","frame":{"method":"account/updated","params":{"authMode":"chatgpt","planType":"unknown"},"emittedAtMs":1790295631109}} @@ -40,22 +42,24 @@ {"type":"expect_outbound","label":"initialize","frame":{"id":1,"method":"initialize","params":{"capabilities":{"experimentalApi":true,"optOutNotificationMethods":["turn/diff/updated"],"extensions":{"io.modelcontextprotocol/ui":{"mimeTypes":["text/html;profile=mcp-app"]}}},"clientInfo":{"name":"T3 Code","title":"T3 Code","version":"0.0.44"}}}} {"type":"emit_inbound","label":"initialize","frame":{"id":1,"result":{"userAgent":"t3code_desktop/0.156.1 (Debian 13.0.0; x86_64) unknown (t3code_desktop; 0.1.0)","codexHome":"/home/replay-user/.codex","platformFamily":"unix","platformOs":"linux"}}} {"type":"expect_outbound","label":"initialized","frame":{"method":"initialized"}} -{"type":"expect_outbound","label":"thread/resume","frame":{"id":2,"method":"thread/resume","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","excludeTurns":true,"model":"gpt-6-luna","threadId":"01a0d5ef-62bd-7c20-861b-0528ff7d86bd"}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":2,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":2,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"thread/resume","frame":{"id":3,"method":"thread/resume","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","excludeTurns":true,"model":"gpt-6-luna","threadId":"01a0d5ef-62bd-7c20-861b-0528ff7d86bd"}}} {"type":"emit_inbound","label":"configWarning","frame":{"method":"configWarning","params":{"summary":"Codex could not find bubblewrap on PATH. Install bubblewrap with your OS package manager. See the sandbox prerequisites: https://developers.openai.com/codex/concepts/sandboxing#prerequisites. Codex will use the bundled bubblewrap in the meantime.","details":null},"emittedAtMs":1790295635636}} {"type":"emit_inbound","label":"remoteControl/status/changed","frame":{"method":"remoteControl/status/changed","params":{"status":"disabled","serverName":"replay-host","installationId":"00000000-0000-4000-8000-000000000000","environmentId":null},"emittedAtMs":1790295635636}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0d5ef-62bd-7c20-861b-0528ff7d86bd","name":"codex_apps","status":"starting","error":null,"failureReason":null},"emittedAtMs":1790295635910}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0d5ef-62bd-7c20-861b-0528ff7d86bd","status":{"type":"idle"}},"emittedAtMs":1790295635918}} -{"type":"emit_inbound","label":"thread/resume","frame":{"id":2,"result":{"thread":{"id":"01a0d5ef-62bd-7c20-861b-0528ff7d86bd","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5ef-62bd-7c20-861b-0528ff7d86bd","forkedFromId":null,"parentThreadId":null,"preview":"Respond with exactly: provider thread resume fixture first turn complete","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790295630,"updatedAt":1790295635,"recencyAt":1790295630,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-20-30-01a0d5ef-62bd-7c20-861b-0528ff7d86bd.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":{"sha":"1563a64b41d5e7e2e640b46f52cee724913f8851","branch":"v2/codex-gpt6-luna-rerecord","originUrl":"https://github.com/pingdotgg/t3code.git"},"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"],"instructionSources":["/home/replay-user/.codex/AGENTS.md","/home/replay-user/t3code/AGENTS.md"],"approvalPolicy":"never","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna","reasoning_effort":null,"developer_instructions":null}},"multiAgentMode":"explicitRequestOnly","initialTurnsPage":null,"turnsBackwardsCursor":"{\"requestedThreadId\":\"01a0d5ef-62bd-7c20-861b-0528ff7d86bd\",\"rolloutOrdinal\":1,\"includeAnchor\":true,\"scope\":{\"kind\":\"turns\"}}","itemsBackwardsCursor":"{\"requestedThreadId\":\"01a0d5ef-62bd-7c20-861b-0528ff7d86bd\",\"rolloutOrdinal\":10,\"includeAnchor\":true,\"scope\":{\"kind\":\"itemsByCreatedAtOrdinal\"}}"}}} -{"type":"expect_outbound","label":"thread/name/set","frame":{"id":3,"method":"thread/name/set","params":{"name":"Replay fixture: provider_thread_resume","threadId":"01a0d5ef-62bd-7c20-861b-0528ff7d86bd"}}} -{"type":"emit_inbound","label":"thread/name/set","frame":{"id":3,"result":{}}} +{"type":"emit_inbound","label":"thread/resume","frame":{"id":3,"result":{"thread":{"id":"01a0d5ef-62bd-7c20-861b-0528ff7d86bd","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5ef-62bd-7c20-861b-0528ff7d86bd","forkedFromId":null,"parentThreadId":null,"preview":"Respond with exactly: provider thread resume fixture first turn complete","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790295630,"updatedAt":1790295635,"recencyAt":1790295630,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-20-30-01a0d5ef-62bd-7c20-861b-0528ff7d86bd.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":{"sha":"1563a64b41d5e7e2e640b46f52cee724913f8851","branch":"v2/codex-gpt6-luna-rerecord","originUrl":"https://github.com/pingdotgg/t3code.git"},"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"],"instructionSources":["/home/replay-user/.codex/AGENTS.md","/home/replay-user/t3code/AGENTS.md"],"approvalPolicy":"never","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna","reasoning_effort":null,"developer_instructions":null}},"multiAgentMode":"explicitRequestOnly","initialTurnsPage":null,"turnsBackwardsCursor":"{\"requestedThreadId\":\"01a0d5ef-62bd-7c20-861b-0528ff7d86bd\",\"rolloutOrdinal\":1,\"includeAnchor\":true,\"scope\":{\"kind\":\"turns\"}}","itemsBackwardsCursor":"{\"requestedThreadId\":\"01a0d5ef-62bd-7c20-861b-0528ff7d86bd\",\"rolloutOrdinal\":10,\"includeAnchor\":true,\"scope\":{\"kind\":\"itemsByCreatedAtOrdinal\"}}"}}} +{"type":"expect_outbound","label":"thread/name/set","frame":{"id":4,"method":"thread/name/set","params":{"name":"Replay fixture: provider_thread_resume","threadId":"01a0d5ef-62bd-7c20-861b-0528ff7d86bd"}}} +{"type":"emit_inbound","label":"thread/name/set","frame":{"id":4,"result":{}}} {"type":"emit_inbound","label":"thread/name/updated","frame":{"method":"thread/name/updated","params":{"threadId":"01a0d5ef-62bd-7c20-861b-0528ff7d86bd","threadName":"Replay fixture: provider_thread_resume"}}} -{"type":"expect_outbound","label":"config/read","frame":{"id":4,"method":"config/read","params":{"cwd":"","includeLayers":false}}} -{"type":"emit_inbound","label":"config/read","frame":{"id":4,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"turn/start","frame":{"id":5,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Using the conversation history available in this resumed thread, first repeat the exact final answer you gave in the previous turn. Then on a new line write exactly: provider thread resume fixture second turn complete","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0d5ef-62bd-7c20-861b-0528ff7d86bd","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":5,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":5,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"turn/start","frame":{"id":6,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Using the conversation history available in this resumed thread, first repeat the exact final answer you gave in the previous turn. Then on a new line write exactly: provider thread resume fixture second turn complete","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0d5ef-62bd-7c20-861b-0528ff7d86bd","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} {"type":"emit_inbound","label":"thread/tokenUsage/updated","frame":{"method":"thread/tokenUsage/updated","params":{"threadId":"01a0d5ef-62bd-7c20-861b-0528ff7d86bd","turnId":"01a0d5ef-637e-7ba2-bf9a-5534a6f98a83","tokenUsage":{"total":{"totalTokens":21432,"inputTokens":21421,"cachedInputTokens":21248,"cacheWriteInputTokens":0,"outputTokens":11,"reasoningOutputTokens":0},"last":{"totalTokens":21432,"inputTokens":21421,"cachedInputTokens":21248,"cacheWriteInputTokens":0,"outputTokens":11,"reasoningOutputTokens":0},"modelContextWindow":258400}},"emittedAtMs":1790295635930}} {"type":"emit_inbound","label":"thread/goal/cleared","frame":{"method":"thread/goal/cleared","params":{"threadId":"01a0d5ef-62bd-7c20-861b-0528ff7d86bd"},"emittedAtMs":1790295635930}} {"type":"emit_inbound","label":"thread/settings/updated","frame":{"method":"thread/settings/updated","params":{"threadId":"01a0d5ef-62bd-7c20-861b-0528ff7d86bd","threadSettings":{"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","approvalPolicy":"never","approvalsReviewer":"user","sandboxPolicy":{"type":"dangerFullAccess"},"activePermissionProfile":null,"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"effort":null,"summary":"detailed","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna","reasoning_effort":null,"developer_instructions":null}},"multiAgentMode":"explicitRequestOnly","personality":null}},"emittedAtMs":1790295635949}} -{"type":"emit_inbound","label":"turn/start","frame":{"id":5,"result":{"turn":{"id":"01a0d5ef-77e2-7e22-a198-4864f687b8b5","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"emit_inbound","label":"turn/start","frame":{"id":6,"result":{"turn":{"id":"01a0d5ef-77e2-7e22-a198-4864f687b8b5","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0d5ef-62bd-7c20-861b-0528ff7d86bd","status":{"type":"active","activeFlags":[]}},"emittedAtMs":1790295635967}} {"type":"emit_inbound","label":"turn/started","frame":{"method":"turn/started","params":{"threadId":"01a0d5ef-62bd-7c20-861b-0528ff7d86bd","turn":{"id":"01a0d5ef-77e2-7e22-a198-4864f687b8b5","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":1790295635,"completedAt":null,"durationMs":null}},"emittedAtMs":1790295635967}} {"type":"emit_inbound","label":"account/updated","frame":{"method":"account/updated","params":{"authMode":"chatgpt","planType":"unknown"},"emittedAtMs":1790295636362}} diff --git a/apps/server/src/orchestration-v2/testkit/fixtures/queued_turn/codex_transcript.ndjson b/apps/server/src/orchestration-v2/testkit/fixtures/queued_turn/codex_transcript.ndjson index 8dc7109ff264c..052b27087784b 100644 --- a/apps/server/src/orchestration-v2/testkit/fixtures/queued_turn/codex_transcript.ndjson +++ b/apps/server/src/orchestration-v2/testkit/fixtures/queued_turn/codex_transcript.ndjson @@ -2,20 +2,22 @@ {"type":"expect_outbound","label":"initialize","frame":{"id":1,"method":"initialize","params":{"capabilities":{"experimentalApi":true,"optOutNotificationMethods":["turn/diff/updated"],"extensions":{"io.modelcontextprotocol/ui":{"mimeTypes":["text/html;profile=mcp-app"]}}},"clientInfo":{"name":"T3 Code","title":"T3 Code","version":"0.0.44"}}}} {"type":"emit_inbound","label":"initialize","frame":{"id":1,"result":{"userAgent":"t3code_desktop/0.156.1 (Debian 13.0.0; x86_64) unknown (t3code_desktop; 0.1.0)","codexHome":"/home/replay-user/.codex","platformFamily":"unix","platformOs":"linux"}}} {"type":"expect_outbound","label":"initialized","frame":{"method":"initialized"}} -{"type":"expect_outbound","label":"thread/start","frame":{"id":2,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","model":"gpt-6-luna"}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":2,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":2,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"thread/start","frame":{"id":3,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","model":"gpt-6-luna"}}} {"type":"emit_inbound","label":"configWarning","frame":{"method":"configWarning","params":{"summary":"Codex could not find bubblewrap on PATH. Install bubblewrap with your OS package manager. See the sandbox prerequisites: https://developers.openai.com/codex/concepts/sandboxing#prerequisites. Codex will use the bundled bubblewrap in the meantime.","details":null},"emittedAtMs":1790295489278}} {"type":"emit_inbound","label":"remoteControl/status/changed","frame":{"method":"remoteControl/status/changed","params":{"status":"disabled","serverName":"replay-host","installationId":"00000000-0000-4000-8000-000000000000","environmentId":null},"emittedAtMs":1790295489278}} -{"type":"emit_inbound","label":"thread/start","frame":{"id":2,"result":{"thread":{"id":"01a0d5ed-3b1d-7b03-a1a3-075d3fa4bc67","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5ed-3b1d-7b03-a1a3-075d3fa4bc67","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790295489,"updatedAt":1790295489,"recencyAt":1790295489,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-18-09-01a0d5ed-3b1d-7b03-a1a3-075d3fa4bc67.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"],"instructionSources":["/home/replay-user/.codex/AGENTS.md","/home/replay-user/t3code/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} -{"type":"expect_outbound","label":"thread/name/set","frame":{"id":3,"method":"thread/name/set","params":{"name":"Replay fixture: queued_turn","threadId":"01a0d5ed-3b1d-7b03-a1a3-075d3fa4bc67"}}} -{"type":"emit_inbound","label":"thread/name/set","frame":{"id":3,"result":{}}} +{"type":"emit_inbound","label":"thread/start","frame":{"id":3,"result":{"thread":{"id":"01a0d5ed-3b1d-7b03-a1a3-075d3fa4bc67","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5ed-3b1d-7b03-a1a3-075d3fa4bc67","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790295489,"updatedAt":1790295489,"recencyAt":1790295489,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-18-09-01a0d5ed-3b1d-7b03-a1a3-075d3fa4bc67.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"],"instructionSources":["/home/replay-user/.codex/AGENTS.md","/home/replay-user/t3code/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} +{"type":"expect_outbound","label":"thread/name/set","frame":{"id":4,"method":"thread/name/set","params":{"name":"Replay fixture: queued_turn","threadId":"01a0d5ed-3b1d-7b03-a1a3-075d3fa4bc67"}}} +{"type":"emit_inbound","label":"thread/name/set","frame":{"id":4,"result":{}}} {"type":"emit_inbound","label":"thread/name/updated","frame":{"method":"thread/name/updated","params":{"threadId":"01a0d5ed-3b1d-7b03-a1a3-075d3fa4bc67","threadName":"Replay fixture: queued_turn"}}} -{"type":"expect_outbound","label":"config/read","frame":{"id":4,"method":"config/read","params":{"cwd":"","includeLayers":false}}} -{"type":"emit_inbound","label":"config/read","frame":{"id":4,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"turn/start","frame":{"id":5,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Respond with exactly: first fixture turn complete","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0d5ed-3b1d-7b03-a1a3-075d3fa4bc67","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":5,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":5,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"turn/start","frame":{"id":6,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Respond with exactly: first fixture turn complete","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0d5ed-3b1d-7b03-a1a3-075d3fa4bc67","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} {"type":"emit_inbound","label":"thread/started","frame":{"method":"thread/started","params":{"thread":{"id":"01a0d5ed-3b1d-7b03-a1a3-075d3fa4bc67","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5ed-3b1d-7b03-a1a3-075d3fa4bc67","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790295489,"updatedAt":1790295489,"recencyAt":1790295489,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-18-09-01a0d5ed-3b1d-7b03-a1a3-075d3fa4bc67.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]}},"emittedAtMs":1790295489585}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0d5ed-3b1d-7b03-a1a3-075d3fa4bc67","name":"codex_apps","status":"starting","error":null,"failureReason":null},"emittedAtMs":1790295489585}} {"type":"emit_inbound","label":"thread/settings/updated","frame":{"method":"thread/settings/updated","params":{"threadId":"01a0d5ed-3b1d-7b03-a1a3-075d3fa4bc67","threadSettings":{"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","approvalPolicy":"never","approvalsReviewer":"user","sandboxPolicy":{"type":"dangerFullAccess"},"activePermissionProfile":null,"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"effort":null,"summary":"detailed","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna","reasoning_effort":null,"developer_instructions":null}},"multiAgentMode":"explicitRequestOnly","personality":null}},"emittedAtMs":1790295489600}} -{"type":"emit_inbound","label":"turn/start","frame":{"id":5,"result":{"turn":{"id":"01a0d5ed-3c38-77a3-ab7d-7b1af28c714e","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"emit_inbound","label":"turn/start","frame":{"id":6,"result":{"turn":{"id":"01a0d5ed-3c38-77a3-ab7d-7b1af28c714e","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0d5ed-3b1d-7b03-a1a3-075d3fa4bc67","status":{"type":"active","activeFlags":[]}},"emittedAtMs":1790295489653}} {"type":"emit_inbound","label":"turn/started","frame":{"method":"turn/started","params":{"threadId":"01a0d5ed-3b1d-7b03-a1a3-075d3fa4bc67","turn":{"id":"01a0d5ed-3c38-77a3-ab7d-7b1af28c714e","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":1790295489,"completedAt":null,"durationMs":null}},"emittedAtMs":1790295489653}} {"type":"emit_inbound","label":"account/updated","frame":{"method":"account/updated","params":{"authMode":"chatgpt","planType":"unknown"},"emittedAtMs":1790295490048}} @@ -33,10 +35,10 @@ {"type":"emit_inbound","label":"thread/tokenUsage/updated","frame":{"method":"thread/tokenUsage/updated","params":{"threadId":"01a0d5ed-3b1d-7b03-a1a3-075d3fa4bc67","turnId":"01a0d5ed-3c38-77a3-ab7d-7b1af28c714e","tokenUsage":{"total":{"totalTokens":21426,"inputTokens":21418,"cachedInputTokens":11008,"cacheWriteInputTokens":0,"outputTokens":8,"reasoningOutputTokens":0},"last":{"totalTokens":21426,"inputTokens":21418,"cachedInputTokens":11008,"cacheWriteInputTokens":0,"outputTokens":8,"reasoningOutputTokens":0},"modelContextWindow":258400}},"emittedAtMs":1790295494469}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0d5ed-3b1d-7b03-a1a3-075d3fa4bc67","status":{"type":"idle"}},"emittedAtMs":1790295494492}} {"type":"emit_inbound","label":"turn/completed","frame":{"method":"turn/completed","params":{"threadId":"01a0d5ed-3b1d-7b03-a1a3-075d3fa4bc67","turn":{"id":"01a0d5ed-3c38-77a3-ab7d-7b1af28c714e","items":[{"type":"agentMessage","id":"msg_0e736caa8e522655016ab5bdc6199487d097782bddce2cbb65","text":"first fixture turn complete","phase":"final_answer","memoryCitation":null,"delivery":null,"questions":null}],"itemsView":"summary","status":"completed","error":null,"startedAt":1790295489,"completedAt":1790295494,"durationMs":4885}},"emittedAtMs":1790295494492}} -{"type":"expect_outbound","label":"config/read","frame":{"id":6,"method":"config/read","params":{"cwd":"","includeLayers":false}}} -{"type":"emit_inbound","label":"config/read","frame":{"id":6,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"turn/start","frame":{"id":7,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Respond with exactly: second fixture turn complete","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0d5ed-3b1d-7b03-a1a3-075d3fa4bc67","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} -{"type":"emit_inbound","label":"turn/start","frame":{"id":7,"result":{"turn":{"id":"01a0d5ed-4f65-7182-8985-cb9fba86acad","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":7,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":7,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"turn/start","frame":{"id":8,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Respond with exactly: second fixture turn complete","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0d5ed-3b1d-7b03-a1a3-075d3fa4bc67","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} +{"type":"emit_inbound","label":"turn/start","frame":{"id":8,"result":{"turn":{"id":"01a0d5ed-4f65-7182-8985-cb9fba86acad","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0d5ed-3b1d-7b03-a1a3-075d3fa4bc67","status":{"type":"active","activeFlags":[]}},"emittedAtMs":1790295494545}} {"type":"emit_inbound","label":"turn/started","frame":{"method":"turn/started","params":{"threadId":"01a0d5ed-3b1d-7b03-a1a3-075d3fa4bc67","turn":{"id":"01a0d5ed-4f65-7182-8985-cb9fba86acad","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":1790295494,"completedAt":null,"durationMs":null}},"emittedAtMs":1790295494545}} {"type":"emit_inbound","label":"item/started","frame":{"method":"item/started","params":{"item":{"type":"userMessage","id":"01a0d5ed-5011-74c1-aa40-36a1a7a1a79c","clientId":null,"content":[{"type":"text","text":"Respond with exactly: second fixture turn complete","text_elements":[]}]},"threadId":"01a0d5ed-3b1d-7b03-a1a3-075d3fa4bc67","turnId":"01a0d5ed-4f65-7182-8985-cb9fba86acad","startedAtMs":1790295494685},"emittedAtMs":1790295494685}} diff --git a/apps/server/src/orchestration-v2/testkit/fixtures/simple/codex_transcript.ndjson b/apps/server/src/orchestration-v2/testkit/fixtures/simple/codex_transcript.ndjson index 2663074270d55..a5d43930ee4ba 100644 --- a/apps/server/src/orchestration-v2/testkit/fixtures/simple/codex_transcript.ndjson +++ b/apps/server/src/orchestration-v2/testkit/fixtures/simple/codex_transcript.ndjson @@ -2,22 +2,24 @@ {"type":"expect_outbound","label":"initialize","frame":{"id":1,"method":"initialize","params":{"capabilities":{"experimentalApi":true,"optOutNotificationMethods":["turn/diff/updated"],"extensions":{"io.modelcontextprotocol/ui":{"mimeTypes":["text/html;profile=mcp-app"]}}},"clientInfo":{"name":"T3 Code","title":"T3 Code","version":"0.0.44"}}}} {"type":"emit_inbound","label":"initialize","frame":{"id":1,"result":{"userAgent":"t3code_desktop/0.156.1 (Debian 13.0.0; x86_64) unknown (t3code_desktop; 0.1.0)","codexHome":"/home/replay-user/.codex","platformFamily":"unix","platformOs":"linux"}}} {"type":"expect_outbound","label":"initialized","frame":{"method":"initialized"}} -{"type":"expect_outbound","label":"thread/start","frame":{"id":2,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","model":"gpt-6-luna"}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":2,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":2,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"thread/start","frame":{"id":3,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","model":"gpt-6-luna"}}} {"type":"emit_inbound","label":"configWarning","frame":{"method":"configWarning","params":{"summary":"Codex could not find bubblewrap on PATH. Install bubblewrap with your OS package manager. See the sandbox prerequisites: https://developers.openai.com/codex/concepts/sandboxing#prerequisites. Codex will use the bundled bubblewrap in the meantime.","details":null},"emittedAtMs":1790295403441}} {"type":"emit_inbound","label":"remoteControl/status/changed","frame":{"method":"remoteControl/status/changed","params":{"status":"disabled","serverName":"replay-host","installationId":"00000000-0000-4000-8000-000000000000","environmentId":null},"emittedAtMs":1790295403441}} {"type":"emit_inbound","label":"account/updated","frame":{"method":"account/updated","params":{"authMode":"chatgpt","planType":"unknown"},"emittedAtMs":1790295404347}} -{"type":"emit_inbound","label":"thread/start","frame":{"id":2,"result":{"thread":{"id":"01a0d5eb-f0c0-7481-a417-5e8871805cbc","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5eb-f0c0-7481-a417-5e8871805cbc","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790295404,"updatedAt":1790295404,"recencyAt":1790295404,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-16-44-01a0d5eb-f0c0-7481-a417-5e8871805cbc.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"],"instructionSources":["/home/replay-user/.codex/AGENTS.md","/home/replay-user/t3code/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} -{"type":"expect_outbound","label":"thread/name/set","frame":{"id":3,"method":"thread/name/set","params":{"name":"Replay fixture: simple","threadId":"01a0d5eb-f0c0-7481-a417-5e8871805cbc"}}} -{"type":"emit_inbound","label":"thread/name/set","frame":{"id":3,"result":{}}} +{"type":"emit_inbound","label":"thread/start","frame":{"id":3,"result":{"thread":{"id":"01a0d5eb-f0c0-7481-a417-5e8871805cbc","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5eb-f0c0-7481-a417-5e8871805cbc","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790295404,"updatedAt":1790295404,"recencyAt":1790295404,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-16-44-01a0d5eb-f0c0-7481-a417-5e8871805cbc.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"],"instructionSources":["/home/replay-user/.codex/AGENTS.md","/home/replay-user/t3code/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} +{"type":"expect_outbound","label":"thread/name/set","frame":{"id":4,"method":"thread/name/set","params":{"name":"Replay fixture: simple","threadId":"01a0d5eb-f0c0-7481-a417-5e8871805cbc"}}} +{"type":"emit_inbound","label":"thread/name/set","frame":{"id":4,"result":{}}} {"type":"emit_inbound","label":"thread/name/updated","frame":{"method":"thread/name/updated","params":{"threadId":"01a0d5eb-f0c0-7481-a417-5e8871805cbc","threadName":"Replay fixture: simple"}}} -{"type":"expect_outbound","label":"config/read","frame":{"id":4,"method":"config/read","params":{"cwd":"","includeLayers":false}}} -{"type":"emit_inbound","label":"config/read","frame":{"id":4,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"turn/start","frame":{"id":5,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Respond with the following text: fixture simple ok","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0d5eb-f0c0-7481-a417-5e8871805cbc","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":5,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":5,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"turn/start","frame":{"id":6,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Respond with the following text: fixture simple ok","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0d5eb-f0c0-7481-a417-5e8871805cbc","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} {"type":"emit_inbound","label":"thread/started","frame":{"method":"thread/started","params":{"thread":{"id":"01a0d5eb-f0c0-7481-a417-5e8871805cbc","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5eb-f0c0-7481-a417-5e8871805cbc","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790295404,"updatedAt":1790295404,"recencyAt":1790295404,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-16-44-01a0d5eb-f0c0-7481-a417-5e8871805cbc.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]}},"emittedAtMs":1790295404904}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0d5eb-f0c0-7481-a417-5e8871805cbc","name":"xcodebuildmcp","status":"starting","error":null,"failureReason":null},"emittedAtMs":1790295404904}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0d5eb-f0c0-7481-a417-5e8871805cbc","name":"codex_apps","status":"starting","error":null,"failureReason":null},"emittedAtMs":1790295404904}} {"type":"emit_inbound","label":"thread/settings/updated","frame":{"method":"thread/settings/updated","params":{"threadId":"01a0d5eb-f0c0-7481-a417-5e8871805cbc","threadSettings":{"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","approvalPolicy":"never","approvalsReviewer":"user","sandboxPolicy":{"type":"dangerFullAccess"},"activePermissionProfile":null,"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"effort":null,"summary":"detailed","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna","reasoning_effort":null,"developer_instructions":null}},"multiAgentMode":"explicitRequestOnly","personality":null}},"emittedAtMs":1790295404923}} -{"type":"emit_inbound","label":"turn/start","frame":{"id":5,"result":{"turn":{"id":"01a0d5eb-f176-71d0-8e1c-a459700443de","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"emit_inbound","label":"turn/start","frame":{"id":6,"result":{"turn":{"id":"01a0d5eb-f176-71d0-8e1c-a459700443de","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0d5eb-f0c0-7481-a417-5e8871805cbc","status":{"type":"active","activeFlags":[]}},"emittedAtMs":1790295404965}} {"type":"emit_inbound","label":"turn/started","frame":{"method":"turn/started","params":{"threadId":"01a0d5eb-f0c0-7481-a417-5e8871805cbc","turn":{"id":"01a0d5eb-f176-71d0-8e1c-a459700443de","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":1790295404,"completedAt":null,"durationMs":null}},"emittedAtMs":1790295404965}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0d5eb-f0c0-7481-a417-5e8871805cbc","name":"codex_apps","status":"ready","error":null,"failureReason":null},"emittedAtMs":1790295405685}} diff --git a/apps/server/src/orchestration-v2/testkit/fixtures/subagent/codex_transcript.ndjson b/apps/server/src/orchestration-v2/testkit/fixtures/subagent/codex_transcript.ndjson index 9255c2572ac51..355c40ef407eb 100644 --- a/apps/server/src/orchestration-v2/testkit/fixtures/subagent/codex_transcript.ndjson +++ b/apps/server/src/orchestration-v2/testkit/fixtures/subagent/codex_transcript.ndjson @@ -2,21 +2,23 @@ {"type":"expect_outbound","label":"initialize","frame":{"id":1,"method":"initialize","params":{"capabilities":{"experimentalApi":true,"optOutNotificationMethods":["turn/diff/updated"],"extensions":{"io.modelcontextprotocol/ui":{"mimeTypes":["text/html;profile=mcp-app"]}}},"clientInfo":{"name":"T3 Code","title":"T3 Code","version":"0.0.44"}}}} {"type":"emit_inbound","label":"initialize","frame":{"id":1,"result":{"userAgent":"t3code_desktop/0.156.1 (Debian 13.0.0; x86_64) unknown (t3code_desktop; 0.1.0)","codexHome":"/home/replay-user/.codex","platformFamily":"unix","platformOs":"linux"}}} {"type":"expect_outbound","label":"initialized","frame":{"method":"initialized"}} -{"type":"expect_outbound","label":"thread/start","frame":{"id":2,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true,"skills.include_instructions":false},"cwd":"","model":"gpt-5.6-luna"}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":2,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":2,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"thread/start","frame":{"id":3,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true,"skills.include_instructions":false},"cwd":"","model":"gpt-5.6-luna"}}} {"type":"emit_inbound","label":"configWarning","frame":{"method":"configWarning","params":{"summary":"Codex could not find bubblewrap on PATH. Install bubblewrap with your OS package manager. See the sandbox prerequisites: https://developers.openai.com/codex/concepts/sandboxing#prerequisites. Codex will use the bundled bubblewrap in the meantime.","details":null},"emittedAtMs":1790298236268}} {"type":"emit_inbound","label":"remoteControl/status/changed","frame":{"method":"remoteControl/status/changed","params":{"status":"disabled","serverName":"replay-host","installationId":"00000000-0000-4000-8000-000000000000","environmentId":null},"emittedAtMs":1790298236268}} {"type":"emit_inbound","label":"account/updated","frame":{"method":"account/updated","params":{"authMode":"chatgpt","planType":"unknown"},"emittedAtMs":1790298236941}} -{"type":"emit_inbound","label":"thread/start","frame":{"id":2,"result":{"thread":{"id":"01a0d617-2920-75e0-8957-ee5a48afefc4","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d617-2920-75e0-8957-ee5a48afefc4","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-5.6-luna","reasoningEffort":null,"createdAt":1790298237,"updatedAt":1790298237,"recencyAt":1790298237,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T18-03-57-01a0d617-2920-75e0-8957-ee5a48afefc4.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-5.6-luna","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"],"instructionSources":["/home/replay-user/.codex/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} -{"type":"expect_outbound","label":"thread/name/set","frame":{"id":3,"method":"thread/name/set","params":{"name":"Replay fixture: subagent","threadId":"01a0d617-2920-75e0-8957-ee5a48afefc4"}}} -{"type":"emit_inbound","label":"thread/name/set","frame":{"id":3,"result":{}}} +{"type":"emit_inbound","label":"thread/start","frame":{"id":3,"result":{"thread":{"id":"01a0d617-2920-75e0-8957-ee5a48afefc4","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d617-2920-75e0-8957-ee5a48afefc4","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-5.6-luna","reasoningEffort":null,"createdAt":1790298237,"updatedAt":1790298237,"recencyAt":1790298237,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T18-03-57-01a0d617-2920-75e0-8957-ee5a48afefc4.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-5.6-luna","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"],"instructionSources":["/home/replay-user/.codex/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} +{"type":"expect_outbound","label":"thread/name/set","frame":{"id":4,"method":"thread/name/set","params":{"name":"Replay fixture: subagent","threadId":"01a0d617-2920-75e0-8957-ee5a48afefc4"}}} +{"type":"emit_inbound","label":"thread/name/set","frame":{"id":4,"result":{}}} {"type":"emit_inbound","label":"thread/name/updated","frame":{"method":"thread/name/updated","params":{"threadId":"01a0d617-2920-75e0-8957-ee5a48afefc4","threadName":"Replay fixture: subagent"}}} -{"type":"expect_outbound","label":"config/read","frame":{"id":4,"method":"config/read","params":{"cwd":"","includeLayers":false}}} -{"type":"emit_inbound","label":"config/read","frame":{"id":4,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"turn/start","frame":{"id":5,"method":"turn/start","params":{"approvalPolicy":"on-request","approvalsReviewer":"user","cwd":"","input":[{"text":"Spawn 2 subagents, one to read package.json and one to read tsconfig.json","type":"text"}],"model":"gpt-5.6-luna","sandboxPolicy":{"networkAccess":false,"type":"readOnly"},"summary":"auto","threadId":"01a0d617-2920-75e0-8957-ee5a48afefc4","collaborationMode":{"mode":"default","settings":{"model":"gpt-5.6-luna"}}}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":5,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":5,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"turn/start","frame":{"id":6,"method":"turn/start","params":{"approvalPolicy":"on-request","approvalsReviewer":"user","cwd":"","input":[{"text":"Spawn 2 subagents, one to read package.json and one to read tsconfig.json","type":"text"}],"model":"gpt-5.6-luna","sandboxPolicy":{"networkAccess":false,"type":"readOnly"},"summary":"auto","threadId":"01a0d617-2920-75e0-8957-ee5a48afefc4","collaborationMode":{"mode":"default","settings":{"model":"gpt-5.6-luna"}}}}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0d617-2920-75e0-8957-ee5a48afefc4","name":"codex_apps","status":"starting","error":null,"failureReason":null},"emittedAtMs":1790298237401}} {"type":"emit_inbound","label":"thread/started","frame":{"method":"thread/started","params":{"thread":{"id":"01a0d617-2920-75e0-8957-ee5a48afefc4","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d617-2920-75e0-8957-ee5a48afefc4","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-5.6-luna","reasoningEffort":null,"createdAt":1790298237,"updatedAt":1790298237,"recencyAt":1790298237,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T18-03-57-01a0d617-2920-75e0-8957-ee5a48afefc4.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]}},"emittedAtMs":1790298237402}} {"type":"emit_inbound","label":"thread/settings/updated","frame":{"method":"thread/settings/updated","params":{"threadId":"01a0d617-2920-75e0-8957-ee5a48afefc4","threadSettings":{"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","approvalPolicy":"on-request","approvalsReviewer":"user","sandboxPolicy":{"type":"readOnly","networkAccess":false},"activePermissionProfile":null,"model":"gpt-5.6-luna","modelProvider":"openai","serviceTier":null,"effort":null,"summary":"detailed","collaborationMode":{"mode":"default","settings":{"model":"gpt-5.6-luna","reasoning_effort":null,"developer_instructions":null}},"multiAgentMode":"explicitRequestOnly","personality":null}},"emittedAtMs":1790298237414}} -{"type":"emit_inbound","label":"turn/start","frame":{"id":5,"result":{"turn":{"id":"01a0d617-29e0-73d3-a4fd-856238566501","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"emit_inbound","label":"turn/start","frame":{"id":6,"result":{"turn":{"id":"01a0d617-29e0-73d3-a4fd-856238566501","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0d617-2920-75e0-8957-ee5a48afefc4","status":{"type":"active","activeFlags":[]}},"emittedAtMs":1790298237472}} {"type":"emit_inbound","label":"turn/started","frame":{"method":"turn/started","params":{"threadId":"01a0d617-2920-75e0-8957-ee5a48afefc4","turn":{"id":"01a0d617-29e0-73d3-a4fd-856238566501","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":1790298237,"completedAt":null,"durationMs":null}},"emittedAtMs":1790298237472}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0d617-2920-75e0-8957-ee5a48afefc4","name":"xcodebuildmcp","status":"starting","error":null,"failureReason":null},"emittedAtMs":1790298237772}} diff --git a/apps/server/src/orchestration-v2/testkit/fixtures/subagent_continue/codex_transcript.ndjson b/apps/server/src/orchestration-v2/testkit/fixtures/subagent_continue/codex_transcript.ndjson index 4deb50c422bd1..4cfd0788bc0aa 100644 --- a/apps/server/src/orchestration-v2/testkit/fixtures/subagent_continue/codex_transcript.ndjson +++ b/apps/server/src/orchestration-v2/testkit/fixtures/subagent_continue/codex_transcript.ndjson @@ -2,20 +2,22 @@ {"type":"expect_outbound","label":"initialize","frame":{"id":1,"method":"initialize","params":{"capabilities":{"experimentalApi":true,"optOutNotificationMethods":["turn/diff/updated"],"extensions":{"io.modelcontextprotocol/ui":{"mimeTypes":["text/html;profile=mcp-app"]}}},"clientInfo":{"name":"T3 Code","title":"T3 Code","version":"0.0.44"}}}} {"type":"emit_inbound","label":"initialize","frame":{"id":1,"result":{"userAgent":"t3code_desktop/0.156.1 (Debian 13.0.0; x86_64) unknown (t3code_desktop; 0.1.0)","codexHome":"/home/replay-user/.codex","platformFamily":"unix","platformOs":"linux"}}} {"type":"expect_outbound","label":"initialized","frame":{"method":"initialized"}} -{"type":"expect_outbound","label":"thread/start","frame":{"id":2,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","model":"gpt-5.6-luna"}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":2,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":2,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"thread/start","frame":{"id":3,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","model":"gpt-5.6-luna"}}} {"type":"emit_inbound","label":"configWarning","frame":{"method":"configWarning","params":{"summary":"Codex could not find bubblewrap on PATH. Install bubblewrap with your OS package manager. See the sandbox prerequisites: https://developers.openai.com/codex/concepts/sandboxing#prerequisites. Codex will use the bundled bubblewrap in the meantime.","details":null},"emittedAtMs":1790296707143}} {"type":"emit_inbound","label":"remoteControl/status/changed","frame":{"method":"remoteControl/status/changed","params":{"status":"disabled","serverName":"replay-host","installationId":"00000000-0000-4000-8000-000000000000","environmentId":null},"emittedAtMs":1790296707143}} -{"type":"emit_inbound","label":"thread/start","frame":{"id":2,"result":{"thread":{"id":"01a0d5ff-d059-77b3-a2cc-81be5c40d448","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5ff-d059-77b3-a2cc-81be5c40d448","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-5.6-luna","reasoningEffort":null,"createdAt":1790296707,"updatedAt":1790296707,"recencyAt":1790296707,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-38-27-01a0d5ff-d059-77b3-a2cc-81be5c40d448.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-5.6-luna","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"],"instructionSources":["/home/replay-user/.codex/AGENTS.md","/home/replay-user/t3code/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} -{"type":"expect_outbound","label":"thread/name/set","frame":{"id":3,"method":"thread/name/set","params":{"name":"Replay fixture: subagent_continue","threadId":"01a0d5ff-d059-77b3-a2cc-81be5c40d448"}}} -{"type":"emit_inbound","label":"thread/name/set","frame":{"id":3,"result":{}}} +{"type":"emit_inbound","label":"thread/start","frame":{"id":3,"result":{"thread":{"id":"01a0d5ff-d059-77b3-a2cc-81be5c40d448","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5ff-d059-77b3-a2cc-81be5c40d448","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-5.6-luna","reasoningEffort":null,"createdAt":1790296707,"updatedAt":1790296707,"recencyAt":1790296707,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-38-27-01a0d5ff-d059-77b3-a2cc-81be5c40d448.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-5.6-luna","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"],"instructionSources":["/home/replay-user/.codex/AGENTS.md","/home/replay-user/t3code/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} +{"type":"expect_outbound","label":"thread/name/set","frame":{"id":4,"method":"thread/name/set","params":{"name":"Replay fixture: subagent_continue","threadId":"01a0d5ff-d059-77b3-a2cc-81be5c40d448"}}} +{"type":"emit_inbound","label":"thread/name/set","frame":{"id":4,"result":{}}} {"type":"emit_inbound","label":"thread/name/updated","frame":{"method":"thread/name/updated","params":{"threadId":"01a0d5ff-d059-77b3-a2cc-81be5c40d448","threadName":"Replay fixture: subagent_continue"}}} -{"type":"expect_outbound","label":"config/read","frame":{"id":4,"method":"config/read","params":{"cwd":"","includeLayers":false}}} -{"type":"emit_inbound","label":"config/read","frame":{"id":4,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"turn/start","frame":{"id":5,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Spawn one subagent and have it reply exactly: initial subagent response","type":"text"}],"model":"gpt-5.6-luna","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0d5ff-d059-77b3-a2cc-81be5c40d448","collaborationMode":{"mode":"default","settings":{"model":"gpt-5.6-luna"}}}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":5,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":5,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"turn/start","frame":{"id":6,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Spawn one subagent and have it reply exactly: initial subagent response","type":"text"}],"model":"gpt-5.6-luna","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0d5ff-d059-77b3-a2cc-81be5c40d448","collaborationMode":{"mode":"default","settings":{"model":"gpt-5.6-luna"}}}}} {"type":"emit_inbound","label":"thread/started","frame":{"method":"thread/started","params":{"thread":{"id":"01a0d5ff-d059-77b3-a2cc-81be5c40d448","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5ff-d059-77b3-a2cc-81be5c40d448","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-5.6-luna","reasoningEffort":null,"createdAt":1790296707,"updatedAt":1790296707,"recencyAt":1790296707,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-38-27-01a0d5ff-d059-77b3-a2cc-81be5c40d448.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]}},"emittedAtMs":1790296707328}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0d5ff-d059-77b3-a2cc-81be5c40d448","name":"codex_apps","status":"starting","error":null,"failureReason":null},"emittedAtMs":1790296707328}} {"type":"emit_inbound","label":"thread/settings/updated","frame":{"method":"thread/settings/updated","params":{"threadId":"01a0d5ff-d059-77b3-a2cc-81be5c40d448","threadSettings":{"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","approvalPolicy":"never","approvalsReviewer":"user","sandboxPolicy":{"type":"dangerFullAccess"},"activePermissionProfile":null,"model":"gpt-5.6-luna","modelProvider":"openai","serviceTier":null,"effort":null,"summary":"detailed","collaborationMode":{"mode":"default","settings":{"model":"gpt-5.6-luna","reasoning_effort":null,"developer_instructions":null}},"multiAgentMode":"explicitRequestOnly","personality":null}},"emittedAtMs":1790296707337}} -{"type":"emit_inbound","label":"turn/start","frame":{"id":5,"result":{"turn":{"id":"01a0d5ff-d107-72b0-b80e-eee523c86b42","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"emit_inbound","label":"turn/start","frame":{"id":6,"result":{"turn":{"id":"01a0d5ff-d107-72b0-b80e-eee523c86b42","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0d5ff-d059-77b3-a2cc-81be5c40d448","status":{"type":"active","activeFlags":[]}},"emittedAtMs":1790296707369}} {"type":"emit_inbound","label":"turn/started","frame":{"method":"turn/started","params":{"threadId":"01a0d5ff-d059-77b3-a2cc-81be5c40d448","turn":{"id":"01a0d5ff-d107-72b0-b80e-eee523c86b42","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":1790296707,"completedAt":null,"durationMs":null}},"emittedAtMs":1790296707369}} {"type":"emit_inbound","label":"account/updated","frame":{"method":"account/updated","params":{"authMode":"chatgpt","planType":"unknown"},"emittedAtMs":1790296707761}} @@ -81,10 +83,10 @@ {"type":"emit_inbound","label":"thread/tokenUsage/updated","frame":{"method":"thread/tokenUsage/updated","params":{"threadId":"01a0d5ff-d059-77b3-a2cc-81be5c40d448","turnId":"01a0d5ff-d107-72b0-b80e-eee523c86b42","tokenUsage":{"total":{"totalTokens":88196,"inputTokens":87953,"cachedInputTokens":61440,"cacheWriteInputTokens":0,"outputTokens":243,"reasoningOutputTokens":74},"last":{"totalTokens":22955,"inputTokens":22918,"cachedInputTokens":22272,"cacheWriteInputTokens":0,"outputTokens":37,"reasoningOutputTokens":27},"modelContextWindow":258400}},"emittedAtMs":1790296721553}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0d5ff-d059-77b3-a2cc-81be5c40d448","status":{"type":"idle"}},"emittedAtMs":1790296721558}} {"type":"emit_inbound","label":"turn/completed","frame":{"method":"turn/completed","params":{"threadId":"01a0d5ff-d059-77b3-a2cc-81be5c40d448","turn":{"id":"01a0d5ff-d107-72b0-b80e-eee523c86b42","items":[{"type":"agentMessage","id":"msg_0cd47e60427f33b8016ab5c29140b487d0abe357be8230ade9","text":"initial subagent response","phase":"final_answer","memoryCitation":null,"delivery":null,"questions":null}],"itemsView":"summary","status":"completed","error":null,"startedAt":1790296707,"completedAt":1790296721,"durationMs":14219}},"emittedAtMs":1790296721558}} -{"type":"expect_outbound","label":"config/read","frame":{"id":6,"method":"config/read","params":{"cwd":"","includeLayers":false}}} -{"type":"emit_inbound","label":"config/read","frame":{"id":6,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"turn/start","frame":{"id":7,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Have the same subagent you spawned earlier reply exactly: continued subagent response","type":"text"}],"model":"gpt-5.6-luna","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0d5ff-d059-77b3-a2cc-81be5c40d448","collaborationMode":{"mode":"default","settings":{"model":"gpt-5.6-luna"}}}}} -{"type":"emit_inbound","label":"turn/start","frame":{"id":7,"result":{"turn":{"id":"01a0d600-0899-7c10-9106-0eac1b8d18f9","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":7,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":7,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"turn/start","frame":{"id":8,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Have the same subagent you spawned earlier reply exactly: continued subagent response","type":"text"}],"model":"gpt-5.6-luna","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0d5ff-d059-77b3-a2cc-81be5c40d448","collaborationMode":{"mode":"default","settings":{"model":"gpt-5.6-luna"}}}}} +{"type":"emit_inbound","label":"turn/start","frame":{"id":8,"result":{"turn":{"id":"01a0d600-0899-7c10-9106-0eac1b8d18f9","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0d5ff-d059-77b3-a2cc-81be5c40d448","status":{"type":"active","activeFlags":[]}},"emittedAtMs":1790296721577}} {"type":"emit_inbound","label":"turn/started","frame":{"method":"turn/started","params":{"threadId":"01a0d5ff-d059-77b3-a2cc-81be5c40d448","turn":{"id":"01a0d600-0899-7c10-9106-0eac1b8d18f9","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":1790296721,"completedAt":null,"durationMs":null}},"emittedAtMs":1790296721577}} {"type":"emit_inbound","label":"item/started","frame":{"method":"item/started","params":{"item":{"type":"userMessage","id":"01a0d600-0931-74b0-9bed-eacf1497bdf5","clientId":null,"content":[{"type":"text","text":"Have the same subagent you spawned earlier reply exactly: continued subagent response","text_elements":[]}]},"threadId":"01a0d5ff-d059-77b3-a2cc-81be5c40d448","turnId":"01a0d600-0899-7c10-9106-0eac1b8d18f9","startedAtMs":1790296721714},"emittedAtMs":1790296721715}} diff --git a/apps/server/src/orchestration-v2/testkit/fixtures/subagent_v2/codex_transcript.ndjson b/apps/server/src/orchestration-v2/testkit/fixtures/subagent_v2/codex_transcript.ndjson index df4278b9e22d7..8038354788e45 100644 --- a/apps/server/src/orchestration-v2/testkit/fixtures/subagent_v2/codex_transcript.ndjson +++ b/apps/server/src/orchestration-v2/testkit/fixtures/subagent_v2/codex_transcript.ndjson @@ -2,22 +2,24 @@ {"type":"expect_outbound","label":"initialize","frame":{"id":1,"method":"initialize","params":{"capabilities":{"experimentalApi":true,"optOutNotificationMethods":["turn/diff/updated"],"extensions":{"io.modelcontextprotocol/ui":{"mimeTypes":["text/html;profile=mcp-app"]}}},"clientInfo":{"name":"T3 Code","title":"T3 Code","version":"0.0.44"}}}} {"type":"emit_inbound","label":"initialize","frame":{"id":1,"result":{"userAgent":"t3code_desktop/0.156.1 (Debian 13.0.0; x86_64) unknown (t3code_desktop; 0.1.0)","codexHome":"/home/replay-user/.codex","platformFamily":"unix","platformOs":"linux"}}} {"type":"expect_outbound","label":"initialized","frame":{"method":"initialized"}} -{"type":"expect_outbound","label":"thread/start","frame":{"id":2,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","model":"gpt-6-luna"}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":2,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":2,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"thread/start","frame":{"id":3,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","model":"gpt-6-luna"}}} {"type":"emit_inbound","label":"configWarning","frame":{"method":"configWarning","params":{"summary":"Codex could not find bubblewrap on PATH. Install bubblewrap with your OS package manager. See the sandbox prerequisites: https://developers.openai.com/codex/concepts/sandboxing#prerequisites. Codex will use the bundled bubblewrap in the meantime.","details":null},"emittedAtMs":1790296671810}} {"type":"emit_inbound","label":"remoteControl/status/changed","frame":{"method":"remoteControl/status/changed","params":{"status":"disabled","serverName":"replay-host","installationId":"00000000-0000-4000-8000-000000000000","environmentId":null},"emittedAtMs":1790296671810}} {"type":"emit_inbound","label":"account/updated","frame":{"method":"account/updated","params":{"authMode":"chatgpt","planType":"unknown"},"emittedAtMs":1790296672562}} -{"type":"emit_inbound","label":"thread/start","frame":{"id":2,"result":{"thread":{"id":"01a0d5ff-49e8-7741-9ca7-b12aa375019a","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5ff-49e8-7741-9ca7-b12aa375019a","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790296672,"updatedAt":1790296672,"recencyAt":1790296672,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-37-52-01a0d5ff-49e8-7741-9ca7-b12aa375019a.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"],"instructionSources":["/home/replay-user/.codex/AGENTS.md","/home/replay-user/t3code/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} -{"type":"expect_outbound","label":"thread/name/set","frame":{"id":3,"method":"thread/name/set","params":{"name":"Replay fixture: subagent_v2","threadId":"01a0d5ff-49e8-7741-9ca7-b12aa375019a"}}} -{"type":"emit_inbound","label":"thread/name/set","frame":{"id":3,"result":{}}} +{"type":"emit_inbound","label":"thread/start","frame":{"id":3,"result":{"thread":{"id":"01a0d5ff-49e8-7741-9ca7-b12aa375019a","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5ff-49e8-7741-9ca7-b12aa375019a","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790296672,"updatedAt":1790296672,"recencyAt":1790296672,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-37-52-01a0d5ff-49e8-7741-9ca7-b12aa375019a.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"],"instructionSources":["/home/replay-user/.codex/AGENTS.md","/home/replay-user/t3code/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} +{"type":"expect_outbound","label":"thread/name/set","frame":{"id":4,"method":"thread/name/set","params":{"name":"Replay fixture: subagent_v2","threadId":"01a0d5ff-49e8-7741-9ca7-b12aa375019a"}}} +{"type":"emit_inbound","label":"thread/name/set","frame":{"id":4,"result":{}}} {"type":"emit_inbound","label":"thread/name/updated","frame":{"method":"thread/name/updated","params":{"threadId":"01a0d5ff-49e8-7741-9ca7-b12aa375019a","threadName":"Replay fixture: subagent_v2"}}} -{"type":"expect_outbound","label":"config/read","frame":{"id":4,"method":"config/read","params":{"cwd":"","includeLayers":false}}} -{"type":"emit_inbound","label":"config/read","frame":{"id":4,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"turn/start","frame":{"id":5,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Spawn one subagent whose only task is to reply with exactly: Hello. Wait for it to finish, then reply with exactly what it said.","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0d5ff-49e8-7741-9ca7-b12aa375019a","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":5,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":5,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"turn/start","frame":{"id":6,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Spawn one subagent whose only task is to reply with exactly: Hello. Wait for it to finish, then reply with exactly what it said.","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0d5ff-49e8-7741-9ca7-b12aa375019a","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} {"type":"emit_inbound","label":"thread/started","frame":{"method":"thread/started","params":{"thread":{"id":"01a0d5ff-49e8-7741-9ca7-b12aa375019a","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5ff-49e8-7741-9ca7-b12aa375019a","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790296672,"updatedAt":1790296672,"recencyAt":1790296672,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-37-52-01a0d5ff-49e8-7741-9ca7-b12aa375019a.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]}},"emittedAtMs":1790296673000}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0d5ff-49e8-7741-9ca7-b12aa375019a","name":"codex_apps","status":"starting","error":null,"failureReason":null},"emittedAtMs":1790296673000}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0d5ff-49e8-7741-9ca7-b12aa375019a","name":"xcodebuildmcp","status":"starting","error":null,"failureReason":null},"emittedAtMs":1790296673000}} {"type":"emit_inbound","label":"thread/settings/updated","frame":{"method":"thread/settings/updated","params":{"threadId":"01a0d5ff-49e8-7741-9ca7-b12aa375019a","threadSettings":{"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","approvalPolicy":"never","approvalsReviewer":"user","sandboxPolicy":{"type":"dangerFullAccess"},"activePermissionProfile":null,"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"effort":null,"summary":"detailed","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna","reasoning_effort":null,"developer_instructions":null}},"multiAgentMode":"explicitRequestOnly","personality":null}},"emittedAtMs":1790296673032}} -{"type":"emit_inbound","label":"turn/start","frame":{"id":5,"result":{"turn":{"id":"01a0d5ff-4b00-7641-bba1-06faa0ef23f1","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"emit_inbound","label":"turn/start","frame":{"id":6,"result":{"turn":{"id":"01a0d5ff-4b00-7641-bba1-06faa0ef23f1","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0d5ff-49e8-7741-9ca7-b12aa375019a","status":{"type":"active","activeFlags":[]}},"emittedAtMs":1790296673081}} {"type":"emit_inbound","label":"turn/started","frame":{"method":"turn/started","params":{"threadId":"01a0d5ff-49e8-7741-9ca7-b12aa375019a","turn":{"id":"01a0d5ff-4b00-7641-bba1-06faa0ef23f1","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":1790296673,"completedAt":null,"durationMs":null}},"emittedAtMs":1790296673081}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0d5ff-49e8-7741-9ca7-b12aa375019a","name":"codex_apps","status":"ready","error":null,"failureReason":null},"emittedAtMs":1790296673765}} diff --git a/apps/server/src/orchestration-v2/testkit/fixtures/subagent_v2_approval/codex_transcript.ndjson b/apps/server/src/orchestration-v2/testkit/fixtures/subagent_v2_approval/codex_transcript.ndjson index b7178ee2cd4ce..2f2f000ce1bb1 100644 --- a/apps/server/src/orchestration-v2/testkit/fixtures/subagent_v2_approval/codex_transcript.ndjson +++ b/apps/server/src/orchestration-v2/testkit/fixtures/subagent_v2_approval/codex_transcript.ndjson @@ -2,21 +2,23 @@ {"type":"expect_outbound","label":"initialize","frame":{"id":1,"method":"initialize","params":{"capabilities":{"experimentalApi":true,"optOutNotificationMethods":["turn/diff/updated"],"extensions":{"io.modelcontextprotocol/ui":{"mimeTypes":["text/html;profile=mcp-app"]}}},"clientInfo":{"name":"T3 Code","title":"T3 Code","version":"0.0.44"}}}} {"type":"emit_inbound","label":"initialize","frame":{"id":1,"result":{"userAgent":"t3code_desktop/0.156.1 (Debian 13.0.0; x86_64) unknown (t3code_desktop; 0.1.0)","codexHome":"/home/replay-user/tmp/codex-subagent-approval-rec/codex-home","platformFamily":"unix","platformOs":"linux"}}} {"type":"expect_outbound","label":"initialized","frame":{"method":"initialized"}} -{"type":"expect_outbound","label":"thread/start","frame":{"id":2,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","model":"gpt-6-luna"}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":2,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":2,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"thread/start","frame":{"id":3,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","model":"gpt-6-luna"}}} {"type":"emit_inbound","label":"configWarning","frame":{"method":"configWarning","params":{"summary":"Codex could not find bubblewrap on PATH. Install bubblewrap with your OS package manager. See the sandbox prerequisites: https://developers.openai.com/codex/concepts/sandboxing#prerequisites. Codex will use the bundled bubblewrap in the meantime.","details":null},"emittedAtMs":1790368128814}} {"type":"emit_inbound","label":"remoteControl/status/changed","frame":{"method":"remoteControl/status/changed","params":{"status":"disabled","serverName":"replay-host","installationId":"00000000-0000-4000-8000-000000000000","environmentId":null},"emittedAtMs":1790368128814}} {"type":"emit_inbound","label":"account/updated","frame":{"method":"account/updated","params":{"authMode":"chatgpt","planType":"unknown"},"emittedAtMs":1790368129787}} -{"type":"emit_inbound","label":"thread/start","frame":{"id":2,"result":{"thread":{"id":"01a0da41-a28d-7271-b6f6-59123b5bb248","environments":[{"environmentId":"local","cwd":"/home/replay-user/tmp/codex-subagent-approval-rec/repo","runtimeWorkspaceRoots":["/home/replay-user/tmp/codex-subagent-approval-rec/repo"]}],"extra":null,"sessionId":"01a0da41-a28d-7271-b6f6-59123b5bb248","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790368129,"updatedAt":1790368129,"recencyAt":1790368129,"status":{"type":"idle"},"path":"/home/replay-user/tmp/codex-subagent-approval-rec/codex-home/sessions/2026/09/25/rollout-2026-09-25T13-28-49-01a0da41-a28d-7271-b6f6-59123b5bb248.jsonl","cwd":"/home/replay-user/tmp/codex-subagent-approval-rec/repo","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/tmp/codex-subagent-approval-rec/repo","runtimeWorkspaceRoots":["/home/replay-user/tmp/codex-subagent-approval-rec/repo"],"instructionSources":[],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} -{"type":"expect_outbound","label":"thread/name/set","frame":{"id":3,"method":"thread/name/set","params":{"name":"Replay fixture: subagent_v2_approval","threadId":"01a0da41-a28d-7271-b6f6-59123b5bb248"}}} -{"type":"emit_inbound","label":"thread/name/set","frame":{"id":3,"result":{}}} +{"type":"emit_inbound","label":"thread/start","frame":{"id":3,"result":{"thread":{"id":"01a0da41-a28d-7271-b6f6-59123b5bb248","environments":[{"environmentId":"local","cwd":"/home/replay-user/tmp/codex-subagent-approval-rec/repo","runtimeWorkspaceRoots":["/home/replay-user/tmp/codex-subagent-approval-rec/repo"]}],"extra":null,"sessionId":"01a0da41-a28d-7271-b6f6-59123b5bb248","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790368129,"updatedAt":1790368129,"recencyAt":1790368129,"status":{"type":"idle"},"path":"/home/replay-user/tmp/codex-subagent-approval-rec/codex-home/sessions/2026/09/25/rollout-2026-09-25T13-28-49-01a0da41-a28d-7271-b6f6-59123b5bb248.jsonl","cwd":"/home/replay-user/tmp/codex-subagent-approval-rec/repo","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/tmp/codex-subagent-approval-rec/repo","runtimeWorkspaceRoots":["/home/replay-user/tmp/codex-subagent-approval-rec/repo"],"instructionSources":[],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} +{"type":"expect_outbound","label":"thread/name/set","frame":{"id":4,"method":"thread/name/set","params":{"name":"Replay fixture: subagent_v2_approval","threadId":"01a0da41-a28d-7271-b6f6-59123b5bb248"}}} +{"type":"emit_inbound","label":"thread/name/set","frame":{"id":4,"result":{}}} {"type":"emit_inbound","label":"thread/name/updated","frame":{"method":"thread/name/updated","params":{"threadId":"01a0da41-a28d-7271-b6f6-59123b5bb248","threadName":"Replay fixture: subagent_v2_approval"}}} -{"type":"expect_outbound","label":"config/read","frame":{"id":4,"method":"config/read","params":{"cwd":"","includeLayers":false}}} -{"type":"emit_inbound","label":"config/read","frame":{"id":4,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"turn/start","frame":{"id":5,"method":"turn/start","params":{"approvalPolicy":"untrusted","approvalsReviewer":"user","cwd":"","input":[{"text":"Do not run any commands yourself. Spawn one subagent whose only task is to run this exact shell command: printf 'subagent approval fixture' > subagent-approval.txt and then reply with exactly: Written. Wait for it to finish, then reply with exactly what it said.","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"type":"readOnly"},"summary":"auto","threadId":"01a0da41-a28d-7271-b6f6-59123b5bb248","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":5,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":5,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"turn/start","frame":{"id":6,"method":"turn/start","params":{"approvalPolicy":"untrusted","approvalsReviewer":"user","cwd":"","input":[{"text":"Do not run any commands yourself. Spawn one subagent whose only task is to run this exact shell command: printf 'subagent approval fixture' > subagent-approval.txt and then reply with exactly: Written. Wait for it to finish, then reply with exactly what it said.","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"type":"readOnly"},"summary":"auto","threadId":"01a0da41-a28d-7271-b6f6-59123b5bb248","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} {"type":"emit_inbound","label":"thread/started","frame":{"method":"thread/started","params":{"thread":{"id":"01a0da41-a28d-7271-b6f6-59123b5bb248","environments":[{"environmentId":"local","cwd":"/home/replay-user/tmp/codex-subagent-approval-rec/repo","runtimeWorkspaceRoots":["/home/replay-user/tmp/codex-subagent-approval-rec/repo"]}],"extra":null,"sessionId":"01a0da41-a28d-7271-b6f6-59123b5bb248","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790368129,"updatedAt":1790368129,"recencyAt":1790368129,"status":{"type":"idle"},"path":"/home/replay-user/tmp/codex-subagent-approval-rec/codex-home/sessions/2026/09/25/rollout-2026-09-25T13-28-49-01a0da41-a28d-7271-b6f6-59123b5bb248.jsonl","cwd":"/home/replay-user/tmp/codex-subagent-approval-rec/repo","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]}},"emittedAtMs":1790368129812}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0da41-a28d-7271-b6f6-59123b5bb248","name":"codex_apps","status":"starting","error":null,"failureReason":null},"emittedAtMs":1790368129813}} {"type":"emit_inbound","label":"thread/settings/updated","frame":{"method":"thread/settings/updated","params":{"threadId":"01a0da41-a28d-7271-b6f6-59123b5bb248","threadSettings":{"disabledPluginIds":[],"cwd":"/home/replay-user/tmp/codex-subagent-approval-rec/repo","approvalPolicy":"untrusted","approvalsReviewer":"user","sandboxPolicy":{"type":"readOnly","networkAccess":false},"activePermissionProfile":null,"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"effort":null,"summary":"detailed","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna","reasoning_effort":null,"developer_instructions":null}},"multiAgentMode":"explicitRequestOnly","personality":null}},"emittedAtMs":1790368129830}} -{"type":"emit_inbound","label":"turn/start","frame":{"id":5,"result":{"turn":{"id":"01a0da41-a31f-7741-bda3-ebc5ad36c38f","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"emit_inbound","label":"turn/start","frame":{"id":6,"result":{"turn":{"id":"01a0da41-a31f-7741-bda3-ebc5ad36c38f","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0da41-a28d-7271-b6f6-59123b5bb248","status":{"type":"active","activeFlags":[]}},"emittedAtMs":1790368129893}} {"type":"emit_inbound","label":"turn/started","frame":{"method":"turn/started","params":{"threadId":"01a0da41-a28d-7271-b6f6-59123b5bb248","turn":{"id":"01a0da41-a31f-7741-bda3-ebc5ad36c38f","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":1790368129,"completedAt":null,"durationMs":null}},"emittedAtMs":1790368129894}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0da41-a28d-7271-b6f6-59123b5bb248","name":"codex_apps","status":"ready","error":null,"failureReason":null},"emittedAtMs":1790368131004}} diff --git a/apps/server/src/orchestration-v2/testkit/fixtures/subagent_v2_nested/codex_transcript.ndjson b/apps/server/src/orchestration-v2/testkit/fixtures/subagent_v2_nested/codex_transcript.ndjson index d895b9ad9849c..777ed6e802a7d 100644 --- a/apps/server/src/orchestration-v2/testkit/fixtures/subagent_v2_nested/codex_transcript.ndjson +++ b/apps/server/src/orchestration-v2/testkit/fixtures/subagent_v2_nested/codex_transcript.ndjson @@ -2,20 +2,22 @@ {"type":"expect_outbound","label":"initialize","frame":{"id":1,"method":"initialize","params":{"capabilities":{"experimentalApi":true,"optOutNotificationMethods":["turn/diff/updated"],"extensions":{"io.modelcontextprotocol/ui":{"mimeTypes":["text/html;profile=mcp-app"]}}},"clientInfo":{"name":"T3 Code","title":"T3 Code","version":"0.0.44"}}}} {"type":"emit_inbound","label":"initialize","frame":{"id":1,"result":{"userAgent":"t3code_desktop/0.156.1 (Debian 13.0.0; x86_64) unknown (t3code_desktop; 0.1.0)","codexHome":"/home/replay-user/.codex","platformFamily":"unix","platformOs":"linux"}}} {"type":"expect_outbound","label":"initialized","frame":{"method":"initialized"}} -{"type":"expect_outbound","label":"thread/start","frame":{"id":2,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true,"agents.max_depth":3},"cwd":"","model":"gpt-6-luna"}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":2,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":2,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"thread/start","frame":{"id":3,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true,"agents.max_depth":3},"cwd":"","model":"gpt-6-luna"}}} {"type":"emit_inbound","label":"configWarning","frame":{"method":"configWarning","params":{"summary":"Codex could not find bubblewrap on PATH. Install bubblewrap with your OS package manager. See the sandbox prerequisites: https://developers.openai.com/codex/concepts/sandboxing#prerequisites. Codex will use the bundled bubblewrap in the meantime.","details":null},"emittedAtMs":1790296685424}} {"type":"emit_inbound","label":"remoteControl/status/changed","frame":{"method":"remoteControl/status/changed","params":{"status":"disabled","serverName":"replay-host","installationId":"00000000-0000-4000-8000-000000000000","environmentId":null},"emittedAtMs":1790296685424}} -{"type":"emit_inbound","label":"thread/start","frame":{"id":2,"result":{"thread":{"id":"01a0d5ff-7b98-7e50-a216-1581ca5ebd3a","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5ff-7b98-7e50-a216-1581ca5ebd3a","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790296685,"updatedAt":1790296685,"recencyAt":1790296685,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-38-05-01a0d5ff-7b98-7e50-a216-1581ca5ebd3a.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"],"instructionSources":["/home/replay-user/.codex/AGENTS.md","/home/replay-user/t3code/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} -{"type":"expect_outbound","label":"thread/name/set","frame":{"id":3,"method":"thread/name/set","params":{"name":"Replay fixture: subagent_v2_nested","threadId":"01a0d5ff-7b98-7e50-a216-1581ca5ebd3a"}}} -{"type":"emit_inbound","label":"thread/name/set","frame":{"id":3,"result":{}}} +{"type":"emit_inbound","label":"thread/start","frame":{"id":3,"result":{"thread":{"id":"01a0d5ff-7b98-7e50-a216-1581ca5ebd3a","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5ff-7b98-7e50-a216-1581ca5ebd3a","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790296685,"updatedAt":1790296685,"recencyAt":1790296685,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-38-05-01a0d5ff-7b98-7e50-a216-1581ca5ebd3a.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"],"instructionSources":["/home/replay-user/.codex/AGENTS.md","/home/replay-user/t3code/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} +{"type":"expect_outbound","label":"thread/name/set","frame":{"id":4,"method":"thread/name/set","params":{"name":"Replay fixture: subagent_v2_nested","threadId":"01a0d5ff-7b98-7e50-a216-1581ca5ebd3a"}}} +{"type":"emit_inbound","label":"thread/name/set","frame":{"id":4,"result":{}}} {"type":"emit_inbound","label":"thread/name/updated","frame":{"method":"thread/name/updated","params":{"threadId":"01a0d5ff-7b98-7e50-a216-1581ca5ebd3a","threadName":"Replay fixture: subagent_v2_nested"}}} -{"type":"expect_outbound","label":"config/read","frame":{"id":4,"method":"config/read","params":{"cwd":"","includeLayers":false}}} -{"type":"emit_inbound","label":"config/read","frame":{"id":4,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"turn/start","frame":{"id":5,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Spawn one subagent and tell it to spawn its own subagent, which must in turn spawn one more subagent whose only task is to reply with exactly: Hello. Each agent waits for its child and replies with exactly what the child said. Wait for your subagent, then reply with exactly what it said.","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0d5ff-7b98-7e50-a216-1581ca5ebd3a","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":5,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":5,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"turn/start","frame":{"id":6,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Spawn one subagent and tell it to spawn its own subagent, which must in turn spawn one more subagent whose only task is to reply with exactly: Hello. Each agent waits for its child and replies with exactly what the child said. Wait for your subagent, then reply with exactly what it said.","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0d5ff-7b98-7e50-a216-1581ca5ebd3a","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} {"type":"emit_inbound","label":"thread/started","frame":{"method":"thread/started","params":{"thread":{"id":"01a0d5ff-7b98-7e50-a216-1581ca5ebd3a","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5ff-7b98-7e50-a216-1581ca5ebd3a","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790296685,"updatedAt":1790296685,"recencyAt":1790296685,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-38-05-01a0d5ff-7b98-7e50-a216-1581ca5ebd3a.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]}},"emittedAtMs":1790296685651}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0d5ff-7b98-7e50-a216-1581ca5ebd3a","name":"codex_apps","status":"starting","error":null,"failureReason":null},"emittedAtMs":1790296685651}} {"type":"emit_inbound","label":"thread/settings/updated","frame":{"method":"thread/settings/updated","params":{"threadId":"01a0d5ff-7b98-7e50-a216-1581ca5ebd3a","threadSettings":{"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","approvalPolicy":"never","approvalsReviewer":"user","sandboxPolicy":{"type":"dangerFullAccess"},"activePermissionProfile":null,"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"effort":null,"summary":"detailed","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna","reasoning_effort":null,"developer_instructions":null}},"multiAgentMode":"explicitRequestOnly","personality":null}},"emittedAtMs":1790296685666}} -{"type":"emit_inbound","label":"turn/start","frame":{"id":5,"result":{"turn":{"id":"01a0d5ff-7c5b-7bf1-a92a-39f93af77a6c","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"emit_inbound","label":"turn/start","frame":{"id":6,"result":{"turn":{"id":"01a0d5ff-7c5b-7bf1-a92a-39f93af77a6c","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0d5ff-7b98-7e50-a216-1581ca5ebd3a","status":{"type":"active","activeFlags":[]}},"emittedAtMs":1790296685723}} {"type":"emit_inbound","label":"turn/started","frame":{"method":"turn/started","params":{"threadId":"01a0d5ff-7b98-7e50-a216-1581ca5ebd3a","turn":{"id":"01a0d5ff-7c5b-7bf1-a92a-39f93af77a6c","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":1790296685,"completedAt":null,"durationMs":null}},"emittedAtMs":1790296685723}} {"type":"emit_inbound","label":"account/updated","frame":{"method":"account/updated","params":{"authMode":"chatgpt","planType":"unknown"},"emittedAtMs":1790296686001}} diff --git a/apps/server/src/orchestration-v2/testkit/fixtures/subagent_v2_nested_approval/codex_transcript.ndjson b/apps/server/src/orchestration-v2/testkit/fixtures/subagent_v2_nested_approval/codex_transcript.ndjson index 213b6d6d36f6a..e286b3f59cdf1 100644 --- a/apps/server/src/orchestration-v2/testkit/fixtures/subagent_v2_nested_approval/codex_transcript.ndjson +++ b/apps/server/src/orchestration-v2/testkit/fixtures/subagent_v2_nested_approval/codex_transcript.ndjson @@ -2,20 +2,22 @@ {"type":"expect_outbound","label":"initialize","frame":{"id":1,"method":"initialize","params":{"capabilities":{"experimentalApi":true,"optOutNotificationMethods":["turn/diff/updated"],"extensions":{"io.modelcontextprotocol/ui":{"mimeTypes":["text/html;profile=mcp-app"]}}},"clientInfo":{"name":"T3 Code","title":"T3 Code","version":"0.0.44"}}}} {"type":"emit_inbound","label":"initialize","frame":{"id":1,"result":{"userAgent":"t3code_desktop/0.156.1 (Debian 13.0.0; x86_64) unknown (t3code_desktop; 0.1.0)","codexHome":"/home/replay-user/.cache/codex-nested-approval-rec/codex-home","platformFamily":"unix","platformOs":"linux"}}} {"type":"expect_outbound","label":"initialized","frame":{"method":"initialized"}} -{"type":"expect_outbound","label":"thread/start","frame":{"id":2,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true,"agents.max_depth":2},"cwd":"","model":"gpt-6-luna"}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":2,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":2,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"thread/start","frame":{"id":3,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true,"agents.max_depth":2},"cwd":"","model":"gpt-6-luna"}}} {"type":"emit_inbound","label":"configWarning","frame":{"method":"configWarning","params":{"summary":"Codex could not find bubblewrap on PATH. Install bubblewrap with your OS package manager. See the sandbox prerequisites: https://developers.openai.com/codex/concepts/sandboxing#prerequisites. Codex will use the bundled bubblewrap in the meantime.","details":null},"emittedAtMs":1790374254500}} {"type":"emit_inbound","label":"remoteControl/status/changed","frame":{"method":"remoteControl/status/changed","params":{"status":"disabled","serverName":"replay-host","installationId":"00000000-0000-4000-8000-000000000000","environmentId":null},"emittedAtMs":1790374254500}} -{"type":"emit_inbound","label":"thread/start","frame":{"id":2,"result":{"thread":{"id":"01a0da9f-1b19-7301-961c-a4f5e1b31832","environments":[{"environmentId":"local","cwd":"/home/replay-user/.cache/codex-nested-approval-rec/repo","runtimeWorkspaceRoots":["/home/replay-user/.cache/codex-nested-approval-rec/repo"]}],"extra":null,"sessionId":"01a0da9f-1b19-7301-961c-a4f5e1b31832","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790374255,"updatedAt":1790374255,"recencyAt":1790374255,"status":{"type":"idle"},"path":"/home/replay-user/.cache/codex-nested-approval-rec/codex-home/sessions/2026/09/25/rollout-2026-09-25T15-10-55-01a0da9f-1b19-7301-961c-a4f5e1b31832.jsonl","cwd":"/home/replay-user/.cache/codex-nested-approval-rec/repo","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/.cache/codex-nested-approval-rec/repo","runtimeWorkspaceRoots":["/home/replay-user/.cache/codex-nested-approval-rec/repo"],"instructionSources":[],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} -{"type":"expect_outbound","label":"thread/name/set","frame":{"id":3,"method":"thread/name/set","params":{"name":"Replay fixture: subagent_v2_nested_approval","threadId":"01a0da9f-1b19-7301-961c-a4f5e1b31832"}}} -{"type":"emit_inbound","label":"thread/name/set","frame":{"id":3,"result":{}}} +{"type":"emit_inbound","label":"thread/start","frame":{"id":3,"result":{"thread":{"id":"01a0da9f-1b19-7301-961c-a4f5e1b31832","environments":[{"environmentId":"local","cwd":"/home/replay-user/.cache/codex-nested-approval-rec/repo","runtimeWorkspaceRoots":["/home/replay-user/.cache/codex-nested-approval-rec/repo"]}],"extra":null,"sessionId":"01a0da9f-1b19-7301-961c-a4f5e1b31832","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790374255,"updatedAt":1790374255,"recencyAt":1790374255,"status":{"type":"idle"},"path":"/home/replay-user/.cache/codex-nested-approval-rec/codex-home/sessions/2026/09/25/rollout-2026-09-25T15-10-55-01a0da9f-1b19-7301-961c-a4f5e1b31832.jsonl","cwd":"/home/replay-user/.cache/codex-nested-approval-rec/repo","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/.cache/codex-nested-approval-rec/repo","runtimeWorkspaceRoots":["/home/replay-user/.cache/codex-nested-approval-rec/repo"],"instructionSources":[],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} +{"type":"expect_outbound","label":"thread/name/set","frame":{"id":4,"method":"thread/name/set","params":{"name":"Replay fixture: subagent_v2_nested_approval","threadId":"01a0da9f-1b19-7301-961c-a4f5e1b31832"}}} +{"type":"emit_inbound","label":"thread/name/set","frame":{"id":4,"result":{}}} {"type":"emit_inbound","label":"thread/name/updated","frame":{"method":"thread/name/updated","params":{"threadId":"01a0da9f-1b19-7301-961c-a4f5e1b31832","threadName":"Replay fixture: subagent_v2_nested_approval"}}} -{"type":"expect_outbound","label":"config/read","frame":{"id":4,"method":"config/read","params":{"cwd":"","includeLayers":false}}} -{"type":"emit_inbound","label":"config/read","frame":{"id":4,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"turn/start","frame":{"id":5,"method":"turn/start","params":{"approvalPolicy":"untrusted","approvalsReviewer":"user","cwd":"","input":[{"text":"Do not run any commands yourself. Spawn one subagent and tell it not to run any commands itself but to spawn its own subagent, whose only task is to run this exact shell command: printf 'nested approval fixture' > nested-approval.txt and then reply with exactly: Written. Each agent waits for its child and replies with exactly what the child said. Wait for your subagent, then reply with exactly what it said.","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"type":"readOnly"},"summary":"auto","threadId":"01a0da9f-1b19-7301-961c-a4f5e1b31832","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":5,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":5,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"turn/start","frame":{"id":6,"method":"turn/start","params":{"approvalPolicy":"untrusted","approvalsReviewer":"user","cwd":"","input":[{"text":"Do not run any commands yourself. Spawn one subagent and tell it not to run any commands itself but to spawn its own subagent, whose only task is to run this exact shell command: printf 'nested approval fixture' > nested-approval.txt and then reply with exactly: Written. Each agent waits for its child and replies with exactly what the child said. Wait for your subagent, then reply with exactly what it said.","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"type":"readOnly"},"summary":"auto","threadId":"01a0da9f-1b19-7301-961c-a4f5e1b31832","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} {"type":"emit_inbound","label":"thread/started","frame":{"method":"thread/started","params":{"thread":{"id":"01a0da9f-1b19-7301-961c-a4f5e1b31832","environments":[{"environmentId":"local","cwd":"/home/replay-user/.cache/codex-nested-approval-rec/repo","runtimeWorkspaceRoots":["/home/replay-user/.cache/codex-nested-approval-rec/repo"]}],"extra":null,"sessionId":"01a0da9f-1b19-7301-961c-a4f5e1b31832","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790374255,"updatedAt":1790374255,"recencyAt":1790374255,"status":{"type":"idle"},"path":"/home/replay-user/.cache/codex-nested-approval-rec/codex-home/sessions/2026/09/25/rollout-2026-09-25T15-10-55-01a0da9f-1b19-7301-961c-a4f5e1b31832.jsonl","cwd":"/home/replay-user/.cache/codex-nested-approval-rec/repo","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]}},"emittedAtMs":1790374255463}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0da9f-1b19-7301-961c-a4f5e1b31832","name":"codex_apps","status":"starting","error":null,"failureReason":null},"emittedAtMs":1790374255463}} {"type":"emit_inbound","label":"thread/settings/updated","frame":{"method":"thread/settings/updated","params":{"threadId":"01a0da9f-1b19-7301-961c-a4f5e1b31832","threadSettings":{"disabledPluginIds":[],"cwd":"/home/replay-user/.cache/codex-nested-approval-rec/repo","approvalPolicy":"untrusted","approvalsReviewer":"user","sandboxPolicy":{"type":"readOnly","networkAccess":false},"activePermissionProfile":null,"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"effort":null,"summary":"detailed","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna","reasoning_effort":null,"developer_instructions":null}},"multiAgentMode":"explicitRequestOnly","personality":null}},"emittedAtMs":1790374255475}} -{"type":"emit_inbound","label":"turn/start","frame":{"id":5,"result":{"turn":{"id":"01a0da9f-1b6f-7dd3-90da-e6c8797c1da6","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"emit_inbound","label":"turn/start","frame":{"id":6,"result":{"turn":{"id":"01a0da9f-1b6f-7dd3-90da-e6c8797c1da6","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0da9f-1b19-7301-961c-a4f5e1b31832","status":{"type":"active","activeFlags":[]}},"emittedAtMs":1790374255518}} {"type":"emit_inbound","label":"turn/started","frame":{"method":"turn/started","params":{"threadId":"01a0da9f-1b19-7301-961c-a4f5e1b31832","turn":{"id":"01a0da9f-1b6f-7dd3-90da-e6c8797c1da6","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":1790374255,"completedAt":null,"durationMs":null}},"emittedAtMs":1790374255518}} {"type":"emit_inbound","label":"account/updated","frame":{"method":"account/updated","params":{"authMode":"chatgpt","planType":"unknown"},"emittedAtMs":1790374255710}} diff --git a/apps/server/src/orchestration-v2/testkit/fixtures/thread_fork_native_prior_turn/codex_transcript.ndjson b/apps/server/src/orchestration-v2/testkit/fixtures/thread_fork_native_prior_turn/codex_transcript.ndjson index 8d84a2031d661..405ce582f6ea0 100644 --- a/apps/server/src/orchestration-v2/testkit/fixtures/thread_fork_native_prior_turn/codex_transcript.ndjson +++ b/apps/server/src/orchestration-v2/testkit/fixtures/thread_fork_native_prior_turn/codex_transcript.ndjson @@ -2,21 +2,23 @@ {"type":"expect_outbound","label":"initialize/source","frame":{"id":1,"method":"initialize","params":{"capabilities":{"experimentalApi":true,"optOutNotificationMethods":["turn/diff/updated"],"extensions":{"io.modelcontextprotocol/ui":{"mimeTypes":["text/html;profile=mcp-app"]}}},"clientInfo":{"name":"T3 Code","title":"T3 Code","version":"0.0.44"}}}} {"type":"emit_inbound","label":"initialize/source","frame":{"id":1,"result":{"userAgent":"t3code_desktop/0.124.0-alpha.3","codexHome":"/home/replay-user/.codex","platformFamily":"unix","platformOs":"macos"}}} {"type":"expect_outbound","label":"initialized/source","frame":{"method":"initialized"}} -{"type":"expect_outbound","label":"thread/start","frame":{"id":2,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true}}}} -{"type":"emit_inbound","label":"thread/start","frame":{"id":2,"result":{"thread":{"id":"019dd6ba-2681-7bf0-b051-141b0cbcbb27","forkedFromId":null,"preview":"","ephemeral":false,"modelProvider":"openai","createdAt":1777424017,"updatedAt":1777424017,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/04/28/rollout-2026-04-28T17-53-37-019dd6ba-2681-7bf0-b051-141b0cbcbb27.jsonl","cwd":"/home/replay-user/t3code","cliVersion":"0.124.0-alpha.3","source":"vscode","agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"turns":[]},"model":"gpt-5.5","modelProvider":"openai","serviceTier":"fast","cwd":"/home/replay-user/t3code","instructionSources":["/home/replay-user/.codex/AGENTS.md","/home/replay-user/t3code/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":["/home/replay-user/.codex/memories"],"readOnlyAccess":{"type":"fullAccess"},"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"permissionProfile":{"network":{"enabled":false},"fileSystem":{"entries":[{"path":{"type":"special","value":{"kind":"root"}},"access":"read"},{"path":{"type":"special","value":{"kind":"current_working_directory"}},"access":"write"},{"path":{"type":"special","value":{"kind":"slash_tmp"}},"access":"write"},{"path":{"type":"special","value":{"kind":"tmpdir"}},"access":"write"},{"path":{"type":"path","path":"/home/replay-user/.codex/memories"},"access":"write"},{"path":{"type":"path","path":"/home/replay-user/Development/Work/codething-mvp/.git/worktrees/t3code-c1e5e1d1"},"access":"read"},{"path":{"type":"path","path":"/home/replay-user/t3code/.git"},"access":"read"},{"path":{"type":"path","path":"/home/replay-user/t3code/.codex"},"access":"read"}]}},"reasoningEffort":"medium"}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":2,"method":"config/read","params":{"includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":2,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"thread/start","frame":{"id":3,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true}}}} +{"type":"emit_inbound","label":"thread/start","frame":{"id":3,"result":{"thread":{"id":"019dd6ba-2681-7bf0-b051-141b0cbcbb27","forkedFromId":null,"preview":"","ephemeral":false,"modelProvider":"openai","createdAt":1777424017,"updatedAt":1777424017,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/04/28/rollout-2026-04-28T17-53-37-019dd6ba-2681-7bf0-b051-141b0cbcbb27.jsonl","cwd":"/home/replay-user/t3code","cliVersion":"0.124.0-alpha.3","source":"vscode","agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"turns":[]},"model":"gpt-5.5","modelProvider":"openai","serviceTier":"fast","cwd":"/home/replay-user/t3code","instructionSources":["/home/replay-user/.codex/AGENTS.md","/home/replay-user/t3code/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":["/home/replay-user/.codex/memories"],"readOnlyAccess":{"type":"fullAccess"},"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"permissionProfile":{"network":{"enabled":false},"fileSystem":{"entries":[{"path":{"type":"special","value":{"kind":"root"}},"access":"read"},{"path":{"type":"special","value":{"kind":"current_working_directory"}},"access":"write"},{"path":{"type":"special","value":{"kind":"slash_tmp"}},"access":"write"},{"path":{"type":"special","value":{"kind":"tmpdir"}},"access":"write"},{"path":{"type":"path","path":"/home/replay-user/.codex/memories"},"access":"write"},{"path":{"type":"path","path":"/home/replay-user/Development/Work/codething-mvp/.git/worktrees/t3code-c1e5e1d1"},"access":"read"},{"path":{"type":"path","path":"/home/replay-user/t3code/.git"},"access":"read"},{"path":{"type":"path","path":"/home/replay-user/t3code/.codex"},"access":"read"}]}},"reasoningEffort":"medium"}}} {"type":"emit_inbound","label":"thread/started","frame":{"method":"thread/started","params":{"thread":{"id":"019dd6ba-2681-7bf0-b051-141b0cbcbb27","forkedFromId":null,"preview":"","ephemeral":false,"modelProvider":"openai","createdAt":1777424017,"updatedAt":1777424017,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/04/28/rollout-2026-04-28T17-53-37-019dd6ba-2681-7bf0-b051-141b0cbcbb27.jsonl","cwd":"/home/replay-user/t3code","cliVersion":"0.124.0-alpha.3","source":"vscode","agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"turns":[]}}}} -{"type":"expect_outbound","label":"thread/name/set","frame":{"id":3,"method":"thread/name/set","params":{"name":"Source thread","threadId":"019dd6ba-2681-7bf0-b051-141b0cbcbb27"}}} -{"type":"emit_inbound","label":"thread/name/set","frame":{"id":3,"result":{}}} +{"type":"expect_outbound","label":"thread/name/set","frame":{"id":4,"method":"thread/name/set","params":{"name":"Source thread","threadId":"019dd6ba-2681-7bf0-b051-141b0cbcbb27"}}} +{"type":"emit_inbound","label":"thread/name/set","frame":{"id":4,"result":{}}} {"type":"emit_inbound","label":"thread/name/updated","frame":{"method":"thread/name/updated","params":{"threadId":"019dd6ba-2681-7bf0-b051-141b0cbcbb27","threadName":"Source thread"}}} -{"type":"expect_outbound","label":"config/read","frame":{"id":4,"method":"config/read","params":{"cwd":"","includeLayers":false}}} -{"type":"emit_inbound","label":"config/read","frame":{"id":4,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"turn/start","frame":{"id":5,"method":"turn/start","params":{"approvalPolicy":"never","cwd":"","input":[{"type":"text","text":"For this fork-boundary fixture, respond with exactly: fork boundary alpha"}],"model":"gpt-5.4","sandboxPolicy":{"type":"readOnly","networkAccess":false},"threadId":"019dd6ba-2681-7bf0-b051-141b0cbcbb27","approvalsReviewer":"user","summary":"auto","collaborationMode":{"mode":"default","settings":{"model":"gpt-5.4"}}}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":5,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":5,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"turn/start","frame":{"id":6,"method":"turn/start","params":{"approvalPolicy":"never","cwd":"","input":[{"type":"text","text":"For this fork-boundary fixture, respond with exactly: fork boundary alpha"}],"model":"gpt-5.4","sandboxPolicy":{"type":"readOnly","networkAccess":false},"threadId":"019dd6ba-2681-7bf0-b051-141b0cbcbb27","approvalsReviewer":"user","summary":"auto","collaborationMode":{"mode":"default","settings":{"model":"gpt-5.4"}}}}} {"type":"emit_inbound","label":"deprecationNotice","frame":{"method":"deprecationNotice","params":{"summary":"`[features].collab` is deprecated. Use `[features].multi_agent` instead.","details":"Enable it with `--enable multi_agent` or `[features].multi_agent` in config.toml. See https://developers.openai.com/codex/config-basic#feature-flags for details."}}} {"type":"emit_inbound","label":"warning","frame":{"method":"warning","params":{"threadId":"019dd6ba-2681-7bf0-b051-141b0cbcbb27","message":"Under-development features enabled: apply_patch_freeform. Under-development features are incomplete and may behave unpredictably. To suppress this warning, set `suppress_unstable_features_warning = true` in /home/replay-user/.codex/config.toml."}}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"name":"codex_apps","status":"starting","error":null}}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"name":"computer-use","status":"starting","error":null}}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"name":"uidotsh","status":"starting","error":null}}} -{"type":"emit_inbound","label":"turn/start","frame":{"id":5,"result":{"turn":{"id":"019dd6ba-268b-7f82-8f4c-9fde0edcfd55","items":[],"status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"emit_inbound","label":"turn/start","frame":{"id":6,"result":{"turn":{"id":"019dd6ba-268b-7f82-8f4c-9fde0edcfd55","items":[],"status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"019dd6ba-2681-7bf0-b051-141b0cbcbb27","status":{"type":"active","activeFlags":[]}}}} {"type":"emit_inbound","label":"turn/started","frame":{"method":"turn/started","params":{"threadId":"019dd6ba-2681-7bf0-b051-141b0cbcbb27","turn":{"id":"019dd6ba-268b-7f82-8f4c-9fde0edcfd55","items":[],"status":"inProgress","error":null,"startedAt":1777424017,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"name":"computer-use","status":"ready","error":null}}} @@ -36,10 +38,10 @@ {"type":"emit_inbound","label":"account/rateLimits/updated","frame":{"method":"account/rateLimits/updated","params":{"rateLimits":{"limitId":"codex","limitName":null,"primary":{"usedPercent":61,"windowDurationMins":300,"resetsAt":1777429830},"secondary":{"usedPercent":23,"windowDurationMins":10080,"resetsAt":1777959590},"credits":null,"planType":"unknown","rateLimitReachedType":null}}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"019dd6ba-2681-7bf0-b051-141b0cbcbb27","status":{"type":"idle"}}}} {"type":"emit_inbound","label":"turn/completed","frame":{"method":"turn/completed","params":{"threadId":"019dd6ba-2681-7bf0-b051-141b0cbcbb27","turn":{"id":"019dd6ba-268b-7f82-8f4c-9fde0edcfd55","items":[],"status":"completed","error":null,"startedAt":1777424017,"completedAt":1777424023,"durationMs":6880}}}} -{"type":"expect_outbound","label":"config/read","frame":{"id":6,"method":"config/read","params":{"cwd":"","includeLayers":false}}} -{"type":"emit_inbound","label":"config/read","frame":{"id":6,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"turn/start","frame":{"id":7,"method":"turn/start","params":{"approvalPolicy":"never","cwd":"","input":[{"type":"text","text":"For this fork-boundary fixture, respond with exactly: fork boundary beta"}],"model":"gpt-5.4","sandboxPolicy":{"type":"readOnly","networkAccess":false},"threadId":"019dd6ba-2681-7bf0-b051-141b0cbcbb27","approvalsReviewer":"user","summary":"auto","collaborationMode":{"mode":"default","settings":{"model":"gpt-5.4"}}}}} -{"type":"emit_inbound","label":"turn/start","frame":{"id":7,"result":{"turn":{"id":"019dd6ba-416d-7902-95cf-d4179c3f4738","items":[],"status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":7,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":7,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"turn/start","frame":{"id":8,"method":"turn/start","params":{"approvalPolicy":"never","cwd":"","input":[{"type":"text","text":"For this fork-boundary fixture, respond with exactly: fork boundary beta"}],"model":"gpt-5.4","sandboxPolicy":{"type":"readOnly","networkAccess":false},"threadId":"019dd6ba-2681-7bf0-b051-141b0cbcbb27","approvalsReviewer":"user","summary":"auto","collaborationMode":{"mode":"default","settings":{"model":"gpt-5.4"}}}}} +{"type":"emit_inbound","label":"turn/start","frame":{"id":8,"result":{"turn":{"id":"019dd6ba-416d-7902-95cf-d4179c3f4738","items":[],"status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"019dd6ba-2681-7bf0-b051-141b0cbcbb27","status":{"type":"active","activeFlags":[]}}}} {"type":"emit_inbound","label":"turn/started","frame":{"method":"turn/started","params":{"threadId":"019dd6ba-2681-7bf0-b051-141b0cbcbb27","turn":{"id":"019dd6ba-416d-7902-95cf-d4179c3f4738","items":[],"status":"inProgress","error":null,"startedAt":1777424023,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"item/started","frame":{"method":"item/started","params":{"item":{"type":"userMessage","id":"e8550ffa-7e59-48b3-8fd2-7bbca932ab95","content":[{"type":"text","text":"For this fork-boundary fixture, respond with exactly: fork boundary beta","text_elements":[]}]},"threadId":"019dd6ba-2681-7bf0-b051-141b0cbcbb27","turnId":"019dd6ba-416d-7902-95cf-d4179c3f4738"}}} @@ -55,21 +57,23 @@ {"type":"emit_inbound","label":"account/rateLimits/updated","frame":{"method":"account/rateLimits/updated","params":{"rateLimits":{"limitId":"codex","limitName":null,"primary":{"usedPercent":61,"windowDurationMins":300,"resetsAt":1777429830},"secondary":{"usedPercent":23,"windowDurationMins":10080,"resetsAt":1777959590},"credits":null,"planType":"unknown","rateLimitReachedType":null}}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"019dd6ba-2681-7bf0-b051-141b0cbcbb27","status":{"type":"idle"}}}} {"type":"emit_inbound","label":"turn/completed","frame":{"method":"turn/completed","params":{"threadId":"019dd6ba-2681-7bf0-b051-141b0cbcbb27","turn":{"id":"019dd6ba-416d-7902-95cf-d4179c3f4738","items":[],"status":"completed","error":null,"startedAt":1777424023,"completedAt":1777424025,"durationMs":1596}}}} -{"type":"expect_outbound","label":"thread/fork","frame":{"id":8,"method":"thread/fork","params":{"threadId":"019dd6ba-2681-7bf0-b051-141b0cbcbb27","excludeTurns":true,"lastTurnId":"019dd6ba-268b-7f82-8f4c-9fde0edcfd55","config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true}}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":9,"method":"config/read","params":{"includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":9,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"thread/fork","frame":{"id":10,"method":"thread/fork","params":{"threadId":"019dd6ba-2681-7bf0-b051-141b0cbcbb27","excludeTurns":true,"lastTurnId":"019dd6ba-268b-7f82-8f4c-9fde0edcfd55","config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true}}}} {"type":"emit_inbound","label":"deprecationNotice","frame":{"method":"deprecationNotice","params":{"summary":"`[features].collab` is deprecated. Use `[features].multi_agent` instead.","details":"Enable it with `--enable multi_agent` or `[features].multi_agent` in config.toml. See https://developers.openai.com/codex/config-basic#feature-flags for details."}}} {"type":"emit_inbound","label":"warning","frame":{"method":"warning","params":{"threadId":"019dd6ba-47b7-7092-8688-9cf7fe5f6498","message":"Under-development features enabled: apply_patch_freeform. Under-development features are incomplete and may behave unpredictably. To suppress this warning, set `suppress_unstable_features_warning = true` in /home/replay-user/.codex/config.toml."}}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"name":"uidotsh","status":"starting","error":null}}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"name":"computer-use","status":"starting","error":null}}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"name":"codex_apps","status":"starting","error":null}}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"name":"computer-use","status":"ready","error":null}}} -{"type":"emit_inbound","label":"thread/fork","frame":{"id":8,"result":{"thread":{"id":"019dd6ba-47b7-7092-8688-9cf7fe5f6498","forkedFromId":"019dd6ba-2681-7bf0-b051-141b0cbcbb27","preview":"For this fork-boundary fixture, respond with exactly: fork boundary alpha","ephemeral":false,"modelProvider":"openai","createdAt":1777424025,"updatedAt":1777424025,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/04/28/rollout-2026-04-28T17-53-45-019dd6ba-47b7-7092-8688-9cf7fe5f6498.jsonl","cwd":"/home/replay-user/t3code","cliVersion":"0.124.0-alpha.3","source":"vscode","agentNickname":null,"agentRole":null,"gitInfo":{"sha":"969e8ea4fac1f2066ed50dd4f82b5fd0014d8a4d","branch":"t3code/codex-turn-mapping","originUrl":"git@github.com:pingdotgg/t3code.git"},"name":null,"turns":[{"id":"019dd6ba-268b-7f82-8f4c-9fde0edcfd55","items":[{"type":"userMessage","id":"item-1","content":[{"type":"text","text":"For this fork-boundary fixture, respond with exactly: fork boundary alpha","text_elements":[]}]},{"type":"agentMessage","id":"item-2","text":"fork boundary alpha","phase":"final_answer","memoryCitation":null}],"status":"completed","error":null,"startedAt":1777424017,"completedAt":1777424023,"durationMs":6880}]},"model":"gpt-5.5","modelProvider":"openai","serviceTier":"fast","cwd":"/home/replay-user/t3code","instructionSources":["/home/replay-user/.codex/AGENTS.md","/home/replay-user/t3code/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":["/home/replay-user/.codex/memories"],"readOnlyAccess":{"type":"fullAccess"},"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"permissionProfile":{"network":{"enabled":false},"fileSystem":{"entries":[{"path":{"type":"special","value":{"kind":"root"}},"access":"read"},{"path":{"type":"special","value":{"kind":"current_working_directory"}},"access":"write"},{"path":{"type":"special","value":{"kind":"slash_tmp"}},"access":"write"},{"path":{"type":"special","value":{"kind":"tmpdir"}},"access":"write"},{"path":{"type":"path","path":"/home/replay-user/.codex/memories"},"access":"write"},{"path":{"type":"path","path":"/home/replay-user/Development/Work/codething-mvp/.git/worktrees/t3code-c1e5e1d1"},"access":"read"},{"path":{"type":"path","path":"/home/replay-user/t3code/.git"},"access":"read"},{"path":{"type":"path","path":"/home/replay-user/t3code/.codex"},"access":"read"}]}},"reasoningEffort":"medium"}}} -{"type":"expect_outbound","label":"thread/name/set","frame":{"id":9,"method":"thread/name/set","params":{"name":"Forked from first response","threadId":"019dd6ba-47b7-7092-8688-9cf7fe5f6498"}}} -{"type":"emit_inbound","label":"thread/name/set","frame":{"id":9,"result":{}}} +{"type":"emit_inbound","label":"thread/fork","frame":{"id":10,"result":{"thread":{"id":"019dd6ba-47b7-7092-8688-9cf7fe5f6498","forkedFromId":"019dd6ba-2681-7bf0-b051-141b0cbcbb27","preview":"For this fork-boundary fixture, respond with exactly: fork boundary alpha","ephemeral":false,"modelProvider":"openai","createdAt":1777424025,"updatedAt":1777424025,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/04/28/rollout-2026-04-28T17-53-45-019dd6ba-47b7-7092-8688-9cf7fe5f6498.jsonl","cwd":"/home/replay-user/t3code","cliVersion":"0.124.0-alpha.3","source":"vscode","agentNickname":null,"agentRole":null,"gitInfo":{"sha":"969e8ea4fac1f2066ed50dd4f82b5fd0014d8a4d","branch":"t3code/codex-turn-mapping","originUrl":"git@github.com:pingdotgg/t3code.git"},"name":null,"turns":[{"id":"019dd6ba-268b-7f82-8f4c-9fde0edcfd55","items":[{"type":"userMessage","id":"item-1","content":[{"type":"text","text":"For this fork-boundary fixture, respond with exactly: fork boundary alpha","text_elements":[]}]},{"type":"agentMessage","id":"item-2","text":"fork boundary alpha","phase":"final_answer","memoryCitation":null}],"status":"completed","error":null,"startedAt":1777424017,"completedAt":1777424023,"durationMs":6880}]},"model":"gpt-5.5","modelProvider":"openai","serviceTier":"fast","cwd":"/home/replay-user/t3code","instructionSources":["/home/replay-user/.codex/AGENTS.md","/home/replay-user/t3code/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":["/home/replay-user/.codex/memories"],"readOnlyAccess":{"type":"fullAccess"},"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"permissionProfile":{"network":{"enabled":false},"fileSystem":{"entries":[{"path":{"type":"special","value":{"kind":"root"}},"access":"read"},{"path":{"type":"special","value":{"kind":"current_working_directory"}},"access":"write"},{"path":{"type":"special","value":{"kind":"slash_tmp"}},"access":"write"},{"path":{"type":"special","value":{"kind":"tmpdir"}},"access":"write"},{"path":{"type":"path","path":"/home/replay-user/.codex/memories"},"access":"write"},{"path":{"type":"path","path":"/home/replay-user/Development/Work/codething-mvp/.git/worktrees/t3code-c1e5e1d1"},"access":"read"},{"path":{"type":"path","path":"/home/replay-user/t3code/.git"},"access":"read"},{"path":{"type":"path","path":"/home/replay-user/t3code/.codex"},"access":"read"}]}},"reasoningEffort":"medium"}}} +{"type":"expect_outbound","label":"thread/name/set","frame":{"id":11,"method":"thread/name/set","params":{"name":"Forked from first response","threadId":"019dd6ba-47b7-7092-8688-9cf7fe5f6498"}}} +{"type":"emit_inbound","label":"thread/name/set","frame":{"id":11,"result":{}}} {"type":"emit_inbound","label":"thread/name/updated","frame":{"method":"thread/name/updated","params":{"threadId":"019dd6ba-47b7-7092-8688-9cf7fe5f6498","threadName":"Forked from first response"}}} -{"type":"expect_outbound","label":"config/read","frame":{"id":10,"method":"config/read","params":{"cwd":"","includeLayers":false}}} -{"type":"emit_inbound","label":"config/read","frame":{"id":10,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"turn/start","frame":{"id":11,"method":"turn/start","params":{"approvalPolicy":"never","cwd":"","input":[{"type":"text","text":"Repeat the user-visible conversation so far verbatim. Include only user and assistant messages. Do not include hidden system/developer content."}],"model":"gpt-5.4","sandboxPolicy":{"type":"readOnly","networkAccess":false},"threadId":"019dd6ba-47b7-7092-8688-9cf7fe5f6498","approvalsReviewer":"user","summary":"auto","collaborationMode":{"mode":"default","settings":{"model":"gpt-5.4"}}}}} -{"type":"emit_inbound","label":"turn/start","frame":{"id":11,"result":{"turn":{"id":"019dd6ba-47eb-7041-ad45-5abe752c28c9","items":[],"status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":12,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":12,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"turn/start","frame":{"id":13,"method":"turn/start","params":{"approvalPolicy":"never","cwd":"","input":[{"type":"text","text":"Repeat the user-visible conversation so far verbatim. Include only user and assistant messages. Do not include hidden system/developer content."}],"model":"gpt-5.4","sandboxPolicy":{"type":"readOnly","networkAccess":false},"threadId":"019dd6ba-47b7-7092-8688-9cf7fe5f6498","approvalsReviewer":"user","summary":"auto","collaborationMode":{"mode":"default","settings":{"model":"gpt-5.4"}}}}} +{"type":"emit_inbound","label":"turn/start","frame":{"id":13,"result":{"turn":{"id":"019dd6ba-47eb-7041-ad45-5abe752c28c9","items":[],"status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"019dd6ba-47b7-7092-8688-9cf7fe5f6498","status":{"type":"active","activeFlags":[]}}}} {"type":"emit_inbound","label":"turn/started","frame":{"method":"turn/started","params":{"threadId":"019dd6ba-47b7-7092-8688-9cf7fe5f6498","turn":{"id":"019dd6ba-47eb-7041-ad45-5abe752c28c9","items":[],"status":"inProgress","error":null,"startedAt":1777424025,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"name":"uidotsh","status":"ready","error":null}}} diff --git a/apps/server/src/orchestration-v2/testkit/fixtures/thread_merge_back_siblings/codex_transcript.ndjson b/apps/server/src/orchestration-v2/testkit/fixtures/thread_merge_back_siblings/codex_transcript.ndjson index 4a9de158436dd..42802821be26e 100644 --- a/apps/server/src/orchestration-v2/testkit/fixtures/thread_merge_back_siblings/codex_transcript.ndjson +++ b/apps/server/src/orchestration-v2/testkit/fixtures/thread_merge_back_siblings/codex_transcript.ndjson @@ -2,20 +2,22 @@ {"type":"expect_outbound","label":"initialize","frame":{"id":1,"method":"initialize","params":{"capabilities":{"experimentalApi":true,"optOutNotificationMethods":["turn/diff/updated"],"extensions":{"io.modelcontextprotocol/ui":{"mimeTypes":["text/html;profile=mcp-app"]}}},"clientInfo":{"name":"T3 Code","title":"T3 Code","version":"0.0.44"}}}} {"type":"emit_inbound","label":"initialize","frame":{"id":1,"result":{"userAgent":"t3code_desktop/0.156.1 (Debian 13.0.0; x86_64) unknown (t3code_desktop; 0.1.0)","codexHome":"/home/replay-user/.codex","platformFamily":"unix","platformOs":"linux"}}} {"type":"expect_outbound","label":"initialized","frame":{"method":"initialized"}} -{"type":"expect_outbound","label":"thread/start","frame":{"id":2,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","model":"gpt-6-sol"}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":2,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":2,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"thread/start","frame":{"id":3,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","model":"gpt-6-sol"}}} {"type":"emit_inbound","label":"configWarning","frame":{"method":"configWarning","params":{"summary":"Codex could not find bubblewrap on PATH. Install bubblewrap with your OS package manager. See the sandbox prerequisites: https://developers.openai.com/codex/concepts/sandboxing#prerequisites. Codex will use the bundled bubblewrap in the meantime.","details":null},"emittedAtMs":1790297773374}} {"type":"emit_inbound","label":"remoteControl/status/changed","frame":{"method":"remoteControl/status/changed","params":{"status":"disabled","serverName":"replay-host","installationId":"00000000-0000-4000-8000-000000000000","environmentId":null},"emittedAtMs":1790297773374}} -{"type":"emit_inbound","label":"thread/start","frame":{"id":2,"result":{"thread":{"id":"01a0d610-155f-7391-843e-120bf1475357","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d610-155f-7391-843e-120bf1475357","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-sol","reasoningEffort":null,"createdAt":1790297773,"updatedAt":1790297773,"recencyAt":1790297773,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-56-13-01a0d610-155f-7391-843e-120bf1475357.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-sol","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"],"instructionSources":["/home/replay-user/.codex/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} -{"type":"expect_outbound","label":"thread/name/set","frame":{"id":3,"method":"thread/name/set","params":{"name":"Merge-back source","threadId":"01a0d610-155f-7391-843e-120bf1475357"}}} -{"type":"emit_inbound","label":"thread/name/set","frame":{"id":3,"result":{}}} +{"type":"emit_inbound","label":"thread/start","frame":{"id":3,"result":{"thread":{"id":"01a0d610-155f-7391-843e-120bf1475357","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d610-155f-7391-843e-120bf1475357","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-sol","reasoningEffort":null,"createdAt":1790297773,"updatedAt":1790297773,"recencyAt":1790297773,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-56-13-01a0d610-155f-7391-843e-120bf1475357.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-sol","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"],"instructionSources":["/home/replay-user/.codex/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} +{"type":"expect_outbound","label":"thread/name/set","frame":{"id":4,"method":"thread/name/set","params":{"name":"Merge-back source","threadId":"01a0d610-155f-7391-843e-120bf1475357"}}} +{"type":"emit_inbound","label":"thread/name/set","frame":{"id":4,"result":{}}} {"type":"emit_inbound","label":"thread/name/updated","frame":{"method":"thread/name/updated","params":{"threadId":"01a0d610-155f-7391-843e-120bf1475357","threadName":"Merge-back source"}}} -{"type":"expect_outbound","label":"config/read","frame":{"id":4,"method":"config/read","params":{"cwd":"","includeLayers":false}}} -{"type":"emit_inbound","label":"config/read","frame":{"id":4,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"turn/start","frame":{"id":5,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Remember the opaque marker merge-sibling-source-3C7K for later in this conversation. Respond with exactly: merge sibling source stored","type":"text"}],"model":"gpt-6-sol","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0d610-155f-7391-843e-120bf1475357","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-sol"}}}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":5,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":5,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"turn/start","frame":{"id":6,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Remember the opaque marker merge-sibling-source-3C7K for later in this conversation. Respond with exactly: merge sibling source stored","type":"text"}],"model":"gpt-6-sol","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0d610-155f-7391-843e-120bf1475357","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-sol"}}}}} {"type":"emit_inbound","label":"thread/started","frame":{"method":"thread/started","params":{"thread":{"id":"01a0d610-155f-7391-843e-120bf1475357","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d610-155f-7391-843e-120bf1475357","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-sol","reasoningEffort":null,"createdAt":1790297773,"updatedAt":1790297773,"recencyAt":1790297773,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-56-13-01a0d610-155f-7391-843e-120bf1475357.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]}},"emittedAtMs":1790297773588}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0d610-155f-7391-843e-120bf1475357","name":"codex_apps","status":"starting","error":null,"failureReason":null},"emittedAtMs":1790297773588}} {"type":"emit_inbound","label":"thread/settings/updated","frame":{"method":"thread/settings/updated","params":{"threadId":"01a0d610-155f-7391-843e-120bf1475357","threadSettings":{"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","approvalPolicy":"never","approvalsReviewer":"user","sandboxPolicy":{"type":"dangerFullAccess"},"activePermissionProfile":null,"model":"gpt-6-sol","modelProvider":"openai","serviceTier":null,"effort":null,"summary":"detailed","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-sol","reasoning_effort":null,"developer_instructions":null}},"multiAgentMode":"explicitRequestOnly","personality":null}},"emittedAtMs":1790297773608}} -{"type":"emit_inbound","label":"turn/start","frame":{"id":5,"result":{"turn":{"id":"01a0d610-1619-7d91-bae2-ec4a7b899193","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"emit_inbound","label":"turn/start","frame":{"id":6,"result":{"turn":{"id":"01a0d610-1619-7d91-bae2-ec4a7b899193","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0d610-155f-7391-843e-120bf1475357","status":{"type":"active","activeFlags":[]}},"emittedAtMs":1790297773650}} {"type":"emit_inbound","label":"turn/started","frame":{"method":"turn/started","params":{"threadId":"01a0d610-155f-7391-843e-120bf1475357","turn":{"id":"01a0d610-1619-7d91-bae2-ec4a7b899193","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":1790297773,"completedAt":null,"durationMs":null}},"emittedAtMs":1790297773650}} {"type":"emit_inbound","label":"account/updated","frame":{"method":"account/updated","params":{"authMode":"chatgpt","planType":"unknown"},"emittedAtMs":1790297773993}} @@ -32,22 +34,24 @@ {"type":"emit_inbound","label":"thread/tokenUsage/updated","frame":{"method":"thread/tokenUsage/updated","params":{"threadId":"01a0d610-155f-7391-843e-120bf1475357","turnId":"01a0d610-1619-7d91-bae2-ec4a7b899193","tokenUsage":{"total":{"totalTokens":17752,"inputTokens":17744,"cachedInputTokens":14848,"cacheWriteInputTokens":0,"outputTokens":8,"reasoningOutputTokens":0},"last":{"totalTokens":17752,"inputTokens":17744,"cachedInputTokens":14848,"cacheWriteInputTokens":0,"outputTokens":8,"reasoningOutputTokens":0},"modelContextWindow":258400}},"emittedAtMs":1790297778003}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0d610-155f-7391-843e-120bf1475357","status":{"type":"idle"}},"emittedAtMs":1790297778011}} {"type":"emit_inbound","label":"turn/completed","frame":{"method":"turn/completed","params":{"threadId":"01a0d610-155f-7391-843e-120bf1475357","turn":{"id":"01a0d610-1619-7d91-bae2-ec4a7b899193","items":[{"type":"agentMessage","id":"msg_0c4d0b070a58ed52016ab5c6b1b0fc87d0a540ea4be4112eb0","text":"merge sibling source stored","phase":"final_answer","memoryCitation":null,"delivery":null,"questions":null}],"itemsView":"summary","status":"completed","error":null,"startedAt":1790297773,"completedAt":1790297778,"durationMs":4400}},"emittedAtMs":1790297778011}} -{"type":"expect_outbound","label":"thread/fork","frame":{"id":6,"method":"thread/fork","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","excludeTurns":true,"lastTurnId":"01a0d610-1619-7d91-bae2-ec4a7b899193","model":"gpt-6-sol","threadId":"01a0d610-155f-7391-843e-120bf1475357"}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":7,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":7,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"thread/fork","frame":{"id":8,"method":"thread/fork","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","excludeTurns":true,"lastTurnId":"01a0d610-1619-7d91-bae2-ec4a7b899193","model":"gpt-6-sol","threadId":"01a0d610-155f-7391-843e-120bf1475357"}}} {"type":"emit_inbound","label":"deprecationNotice","frame":{"method":"deprecationNotice","params":{"summary":"Full-history hydration is deprecated for paginated threads; use `excludeTurns: true`, then page with `thread/turns/list` and `thread/items/list`.","details":null},"emittedAtMs":1790297778016}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0d610-155f-7391-843e-120bf1475357","name":"xcodebuildmcp","status":"ready","error":null,"failureReason":null},"emittedAtMs":1790297778263}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0d610-2789-7bb3-a492-ad7fa8a7db9c","name":"codex_apps","status":"starting","error":null,"failureReason":null},"emittedAtMs":1790297778313}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0d610-2789-7bb3-a492-ad7fa8a7db9c","name":"xcodebuildmcp","status":"starting","error":null,"failureReason":null},"emittedAtMs":1790297778313}} -{"type":"emit_inbound","label":"thread/fork","frame":{"id":6,"result":{"thread":{"id":"01a0d610-2789-7bb3-a492-ad7fa8a7db9c","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d610-2789-7bb3-a492-ad7fa8a7db9c","forkedFromId":"01a0d610-155f-7391-843e-120bf1475357","parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-sol","reasoningEffort":null,"createdAt":1790297778,"updatedAt":1790297778,"recencyAt":1790297778,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-56-18-01a0d610-2789-7bb3-a492-ad7fa8a7db9c.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":{"sha":"1563a64b41d5e7e2e640b46f52cee724913f8851","branch":"v2/codex-gpt6-luna-rerecord","originUrl":"https://github.com/pingdotgg/t3code.git"},"name":null,"daybreakEnabled":null,"turns":[{"id":"01a0d610-1619-7d91-bae2-ec4a7b899193","items":[{"type":"userMessage","id":"01a0d610-1f48-7281-871b-c5d12ab0a228","clientId":null,"content":[{"type":"text","text":"Remember the opaque marker merge-sibling-source-3C7K for later in this conversation. Respond with exactly: merge sibling source stored","text_elements":[]}]},{"type":"agentMessage","id":"msg_0c4d0b070a58ed52016ab5c6b1b0fc87d0a540ea4be4112eb0","text":"merge sibling source stored","phase":"final_answer","memoryCitation":null,"delivery":null,"questions":null}],"itemsView":"full","status":"completed","error":null,"startedAt":1790297773,"completedAt":1790297778,"durationMs":4400}]},"model":"gpt-6-sol","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"],"instructionSources":["/home/replay-user/.codex/AGENTS.md"],"approvalPolicy":"never","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} -{"type":"expect_outbound","label":"thread/name/set","frame":{"id":7,"method":"thread/name/set","params":{"name":"First merge-back sibling","threadId":"01a0d610-2789-7bb3-a492-ad7fa8a7db9c"}}} -{"type":"emit_inbound","label":"thread/name/set","frame":{"id":7,"result":{}}} +{"type":"emit_inbound","label":"thread/fork","frame":{"id":8,"result":{"thread":{"id":"01a0d610-2789-7bb3-a492-ad7fa8a7db9c","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d610-2789-7bb3-a492-ad7fa8a7db9c","forkedFromId":"01a0d610-155f-7391-843e-120bf1475357","parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-sol","reasoningEffort":null,"createdAt":1790297778,"updatedAt":1790297778,"recencyAt":1790297778,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-56-18-01a0d610-2789-7bb3-a492-ad7fa8a7db9c.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":{"sha":"1563a64b41d5e7e2e640b46f52cee724913f8851","branch":"v2/codex-gpt6-luna-rerecord","originUrl":"https://github.com/pingdotgg/t3code.git"},"name":null,"daybreakEnabled":null,"turns":[{"id":"01a0d610-1619-7d91-bae2-ec4a7b899193","items":[{"type":"userMessage","id":"01a0d610-1f48-7281-871b-c5d12ab0a228","clientId":null,"content":[{"type":"text","text":"Remember the opaque marker merge-sibling-source-3C7K for later in this conversation. Respond with exactly: merge sibling source stored","text_elements":[]}]},{"type":"agentMessage","id":"msg_0c4d0b070a58ed52016ab5c6b1b0fc87d0a540ea4be4112eb0","text":"merge sibling source stored","phase":"final_answer","memoryCitation":null,"delivery":null,"questions":null}],"itemsView":"full","status":"completed","error":null,"startedAt":1790297773,"completedAt":1790297778,"durationMs":4400}]},"model":"gpt-6-sol","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"],"instructionSources":["/home/replay-user/.codex/AGENTS.md"],"approvalPolicy":"never","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} +{"type":"expect_outbound","label":"thread/name/set","frame":{"id":9,"method":"thread/name/set","params":{"name":"First merge-back sibling","threadId":"01a0d610-2789-7bb3-a492-ad7fa8a7db9c"}}} +{"type":"emit_inbound","label":"thread/name/set","frame":{"id":9,"result":{}}} {"type":"emit_inbound","label":"thread/name/updated","frame":{"method":"thread/name/updated","params":{"threadId":"01a0d610-2789-7bb3-a492-ad7fa8a7db9c","threadName":"First merge-back sibling"}}} -{"type":"expect_outbound","label":"config/read","frame":{"id":8,"method":"config/read","params":{"cwd":"","includeLayers":false}}} -{"type":"emit_inbound","label":"config/read","frame":{"id":8,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"turn/start","frame":{"id":9,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Remember the fork-local marker merge-sibling-first-6V2J. Respond with exactly: first merge sibling stored","type":"text"}],"model":"gpt-6-sol","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0d610-2789-7bb3-a492-ad7fa8a7db9c","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-sol"}}}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":10,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":10,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"turn/start","frame":{"id":11,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Remember the fork-local marker merge-sibling-first-6V2J. Respond with exactly: first merge sibling stored","type":"text"}],"model":"gpt-6-sol","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0d610-2789-7bb3-a492-ad7fa8a7db9c","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-sol"}}}}} {"type":"emit_inbound","label":"thread/tokenUsage/updated","frame":{"method":"thread/tokenUsage/updated","params":{"threadId":"01a0d610-2789-7bb3-a492-ad7fa8a7db9c","turnId":"01a0d610-1619-7d91-bae2-ec4a7b899193","tokenUsage":{"total":{"totalTokens":17752,"inputTokens":17744,"cachedInputTokens":14848,"cacheWriteInputTokens":0,"outputTokens":8,"reasoningOutputTokens":0},"last":{"totalTokens":17752,"inputTokens":17744,"cachedInputTokens":14848,"cacheWriteInputTokens":0,"outputTokens":8,"reasoningOutputTokens":0},"modelContextWindow":258400}},"emittedAtMs":1790297778338}} {"type":"emit_inbound","label":"thread/started","frame":{"method":"thread/started","params":{"thread":{"id":"01a0d610-2789-7bb3-a492-ad7fa8a7db9c","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d610-2789-7bb3-a492-ad7fa8a7db9c","forkedFromId":"01a0d610-155f-7391-843e-120bf1475357","parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-sol","reasoningEffort":null,"createdAt":1790297778,"updatedAt":1790297778,"recencyAt":1790297778,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-56-18-01a0d610-2789-7bb3-a492-ad7fa8a7db9c.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":{"sha":"1563a64b41d5e7e2e640b46f52cee724913f8851","branch":"v2/codex-gpt6-luna-rerecord","originUrl":"https://github.com/pingdotgg/t3code.git"},"name":null,"daybreakEnabled":null,"turns":[]}},"emittedAtMs":1790297778338}} {"type":"emit_inbound","label":"thread/settings/updated","frame":{"method":"thread/settings/updated","params":{"threadId":"01a0d610-2789-7bb3-a492-ad7fa8a7db9c","threadSettings":{"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","approvalPolicy":"never","approvalsReviewer":"user","sandboxPolicy":{"type":"dangerFullAccess"},"activePermissionProfile":null,"model":"gpt-6-sol","modelProvider":"openai","serviceTier":null,"effort":null,"summary":"detailed","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-sol","reasoning_effort":null,"developer_instructions":null}},"multiAgentMode":"explicitRequestOnly","personality":null}},"emittedAtMs":1790297778364}} -{"type":"emit_inbound","label":"turn/start","frame":{"id":9,"result":{"turn":{"id":"01a0d610-28ad-7071-82a1-f55ea8178ae8","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"emit_inbound","label":"turn/start","frame":{"id":11,"result":{"turn":{"id":"01a0d610-28ad-7071-82a1-f55ea8178ae8","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0d610-2789-7bb3-a492-ad7fa8a7db9c","status":{"type":"active","activeFlags":[]}},"emittedAtMs":1790297778383}} {"type":"emit_inbound","label":"turn/started","frame":{"method":"turn/started","params":{"threadId":"01a0d610-2789-7bb3-a492-ad7fa8a7db9c","turn":{"id":"01a0d610-28ad-7071-82a1-f55ea8178ae8","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":1790297778,"completedAt":null,"durationMs":null}},"emittedAtMs":1790297778383}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0d610-2789-7bb3-a492-ad7fa8a7db9c","name":"codex_apps","status":"ready","error":null,"failureReason":null},"emittedAtMs":1790297779053}} @@ -62,21 +66,23 @@ {"type":"emit_inbound","label":"thread/tokenUsage/updated","frame":{"method":"thread/tokenUsage/updated","params":{"threadId":"01a0d610-2789-7bb3-a492-ad7fa8a7db9c","turnId":"01a0d610-28ad-7071-82a1-f55ea8178ae8","tokenUsage":{"total":{"totalTokens":39723,"inputTokens":39707,"cachedInputTokens":26624,"cacheWriteInputTokens":0,"outputTokens":16,"reasoningOutputTokens":0},"last":{"totalTokens":21971,"inputTokens":21963,"cachedInputTokens":11776,"cacheWriteInputTokens":0,"outputTokens":8,"reasoningOutputTokens":0},"modelContextWindow":258400}},"emittedAtMs":1790297782125}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0d610-2789-7bb3-a492-ad7fa8a7db9c","status":{"type":"idle"}},"emittedAtMs":1790297782161}} {"type":"emit_inbound","label":"turn/completed","frame":{"method":"turn/completed","params":{"threadId":"01a0d610-2789-7bb3-a492-ad7fa8a7db9c","turn":{"id":"01a0d610-28ad-7071-82a1-f55ea8178ae8","items":[{"type":"agentMessage","id":"msg_0c4d0b070a58ed52016ab5c6b5b44c87d08e7e5612c5312499","text":"first merge sibling stored","phase":"final_answer","memoryCitation":null,"delivery":null,"questions":null}],"itemsView":"summary","status":"completed","error":null,"startedAt":1790297778,"completedAt":1790297782,"durationMs":3783}},"emittedAtMs":1790297782161}} -{"type":"expect_outbound","label":"thread/fork","frame":{"id":10,"method":"thread/fork","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","excludeTurns":true,"lastTurnId":"01a0d610-1619-7d91-bae2-ec4a7b899193","model":"gpt-6-sol","threadId":"01a0d610-155f-7391-843e-120bf1475357"}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":12,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":12,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"thread/fork","frame":{"id":13,"method":"thread/fork","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","excludeTurns":true,"lastTurnId":"01a0d610-1619-7d91-bae2-ec4a7b899193","model":"gpt-6-sol","threadId":"01a0d610-155f-7391-843e-120bf1475357"}}} {"type":"emit_inbound","label":"deprecationNotice","frame":{"method":"deprecationNotice","params":{"summary":"Full-history hydration is deprecated for paginated threads; use `excludeTurns: true`, then page with `thread/turns/list` and `thread/items/list`.","details":null},"emittedAtMs":1790297782170}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0d610-37d1-7ba1-918f-136cfdbd9bfd","name":"xcodebuildmcp","status":"starting","error":null,"failureReason":null},"emittedAtMs":1790297782559}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0d610-37d1-7ba1-918f-136cfdbd9bfd","name":"codex_apps","status":"starting","error":null,"failureReason":null},"emittedAtMs":1790297782559}} -{"type":"emit_inbound","label":"thread/fork","frame":{"id":10,"result":{"thread":{"id":"01a0d610-37d1-7ba1-918f-136cfdbd9bfd","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d610-37d1-7ba1-918f-136cfdbd9bfd","forkedFromId":"01a0d610-155f-7391-843e-120bf1475357","parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-sol","reasoningEffort":null,"createdAt":1790297782,"updatedAt":1790297782,"recencyAt":1790297782,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-56-22-01a0d610-37d1-7ba1-918f-136cfdbd9bfd.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":{"sha":"1563a64b41d5e7e2e640b46f52cee724913f8851","branch":"v2/codex-gpt6-luna-rerecord","originUrl":"https://github.com/pingdotgg/t3code.git"},"name":null,"daybreakEnabled":null,"turns":[{"id":"01a0d610-1619-7d91-bae2-ec4a7b899193","items":[{"type":"userMessage","id":"01a0d610-1f48-7281-871b-c5d12ab0a228","clientId":null,"content":[{"type":"text","text":"Remember the opaque marker merge-sibling-source-3C7K for later in this conversation. Respond with exactly: merge sibling source stored","text_elements":[]}]},{"type":"agentMessage","id":"msg_0c4d0b070a58ed52016ab5c6b1b0fc87d0a540ea4be4112eb0","text":"merge sibling source stored","phase":"final_answer","memoryCitation":null,"delivery":null,"questions":null}],"itemsView":"full","status":"completed","error":null,"startedAt":1790297773,"completedAt":1790297778,"durationMs":4400}]},"model":"gpt-6-sol","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"],"instructionSources":["/home/replay-user/.codex/AGENTS.md"],"approvalPolicy":"never","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} -{"type":"expect_outbound","label":"thread/name/set","frame":{"id":11,"method":"thread/name/set","params":{"name":"Second merge-back sibling","threadId":"01a0d610-37d1-7ba1-918f-136cfdbd9bfd"}}} -{"type":"emit_inbound","label":"thread/name/set","frame":{"id":11,"result":{}}} +{"type":"emit_inbound","label":"thread/fork","frame":{"id":13,"result":{"thread":{"id":"01a0d610-37d1-7ba1-918f-136cfdbd9bfd","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d610-37d1-7ba1-918f-136cfdbd9bfd","forkedFromId":"01a0d610-155f-7391-843e-120bf1475357","parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-sol","reasoningEffort":null,"createdAt":1790297782,"updatedAt":1790297782,"recencyAt":1790297782,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-56-22-01a0d610-37d1-7ba1-918f-136cfdbd9bfd.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":{"sha":"1563a64b41d5e7e2e640b46f52cee724913f8851","branch":"v2/codex-gpt6-luna-rerecord","originUrl":"https://github.com/pingdotgg/t3code.git"},"name":null,"daybreakEnabled":null,"turns":[{"id":"01a0d610-1619-7d91-bae2-ec4a7b899193","items":[{"type":"userMessage","id":"01a0d610-1f48-7281-871b-c5d12ab0a228","clientId":null,"content":[{"type":"text","text":"Remember the opaque marker merge-sibling-source-3C7K for later in this conversation. Respond with exactly: merge sibling source stored","text_elements":[]}]},{"type":"agentMessage","id":"msg_0c4d0b070a58ed52016ab5c6b1b0fc87d0a540ea4be4112eb0","text":"merge sibling source stored","phase":"final_answer","memoryCitation":null,"delivery":null,"questions":null}],"itemsView":"full","status":"completed","error":null,"startedAt":1790297773,"completedAt":1790297778,"durationMs":4400}]},"model":"gpt-6-sol","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"],"instructionSources":["/home/replay-user/.codex/AGENTS.md"],"approvalPolicy":"never","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} +{"type":"expect_outbound","label":"thread/name/set","frame":{"id":14,"method":"thread/name/set","params":{"name":"Second merge-back sibling","threadId":"01a0d610-37d1-7ba1-918f-136cfdbd9bfd"}}} +{"type":"emit_inbound","label":"thread/name/set","frame":{"id":14,"result":{}}} {"type":"emit_inbound","label":"thread/name/updated","frame":{"method":"thread/name/updated","params":{"threadId":"01a0d610-37d1-7ba1-918f-136cfdbd9bfd","threadName":"Second merge-back sibling"}}} -{"type":"expect_outbound","label":"config/read","frame":{"id":12,"method":"config/read","params":{"cwd":"","includeLayers":false}}} -{"type":"emit_inbound","label":"config/read","frame":{"id":12,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"turn/start","frame":{"id":13,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Remember the fork-local marker merge-sibling-second-9X5B. Respond with exactly: second merge sibling stored","type":"text"}],"model":"gpt-6-sol","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0d610-37d1-7ba1-918f-136cfdbd9bfd","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-sol"}}}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":15,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":15,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"turn/start","frame":{"id":16,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Remember the fork-local marker merge-sibling-second-9X5B. Respond with exactly: second merge sibling stored","type":"text"}],"model":"gpt-6-sol","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0d610-37d1-7ba1-918f-136cfdbd9bfd","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-sol"}}}}} {"type":"emit_inbound","label":"thread/tokenUsage/updated","frame":{"method":"thread/tokenUsage/updated","params":{"threadId":"01a0d610-37d1-7ba1-918f-136cfdbd9bfd","turnId":"01a0d610-1619-7d91-bae2-ec4a7b899193","tokenUsage":{"total":{"totalTokens":17752,"inputTokens":17744,"cachedInputTokens":14848,"cacheWriteInputTokens":0,"outputTokens":8,"reasoningOutputTokens":0},"last":{"totalTokens":17752,"inputTokens":17744,"cachedInputTokens":14848,"cacheWriteInputTokens":0,"outputTokens":8,"reasoningOutputTokens":0},"modelContextWindow":258400}},"emittedAtMs":1790297782630}} {"type":"emit_inbound","label":"thread/started","frame":{"method":"thread/started","params":{"thread":{"id":"01a0d610-37d1-7ba1-918f-136cfdbd9bfd","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d610-37d1-7ba1-918f-136cfdbd9bfd","forkedFromId":"01a0d610-155f-7391-843e-120bf1475357","parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-sol","reasoningEffort":null,"createdAt":1790297782,"updatedAt":1790297782,"recencyAt":1790297782,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-56-22-01a0d610-37d1-7ba1-918f-136cfdbd9bfd.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":{"sha":"1563a64b41d5e7e2e640b46f52cee724913f8851","branch":"v2/codex-gpt6-luna-rerecord","originUrl":"https://github.com/pingdotgg/t3code.git"},"name":null,"daybreakEnabled":null,"turns":[]}},"emittedAtMs":1790297782630}} {"type":"emit_inbound","label":"thread/settings/updated","frame":{"method":"thread/settings/updated","params":{"threadId":"01a0d610-37d1-7ba1-918f-136cfdbd9bfd","threadSettings":{"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","approvalPolicy":"never","approvalsReviewer":"user","sandboxPolicy":{"type":"dangerFullAccess"},"activePermissionProfile":null,"model":"gpt-6-sol","modelProvider":"openai","serviceTier":null,"effort":null,"summary":"detailed","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-sol","reasoning_effort":null,"developer_instructions":null}},"multiAgentMode":"explicitRequestOnly","personality":null}},"emittedAtMs":1790297782690}} -{"type":"emit_inbound","label":"turn/start","frame":{"id":13,"result":{"turn":{"id":"01a0d610-398b-7ea0-b252-1ba58fc7d14d","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"emit_inbound","label":"turn/start","frame":{"id":16,"result":{"turn":{"id":"01a0d610-398b-7ea0-b252-1ba58fc7d14d","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0d610-37d1-7ba1-918f-136cfdbd9bfd","status":{"type":"active","activeFlags":[]}},"emittedAtMs":1790297782728}} {"type":"emit_inbound","label":"turn/started","frame":{"method":"turn/started","params":{"threadId":"01a0d610-37d1-7ba1-918f-136cfdbd9bfd","turn":{"id":"01a0d610-398b-7ea0-b252-1ba58fc7d14d","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":1790297782,"completedAt":null,"durationMs":null}},"emittedAtMs":1790297782728}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0d610-2789-7bb3-a492-ad7fa8a7db9c","name":"xcodebuildmcp","status":"ready","error":null,"failureReason":null},"emittedAtMs":1790297782926}} @@ -92,10 +98,10 @@ {"type":"emit_inbound","label":"thread/tokenUsage/updated","frame":{"method":"thread/tokenUsage/updated","params":{"threadId":"01a0d610-37d1-7ba1-918f-136cfdbd9bfd","turnId":"01a0d610-398b-7ea0-b252-1ba58fc7d14d","tokenUsage":{"total":{"totalTokens":39723,"inputTokens":39707,"cachedInputTokens":32384,"cacheWriteInputTokens":0,"outputTokens":16,"reasoningOutputTokens":0},"last":{"totalTokens":21971,"inputTokens":21963,"cachedInputTokens":17536,"cacheWriteInputTokens":0,"outputTokens":8,"reasoningOutputTokens":0},"modelContextWindow":258400}},"emittedAtMs":1790297786356}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0d610-37d1-7ba1-918f-136cfdbd9bfd","status":{"type":"idle"}},"emittedAtMs":1790297786381}} {"type":"emit_inbound","label":"turn/completed","frame":{"method":"turn/completed","params":{"threadId":"01a0d610-37d1-7ba1-918f-136cfdbd9bfd","turn":{"id":"01a0d610-398b-7ea0-b252-1ba58fc7d14d","items":[{"type":"agentMessage","id":"msg_0c4d0b070a58ed52016ab5c6b9e23887d0aead55548c08d807","text":"second merge sibling stored","phase":"final_answer","memoryCitation":null,"delivery":null,"questions":null}],"itemsView":"summary","status":"completed","error":null,"startedAt":1790297782,"completedAt":1790297786,"durationMs":3683}},"emittedAtMs":1790297786381}} -{"type":"expect_outbound","label":"config/read","frame":{"id":14,"method":"config/read","params":{"cwd":"","includeLayers":false}}} -{"type":"emit_inbound","label":"config/read","frame":{"id":14,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"turn/start","frame":{"id":15,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Context handoff (merge_back / fork_delta_summary):\nMerge-back context from first forked conversation.\n\nFork delta:\n- User introduced opaque marker merge-sibling-first-6V2J.\n- Assistant confirmed: first merge sibling stored\n\nUser message:\nRetain the first transferred marker for later. Respond with exactly: first merge delta stored","type":"text"}],"model":"gpt-6-sol","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0d610-155f-7391-843e-120bf1475357","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-sol"}}}}} -{"type":"emit_inbound","label":"turn/start","frame":{"id":15,"result":{"turn":{"id":"01a0d610-481e-7522-ab04-234cac3907b5","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":17,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":17,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"turn/start","frame":{"id":18,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Context handoff (merge_back / fork_delta_summary):\nMerge-back context from first forked conversation.\n\nFork delta:\n- User introduced opaque marker merge-sibling-first-6V2J.\n- Assistant confirmed: first merge sibling stored\n\nUser message:\nRetain the first transferred marker for later. Respond with exactly: first merge delta stored","type":"text"}],"model":"gpt-6-sol","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0d610-155f-7391-843e-120bf1475357","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-sol"}}}}} +{"type":"emit_inbound","label":"turn/start","frame":{"id":18,"result":{"turn":{"id":"01a0d610-481e-7522-ab04-234cac3907b5","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0d610-155f-7391-843e-120bf1475357","status":{"type":"active","activeFlags":[]}},"emittedAtMs":1790297786444}} {"type":"emit_inbound","label":"turn/started","frame":{"method":"turn/started","params":{"threadId":"01a0d610-155f-7391-843e-120bf1475357","turn":{"id":"01a0d610-481e-7522-ab04-234cac3907b5","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":1790297786,"completedAt":null,"durationMs":null}},"emittedAtMs":1790297786444}} {"type":"emit_inbound","label":"item/started","frame":{"method":"item/started","params":{"item":{"type":"userMessage","id":"01a0d610-48e6-7791-90d7-390fdc407d60","clientId":null,"content":[{"type":"text","text":"Context handoff (merge_back / fork_delta_summary):\nMerge-back context from first forked conversation.\n\nFork delta:\n- User introduced opaque marker merge-sibling-first-6V2J.\n- Assistant confirmed: first merge sibling stored\n\nUser message:\nRetain the first transferred marker for later. Respond with exactly: first merge delta stored","text_elements":[]}]},"threadId":"01a0d610-155f-7391-843e-120bf1475357","turnId":"01a0d610-481e-7522-ab04-234cac3907b5","startedAtMs":1790297786608},"emittedAtMs":1790297786608}} @@ -114,10 +120,10 @@ {"type":"emit_inbound","label":"thread/tokenUsage/updated","frame":{"method":"thread/tokenUsage/updated","params":{"threadId":"01a0d610-155f-7391-843e-120bf1475357","turnId":"01a0d610-481e-7522-ab04-234cac3907b5","tokenUsage":{"total":{"totalTokens":39782,"inputTokens":39751,"cachedInputTokens":32384,"cacheWriteInputTokens":0,"outputTokens":31,"reasoningOutputTokens":13},"last":{"totalTokens":22030,"inputTokens":22007,"cachedInputTokens":17536,"cacheWriteInputTokens":0,"outputTokens":23,"reasoningOutputTokens":13},"modelContextWindow":258400}},"emittedAtMs":1790297790394}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0d610-155f-7391-843e-120bf1475357","status":{"type":"idle"}},"emittedAtMs":1790297790409}} {"type":"emit_inbound","label":"turn/completed","frame":{"method":"turn/completed","params":{"threadId":"01a0d610-155f-7391-843e-120bf1475357","turn":{"id":"01a0d610-481e-7522-ab04-234cac3907b5","items":[{"type":"agentMessage","id":"msg_0c4d0b070a58ed52016ab5c6be15bc87d0b5c0c3a9a6045bbb","text":"first merge delta stored","phase":"final_answer","memoryCitation":null,"delivery":null,"questions":null}],"itemsView":"summary","status":"completed","error":null,"startedAt":1790297786,"completedAt":1790297790,"durationMs":3979}},"emittedAtMs":1790297790409}} -{"type":"expect_outbound","label":"config/read","frame":{"id":16,"method":"config/read","params":{"cwd":"","includeLayers":false}}} -{"type":"emit_inbound","label":"config/read","frame":{"id":16,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"turn/start","frame":{"id":17,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Context handoff (merge_back / fork_delta_summary):\nMerge-back context from second forked conversation.\n\nFork delta:\n- User introduced opaque marker merge-sibling-second-9X5B.\n- Assistant confirmed: second merge sibling stored\n\nUser message:\nRetain the second transferred marker for later. Respond with exactly: second merge delta stored","type":"text"}],"model":"gpt-6-sol","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0d610-155f-7391-843e-120bf1475357","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-sol"}}}}} -{"type":"emit_inbound","label":"turn/start","frame":{"id":17,"result":{"turn":{"id":"01a0d610-57d2-7671-858a-d9e868574664","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":19,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":19,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"turn/start","frame":{"id":20,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Context handoff (merge_back / fork_delta_summary):\nMerge-back context from second forked conversation.\n\nFork delta:\n- User introduced opaque marker merge-sibling-second-9X5B.\n- Assistant confirmed: second merge sibling stored\n\nUser message:\nRetain the second transferred marker for later. Respond with exactly: second merge delta stored","type":"text"}],"model":"gpt-6-sol","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0d610-155f-7391-843e-120bf1475357","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-sol"}}}}} +{"type":"emit_inbound","label":"turn/start","frame":{"id":20,"result":{"turn":{"id":"01a0d610-57d2-7671-858a-d9e868574664","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0d610-155f-7391-843e-120bf1475357","status":{"type":"active","activeFlags":[]}},"emittedAtMs":1790297790438}} {"type":"emit_inbound","label":"turn/started","frame":{"method":"turn/started","params":{"threadId":"01a0d610-155f-7391-843e-120bf1475357","turn":{"id":"01a0d610-57d2-7671-858a-d9e868574664","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":1790297790,"completedAt":null,"durationMs":null}},"emittedAtMs":1790297790438}} {"type":"emit_inbound","label":"item/started","frame":{"method":"item/started","params":{"item":{"type":"userMessage","id":"01a0d610-5897-7993-b78c-2e5977b826e8","clientId":null,"content":[{"type":"text","text":"Context handoff (merge_back / fork_delta_summary):\nMerge-back context from second forked conversation.\n\nFork delta:\n- User introduced opaque marker merge-sibling-second-9X5B.\n- Assistant confirmed: second merge sibling stored\n\nUser message:\nRetain the second transferred marker for later. Respond with exactly: second merge delta stored","text_elements":[]}]},"threadId":"01a0d610-155f-7391-843e-120bf1475357","turnId":"01a0d610-57d2-7671-858a-d9e868574664","startedAtMs":1790297790625},"emittedAtMs":1790297790625}} @@ -131,10 +137,10 @@ {"type":"emit_inbound","label":"thread/tokenUsage/updated","frame":{"method":"thread/tokenUsage/updated","params":{"threadId":"01a0d610-155f-7391-843e-120bf1475357","turnId":"01a0d610-57d2-7671-858a-d9e868574664","tokenUsage":{"total":{"totalTokens":61893,"inputTokens":61854,"cachedInputTokens":54272,"cacheWriteInputTokens":0,"outputTokens":39,"reasoningOutputTokens":13},"last":{"totalTokens":22111,"inputTokens":22103,"cachedInputTokens":21888,"cacheWriteInputTokens":0,"outputTokens":8,"reasoningOutputTokens":0},"modelContextWindow":258400}},"emittedAtMs":1790297793240}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0d610-155f-7391-843e-120bf1475357","status":{"type":"idle"}},"emittedAtMs":1790297793249}} {"type":"emit_inbound","label":"turn/completed","frame":{"method":"turn/completed","params":{"threadId":"01a0d610-155f-7391-843e-120bf1475357","turn":{"id":"01a0d610-57d2-7671-858a-d9e868574664","items":[{"type":"agentMessage","id":"msg_0c4d0b070a58ed52016ab5c6c071ec87d0ad6a38add1f18e1a","text":"second merge delta stored","phase":"final_answer","memoryCitation":null,"delivery":null,"questions":null}],"itemsView":"summary","status":"completed","error":null,"startedAt":1790297790,"completedAt":1790297793,"durationMs":2814}},"emittedAtMs":1790297793249}} -{"type":"expect_outbound","label":"config/read","frame":{"id":18,"method":"config/read","params":{"cwd":"","includeLayers":false}}} -{"type":"emit_inbound","label":"config/read","frame":{"id":18,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"turn/start","frame":{"id":19,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Return the source marker followed by both transferred fork markers in merge order, separated by single | characters. Respond with only the markers and separators.","type":"text"}],"model":"gpt-6-sol","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0d610-155f-7391-843e-120bf1475357","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-sol"}}}}} -{"type":"emit_inbound","label":"turn/start","frame":{"id":19,"result":{"turn":{"id":"01a0d610-62e7-7610-9b44-1d654367e4bf","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":21,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":21,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"turn/start","frame":{"id":22,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Return the source marker followed by both transferred fork markers in merge order, separated by single | characters. Respond with only the markers and separators.","type":"text"}],"model":"gpt-6-sol","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0d610-155f-7391-843e-120bf1475357","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-sol"}}}}} +{"type":"emit_inbound","label":"turn/start","frame":{"id":22,"result":{"turn":{"id":"01a0d610-62e7-7610-9b44-1d654367e4bf","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0d610-155f-7391-843e-120bf1475357","status":{"type":"active","activeFlags":[]}},"emittedAtMs":1790297793308}} {"type":"emit_inbound","label":"turn/started","frame":{"method":"turn/started","params":{"threadId":"01a0d610-155f-7391-843e-120bf1475357","turn":{"id":"01a0d610-62e7-7610-9b44-1d654367e4bf","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":1790297793,"completedAt":null,"durationMs":null}},"emittedAtMs":1790297793308}} {"type":"emit_inbound","label":"item/started","frame":{"method":"item/started","params":{"item":{"type":"userMessage","id":"01a0d610-63a5-7aa0-bdd9-6d0a56bf21e7","clientId":null,"content":[{"type":"text","text":"Return the source marker followed by both transferred fork markers in merge order, separated by single | characters. Respond with only the markers and separators.","text_elements":[]}]},"threadId":"01a0d610-155f-7391-843e-120bf1475357","turnId":"01a0d610-62e7-7610-9b44-1d654367e4bf","startedAtMs":1790297793453},"emittedAtMs":1790297793453}} diff --git a/apps/server/src/orchestration-v2/testkit/fixtures/thread_rollback/codex_transcript.ndjson b/apps/server/src/orchestration-v2/testkit/fixtures/thread_rollback/codex_transcript.ndjson index ba52432940a03..3bb8185a7390b 100644 --- a/apps/server/src/orchestration-v2/testkit/fixtures/thread_rollback/codex_transcript.ndjson +++ b/apps/server/src/orchestration-v2/testkit/fixtures/thread_rollback/codex_transcript.ndjson @@ -2,20 +2,22 @@ {"type":"expect_outbound","label":"initialize","frame":{"id":1,"method":"initialize","params":{"capabilities":{"experimentalApi":true,"optOutNotificationMethods":["turn/diff/updated"],"extensions":{"io.modelcontextprotocol/ui":{"mimeTypes":["text/html;profile=mcp-app"]}}},"clientInfo":{"name":"T3 Code","title":"T3 Code","version":"0.0.44"}}}} {"type":"emit_inbound","label":"initialize","frame":{"id":1,"result":{"userAgent":"t3code_desktop/0.156.1 (Debian 13.0.0; x86_64) unknown (t3code_desktop; 0.1.0)","codexHome":"/home/replay-user/.codex","platformFamily":"unix","platformOs":"linux"}}} {"type":"expect_outbound","label":"initialized","frame":{"method":"initialized"}} -{"type":"expect_outbound","label":"thread/start","frame":{"id":2,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","model":"gpt-6-luna"}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":2,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":2,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"thread/start","frame":{"id":3,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","model":"gpt-6-luna"}}} {"type":"emit_inbound","label":"configWarning","frame":{"method":"configWarning","params":{"summary":"Codex could not find bubblewrap on PATH. Install bubblewrap with your OS package manager. See the sandbox prerequisites: https://developers.openai.com/codex/concepts/sandboxing#prerequisites. Codex will use the bundled bubblewrap in the meantime.","details":null},"emittedAtMs":1790295644807}} {"type":"emit_inbound","label":"remoteControl/status/changed","frame":{"method":"remoteControl/status/changed","params":{"status":"disabled","serverName":"replay-host","installationId":"00000000-0000-4000-8000-000000000000","environmentId":null},"emittedAtMs":1790295644807}} -{"type":"emit_inbound","label":"thread/start","frame":{"id":2,"result":{"thread":{"id":"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790295644,"updatedAt":1790295644,"recencyAt":1790295644,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-20-44-01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"],"instructionSources":["/home/replay-user/.codex/AGENTS.md","/home/replay-user/t3code/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} -{"type":"expect_outbound","label":"thread/name/set","frame":{"id":3,"method":"thread/name/set","params":{"name":"Replay fixture: thread_rollback","threadId":"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff"}}} -{"type":"emit_inbound","label":"thread/name/set","frame":{"id":3,"result":{}}} +{"type":"emit_inbound","label":"thread/start","frame":{"id":3,"result":{"thread":{"id":"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790295644,"updatedAt":1790295644,"recencyAt":1790295644,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-20-44-01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"],"instructionSources":["/home/replay-user/.codex/AGENTS.md","/home/replay-user/t3code/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} +{"type":"expect_outbound","label":"thread/name/set","frame":{"id":4,"method":"thread/name/set","params":{"name":"Replay fixture: thread_rollback","threadId":"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff"}}} +{"type":"emit_inbound","label":"thread/name/set","frame":{"id":4,"result":{}}} {"type":"emit_inbound","label":"thread/name/updated","frame":{"method":"thread/name/updated","params":{"threadId":"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff","threadName":"Replay fixture: thread_rollback"}}} -{"type":"expect_outbound","label":"config/read","frame":{"id":4,"method":"config/read","params":{"cwd":"","includeLayers":false}}} -{"type":"emit_inbound","label":"config/read","frame":{"id":4,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"turn/start","frame":{"id":5,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Respond with exactly: rollback fixture first turn complete","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":5,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":5,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"turn/start","frame":{"id":6,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Respond with exactly: rollback fixture first turn complete","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} {"type":"emit_inbound","label":"thread/started","frame":{"method":"thread/started","params":{"thread":{"id":"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790295644,"updatedAt":1790295644,"recencyAt":1790295644,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-20-44-01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]}},"emittedAtMs":1790295645009}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff","name":"codex_apps","status":"starting","error":null,"failureReason":null},"emittedAtMs":1790295645009}} {"type":"emit_inbound","label":"thread/settings/updated","frame":{"method":"thread/settings/updated","params":{"threadId":"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff","threadSettings":{"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","approvalPolicy":"never","approvalsReviewer":"user","sandboxPolicy":{"type":"dangerFullAccess"},"activePermissionProfile":null,"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"effort":null,"summary":"detailed","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna","reasoning_effort":null,"developer_instructions":null}},"multiAgentMode":"explicitRequestOnly","personality":null}},"emittedAtMs":1790295645023}} -{"type":"emit_inbound","label":"turn/start","frame":{"id":5,"result":{"turn":{"id":"01a0d5ef-9b58-7980-9e7a-2463dd068a8e","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"emit_inbound","label":"turn/start","frame":{"id":6,"result":{"turn":{"id":"01a0d5ef-9b58-7980-9e7a-2463dd068a8e","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff","status":{"type":"active","activeFlags":[]}},"emittedAtMs":1790295645070}} {"type":"emit_inbound","label":"turn/started","frame":{"method":"turn/started","params":{"threadId":"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff","turn":{"id":"01a0d5ef-9b58-7980-9e7a-2463dd068a8e","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":1790295645,"completedAt":null,"durationMs":null}},"emittedAtMs":1790295645070}} {"type":"emit_inbound","label":"account/updated","frame":{"method":"account/updated","params":{"authMode":"chatgpt","planType":"unknown"},"emittedAtMs":1790295645465}} @@ -33,10 +35,10 @@ {"type":"emit_inbound","label":"thread/tokenUsage/updated","frame":{"method":"thread/tokenUsage/updated","params":{"threadId":"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff","turnId":"01a0d5ef-9b58-7980-9e7a-2463dd068a8e","tokenUsage":{"total":{"totalTokens":21428,"inputTokens":21419,"cachedInputTokens":21248,"cacheWriteInputTokens":0,"outputTokens":9,"reasoningOutputTokens":0},"last":{"totalTokens":21428,"inputTokens":21419,"cachedInputTokens":21248,"cacheWriteInputTokens":0,"outputTokens":9,"reasoningOutputTokens":0},"modelContextWindow":258400}},"emittedAtMs":1790295649339}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff","status":{"type":"idle"}},"emittedAtMs":1790295649352}} {"type":"emit_inbound","label":"turn/completed","frame":{"method":"turn/completed","params":{"threadId":"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff","turn":{"id":"01a0d5ef-9b58-7980-9e7a-2463dd068a8e","items":[{"type":"agentMessage","id":"msg_044082e5a0068297016ab5be60f20c87d0aed9858a5d1f00b2","text":"rollback fixture first turn complete","phase":"final_answer","memoryCitation":null,"delivery":null,"questions":null}],"itemsView":"summary","status":"completed","error":null,"startedAt":1790295645,"completedAt":1790295649,"durationMs":4326}},"emittedAtMs":1790295649352}} -{"type":"expect_outbound","label":"config/read","frame":{"id":6,"method":"config/read","params":{"cwd":"","includeLayers":false}}} -{"type":"emit_inbound","label":"config/read","frame":{"id":6,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"turn/start","frame":{"id":7,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Respond with exactly: rollback fixture second turn complete","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} -{"type":"emit_inbound","label":"turn/start","frame":{"id":7,"result":{"turn":{"id":"01a0d5ef-ac4e-7471-a4a8-6776e39e6d29","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":7,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":7,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"turn/start","frame":{"id":8,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Respond with exactly: rollback fixture second turn complete","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} +{"type":"emit_inbound","label":"turn/start","frame":{"id":8,"result":{"turn":{"id":"01a0d5ef-ac4e-7471-a4a8-6776e39e6d29","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff","status":{"type":"active","activeFlags":[]}},"emittedAtMs":1790295649424}} {"type":"emit_inbound","label":"turn/started","frame":{"method":"turn/started","params":{"threadId":"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff","turn":{"id":"01a0d5ef-ac4e-7471-a4a8-6776e39e6d29","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":1790295649,"completedAt":null,"durationMs":null}},"emittedAtMs":1790295649424}} {"type":"emit_inbound","label":"item/started","frame":{"method":"item/started","params":{"item":{"type":"userMessage","id":"01a0d5ef-ad0e-78d0-af5c-7145f750bd81","clientId":null,"content":[{"type":"text","text":"Respond with exactly: rollback fixture second turn complete","text_elements":[]}]},"threadId":"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff","turnId":"01a0d5ef-ac4e-7471-a4a8-6776e39e6d29","startedAtMs":1790295649555},"emittedAtMs":1790295649555}} @@ -52,21 +54,21 @@ {"type":"emit_inbound","label":"thread/tokenUsage/updated","frame":{"method":"thread/tokenUsage/updated","params":{"threadId":"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff","turnId":"01a0d5ef-ac4e-7471-a4a8-6776e39e6d29","tokenUsage":{"total":{"totalTokens":47217,"inputTokens":47199,"cachedInputTokens":42496,"cacheWriteInputTokens":0,"outputTokens":18,"reasoningOutputTokens":0},"last":{"totalTokens":25789,"inputTokens":25780,"cachedInputTokens":21248,"cacheWriteInputTokens":0,"outputTokens":9,"reasoningOutputTokens":0},"modelContextWindow":258400}},"emittedAtMs":1790295651330}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff","status":{"type":"idle"}},"emittedAtMs":1790295651335}} {"type":"emit_inbound","label":"turn/completed","frame":{"method":"turn/completed","params":{"threadId":"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff","turn":{"id":"01a0d5ef-ac4e-7471-a4a8-6776e39e6d29","items":[{"type":"agentMessage","id":"msg_044082e5a0068297016ab5be62fefc87d0bbf3fdbed6561ac8","text":"rollback fixture second turn complete","phase":"final_answer","memoryCitation":null,"delivery":null,"questions":null}],"itemsView":"summary","status":"completed","error":null,"startedAt":1790295649,"completedAt":1790295651,"durationMs":1931}},"emittedAtMs":1790295651335}} -{"type":"expect_outbound","label":"thread/read","frame":{"id":8,"method":"thread/read","params":{"includeTurns":false,"threadId":"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff"}}} -{"type":"emit_inbound","label":"thread/read","frame":{"id":8,"result":{"thread":{"id":"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff","forkedFromId":null,"parentThreadId":null,"preview":"Respond with exactly: rollback fixture first turn complete","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790295644,"updatedAt":1790295651,"recencyAt":1790295649,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-20-44-01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":{"sha":"1563a64b41d5e7e2e640b46f52cee724913f8851","branch":"v2/codex-gpt6-luna-rerecord","originUrl":"https://github.com/pingdotgg/t3code.git"},"name":null,"daybreakEnabled":null,"turns":[]}}}} -{"type":"expect_outbound","label":"thread/turns/list","frame":{"id":9,"method":"thread/turns/list","params":{"cursor":null,"itemsView":"summary","limit":1,"sortDirection":"desc","threadId":"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff"}}} -{"type":"emit_inbound","label":"thread/turns/list","frame":{"id":9,"result":{"data":[{"id":"01a0d5ef-ac4e-7471-a4a8-6776e39e6d29","items":[{"type":"userMessage","id":"01a0d5ef-ad0e-78d0-af5c-7145f750bd81","clientId":null,"content":[{"type":"text","text":"Respond with exactly: rollback fixture second turn complete","text_elements":[]}]},{"type":"agentMessage","id":"msg_044082e5a0068297016ab5be62fefc87d0bbf3fdbed6561ac8","text":"rollback fixture second turn complete","phase":"final_answer","memoryCitation":null,"delivery":null,"questions":null}],"itemsView":"summary","status":"completed","error":null,"startedAt":1790295649,"completedAt":1790295651,"durationMs":1931}],"nextCursor":"{\"requestedThreadId\":\"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff\",\"rolloutOrdinal\":16,\"includeAnchor\":false,\"scope\":{\"kind\":\"turns\"}}","backwardsCursor":"{\"requestedThreadId\":\"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff\",\"rolloutOrdinal\":16,\"includeAnchor\":true,\"scope\":{\"kind\":\"turns\"}}"}}} -{"type":"expect_outbound","label":"thread/revert","frame":{"id":10,"method":"thread/revert","params":{"beforeTurnId":"01a0d5ef-ac4e-7471-a4a8-6776e39e6d29","threadId":"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff"}}} +{"type":"expect_outbound","label":"thread/read","frame":{"id":9,"method":"thread/read","params":{"includeTurns":false,"threadId":"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff"}}} +{"type":"emit_inbound","label":"thread/read","frame":{"id":9,"result":{"thread":{"id":"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff","forkedFromId":null,"parentThreadId":null,"preview":"Respond with exactly: rollback fixture first turn complete","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790295644,"updatedAt":1790295651,"recencyAt":1790295649,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-20-44-01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":{"sha":"1563a64b41d5e7e2e640b46f52cee724913f8851","branch":"v2/codex-gpt6-luna-rerecord","originUrl":"https://github.com/pingdotgg/t3code.git"},"name":null,"daybreakEnabled":null,"turns":[]}}}} +{"type":"expect_outbound","label":"thread/turns/list","frame":{"id":10,"method":"thread/turns/list","params":{"cursor":null,"itemsView":"summary","limit":1,"sortDirection":"desc","threadId":"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff"}}} +{"type":"emit_inbound","label":"thread/turns/list","frame":{"id":10,"result":{"data":[{"id":"01a0d5ef-ac4e-7471-a4a8-6776e39e6d29","items":[{"type":"userMessage","id":"01a0d5ef-ad0e-78d0-af5c-7145f750bd81","clientId":null,"content":[{"type":"text","text":"Respond with exactly: rollback fixture second turn complete","text_elements":[]}]},{"type":"agentMessage","id":"msg_044082e5a0068297016ab5be62fefc87d0bbf3fdbed6561ac8","text":"rollback fixture second turn complete","phase":"final_answer","memoryCitation":null,"delivery":null,"questions":null}],"itemsView":"summary","status":"completed","error":null,"startedAt":1790295649,"completedAt":1790295651,"durationMs":1931}],"nextCursor":"{\"requestedThreadId\":\"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff\",\"rolloutOrdinal\":16,\"includeAnchor\":false,\"scope\":{\"kind\":\"turns\"}}","backwardsCursor":"{\"requestedThreadId\":\"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff\",\"rolloutOrdinal\":16,\"includeAnchor\":true,\"scope\":{\"kind\":\"turns\"}}"}}} +{"type":"expect_outbound","label":"thread/revert","frame":{"id":11,"method":"thread/revert","params":{"beforeTurnId":"01a0d5ef-ac4e-7471-a4a8-6776e39e6d29","threadId":"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff"}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff","status":{"type":"notLoaded"}},"emittedAtMs":1790295651358}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff","name":"xcodebuildmcp","status":"starting","error":null,"failureReason":null},"emittedAtMs":1790295651544}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff","name":"codex_apps","status":"starting","error":null,"failureReason":null},"emittedAtMs":1790295651544}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff","status":{"type":"idle"}},"emittedAtMs":1790295651551}} -{"type":"emit_inbound","label":"thread/revert","frame":{"id":10,"result":{"thread":{"id":"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff","forkedFromId":null,"parentThreadId":null,"preview":"Respond with exactly: rollback fixture first turn complete","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790295651,"updatedAt":1790295651,"recencyAt":1790295649,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-20-51-01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff_01a0d5ef-b424-72f2-9853-9b112f028a71.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":{"sha":"1563a64b41d5e7e2e640b46f52cee724913f8851","branch":"v2/codex-gpt6-luna-rerecord","originUrl":"https://github.com/pingdotgg/t3code.git"},"name":null,"daybreakEnabled":null,"turns":[]},"turnsBackwardsCursor":"{\"requestedThreadId\":\"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff\",\"rolloutOrdinal\":1,\"includeAnchor\":true,\"scope\":{\"kind\":\"turns\"}}","itemsBackwardsCursor":"{\"requestedThreadId\":\"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff\",\"rolloutOrdinal\":10,\"includeAnchor\":true,\"scope\":{\"kind\":\"itemsByCreatedAtOrdinal\"}}"}}} -{"type":"expect_outbound","label":"config/read","frame":{"id":11,"method":"config/read","params":{"cwd":"","includeLayers":false}}} -{"type":"emit_inbound","label":"config/read","frame":{"id":11,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"turn/start","frame":{"id":12,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Repeat the conversation verbatim.","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} +{"type":"emit_inbound","label":"thread/revert","frame":{"id":11,"result":{"thread":{"id":"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff","forkedFromId":null,"parentThreadId":null,"preview":"Respond with exactly: rollback fixture first turn complete","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790295651,"updatedAt":1790295651,"recencyAt":1790295649,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-20-51-01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff_01a0d5ef-b424-72f2-9853-9b112f028a71.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":{"sha":"1563a64b41d5e7e2e640b46f52cee724913f8851","branch":"v2/codex-gpt6-luna-rerecord","originUrl":"https://github.com/pingdotgg/t3code.git"},"name":null,"daybreakEnabled":null,"turns":[]},"turnsBackwardsCursor":"{\"requestedThreadId\":\"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff\",\"rolloutOrdinal\":1,\"includeAnchor\":true,\"scope\":{\"kind\":\"turns\"}}","itemsBackwardsCursor":"{\"requestedThreadId\":\"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff\",\"rolloutOrdinal\":10,\"includeAnchor\":true,\"scope\":{\"kind\":\"itemsByCreatedAtOrdinal\"}}"}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":12,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":12,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"turn/start","frame":{"id":13,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Repeat the conversation verbatim.","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} {"type":"emit_inbound","label":"thread/reverted","frame":{"method":"thread/reverted","params":{"threadId":"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff"},"emittedAtMs":1790295651568}} -{"type":"emit_inbound","label":"turn/start","frame":{"id":12,"result":{"turn":{"id":"01a0d5ef-b4f4-7aa2-b4c2-f5f494881401","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"emit_inbound","label":"turn/start","frame":{"id":13,"result":{"turn":{"id":"01a0d5ef-b4f4-7aa2-b4c2-f5f494881401","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff","status":{"type":"active","activeFlags":[]}},"emittedAtMs":1790295651594}} {"type":"emit_inbound","label":"turn/started","frame":{"method":"turn/started","params":{"threadId":"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff","turn":{"id":"01a0d5ef-b4f4-7aa2-b4c2-f5f494881401","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":1790295651,"completedAt":null,"durationMs":null}},"emittedAtMs":1790295651594}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0d5ef-9a99-7bf2-a24c-197fc5cc32ff","name":"codex_apps","status":"ready","error":null,"failureReason":null},"emittedAtMs":1790295652127}} diff --git a/apps/server/src/orchestration-v2/testkit/fixtures/thread_rollback_after_restart/codex_transcript.ndjson b/apps/server/src/orchestration-v2/testkit/fixtures/thread_rollback_after_restart/codex_transcript.ndjson index 4083e4f61f3f7..086462cb51e05 100644 --- a/apps/server/src/orchestration-v2/testkit/fixtures/thread_rollback_after_restart/codex_transcript.ndjson +++ b/apps/server/src/orchestration-v2/testkit/fixtures/thread_rollback_after_restart/codex_transcript.ndjson @@ -2,20 +2,22 @@ {"type":"expect_outbound","label":"initialize","frame":{"id":1,"method":"initialize","params":{"capabilities":{"experimentalApi":true,"optOutNotificationMethods":["turn/diff/updated"],"extensions":{"io.modelcontextprotocol/ui":{"mimeTypes":["text/html;profile=mcp-app"]}}},"clientInfo":{"name":"T3 Code","title":"T3 Code","version":"0.0.44"}}}} {"type":"emit_inbound","label":"initialize","frame":{"id":1,"result":{"userAgent":"t3code_desktop/0.156.1 (Debian 13.0.0; x86_64) unknown (t3code_desktop; 0.1.0)","codexHome":"/home/replay-user/tmp/bughunt-codex/codex-home","platformFamily":"unix","platformOs":"linux"}}} {"type":"expect_outbound","label":"initialized","frame":{"method":"initialized"}} -{"type":"expect_outbound","label":"thread/start","frame":{"id":2,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","model":"gpt-6-luna"}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":2,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":2,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"thread/start","frame":{"id":3,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","model":"gpt-6-luna"}}} {"type":"emit_inbound","label":"configWarning","frame":{"method":"configWarning","params":{"summary":"Codex could not find bubblewrap on PATH. Install bubblewrap with your OS package manager. See the sandbox prerequisites: https://developers.openai.com/codex/concepts/sandboxing#prerequisites. Codex will use the bundled bubblewrap in the meantime.","details":null},"emittedAtMs":1790404926353}} {"type":"emit_inbound","label":"remoteControl/status/changed","frame":{"method":"remoteControl/status/changed","params":{"status":"disabled","serverName":"replay-host","installationId":"00000000-0000-4000-8000-000000000000","environmentId":null},"emittedAtMs":1790404926353}} -{"type":"emit_inbound","label":"thread/start","frame":{"id":2,"result":{"thread":{"id":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/apps/server","runtimeWorkspaceRoots":["/home/replay-user/t3code/apps/server"]}],"extra":null,"sessionId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790404926,"updatedAt":1790404926,"recencyAt":1790404926,"status":{"type":"idle"},"path":"/home/replay-user/tmp/bughunt-codex/codex-home/sessions/2026/09/25/rollout-2026-09-25T23-42-06-01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a.jsonl","cwd":"/home/replay-user/t3code/apps/server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/apps/server","runtimeWorkspaceRoots":["/home/replay-user/t3code/apps/server"],"instructionSources":["/home/replay-user/t3code/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} -{"type":"expect_outbound","label":"thread/name/set","frame":{"id":3,"method":"thread/name/set","params":{"name":"Replay fixture: thread_rollback_after_restart","threadId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a"}}} -{"type":"emit_inbound","label":"thread/name/set","frame":{"id":3,"result":{}}} +{"type":"emit_inbound","label":"thread/start","frame":{"id":3,"result":{"thread":{"id":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/apps/server","runtimeWorkspaceRoots":["/home/replay-user/t3code/apps/server"]}],"extra":null,"sessionId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790404926,"updatedAt":1790404926,"recencyAt":1790404926,"status":{"type":"idle"},"path":"/home/replay-user/tmp/bughunt-codex/codex-home/sessions/2026/09/25/rollout-2026-09-25T23-42-06-01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a.jsonl","cwd":"/home/replay-user/t3code/apps/server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/apps/server","runtimeWorkspaceRoots":["/home/replay-user/t3code/apps/server"],"instructionSources":["/home/replay-user/t3code/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} +{"type":"expect_outbound","label":"thread/name/set","frame":{"id":4,"method":"thread/name/set","params":{"name":"Replay fixture: thread_rollback_after_restart","threadId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a"}}} +{"type":"emit_inbound","label":"thread/name/set","frame":{"id":4,"result":{}}} {"type":"emit_inbound","label":"thread/name/updated","frame":{"method":"thread/name/updated","params":{"threadId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a","threadName":"Replay fixture: thread_rollback_after_restart"}}} -{"type":"expect_outbound","label":"config/read","frame":{"id":4,"method":"config/read","params":{"cwd":"","includeLayers":false}}} -{"type":"emit_inbound","label":"config/read","frame":{"id":4,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"turn/start","frame":{"id":5,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Respond with exactly: rollback fixture first turn complete","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":5,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":5,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"turn/start","frame":{"id":6,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Respond with exactly: rollback fixture first turn complete","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} {"type":"emit_inbound","label":"thread/started","frame":{"method":"thread/started","params":{"thread":{"id":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/apps/server","runtimeWorkspaceRoots":["/home/replay-user/t3code/apps/server"]}],"extra":null,"sessionId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790404926,"updatedAt":1790404926,"recencyAt":1790404926,"status":{"type":"idle"},"path":"/home/replay-user/tmp/bughunt-codex/codex-home/sessions/2026/09/25/rollout-2026-09-25T23-42-06-01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a.jsonl","cwd":"/home/replay-user/t3code/apps/server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]}},"emittedAtMs":1790404926549}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a","name":"codex_apps","status":"starting","error":null,"failureReason":null},"emittedAtMs":1790404926550}} {"type":"emit_inbound","label":"thread/settings/updated","frame":{"method":"thread/settings/updated","params":{"threadId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a","threadSettings":{"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/apps/server","approvalPolicy":"never","approvalsReviewer":"user","sandboxPolicy":{"type":"dangerFullAccess"},"activePermissionProfile":null,"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"effort":null,"summary":"detailed","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna","reasoning_effort":null,"developer_instructions":null}},"multiAgentMode":"explicitRequestOnly","personality":null}},"emittedAtMs":1790404926569}} -{"type":"emit_inbound","label":"turn/start","frame":{"id":5,"result":{"turn":{"id":"01a0dc73-1c60-70a3-9a3c-d54c0020efa2","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"emit_inbound","label":"turn/start","frame":{"id":6,"result":{"turn":{"id":"01a0dc73-1c60-70a3-9a3c-d54c0020efa2","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a","status":{"type":"active","activeFlags":[]}},"emittedAtMs":1790404926645}} {"type":"emit_inbound","label":"turn/started","frame":{"method":"turn/started","params":{"threadId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a","turn":{"id":"01a0dc73-1c60-70a3-9a3c-d54c0020efa2","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":1790404926,"completedAt":null,"durationMs":null}},"emittedAtMs":1790404926645}} {"type":"emit_inbound","label":"account/updated","frame":{"method":"account/updated","params":{"authMode":"chatgpt","planType":"unknown"},"emittedAtMs":1790404926921}} @@ -33,10 +35,10 @@ {"type":"emit_inbound","label":"thread/tokenUsage/updated","frame":{"method":"thread/tokenUsage/updated","params":{"threadId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a","turnId":"01a0dc73-1c60-70a3-9a3c-d54c0020efa2","tokenUsage":{"total":{"totalTokens":19805,"inputTokens":19796,"cachedInputTokens":0,"cacheWriteInputTokens":0,"outputTokens":9,"reasoningOutputTokens":0},"last":{"totalTokens":19805,"inputTokens":19796,"cachedInputTokens":0,"cacheWriteInputTokens":0,"outputTokens":9,"reasoningOutputTokens":0},"modelContextWindow":258400}},"emittedAtMs":1790404930976}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a","status":{"type":"idle"}},"emittedAtMs":1790404931000}} {"type":"emit_inbound","label":"turn/completed","frame":{"method":"turn/completed","params":{"threadId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a","turn":{"id":"01a0dc73-1c60-70a3-9a3c-d54c0020efa2","items":[{"type":"agentMessage","id":"msg_0f3ce1c685f16088016ab7694298d087d0a53f8de6070d33ad","text":"rollback fixture first turn complete","phase":"final_answer","memoryCitation":null,"delivery":null,"questions":null}],"itemsView":"summary","status":"completed","error":null,"startedAt":1790404926,"completedAt":1790404930,"durationMs":4426}},"emittedAtMs":1790404931000}} -{"type":"expect_outbound","label":"config/read","frame":{"id":6,"method":"config/read","params":{"cwd":"","includeLayers":false}}} -{"type":"emit_inbound","label":"config/read","frame":{"id":6,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"turn/start","frame":{"id":7,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Respond with exactly: rollback fixture second turn complete","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} -{"type":"emit_inbound","label":"turn/start","frame":{"id":7,"result":{"turn":{"id":"01a0dc73-2dc4-7911-a448-c66b9bf3318b","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":7,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":7,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"turn/start","frame":{"id":8,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Respond with exactly: rollback fixture second turn complete","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} +{"type":"emit_inbound","label":"turn/start","frame":{"id":8,"result":{"turn":{"id":"01a0dc73-2dc4-7911-a448-c66b9bf3318b","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a","status":{"type":"active","activeFlags":[]}},"emittedAtMs":1790404931059}} {"type":"emit_inbound","label":"turn/started","frame":{"method":"turn/started","params":{"threadId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a","turn":{"id":"01a0dc73-2dc4-7911-a448-c66b9bf3318b","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":1790404931,"completedAt":null,"durationMs":null}},"emittedAtMs":1790404931059}} {"type":"emit_inbound","label":"item/started","frame":{"method":"item/started","params":{"item":{"type":"userMessage","id":"01a0dc73-2e86-7131-a632-7a2b7e8186fb","clientId":null,"content":[{"type":"text","text":"Respond with exactly: rollback fixture second turn complete","text_elements":[]}]},"threadId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a","turnId":"01a0dc73-2dc4-7911-a448-c66b9bf3318b","startedAtMs":1790404931208},"emittedAtMs":1790404931208}} @@ -59,32 +61,36 @@ {"type":"emit_inbound","label":"configWarning","frame":{"method":"configWarning","params":{"summary":"Codex could not find bubblewrap on PATH. Install bubblewrap with your OS package manager. See the sandbox prerequisites: https://developers.openai.com/codex/concepts/sandboxing#prerequisites. Codex will use the bundled bubblewrap in the meantime.","details":null},"emittedAtMs":1790404935235}} {"type":"emit_inbound","label":"remoteControl/status/changed","frame":{"method":"remoteControl/status/changed","params":{"status":"disabled","serverName":"replay-host","installationId":"00000000-0000-4000-8000-000000000000","environmentId":null},"emittedAtMs":1790404935235}} {"type":"emit_inbound","label":"thread/read","frame":{"id":2,"result":{"thread":{"id":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a","environments":null,"extra":null,"sessionId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a","forkedFromId":null,"parentThreadId":null,"preview":"Respond with exactly: rollback fixture first turn complete","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790404926,"updatedAt":1790404934,"recencyAt":1790404931,"status":{"type":"notLoaded"},"path":"/home/replay-user/tmp/bughunt-codex/codex-home/sessions/2026/09/25/rollout-2026-09-25T23-42-06-01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a.jsonl","cwd":"/home/replay-user/t3code/apps/server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":null,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":{"sha":"70629cdddbe2c29749e8dce588b1828580b2777b","branch":"fix/codex-rollback-resume","originUrl":"https://github.com/pingdotgg/t3code.git"},"name":null,"daybreakEnabled":null,"turns":[]}}}} -{"type":"expect_outbound","label":"thread/resume","frame":{"id":3,"method":"thread/resume","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","excludeTurns":true,"model":"gpt-6-luna","threadId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a"}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":3,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":3,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"thread/resume","frame":{"id":4,"method":"thread/resume","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","excludeTurns":true,"model":"gpt-6-luna","threadId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a"}}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a","name":"codex_apps","status":"starting","error":null,"failureReason":null},"emittedAtMs":1790404935482}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a","status":{"type":"idle"}},"emittedAtMs":1790404935500}} -{"type":"emit_inbound","label":"thread/resume","frame":{"id":3,"result":{"thread":{"id":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/apps/server","runtimeWorkspaceRoots":["/home/replay-user/t3code/apps/server"]}],"extra":null,"sessionId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a","forkedFromId":null,"parentThreadId":null,"preview":"Respond with exactly: rollback fixture first turn complete","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790404926,"updatedAt":1790404935,"recencyAt":1790404931,"status":{"type":"idle"},"path":"/home/replay-user/tmp/bughunt-codex/codex-home/sessions/2026/09/25/rollout-2026-09-25T23-42-06-01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a.jsonl","cwd":"/home/replay-user/t3code/apps/server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":{"sha":"70629cdddbe2c29749e8dce588b1828580b2777b","branch":"fix/codex-rollback-resume","originUrl":"https://github.com/pingdotgg/t3code.git"},"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/apps/server","runtimeWorkspaceRoots":["/home/replay-user/t3code/apps/server"],"instructionSources":["/home/replay-user/t3code/AGENTS.md"],"approvalPolicy":"never","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna","reasoning_effort":null,"developer_instructions":null}},"multiAgentMode":"explicitRequestOnly","initialTurnsPage":null,"turnsBackwardsCursor":"{\"requestedThreadId\":\"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a\",\"rolloutOrdinal\":16,\"includeAnchor\":true,\"scope\":{\"kind\":\"turns\"}}","itemsBackwardsCursor":"{\"requestedThreadId\":\"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a\",\"rolloutOrdinal\":22,\"includeAnchor\":true,\"scope\":{\"kind\":\"itemsByCreatedAtOrdinal\"}}"}}} -{"type":"expect_outbound","label":"thread/turns/list","frame":{"id":4,"method":"thread/turns/list","params":{"cursor":null,"itemsView":"summary","limit":1,"sortDirection":"desc","threadId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a"}}} +{"type":"emit_inbound","label":"thread/resume","frame":{"id":4,"result":{"thread":{"id":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/apps/server","runtimeWorkspaceRoots":["/home/replay-user/t3code/apps/server"]}],"extra":null,"sessionId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a","forkedFromId":null,"parentThreadId":null,"preview":"Respond with exactly: rollback fixture first turn complete","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790404926,"updatedAt":1790404935,"recencyAt":1790404931,"status":{"type":"idle"},"path":"/home/replay-user/tmp/bughunt-codex/codex-home/sessions/2026/09/25/rollout-2026-09-25T23-42-06-01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a.jsonl","cwd":"/home/replay-user/t3code/apps/server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":{"sha":"70629cdddbe2c29749e8dce588b1828580b2777b","branch":"fix/codex-rollback-resume","originUrl":"https://github.com/pingdotgg/t3code.git"},"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/apps/server","runtimeWorkspaceRoots":["/home/replay-user/t3code/apps/server"],"instructionSources":["/home/replay-user/t3code/AGENTS.md"],"approvalPolicy":"never","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna","reasoning_effort":null,"developer_instructions":null}},"multiAgentMode":"explicitRequestOnly","initialTurnsPage":null,"turnsBackwardsCursor":"{\"requestedThreadId\":\"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a\",\"rolloutOrdinal\":16,\"includeAnchor\":true,\"scope\":{\"kind\":\"turns\"}}","itemsBackwardsCursor":"{\"requestedThreadId\":\"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a\",\"rolloutOrdinal\":22,\"includeAnchor\":true,\"scope\":{\"kind\":\"itemsByCreatedAtOrdinal\"}}"}}} +{"type":"expect_outbound","label":"thread/turns/list","frame":{"id":5,"method":"thread/turns/list","params":{"cursor":null,"itemsView":"summary","limit":1,"sortDirection":"desc","threadId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a"}}} {"type":"emit_inbound","label":"thread/tokenUsage/updated","frame":{"method":"thread/tokenUsage/updated","params":{"threadId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a","turnId":"01a0dc73-2dc4-7911-a448-c66b9bf3318b","tokenUsage":{"total":{"totalTokens":44003,"inputTokens":43985,"cachedInputTokens":19200,"cacheWriteInputTokens":0,"outputTokens":18,"reasoningOutputTokens":0},"last":{"totalTokens":24198,"inputTokens":24189,"cachedInputTokens":19200,"cacheWriteInputTokens":0,"outputTokens":9,"reasoningOutputTokens":0},"modelContextWindow":258400}},"emittedAtMs":1790404935520}} {"type":"emit_inbound","label":"thread/goal/cleared","frame":{"method":"thread/goal/cleared","params":{"threadId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a"},"emittedAtMs":1790404935521}} -{"type":"emit_inbound","label":"thread/turns/list","frame":{"id":4,"result":{"data":[{"id":"01a0dc73-2dc4-7911-a448-c66b9bf3318b","items":[{"type":"userMessage","id":"01a0dc73-2e86-7131-a632-7a2b7e8186fb","clientId":null,"content":[{"type":"text","text":"Respond with exactly: rollback fixture second turn complete","text_elements":[]}]},{"type":"agentMessage","id":"msg_0f3ce1c685f16088016ab769447c6087d08bd0018d724b5401","text":"rollback fixture second turn complete","phase":"final_answer","memoryCitation":null,"delivery":null,"questions":null}],"itemsView":"summary","status":"completed","error":null,"startedAt":1790404931,"completedAt":1790404934,"durationMs":3756}],"nextCursor":"{\"requestedThreadId\":\"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a\",\"rolloutOrdinal\":16,\"includeAnchor\":false,\"scope\":{\"kind\":\"turns\"}}","backwardsCursor":"{\"requestedThreadId\":\"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a\",\"rolloutOrdinal\":16,\"includeAnchor\":true,\"scope\":{\"kind\":\"turns\"}}"}}} -{"type":"expect_outbound","label":"thread/revert","frame":{"id":5,"method":"thread/revert","params":{"beforeTurnId":"01a0dc73-2dc4-7911-a448-c66b9bf3318b","threadId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a"}}} +{"type":"emit_inbound","label":"thread/turns/list","frame":{"id":5,"result":{"data":[{"id":"01a0dc73-2dc4-7911-a448-c66b9bf3318b","items":[{"type":"userMessage","id":"01a0dc73-2e86-7131-a632-7a2b7e8186fb","clientId":null,"content":[{"type":"text","text":"Respond with exactly: rollback fixture second turn complete","text_elements":[]}]},{"type":"agentMessage","id":"msg_0f3ce1c685f16088016ab769447c6087d08bd0018d724b5401","text":"rollback fixture second turn complete","phase":"final_answer","memoryCitation":null,"delivery":null,"questions":null}],"itemsView":"summary","status":"completed","error":null,"startedAt":1790404931,"completedAt":1790404934,"durationMs":3756}],"nextCursor":"{\"requestedThreadId\":\"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a\",\"rolloutOrdinal\":16,\"includeAnchor\":false,\"scope\":{\"kind\":\"turns\"}}","backwardsCursor":"{\"requestedThreadId\":\"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a\",\"rolloutOrdinal\":16,\"includeAnchor\":true,\"scope\":{\"kind\":\"turns\"}}"}}} +{"type":"expect_outbound","label":"thread/revert","frame":{"id":6,"method":"thread/revert","params":{"beforeTurnId":"01a0dc73-2dc4-7911-a448-c66b9bf3318b","threadId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a"}}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a","name":"codex_apps","status":"cancelled","error":null,"failureReason":null},"emittedAtMs":1790404935542}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a","status":{"type":"notLoaded"}},"emittedAtMs":1790404935544}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a","name":"codex_apps","status":"starting","error":null,"failureReason":null},"emittedAtMs":1790404935656}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a","status":{"type":"idle"}},"emittedAtMs":1790404935660}} -{"type":"emit_inbound","label":"thread/revert","frame":{"id":5,"result":{"thread":{"id":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/apps/server","runtimeWorkspaceRoots":["/home/replay-user/t3code/apps/server"]}],"extra":null,"sessionId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a","forkedFromId":null,"parentThreadId":null,"preview":"Respond with exactly: rollback fixture first turn complete","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790404935,"updatedAt":1790404935,"recencyAt":1790404931,"status":{"type":"idle"},"path":"/home/replay-user/tmp/bughunt-codex/codex-home/sessions/2026/09/25/rollout-2026-09-25T23-42-15-01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a_01a0dc73-3f89-7660-9a2a-81865e6273eb.jsonl","cwd":"/home/replay-user/t3code/apps/server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":{"sha":"70629cdddbe2c29749e8dce588b1828580b2777b","branch":"fix/codex-rollback-resume","originUrl":"https://github.com/pingdotgg/t3code.git"},"name":null,"daybreakEnabled":null,"turns":[]},"turnsBackwardsCursor":"{\"requestedThreadId\":\"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a\",\"rolloutOrdinal\":1,\"includeAnchor\":true,\"scope\":{\"kind\":\"turns\"}}","itemsBackwardsCursor":"{\"requestedThreadId\":\"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a\",\"rolloutOrdinal\":10,\"includeAnchor\":true,\"scope\":{\"kind\":\"itemsByCreatedAtOrdinal\"}}"}}} -{"type":"expect_outbound","label":"thread/resume","frame":{"id":6,"method":"thread/resume","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","excludeTurns":true,"model":"gpt-6-luna","threadId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a"}}} +{"type":"emit_inbound","label":"thread/revert","frame":{"id":6,"result":{"thread":{"id":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/apps/server","runtimeWorkspaceRoots":["/home/replay-user/t3code/apps/server"]}],"extra":null,"sessionId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a","forkedFromId":null,"parentThreadId":null,"preview":"Respond with exactly: rollback fixture first turn complete","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790404935,"updatedAt":1790404935,"recencyAt":1790404931,"status":{"type":"idle"},"path":"/home/replay-user/tmp/bughunt-codex/codex-home/sessions/2026/09/25/rollout-2026-09-25T23-42-15-01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a_01a0dc73-3f89-7660-9a2a-81865e6273eb.jsonl","cwd":"/home/replay-user/t3code/apps/server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":{"sha":"70629cdddbe2c29749e8dce588b1828580b2777b","branch":"fix/codex-rollback-resume","originUrl":"https://github.com/pingdotgg/t3code.git"},"name":null,"daybreakEnabled":null,"turns":[]},"turnsBackwardsCursor":"{\"requestedThreadId\":\"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a\",\"rolloutOrdinal\":1,\"includeAnchor\":true,\"scope\":{\"kind\":\"turns\"}}","itemsBackwardsCursor":"{\"requestedThreadId\":\"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a\",\"rolloutOrdinal\":10,\"includeAnchor\":true,\"scope\":{\"kind\":\"itemsByCreatedAtOrdinal\"}}"}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":7,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":7,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"thread/resume","frame":{"id":8,"method":"thread/resume","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","excludeTurns":true,"model":"gpt-6-luna","threadId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a"}}} {"type":"emit_inbound","label":"thread/reverted","frame":{"method":"thread/reverted","params":{"threadId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a"},"emittedAtMs":1790404935694}} -{"type":"emit_inbound","label":"thread/resume","frame":{"id":6,"result":{"thread":{"id":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/apps/server","runtimeWorkspaceRoots":["/home/replay-user/t3code/apps/server"]}],"extra":null,"sessionId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a","forkedFromId":null,"parentThreadId":null,"preview":"Respond with exactly: rollback fixture first turn complete","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790404935,"updatedAt":1790404935,"recencyAt":1790404931,"status":{"type":"idle"},"path":"/home/replay-user/tmp/bughunt-codex/codex-home/sessions/2026/09/25/rollout-2026-09-25T23-42-15-01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a_01a0dc73-3f89-7660-9a2a-81865e6273eb.jsonl","cwd":"/home/replay-user/t3code/apps/server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":{"sha":"70629cdddbe2c29749e8dce588b1828580b2777b","branch":"fix/codex-rollback-resume","originUrl":"https://github.com/pingdotgg/t3code.git"},"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-luna","modelProvider":"openai","serviceTier":"default","disabledPluginIds":[],"cwd":"/home/replay-user/t3code/apps/server","runtimeWorkspaceRoots":["/home/replay-user/t3code/apps/server"],"instructionSources":["/home/replay-user/t3code/AGENTS.md"],"approvalPolicy":"never","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna","reasoning_effort":null,"developer_instructions":null}},"multiAgentMode":"explicitRequestOnly","initialTurnsPage":null,"turnsBackwardsCursor":"{\"requestedThreadId\":\"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a\",\"rolloutOrdinal\":1,\"includeAnchor\":true,\"scope\":{\"kind\":\"turns\"}}","itemsBackwardsCursor":"{\"requestedThreadId\":\"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a\",\"rolloutOrdinal\":10,\"includeAnchor\":true,\"scope\":{\"kind\":\"itemsByCreatedAtOrdinal\"}}"}}} -{"type":"expect_outbound","label":"thread/name/set","frame":{"id":7,"method":"thread/name/set","params":{"name":"Replay fixture: thread_rollback_after_restart","threadId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a"}}} -{"type":"emit_inbound","label":"thread/name/set","frame":{"id":7,"result":{}}} +{"type":"emit_inbound","label":"thread/resume","frame":{"id":8,"result":{"thread":{"id":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/apps/server","runtimeWorkspaceRoots":["/home/replay-user/t3code/apps/server"]}],"extra":null,"sessionId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a","forkedFromId":null,"parentThreadId":null,"preview":"Respond with exactly: rollback fixture first turn complete","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790404935,"updatedAt":1790404935,"recencyAt":1790404931,"status":{"type":"idle"},"path":"/home/replay-user/tmp/bughunt-codex/codex-home/sessions/2026/09/25/rollout-2026-09-25T23-42-15-01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a_01a0dc73-3f89-7660-9a2a-81865e6273eb.jsonl","cwd":"/home/replay-user/t3code/apps/server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":{"sha":"70629cdddbe2c29749e8dce588b1828580b2777b","branch":"fix/codex-rollback-resume","originUrl":"https://github.com/pingdotgg/t3code.git"},"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-luna","modelProvider":"openai","serviceTier":"default","disabledPluginIds":[],"cwd":"/home/replay-user/t3code/apps/server","runtimeWorkspaceRoots":["/home/replay-user/t3code/apps/server"],"instructionSources":["/home/replay-user/t3code/AGENTS.md"],"approvalPolicy":"never","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna","reasoning_effort":null,"developer_instructions":null}},"multiAgentMode":"explicitRequestOnly","initialTurnsPage":null,"turnsBackwardsCursor":"{\"requestedThreadId\":\"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a\",\"rolloutOrdinal\":1,\"includeAnchor\":true,\"scope\":{\"kind\":\"turns\"}}","itemsBackwardsCursor":"{\"requestedThreadId\":\"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a\",\"rolloutOrdinal\":10,\"includeAnchor\":true,\"scope\":{\"kind\":\"itemsByCreatedAtOrdinal\"}}"}}} +{"type":"expect_outbound","label":"thread/name/set","frame":{"id":9,"method":"thread/name/set","params":{"name":"Replay fixture: thread_rollback_after_restart","threadId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a"}}} +{"type":"emit_inbound","label":"thread/name/set","frame":{"id":9,"result":{}}} {"type":"emit_inbound","label":"thread/name/updated","frame":{"method":"thread/name/updated","params":{"threadId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a","threadName":"Replay fixture: thread_rollback_after_restart"}}} -{"type":"expect_outbound","label":"config/read","frame":{"id":8,"method":"config/read","params":{"cwd":"","includeLayers":false}}} -{"type":"emit_inbound","label":"config/read","frame":{"id":8,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"turn/start","frame":{"id":9,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Repeat the conversation verbatim.","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":10,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":10,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"turn/start","frame":{"id":11,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Repeat the conversation verbatim.","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} {"type":"emit_inbound","label":"thread/goal/cleared","frame":{"method":"thread/goal/cleared","params":{"threadId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a"},"emittedAtMs":1790404935729}} {"type":"emit_inbound","label":"thread/settings/updated","frame":{"method":"thread/settings/updated","params":{"threadId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a","threadSettings":{"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/apps/server","approvalPolicy":"never","approvalsReviewer":"user","sandboxPolicy":{"type":"dangerFullAccess"},"activePermissionProfile":null,"model":"gpt-6-luna","modelProvider":"openai","serviceTier":"default","effort":null,"summary":"detailed","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna","reasoning_effort":null,"developer_instructions":null}},"multiAgentMode":"explicitRequestOnly","personality":null}},"emittedAtMs":1790404935753}} -{"type":"emit_inbound","label":"turn/start","frame":{"id":9,"result":{"turn":{"id":"01a0dc73-4034-7201-88e4-13d0d27303a3","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"emit_inbound","label":"turn/start","frame":{"id":11,"result":{"turn":{"id":"01a0dc73-4034-7201-88e4-13d0d27303a3","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a","status":{"type":"active","activeFlags":[]}},"emittedAtMs":1790404935798}} {"type":"emit_inbound","label":"turn/started","frame":{"method":"turn/started","params":{"threadId":"01a0dc73-1bb4-74f1-977f-2fc39b8aaa6a","turn":{"id":"01a0dc73-4034-7201-88e4-13d0d27303a3","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":1790404935,"completedAt":null,"durationMs":null}},"emittedAtMs":1790404935798}} {"type":"emit_inbound","label":"account/updated","frame":{"method":"account/updated","params":{"authMode":"chatgpt","planType":"unknown"},"emittedAtMs":1790404935820}} diff --git a/apps/server/src/orchestration-v2/testkit/fixtures/thread_rollback_to_stopped_turn/codex_transcript.ndjson b/apps/server/src/orchestration-v2/testkit/fixtures/thread_rollback_to_stopped_turn/codex_transcript.ndjson index 7868924d82823..9b5eece1211e0 100644 --- a/apps/server/src/orchestration-v2/testkit/fixtures/thread_rollback_to_stopped_turn/codex_transcript.ndjson +++ b/apps/server/src/orchestration-v2/testkit/fixtures/thread_rollback_to_stopped_turn/codex_transcript.ndjson @@ -2,20 +2,22 @@ {"type":"expect_outbound","label":"initialize","frame":{"id":1,"method":"initialize","params":{"capabilities":{"experimentalApi":true,"optOutNotificationMethods":["turn/diff/updated"],"extensions":{"io.modelcontextprotocol/ui":{"mimeTypes":["text/html;profile=mcp-app"]}}},"clientInfo":{"name":"T3 Code","title":"T3 Code","version":"0.0.44"}}}} {"type":"emit_inbound","label":"initialize","frame":{"id":1,"result":{"userAgent":"t3code_desktop/0.156.1 (Debian 13.0.0; x86_64) unknown (t3code_desktop; 0.1.0)","codexHome":"/home/replay-user/.codex","platformFamily":"unix","platformOs":"linux"}}} {"type":"expect_outbound","label":"initialized","frame":{"method":"initialized"}} -{"type":"expect_outbound","label":"thread/start","frame":{"id":2,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","model":"gpt-6-luna"}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":2,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":2,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"thread/start","frame":{"id":3,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","model":"gpt-6-luna"}}} {"type":"emit_inbound","label":"configWarning","frame":{"method":"configWarning","params":{"summary":"Codex could not find bubblewrap on PATH. Install bubblewrap with your OS package manager. See the sandbox prerequisites: https://developers.openai.com/codex/concepts/sandboxing#prerequisites. Codex will use the bundled bubblewrap in the meantime.","details":null},"emittedAtMs":1790459891821}} {"type":"emit_inbound","label":"remoteControl/status/changed","frame":{"method":"remoteControl/status/changed","params":{"status":"disabled","serverName":"replay-host","installationId":"00000000-0000-4000-8000-000000000000","environmentId":null},"emittedAtMs":1790459891821}} -{"type":"emit_inbound","label":"thread/start","frame":{"id":2,"result":{"thread":{"id":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code","runtimeWorkspaceRoots":["/home/replay-user/t3code"]}],"extra":null,"sessionId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790459892,"updatedAt":1790459892,"recencyAt":1790459892,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/26/rollout-2026-09-26T14-58-12-01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88.jsonl","cwd":"/home/replay-user/t3code","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code","runtimeWorkspaceRoots":["/home/replay-user/t3code"],"instructionSources":[],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} -{"type":"expect_outbound","label":"thread/name/set","frame":{"id":3,"method":"thread/name/set","params":{"name":"Replay fixture: thread_rollback_to_stopped_turn","threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88"}}} -{"type":"emit_inbound","label":"thread/name/set","frame":{"id":3,"result":{}}} +{"type":"emit_inbound","label":"thread/start","frame":{"id":3,"result":{"thread":{"id":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code","runtimeWorkspaceRoots":["/home/replay-user/t3code"]}],"extra":null,"sessionId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790459892,"updatedAt":1790459892,"recencyAt":1790459892,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/26/rollout-2026-09-26T14-58-12-01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88.jsonl","cwd":"/home/replay-user/t3code","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code","runtimeWorkspaceRoots":["/home/replay-user/t3code"],"instructionSources":[],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} +{"type":"expect_outbound","label":"thread/name/set","frame":{"id":4,"method":"thread/name/set","params":{"name":"Replay fixture: thread_rollback_to_stopped_turn","threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88"}}} +{"type":"emit_inbound","label":"thread/name/set","frame":{"id":4,"result":{}}} {"type":"emit_inbound","label":"thread/name/updated","frame":{"method":"thread/name/updated","params":{"threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","threadName":"Replay fixture: thread_rollback_to_stopped_turn"}}} -{"type":"expect_outbound","label":"config/read","frame":{"id":4,"method":"config/read","params":{"cwd":"","includeLayers":false}}} -{"type":"emit_inbound","label":"config/read","frame":{"id":4,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"turn/start","frame":{"id":5,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Respond with exactly: rollback fixture first turn complete","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"networkAccess":false,"type":"workspaceWrite","writableRoots":[]},"summary":"auto","threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":5,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":5,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"turn/start","frame":{"id":6,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Respond with exactly: rollback fixture first turn complete","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"networkAccess":false,"type":"workspaceWrite","writableRoots":[]},"summary":"auto","threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} {"type":"emit_inbound","label":"thread/started","frame":{"method":"thread/started","params":{"thread":{"id":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code","runtimeWorkspaceRoots":["/home/replay-user/t3code"]}],"extra":null,"sessionId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790459892,"updatedAt":1790459892,"recencyAt":1790459892,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/26/rollout-2026-09-26T14-58-12-01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88.jsonl","cwd":"/home/replay-user/t3code","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]}},"emittedAtMs":1790459892845}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","name":"codex_apps","status":"starting","error":null,"failureReason":null},"emittedAtMs":1790459892846}} {"type":"emit_inbound","label":"thread/settings/updated","frame":{"method":"thread/settings/updated","params":{"threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","threadSettings":{"disabledPluginIds":[],"cwd":"/home/replay-user/t3code","approvalPolicy":"never","approvalsReviewer":"user","sandboxPolicy":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":null,"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"effort":null,"summary":"detailed","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna","reasoning_effort":null,"developer_instructions":null}},"multiAgentMode":"explicitRequestOnly","personality":null}},"emittedAtMs":1790459892862}} -{"type":"emit_inbound","label":"turn/start","frame":{"id":5,"result":{"turn":{"id":"01a0dfb9-d479-70c0-9d88-912b52f7f613","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"emit_inbound","label":"turn/start","frame":{"id":6,"result":{"turn":{"id":"01a0dfb9-d479-70c0-9d88-912b52f7f613","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","status":{"type":"active","activeFlags":[]}},"emittedAtMs":1790459892915}} {"type":"emit_inbound","label":"turn/started","frame":{"method":"turn/started","params":{"threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","turn":{"id":"01a0dfb9-d479-70c0-9d88-912b52f7f613","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":1790459892,"completedAt":null,"durationMs":null}},"emittedAtMs":1790459892915}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","name":"codex_apps","status":"failed","error":"MCP client for `codex_apps` failed to start: MCP startup failed: handshaking with MCP server failed: Send message error Transport [codex_rmcp_client::event_notification_transport::EventNotificationTransport>>] error: unexpected server response: HTTP 401: {\n \"error\": {\n \"message\": \"Encountered invalidated oauth token for user, failing request\",\n \"type\": null,\n \"code\": \"token_revoked\",\n \"param\": null\n },\n \"status\": 401\n}, when send initialize request: Send message error Transport [codex_rmcp_client::event_notification_transport::EventNotificationTransport>>] error: unexpected server response: HTTP 401: {\n \"error\": {\n \"message\": \"Encountered invalidated oauth token for user, failing request\",\n \"type\": null,\n \"code\": \"token_revoked\",\n \"param\": null\n },\n \"status\": 401\n}, when send initialize request","failureReason":null},"emittedAtMs":1790459893144}} @@ -31,10 +33,10 @@ {"type":"emit_inbound","label":"thread/tokenUsage/updated","frame":{"method":"thread/tokenUsage/updated","params":{"threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","turnId":"01a0dfb9-d479-70c0-9d88-912b52f7f613","tokenUsage":{"total":{"totalTokens":15291,"inputTokens":15282,"cachedInputTokens":0,"cacheWriteInputTokens":0,"outputTokens":9,"reasoningOutputTokens":0},"last":{"totalTokens":15291,"inputTokens":15282,"cachedInputTokens":0,"cacheWriteInputTokens":0,"outputTokens":9,"reasoningOutputTokens":0},"modelContextWindow":258400}},"emittedAtMs":1790459897074}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","status":{"type":"idle"}},"emittedAtMs":1790459897082}} {"type":"emit_inbound","label":"turn/completed","frame":{"method":"turn/completed","params":{"threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","turn":{"id":"01a0dfb9-d479-70c0-9d88-912b52f7f613","items":[{"type":"agentMessage","id":"msg_0508263b0487774d016ab83ff8973c87d0afab5ac113234803","text":"rollback fixture first turn complete","phase":"final_answer","memoryCitation":null,"delivery":null,"questions":null}],"itemsView":"summary","status":"completed","error":null,"startedAt":1790459892,"completedAt":1790459897,"durationMs":4216}},"emittedAtMs":1790459897082}} -{"type":"expect_outbound","label":"config/read","frame":{"id":6,"method":"config/read","params":{"cwd":"","includeLayers":false}}} -{"type":"emit_inbound","label":"config/read","frame":{"id":6,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"turn/start","frame":{"id":7,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Run this exact local command: `node -e \"console.log('interrupt fixture tool started'); setTimeout(() => {}, 30000)\"`. Do not answer until it completes, then respond exactly: interrupt fixture should not finish naturally.","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"networkAccess":false,"type":"workspaceWrite","writableRoots":[]},"summary":"auto","threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} -{"type":"emit_inbound","label":"turn/start","frame":{"id":7,"result":{"turn":{"id":"01a0dfb9-e509-7001-ba72-fe324f527fb9","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":7,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":7,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"turn/start","frame":{"id":8,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Run this exact local command: `node -e \"console.log('interrupt fixture tool started'); setTimeout(() => {}, 30000)\"`. Do not answer until it completes, then respond exactly: interrupt fixture should not finish naturally.","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"networkAccess":false,"type":"workspaceWrite","writableRoots":[]},"summary":"auto","threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} +{"type":"emit_inbound","label":"turn/start","frame":{"id":8,"result":{"turn":{"id":"01a0dfb9-e509-7001-ba72-fe324f527fb9","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","status":{"type":"active","activeFlags":[]}},"emittedAtMs":1790459897121}} {"type":"emit_inbound","label":"turn/started","frame":{"method":"turn/started","params":{"threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","turn":{"id":"01a0dfb9-e509-7001-ba72-fe324f527fb9","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":1790459897,"completedAt":null,"durationMs":null}},"emittedAtMs":1790459897121}} {"type":"emit_inbound","label":"item/started","frame":{"method":"item/started","params":{"item":{"type":"userMessage","id":"01a0dfb9-e8f3-7011-a214-7479457edb56","clientId":null,"content":[{"type":"text","text":"Run this exact local command: `node -e \"console.log('interrupt fixture tool started'); setTimeout(() => {}, 30000)\"`. Do not answer until it completes, then respond exactly: interrupt fixture should not finish naturally.","text_elements":[]}]},"threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","turnId":"01a0dfb9-e509-7001-ba72-fe324f527fb9","startedAtMs":1790459898101},"emittedAtMs":1790459898101}} @@ -61,19 +63,19 @@ {"type":"emit_inbound","label":"item/agentMessage/delta","frame":{"method":"item/agentMessage/delta","params":{"threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","turnId":"01a0dfb9-e509-7001-ba72-fe324f527fb9","itemId":"msg_0508263b0487774d016ab83ffcc71887d0874b12a3fb65dd41","delta":"."},"emittedAtMs":1790459902812}} {"type":"emit_inbound","label":"item/completed","frame":{"method":"item/completed","params":{"item":{"type":"agentMessage","id":"msg_0508263b0487774d016ab83ffcc71887d0874b12a3fb65dd41","text":"I’ll run the command exactly as given and wait for it to exit.","phase":"commentary","memoryCitation":null,"delivery":null,"questions":null},"threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","turnId":"01a0dfb9-e509-7001-ba72-fe324f527fb9","completedAtMs":1790459903007},"emittedAtMs":1790459903009}} {"type":"emit_inbound","label":"item/started","frame":{"method":"item/started","params":{"item":{"type":"commandExecution","id":"exec-6964412e-1d91-47b5-8a37-7a669b30c03e","pluginId":null,"scriptPath":null,"command":"/bin/bash -lc \"node -e \\\"console.log('interrupt fixture tool started'); setTimeout(() => {}, 30000)\\\"\"","cwd":"/home/replay-user/t3code","processId":"26675","source":"unifiedExecStartup","status":"inProgress","commandActions":[{"type":"unknown","command":"node -e \"console.log('interrupt fixture tool started'); setTimeout(() => {}, 30000)\""}],"aggregatedOutput":null,"exitCode":null,"durationMs":null},"threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","turnId":"01a0dfb9-e509-7001-ba72-fe324f527fb9","startedAtMs":1790459903878},"emittedAtMs":1790459903884}} -{"type":"expect_outbound","label":"turn/interrupt","frame":{"id":8,"method":"turn/interrupt","params":{"threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","turnId":"01a0dfb9-e509-7001-ba72-fe324f527fb9"}}} +{"type":"expect_outbound","label":"turn/interrupt","frame":{"id":9,"method":"turn/interrupt","params":{"threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","turnId":"01a0dfb9-e509-7001-ba72-fe324f527fb9"}}} {"type":"emit_inbound","label":"thread/tokenUsage/updated","frame":{"method":"thread/tokenUsage/updated","params":{"threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","turnId":"01a0dfb9-e509-7001-ba72-fe324f527fb9","tokenUsage":{"total":{"totalTokens":30736,"inputTokens":30626,"cachedInputTokens":15104,"cacheWriteInputTokens":0,"outputTokens":110,"reasoningOutputTokens":15},"last":{"totalTokens":15445,"inputTokens":15344,"cachedInputTokens":15104,"cacheWriteInputTokens":0,"outputTokens":101,"reasoningOutputTokens":15},"modelContextWindow":258400}},"emittedAtMs":1790459903893}} -{"type":"emit_inbound","label":"turn/interrupt","frame":{"id":8,"result":{}}} -{"type":"expect_outbound","label":"thread/backgroundTerminals/terminate","frame":{"id":9,"method":"thread/backgroundTerminals/terminate","params":{"threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","processId":"26675"}}} +{"type":"emit_inbound","label":"turn/interrupt","frame":{"id":9,"result":{}}} +{"type":"expect_outbound","label":"thread/backgroundTerminals/terminate","frame":{"id":10,"method":"thread/backgroundTerminals/terminate","params":{"threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","processId":"26675"}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","status":{"type":"idle"}},"emittedAtMs":1790459903899}} {"type":"emit_inbound","label":"turn/completed","frame":{"method":"turn/completed","params":{"threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","turn":{"id":"01a0dfb9-e509-7001-ba72-fe324f527fb9","items":[],"itemsView":"notLoaded","status":"interrupted","error":null,"startedAt":1790459897,"completedAt":1790459903,"durationMs":6789}},"emittedAtMs":1790459903899}} -{"type":"emit_inbound","label":"thread/backgroundTerminals/terminate","frame":{"id":9,"result":{"terminated":true}}} -{"type":"expect_outbound","label":"config/read","frame":{"id":10,"method":"config/read","params":{"cwd":"","includeLayers":false}}} -{"type":"emit_inbound","label":"config/read","frame":{"id":10,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"turn/start","frame":{"id":11,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Respond with exactly: rollback fixture second turn complete","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"networkAccess":false,"type":"workspaceWrite","writableRoots":[]},"summary":"auto","threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} +{"type":"emit_inbound","label":"thread/backgroundTerminals/terminate","frame":{"id":10,"result":{"terminated":true}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":11,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":11,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"turn/start","frame":{"id":12,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Respond with exactly: rollback fixture second turn complete","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"networkAccess":false,"type":"workspaceWrite","writableRoots":[]},"summary":"auto","threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","name":"codex_apps","status":"starting","error":null,"failureReason":null},"emittedAtMs":1790459903907}} {"type":"emit_inbound","label":"item/completed","frame":{"method":"item/completed","params":{"item":{"type":"commandExecution","id":"exec-6964412e-1d91-47b5-8a37-7a669b30c03e","pluginId":null,"scriptPath":null,"command":"/bin/bash -lc \"node -e \\\"console.log('interrupt fixture tool started'); setTimeout(() => {}, 30000)\\\"\"","cwd":"/home/replay-user/t3code","processId":"26675","source":"unifiedExecStartup","status":"failed","commandActions":[{"type":"unknown","command":"node -e \"console.log('interrupt fixture tool started'); setTimeout(() => {}, 30000)\""}],"aggregatedOutput":null,"exitCode":-1,"durationMs":22},"threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","turnId":"01a0dfb9-e509-7001-ba72-fe324f527fb9","completedAtMs":1790459903901},"emittedAtMs":1790459903912}} -{"type":"emit_inbound","label":"turn/start","frame":{"id":11,"result":{"turn":{"id":"01a0dfb9-ff9f-7902-a370-d05cc4ec5959","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"emit_inbound","label":"turn/start","frame":{"id":12,"result":{"turn":{"id":"01a0dfb9-ff9f-7902-a370-d05cc4ec5959","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","status":{"type":"active","activeFlags":[]}},"emittedAtMs":1790459903925}} {"type":"emit_inbound","label":"turn/started","frame":{"method":"turn/started","params":{"threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","turn":{"id":"01a0dfb9-ff9f-7902-a370-d05cc4ec5959","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":1790459903,"completedAt":null,"durationMs":null}},"emittedAtMs":1790459903925}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","name":"codex_apps","status":"failed","error":"MCP client for `codex_apps` failed to start: MCP startup failed: handshaking with MCP server failed: Send message error Transport [codex_rmcp_client::event_notification_transport::EventNotificationTransport>>] error: unexpected server response: HTTP 401: {\n \"error\": {\n \"message\": \"Encountered invalidated oauth token for user, failing request\",\n \"type\": null,\n \"code\": \"token_revoked\",\n \"param\": null\n },\n \"status\": 401\n}, when send initialize request: Send message error Transport [codex_rmcp_client::event_notification_transport::EventNotificationTransport>>] error: unexpected server response: HTTP 401: {\n \"error\": {\n \"message\": \"Encountered invalidated oauth token for user, failing request\",\n \"type\": null,\n \"code\": \"token_revoked\",\n \"param\": null\n },\n \"status\": 401\n}, when send initialize request","failureReason":null},"emittedAtMs":1790459904186}} @@ -89,20 +91,20 @@ {"type":"emit_inbound","label":"thread/tokenUsage/updated","frame":{"method":"thread/tokenUsage/updated","params":{"threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","turnId":"01a0dfb9-ff9f-7902-a370-d05cc4ec5959","tokenUsage":{"total":{"totalTokens":46272,"inputTokens":46153,"cachedInputTokens":30208,"cacheWriteInputTokens":0,"outputTokens":119,"reasoningOutputTokens":15},"last":{"totalTokens":15536,"inputTokens":15527,"cachedInputTokens":15104,"cacheWriteInputTokens":0,"outputTokens":9,"reasoningOutputTokens":0},"modelContextWindow":258400}},"emittedAtMs":1790459906339}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","status":{"type":"idle"}},"emittedAtMs":1790459906344}} {"type":"emit_inbound","label":"turn/completed","frame":{"method":"turn/completed","params":{"threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","turn":{"id":"01a0dfb9-ff9f-7902-a370-d05cc4ec5959","items":[{"type":"agentMessage","id":"msg_0508263b0487774d016ab840020e1087d08e559660413ebcd6","text":"rollback fixture second turn complete","phase":"final_answer","memoryCitation":null,"delivery":null,"questions":null}],"itemsView":"summary","status":"completed","error":null,"startedAt":1790459903,"completedAt":1790459906,"durationMs":2423}},"emittedAtMs":1790459906344}} -{"type":"expect_outbound","label":"thread/read","frame":{"id":12,"method":"thread/read","params":{"includeTurns":false,"threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88"}}} -{"type":"emit_inbound","label":"thread/read","frame":{"id":12,"result":{"thread":{"id":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code","runtimeWorkspaceRoots":["/home/replay-user/t3code"]}],"extra":null,"sessionId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","forkedFromId":null,"parentThreadId":null,"preview":"Respond with exactly: rollback fixture first turn complete","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790459892,"updatedAt":1790459906,"recencyAt":1790459903,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/26/rollout-2026-09-26T14-58-12-01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88.jsonl","cwd":"/home/replay-user/t3code","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":{"sha":"147b1509eac4291b323371299d0925a44035680c","branch":"master","originUrl":null},"name":null,"daybreakEnabled":null,"turns":[]}}}} -{"type":"expect_outbound","label":"thread/turns/list","frame":{"id":13,"method":"thread/turns/list","params":{"cursor":null,"itemsView":"summary","limit":1,"sortDirection":"desc","threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88"}}} -{"type":"emit_inbound","label":"thread/turns/list","frame":{"id":13,"result":{"data":[{"id":"01a0dfb9-ff9f-7902-a370-d05cc4ec5959","items":[{"type":"userMessage","id":"01a0dfba-0390-7aa0-a945-e25ca01302e2","clientId":null,"content":[{"type":"text","text":"Respond with exactly: rollback fixture second turn complete","text_elements":[]}]},{"type":"agentMessage","id":"msg_0508263b0487774d016ab840020e1087d08e559660413ebcd6","text":"rollback fixture second turn complete","phase":"final_answer","memoryCitation":null,"delivery":null,"questions":null}],"itemsView":"summary","status":"completed","error":null,"startedAt":1790459903,"completedAt":1790459906,"durationMs":2423}],"nextCursor":"{\"requestedThreadId\":\"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88\",\"rolloutOrdinal\":32,\"includeAnchor\":false,\"scope\":{\"kind\":\"turns\"}}","backwardsCursor":"{\"requestedThreadId\":\"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88\",\"rolloutOrdinal\":32,\"includeAnchor\":true,\"scope\":{\"kind\":\"turns\"}}"}}} -{"type":"expect_outbound","label":"thread/revert","frame":{"id":14,"method":"thread/revert","params":{"beforeTurnId":"01a0dfb9-ff9f-7902-a370-d05cc4ec5959","threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88"}}} +{"type":"expect_outbound","label":"thread/read","frame":{"id":13,"method":"thread/read","params":{"includeTurns":false,"threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88"}}} +{"type":"emit_inbound","label":"thread/read","frame":{"id":13,"result":{"thread":{"id":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code","runtimeWorkspaceRoots":["/home/replay-user/t3code"]}],"extra":null,"sessionId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","forkedFromId":null,"parentThreadId":null,"preview":"Respond with exactly: rollback fixture first turn complete","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790459892,"updatedAt":1790459906,"recencyAt":1790459903,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/26/rollout-2026-09-26T14-58-12-01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88.jsonl","cwd":"/home/replay-user/t3code","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":{"sha":"147b1509eac4291b323371299d0925a44035680c","branch":"master","originUrl":null},"name":null,"daybreakEnabled":null,"turns":[]}}}} +{"type":"expect_outbound","label":"thread/turns/list","frame":{"id":14,"method":"thread/turns/list","params":{"cursor":null,"itemsView":"summary","limit":1,"sortDirection":"desc","threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88"}}} +{"type":"emit_inbound","label":"thread/turns/list","frame":{"id":14,"result":{"data":[{"id":"01a0dfb9-ff9f-7902-a370-d05cc4ec5959","items":[{"type":"userMessage","id":"01a0dfba-0390-7aa0-a945-e25ca01302e2","clientId":null,"content":[{"type":"text","text":"Respond with exactly: rollback fixture second turn complete","text_elements":[]}]},{"type":"agentMessage","id":"msg_0508263b0487774d016ab840020e1087d08e559660413ebcd6","text":"rollback fixture second turn complete","phase":"final_answer","memoryCitation":null,"delivery":null,"questions":null}],"itemsView":"summary","status":"completed","error":null,"startedAt":1790459903,"completedAt":1790459906,"durationMs":2423}],"nextCursor":"{\"requestedThreadId\":\"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88\",\"rolloutOrdinal\":32,\"includeAnchor\":false,\"scope\":{\"kind\":\"turns\"}}","backwardsCursor":"{\"requestedThreadId\":\"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88\",\"rolloutOrdinal\":32,\"includeAnchor\":true,\"scope\":{\"kind\":\"turns\"}}"}}} +{"type":"expect_outbound","label":"thread/revert","frame":{"id":15,"method":"thread/revert","params":{"beforeTurnId":"01a0dfb9-ff9f-7902-a370-d05cc4ec5959","threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88"}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","status":{"type":"notLoaded"}},"emittedAtMs":1790459906373}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","name":"codex_apps","status":"starting","error":null,"failureReason":null},"emittedAtMs":1790459906471}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","status":{"type":"idle"}},"emittedAtMs":1790459906478}} -{"type":"emit_inbound","label":"thread/revert","frame":{"id":14,"result":{"thread":{"id":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code","runtimeWorkspaceRoots":["/home/replay-user/t3code"]}],"extra":null,"sessionId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","forkedFromId":null,"parentThreadId":null,"preview":"Respond with exactly: rollback fixture first turn complete","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790459906,"updatedAt":1790459906,"recencyAt":1790459903,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/26/rollout-2026-09-26T14-58-26-01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88_01a0dfba-094c-77d1-8e0b-8bf690a73635.jsonl","cwd":"/home/replay-user/t3code","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":{"sha":"147b1509eac4291b323371299d0925a44035680c","branch":"master","originUrl":null},"name":null,"daybreakEnabled":null,"turns":[]},"turnsBackwardsCursor":"{\"requestedThreadId\":\"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88\",\"rolloutOrdinal\":16,\"includeAnchor\":true,\"scope\":{\"kind\":\"turns\"}}","itemsBackwardsCursor":"{\"requestedThreadId\":\"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88\",\"rolloutOrdinal\":30,\"includeAnchor\":true,\"scope\":{\"kind\":\"itemsByCreatedAtOrdinal\"}}"}}} -{"type":"expect_outbound","label":"config/read","frame":{"id":15,"method":"config/read","params":{"cwd":"","includeLayers":false}}} -{"type":"emit_inbound","label":"config/read","frame":{"id":15,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"turn/start","frame":{"id":16,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Repeat the conversation verbatim.","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"networkAccess":false,"type":"workspaceWrite","writableRoots":[]},"summary":"auto","threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} +{"type":"emit_inbound","label":"thread/revert","frame":{"id":15,"result":{"thread":{"id":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code","runtimeWorkspaceRoots":["/home/replay-user/t3code"]}],"extra":null,"sessionId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","forkedFromId":null,"parentThreadId":null,"preview":"Respond with exactly: rollback fixture first turn complete","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790459906,"updatedAt":1790459906,"recencyAt":1790459903,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/26/rollout-2026-09-26T14-58-26-01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88_01a0dfba-094c-77d1-8e0b-8bf690a73635.jsonl","cwd":"/home/replay-user/t3code","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":{"sha":"147b1509eac4291b323371299d0925a44035680c","branch":"master","originUrl":null},"name":null,"daybreakEnabled":null,"turns":[]},"turnsBackwardsCursor":"{\"requestedThreadId\":\"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88\",\"rolloutOrdinal\":16,\"includeAnchor\":true,\"scope\":{\"kind\":\"turns\"}}","itemsBackwardsCursor":"{\"requestedThreadId\":\"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88\",\"rolloutOrdinal\":30,\"includeAnchor\":true,\"scope\":{\"kind\":\"itemsByCreatedAtOrdinal\"}}"}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":16,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":16,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"turn/start","frame":{"id":17,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Repeat the conversation verbatim.","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"networkAccess":false,"type":"workspaceWrite","writableRoots":[]},"summary":"auto","threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} {"type":"emit_inbound","label":"thread/reverted","frame":{"method":"thread/reverted","params":{"threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88"},"emittedAtMs":1790459906490}} -{"type":"emit_inbound","label":"turn/start","frame":{"id":16,"result":{"turn":{"id":"01a0dfba-09be-7112-8c42-4a6a8d1fe1d6","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"emit_inbound","label":"turn/start","frame":{"id":17,"result":{"turn":{"id":"01a0dfba-09be-7112-8c42-4a6a8d1fe1d6","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","status":{"type":"active","activeFlags":[]}},"emittedAtMs":1790459906518}} {"type":"emit_inbound","label":"turn/started","frame":{"method":"turn/started","params":{"threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","turn":{"id":"01a0dfba-09be-7112-8c42-4a6a8d1fe1d6","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":1790459906,"completedAt":null,"durationMs":null}},"emittedAtMs":1790459906518}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0dfb9-d3d6-7c72-a2a4-2f0ba5eedd88","name":"codex_apps","status":"failed","error":"MCP client for `codex_apps` failed to start: MCP startup failed: handshaking with MCP server failed: Send message error Transport [codex_rmcp_client::event_notification_transport::EventNotificationTransport>>] error: unexpected server response: HTTP 401: {\n \"error\": {\n \"message\": \"Encountered invalidated oauth token for user, failing request\",\n \"type\": null,\n \"code\": \"token_revoked\",\n \"param\": null\n },\n \"status\": 401\n}, when send initialize request: Send message error Transport [codex_rmcp_client::event_notification_transport::EventNotificationTransport>>] error: unexpected server response: HTTP 401: {\n \"error\": {\n \"message\": \"Encountered invalidated oauth token for user, failing request\",\n \"type\": null,\n \"code\": \"token_revoked\",\n \"param\": null\n },\n \"status\": 401\n}, when send initialize request","failureReason":null},"emittedAtMs":1790459906779}} diff --git a/apps/server/src/orchestration-v2/testkit/fixtures/todo_list/codex_transcript.ndjson b/apps/server/src/orchestration-v2/testkit/fixtures/todo_list/codex_transcript.ndjson index a7efceb7e8ecd..0582c6a465c31 100644 --- a/apps/server/src/orchestration-v2/testkit/fixtures/todo_list/codex_transcript.ndjson +++ b/apps/server/src/orchestration-v2/testkit/fixtures/todo_list/codex_transcript.ndjson @@ -2,22 +2,24 @@ {"type":"expect_outbound","label":"initialize","frame":{"id":1,"method":"initialize","params":{"capabilities":{"experimentalApi":true,"optOutNotificationMethods":["turn/diff/updated"],"extensions":{"io.modelcontextprotocol/ui":{"mimeTypes":["text/html;profile=mcp-app"]}}},"clientInfo":{"name":"T3 Code","title":"T3 Code","version":"0.0.44"}}}} {"type":"emit_inbound","label":"initialize","frame":{"id":1,"result":{"userAgent":"t3code_desktop/0.156.1 (Debian 13.0.0; x86_64) unknown (t3code_desktop; 0.1.0)","codexHome":"/home/replay-user/.codex","platformFamily":"unix","platformOs":"linux"}}} {"type":"expect_outbound","label":"initialized","frame":{"method":"initialized"}} -{"type":"expect_outbound","label":"thread/start","frame":{"id":2,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","model":"gpt-6-luna"}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":2,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":2,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"thread/start","frame":{"id":3,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","model":"gpt-6-luna"}}} {"type":"emit_inbound","label":"configWarning","frame":{"method":"configWarning","params":{"summary":"Codex could not find bubblewrap on PATH. Install bubblewrap with your OS package manager. See the sandbox prerequisites: https://developers.openai.com/codex/concepts/sandboxing#prerequisites. Codex will use the bundled bubblewrap in the meantime.","details":null},"emittedAtMs":1790306244669}} {"type":"emit_inbound","label":"remoteControl/status/changed","frame":{"method":"remoteControl/status/changed","params":{"status":"disabled","serverName":"replay-host","installationId":"00000000-0000-4000-8000-000000000000","environmentId":null},"emittedAtMs":1790306244669}} {"type":"emit_inbound","label":"account/updated","frame":{"method":"account/updated","params":{"authMode":"chatgpt","planType":"unknown"},"emittedAtMs":1790306245652}} -{"type":"emit_inbound","label":"thread/start","frame":{"id":2,"result":{"thread":{"id":"01a0d691-5ba5-77b1-bf0d-1bf7be8e9abe","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d691-5ba5-77b1-bf0d-1bf7be8e9abe","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790306245,"updatedAt":1790306245,"recencyAt":1790306245,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T20-17-25-01a0d691-5ba5-77b1-bf0d-1bf7be8e9abe.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"],"instructionSources":["/home/replay-user/.codex/AGENTS.md","/home/replay-user/t3code/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} -{"type":"expect_outbound","label":"thread/name/set","frame":{"id":3,"method":"thread/name/set","params":{"name":"Replay fixture: todo_list","threadId":"01a0d691-5ba5-77b1-bf0d-1bf7be8e9abe"}}} -{"type":"emit_inbound","label":"thread/name/set","frame":{"id":3,"result":{}}} +{"type":"emit_inbound","label":"thread/start","frame":{"id":3,"result":{"thread":{"id":"01a0d691-5ba5-77b1-bf0d-1bf7be8e9abe","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d691-5ba5-77b1-bf0d-1bf7be8e9abe","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790306245,"updatedAt":1790306245,"recencyAt":1790306245,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T20-17-25-01a0d691-5ba5-77b1-bf0d-1bf7be8e9abe.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"],"instructionSources":["/home/replay-user/.codex/AGENTS.md","/home/replay-user/t3code/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} +{"type":"expect_outbound","label":"thread/name/set","frame":{"id":4,"method":"thread/name/set","params":{"name":"Replay fixture: todo_list","threadId":"01a0d691-5ba5-77b1-bf0d-1bf7be8e9abe"}}} +{"type":"emit_inbound","label":"thread/name/set","frame":{"id":4,"result":{}}} {"type":"emit_inbound","label":"thread/name/updated","frame":{"method":"thread/name/updated","params":{"threadId":"01a0d691-5ba5-77b1-bf0d-1bf7be8e9abe","threadName":"Replay fixture: todo_list"}}} -{"type":"expect_outbound","label":"config/read","frame":{"id":4,"method":"config/read","params":{"cwd":"","includeLayers":false}}} -{"type":"emit_inbound","label":"config/read","frame":{"id":4,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"turn/start","frame":{"id":5,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Use the update_plan tool to track exactly three steps: inspect package.json, inspect tsconfig.json, report completion. Then read package.json and tsconfig.json, and answer exactly: todo list fixture complete","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"networkAccess":false,"type":"readOnly"},"summary":"auto","threadId":"01a0d691-5ba5-77b1-bf0d-1bf7be8e9abe","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":5,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":5,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"turn/start","frame":{"id":6,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Use the update_plan tool to track exactly three steps: inspect package.json, inspect tsconfig.json, report completion. Then read package.json and tsconfig.json, and answer exactly: todo list fixture complete","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"networkAccess":false,"type":"readOnly"},"summary":"auto","threadId":"01a0d691-5ba5-77b1-bf0d-1bf7be8e9abe","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} {"type":"emit_inbound","label":"thread/started","frame":{"method":"thread/started","params":{"thread":{"id":"01a0d691-5ba5-77b1-bf0d-1bf7be8e9abe","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d691-5ba5-77b1-bf0d-1bf7be8e9abe","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790306245,"updatedAt":1790306245,"recencyAt":1790306245,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T20-17-25-01a0d691-5ba5-77b1-bf0d-1bf7be8e9abe.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]}},"emittedAtMs":1790306245772}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0d691-5ba5-77b1-bf0d-1bf7be8e9abe","name":"codex_apps","status":"starting","error":null,"failureReason":null},"emittedAtMs":1790306245772}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0d691-5ba5-77b1-bf0d-1bf7be8e9abe","name":"xcodebuildmcp","status":"starting","error":null,"failureReason":null},"emittedAtMs":1790306245772}} {"type":"emit_inbound","label":"thread/settings/updated","frame":{"method":"thread/settings/updated","params":{"threadId":"01a0d691-5ba5-77b1-bf0d-1bf7be8e9abe","threadSettings":{"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","approvalPolicy":"never","approvalsReviewer":"user","sandboxPolicy":{"type":"readOnly","networkAccess":false},"activePermissionProfile":null,"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"effort":null,"summary":"detailed","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna","reasoning_effort":null,"developer_instructions":null}},"multiAgentMode":"explicitRequestOnly","personality":null}},"emittedAtMs":1790306245794}} -{"type":"emit_inbound","label":"turn/start","frame":{"id":5,"result":{"turn":{"id":"01a0d691-5c9c-7873-a191-5a599fd58099","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"emit_inbound","label":"turn/start","frame":{"id":6,"result":{"turn":{"id":"01a0d691-5c9c-7873-a191-5a599fd58099","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0d691-5ba5-77b1-bf0d-1bf7be8e9abe","status":{"type":"active","activeFlags":[]}},"emittedAtMs":1790306245845}} {"type":"emit_inbound","label":"turn/started","frame":{"method":"turn/started","params":{"threadId":"01a0d691-5ba5-77b1-bf0d-1bf7be8e9abe","turn":{"id":"01a0d691-5c9c-7873-a191-5a599fd58099","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":1790306245,"completedAt":null,"durationMs":null}},"emittedAtMs":1790306245845}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0d691-5ba5-77b1-bf0d-1bf7be8e9abe","name":"codex_apps","status":"ready","error":null,"failureReason":null},"emittedAtMs":1790306246472}} diff --git a/apps/server/src/orchestration-v2/testkit/fixtures/tool_call_read_only_on_request/codex_transcript.ndjson b/apps/server/src/orchestration-v2/testkit/fixtures/tool_call_read_only_on_request/codex_transcript.ndjson index 2fc49ff87b092..60ed0f1c710a0 100644 --- a/apps/server/src/orchestration-v2/testkit/fixtures/tool_call_read_only_on_request/codex_transcript.ndjson +++ b/apps/server/src/orchestration-v2/testkit/fixtures/tool_call_read_only_on_request/codex_transcript.ndjson @@ -2,20 +2,22 @@ {"type":"expect_outbound","label":"initialize","frame":{"id":1,"method":"initialize","params":{"capabilities":{"experimentalApi":true,"optOutNotificationMethods":["turn/diff/updated"],"extensions":{"io.modelcontextprotocol/ui":{"mimeTypes":["text/html;profile=mcp-app"]}}},"clientInfo":{"name":"T3 Code","title":"T3 Code","version":"0.0.44"}}}} {"type":"emit_inbound","label":"initialize","frame":{"id":1,"result":{"userAgent":"t3code_desktop/0.156.1 (Debian 13.0.0; x86_64) unknown (t3code_desktop; 0.1.0)","codexHome":"/home/replay-user/.codex","platformFamily":"unix","platformOs":"linux"}}} {"type":"expect_outbound","label":"initialized","frame":{"method":"initialized"}} -{"type":"expect_outbound","label":"thread/start","frame":{"id":2,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","model":"gpt-6-sol"}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":2,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":2,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"thread/start","frame":{"id":3,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","model":"gpt-6-sol"}}} {"type":"emit_inbound","label":"configWarning","frame":{"method":"configWarning","params":{"summary":"Codex could not find bubblewrap on PATH. Install bubblewrap with your OS package manager. See the sandbox prerequisites: https://developers.openai.com/codex/concepts/sandboxing#prerequisites. Codex will use the bundled bubblewrap in the meantime.","details":null},"emittedAtMs":1790296989543}} {"type":"emit_inbound","label":"remoteControl/status/changed","frame":{"method":"remoteControl/status/changed","params":{"status":"disabled","serverName":"replay-host","installationId":"00000000-0000-4000-8000-000000000000","environmentId":null},"emittedAtMs":1790296989543}} -{"type":"emit_inbound","label":"thread/start","frame":{"id":2,"result":{"thread":{"id":"01a0d604-1f8d-7522-8fe1-371c6626896e","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d604-1f8d-7522-8fe1-371c6626896e","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-sol","reasoningEffort":null,"createdAt":1790296989,"updatedAt":1790296989,"recencyAt":1790296989,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-43-09-01a0d604-1f8d-7522-8fe1-371c6626896e.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-sol","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"],"instructionSources":["/home/replay-user/.codex/AGENTS.md","/home/replay-user/t3code/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} -{"type":"expect_outbound","label":"thread/name/set","frame":{"id":3,"method":"thread/name/set","params":{"name":"Replay fixture: tool_call_read_only_on_request","threadId":"01a0d604-1f8d-7522-8fe1-371c6626896e"}}} -{"type":"emit_inbound","label":"thread/name/set","frame":{"id":3,"result":{}}} +{"type":"emit_inbound","label":"thread/start","frame":{"id":3,"result":{"thread":{"id":"01a0d604-1f8d-7522-8fe1-371c6626896e","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d604-1f8d-7522-8fe1-371c6626896e","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-sol","reasoningEffort":null,"createdAt":1790296989,"updatedAt":1790296989,"recencyAt":1790296989,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-43-09-01a0d604-1f8d-7522-8fe1-371c6626896e.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-sol","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"],"instructionSources":["/home/replay-user/.codex/AGENTS.md","/home/replay-user/t3code/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} +{"type":"expect_outbound","label":"thread/name/set","frame":{"id":4,"method":"thread/name/set","params":{"name":"Replay fixture: tool_call_read_only_on_request","threadId":"01a0d604-1f8d-7522-8fe1-371c6626896e"}}} +{"type":"emit_inbound","label":"thread/name/set","frame":{"id":4,"result":{}}} {"type":"emit_inbound","label":"thread/name/updated","frame":{"method":"thread/name/updated","params":{"threadId":"01a0d604-1f8d-7522-8fe1-371c6626896e","threadName":"Replay fixture: tool_call_read_only_on_request"}}} -{"type":"expect_outbound","label":"config/read","frame":{"id":4,"method":"config/read","params":{"cwd":"","includeLayers":false}}} -{"type":"emit_inbound","label":"config/read","frame":{"id":4,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"turn/start","frame":{"id":5,"method":"turn/start","params":{"approvalPolicy":"on-request","approvalsReviewer":"user","cwd":"","input":[{"text":"Create or overwrite .codex-probe-write-action.txt with exactly this text: codex app-server approval fixture. Use a local shell command or file edit only, then briefly report what happened. Do not read package metadata, use GitHub, use web, or use MCP.","type":"text"}],"model":"gpt-6-sol","sandboxPolicy":{"networkAccess":false,"type":"readOnly"},"summary":"auto","threadId":"01a0d604-1f8d-7522-8fe1-371c6626896e","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-sol"}}}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":5,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":5,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"turn/start","frame":{"id":6,"method":"turn/start","params":{"approvalPolicy":"on-request","approvalsReviewer":"user","cwd":"","input":[{"text":"Create or overwrite .codex-probe-write-action.txt with exactly this text: codex app-server approval fixture. Use a local shell command or file edit only, then briefly report what happened. Do not read package metadata, use GitHub, use web, or use MCP.","type":"text"}],"model":"gpt-6-sol","sandboxPolicy":{"networkAccess":false,"type":"readOnly"},"summary":"auto","threadId":"01a0d604-1f8d-7522-8fe1-371c6626896e","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-sol"}}}}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0d604-1f8d-7522-8fe1-371c6626896e","name":"codex_apps","status":"starting","error":null,"failureReason":null},"emittedAtMs":1790296989839}} {"type":"emit_inbound","label":"thread/started","frame":{"method":"thread/started","params":{"thread":{"id":"01a0d604-1f8d-7522-8fe1-371c6626896e","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d604-1f8d-7522-8fe1-371c6626896e","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-sol","reasoningEffort":null,"createdAt":1790296989,"updatedAt":1790296989,"recencyAt":1790296989,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-43-09-01a0d604-1f8d-7522-8fe1-371c6626896e.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]}},"emittedAtMs":1790296989839}} {"type":"emit_inbound","label":"thread/settings/updated","frame":{"method":"thread/settings/updated","params":{"threadId":"01a0d604-1f8d-7522-8fe1-371c6626896e","threadSettings":{"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","approvalPolicy":"on-request","approvalsReviewer":"user","sandboxPolicy":{"type":"readOnly","networkAccess":false},"activePermissionProfile":null,"model":"gpt-6-sol","modelProvider":"openai","serviceTier":null,"effort":null,"summary":"detailed","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-sol","reasoning_effort":null,"developer_instructions":null}},"multiAgentMode":"explicitRequestOnly","personality":null}},"emittedAtMs":1790296989848}} -{"type":"emit_inbound","label":"turn/start","frame":{"id":5,"result":{"turn":{"id":"01a0d604-2095-7fb0-a7e6-3f63d1949bbe","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"emit_inbound","label":"turn/start","frame":{"id":6,"result":{"turn":{"id":"01a0d604-2095-7fb0-a7e6-3f63d1949bbe","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0d604-1f8d-7522-8fe1-371c6626896e","status":{"type":"active","activeFlags":[]}},"emittedAtMs":1790296989915}} {"type":"emit_inbound","label":"turn/started","frame":{"method":"turn/started","params":{"threadId":"01a0d604-1f8d-7522-8fe1-371c6626896e","turn":{"id":"01a0d604-2095-7fb0-a7e6-3f63d1949bbe","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":1790296989,"completedAt":null,"durationMs":null}},"emittedAtMs":1790296989915}} {"type":"emit_inbound","label":"account/updated","frame":{"method":"account/updated","params":{"authMode":"chatgpt","planType":"unknown"},"emittedAtMs":1790296990273}} diff --git a/apps/server/src/orchestration-v2/testkit/fixtures/tool_call_restricted_granular/codex_transcript.ndjson b/apps/server/src/orchestration-v2/testkit/fixtures/tool_call_restricted_granular/codex_transcript.ndjson index a15f5dd2b1d6e..bc6baa5a3c232 100644 --- a/apps/server/src/orchestration-v2/testkit/fixtures/tool_call_restricted_granular/codex_transcript.ndjson +++ b/apps/server/src/orchestration-v2/testkit/fixtures/tool_call_restricted_granular/codex_transcript.ndjson @@ -2,20 +2,22 @@ {"type":"expect_outbound","label":"initialize","frame":{"id":1,"method":"initialize","params":{"capabilities":{"experimentalApi":true,"optOutNotificationMethods":["turn/diff/updated"],"extensions":{"io.modelcontextprotocol/ui":{"mimeTypes":["text/html;profile=mcp-app"]}}},"clientInfo":{"name":"T3 Code","title":"T3 Code","version":"0.0.44"}}}} {"type":"emit_inbound","label":"initialize","frame":{"id":1,"result":{"userAgent":"t3code_desktop/0.156.1 (Debian 13.0.0; x86_64) unknown (t3code_desktop; 0.1.0)","codexHome":"/home/replay-user/.codex","platformFamily":"unix","platformOs":"linux"}}} {"type":"expect_outbound","label":"initialized","frame":{"method":"initialized"}} -{"type":"expect_outbound","label":"thread/start","frame":{"id":2,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","model":"gpt-5.6-terra"}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":2,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":2,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"thread/start","frame":{"id":3,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","model":"gpt-5.6-terra"}}} {"type":"emit_inbound","label":"configWarning","frame":{"method":"configWarning","params":{"summary":"Codex could not find bubblewrap on PATH. Install bubblewrap with your OS package manager. See the sandbox prerequisites: https://developers.openai.com/codex/concepts/sandboxing#prerequisites. Codex will use the bundled bubblewrap in the meantime.","details":null},"emittedAtMs":1790297006729}} {"type":"emit_inbound","label":"remoteControl/status/changed","frame":{"method":"remoteControl/status/changed","params":{"status":"disabled","serverName":"replay-host","installationId":"00000000-0000-4000-8000-000000000000","environmentId":null},"emittedAtMs":1790297006729}} -{"type":"emit_inbound","label":"thread/start","frame":{"id":2,"result":{"thread":{"id":"01a0d604-629d-7162-b667-18c96f6fdf56","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d604-629d-7162-b667-18c96f6fdf56","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-5.6-terra","reasoningEffort":null,"createdAt":1790297006,"updatedAt":1790297006,"recencyAt":1790297006,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-43-26-01a0d604-629d-7162-b667-18c96f6fdf56.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-5.6-terra","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"],"instructionSources":["/home/replay-user/.codex/AGENTS.md","/home/replay-user/t3code/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} -{"type":"expect_outbound","label":"thread/name/set","frame":{"id":3,"method":"thread/name/set","params":{"name":"Replay fixture: tool_call_restricted_granular","threadId":"01a0d604-629d-7162-b667-18c96f6fdf56"}}} -{"type":"emit_inbound","label":"thread/name/set","frame":{"id":3,"result":{}}} +{"type":"emit_inbound","label":"thread/start","frame":{"id":3,"result":{"thread":{"id":"01a0d604-629d-7162-b667-18c96f6fdf56","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d604-629d-7162-b667-18c96f6fdf56","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-5.6-terra","reasoningEffort":null,"createdAt":1790297006,"updatedAt":1790297006,"recencyAt":1790297006,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-43-26-01a0d604-629d-7162-b667-18c96f6fdf56.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-5.6-terra","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"],"instructionSources":["/home/replay-user/.codex/AGENTS.md","/home/replay-user/t3code/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} +{"type":"expect_outbound","label":"thread/name/set","frame":{"id":4,"method":"thread/name/set","params":{"name":"Replay fixture: tool_call_restricted_granular","threadId":"01a0d604-629d-7162-b667-18c96f6fdf56"}}} +{"type":"emit_inbound","label":"thread/name/set","frame":{"id":4,"result":{}}} {"type":"emit_inbound","label":"thread/name/updated","frame":{"method":"thread/name/updated","params":{"threadId":"01a0d604-629d-7162-b667-18c96f6fdf56","threadName":"Replay fixture: tool_call_restricted_granular"}}} -{"type":"expect_outbound","label":"config/read","frame":{"id":4,"method":"config/read","params":{"cwd":"","includeLayers":false}}} -{"type":"emit_inbound","label":"config/read","frame":{"id":4,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"turn/start","frame":{"id":5,"method":"turn/start","params":{"approvalPolicy":{"granular":{"mcp_elicitations":true,"request_permissions":true,"rules":true,"sandbox_approval":true,"skill_approval":true}},"approvalsReviewer":"user","cwd":"","input":[{"text":"Create or overwrite .codex-probe-write-action.txt with exactly this text: codex app-server approval fixture. Use a local shell command or file edit only, then briefly report what happened. Do not read package metadata, use GitHub, use web, or use MCP.","type":"text"}],"model":"gpt-5.6-terra","sandboxPolicy":{"networkAccess":false,"type":"readOnly"},"summary":"auto","threadId":"01a0d604-629d-7162-b667-18c96f6fdf56","collaborationMode":{"mode":"default","settings":{"model":"gpt-5.6-terra"}}}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":5,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":5,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"turn/start","frame":{"id":6,"method":"turn/start","params":{"approvalPolicy":{"granular":{"mcp_elicitations":true,"request_permissions":true,"rules":true,"sandbox_approval":true,"skill_approval":true}},"approvalsReviewer":"user","cwd":"","input":[{"text":"Create or overwrite .codex-probe-write-action.txt with exactly this text: codex app-server approval fixture. Use a local shell command or file edit only, then briefly report what happened. Do not read package metadata, use GitHub, use web, or use MCP.","type":"text"}],"model":"gpt-5.6-terra","sandboxPolicy":{"networkAccess":false,"type":"readOnly"},"summary":"auto","threadId":"01a0d604-629d-7162-b667-18c96f6fdf56","collaborationMode":{"mode":"default","settings":{"model":"gpt-5.6-terra"}}}}} {"type":"emit_inbound","label":"thread/started","frame":{"method":"thread/started","params":{"thread":{"id":"01a0d604-629d-7162-b667-18c96f6fdf56","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d604-629d-7162-b667-18c96f6fdf56","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-5.6-terra","reasoningEffort":null,"createdAt":1790297006,"updatedAt":1790297006,"recencyAt":1790297006,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-43-26-01a0d604-629d-7162-b667-18c96f6fdf56.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]}},"emittedAtMs":1790297006923}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0d604-629d-7162-b667-18c96f6fdf56","name":"codex_apps","status":"starting","error":null,"failureReason":null},"emittedAtMs":1790297006923}} {"type":"emit_inbound","label":"thread/settings/updated","frame":{"method":"thread/settings/updated","params":{"threadId":"01a0d604-629d-7162-b667-18c96f6fdf56","threadSettings":{"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","approvalPolicy":{"granular":{"sandbox_approval":true,"rules":true,"skill_approval":true,"request_permissions":true,"mcp_elicitations":true}},"approvalsReviewer":"user","sandboxPolicy":{"type":"readOnly","networkAccess":false},"activePermissionProfile":null,"model":"gpt-5.6-terra","modelProvider":"openai","serviceTier":null,"effort":null,"summary":"detailed","collaborationMode":{"mode":"default","settings":{"model":"gpt-5.6-terra","reasoning_effort":null,"developer_instructions":null}},"multiAgentMode":"explicitRequestOnly","personality":null}},"emittedAtMs":1790297006943}} -{"type":"emit_inbound","label":"turn/start","frame":{"id":5,"result":{"turn":{"id":"01a0d604-6358-72f1-bb89-7361cce0045c","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"emit_inbound","label":"turn/start","frame":{"id":6,"result":{"turn":{"id":"01a0d604-6358-72f1-bb89-7361cce0045c","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0d604-629d-7162-b667-18c96f6fdf56","status":{"type":"active","activeFlags":[]}},"emittedAtMs":1790297007009}} {"type":"emit_inbound","label":"turn/started","frame":{"method":"turn/started","params":{"threadId":"01a0d604-629d-7162-b667-18c96f6fdf56","turn":{"id":"01a0d604-6358-72f1-bb89-7361cce0045c","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":1790297006,"completedAt":null,"durationMs":null}},"emittedAtMs":1790297007009}} {"type":"emit_inbound","label":"account/updated","frame":{"method":"account/updated","params":{"authMode":"chatgpt","planType":"unknown"},"emittedAtMs":1790297007345}} diff --git a/apps/server/src/orchestration-v2/testkit/fixtures/tool_call_workspace_never/codex_transcript.ndjson b/apps/server/src/orchestration-v2/testkit/fixtures/tool_call_workspace_never/codex_transcript.ndjson index e7fc6334e7fd2..318a98ecc54df 100644 --- a/apps/server/src/orchestration-v2/testkit/fixtures/tool_call_workspace_never/codex_transcript.ndjson +++ b/apps/server/src/orchestration-v2/testkit/fixtures/tool_call_workspace_never/codex_transcript.ndjson @@ -2,20 +2,22 @@ {"type":"expect_outbound","label":"initialize","frame":{"id":1,"method":"initialize","params":{"capabilities":{"experimentalApi":true,"optOutNotificationMethods":["turn/diff/updated"],"extensions":{"io.modelcontextprotocol/ui":{"mimeTypes":["text/html;profile=mcp-app"]}}},"clientInfo":{"name":"T3 Code","title":"T3 Code","version":"0.0.44"}}}} {"type":"emit_inbound","label":"initialize","frame":{"id":1,"result":{"userAgent":"t3code_desktop/0.156.1 (Debian 13.0.0; x86_64) unknown (t3code_desktop; 0.1.0)","codexHome":"/home/replay-user/.codex","platformFamily":"unix","platformOs":"linux"}}} {"type":"expect_outbound","label":"initialized","frame":{"method":"initialized"}} -{"type":"expect_outbound","label":"thread/start","frame":{"id":2,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","model":"gpt-6-luna"}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":2,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":2,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"thread/start","frame":{"id":3,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","model":"gpt-6-luna"}}} {"type":"emit_inbound","label":"configWarning","frame":{"method":"configWarning","params":{"summary":"Codex could not find bubblewrap on PATH. Install bubblewrap with your OS package manager. See the sandbox prerequisites: https://developers.openai.com/codex/concepts/sandboxing#prerequisites. Codex will use the bundled bubblewrap in the meantime.","details":null},"emittedAtMs":1790295509345}} {"type":"emit_inbound","label":"remoteControl/status/changed","frame":{"method":"remoteControl/status/changed","params":{"status":"disabled","serverName":"replay-host","installationId":"00000000-0000-4000-8000-000000000000","environmentId":null},"emittedAtMs":1790295509345}} -{"type":"emit_inbound","label":"thread/start","frame":{"id":2,"result":{"thread":{"id":"01a0d5ed-896f-73b3-8c42-3ffa820eb343","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5ed-896f-73b3-8c42-3ffa820eb343","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790295509,"updatedAt":1790295509,"recencyAt":1790295509,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-18-29-01a0d5ed-896f-73b3-8c42-3ffa820eb343.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"],"instructionSources":["/home/replay-user/.codex/AGENTS.md","/home/replay-user/t3code/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} -{"type":"expect_outbound","label":"thread/name/set","frame":{"id":3,"method":"thread/name/set","params":{"name":"Replay fixture: tool_call_workspace_never","threadId":"01a0d5ed-896f-73b3-8c42-3ffa820eb343"}}} -{"type":"emit_inbound","label":"thread/name/set","frame":{"id":3,"result":{}}} +{"type":"emit_inbound","label":"thread/start","frame":{"id":3,"result":{"thread":{"id":"01a0d5ed-896f-73b3-8c42-3ffa820eb343","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5ed-896f-73b3-8c42-3ffa820eb343","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790295509,"updatedAt":1790295509,"recencyAt":1790295509,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-18-29-01a0d5ed-896f-73b3-8c42-3ffa820eb343.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"],"instructionSources":["/home/replay-user/.codex/AGENTS.md","/home/replay-user/t3code/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} +{"type":"expect_outbound","label":"thread/name/set","frame":{"id":4,"method":"thread/name/set","params":{"name":"Replay fixture: tool_call_workspace_never","threadId":"01a0d5ed-896f-73b3-8c42-3ffa820eb343"}}} +{"type":"emit_inbound","label":"thread/name/set","frame":{"id":4,"result":{}}} {"type":"emit_inbound","label":"thread/name/updated","frame":{"method":"thread/name/updated","params":{"threadId":"01a0d5ed-896f-73b3-8c42-3ffa820eb343","threadName":"Replay fixture: tool_call_workspace_never"}}} -{"type":"expect_outbound","label":"config/read","frame":{"id":4,"method":"config/read","params":{"cwd":"","includeLayers":false}}} -{"type":"emit_inbound","label":"config/read","frame":{"id":4,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"turn/start","frame":{"id":5,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Create or overwrite .codex-probe-write-action.txt with exactly this text: codex app-server approval fixture. Use a local shell command or file edit only, then briefly report what happened. Do not read package metadata, use GitHub, use web, or use MCP.","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"networkAccess":false,"type":"workspaceWrite","writableRoots":[]},"summary":"auto","threadId":"01a0d5ed-896f-73b3-8c42-3ffa820eb343","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":5,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":5,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"turn/start","frame":{"id":6,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Create or overwrite .codex-probe-write-action.txt with exactly this text: codex app-server approval fixture. Use a local shell command or file edit only, then briefly report what happened. Do not read package metadata, use GitHub, use web, or use MCP.","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"networkAccess":false,"type":"workspaceWrite","writableRoots":[]},"summary":"auto","threadId":"01a0d5ed-896f-73b3-8c42-3ffa820eb343","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} {"type":"emit_inbound","label":"thread/started","frame":{"method":"thread/started","params":{"thread":{"id":"01a0d5ed-896f-73b3-8c42-3ffa820eb343","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5ed-896f-73b3-8c42-3ffa820eb343","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790295509,"updatedAt":1790295509,"recencyAt":1790295509,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-18-29-01a0d5ed-896f-73b3-8c42-3ffa820eb343.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]}},"emittedAtMs":1790295509540}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0d5ed-896f-73b3-8c42-3ffa820eb343","name":"codex_apps","status":"starting","error":null,"failureReason":null},"emittedAtMs":1790295509540}} {"type":"emit_inbound","label":"thread/settings/updated","frame":{"method":"thread/settings/updated","params":{"threadId":"01a0d5ed-896f-73b3-8c42-3ffa820eb343","threadSettings":{"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","approvalPolicy":"never","approvalsReviewer":"user","sandboxPolicy":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":null,"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"effort":null,"summary":"detailed","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna","reasoning_effort":null,"developer_instructions":null}},"multiAgentMode":"explicitRequestOnly","personality":null}},"emittedAtMs":1790295509553}} -{"type":"emit_inbound","label":"turn/start","frame":{"id":5,"result":{"turn":{"id":"01a0d5ed-8a2a-7002-b65d-fe5885c9f4e0","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"emit_inbound","label":"turn/start","frame":{"id":6,"result":{"turn":{"id":"01a0d5ed-8a2a-7002-b65d-fe5885c9f4e0","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0d5ed-896f-73b3-8c42-3ffa820eb343","status":{"type":"active","activeFlags":[]}},"emittedAtMs":1790295509613}} {"type":"emit_inbound","label":"turn/started","frame":{"method":"turn/started","params":{"threadId":"01a0d5ed-896f-73b3-8c42-3ffa820eb343","turn":{"id":"01a0d5ed-8a2a-7002-b65d-fe5885c9f4e0","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":1790295509,"completedAt":null,"durationMs":null}},"emittedAtMs":1790295509613}} {"type":"emit_inbound","label":"account/updated","frame":{"method":"account/updated","params":{"authMode":"chatgpt","planType":"unknown"},"emittedAtMs":1790295510000}} diff --git a/apps/server/src/orchestration-v2/testkit/fixtures/turn_interrupt/codex_transcript.ndjson b/apps/server/src/orchestration-v2/testkit/fixtures/turn_interrupt/codex_transcript.ndjson index 8408743473657..cd2a4d2f38346 100644 --- a/apps/server/src/orchestration-v2/testkit/fixtures/turn_interrupt/codex_transcript.ndjson +++ b/apps/server/src/orchestration-v2/testkit/fixtures/turn_interrupt/codex_transcript.ndjson @@ -2,29 +2,31 @@ {"type":"expect_outbound","label":"initialize","frame":{"id":1,"method":"initialize","params":{"capabilities":{"experimentalApi":true,"optOutNotificationMethods":["turn/diff/updated"],"extensions":{"io.modelcontextprotocol/ui":{"mimeTypes":["text/html;profile=mcp-app"]}}},"clientInfo":{"name":"T3 Code","title":"T3 Code","version":"0.0.44"}}}} {"type":"emit_inbound","label":"initialize","frame":{"id":1,"result":{"userAgent":"t3code_desktop/0.156.1 (Debian 13.0.0; x86_64) unknown (t3code_desktop; 0.1.0)","codexHome":"/home/replay-user/.codex","platformFamily":"unix","platformOs":"linux"}}} {"type":"expect_outbound","label":"initialized","frame":{"method":"initialized"}} -{"type":"expect_outbound","label":"thread/start","frame":{"id":2,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","model":"gpt-6-luna"}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":2,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":2,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"thread/start","frame":{"id":3,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","model":"gpt-6-luna"}}} {"type":"emit_inbound","label":"configWarning","frame":{"method":"configWarning","params":{"summary":"Codex could not find bubblewrap on PATH. Install bubblewrap with your OS package manager. See the sandbox prerequisites: https://developers.openai.com/codex/concepts/sandboxing#prerequisites. Codex will use the bundled bubblewrap in the meantime.","details":null},"emittedAtMs":1790295488496}} {"type":"emit_inbound","label":"remoteControl/status/changed","frame":{"method":"remoteControl/status/changed","params":{"status":"disabled","serverName":"replay-host","installationId":"00000000-0000-4000-8000-000000000000","environmentId":null},"emittedAtMs":1790295488496}} -{"type":"emit_inbound","label":"thread/start","frame":{"id":2,"result":{"thread":{"id":"01a0d5ed-3804-72d0-9a3f-929885a11f32","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5ed-3804-72d0-9a3f-929885a11f32","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790295488,"updatedAt":1790295488,"recencyAt":1790295488,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-18-08-01a0d5ed-3804-72d0-9a3f-929885a11f32.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"],"instructionSources":["/home/replay-user/.codex/AGENTS.md","/home/replay-user/t3code/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} -{"type":"expect_outbound","label":"thread/name/set","frame":{"id":3,"method":"thread/name/set","params":{"name":"Replay fixture: turn_interrupt","threadId":"01a0d5ed-3804-72d0-9a3f-929885a11f32"}}} -{"type":"emit_inbound","label":"thread/name/set","frame":{"id":3,"result":{}}} +{"type":"emit_inbound","label":"thread/start","frame":{"id":3,"result":{"thread":{"id":"01a0d5ed-3804-72d0-9a3f-929885a11f32","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5ed-3804-72d0-9a3f-929885a11f32","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790295488,"updatedAt":1790295488,"recencyAt":1790295488,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-18-08-01a0d5ed-3804-72d0-9a3f-929885a11f32.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"],"instructionSources":["/home/replay-user/.codex/AGENTS.md","/home/replay-user/t3code/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} +{"type":"expect_outbound","label":"thread/name/set","frame":{"id":4,"method":"thread/name/set","params":{"name":"Replay fixture: turn_interrupt","threadId":"01a0d5ed-3804-72d0-9a3f-929885a11f32"}}} +{"type":"emit_inbound","label":"thread/name/set","frame":{"id":4,"result":{}}} {"type":"emit_inbound","label":"thread/name/updated","frame":{"method":"thread/name/updated","params":{"threadId":"01a0d5ed-3804-72d0-9a3f-929885a11f32","threadName":"Replay fixture: turn_interrupt"}}} -{"type":"expect_outbound","label":"config/read","frame":{"id":4,"method":"config/read","params":{"cwd":"","includeLayers":false}}} -{"type":"emit_inbound","label":"config/read","frame":{"id":4,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"turn/start","frame":{"id":5,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Do not answer immediately. First run the local shell command `sleep 30`, then respond with exactly: interrupt fixture should not finish naturally.","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"networkAccess":false,"type":"workspaceWrite","writableRoots":[]},"summary":"auto","threadId":"01a0d5ed-3804-72d0-9a3f-929885a11f32","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":5,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":5,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"turn/start","frame":{"id":6,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Do not answer immediately. First run the local shell command `sleep 30`, then respond with exactly: interrupt fixture should not finish naturally.","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"networkAccess":false,"type":"workspaceWrite","writableRoots":[]},"summary":"auto","threadId":"01a0d5ed-3804-72d0-9a3f-929885a11f32","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} {"type":"emit_inbound","label":"thread/started","frame":{"method":"thread/started","params":{"thread":{"id":"01a0d5ed-3804-72d0-9a3f-929885a11f32","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5ed-3804-72d0-9a3f-929885a11f32","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790295488,"updatedAt":1790295488,"recencyAt":1790295488,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-18-08-01a0d5ed-3804-72d0-9a3f-929885a11f32.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]}},"emittedAtMs":1790295488683}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0d5ed-3804-72d0-9a3f-929885a11f32","name":"codex_apps","status":"starting","error":null,"failureReason":null},"emittedAtMs":1790295488683}} {"type":"emit_inbound","label":"thread/settings/updated","frame":{"method":"thread/settings/updated","params":{"threadId":"01a0d5ed-3804-72d0-9a3f-929885a11f32","threadSettings":{"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","approvalPolicy":"never","approvalsReviewer":"user","sandboxPolicy":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":null,"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"effort":null,"summary":"detailed","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna","reasoning_effort":null,"developer_instructions":null}},"multiAgentMode":"explicitRequestOnly","personality":null}},"emittedAtMs":1790295488699}} -{"type":"emit_inbound","label":"turn/start","frame":{"id":5,"result":{"turn":{"id":"01a0d5ed-38b3-7a11-9203-bd9650a02764","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"emit_inbound","label":"turn/start","frame":{"id":6,"result":{"turn":{"id":"01a0d5ed-38b3-7a11-9203-bd9650a02764","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0d5ed-3804-72d0-9a3f-929885a11f32","status":{"type":"active","activeFlags":[]}},"emittedAtMs":1790295488747}} {"type":"emit_inbound","label":"turn/started","frame":{"method":"turn/started","params":{"threadId":"01a0d5ed-3804-72d0-9a3f-929885a11f32","turn":{"id":"01a0d5ed-38b3-7a11-9203-bd9650a02764","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":1790295488,"completedAt":null,"durationMs":null}},"emittedAtMs":1790295488747}} {"type":"emit_inbound","label":"account/updated","frame":{"method":"account/updated","params":{"authMode":"chatgpt","planType":"unknown"},"emittedAtMs":1790295489056}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0d5ed-3804-72d0-9a3f-929885a11f32","name":"xcodebuildmcp","status":"starting","error":null,"failureReason":null},"emittedAtMs":1790295489323}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0d5ed-3804-72d0-9a3f-929885a11f32","name":"codex_apps","status":"ready","error":null,"failureReason":null},"emittedAtMs":1790295489469}} -{"type":"expect_outbound","label":"turn/interrupt","frame":{"id":6,"method":"turn/interrupt","params":{"threadId":"01a0d5ed-3804-72d0-9a3f-929885a11f32","turnId":"01a0d5ed-38b3-7a11-9203-bd9650a02764"}}} +{"type":"expect_outbound","label":"turn/interrupt","frame":{"id":7,"method":"turn/interrupt","params":{"threadId":"01a0d5ed-3804-72d0-9a3f-929885a11f32","turnId":"01a0d5ed-38b3-7a11-9203-bd9650a02764"}}} {"type":"emit_inbound","label":"item/started","frame":{"method":"item/started","params":{"item":{"type":"userMessage","id":"01a0d5ed-3ea7-7aa3-a029-700c3b1aa2e8","clientId":null,"content":[{"type":"text","text":"Do not answer immediately. First run the local shell command `sleep 30`, then respond with exactly: interrupt fixture should not finish naturally.","text_elements":[]}]},"threadId":"01a0d5ed-3804-72d0-9a3f-929885a11f32","turnId":"01a0d5ed-38b3-7a11-9203-bd9650a02764","startedAtMs":1790295490219},"emittedAtMs":1790295490220}} {"type":"emit_inbound","label":"item/completed","frame":{"method":"item/completed","params":{"item":{"type":"userMessage","id":"01a0d5ed-3ea7-7aa3-a029-700c3b1aa2e8","clientId":null,"content":[{"type":"text","text":"Do not answer immediately. First run the local shell command `sleep 30`, then respond with exactly: interrupt fixture should not finish naturally.","text_elements":[]}]},"threadId":"01a0d5ed-3804-72d0-9a3f-929885a11f32","turnId":"01a0d5ed-38b3-7a11-9203-bd9650a02764","completedAtMs":1790295490219},"emittedAtMs":1790295490229}} -{"type":"emit_inbound","label":"turn/interrupt","frame":{"id":6,"result":{}}} +{"type":"emit_inbound","label":"turn/interrupt","frame":{"id":7,"result":{}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0d5ed-3804-72d0-9a3f-929885a11f32","status":{"type":"idle"}},"emittedAtMs":1790295490246}} {"type":"emit_inbound","label":"turn/completed","frame":{"method":"turn/completed","params":{"threadId":"01a0d5ed-3804-72d0-9a3f-929885a11f32","turn":{"id":"01a0d5ed-38b3-7a11-9203-bd9650a02764","items":[],"itemsView":"notLoaded","status":"interrupted","error":null,"startedAt":1790295488,"completedAt":1790295490,"durationMs":1544}},"emittedAtMs":1790295490246}} {"type":"runtime_exit","status":"success"} diff --git a/apps/server/src/orchestration-v2/testkit/fixtures/turn_interrupt_mid_tool/codex_transcript.ndjson b/apps/server/src/orchestration-v2/testkit/fixtures/turn_interrupt_mid_tool/codex_transcript.ndjson index c50bb4c3d650f..14a413c4c4c9d 100644 --- a/apps/server/src/orchestration-v2/testkit/fixtures/turn_interrupt_mid_tool/codex_transcript.ndjson +++ b/apps/server/src/orchestration-v2/testkit/fixtures/turn_interrupt_mid_tool/codex_transcript.ndjson @@ -2,20 +2,22 @@ {"type":"expect_outbound","label":"initialize","frame":{"id":1,"method":"initialize","params":{"capabilities":{"experimentalApi":true,"optOutNotificationMethods":["turn/diff/updated"],"extensions":{"io.modelcontextprotocol/ui":{"mimeTypes":["text/html;profile=mcp-app"]}}},"clientInfo":{"name":"T3 Code","title":"T3 Code","version":"0.0.44"}}}} {"type":"emit_inbound","label":"initialize","frame":{"id":1,"result":{"userAgent":"t3code_desktop/0.156.1 (Debian 13.0.0; x86_64) unknown (t3code_desktop; 0.1.0)","codexHome":"/home/replay-user/.codex","platformFamily":"unix","platformOs":"linux"}}} {"type":"expect_outbound","label":"initialized","frame":{"method":"initialized"}} -{"type":"expect_outbound","label":"thread/start","frame":{"id":2,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","model":"gpt-6-luna"}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":2,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":2,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"thread/start","frame":{"id":3,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","model":"gpt-6-luna"}}} {"type":"emit_inbound","label":"configWarning","frame":{"method":"configWarning","params":{"summary":"Codex could not find bubblewrap on PATH. Install bubblewrap with your OS package manager. See the sandbox prerequisites: https://developers.openai.com/codex/concepts/sandboxing#prerequisites. Codex will use the bundled bubblewrap in the meantime.","details":null},"emittedAtMs":1790297700256}} {"type":"emit_inbound","label":"remoteControl/status/changed","frame":{"method":"remoteControl/status/changed","params":{"status":"disabled","serverName":"replay-host","installationId":"00000000-0000-4000-8000-000000000000","environmentId":null},"emittedAtMs":1790297700256}} -{"type":"emit_inbound","label":"thread/start","frame":{"id":2,"result":{"thread":{"id":"01a0d60e-f7cc-7a50-bdff-90174e2c3b56","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d60e-f7cc-7a50-bdff-90174e2c3b56","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790297700,"updatedAt":1790297700,"recencyAt":1790297700,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-55-00-01a0d60e-f7cc-7a50-bdff-90174e2c3b56.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"],"instructionSources":["/home/replay-user/.codex/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} -{"type":"expect_outbound","label":"thread/name/set","frame":{"id":3,"method":"thread/name/set","params":{"name":"Replay fixture: turn_interrupt_mid_tool","threadId":"01a0d60e-f7cc-7a50-bdff-90174e2c3b56"}}} -{"type":"emit_inbound","label":"thread/name/set","frame":{"id":3,"result":{}}} +{"type":"emit_inbound","label":"thread/start","frame":{"id":3,"result":{"thread":{"id":"01a0d60e-f7cc-7a50-bdff-90174e2c3b56","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d60e-f7cc-7a50-bdff-90174e2c3b56","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790297700,"updatedAt":1790297700,"recencyAt":1790297700,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-55-00-01a0d60e-f7cc-7a50-bdff-90174e2c3b56.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"],"instructionSources":["/home/replay-user/.codex/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} +{"type":"expect_outbound","label":"thread/name/set","frame":{"id":4,"method":"thread/name/set","params":{"name":"Replay fixture: turn_interrupt_mid_tool","threadId":"01a0d60e-f7cc-7a50-bdff-90174e2c3b56"}}} +{"type":"emit_inbound","label":"thread/name/set","frame":{"id":4,"result":{}}} {"type":"emit_inbound","label":"thread/name/updated","frame":{"method":"thread/name/updated","params":{"threadId":"01a0d60e-f7cc-7a50-bdff-90174e2c3b56","threadName":"Replay fixture: turn_interrupt_mid_tool"}}} -{"type":"expect_outbound","label":"config/read","frame":{"id":4,"method":"config/read","params":{"cwd":"","includeLayers":false}}} -{"type":"emit_inbound","label":"config/read","frame":{"id":4,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"turn/start","frame":{"id":5,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Run this exact local command: `node -e \"console.log('interrupt fixture tool started'); setTimeout(() => {}, 30000)\"`. Do not answer until it completes, then respond exactly: interrupt fixture should not finish naturally.","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"networkAccess":false,"type":"workspaceWrite","writableRoots":[]},"summary":"auto","threadId":"01a0d60e-f7cc-7a50-bdff-90174e2c3b56","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":5,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":5,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"turn/start","frame":{"id":6,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Run this exact local command: `node -e \"console.log('interrupt fixture tool started'); setTimeout(() => {}, 30000)\"`. Do not answer until it completes, then respond exactly: interrupt fixture should not finish naturally.","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"networkAccess":false,"type":"workspaceWrite","writableRoots":[]},"summary":"auto","threadId":"01a0d60e-f7cc-7a50-bdff-90174e2c3b56","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} {"type":"emit_inbound","label":"thread/started","frame":{"method":"thread/started","params":{"thread":{"id":"01a0d60e-f7cc-7a50-bdff-90174e2c3b56","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d60e-f7cc-7a50-bdff-90174e2c3b56","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790297700,"updatedAt":1790297700,"recencyAt":1790297700,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-55-00-01a0d60e-f7cc-7a50-bdff-90174e2c3b56.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]}},"emittedAtMs":1790297700615}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0d60e-f7cc-7a50-bdff-90174e2c3b56","name":"codex_apps","status":"starting","error":null,"failureReason":null},"emittedAtMs":1790297700615}} {"type":"emit_inbound","label":"thread/settings/updated","frame":{"method":"thread/settings/updated","params":{"threadId":"01a0d60e-f7cc-7a50-bdff-90174e2c3b56","threadSettings":{"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","approvalPolicy":"never","approvalsReviewer":"user","sandboxPolicy":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":null,"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"effort":null,"summary":"detailed","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna","reasoning_effort":null,"developer_instructions":null}},"multiAgentMode":"explicitRequestOnly","personality":null}},"emittedAtMs":1790297700629}} -{"type":"emit_inbound","label":"turn/start","frame":{"id":5,"result":{"turn":{"id":"01a0d60e-f90f-7f23-b6ba-9ca7ee20b5cd","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"emit_inbound","label":"turn/start","frame":{"id":6,"result":{"turn":{"id":"01a0d60e-f90f-7f23-b6ba-9ca7ee20b5cd","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0d60e-f7cc-7a50-bdff-90174e2c3b56","status":{"type":"active","activeFlags":[]}},"emittedAtMs":1790297700691}} {"type":"emit_inbound","label":"turn/started","frame":{"method":"turn/started","params":{"threadId":"01a0d60e-f7cc-7a50-bdff-90174e2c3b56","turn":{"id":"01a0d60e-f90f-7f23-b6ba-9ca7ee20b5cd","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":1790297700,"completedAt":null,"durationMs":null}},"emittedAtMs":1790297700691}} {"type":"emit_inbound","label":"account/updated","frame":{"method":"account/updated","params":{"authMode":"chatgpt","planType":"unknown"},"emittedAtMs":1790297700959}} @@ -30,11 +32,11 @@ {"type":"emit_inbound","label":"item/reasoning/summaryTextDelta","frame":{"method":"item/reasoning/summaryTextDelta","params":{"threadId":"01a0d60e-f7cc-7a50-bdff-90174e2c3b56","turnId":"01a0d60e-f90f-7f23-b6ba-9ca7ee20b5cd","itemId":"rs_02867d76e88a025b016ab5c669424c87d09ca784eb308b0650","delta":"**Running exact command**","summaryIndex":0},"emittedAtMs":1790297707152}} {"type":"emit_inbound","label":"item/completed","frame":{"method":"item/completed","params":{"item":{"type":"reasoning","id":"rs_02867d76e88a025b016ab5c669424c87d09ca784eb308b0650","summary":["**Running exact command**"],"content":[]},"threadId":"01a0d60e-f7cc-7a50-bdff-90174e2c3b56","turnId":"01a0d60e-f90f-7f23-b6ba-9ca7ee20b5cd","completedAtMs":1790297707229},"emittedAtMs":1790297707234}} {"type":"emit_inbound","label":"item/started","frame":{"method":"item/started","params":{"item":{"type":"commandExecution","id":"exec-0ce96e49-aa1c-4bae-b4f8-687a7473017c","pluginId":null,"scriptPath":null,"command":"/bin/bash -lc \"node -e \\\"console.log('interrupt fixture tool started'); setTimeout(() => {}, 30000)\\\"\"","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","processId":"87302","source":"unifiedExecStartup","status":"inProgress","commandActions":[{"type":"unknown","command":"node -e \"console.log('interrupt fixture tool started'); setTimeout(() => {}, 30000)\""}],"aggregatedOutput":null,"exitCode":null,"durationMs":null},"threadId":"01a0d60e-f7cc-7a50-bdff-90174e2c3b56","turnId":"01a0d60e-f90f-7f23-b6ba-9ca7ee20b5cd","startedAtMs":1790297707619},"emittedAtMs":1790297707621}} -{"type":"expect_outbound","label":"turn/interrupt","frame":{"id":6,"method":"turn/interrupt","params":{"threadId":"01a0d60e-f7cc-7a50-bdff-90174e2c3b56","turnId":"01a0d60e-f90f-7f23-b6ba-9ca7ee20b5cd"}}} +{"type":"expect_outbound","label":"turn/interrupt","frame":{"id":7,"method":"turn/interrupt","params":{"threadId":"01a0d60e-f7cc-7a50-bdff-90174e2c3b56","turnId":"01a0d60e-f90f-7f23-b6ba-9ca7ee20b5cd"}}} {"type":"emit_inbound","label":"thread/tokenUsage/updated","frame":{"method":"thread/tokenUsage/updated","params":{"threadId":"01a0d60e-f7cc-7a50-bdff-90174e2c3b56","turnId":"01a0d60e-f90f-7f23-b6ba-9ca7ee20b5cd","tokenUsage":{"total":{"totalTokens":17953,"inputTokens":17855,"cachedInputTokens":11008,"cacheWriteInputTokens":0,"outputTokens":98,"reasoningOutputTokens":25},"last":{"totalTokens":17953,"inputTokens":17855,"cachedInputTokens":11008,"cacheWriteInputTokens":0,"outputTokens":98,"reasoningOutputTokens":25},"modelContextWindow":258400}},"emittedAtMs":1790297707635}} -{"type":"emit_inbound","label":"turn/interrupt","frame":{"id":6,"result":{}}} -{"type":"expect_outbound","label":"thread/backgroundTerminals/terminate","frame":{"id":7,"method":"thread/backgroundTerminals/terminate","params":{"threadId":"01a0d60e-f7cc-7a50-bdff-90174e2c3b56","processId":"87302"}}} +{"type":"emit_inbound","label":"turn/interrupt","frame":{"id":7,"result":{}}} +{"type":"expect_outbound","label":"thread/backgroundTerminals/terminate","frame":{"id":8,"method":"thread/backgroundTerminals/terminate","params":{"threadId":"01a0d60e-f7cc-7a50-bdff-90174e2c3b56","processId":"87302"}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0d60e-f7cc-7a50-bdff-90174e2c3b56","status":{"type":"idle"}},"emittedAtMs":1790297707650}} {"type":"emit_inbound","label":"turn/completed","frame":{"method":"turn/completed","params":{"threadId":"01a0d60e-f7cc-7a50-bdff-90174e2c3b56","turn":{"id":"01a0d60e-f90f-7f23-b6ba-9ca7ee20b5cd","items":[],"itemsView":"notLoaded","status":"interrupted","error":null,"startedAt":1790297700,"completedAt":1790297707,"durationMs":7017}},"emittedAtMs":1790297707650}} -{"type":"emit_inbound","label":"thread/backgroundTerminals/terminate","frame":{"id":7,"result":{"terminated":true}}} +{"type":"emit_inbound","label":"thread/backgroundTerminals/terminate","frame":{"id":8,"result":{"terminated":true}}} {"type":"runtime_exit","status":"success"} diff --git a/apps/server/src/orchestration-v2/testkit/fixtures/web_search/codex_transcript.ndjson b/apps/server/src/orchestration-v2/testkit/fixtures/web_search/codex_transcript.ndjson index 13e2b2b73a404..34013740bd798 100644 --- a/apps/server/src/orchestration-v2/testkit/fixtures/web_search/codex_transcript.ndjson +++ b/apps/server/src/orchestration-v2/testkit/fixtures/web_search/codex_transcript.ndjson @@ -2,20 +2,22 @@ {"type":"expect_outbound","label":"initialize","frame":{"id":1,"method":"initialize","params":{"capabilities":{"experimentalApi":true,"optOutNotificationMethods":["turn/diff/updated"],"extensions":{"io.modelcontextprotocol/ui":{"mimeTypes":["text/html;profile=mcp-app"]}}},"clientInfo":{"name":"T3 Code","title":"T3 Code","version":"0.0.44"}}}} {"type":"emit_inbound","label":"initialize","frame":{"id":1,"result":{"userAgent":"t3code_desktop/0.156.1 (Debian 13.0.0; x86_64) unknown (t3code_desktop; 0.1.0)","codexHome":"/home/replay-user/.codex","platformFamily":"unix","platformOs":"linux"}}} {"type":"expect_outbound","label":"initialized","frame":{"method":"initialized"}} -{"type":"expect_outbound","label":"thread/start","frame":{"id":2,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","model":"gpt-6-luna"}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":2,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":2,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"thread/start","frame":{"id":3,"method":"thread/start","params":{"config":{"tools.update_plan.enabled":true,"mcp_optional_startup_grace_ms":10000,"features.concurrent_reasoning_summaries":true},"cwd":"","model":"gpt-6-luna"}}} {"type":"emit_inbound","label":"configWarning","frame":{"method":"configWarning","params":{"summary":"Codex could not find bubblewrap on PATH. Install bubblewrap with your OS package manager. See the sandbox prerequisites: https://developers.openai.com/codex/concepts/sandboxing#prerequisites. Codex will use the bundled bubblewrap in the meantime.","details":null},"emittedAtMs":1790295574462}} {"type":"emit_inbound","label":"remoteControl/status/changed","frame":{"method":"remoteControl/status/changed","params":{"status":"disabled","serverName":"replay-host","installationId":"00000000-0000-4000-8000-000000000000","environmentId":null},"emittedAtMs":1790295574462}} -{"type":"emit_inbound","label":"thread/start","frame":{"id":2,"result":{"thread":{"id":"01a0d5ee-87e4-7461-9ab7-5c316b503107","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5ee-87e4-7461-9ab7-5c316b503107","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790295574,"updatedAt":1790295574,"recencyAt":1790295574,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-19-34-01a0d5ee-87e4-7461-9ab7-5c316b503107.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"],"instructionSources":["/home/replay-user/.codex/AGENTS.md","/home/replay-user/t3code/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} -{"type":"expect_outbound","label":"thread/name/set","frame":{"id":3,"method":"thread/name/set","params":{"name":"Replay fixture: web_search","threadId":"01a0d5ee-87e4-7461-9ab7-5c316b503107"}}} -{"type":"emit_inbound","label":"thread/name/set","frame":{"id":3,"result":{}}} +{"type":"emit_inbound","label":"thread/start","frame":{"id":3,"result":{"thread":{"id":"01a0d5ee-87e4-7461-9ab7-5c316b503107","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5ee-87e4-7461-9ab7-5c316b503107","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790295574,"updatedAt":1790295574,"recencyAt":1790295574,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-19-34-01a0d5ee-87e4-7461-9ab7-5c316b503107.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]},"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"],"instructionSources":["/home/replay-user/.codex/AGENTS.md","/home/replay-user/t3code/AGENTS.md"],"approvalPolicy":"on-request","approvalsReviewer":"user","sandbox":{"type":"workspaceWrite","writableRoots":[],"networkAccess":false,"excludeTmpdirEnvVar":false,"excludeSlashTmp":false},"activePermissionProfile":{"id":":workspace","extends":null},"reasoningEffort":null,"multiAgentMode":"explicitRequestOnly"}}} +{"type":"expect_outbound","label":"thread/name/set","frame":{"id":4,"method":"thread/name/set","params":{"name":"Replay fixture: web_search","threadId":"01a0d5ee-87e4-7461-9ab7-5c316b503107"}}} +{"type":"emit_inbound","label":"thread/name/set","frame":{"id":4,"result":{}}} {"type":"emit_inbound","label":"thread/name/updated","frame":{"method":"thread/name/updated","params":{"threadId":"01a0d5ee-87e4-7461-9ab7-5c316b503107","threadName":"Replay fixture: web_search"}}} -{"type":"expect_outbound","label":"config/read","frame":{"id":4,"method":"config/read","params":{"cwd":"","includeLayers":false}}} -{"type":"emit_inbound","label":"config/read","frame":{"id":4,"result":{"config":{},"origins":{}}}} -{"type":"expect_outbound","label":"turn/start","frame":{"id":5,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Search the web for FIFA World Cup ticket pricing, then answer exactly: web search fixture complete","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0d5ee-87e4-7461-9ab7-5c316b503107","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} +{"type":"expect_outbound","label":"config/read","frame":{"id":5,"method":"config/read","params":{"cwd":"","includeLayers":false}}} +{"type":"emit_inbound","label":"config/read","frame":{"id":5,"result":{"config":{},"origins":{}}}} +{"type":"expect_outbound","label":"turn/start","frame":{"id":6,"method":"turn/start","params":{"approvalPolicy":"never","approvalsReviewer":"user","cwd":"","input":[{"text":"Search the web for FIFA World Cup ticket pricing, then answer exactly: web search fixture complete","type":"text"}],"model":"gpt-6-luna","sandboxPolicy":{"type":"dangerFullAccess"},"summary":"auto","threadId":"01a0d5ee-87e4-7461-9ab7-5c316b503107","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna"}}}}} {"type":"emit_inbound","label":"thread/started","frame":{"method":"thread/started","params":{"thread":{"id":"01a0d5ee-87e4-7461-9ab7-5c316b503107","environments":[{"environmentId":"local","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","runtimeWorkspaceRoots":["/home/replay-user/t3code/packages/effect-codex-app-server"]}],"extra":null,"sessionId":"01a0d5ee-87e4-7461-9ab7-5c316b503107","forkedFromId":null,"parentThreadId":null,"preview":"","ephemeral":false,"section":null,"sectionEnteredAt":null,"projectId":null,"historyMode":"paginated","modelProvider":"openai","model":"gpt-6-luna","reasoningEffort":null,"createdAt":1790295574,"updatedAt":1790295574,"recencyAt":1790295574,"status":{"type":"idle"},"path":"/home/replay-user/.codex/sessions/2026/09/24/rollout-2026-09-24T17-19-34-01a0d5ee-87e4-7461-9ab7-5c316b503107.jsonl","cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","cliVersion":"0.156.1","originator":"t3code_desktop","source":"vscode","canAcceptDirectInput":true,"threadSource":null,"agentNickname":null,"agentRole":null,"gitInfo":null,"name":null,"daybreakEnabled":null,"turns":[]}},"emittedAtMs":1790295574652}} {"type":"emit_inbound","label":"mcpServer/startupStatus/updated","frame":{"method":"mcpServer/startupStatus/updated","params":{"threadId":"01a0d5ee-87e4-7461-9ab7-5c316b503107","name":"codex_apps","status":"starting","error":null,"failureReason":null},"emittedAtMs":1790295574652}} {"type":"emit_inbound","label":"thread/settings/updated","frame":{"method":"thread/settings/updated","params":{"threadId":"01a0d5ee-87e4-7461-9ab7-5c316b503107","threadSettings":{"disabledPluginIds":[],"cwd":"/home/replay-user/t3code/packages/effect-codex-app-server","approvalPolicy":"never","approvalsReviewer":"user","sandboxPolicy":{"type":"dangerFullAccess"},"activePermissionProfile":null,"model":"gpt-6-luna","modelProvider":"openai","serviceTier":null,"effort":null,"summary":"detailed","collaborationMode":{"mode":"default","settings":{"model":"gpt-6-luna","reasoning_effort":null,"developer_instructions":null}},"multiAgentMode":"explicitRequestOnly","personality":null}},"emittedAtMs":1790295574669}} -{"type":"emit_inbound","label":"turn/start","frame":{"id":5,"result":{"turn":{"id":"01a0d5ee-8888-7d30-8f2b-68fe28f521bc","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} +{"type":"emit_inbound","label":"turn/start","frame":{"id":6,"result":{"turn":{"id":"01a0d5ee-8888-7d30-8f2b-68fe28f521bc","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":null,"completedAt":null,"durationMs":null}}}} {"type":"emit_inbound","label":"thread/status/changed","frame":{"method":"thread/status/changed","params":{"threadId":"01a0d5ee-87e4-7461-9ab7-5c316b503107","status":{"type":"active","activeFlags":[]}},"emittedAtMs":1790295574742}} {"type":"emit_inbound","label":"turn/started","frame":{"method":"turn/started","params":{"threadId":"01a0d5ee-87e4-7461-9ab7-5c316b503107","turn":{"id":"01a0d5ee-8888-7d30-8f2b-68fe28f521bc","items":[],"itemsView":"notLoaded","status":"inProgress","error":null,"startedAt":1790295574,"completedAt":null,"durationMs":null}},"emittedAtMs":1790295574742}} {"type":"emit_inbound","label":"account/updated","frame":{"method":"account/updated","params":{"authMode":"chatgpt","planType":"unknown"},"emittedAtMs":1790295575098}} diff --git a/packages/effect-codex-app-server/src/replay.ts b/packages/effect-codex-app-server/src/replay.ts index 219feae25126a..384e11c8b4a3e 100644 --- a/packages/effect-codex-app-server/src/replay.ts +++ b/packages/effect-codex-app-server/src/replay.ts @@ -252,11 +252,20 @@ function recorderThreadConfigKeys(transcript: CodexAppServerReplayTranscript): R /** * `cwd`, `model`, host-supplied MCP servers (machine-local URLs, short-lived * authorization headers) and the T3 thread id vary per machine or run, and - * recorder-only keys are not the client's. + * recorder-only keys are not the client's. The config read before a thread + * request carries the same `cwd`. */ function normalizeThreadRequest(frame: unknown, ignoredConfigKeys: ReadonlySet): unknown { if (typeof frame !== "object" || frame === null) return frame; const record = frame as Record; + if ( + record.method === "config/read" && + typeof record.params === "object" && + record.params !== null + ) { + const { cwd: _cwd, ...params } = record.params as Record; + return { ...record, params }; + } if ( (record.method !== "thread/start" && record.method !== "thread/resume" && From 505f6d6cf4fcd61aeafc2f32f8bc7adfd8713f5f Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Thu, 19 Nov 2026 15:36:00 -0800 Subject: [PATCH 149/201] fix(server): Antigravity accepts t3_background_wait for its own background commands (#39421) --- .../Adapters/AntigravityAdapterV2.test.ts | 19 +++++++++++++++ packages/provider-acp/src/server/adapter.ts | 23 +++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/apps/server/src/orchestration-v2/Adapters/AntigravityAdapterV2.test.ts b/apps/server/src/orchestration-v2/Adapters/AntigravityAdapterV2.test.ts index 21022a97f36d5..c7b8c6ffaf1b2 100644 --- a/apps/server/src/orchestration-v2/Adapters/AntigravityAdapterV2.test.ts +++ b/apps/server/src/orchestration-v2/Adapters/AntigravityAdapterV2.test.ts @@ -1462,6 +1462,25 @@ describe("AntigravityAdapterV2 work after the prompt ends", () => { }).pipe(Effect.provide(layerSession)), ); + // agy names its background commands `/task-`; the agent passes that to + // t3_background_wait, which must not fail since the adapter already holds the run open. + it.effect("accepts t3_background_wait for a command it already tracks", () => + Effect.gen(function* () { + const { session, providerThread, startTurn, throughPromptSettled } = + yield* openSessionWithRunningCommand({ WaitMsBeforeAsync: 10000 }); + yield* startTurn(1, false); + yield* throughPromptSettled; + const taskIds = ["mock-session-1/task-2"]; + assert.isDefined(session.awaitBackgroundTasks, "t3_background_wait must not be unsupported"); + const result = yield* session.awaitBackgroundTasks!({ + providerThread, + taskIds, + awaited: true, + }); + assert.deepEqual(result.matched, taskIds); + }).pipe(Effect.provide(layerSession)), + ); + // agy 1.5.11 reads a prompt sent mid-turn as a steer: it answers the running prompt end_turn // and goes on under the new one. session/cancel would end its running commands and subagents. it.effect("steers a running prompt with the next one and leaves its work running", () => diff --git a/packages/provider-acp/src/server/adapter.ts b/packages/provider-acp/src/server/adapter.ts index 3e0864054c32f..e096bf25a4577 100644 --- a/packages/provider-acp/src/server/adapter.ts +++ b/packages/provider-acp/src/server/adapter.ts @@ -9972,6 +9972,29 @@ export const makeAcpAdapterV2 = Effect.fn("makeAcpAdapterV2")(function* ( ), ), ), + // The held turn already waits on these commands; their tool calls carry no task id, + // so any id matches while one runs on this thread. + ...(flavor.toolOutlivesPrompt === undefined + ? {} + : { + awaitBackgroundTasks: Effect.fn("AcpAdapterV2.awaitBackgroundTasks")(function* ({ + providerThread, + taskIds, + }) { + const outlives = flavor.toolOutlivesPrompt; + const context = yield* Ref.get(activeTurn); + const holdsCommand = + outlives !== undefined && + defersFinalizeForBackgroundWork && + context !== null && + !context.finalized && + context.nativeThreadId === providerThread.nativeThreadRef?.nativeId && + [...context.tools.values()].some( + (tool) => toolStatus(tool.status) === "running" && outlives(tool), + ); + return { matched: holdsCommand ? [...new Set(taskIds)] : [] }; + }), + }), interruptTurn: Effect.fn("AcpAdapterV2.interruptTurn")( function* (turnInput: ProviderAdapter.ProviderAdapterV2InterruptInput) { return yield* Effect.uninterruptibleMask((restore) => From 990f31cac2567163a15c7fa603abfebe5bdcdb9e Mon Sep 17 00:00:00 2001 From: Omar Espinosa <77650361+OmarAlex24@users.noreply.github.com> Date: Thu, 19 Nov 2026 17:36:13 -0600 Subject: [PATCH 150/201] fix(server): host sleep no longer times out an Antigravity turn (#39395) Co-authored-by: Julius Marminge --- .../Adapters/AcpAdapterV2.test.ts | 60 +++++++++++++++++++ packages/provider-acp/src/server/adapter.ts | 15 ++++- 2 files changed, 72 insertions(+), 3 deletions(-) diff --git a/apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.ts b/apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.ts index c3d54f06719fa..9c8b403a748a6 100644 --- a/apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.ts +++ b/apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.ts @@ -45,6 +45,7 @@ import * as Effect from "effect/Effect"; import * as Exit from "effect/Exit"; import * as FileSystem from "effect/FileSystem"; import * as Fiber from "effect/Fiber"; +import * as Latch from "effect/Latch"; import * as Layer from "effect/Layer"; import * as Option from "effect/Option"; import * as Path from "effect/Path"; @@ -5531,6 +5532,65 @@ describe("AcpAdapterV2", () => { }).pipe(Effect.provide(layerTest)), ); + // regression: #34160 a turn failed as silent right after the computer woke from sleep + it.effect.each([ + { label: "a timer due during sleep fires on wake", timerCountsSleep: true, asleep: "2 hours" }, + { label: "the host wakes before the deadline", timerCountsSleep: true, asleep: "9 minutes" }, + { + label: "timers pause while only wall time jumps", + timerCountsSleep: false, + asleep: "2 hours", + }, + ] as const)( + "does not count host sleep as prompt inactivity when $label", + ({ timerCountsSleep, asleep }) => + Effect.gen(function* () { + const testClock = yield* TestClock.testClockWith(Effect.succeed); + const awake = yield* Latch.make(true); + let wallJumpMillis = 0; + // macOS and Windows timers count sleep and fire on the first tick after wake; on Linux + // timers pause while the wall clock jumps. + const hostClock: TestClock.TestClock = { + ...testClock, + currentTimeMillisUnsafe: () => testClock.currentTimeMillisUnsafe() + wallJumpMillis, + currentTimeMillis: Effect.sync( + () => testClock.currentTimeMillisUnsafe() + wallJumpMillis, + ), + sleep: (duration) => testClock.sleep(duration).pipe(Effect.andThen(awake.await)), + }; + yield* Effect.gen(function* () { + const harness = yield* makePromptInactivityHarness({ + environment: (runtimeOrdinal) => + runtimeOrdinal === 1 ? { T3_ACP_HANG_PROMPT_FOREVER: "1" } : {}, + }); + yield* harness.startTurn(1); + yield* TestClock.adjust("5 minutes"); + yield* harness.emitUpdate({ + sessionId: "mock-session-1", + update: { + sessionUpdate: "agent_thought_chunk", + content: { type: "text", text: "Still working." }, + }, + }); + if (timerCountsSleep) { + yield* awake.close; + yield* TestClock.adjust(asleep); + yield* awake.open; + } else { + wallJumpMillis = Duration.toMillis(asleep); + } + yield* TestClock.adjust(Duration.millis(15 * 60_000 - 1)); + assert.isTrue(yield* harness.nextTurnRejected(2)); + + yield* TestClock.adjust("2 minutes"); + yield* harness.startTurn(2); + const [silent, next] = yield* harness.terminals(2); + assert.equal(silent?.status, "failed"); + assert.equal(next?.status, "completed"); + }).pipe(Effect.provideService(Clock.Clock, hostClock)); + }).pipe(Effect.provide(layerTest)), + ); + it.effect( "holds the inactivity timeout while a tool runs and restarts it when the tool ends", () => diff --git a/packages/provider-acp/src/server/adapter.ts b/packages/provider-acp/src/server/adapter.ts index e096bf25a4577..ea1c83091d5f9 100644 --- a/packages/provider-acp/src/server/adapter.ts +++ b/packages/provider-acp/src/server/adapter.ts @@ -147,6 +147,8 @@ const ACP_DEFERRED_FINALIZE_DEBOUNCE: Duration.Input = "3000 millis"; // A model can stay silent this long before the first token of a reply the agent started itself. const ACP_OPEN_REPLY_QUIET_LIMIT: Duration.Input = "2 minutes"; const ACP_BUSY_PROMPT_RETRY_INTERVAL: Duration.Input = "1 second"; +const ACP_PROMPT_INACTIVITY_SLICE_MILLIS = 60_000; +const ACP_HOST_SLEEP_TOLERANCE_MILLIS = 10_000; // pi-agent-core agents (oh-my-pi) end a turn while background work runs and reject // prompts until it finishes; the prompt is resent rather than failing the turn. @@ -8767,10 +8769,17 @@ export const makeAcpAdapterV2 = Effect.fn("makeAcpAdapterV2")(function* ( yield* Deferred.await(context.promptDispatched); context.lastProgressAt = yield* Clock.currentTimeMillis; while (true) { - const remaining = - context.lastProgressAt + timeoutMillis - (yield* Clock.currentTimeMillis); + const sliceStartedAt = yield* Clock.currentTimeMillis; + const remaining = context.lastProgressAt + timeoutMillis - sliceStartedAt; if (remaining > 0) { - yield* Effect.sleep(Duration.millis(remaining)); + const slice = Math.min(remaining, ACP_PROMPT_INACTIVITY_SLICE_MILLIS); + yield* Effect.sleep(Duration.millis(slice)); + // Host sleep is not agent silence. Timers either fire late on wake (macOS, Windows) + // or pause while the wall clock jumps (Linux); both overrun a short slice. + const now = yield* Clock.currentTimeMillis; + if (now - sliceStartedAt > slice + ACP_HOST_SLEEP_TOLERANCE_MILLIS) { + context.lastProgressAt = now; + } continue; } const outcome = yield* runtimeTransitionPermit.withPermit( From 944d1820e2b797fd1369f81035a13746b02a99de Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Thu, 19 Nov 2026 15:41:28 -0800 Subject: [PATCH 151/201] fix(server): Antigravity Google sign-in shows its link with the native CLI (#38953) --- .../src/provider/AntigravityAuth.test.ts | 57 ++++++++ apps/server/src/provider/AntigravityAuth.ts | 121 +++++++++++++++-- .../src/provider/Drivers/AntigravityDriver.ts | 128 ++++++++++++++++-- .../provider/antigravityAuthSupport.test.ts | 41 ++++++ .../src/provider/antigravityAuthSupport.ts | 38 +++++- docs/user/providers-antigravity.md | 6 +- 6 files changed, 361 insertions(+), 30 deletions(-) diff --git a/apps/server/src/provider/AntigravityAuth.test.ts b/apps/server/src/provider/AntigravityAuth.test.ts index 48cb3f1912da3..af730c75f12c8 100644 --- a/apps/server/src/provider/AntigravityAuth.test.ts +++ b/apps/server/src/provider/AntigravityAuth.test.ts @@ -27,6 +27,8 @@ const otherOwner = "t3-auth-session-other"; const authorizationUrl = "https://accounts.google.com/o/oauth2/v2/auth?response_type=code&redirect_uri=http%3A%2F%2F127.0.0.1%3A51234%2F&state=test-state"; const callbackUrl = "http://127.0.0.1:51234/?state=test-state&code=test-code"; +const loginUrl = + "https://accounts.google.com/o/oauth2/auth?response_type=code&redirect_uri=https%3A%2F%2Fantigravity.google%2Foauth-callback&state=login-state"; const initialized = { protocolVersion: 1, @@ -60,8 +62,11 @@ const makeHarness = Effect.fn("makeAuthTestHarness")(function* ( readonly supportsLogout?: boolean; readonly beforeInitialize?: Effect.Effect; readonly forwardCallback?: Effect.Effect; + readonly codeLogin?: boolean; } = {}, ) { + const loginCodes: string[] = []; + const loginCode = yield* Deferred.make(); const authenticated = yield* Deferred.make(); const discovered = yield* Deferred.make(); const closed = yield* Deferred.make(); @@ -132,6 +137,21 @@ const makeHarness = Effect.fn("makeAuthTestHarness")(function* ( Effect.sync(() => { forwarded += 1; }), + codeLogin: ({ onAuthorizationUrl }) => + Effect.gen(function* () { + if (!options.codeLogin) return undefined; + events.push("login-open"); + yield* Effect.addFinalizer(() => Effect.sync(() => events.push("login-close"))); + yield* onAuthorizationUrl(loginUrl); + return { + submit: (response: string) => + Effect.sync(() => loginCodes.push(response)).pipe( + Effect.andThen(Deferred.succeed(loginCode, undefined)), + Effect.asVoid, + ), + completed: Deferred.await(loginCode), + }; + }), }); return { auth, @@ -142,6 +162,7 @@ const makeHarness = Effect.fn("makeAuthTestHarness")(function* ( events, catalog: () => catalog, forwarded: () => forwarded, + loginCodes, receiveAuthorizationUrl: (url: string) => Effect.suspend(() => receiveAuthorizationUrl @@ -170,6 +191,42 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("AntigravityAuth" }), ); + it.effect("signs in through the CLI's code login, then authenticates a fresh process", () => + Effect.gen(function* () { + const harness = yield* makeHarness({ codeLogin: true }); + const state = yield* harness.auth.controller.start(owner); + const waiting = yield* phase(harness.auth, "waiting"); + assert.equal(waiting.authorizationUrl, loginUrl); + assert.equal(waiting.interaction?.type, "credentials"); + const respond = (code: string) => + harness.auth.controller.respond!(owner, { + instanceId, + flowId: state.flowId!, + interactionId: state.flowId!, + response: { type: "credentials", values: { code } }, + }); + for (const invalid of [callbackUrl, "two words", ""]) { + assert.isTrue(Exit.isFailure(yield* respond(invalid).pipe(Effect.exit)), invalid); + } + assert.equal((yield* respond("4/0Ab-code")).phase, "verifying"); + assert.deepEqual(harness.loginCodes, ["4/0Ab-code"]); + + yield* Deferred.succeed(harness.authenticated, undefined); + yield* Deferred.succeed(harness.discovered, undefined); + yield* phase(harness.auth, "succeeded"); + assert.deepEqual(harness.events, [ + "login-open", + "login-close", + "process-open", + "initialize", + "authenticate", + "session-new", + "catalog-published", + "process-close", + ]); + }), + ); + it.effect("rejects a different second authorization URL", () => Effect.gen(function* () { const harness = yield* makeHarness({ diff --git a/apps/server/src/provider/AntigravityAuth.ts b/apps/server/src/provider/AntigravityAuth.ts index 6e471dad4dc1a..5f5d3f1143a34 100644 --- a/apps/server/src/provider/AntigravityAuth.ts +++ b/apps/server/src/provider/AntigravityAuth.ts @@ -21,6 +21,7 @@ import * as AcpErrors from "effect-acp/errors"; import type * as AcpSessionRuntime from "@t3tools/provider-acp/server/AcpSessionRuntime"; import { + antigravityLoginResponse, parseAntigravityAuthorizationUrl, type AntigravityAuthorizationUrl, } from "./antigravityAuthSupport.ts"; @@ -45,6 +46,7 @@ const NO_RESPONSE_MESSAGE = const UNREACHABLE_MESSAGE = "Antigravity could not reach Google. Check this machine's network connection, then start sign-in again."; const FORWARDING_FAILED_MESSAGE = "Could not deliver the sign-in response. Start sign-in again."; +const LOGIN_CODE_FIELD = "code"; const isSetupError = Schema.is(ProviderSetupError); const isAcpRequestError = Schema.is(AcpErrors.AcpRequestError); const isAcpProcessExitedError = Schema.is(AcpErrors.AcpProcessExitedError); @@ -52,6 +54,7 @@ const isAcpProcessExitedError = Schema.is(AcpErrors.AcpProcessExitedError); interface AuthSnapshot { readonly ownerSessionId: string | null; readonly state: ProviderAuthState; + readonly codeLogin?: boolean; } interface AuthFlow { @@ -62,6 +65,8 @@ interface AuthFlow { pending: AntigravityAuthorizationUrl | undefined; initialized: boolean; callbackSent: boolean; + codeLogin: boolean; + submitCode: ((response: string) => Effect.Effect) | undefined; fiber: Fiber.Fiber | undefined; forwarding: Fiber.Fiber | undefined; } @@ -79,6 +84,13 @@ export interface AntigravityAuth { ) => Effect.Effect; } +/** `agy acp --login`: it prints a Google link and reads the code the Antigravity page shows. */ +export interface AntigravityCodeLogin { + readonly submit: (response: string) => Effect.Effect; + /** Succeeds once the runtime has stored the sign-in. */ + readonly completed: Effect.Effect; +} + export type AntigravityAuthRuntime = Pick< AcpSessionRuntime.AcpSessionRuntime["Service"], "initialize" | "start" | "request" @@ -98,6 +110,14 @@ export interface AntigravityAuthOptions< readonly onSignedOut: Effect.Effect; readonly forwardCallback?: (callback: URL) => Effect.Effect; readonly usesBrowser?: boolean; + /** Undefined when the runtime signs in through ACP `authenticate` and T3's browser helper. */ + readonly codeLogin?: (input: { + readonly onAuthorizationUrl: (url: string) => Effect.Effect; + }) => Effect.Effect< + AntigravityCodeLogin | undefined, + AcpErrors.AcpError | ProviderSetupError, + Scope.Scope + >; } function visibleSnapshot(snapshot: AuthSnapshot, ownerSessionId: string): ProviderAuthState { @@ -185,7 +205,11 @@ export const makeAntigravityAuth = Effect.fn("makeAntigravityAuth")(function* < ); const publishFlow = (flow: AuthFlow, state: ProviderAuthState) => { flow.state = state; - return SubscriptionRef.set(snapshot, { ownerSessionId: flow.ownerSessionId, state }); + return SubscriptionRef.set(snapshot, { + ownerSessionId: flow.ownerSessionId, + state, + codeLogin: flow.codeLogin, + }); }; const stopOwnedProcesses = Effect.suspend(() => Effect.forEach( @@ -260,8 +284,8 @@ export const makeAntigravityAuth = Effect.fn("makeAntigravityAuth")(function* < }), ); - const receiveAuthorizationUrl = (flow: AuthFlow, url: string) => - parseAntigravityAuthorizationUrl(url).pipe( + const receiveAuthorizationUrl = (flow: AuthFlow, url: string, redirect: "loopback" | "code") => + parseAntigravityAuthorizationUrl(url, redirect).pipe( Effect.flatMap((authorization) => lock.withPermits(1)( Effect.gen(function* () { @@ -274,12 +298,15 @@ export const makeAntigravityAuth = Effect.fn("makeAntigravityAuth")(function* < }); } flow.pending = authorization; + flow.codeLogin = redirect === "code"; yield* publishFlow(flow, { ...flow.state, phase: "waiting", authorizationUrl: authorization.authorizationUrl, message: - "Open the Google sign-in link. If you are remote, paste the redirect URL here.", + redirect === "loopback" + ? "Open the Google sign-in link. If you are remote, paste the redirect URL here." + : "Open the Google sign-in link, then paste the code from the Antigravity page here.", }); }), ), @@ -302,9 +329,24 @@ export const makeAntigravityAuth = Effect.fn("makeAntigravityAuth")(function* < const runSignIn = Effect.fn("AntigravityAuth.runSignIn")( function* (flow: AuthFlow, stopSessions: Effect.Effect) { yield* stopSessions.pipe(Effect.ensuring(stopOwnedProcesses)); - const runtime = yield* options.makeRuntime({ - onAuthorizationUrl: (url) => receiveAuthorizationUrl(flow, url), - }); + const signedIn = yield* Effect.scoped( + Effect.gen(function* () { + const login = yield* ( + options.codeLogin?.({ + onAuthorizationUrl: (url) => receiveAuthorizationUrl(flow, url, "code"), + }) ?? Effect.undefined + ); + if (login === undefined) return false; + flow.submitCode = login.submit; + yield* login.completed; + return true; + }), + ); + const runtime = yield* options.makeRuntime( + signedIn + ? {} + : { onAuthorizationUrl: (url) => receiveAuthorizationUrl(flow, url, "loopback") }, + ); const startupHint = yield* publishStartingHint(flow, STARTUP_HINT_MS, NOT_STARTED_MESSAGE); // `start` reuses this memoized handshake. yield* runtime.initialize(); @@ -428,6 +470,8 @@ export const makeAntigravityAuth = Effect.fn("makeAntigravityAuth")(function* < pending: undefined, initialized: false, callbackSent: false, + codeLogin: false, + submitCode: undefined, fiber: undefined, forwarding: undefined, }; @@ -489,6 +533,43 @@ export const makeAntigravityAuth = Effect.fn("makeAntigravityAuth")(function* < } return pending.flow.state; }), + respond: Effect.fn("AntigravityAuth.respond")(function* (ownerSessionId, input) { + return yield* lock.withPermits(1)( + Effect.gen(function* () { + const flow = yield* requireFlow(ownerSessionId, input.flowId, "respond"); + if (!flow.pending || !flow.submitCode || flow.callbackSent) { + return yield* setupError( + "respond", + flow.callbackSent + ? "The sign-in response was already sent. Wait for Google to finish." + : "Wait for the Google sign-in link before you send a code.", + ); + } + const response = + input.interactionId === flow.id && input.response.type === "credentials" + ? antigravityLoginResponse( + flow.pending, + input.response.values[LOGIN_CODE_FIELD] ?? "", + ) + : undefined; + if (response === undefined) { + return yield* setupError( + "respond", + "Paste the code from the Antigravity page, or that page's full URL.", + ); + } + flow.callbackSent = true; + yield* flow.submitCode(response); + yield* publishFlow(flow, { + ...flow.state, + phase: "verifying", + authorizationUrl: null, + message: "Waiting for Google to finish sign-in.", + }); + return flow.state; + }), + ); + }), cancel: Effect.fn("AntigravityAuth.cancel")(function* (ownerSessionId, flowId) { const flow = yield* lock.withPermits(1)(requireFlow(ownerSessionId, flowId, "cancel")); yield* stopFlow(flow, "cancelled", "Google sign-in was cancelled."); @@ -580,13 +661,25 @@ export const makeAntigravityAuth = Effect.fn("makeAntigravityAuth")(function* < credentialOwner: "provider" as const, interaction: state.phase === "waiting" && state.authorizationUrl && state.flowId - ? { - type: "browser" as const, - id: state.flowId, - url: state.authorizationUrl, - requiresConsent: false, - acceptsCallback: true, - } + ? value.codeLogin + ? { + type: "credentials" as const, + id: state.flowId, + fields: [ + { + name: LOGIN_CODE_FIELD, + label: "Code from the Antigravity page", + secret: false, + }, + ], + } + : { + type: "browser" as const, + id: state.flowId, + url: state.authorizationUrl, + requiresConsent: false, + acceptsCallback: true, + } : null, }; }), diff --git a/apps/server/src/provider/Drivers/AntigravityDriver.ts b/apps/server/src/provider/Drivers/AntigravityDriver.ts index 1117fc3b9376c..2114aec8e5c60 100644 --- a/apps/server/src/provider/Drivers/AntigravityDriver.ts +++ b/apps/server/src/provider/Drivers/AntigravityDriver.ts @@ -16,11 +16,14 @@ import * as SecureRandom from "effect/crypto/SecureRandom"; import * as Deferred from "effect/Deferred"; import * as Effect from "effect/Effect"; import * as Exit from "effect/Exit"; +import * as Fiber from "effect/Fiber"; import * as FileSystem from "effect/FileSystem"; +import * as Option from "effect/Option"; import * as Path from "effect/Path"; import * as Schema from "effect/Schema"; import * as Scope from "effect/Scope"; import * as Stream from "effect/Stream"; +import * as ChildProcess from "effect/process/ChildProcess"; import * as ChildProcessSpawner from "effect/process/ChildProcessSpawner"; import { HttpClient } from "effect/http"; import * as AcpErrors from "effect-acp/errors"; @@ -200,10 +203,14 @@ export const AntigravityDriver: ProviderDriver< Effect.map((catalog) => stampIdentity(ModelCatalog.applyModelCatalog(draft, catalog))), ); - const makeRuntime = Effect.fn("AntigravityDriver.makeRuntime")(function* ( - input: AntigravityAdapterV2RuntimeInput, + const prepareSpawn = Effect.fn("AntigravityDriver.prepareSpawn")(function* ( + cwd: string, + baseEnv: NodeJS.ProcessEnv, ): Effect.fn.Return< - AcpSessionRuntime.AcpSessionRuntime["Service"], + { + readonly executable: AntigravityInstallation.AntigravityExecutable; + readonly spawn: AcpSessionRuntime.AcpSpawnInput; + }, AcpErrors.AcpError | ProviderSetupError, Scope.Scope > { @@ -270,26 +277,41 @@ export const AntigravityDriver: ProviderDriver< ), ), ); + return { + executable, + spawn: buildAntigravityAcpSpawnInput({ + installation: executable, + profile, + cwd, + baseEnv, + auth, + runtimeTempDirectory, + }), + }; + }); + + const makeRuntime = Effect.fn("AntigravityDriver.makeRuntime")(function* ( + input: AntigravityAdapterV2RuntimeInput, + ): Effect.fn.Return< + AcpSessionRuntime.AcpSessionRuntime["Service"], + AcpErrors.AcpError | ProviderSetupError, + Scope.Scope + > { // `buildAntigravityAcpSpawnInput` sets `extendEnv: false`, so thread variables only reach the // agent's shell through `baseEnv`. const { processEnvironment: threadEnvironment, ...runtimeInput } = input; - const spawnEnvironment = + const { executable, spawn } = yield* prepareSpawn( + runtimeInput.cwd, threadEnvironment === undefined ? processEnvironment - : { ...processEnvironment, ...threadEnvironment }; + : { ...processEnvironment, ...threadEnvironment }, + ); const runtime = yield* makeAntigravityAcpRuntime({ ...runtimeInput, runtimeVersion: executable.version, authMethod: auth.authMethod, childProcessSpawner: spawner, - spawn: buildAntigravityAcpSpawnInput({ - installation: executable, - profile, - cwd: runtimeInput.cwd, - baseEnv: spawnEnvironment, - auth, - runtimeTempDirectory, - }), + spawn, }).pipe(Effect.provideService(SecureRandom.SecureRandom, random)); return { ...runtime, @@ -354,6 +376,85 @@ export const AntigravityDriver: ProviderDriver< }; }); + // The agy CLI ignores T3's browser helper during ACP `authenticate`, so Google sign-in runs its + // remote-friendly `--login`, which stores the sign-in where the ACP process reads it. + const codeLogin = Effect.fn("AntigravityDriver.codeLogin")(function* (input: { + readonly onAuthorizationUrl: (url: string) => Effect.Effect; + }) { + if (auth.authMethod !== "oauth-personal") return undefined; + const resolved = yield* installation + .resolve(settings.binaryPath, processEnvironment) + .pipe(Effect.option); + if (Option.isSome(resolved) && resolved.value.harnessPath !== null) return undefined; + const cwd = yield* fileSystem + .makeTempDirectoryScoped({ prefix: "t3-antigravity-login-" }) + .pipe( + Effect.mapError( + () => + new ProviderSetupError({ + instanceId, + operation: "start", + detail: "Could not create an Antigravity setup workspace.", + }), + ), + ); + const { executable, spawn } = yield* prepareSpawn(cwd, processEnvironment); + if (executable.harnessPath !== null) return undefined; + const failed = (detail: string, cause?: unknown) => + new ProviderSetupError({ instanceId, operation: "start", detail, cause }); + // Without a display it prints the link only, instead of opening a browser on this machine. + const { DISPLAY: _display, WAYLAND_DISPLAY: _wayland, ...env } = spawn.env ?? {}; + const child = yield* spawner + .spawn( + ChildProcess.make(spawn.command, [...spawn.args, "--login"], { + cwd, + env, + extendEnv: false, + shell: false, + }), + ) + .pipe(Effect.mapError((cause) => failed("Could not start Antigravity sign-in.", cause))); + const code = yield* Deferred.make(); + yield* Stream.fromEffect(Deferred.await(code)).pipe( + Stream.map((response) => `${response}\n`), + Stream.encodeText, + Stream.run(child.stdin), + Effect.ignore, + Effect.forkScoped, + ); + const output = yield* child.stdout.pipe( + Stream.decodeText(), + Stream.splitLines, + Stream.map((line) => line.trim()), + Stream.runForEach((line) => + line.startsWith("https://accounts.google.com/") + ? input.onAuthorizationUrl(line) + : Effect.void, + ), + Effect.forkScoped, + ); + yield* Stream.runDrain(child.stderr).pipe(Effect.ignore, Effect.forkScoped); + return { + submit: (response: string) => Deferred.succeed(code, response).pipe(Effect.asVoid), + completed: Effect.gen(function* () { + // Stdout closes when the process exits, or this fails first on an unusable link. + yield* Fiber.join(output).pipe( + Effect.mapError((cause) => + failed("Antigravity returned an invalid Google sign-in link.", cause), + ), + ); + const exitCode = yield* child.exitCode.pipe( + Effect.mapError((cause) => failed("Antigravity sign-in stopped unexpectedly.", cause)), + ); + if (Number(exitCode) !== 0) { + return yield* failed( + "Antigravity could not finish Google sign-in. Start sign-in again.", + ); + } + }), + }; + }); + const publishCatalog = Effect.fn("AntigravityDriver.publishCatalog")(function* ( started: AcpSessionRuntime.AcpSessionRuntimeStartResult, runtime: Pick< @@ -394,6 +495,7 @@ export const AntigravityDriver: ProviderDriver< ), onSignedOut: Effect.suspend(() => provider.onSignedOut), usesBrowser: antigravityAuthUsesBrowser(auth.authMethod), + codeLogin, }); // The probe must not spawn. The agent is a PyInstaller one-file bundle diff --git a/apps/server/src/provider/antigravityAuthSupport.test.ts b/apps/server/src/provider/antigravityAuthSupport.test.ts index 4476ccd3a2d1c..d4e4ed2ddff90 100644 --- a/apps/server/src/provider/antigravityAuthSupport.test.ts +++ b/apps/server/src/provider/antigravityAuthSupport.test.ts @@ -30,6 +30,7 @@ import { isAntigravitySignInRequiredError, makeAntigravityStderrHandler, makeAntigravityStdoutTransform, + antigravityLoginResponse, parseAntigravityAuthorizationUrl, prepareAntigravityProfile, resolveAntigravityInstanceDirectories, @@ -272,6 +273,46 @@ describe("Antigravity authorization URL", () => { ); }); +describe("Antigravity code sign-in", () => { + const loginUrl = + "https://accounts.google.com/o/oauth2/auth?access_type=offline&code_challenge_method=S256&redirect_uri=https%3A%2F%2Fantigravity.google%2Foauth-callback&response_type=code&state=login-state"; + + it.effect("accepts the agy CLI's link and only a code or page URL for that sign-in", () => + Effect.gen(function* () { + const pending = yield* parseAntigravityAuthorizationUrl(loginUrl, "code"); + expect(pending.redirectUri).toBe("https://antigravity.google/oauth-callback"); + for (const other of [ + loginUrl.replace("antigravity.google", "antigravity.google.example.invalid"), + loginUrl.replace("/o/oauth2/auth", "/o/oauth2/v2/auth"), + ]) { + expect( + Result.isFailure( + yield* parseAntigravityAuthorizationUrl(other, "code").pipe(Effect.result), + ), + ).toBe(true); + } + expect( + Result.isFailure(yield* parseAntigravityAuthorizationUrl(loginUrl).pipe(Effect.result)), + ).toBe(true); + + const page = "https://antigravity.google/oauth-callback?state=login-state&code=4%2F0Ab-c"; + expect(antigravityLoginResponse(pending, " 4/0Ab-code_1.x~ ")).toBe("4/0Ab-code_1.x~"); + expect(antigravityLoginResponse(pending, page)).toBe(page); + for (const invalid of [ + "", + "4/0Ab code", + "4/0Ab\nsecond line", + page.replace("login-state", "other-state"), + page.replace("antigravity.google", "evil.example"), + page.replace("&code=4%2F0Ab-c", ""), + `${page}&code=again`, + ]) { + expect(antigravityLoginResponse(pending, invalid)).toBeUndefined(); + } + }), + ); +}); + describe("Antigravity sign-in errors", () => { it("recognizes native auth-required errors and the blocked-login transport error", () => { expect(isAntigravitySignInRequiredError(AcpErrors.AcpRequestError.authRequired())).toBe(true); diff --git a/apps/server/src/provider/antigravityAuthSupport.ts b/apps/server/src/provider/antigravityAuthSupport.ts index 47be6bf31ccae..c7245536a5535 100644 --- a/apps/server/src/provider/antigravityAuthSupport.ts +++ b/apps/server/src/provider/antigravityAuthSupport.ts @@ -499,9 +499,13 @@ export function buildAntigravityAcpSpawnInput(input: { }; } +/** Where `agy acp --login` sends Google; the page shows a code the user pastes back. */ +const ANTIGRAVITY_CODE_REDIRECT_URI = "https://antigravity.google/oauth-callback"; + export const parseAntigravityAuthorizationUrl = Effect.fn("parseAntigravityAuthorizationUrl")( function* ( authorizationUrl: string, + kind: "loopback" | "code" = "loopback", ): Effect.fn.Return { const invalidUrl = () => authSupportError("Antigravity returned an invalid Google sign-in URL."); @@ -513,7 +517,7 @@ export const parseAntigravityAuthorizationUrl = Effect.fn("parseAntigravityAutho const redirectUri = url.searchParams.get("redirect_uri"); if ( url.origin !== "https://accounts.google.com" || - url.pathname !== "/o/oauth2/v2/auth" || + url.pathname !== (kind === "loopback" ? "/o/oauth2/v2/auth" : "/o/oauth2/auth") || url.username !== "" || url.password !== "" || url.hash !== "" || @@ -526,16 +530,46 @@ export const parseAntigravityAuthorizationUrl = Effect.fn("parseAntigravityAutho state.length > 512 || /\s/.test(state) || redirectUri === null || - !/^http:\/\/127\.0\.0\.1:[1-9][0-9]{0,4}\/$/.test(redirectUri) + (kind === "loopback" + ? !/^http:\/\/127\.0\.0\.1:[1-9][0-9]{0,4}\/$/.test(redirectUri) + : redirectUri !== ANTIGRAVITY_CODE_REDIRECT_URI) ) { return yield* invalidUrl(); } + if (kind === "code") return { authorizationUrl, redirectUri, state }; const redirect = yield* decodeUrl(redirectUri).pipe(Effect.mapError(invalidUrl)); if (Number(redirect.port) < 1_024) return yield* invalidUrl(); return { authorizationUrl, redirectUri, state }; }, ); +/** + * What `agy acp --login` reads after its link: the code the Antigravity page shows, or that page's + * URL, which must answer this sign-in. Undefined for anything else, including any line break. + */ +export function antigravityLoginResponse( + pending: AntigravityAuthorizationUrl, + response: string, +): string | undefined { + const value = response.trim(); + if (/^[\w./~-]{1,2048}$/.test(value)) return value; + if (value.length > maxAuthorizationUrlLength || /\s/.test(value)) return undefined; + const url = URL.parse(value); + if ( + url === null || + `${url.origin}${url.pathname}` !== pending.redirectUri || + url.username !== "" || + url.password !== "" || + url.searchParams.getAll("state").length !== 1 || + url.searchParams.get("state") !== pending.state || + url.searchParams.getAll("code").length !== 1 || + !url.searchParams.get("code") + ) { + return undefined; + } + return value; +} + export function makeAntigravityStdoutTransform( input: { readonly onAuthorizationUrl?: ( diff --git a/docs/user/providers-antigravity.md b/docs/user/providers-antigravity.md index db2a06661c8e7..d8d811bd58f68 100644 --- a/docs/user/providers-antigravity.md +++ b/docs/user/providers-antigravity.md @@ -18,7 +18,11 @@ Antigravity setup. ### Sign in from a remote device -Google returns to a `127.0.0.1` address. It can finish directly when your browser is +With the native CLI, Google finishes on an Antigravity page that shows a code. Paste that +code, or the page's full address, into the code field in the client where you started +sign-in. This works the same from any device. + +With the older 1.4.5 runtime, Google returns to a `127.0.0.1` address. It can finish directly when your browser is on the environment's machine. From another device, the final page will usually fail to load because the sign-in listener is on the environment. From 9f6f5540cfe975b6c2748f8e11de62c243dd4414 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Thu, 19 Nov 2026 15:41:54 -0800 Subject: [PATCH 152/201] fix(server): worktree handoff no longer leaves Antigravity threads Waiting (#39422) --- .../Adapters/AcpAdapterV2.test.ts | 42 ++++++++++++++- .../orchestration-v2/RunExecutionService.ts | 6 ++- .../SelectionRestart.integration.test.ts | 51 +++++++++++++++++-- packages/provider-acp/src/server/adapter.ts | 6 +++ 4 files changed, 99 insertions(+), 6 deletions(-) diff --git a/apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.ts b/apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.ts index 9c8b403a748a6..4fb03956e9e13 100644 --- a/apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.ts +++ b/apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.ts @@ -623,6 +623,7 @@ const makePromptInactivityHarness = Effect.fnUntraced(function* (input: { ) => AcpSessionRuntime.AcpSessionRuntime["Service"]["prompt"]; readonly cancelled?: Deferred.Deferred; readonly followAgentWorkState?: boolean; + readonly sessionScope?: Scope.Scope; }) { const childProcessSpawner = yield* ChildProcessSpawner.ChildProcessSpawner; const natives: Array = []; @@ -663,12 +664,15 @@ const makePromptInactivityHarness = Effect.fnUntraced(function* (input: { cwd: process.cwd(), }); const modelSelection = { instanceId, model: "default" } as const; - const runtime = yield* adapter.openSession({ + const opened = adapter.openSession({ threadId, providerSessionId: ProviderSessionId.make("provider-session-acp-prompt-inactivity"), modelSelection, runtimePolicy, }); + const runtime = yield* input.sessionScope === undefined + ? opened + : opened.pipe(Effect.provideService(Scope.Scope, input.sessionScope)); const providerThread = yield* runtime.ensureThread({ threadId, modelSelection, runtimePolicy }); const startTurn = (ordinal: number) => DateTime.now.pipe( @@ -5840,6 +5844,42 @@ describe("AcpAdapterV2", () => { }).pipe(Effect.provide(layerTest)), ); + it.effect("ends a running T3 MCP tool call when its session closes mid-prompt", () => + Effect.gen(function* () { + const sessionScope = yield* Scope.make(); + const harness = yield* makePromptInactivityHarness({ + sessionScope, + environment: () => ({ T3_ACP_EMIT_TRACKED_TOOL_CALL_KIND_THEN_HANG: "other" }), + }); + const trackedToolStatus = (event: ProviderAdapter.ProviderAdapterV2Event) => + event.type === "turn_item.updated" && + event.turnItem.nativeItemRef?.nativeId === "tracked-tool-call" + ? event.turnItem.status + : undefined; + yield* harness.startTurn(1); + yield* harness.runtime.events.pipe( + Stream.filter((event) => trackedToolStatus(event) !== undefined), + Stream.runHead, + ); + // t3_worktree_handoff releases the live session while its own tool call is open. + yield* Scope.close(sessionScope, Exit.void); + // The event queue outlives the session; only events emitted by the close remain. + const after = yield* harness.runtime.events.pipe( + Stream.filter((event) => trackedToolStatus(event) !== undefined), + Stream.map(trackedToolStatus), + Stream.takeUntil((status) => status !== "pending" && status !== "running"), + Stream.runCollect, + Effect.map((collected) => Array.from(collected)), + Effect.timeoutOption("1 second"), + Effect.forkChild, + ); + yield* TestClock.adjust("1 second"); + const statuses = Option.getOrElse(yield* Fiber.join(after), () => []); + // regression: #39410 the handoff's tool call stayed running after the session closed. + assert.include(["completed", "failed", "interrupted", "cancelled"], statuses.at(-1)); + }).pipe(Effect.provide(layerTest)), + ); + it.live("does not poll the process ledger while a cgroup lease owns teardown", () => Effect.gen(function* () { if ((yield* HostProcess.Platform) !== "linux") return; diff --git a/apps/server/src/orchestration-v2/RunExecutionService.ts b/apps/server/src/orchestration-v2/RunExecutionService.ts index f1d21f4a6bad5..da162282719aa 100644 --- a/apps/server/src/orchestration-v2/RunExecutionService.ts +++ b/apps/server/src/orchestration-v2/RunExecutionService.ts @@ -2055,7 +2055,11 @@ export const layer: Layer.Layer< ).pipe(Effect.as(false)), ), ); - if (handedOff) return; + if (handedOff) { + // Its tool calls, the handoff's own among them, died with that process. + yield* endWorkLostAfterRootRun(completedAt); + return; + } } yield* Effect.logWarning("orchestration V2 provider event ingestion failed", { runId: input.run.id, diff --git a/apps/server/src/orchestration-v2/SelectionRestart.integration.test.ts b/apps/server/src/orchestration-v2/SelectionRestart.integration.test.ts index 683fb14d44cc3..890aa9d97467e 100644 --- a/apps/server/src/orchestration-v2/SelectionRestart.integration.test.ts +++ b/apps/server/src/orchestration-v2/SelectionRestart.integration.test.ts @@ -16,6 +16,7 @@ import { ProviderTurnId, type RunId, ThreadId, + TurnItemId, } from "@t3tools/contracts"; import * as DateTime from "effect/DateTime"; import * as Effect from "effect/Effect"; @@ -462,19 +463,54 @@ it.live.each(["pooled", "exclusive"] as const)( state, mode === "pooled" ? pooledCapabilities : exclusiveCapabilities, ); + const handoffToolId = TurnItemId.make(`turn-item:workspace-handoff:${mode}:tool`); // A session that closes on detach is never asked to interrupt: Claude's cannot answer. + // Its turn is inside the handoff's own tool call, which the closed session never ends. const adapter: ProviderAdapter.ProviderAdapterV2["Service"] = mode === "pooled" ? base : { ...base, openSession: (input) => - base.openSession(input).pipe( - Effect.map((session) => ({ + Effect.gen(function* () { + const session = yield* base.openSession(input); + const toolEvents = + yield* Queue.unbounded(); + return { ...session, + events: Stream.merge(session.events, Stream.fromQueue(toolEvents)), + startTurn: (turn) => + Effect.gen(function* () { + yield* session.startTurn(turn); + const now = yield* DateTime.now; + yield* Queue.offer(toolEvents, { + type: "turn_item.updated", + driver, + turnItem: { + id: handoffToolId, + type: "dynamic_tool", + threadId: turn.threadId, + runId: turn.runId, + nodeId: turn.rootNodeId, + providerThreadId: turn.providerThread.id, + providerTurnId: ProviderTurnId.make(`provider-turn:${turn.attemptId}`), + nativeItemRef: null, + parentItemId: null, + ordinal: 1, + status: "running", + title: "t3_worktree_handoff", + toolName: "t3-code.t3_worktree_handoff", + input: {}, + output: null, + startedAt: now, + completedAt: null, + updatedAt: now, + }, + }); + }), interruptTurn: () => Effect.die("an exclusive handoff must not interrupt"), - })), - ), + }; + }), }; const layerRegistry = ProviderAdapterRegistry.layerSingle(adapter); @@ -585,6 +621,13 @@ it.live.each(["pooled", "exclusive"] as const)( ), "an intentional workspace handoff must not project an interrupt result or a failure", ); + if (mode === "exclusive") { + // regression: #39410 the handoff's tool call stayed running after its session closed. + assert.equal( + projection.turnItems.find((item) => item.id === handoffToolId)?.status, + "interrupted", + ); + } assert.deepEqual( (yield* Ref.get(state)).started.map((turn) => turn.cwd), [cwd, handoffCwd], diff --git a/packages/provider-acp/src/server/adapter.ts b/packages/provider-acp/src/server/adapter.ts index ea1c83091d5f9..8b696761742f7 100644 --- a/packages/provider-acp/src/server/adapter.ts +++ b/packages/provider-acp/src/server/adapter.ts @@ -9646,6 +9646,12 @@ export const makeAcpAdapterV2 = Effect.fn("makeAcpAdapterV2")(function* ( yield* Ref.update(continuationGeneration, (value) => value + 1); }), ); + // A session released mid-prompt (worktree handoff) never sees its prompt settle. + const openTurn = yield* Ref.get(activeTurn); + if (openTurn !== null && !openTurn.finalized) { + openTurn.interrupted = true; + yield* finalizeTurn(openTurn, "interrupted"); + } const requests = [...(yield* Ref.get(pendingRuntimeRequests)).values()]; yield* Effect.forEach( requests, From dcf158c5915baaf961ddc1bce06cafd4d2eeeb00 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Thu, 19 Nov 2026 15:47:05 -0800 Subject: [PATCH 153/201] feat(server): setting and managed policy to turn off the preview tunnel (#39415) Co-authored-by: Claude Opus 5.5 --- .../src/features/browser/BrowserTabMenu.tsx | 4 +- .../browser/LocalPreviewRouteScreen.tsx | 23 +++- .../src/features/threads/ThreadFeed.tsx | 11 +- apps/mobile/src/i18n/translations/de.json | 3 + apps/mobile/src/i18n/translations/en.json | 3 + apps/mobile/src/i18n/translations/es.json | 3 + apps/mobile/src/i18n/translations/fr.json | 3 + apps/mobile/src/i18n/translations/ja.json | 3 + apps/mobile/src/i18n/translations/ko.json | 3 + apps/mobile/src/i18n/translations/pt-BR.json | 3 + apps/mobile/src/i18n/translations/ru.json | 3 + apps/mobile/src/i18n/translations/sv.json | 3 + apps/mobile/src/i18n/translations/zh.json | 3 + apps/mobile/src/lib/filePreview.test.ts | 1 + apps/mobile/src/state/entities.ts | 7 ++ .../src/environment/ServerEnvironment.ts | 1 + apps/server/src/policy/ManagedPolicy.test.ts | 9 +- apps/server/src/policy/ManagedPolicy.ts | 4 +- apps/server/src/policy/policyTemplates.ts | 6 + apps/server/src/preview/PreviewTunnel.test.ts | 115 +++++++++++++++++- apps/server/src/preview/PreviewTunnel.ts | 59 ++++++++- apps/web/src/browser/previewRuntime.ts | 34 +++++- .../CommandPalettePortForwardItems.tsx | 3 +- .../components/chat/ThreadServersPanel.tsx | 25 +++- .../src/components/preview/PreviewView.tsx | 8 +- .../settings/ConnectionsSettings.tsx | 27 ++++ .../src/components/settings/settingsSearch.ts | 9 ++ apps/web/src/i18n/translations/de.json | 6 + apps/web/src/i18n/translations/en.json | 6 + apps/web/src/i18n/translations/es.json | 6 + apps/web/src/i18n/translations/fr.json | 6 + apps/web/src/i18n/translations/ja.json | 6 + apps/web/src/i18n/translations/ko.json | 6 + apps/web/src/i18n/translations/pt-BR.json | 6 + apps/web/src/i18n/translations/ru.json | 6 + apps/web/src/i18n/translations/sv.json | 6 + apps/web/src/i18n/translations/zh.json | 6 + apps/web/src/state/portForwards.ts | 18 ++- docs/internals/remote.md | 3 + docs/user/managed-policy.md | 5 + docs/user/remote-access.md | 8 ++ packages/client-runtime/src/contractLabels.ts | 10 +- packages/contracts/src/environment.ts | 2 + packages/contracts/src/managedPolicy.ts | 14 +++ packages/contracts/src/settings.ts | 5 +- packages/shared/src/managedPolicyFile.ts | 1 + 46 files changed, 472 insertions(+), 30 deletions(-) diff --git a/apps/mobile/src/features/browser/BrowserTabMenu.tsx b/apps/mobile/src/features/browser/BrowserTabMenu.tsx index c0df3fb971419..a98bded8b883e 100644 --- a/apps/mobile/src/features/browser/BrowserTabMenu.tsx +++ b/apps/mobile/src/features/browser/BrowserTabMenu.tsx @@ -16,6 +16,7 @@ import { msg, useGT, useMessages } from "gt-react-native"; import { ControlPill } from "../../components/ui/ControlPill"; import { Menu } from "../../components/ui/Menu"; import { m } from "../../i18n/messages"; +import { useEnvironmentPreviewTunnelOff } from "../../state/entities"; import { previewEnvironment } from "../../state/preview"; import { useAtomCommand } from "../../state/use-atom-command"; import { browserTabUrl, loopbackUrlForDevice } from "./browserTabs"; @@ -65,6 +66,7 @@ export function BrowserTabMenu({ readonly onReleaseControl?: () => void; }) { const openLocalPreview = useOpenLocalPreview(); + const tunnelOff = useEnvironmentPreviewTunnelOff(environmentId); const adjust = useAtomCommand(previewEnvironment.adjust, "browser tab change"); const resize = useAtomCommand(previewEnvironment.resize, "browser viewport change"); const close = useAtomCommand(previewEnvironment.close, "browser tab close"); @@ -92,7 +94,7 @@ export function BrowserTabMenu({ image: "xmark", attributes: { destructive: true, disabled: !canClose }, }; - const deviceUrl = loopbackUrlForDevice(browserTabUrl(tab)); + const deviceUrl = tunnelOff ? null : loopbackUrlForDevice(browserTabUrl(tab)); // The device preview has its own webview and tunnel, so it doesn't wait for the stream. const openOnDevice: MenuAction[] = deviceUrl ? [{ id: "open-on-device", title: gt("Open on this device"), image: "iphone" }] diff --git a/apps/mobile/src/features/browser/LocalPreviewRouteScreen.tsx b/apps/mobile/src/features/browser/LocalPreviewRouteScreen.tsx index e8750bcf74349..8cfd22142698a 100644 --- a/apps/mobile/src/features/browser/LocalPreviewRouteScreen.tsx +++ b/apps/mobile/src/features/browser/LocalPreviewRouteScreen.tsx @@ -10,6 +10,7 @@ import { AppText } from "../../components/ui/AppText"; import * as Dialog from "../../components/ui/Dialog"; import { EmptyState } from "../../components/ui/EmptyState"; import { m } from "../../i18n/messages"; +import { useEnvironmentPreviewTunnelOff } from "../../state/entities"; import { useEnvironments } from "../../state/environments"; import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider"; import { BrowserChrome } from "./BrowserBar"; @@ -49,6 +50,7 @@ export function LocalPreviewScreen(props: { useEnvironments().presentationById.get(environmentId)?.entry.target.label ?? gt("the environment", { $context: "stands in for an environment name in a sentence" }); const { themeVariables } = useAppearancePreferences(); + const tunnelOff = useEnvironmentPreviewTunnelOff(environmentId); const webView = useRef(null); const [requested, setRequested] = useState(initialUrl); const [page, setPage] = useState(null); @@ -77,7 +79,7 @@ export function LocalPreviewScreen(props: { }; const back = () => void webView.current?.goBack(); const canGoBack = page?.canGoBack ?? false; - const pageColor = failed || unsupported !== null ? null : page?.pageColor || null; + const pageColor = failed || tunnelOff || unsupported !== null ? null : page?.pageColor || null; return ( // Full screen spans the Duo's rail, so it insets its own sides; the pane is inset already. @@ -127,7 +129,24 @@ export function LocalPreviewScreen(props: { setFailed(true); }} /> - {unsupported !== null ? ( + {tunnelOff ? ( + + + + + + ) : unsupported !== null ? ( + previewTunnelOff ? null : loopbackUrlForDevice(href); // Recycling a row disposes its native audio player, so a started clip's row stays rendered. const [retainedMediaRowId, setRetainedMediaRowId] = useState(null); const focused = useIsFocused(); @@ -3421,7 +3426,7 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) { return; } // Safari would open the phone's own localhost, so these open on the device by default. - const deviceUrl = loopbackUrlForDevice(href); + const deviceUrl = deviceLoopbackUrl(href); if (deviceUrl) { openLocalPreview( { environmentId: String(props.environmentId), threadId: String(props.threadId) }, @@ -3559,7 +3564,7 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) { }; } // The environment's localhost, which this device can only reach through the tunnel. - if (loopbackUrlForDevice(href)) { + if (deviceLoopbackUrl(href)) { return { title: href, actions: [ @@ -3585,7 +3590,7 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) { else if (actionId === "copy-thread-link") copyTextWithHaptic(hostedThreadLink(thread)); return; } - const deviceUrl = loopbackUrlForDevice(href); + const deviceUrl = deviceLoopbackUrl(href); if (deviceUrl) { if (actionId === "open-on-device") { markdownLinkRequest.current?.abort(); diff --git a/apps/mobile/src/i18n/translations/de.json b/apps/mobile/src/i18n/translations/de.json index 084c9bb22d63b..14a72ef456de5 100644 --- a/apps/mobile/src/i18n/translations/de.json +++ b/apps/mobile/src/i18n/translations/de.json @@ -23,6 +23,7 @@ "ef9533bcc048f17b": "Die Richtlinie von {organization} erlaubt T3 Connect nicht.", "986b0873f913a840": "Die Richtlinie von {organization} erlaubt keine Webhook-Aufgaben.", "eebc538e25b09fe2": "Die Richtlinie von {organization} erlaubt keinen Import von Browser-Cookies.", + "7642a133db05f164": "Die Richtlinie von {organization} erlaubt nicht, die lokalen Server dieses Rechners auf anderen Geräten zu öffnen.", "39f6771b49f9b3b6": "Standard verwenden", "45bb0e90e1c42046": "Wenn du zurückkommst", "d8fa0a55446bbb0d": "Bevor der Cache abläuft (Beta)", @@ -1780,6 +1781,8 @@ "9bce41be8fc55a47": "Cache leeren", "4d7f5af0445371fd": "Optionen für Browser-Tab", "27025b00be488485": "die Umgebung", + "4391875125b7882c": "{environment} teilt seinen localhost nicht", + "ec7a78dd403ccf6a": "Der Vorschau-Tunnel ist dort ausgeschaltet, daher öffnen sich seine lokalen Server nur im gestreamten Browser.", "e1ffd0532d64e52c": "Dieses Gerät kann keine localhost-Seiten öffnen", "f72cc72b321f93a5": "{reason} Für diesen Tab kannst du weiterhin den gestreamten Browser verwenden.", "6bf09d4b7e4ba53b": "T3 Code auf {environment} aktualisieren", diff --git a/apps/mobile/src/i18n/translations/en.json b/apps/mobile/src/i18n/translations/en.json index e4258c6dec547..3596aa21e36af 100644 --- a/apps/mobile/src/i18n/translations/en.json +++ b/apps/mobile/src/i18n/translations/en.json @@ -23,6 +23,7 @@ "ef9533bcc048f17b": "{organization}'s policy does not allow T3 Connect.", "986b0873f913a840": "{organization}'s policy does not allow webhook tasks.", "eebc538e25b09fe2": "{organization}'s policy does not allow importing browser cookies.", + "7642a133db05f164": "{organization}'s policy does not allow opening this machine's local servers on other devices.", "39f6771b49f9b3b6": "Use default", "45bb0e90e1c42046": "When you return", "d8fa0a55446bbb0d": "Before the cache expires (beta)", @@ -1780,6 +1781,8 @@ "9bce41be8fc55a47": "Clear cache", "4d7f5af0445371fd": "Browser tab options", "27025b00be488485": "the environment", + "4391875125b7882c": "{environment} doesn't share its localhost", + "ec7a78dd403ccf6a": "The preview tunnel is off there, so its local servers only open in the streamed browser.", "e1ffd0532d64e52c": "This device can't open localhost pages", "f72cc72b321f93a5": "{reason} You can still use the streamed browser for this tab.", "6bf09d4b7e4ba53b": "Update T3 Code on {environment}", diff --git a/apps/mobile/src/i18n/translations/es.json b/apps/mobile/src/i18n/translations/es.json index 9723fc5471f3b..a18764f050d09 100644 --- a/apps/mobile/src/i18n/translations/es.json +++ b/apps/mobile/src/i18n/translations/es.json @@ -23,6 +23,7 @@ "ef9533bcc048f17b": "La política de {organization} no permite T3 Connect.", "986b0873f913a840": "La política de {organization} no permite tareas de webhook.", "eebc538e25b09fe2": "La política de {organization} no permite importar cookies del navegador.", + "7642a133db05f164": "La política de {organization} no permite abrir los servidores locales de esta máquina en otros dispositivos.", "39f6771b49f9b3b6": "Usar valor predeterminado", "45bb0e90e1c42046": "Cuando vuelvas", "d8fa0a55446bbb0d": "Antes de que caduque la caché (beta)", @@ -1780,6 +1781,8 @@ "9bce41be8fc55a47": "Borrar caché", "4d7f5af0445371fd": "Opciones de la pestaña del navegador", "27025b00be488485": "el entorno", + "4391875125b7882c": "{environment} no comparte su localhost", + "ec7a78dd403ccf6a": "El túnel de vista previa está desactivado allí, así que sus servidores locales solo se abren en el navegador transmitido.", "e1ffd0532d64e52c": "Este dispositivo no puede abrir páginas de localhost", "f72cc72b321f93a5": "{reason} Aún puedes usar el navegador transmitido para esta pestaña.", "6bf09d4b7e4ba53b": "Actualiza T3 Code en {environment}", diff --git a/apps/mobile/src/i18n/translations/fr.json b/apps/mobile/src/i18n/translations/fr.json index 795b4bc67312d..9f12d87dd513b 100644 --- a/apps/mobile/src/i18n/translations/fr.json +++ b/apps/mobile/src/i18n/translations/fr.json @@ -23,6 +23,7 @@ "ef9533bcc048f17b": "La politique de {organization} n’autorise pas T3 Connect.", "986b0873f913a840": "La politique de {organization} n’autorise pas les tâches webhook.", "eebc538e25b09fe2": "La politique de {organization} n’autorise pas l’import des cookies du navigateur.", + "7642a133db05f164": "La stratégie de {organization} n’autorise pas l’ouverture des serveurs locaux de cette machine sur d’autres appareils.", "39f6771b49f9b3b6": "Utiliser la valeur par défaut", "45bb0e90e1c42046": "À votre retour", "d8fa0a55446bbb0d": "Avant l’expiration du cache (bêta)", @@ -1780,6 +1781,8 @@ "9bce41be8fc55a47": "Vider le cache", "4d7f5af0445371fd": "Options de l’onglet du navigateur", "27025b00be488485": "l’environnement", + "4391875125b7882c": "{environment} ne partage pas son localhost", + "ec7a78dd403ccf6a": "Le tunnel d’aperçu y est désactivé, ses serveurs locaux ne s’ouvrent donc que dans le navigateur diffusé.", "e1ffd0532d64e52c": "Cet appareil ne peut pas ouvrir les pages localhost", "f72cc72b321f93a5": "{reason} Tu peux toujours utiliser le navigateur diffusé pour cet onglet.", "6bf09d4b7e4ba53b": "Mettez à jour T3 Code sur {environment}", diff --git a/apps/mobile/src/i18n/translations/ja.json b/apps/mobile/src/i18n/translations/ja.json index 97f21ae2fe472..441175f85337e 100644 --- a/apps/mobile/src/i18n/translations/ja.json +++ b/apps/mobile/src/i18n/translations/ja.json @@ -23,6 +23,7 @@ "ef9533bcc048f17b": "{organization} のポリシーでは、T3 Connect は許可されていません。", "986b0873f913a840": "{organization} のポリシーでは、Webhook タスクは許可されていません。", "eebc538e25b09fe2": "{organization} のポリシーでは、ブラウザーの Cookie のインポートは許可されていません。", + "7642a133db05f164": "{organization} のポリシーでは、このマシンのローカルサーバーを他のデバイスで開くことは許可されていません。", "39f6771b49f9b3b6": "デフォルトを使用", "45bb0e90e1c42046": "戻ってきたとき", "d8fa0a55446bbb0d": "キャッシュの期限切れ前 (ベータ)", @@ -1780,6 +1781,8 @@ "9bce41be8fc55a47": "キャッシュを消去", "4d7f5af0445371fd": "ブラウザータブのオプション", "27025b00be488485": "環境", + "4391875125b7882c": "{environment} は localhost を共有していません", + "ec7a78dd403ccf6a": "そちらではプレビュートンネルがオフのため、ローカルサーバーはストリーミングブラウザでのみ開けます。", "e1ffd0532d64e52c": "このデバイスでは localhost のページを開けません", "f72cc72b321f93a5": "{reason} このタブではストリーミングブラウザを引き続き使えます。", "6bf09d4b7e4ba53b": "{environment} の T3 Code を更新してください", diff --git a/apps/mobile/src/i18n/translations/ko.json b/apps/mobile/src/i18n/translations/ko.json index 2d95884bfc32c..c73c767074bde 100644 --- a/apps/mobile/src/i18n/translations/ko.json +++ b/apps/mobile/src/i18n/translations/ko.json @@ -23,6 +23,7 @@ "ef9533bcc048f17b": "{organization}의 정책상 T3 Connect를 사용할 수 없습니다.", "986b0873f913a840": "{organization}의 정책상 웹후크 작업을 사용할 수 없습니다.", "eebc538e25b09fe2": "{organization}의 정책상 브라우저 쿠키를 가져올 수 없습니다.", + "7642a133db05f164": "{organization}의 정책은 이 컴퓨터의 로컬 서버를 다른 기기에서 여는 것을 허용하지 않습니다.", "39f6771b49f9b3b6": "기본값 사용", "45bb0e90e1c42046": "돌아왔을 때", "d8fa0a55446bbb0d": "캐시가 만료되기 전(베타)", @@ -1780,6 +1781,8 @@ "9bce41be8fc55a47": "캐시 지우기", "4d7f5af0445371fd": "브라우저 탭 옵션", "27025b00be488485": "환경", + "4391875125b7882c": "{environment}에서 localhost를 공유하지 않습니다", + "ec7a78dd403ccf6a": "그곳에서 미리보기 터널이 꺼져 있어 로컬 서버는 스트리밍 브라우저에서만 열립니다.", "e1ffd0532d64e52c": "이 기기에서는 localhost 페이지를 열 수 없습니다", "f72cc72b321f93a5": "{reason} 이 탭에서는 스트리밍 브라우저를 계속 사용할 수 있습니다.", "6bf09d4b7e4ba53b": "{environment}의 T3 Code를 업데이트하세요", diff --git a/apps/mobile/src/i18n/translations/pt-BR.json b/apps/mobile/src/i18n/translations/pt-BR.json index 412808cc9d686..8c9071db5dfee 100644 --- a/apps/mobile/src/i18n/translations/pt-BR.json +++ b/apps/mobile/src/i18n/translations/pt-BR.json @@ -23,6 +23,7 @@ "ef9533bcc048f17b": "A política de {organization} não permite o T3 Connect.", "986b0873f913a840": "A política de {organization} não permite tarefas de webhook.", "eebc538e25b09fe2": "A política de {organization} não permite importar cookies do navegador.", + "7642a133db05f164": "A política de {organization} não permite abrir os servidores locais desta máquina em outros dispositivos.", "39f6771b49f9b3b6": "Usar padrão", "45bb0e90e1c42046": "Quando você voltar", "d8fa0a55446bbb0d": "Antes de o cache expirar (beta)", @@ -1780,6 +1781,8 @@ "9bce41be8fc55a47": "Limpar cache", "4d7f5af0445371fd": "Opções da aba do navegador", "27025b00be488485": "o ambiente", + "4391875125b7882c": "{environment} não compartilha seu localhost", + "ec7a78dd403ccf6a": "O túnel de pré-visualização está desativado lá, então seus servidores locais só abrem no navegador transmitido.", "e1ffd0532d64e52c": "Este dispositivo não consegue abrir páginas de localhost", "f72cc72b321f93a5": "{reason} Você ainda pode usar o navegador transmitido para esta aba.", "6bf09d4b7e4ba53b": "Atualize o T3 Code em {environment}", diff --git a/apps/mobile/src/i18n/translations/ru.json b/apps/mobile/src/i18n/translations/ru.json index b76e105104a8a..ce752d7d25c6f 100644 --- a/apps/mobile/src/i18n/translations/ru.json +++ b/apps/mobile/src/i18n/translations/ru.json @@ -23,6 +23,7 @@ "ef9533bcc048f17b": "Политика {organization} запрещает T3 Connect.", "986b0873f913a840": "Политика {organization} запрещает задачи по вебхуку.", "eebc538e25b09fe2": "Политика {organization} запрещает импорт cookie браузера.", + "7642a133db05f164": "Политика {organization} не разрешает открывать локальные серверы этого компьютера на других устройствах.", "39f6771b49f9b3b6": "По умолчанию", "45bb0e90e1c42046": "Когда вы вернётесь", "d8fa0a55446bbb0d": "До истечения кеша (бета)", @@ -1780,6 +1781,8 @@ "9bce41be8fc55a47": "Очистить кеш", "4d7f5af0445371fd": "Параметры вкладки браузера", "27025b00be488485": "окружение", + "4391875125b7882c": "{environment} не открывает доступ к своему localhost", + "ec7a78dd403ccf6a": "Там выключен туннель предпросмотра, поэтому его локальные серверы открываются только в транслируемом браузере.", "e1ffd0532d64e52c": "Это устройство не может открывать страницы localhost", "f72cc72b321f93a5": "{reason} Для этой вкладки можно по-прежнему использовать транслируемый браузер.", "6bf09d4b7e4ba53b": "Обновите T3 Code на {environment}", diff --git a/apps/mobile/src/i18n/translations/sv.json b/apps/mobile/src/i18n/translations/sv.json index 8629e708c09fe..c87a75ea47e5d 100644 --- a/apps/mobile/src/i18n/translations/sv.json +++ b/apps/mobile/src/i18n/translations/sv.json @@ -23,6 +23,7 @@ "ef9533bcc048f17b": "Policyn för {organization} tillåter inte T3 Connect.", "986b0873f913a840": "Policyn för {organization} tillåter inte webhook-uppgifter.", "eebc538e25b09fe2": "Policyn för {organization} tillåter inte import av cookies från webbläsare.", + "7642a133db05f164": "{organization}s policy tillåter inte att den här datorns lokala servrar öppnas på andra enheter.", "39f6771b49f9b3b6": "Använd standard", "45bb0e90e1c42046": "När du kommer tillbaka", "d8fa0a55446bbb0d": "Innan cachen går ut (beta)", @@ -1780,6 +1781,8 @@ "9bce41be8fc55a47": "Rensa cache", "4d7f5af0445371fd": "Alternativ för webbläsarflik", "27025b00be488485": "miljön", + "4391875125b7882c": "{environment} delar inte sin localhost", + "ec7a78dd403ccf6a": "Förhandsgranskningstunneln är avstängd där, så dess lokala servrar öppnas bara i den strömmade webbläsaren.", "e1ffd0532d64e52c": "Den här enheten kan inte öppna localhost-sidor", "f72cc72b321f93a5": "{reason} Du kan fortfarande använda den strömmade webbläsaren för den här fliken.", "6bf09d4b7e4ba53b": "Uppdatera T3 Code på {environment}", diff --git a/apps/mobile/src/i18n/translations/zh.json b/apps/mobile/src/i18n/translations/zh.json index 45e032bebe433..ce8b8caf281d5 100644 --- a/apps/mobile/src/i18n/translations/zh.json +++ b/apps/mobile/src/i18n/translations/zh.json @@ -23,6 +23,7 @@ "ef9533bcc048f17b": "{organization} 的策略不允许使用 T3 Connect。", "986b0873f913a840": "{organization} 的策略不允许使用 webhook 任务。", "eebc538e25b09fe2": "{organization} 的策略不允许导入浏览器 Cookie。", + "7642a133db05f164": "{organization} 的策略不允许在其他设备上打开此机器的本地服务器。", "39f6771b49f9b3b6": "使用默认值", "45bb0e90e1c42046": "在你回来后", "d8fa0a55446bbb0d": "缓存过期前(测试版)", @@ -1781,6 +1782,8 @@ "9bce41be8fc55a47": "清除缓存", "4d7f5af0445371fd": "浏览器标签页选项", "27025b00be488485": "该环境", + "4391875125b7882c": "{environment} 未共享其 localhost", + "ec7a78dd403ccf6a": "那里的预览隧道已关闭,因此其本地服务器只能在串流浏览器中打开。", "e1ffd0532d64e52c": "此设备无法打开 localhost 页面", "f72cc72b321f93a5": "{reason} 你仍可以为此标签页使用流式浏览器。", "6bf09d4b7e4ba53b": "请更新 {environment} 上的 T3 Code", diff --git a/apps/mobile/src/lib/filePreview.test.ts b/apps/mobile/src/lib/filePreview.test.ts index b93913c00da55..d82e0c5f7abeb 100644 --- a/apps/mobile/src/lib/filePreview.test.ts +++ b/apps/mobile/src/lib/filePreview.test.ts @@ -184,6 +184,7 @@ vi.mock("../state/threads", () => ({ environmentThreadShells: {}, threadEnvironm vi.mock("../state/entities", () => ({ useLiveThreadLinkLabels: (text: string) => text, useThreadChipIcons: () => new Map(), + useEnvironmentPreviewTunnelOff: () => false, })); vi.mock("../state/use-thread-selection", () => ({ useThreadSelection: () => ({ selectedThread: null }), diff --git a/apps/mobile/src/state/entities.ts b/apps/mobile/src/state/entities.ts index 9ca7f1d64496f..462c8dd68c795 100644 --- a/apps/mobile/src/state/entities.ts +++ b/apps/mobile/src/state/entities.ts @@ -8,6 +8,7 @@ import type { EnvironmentThreadShell, } from "@t3tools/client-runtime/state/shell"; import { + allowsPreviewTunnel, EnvironmentId, ThreadId, type ComposerContextRecord, @@ -304,6 +305,12 @@ export function useEnvironmentServerConfig( ); } +/** Whether the environment turned its preview tunnel off; false until its config loads. */ +export function useEnvironmentPreviewTunnelOff(environmentId: EnvironmentId | null): boolean { + const config = useEnvironmentServerConfig(environmentId); + return config !== null && !allowsPreviewTunnel(config); +} + export function useServerConfigs(): ReadonlyMap { return useAtomValue(environmentServerConfigsAtom); } diff --git a/apps/server/src/environment/ServerEnvironment.ts b/apps/server/src/environment/ServerEnvironment.ts index 04f5c9082b606..a9dfdcb6e6048 100644 --- a/apps/server/src/environment/ServerEnvironment.ts +++ b/apps/server/src/environment/ServerEnvironment.ts @@ -273,6 +273,7 @@ export const make = Effect.gen(function* () { serverResolvedCommandContext: true, threadStop: true, ...(hostPlatform === "win32" ? {} : { localServerStop: true }), + previewTunnelSetting: true, environmentIcon: true, projectCloneTracking: true, projectOrganization: true, diff --git a/apps/server/src/policy/ManagedPolicy.test.ts b/apps/server/src/policy/ManagedPolicy.test.ts index a91cdec613095..c52c1f036009a 100644 --- a/apps/server/src/policy/ManagedPolicy.test.ts +++ b/apps/server/src/policy/ManagedPolicy.test.ts @@ -60,11 +60,16 @@ it.layer(NodeServices.layer)("ManagedPolicy.load", (it) => { JSON.stringify({ schemaVersion: 1, organization: "Example Corp", - limits: { webhookTasks: false, telemetry: true }, + limits: { webhookTasks: false, telemetry: true, previewTunnel: false }, }), ); - assert.deepEqual(policy.summary?.limits, { webhookTasks: false, telemetry: true }); + assert.deepEqual(policy.summary?.limits, { + webhookTasks: false, + telemetry: true, + previewTunnel: false, + }); assert.equal(ManagedPolicy.deniedBy(policy, "webhookTasks"), "Example Corp"); + assert.equal(ManagedPolicy.deniedBy(policy, "previewTunnel"), "Example Corp"); assert.isUndefined(ManagedPolicy.deniedBy(policy, "telemetry")); }), ); diff --git a/apps/server/src/policy/ManagedPolicy.ts b/apps/server/src/policy/ManagedPolicy.ts index 01651051893c0..36665b6e1572b 100644 --- a/apps/server/src/policy/ManagedPolicy.ts +++ b/apps/server/src/policy/ManagedPolicy.ts @@ -70,7 +70,7 @@ export const loadedPolicy = Effect.fn("ManagedPolicy.loadedPolicy")(function* ( */ export function deniedBy( policy: Pick, - capability: "webhookTasks" | "telemetry", + capability: "webhookTasks" | "telemetry" | "previewTunnel", ): string | undefined { return policy.document?.limits?.[capability] === false ? policy.document.organization : undefined; } @@ -135,6 +135,7 @@ function summarizeLimits( webhookTasks, telemetry, browserCookieImport, + previewTunnel, providers, updates, } = document.limits ?? {}; @@ -146,6 +147,7 @@ function summarizeLimits( ...(webhookTasks === undefined ? {} : { webhookTasks }), ...(telemetry === undefined ? {} : { telemetry }), ...(browserCookieImport === undefined ? {} : { browserCookieImport }), + ...(previewTunnel === undefined ? {} : { previewTunnel }), ...(providers?.allowedDrivers === undefined && Object.keys(lockedInstanceFields).length === 0 ? {} : { diff --git a/apps/server/src/policy/policyTemplates.ts b/apps/server/src/policy/policyTemplates.ts index 55c15fb94f56c..602bb740db04f 100644 --- a/apps/server/src/policy/policyTemplates.ts +++ b/apps/server/src/policy/policyTemplates.ts @@ -119,6 +119,12 @@ const policies = (): ReadonlyArray => [ help: "Disabled stops users from importing cookies from another browser into T3 Code's browser.", toggle: "BrowserCookieImport", }, + { + id: "PreviewTunnel", + title: "Allow the preview tunnel", + help: "Disabled stops other devices from opening this machine's local servers through T3 Code: no in-app browser tabs loaded on the device, no Open on this device, no port forwarding. Browser tabs still stream from this machine.", + toggle: "PreviewTunnel", + }, { id: "Telemetry", title: "Allow usage data", diff --git a/apps/server/src/preview/PreviewTunnel.test.ts b/apps/server/src/preview/PreviewTunnel.test.ts index 684622e488424..b8a7732d56f83 100644 --- a/apps/server/src/preview/PreviewTunnel.test.ts +++ b/apps/server/src/preview/PreviewTunnel.test.ts @@ -5,16 +5,23 @@ import { AuthOrchestrationReadScope, AuthSessionId, AuthTerminalOperateScope, + DEFAULT_SERVER_SETTINGS, + type ManagedPolicySummary, + type ServerSettings, } from "@t3tools/contracts"; import * as NodeNet from "node:net"; import * as Context from "effect/Context"; import * as Deferred from "effect/Deferred"; import * as Effect from "effect/Effect"; import * as Layer from "effect/Layer"; +import * as PubSub from "effect/PubSub"; +import * as Ref from "effect/Ref"; +import * as Stream from "effect/Stream"; import { HttpRouter, HttpServer } from "effect/http"; import * as EnvironmentAuth from "../auth/EnvironmentAuth.ts"; import * as SessionStore from "../auth/SessionStore.ts"; +import { ServerSettingsService } from "../serverSettings.ts"; import * as PreviewTunnel from "./PreviewTunnel.ts"; const listen = (onConnection: (socket: NodeNet.Socket) => void) => @@ -40,13 +47,51 @@ const listen = (onConnection: (socket: NodeNet.Socket) => void) => ), ).pipe(Effect.map(({ server }) => ({ port: (server.address() as NodeNet.AddressInfo).port }))); +/** Settings the route reads; `set` publishes a change as the real service does. */ +const makeSettings = Effect.fn(function* ( + enablePreviewTunnel = true, + managedPolicy?: ManagedPolicySummary, + /** Applied right after the first read, as a change landing while a tunnel dials. */ + afterFirstRead?: Partial, +) { + const current = yield* Ref.make({ + ...DEFAULT_SERVER_SETTINGS, + enablePreviewTunnel, + }); + const changes = yield* PubSub.unbounded(); + const set = (patch: Partial) => + Ref.updateAndGet(current, (settings) => ({ ...settings, ...patch })).pipe( + Effect.flatMap((settings) => PubSub.publish(changes, settings)), + ); + let pendingChange = afterFirstRead; + return { + set, + layer: Layer.mock(ServerSettingsService, { + managedPolicy, + getSettings: Ref.get(current).pipe( + Effect.tap(() => { + const change = pendingChange; + pendingChange = undefined; + return change ? set(change) : Effect.void; + }), + ), + streamChanges: Stream.fromPubSub(changes), + subscribeChanges: PubSub.subscribe(changes).pipe(Effect.map(Stream.fromSubscription)), + }), + }; +}); + /** Serves the tunnel route; `wsTicket=reader` authenticates without terminal:operate. */ -const serveTunnel = (sessionInvalidated: Effect.Effect = Effect.never) => +const serveTunnel = ( + sessionInvalidated: Effect.Effect = Effect.never, + settings?: Layer.Layer, +) => Effect.gen(function* () { + const settingsLayer = settings ?? (yield* makeSettings()).layer; const services = yield* Layer.build( HttpRouter.serve(PreviewTunnel.routeLayer, { disableListenLog: true }).pipe( Layer.provideMerge(NodeHttpServer.layerTest), - Layer.provide(PreviewTunnel.layer), + Layer.provide(PreviewTunnel.layer.pipe(Layer.provide(settingsLayer))), Layer.provide( Layer.mock(SessionStore.SessionStore, { cookieName: "t3_session", @@ -183,3 +228,69 @@ it.effect("closes an open tunnel when its session is revoked", () => yield* Effect.promise(() => Promise.all([clientClosed, upstreamClosed.promise])); }), ); + +it.effect.each([ + { case: "the setting", enabled: false, policy: undefined }, + { + case: "a policy, whatever the setting", + enabled: true, + policy: { + organization: "Example Corp", + lockedSettings: [], + limits: { previewTunnel: false }, + } satisfies ManagedPolicySummary, + }, +])("refuses every tunnel with 403 when $case turns it off", ({ enabled, policy }) => + Effect.gen(function* () { + let dialled = 0; + const listed = yield* listen((socket) => { + dialled++; + socket.destroy(); + }); + const settings = yield* makeSettings(enabled, policy); + const tunnel = yield* serveTunnel(Effect.never, settings.layer); + const client = yield* openTunnel(`${tunnel.origin}/api/preview/tunnel?port=${listed.port}`); + const status = yield* Effect.promise( + () => + new Promise<{ status: number | undefined; disabled: boolean }>((resolve, reject) => { + client.on("unexpected-response", (_request, response) => + resolve({ + status: response.statusCode, + disabled: + response.headers[PreviewTunnel.PREVIEW_TUNNEL_DISABLED_HEADER] !== undefined, + }), + ); + client.on("open", () => reject(new Error("tunnel opened"))); + client.on("error", reject); + }), + ); + expect(status).toEqual({ status: 403, disabled: true }); + expect(dialled).toBe(0); + }), +); + +it.effect("closes an open tunnel when the setting turns it off", () => + Effect.gen(function* () { + const upstreamClosed = Promise.withResolvers(); + const upstream = yield* listen((socket) => socket.on("close", () => upstreamClosed.resolve())); + const settings = yield* makeSettings(); + const tunnel = yield* serveTunnel(Effect.never, settings.layer); + const client = yield* openTunnel(`${tunnel.origin}/api/preview/tunnel?port=${upstream.port}`); + yield* Effect.promise(() => new Promise((resolve) => client.once("open", resolve))); + const clientClosed = new Promise((resolve) => client.once("close", resolve)); + yield* settings.set({ enablePreviewTunnel: false }); + yield* Effect.promise(() => Promise.all([clientClosed, upstreamClosed.promise])); + }), +); + +it.effect("closes a tunnel the setting turns off while it is still dialling", () => + Effect.gen(function* () { + const settings = yield* makeSettings(true, undefined, { enablePreviewTunnel: false }); + const upstreamClosed = Promise.withResolvers(); + const upstream = yield* listen((socket) => socket.on("close", () => upstreamClosed.resolve())); + const tunnel = yield* serveTunnel(Effect.never, settings.layer); + const client = yield* openTunnel(`${tunnel.origin}/api/preview/tunnel?port=${upstream.port}`); + const clientClosed = new Promise((resolve) => client.once("close", resolve)); + yield* Effect.promise(() => Promise.all([clientClosed, upstreamClosed.promise])); + }), +); diff --git a/apps/server/src/preview/PreviewTunnel.ts b/apps/server/src/preview/PreviewTunnel.ts index 7984a81420e52..8071e4ef1eb0a 100644 --- a/apps/server/src/preview/PreviewTunnel.ts +++ b/apps/server/src/preview/PreviewTunnel.ts @@ -2,7 +2,7 @@ // connection per WebSocket. Raw bytes, so pages keep their own origin, HMR sockets and TLS. import * as NodeHttpServerRequest from "@effect/platform-node/NodeHttpServerRequest"; import * as NodeSocket from "@effect/platform-node/NodeSocket"; -import { AuthTerminalOperateScope } from "@t3tools/contracts"; +import { allowsPreviewTunnel, AuthTerminalOperateScope } from "@t3tools/contracts"; import type * as NodeNet from "node:net"; import * as Context from "effect/Context"; import * as Effect from "effect/Effect"; @@ -10,12 +10,14 @@ import * as Layer from "effect/Layer"; import * as Option from "effect/Option"; import * as Schema from "effect/Schema"; import type * as Scope from "effect/Scope"; +import * as Stream from "effect/Stream"; import { HttpRouter, HttpServerRequest, HttpServerResponse } from "effect/http"; import type * as Socket from "effect/socket/Socket"; import { authenticateMediaRequest } from "../auth/http.ts"; import * as SessionStore from "../auth/SessionStore.ts"; import { requestUrl } from "../requestUrl.ts"; +import { ServerSettingsService } from "../serverSettings.ts"; const PREVIEW_TUNNEL_ROUTE = "/api/preview/tunnel"; /** @@ -23,6 +25,8 @@ const PREVIEW_TUNNEL_ROUTE = "/api/preview/tunnel"; * in front of the environment answering 502 because the environment is down. */ export const PREVIEW_TUNNEL_PORT_REFUSED_HEADER = "x-t3-tunnel-port-refused"; +/** Marks a refusal because the tunnel is switched off here, by the setting or by policy. */ +export const PREVIEW_TUNNEL_DISABLED_HEADER = "x-t3-tunnel-disabled"; const CONNECT_TIMEOUT = "5 seconds"; @@ -35,6 +39,15 @@ export class PreviewTunnelPortRefusedError extends Schema.TaggedError()( + "PreviewTunnelDisabledError", + {}, +) { + override get message(): string { + return "The preview tunnel is turned off on this T3 Code server."; + } +} + export class PreviewTunnelConnectError extends Schema.TaggedError()( "PreviewTunnelConnectError", { port: Schema.Number, cause: Schema.Defect() }, @@ -53,13 +66,38 @@ export class PreviewTunnel extends Context.Service< readonly servedPort: number | undefined; }) => Effect.Effect< { readonly reader: Socket.Reader; readonly writer: Socket.Writer }, - PreviewTunnelPortRefusedError | PreviewTunnelConnectError, + PreviewTunnelDisabledError | PreviewTunnelPortRefusedError | PreviewTunnelConnectError, Scope.Scope >; + /** + * Subscribes now, before `connect` reads the setting, so a switch-off during dialling isn't + * missed. The returned effect completes once the tunnel is switched off. + */ + readonly watchTurnedOff: Effect.Effect, never, Scope.Scope>; } >()("t3/preview/PreviewTunnel") {} -const make = Effect.sync(() => { +const make = Effect.gen(function* () { + const serverSettings = yield* ServerSettingsService; + const managedPolicy = serverSettings.managedPolicy; + const allowedBy = (settings: { readonly enablePreviewTunnel: boolean }) => + allowsPreviewTunnel({ settings, managedPolicy }); + // Unreadable settings fail closed: the tunnel is raw TCP into the host. + const enabled = serverSettings.getSettings.pipe( + Effect.map(allowedBy), + Effect.orElseSucceed(() => false), + ); + const watchTurnedOff = serverSettings.subscribeChanges.pipe( + Effect.map((changes) => + changes.pipe( + Stream.filter((settings) => !allowedBy(settings)), + Stream.runHead, + // A change stream that ends without switching the tunnel off never does. + Effect.flatMap((change) => (Option.isSome(change) ? Effect.void : Effect.never)), + ), + ), + ); + const dial = Effect.fnUntraced(function* (host: string, port: number) { const socket = yield* NodeSocket.makeNet({ host, port, openTimeout: CONNECT_TIMEOUT }); return { reader: yield* socket.reader, writer: yield* socket.writer }; @@ -68,6 +106,7 @@ const make = Effect.sync(() => { const connect: PreviewTunnel["Service"]["connect"] = Effect.fn("PreviewTunnel.connect")( function* ({ port, servedPort }) { yield* Effect.annotateCurrentSpan({ port }); + if (!(yield* enabled)) return yield* new PreviewTunnelDisabledError(); // Tunnelling to this server would hand the page an unauthenticated loopback client. if (port === servedPort) { return yield* new PreviewTunnelPortRefusedError({ port }); @@ -79,7 +118,7 @@ const make = Effect.sync(() => { }, ); - return PreviewTunnel.of({ connect }); + return PreviewTunnel.of({ connect, watchTurnedOff }); }); export const layer = Layer.effect(PreviewTunnel, make); @@ -133,23 +172,32 @@ const handler = Effect.gen(function* () { const connection = NodeHttpServerRequest.toIncomingMessage(request).socket; const servedPort = connection.localPort; return yield* Effect.gen(function* () { + const turnedOff = yield* tunnel.watchTurnedOff; // Dialled before the upgrade so a dead port fails the handshake instead of an open socket. const upstream = yield* tunnel.connect({ port, servedPort }); const client = yield* request.upgrade; const clientReader = yield* client.reader; const clientWriter = yield* client.writer; // A tunnel is raw TCP into the host, so it closes with its session like the RPC socket. + // So does switching the tunnel off. yield* Effect.raceFirst( Effect.raceFirst( pump(upstream.reader, clientWriter, drained(connection)), pump(clientReader, upstream.writer), ), - sessions.awaitInvalidation(session.sessionId, session.proofKeyThumbprint), + Effect.raceFirst( + sessions.awaitInvalidation(session.sessionId, session.proofKeyThumbprint), + turnedOff, + ), ).pipe(Effect.ignoreCause); return HttpServerResponse.empty(); }).pipe( Effect.scoped, Effect.catchTags({ + PreviewTunnelDisabledError: (error) => + Effect.succeed( + HttpServerResponse.text(error.message, { status: 403, headers: DISABLED_HEADERS }), + ), PreviewTunnelPortRefusedError: (error) => Effect.succeed( HttpServerResponse.text(error.message, { status: 403, headers: PORT_REFUSED_HEADERS }), @@ -163,5 +211,6 @@ const handler = Effect.gen(function* () { }); const PORT_REFUSED_HEADERS = { [PREVIEW_TUNNEL_PORT_REFUSED_HEADER]: "1" }; +const DISABLED_HEADERS = { [PREVIEW_TUNNEL_DISABLED_HEADER]: "1" }; export const routeLayer = HttpRouter.add("GET", PREVIEW_TUNNEL_ROUTE, handler); diff --git a/apps/web/src/browser/previewRuntime.ts b/apps/web/src/browser/previewRuntime.ts index 7ca4a8a8f6995..8b68ff5e96aaa 100644 --- a/apps/web/src/browser/previewRuntime.ts +++ b/apps/web/src/browser/previewRuntime.ts @@ -1,6 +1,13 @@ import { useAtomValue } from "@effect/atom-react"; -import type { EnvironmentId, PreviewRuntime, PreviewSessionSnapshot } from "@t3tools/contracts"; +import { + allowsPreviewTunnel, + type EnvironmentId, + type PreviewRuntime, + type PreviewSessionSnapshot, +} from "@t3tools/contracts"; +import { Atom } from "effect/reactivity"; +import { environmentCatalog } from "~/connection/catalog"; import { isElectron } from "~/env"; import { isPreviewSupportedInRuntime } from "~/previewStateStore"; import { appAtomRegistry } from "~/rpc/atomRegistry"; @@ -9,12 +16,27 @@ import { readEnvironmentSupportsServerBrowser, useEnvironmentSupportsServerBrowser, } from "~/state/entities"; +import { environmentServerConfigsAtom } from "~/state/server"; + +import { tunnelsEnvironmentLoopback } from "./browserTargetResolver"; + +/** Whether this desktop loads the environment's localhost itself: it is local, or its tunnel is on. */ +const desktopLoadsLoopbackAtom = Atom.family((environmentId: EnvironmentId) => + Atom.make((get) => { + const target = get(environmentCatalog.catalogValueAtom).entries.get(environmentId)?.target; + if (!tunnelsEnvironmentLoopback(target)) return true; + const config = get(environmentServerConfigsAtom).get(environmentId); + return config !== undefined && allowsPreviewTunnel(config); + }).pipe(Atom.withLabel(`preview:desktop-loads-loopback:${environmentId}`)), +); export function previewRuntimeFor(environmentId: EnvironmentId): PreviewRuntime | undefined { if (!readEnvironmentSupportsServerBrowser(environmentId)) return undefined; + // Without its tunnel, another environment's tabs stream from it, as on the web. if ( isPreviewSupportedInRuntime() && - environmentId !== appAtomRegistry.get(primaryEnvironmentIdAtom) + environmentId !== appAtomRegistry.get(primaryEnvironmentIdAtom) && + appAtomRegistry.get(desktopLoadsLoopbackAtom(environmentId)) ) { return undefined; } @@ -25,11 +47,17 @@ export function alternatePreviewRuntime( environmentId: EnvironmentId, primaryEnvironmentId: EnvironmentId | null, serverBrowser: boolean, + desktopLoadsLoopback: boolean, snapshot: Pick | null | undefined, ): PreviewRuntime | null { if (!snapshot || !serverBrowser || !isPreviewSupportedInRuntime()) return null; if (environmentId === primaryEnvironmentId) return null; - return snapshot.runtime === "server" ? "desktop" : "server"; + if (snapshot.runtime === "server") return desktopLoadsLoopback ? "desktop" : null; + return "server"; +} + +export function useDesktopLoadsLoopback(environmentId: EnvironmentId): boolean { + return useAtomValue(desktopLoadsLoopbackAtom(environmentId)); } export function isPreviewAvailableFor(environmentId: EnvironmentId): boolean { diff --git a/apps/web/src/components/CommandPalettePortForwardItems.tsx b/apps/web/src/components/CommandPalettePortForwardItems.tsx index 2a03b19d300c1..0c50c2eaf1e12 100644 --- a/apps/web/src/components/CommandPalettePortForwardItems.tsx +++ b/apps/web/src/components/CommandPalettePortForwardItems.tsx @@ -54,8 +54,7 @@ export function useCommandPalettePortForwardItem(input: { const forwards = usePortForwards(); const { environments } = useEnvironments(); const reachable = environments.filter( - (environment) => - environment.connection.phase === "connected" && canForwardPorts(environment.entry.target), + (environment) => environment.connection.phase === "connected" && canForwardPorts(environment), ); const tunnelling = useEnvironmentsWithScope(reachable, AuthTerminalOperateScope); const tunnelled = reachable.filter((environment) => tunnelling.has(environment.environmentId)); diff --git a/apps/web/src/components/chat/ThreadServersPanel.tsx b/apps/web/src/components/chat/ThreadServersPanel.tsx index b392a78f21b9a..5f6f11636e806 100644 --- a/apps/web/src/components/chat/ThreadServersPanel.tsx +++ b/apps/web/src/components/chat/ThreadServersPanel.tsx @@ -12,12 +12,16 @@ import { isAtomCommandInterrupted, squashAtomCommandFailure, } from "@t3tools/client-runtime/state/runtime"; +import { isLoopbackHost } from "@t3tools/shared/preview"; import { T, useGT, Var } from "gt-react"; import { m } from "~/i18n/messages"; import { CableIcon, GlobeIcon, SquareIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react"; import { type MouseEvent, useState } from "react"; -import { resolveExternalServerUrl } from "../../browser/browserTargetResolver"; +import { + resolveExternalServerUrl, + tunnelsEnvironmentLoopback, +} from "../../browser/browserTargetResolver"; import { readLocalApi } from "../../localApi"; import { cn, isMacPlatform } from "../../lib/utils"; import { useThreadDiscoveredPorts } from "../../portDiscoveryState"; @@ -69,7 +73,7 @@ function ThreadServersList(props: ThreadServersPanelProps) { const forwardable = useEnvironmentScope(props.environmentId, AuthTerminalOperateScope) && environment?.connection.phase === "connected" && - canForwardPorts(environment.entry.target); + canForwardPorts(environment); const locality = useForwardLocality(forwardable ? props.environmentId : null); const canForward = locality === "remote"; const openPreview = useAtomCommand(previewEnvironment.open, { reportFailure: false }); @@ -113,6 +117,23 @@ function ThreadServersList(props: ThreadServersPanelProps) { ) : resolveExternalServerUrl(props.environmentId, server.url); if (url === null) return; + // Without a forward, a remote environment's localhost would open this machine's instead. + if ( + locality !== "local" && + tunnelsEnvironmentLoopback(environment?.entry.target) && + isLoopbackHost(new URL(url).hostname) + ) { + reportFailure( + gt("Unable to open in browser"), + new Error( + gt( + "localhost:{port} runs on another machine, and port forwarding isn't available for it right now.", + { port: server.port }, + ), + ), + ); + return; + } await readLocalApi() ?.shell.openExternal(url) .catch((error: unknown) => reportFailure(gt("Unable to open in browser"), error)); diff --git a/apps/web/src/components/preview/PreviewView.tsx b/apps/web/src/components/preview/PreviewView.tsx index 481e6d8e0f291..bb62228b93736 100644 --- a/apps/web/src/components/preview/PreviewView.tsx +++ b/apps/web/src/components/preview/PreviewView.tsx @@ -91,7 +91,11 @@ import type { MessageResolver } from "~/i18n/messages"; import { revealInFileExplorerLabel } from "./fileExplorerLabel"; import { Badge } from "~/components/ui/badge"; import { BrowserSurfaceSlot } from "~/browser/BrowserSurfaceSlot"; -import { alternatePreviewRuntime, useRendersServerTabNatively } from "~/browser/previewRuntime"; +import { + alternatePreviewRuntime, + useDesktopLoadsLoopback, + useRendersServerTabNatively, +} from "~/browser/previewRuntime"; import { ServerBrowserSurface, type ServerBrowserHandle } from "~/browser/ServerBrowserSurface"; import { cn } from "~/lib/utils"; import { useBrowserSurfaceStore } from "~/browser/browserSurfaceStore"; @@ -205,6 +209,7 @@ export function PreviewView({ const environmentLabel = useEnvironment(threadRef.environmentId)?.label ?? null; const primaryEnvironmentId = usePrimaryEnvironmentId(); const serverBrowser = useEnvironmentSupportsServerBrowser(threadRef.environmentId); + const desktopLoadsLoopback = useDesktopLoadsLoopback(threadRef.environmentId); const adjust = useAtomCommand(previewEnvironment.adjust, "preview appearance or zoom"); usePreviewSession(threadRef); @@ -463,6 +468,7 @@ export function PreviewView({ threadRef.environmentId, primaryEnvironmentId, serverBrowser, + desktopLoadsLoopback, snapshot, ); const moveLabel = diff --git a/apps/web/src/components/settings/ConnectionsSettings.tsx b/apps/web/src/components/settings/ConnectionsSettings.tsx index a6cf6a03b3a28..8f4d8778bcf80 100644 --- a/apps/web/src/components/settings/ConnectionsSettings.tsx +++ b/apps/web/src/components/settings/ConnectionsSettings.tsx @@ -13,6 +13,8 @@ import { AuthEnvironmentMaintainScope, AuthRelayReadScope, AuthRelayWriteScope, + allowsPreviewTunnel, + isManagedSettingPath, type AuthClientSession, type AuthPairingLink, type AuthPairingCredentialResult, @@ -1255,6 +1257,12 @@ function ConnectionsSettingsContent({ ); const accessServerConfig = accessEnvironment?.serverConfig ?? null; + const accessPolicy = accessServerConfig?.managedPolicy; + const previewTunnelDenial = + managedCapabilityDenial(accessPolicy, "previewTunnel", m) ?? + (accessPolicy !== undefined && isManagedSettingPath(accessPolicy, "enablePreviewTunnel") + ? gt("Managed by {organization}.", { organization: accessPolicy.organization }) + : undefined); const primarySettings = ( <> {accessEnvironmentPicker} @@ -1377,6 +1385,25 @@ function ConnectionsSettingsContent({ } /> ) : null} + {accessServerConfig?.environment.capabilities.previewTunnelSetting ? ( + + void updateAccessSettings({ enablePreviewTunnel: enabled }) + } + /> + } + /> + ) : null} {accessEnvironment ? (
    diff --git a/apps/web/src/components/settings/settingsSearch.ts b/apps/web/src/components/settings/settingsSearch.ts index b02f8d2f0b0c8..51ac4d7e19add 100644 --- a/apps/web/src/components/settings/settingsSearch.ts +++ b/apps/web/src/components/settings/settingsSearch.ts @@ -1391,6 +1391,15 @@ export const SETTINGS_SEARCH_ITEMS = [ searchTerms: [msg("mobile push notifications live activities cloud tunnel")], cloudOnly: true, }, + { + id: "preview-tunnel", + title: msg("Preview tunnel"), + to: "/settings/access", + targetId: "connections-environment", + searchTerms: [ + msg("localhost loopback port forwarding open on this device browser tabs stream security"), + ], + }, { id: "connections-environment", title: msg("This machine"), diff --git a/apps/web/src/i18n/translations/de.json b/apps/web/src/i18n/translations/de.json index 661098ee35afc..2ec76aa57cfd7 100644 --- a/apps/web/src/i18n/translations/de.json +++ b/apps/web/src/i18n/translations/de.json @@ -23,6 +23,7 @@ "ef9533bcc048f17b": "Die Richtlinie von {organization} erlaubt T3 Connect nicht.", "986b0873f913a840": "Die Richtlinie von {organization} erlaubt keine Webhook-Aufgaben.", "eebc538e25b09fe2": "Die Richtlinie von {organization} erlaubt keinen Import von Browser-Cookies.", + "7642a133db05f164": "Die Richtlinie von {organization} erlaubt nicht, die lokalen Server dieses Rechners auf anderen Geräten zu öffnen.", "39f6771b49f9b3b6": "Standard verwenden", "45bb0e90e1c42046": "Wenn du zurückkommst", "d8fa0a55446bbb0d": "Bevor der Cache abläuft (Beta)", @@ -4198,6 +4199,7 @@ "075398ac562d74b0": "Agentensitzung trennen", "1d2025060ba3d1c3": "Port {port} konnte nicht weitergeleitet werden", "086ecbb6f4c2e959": "Kann nicht im Browser geöffnet werden", + "112173d046bfc910": "localhost:{port} läuft auf einem anderen Rechner, und Portweiterleitung ist dafür gerade nicht verfügbar.", "51052c00ab1ac8cc": "Vorschau kann nicht geöffnet werden", "0ccd37739f9cf2b6": "Server konnte nicht gestoppt werden", "a610a81c4061bb4c": "Server", @@ -8006,6 +8008,8 @@ "9bfddd9a835be5de": "Server", "43b545c01503eee4": "Update wiederholen", "2f015e6d5459dce9": "Auf {version} aktualisieren", + "8ebba639f92932c3": "Erlaubt anderen Geräten, die lokalen Server dieses Rechners zu öffnen: auf dem Gerät geladene Browser-Tabs, Auf diesem Gerät öffnen und Portweiterleitung. Aus: Browser-Tabs werden von diesem Rechner gestreamt.", + "1c5266bf18d0ed24": "Vorschau-Tunnel erlauben", "a0e93cca71d0417e": "Autorisierte Clients", "03b9501ae07b5cf3": "Netzwerkzugriff aktivieren?", "a09aff32ef3d89c7": "Netzwerkzugriff deaktivieren?", @@ -11630,6 +11634,8 @@ "b5cd79513a06e7c3": "Webhooks offline zurückhalten", "fadd0fcd7b9e1651": "webhook automatisierungen offline warteschlange postfach t3 connect", "9bebacdcfbde18d4": "mobil push-benachrichtigungen live-aktivitäten cloud tunnel", + "a4e6dee662edc3cf": "Vorschau-Tunnel", + "8ed7c2a2226f4663": "localhost loopback portweiterleitung auf diesem gerät öffnen browser tabs streamen sicherheit port forwarding", "1c3e0ac06c8a1f1e": "verbindungen server backend lokal remote zugriff administrativ berechtigungen bereich kopplungslinks qr-code autorisierte clients sitzungen widerrufen endpunkt", "744fd34e8049efeb": "verknüpfen peer anderer rechner vps agenten dort arbeiten übergabe kopplungscode", "3d00c452287f50bd": "hinzufügen koppeln backend host code ssh konfiguration agent tunnel gespeichert t3 connect", diff --git a/apps/web/src/i18n/translations/en.json b/apps/web/src/i18n/translations/en.json index a873be091b0c9..83909c95ae905 100644 --- a/apps/web/src/i18n/translations/en.json +++ b/apps/web/src/i18n/translations/en.json @@ -23,6 +23,7 @@ "ef9533bcc048f17b": "{organization}'s policy does not allow T3 Connect.", "986b0873f913a840": "{organization}'s policy does not allow webhook tasks.", "eebc538e25b09fe2": "{organization}'s policy does not allow importing browser cookies.", + "7642a133db05f164": "{organization}'s policy does not allow opening this machine's local servers on other devices.", "39f6771b49f9b3b6": "Use default", "45bb0e90e1c42046": "When you return", "d8fa0a55446bbb0d": "Before the cache expires (beta)", @@ -4197,6 +4198,7 @@ "075398ac562d74b0": "Disconnect agent session", "1d2025060ba3d1c3": "Could not forward port {port}", "086ecbb6f4c2e959": "Unable to open in browser", + "112173d046bfc910": "localhost:{port} runs on another machine, and port forwarding isn't available for it right now.", "51052c00ab1ac8cc": "Unable to open preview", "0ccd37739f9cf2b6": "Could not stop server", "a610a81c4061bb4c": "Servers", @@ -8013,6 +8015,8 @@ "9bfddd9a835be5de": "server", "43b545c01503eee4": "Retry update", "2f015e6d5459dce9": "Update to {version}", + "8ebba639f92932c3": "Lets other devices open this machine's local servers: browser tabs loaded on the device, Open on this device, and port forwarding. Off: browser tabs stream from this machine.", + "1c5266bf18d0ed24": "Allow the preview tunnel", "a0e93cca71d0417e": "Authorized clients", "03b9501ae07b5cf3": "Enable network access?", "a09aff32ef3d89c7": "Disable network access?", @@ -11638,6 +11642,8 @@ "b5cd79513a06e7c3": "Hold webhooks while offline", "fadd0fcd7b9e1651": "webhook automations offline queue mailbox t3 connect", "9bebacdcfbde18d4": "mobile push notifications live activities cloud tunnel", + "a4e6dee662edc3cf": "Preview tunnel", + "8ed7c2a2226f4663": "localhost loopback port forwarding open on this device browser tabs stream security", "1c3e0ac06c8a1f1e": "connections server backend local remote access administrative permissions scope pairing links qr code authorized clients sessions revoke endpoint", "744fd34e8049efeb": "link peer another machine vps agents work there handoff pairing code", "3d00c452287f50bd": "add pair backend host code ssh config agent tunnel saved t3 connect", diff --git a/apps/web/src/i18n/translations/es.json b/apps/web/src/i18n/translations/es.json index 3e730353316fe..58a70229908d8 100644 --- a/apps/web/src/i18n/translations/es.json +++ b/apps/web/src/i18n/translations/es.json @@ -23,6 +23,7 @@ "ef9533bcc048f17b": "La política de {organization} no permite T3 Connect.", "986b0873f913a840": "La política de {organization} no permite tareas de webhook.", "eebc538e25b09fe2": "La política de {organization} no permite importar cookies del navegador.", + "7642a133db05f164": "La política de {organization} no permite abrir los servidores locales de esta máquina en otros dispositivos.", "39f6771b49f9b3b6": "Usar valor predeterminado", "45bb0e90e1c42046": "Cuando vuelvas", "d8fa0a55446bbb0d": "Antes de que caduque la caché (beta)", @@ -4195,6 +4196,7 @@ "075398ac562d74b0": "Desconectar la sesión del agente", "1d2025060ba3d1c3": "No se pudo reenviar el puerto {port}", "086ecbb6f4c2e959": "No se puede abrir en el navegador", + "112173d046bfc910": "localhost:{port} se ejecuta en otro equipo y el reenvío de puertos no está disponible para él ahora.", "51052c00ab1ac8cc": "No se puede abrir la vista previa", "0ccd37739f9cf2b6": "No se pudo detener el servidor", "a610a81c4061bb4c": "Servidores", @@ -8005,6 +8007,8 @@ "9bfddd9a835be5de": "servidor", "43b545c01503eee4": "Reintentar actualización", "2f015e6d5459dce9": "Actualizar a {version}", + "8ebba639f92932c3": "Permite que otros dispositivos abran los servidores locales de esta máquina: pestañas del navegador cargadas en el dispositivo, Abrir en este dispositivo y reenvío de puertos. Desactivado: las pestañas del navegador se transmiten desde esta máquina.", + "1c5266bf18d0ed24": "Permitir el túnel de vista previa", "a0e93cca71d0417e": "Clientes autorizados", "03b9501ae07b5cf3": "¿Activar el acceso a la red?", "a09aff32ef3d89c7": "¿Desactivar el acceso a la red?", @@ -11623,6 +11627,8 @@ "b5cd79513a06e7c3": "Retener webhooks sin conexión", "fadd0fcd7b9e1651": "webhook automatizaciones sin conexión cola buzón t3 connect", "9bebacdcfbde18d4": "móvil notificaciones push actividades en directo live activities nube túnel", + "a4e6dee662edc3cf": "Túnel de vista previa", + "8ed7c2a2226f4663": "localhost loopback reenvío de puertos abrir en este dispositivo pestañas navegador transmitir seguridad port forwarding", "1c3e0ac06c8a1f1e": "conexiones servidor backend local remoto acceso administrativo permisos ámbito enlaces de emparejamiento código qr clientes autorizados sesiones revocar endpoint", "744fd34e8049efeb": "vincular par otra máquina vps agentes trabajar allí traspaso código de emparejamiento", "3d00c452287f50bd": "añadir emparejar backend host código ssh config agente túnel guardado t3 connect", diff --git a/apps/web/src/i18n/translations/fr.json b/apps/web/src/i18n/translations/fr.json index 24dba2e932684..829d5654d59e5 100644 --- a/apps/web/src/i18n/translations/fr.json +++ b/apps/web/src/i18n/translations/fr.json @@ -23,6 +23,7 @@ "ef9533bcc048f17b": "La politique de {organization} n’autorise pas T3 Connect.", "986b0873f913a840": "La politique de {organization} n’autorise pas les tâches webhook.", "eebc538e25b09fe2": "La politique de {organization} n’autorise pas l’import des cookies du navigateur.", + "7642a133db05f164": "La stratégie de {organization} n’autorise pas l’ouverture des serveurs locaux de cette machine sur d’autres appareils.", "39f6771b49f9b3b6": "Utiliser la valeur par défaut", "45bb0e90e1c42046": "À votre retour", "d8fa0a55446bbb0d": "Avant l’expiration du cache (bêta)", @@ -4196,6 +4197,7 @@ "075398ac562d74b0": "Déconnecter la session de l’agent", "1d2025060ba3d1c3": "Impossible de rediriger le port {port}", "086ecbb6f4c2e959": "Impossible d’ouvrir dans le navigateur", + "112173d046bfc910": "localhost:{port} tourne sur une autre machine, et la redirection de ports n’est pas disponible pour elle pour le moment.", "51052c00ab1ac8cc": "Impossible d’ouvrir l’aperçu", "0ccd37739f9cf2b6": "Impossible d’arrêter le serveur", "a610a81c4061bb4c": "Serveurs", @@ -8006,6 +8008,8 @@ "9bfddd9a835be5de": "serveur", "43b545c01503eee4": "Réessayer la mise à jour", "2f015e6d5459dce9": "Mettre à jour vers {version}", + "8ebba639f92932c3": "Permet à d’autres appareils d’ouvrir les serveurs locaux de cette machine : onglets de navigateur chargés sur l’appareil, Ouvrir sur cet appareil et redirection de ports. Désactivé : les onglets du navigateur sont diffusés depuis cette machine.", + "1c5266bf18d0ed24": "Autoriser le tunnel d’aperçu", "a0e93cca71d0417e": "Clients autorisés", "03b9501ae07b5cf3": "Activer l’accès réseau ?", "a09aff32ef3d89c7": "Désactiver l’accès réseau ?", @@ -11628,6 +11632,8 @@ "b5cd79513a06e7c3": "Conserver les webhooks hors ligne", "fadd0fcd7b9e1651": "webhook automatisations file d’attente hors ligne boîte aux lettres t3 connect", "9bebacdcfbde18d4": "mobile notifications push live activities tunnel cloud", + "a4e6dee662edc3cf": "Tunnel d’aperçu", + "8ed7c2a2226f4663": "localhost loopback redirection de ports ouvrir sur cet appareil onglets navigateur diffusion sécurité port forwarding", "1c3e0ac06c8a1f1e": "connexions serveur backend local accès distant autorisations administratives portée liens d’appairage code qr clients autorisés sessions révoquer point de terminaison", "744fd34e8049efeb": "associer pair autre machine vps agents y travaillent transfert code d’appairage", "3d00c452287f50bd": "ajouter appairer backend hôte code ssh config agent tunnel enregistré t3 connect", diff --git a/apps/web/src/i18n/translations/ja.json b/apps/web/src/i18n/translations/ja.json index e88cc490a8590..dac6333be5e1a 100644 --- a/apps/web/src/i18n/translations/ja.json +++ b/apps/web/src/i18n/translations/ja.json @@ -23,6 +23,7 @@ "ef9533bcc048f17b": "{organization} のポリシーでは、T3 Connect は許可されていません。", "986b0873f913a840": "{organization} のポリシーでは、Webhook タスクは許可されていません。", "eebc538e25b09fe2": "{organization} のポリシーでは、ブラウザーの Cookie のインポートは許可されていません。", + "7642a133db05f164": "{organization} のポリシーでは、このマシンのローカルサーバーを他のデバイスで開くことは許可されていません。", "39f6771b49f9b3b6": "デフォルトを使用", "45bb0e90e1c42046": "戻ってきたとき", "d8fa0a55446bbb0d": "キャッシュの期限切れ前 (ベータ)", @@ -4186,6 +4187,7 @@ "075398ac562d74b0": "エージェントのセッションを切断", "1d2025060ba3d1c3": "ポート {port} を転送できませんでした", "086ecbb6f4c2e959": "ブラウザーで開けません", + "112173d046bfc910": "localhost:{port} は別のマシンで動いており、現在このポートは転送できません。", "51052c00ab1ac8cc": "プレビューを開けません", "0ccd37739f9cf2b6": "サーバーを停止できませんでした", "a610a81c4061bb4c": "サーバー", @@ -7966,6 +7968,8 @@ "9bfddd9a835be5de": "サーバー", "43b545c01503eee4": "更新を再試行", "2f015e6d5459dce9": "{version} に更新", + "8ebba639f92932c3": "他のデバイスがこのマシンのローカルサーバーを開けるようにします:デバイス上で読み込むブラウザタブ、「このデバイスで開く」、ポートフォワーディング。オフ:ブラウザタブはこのマシンからストリーミングされます。", + "1c5266bf18d0ed24": "プレビュートンネルを許可", "a0e93cca71d0417e": "承認済みクライアント", "03b9501ae07b5cf3": "ネットワークアクセスを有効にしますか?", "a09aff32ef3d89c7": "ネットワークアクセスを無効にしますか?", @@ -11578,6 +11582,8 @@ "b5cd79513a06e7c3": "オフライン中の Webhook を保持", "fadd0fcd7b9e1651": "Webhook オートメーション オフライン キュー メールボックス T3 Connect webhook", "9bebacdcfbde18d4": "モバイル プッシュ通知 ライブアクティビティ クラウド トンネル push", + "a4e6dee662edc3cf": "プレビュートンネル", + "8ed7c2a2226f4663": "localhost ループバック ポートフォワーディング このデバイスで開く ブラウザ タブ ストリーミング セキュリティ port forwarding", "1c3e0ac06c8a1f1e": "接続 サーバー バックエンド ローカル リモート アクセス 管理者 権限 スコープ ペアリングリンク QR コード 認可済みクライアント セッション 取り消し エンドポイント connections", "744fd34e8049efeb": "リンク ピア 別のマシン VPS エージェント そこで作業 引き継ぎ ペアリングコード link machine", "3d00c452287f50bd": "追加 ペアリング バックエンド ホスト コード SSH 構成 エージェント トンネル 保存済み T3 Connect add pair", diff --git a/apps/web/src/i18n/translations/ko.json b/apps/web/src/i18n/translations/ko.json index c80d5dc373208..937913f4ba846 100644 --- a/apps/web/src/i18n/translations/ko.json +++ b/apps/web/src/i18n/translations/ko.json @@ -23,6 +23,7 @@ "ef9533bcc048f17b": "{organization}의 정책상 T3 Connect를 사용할 수 없습니다.", "986b0873f913a840": "{organization}의 정책상 웹후크 작업을 사용할 수 없습니다.", "eebc538e25b09fe2": "{organization}의 정책상 브라우저 쿠키를 가져올 수 없습니다.", + "7642a133db05f164": "{organization}의 정책은 이 컴퓨터의 로컬 서버를 다른 기기에서 여는 것을 허용하지 않습니다.", "39f6771b49f9b3b6": "기본값 사용", "45bb0e90e1c42046": "돌아왔을 때", "d8fa0a55446bbb0d": "캐시가 만료되기 전(베타)", @@ -4183,6 +4184,7 @@ "075398ac562d74b0": "에이전트 세션 연결 끊기", "1d2025060ba3d1c3": "포트 {port}을(를) 포워딩할 수 없습니다", "086ecbb6f4c2e959": "브라우저에서 열 수 없습니다", + "112173d046bfc910": "localhost:{port}는 다른 컴퓨터에서 실행 중이며, 지금은 포트 포워딩을 사용할 수 없습니다.", "51052c00ab1ac8cc": "미리 보기를 열 수 없습니다", "0ccd37739f9cf2b6": "서버를 중지할 수 없습니다", "a610a81c4061bb4c": "서버", @@ -7968,6 +7970,8 @@ "9bfddd9a835be5de": "서버", "43b545c01503eee4": "업데이트 다시 시도", "2f015e6d5459dce9": "{version}(으)로 업데이트", + "8ebba639f92932c3": "다른 기기에서 이 컴퓨터의 로컬 서버를 열 수 있게 합니다: 기기에서 불러오는 브라우저 탭, 이 기기에서 열기, 포트 포워딩. 끄면 브라우저 탭이 이 컴퓨터에서 스트리밍됩니다.", + "1c5266bf18d0ed24": "미리보기 터널 허용", "a0e93cca71d0417e": "승인된 클라이언트", "03b9501ae07b5cf3": "네트워크 액세스를 켤까요?", "a09aff32ef3d89c7": "네트워크 액세스를 끌까요?", @@ -11575,6 +11579,8 @@ "b5cd79513a06e7c3": "오프라인 동안 웹후크 보관", "fadd0fcd7b9e1651": "웹후크 자동화 오프라인 대기열 메일함 T3 Connect", "9bebacdcfbde18d4": "모바일 푸시 알림 실시간 현황 클라우드 터널", + "a4e6dee662edc3cf": "미리보기 터널", + "8ed7c2a2226f4663": "localhost 루프백 포트 포워딩 이 기기에서 열기 브라우저 탭 스트리밍 보안 port forwarding", "1c3e0ac06c8a1f1e": "연결 서버 백엔드 로컬 원격 액세스 관리 권한 범위 페어링 링크 QR 코드 인증된 클라이언트 세션 취소 엔드포인트", "744fd34e8049efeb": "다른 머신 연결 피어 vps 에이전트 원격 작업 넘기기 페어링 코드", "3d00c452287f50bd": "추가 페어링 백엔드 호스트 코드 ssh 구성 에이전트 터널 저장됨 T3 Connect", diff --git a/apps/web/src/i18n/translations/pt-BR.json b/apps/web/src/i18n/translations/pt-BR.json index a2a2daa2b7ccc..6ab44ccc24f70 100644 --- a/apps/web/src/i18n/translations/pt-BR.json +++ b/apps/web/src/i18n/translations/pt-BR.json @@ -23,6 +23,7 @@ "ef9533bcc048f17b": "A política de {organization} não permite o T3 Connect.", "986b0873f913a840": "A política de {organization} não permite tarefas de webhook.", "eebc538e25b09fe2": "A política de {organization} não permite importar cookies do navegador.", + "7642a133db05f164": "A política de {organization} não permite abrir os servidores locais desta máquina em outros dispositivos.", "39f6771b49f9b3b6": "Usar padrão", "45bb0e90e1c42046": "Quando você voltar", "d8fa0a55446bbb0d": "Antes de o cache expirar (beta)", @@ -4195,6 +4196,7 @@ "075398ac562d74b0": "Desconectar a sessão do agente", "1d2025060ba3d1c3": "Não foi possível encaminhar a porta {port}", "086ecbb6f4c2e959": "Não foi possível abrir no navegador", + "112173d046bfc910": "localhost:{port} roda em outra máquina, e o encaminhamento de portas não está disponível para ela agora.", "51052c00ab1ac8cc": "Não foi possível abrir a pré-visualização", "0ccd37739f9cf2b6": "Não foi possível parar o servidor", "a610a81c4061bb4c": "Servidores", @@ -8005,6 +8007,8 @@ "9bfddd9a835be5de": "servidor", "43b545c01503eee4": "Tentar atualizar novamente", "2f015e6d5459dce9": "Atualizar para {version}", + "8ebba639f92932c3": "Permite que outros dispositivos abram os servidores locais desta máquina: abas do navegador carregadas no dispositivo, Abrir neste dispositivo e encaminhamento de portas. Desativado: as abas do navegador são transmitidas desta máquina.", + "1c5266bf18d0ed24": "Permitir o túnel de pré-visualização", "a0e93cca71d0417e": "Clientes autorizados", "03b9501ae07b5cf3": "Ativar o acesso à rede?", "a09aff32ef3d89c7": "Desativar o acesso à rede?", @@ -11627,6 +11631,8 @@ "b5cd79513a06e7c3": "Reter webhooks enquanto offline", "fadd0fcd7b9e1651": "webhook automações offline fila caixa de correio t3 connect", "9bebacdcfbde18d4": "celular notificações push live activities nuvem túnel", + "a4e6dee662edc3cf": "Túnel de pré-visualização", + "8ed7c2a2226f4663": "localhost loopback encaminhamento de portas abrir neste dispositivo abas navegador transmitir segurança port forwarding", "1c3e0ac06c8a1f1e": "conexões servidor backend local remoto acesso administrativo permissões escopo links de pareamento código qr clientes autorizados sessões revogar endpoint", "744fd34e8049efeb": "vincular par outra máquina vps agentes trabalham lá transferir código de pareamento", "3d00c452287f50bd": "adicionar parear backend host código ssh config agente túnel salvo t3 connect", diff --git a/apps/web/src/i18n/translations/ru.json b/apps/web/src/i18n/translations/ru.json index 852b80217f746..ea00719da3b6b 100644 --- a/apps/web/src/i18n/translations/ru.json +++ b/apps/web/src/i18n/translations/ru.json @@ -23,6 +23,7 @@ "ef9533bcc048f17b": "Политика {organization} запрещает T3 Connect.", "986b0873f913a840": "Политика {organization} запрещает задачи по вебхуку.", "eebc538e25b09fe2": "Политика {organization} запрещает импорт cookie браузера.", + "7642a133db05f164": "Политика {organization} не разрешает открывать локальные серверы этого компьютера на других устройствах.", "39f6771b49f9b3b6": "По умолчанию", "45bb0e90e1c42046": "Когда вы вернётесь", "d8fa0a55446bbb0d": "До истечения кеша (бета)", @@ -4195,6 +4196,7 @@ "075398ac562d74b0": "Отключить сеанс агента", "1d2025060ba3d1c3": "Не удалось перенаправить порт {port}", "086ecbb6f4c2e959": "Не удалось открыть в браузере", + "112173d046bfc910": "localhost:{port} работает на другом компьютере, и перенаправление портов для него сейчас недоступно.", "51052c00ab1ac8cc": "Не удалось открыть предпросмотр", "0ccd37739f9cf2b6": "Не удалось остановить сервер", "a610a81c4061bb4c": "Серверы", @@ -8005,6 +8007,8 @@ "9bfddd9a835be5de": "сервер", "43b545c01503eee4": "Повторить обновление", "2f015e6d5459dce9": "Обновить до {version}", + "8ebba639f92932c3": "Позволяет другим устройствам открывать локальные серверы этого компьютера: вкладки браузера, загружаемые на устройстве, «Открыть на этом устройстве» и перенаправление портов. Выключено: вкладки браузера транслируются с этого компьютера.", + "1c5266bf18d0ed24": "Разрешить туннель предпросмотра", "a0e93cca71d0417e": "Авторизованные клиенты", "03b9501ae07b5cf3": "Включить сетевой доступ?", "a09aff32ef3d89c7": "Отключить сетевой доступ?", @@ -11628,6 +11632,8 @@ "b5cd79513a06e7c3": "Удерживать вебхуки в офлайне", "fadd0fcd7b9e1651": "вебхук автоматизации офлайн очередь почтовый ящик t3 connect", "9bebacdcfbde18d4": "мобильные push-уведомления live activities облако туннель", + "a4e6dee662edc3cf": "Туннель предпросмотра", + "8ed7c2a2226f4663": "localhost loopback перенаправление портов открыть на этом устройстве вкладки браузер трансляция безопасность port forwarding", "1c3e0ac06c8a1f1e": "подключения сервер бэкенд локальный удалённый доступ административные разрешения область ссылки сопряжения qr-код авторизованные клиенты сеансы отозвать конечная точка", "744fd34e8049efeb": "привязать другой компьютер vps агенты работают там передача код сопряжения", "3d00c452287f50bd": "добавить сопряжение бэкенд хост код ssh конфигурация агент туннель сохранённые t3 connect", diff --git a/apps/web/src/i18n/translations/sv.json b/apps/web/src/i18n/translations/sv.json index f8c06f7408c75..baf63922386cb 100644 --- a/apps/web/src/i18n/translations/sv.json +++ b/apps/web/src/i18n/translations/sv.json @@ -23,6 +23,7 @@ "ef9533bcc048f17b": "Policyn för {organization} tillåter inte T3 Connect.", "986b0873f913a840": "Policyn för {organization} tillåter inte webhook-uppgifter.", "eebc538e25b09fe2": "Policyn för {organization} tillåter inte import av cookies från webbläsare.", + "7642a133db05f164": "{organization}s policy tillåter inte att den här datorns lokala servrar öppnas på andra enheter.", "39f6771b49f9b3b6": "Använd standard", "45bb0e90e1c42046": "När du kommer tillbaka", "d8fa0a55446bbb0d": "Innan cachen går ut (beta)", @@ -4196,6 +4197,7 @@ "075398ac562d74b0": "Koppla från agentsession", "1d2025060ba3d1c3": "Kunde inte vidarebefordra port {port}", "086ecbb6f4c2e959": "Det gick inte att öppna i webbläsaren", + "112173d046bfc910": "localhost:{port} körs på en annan dator, och portvidarebefordring är inte tillgänglig för den just nu.", "51052c00ab1ac8cc": "Det gick inte att öppna förhandsvisningen", "0ccd37739f9cf2b6": "Kunde inte stoppa servern", "a610a81c4061bb4c": "Servrar", @@ -8011,6 +8013,8 @@ "9bfddd9a835be5de": "server", "43b545c01503eee4": "Försök uppdatera igen", "2f015e6d5459dce9": "Uppdatera till {version}", + "8ebba639f92932c3": "Låter andra enheter öppna den här datorns lokala servrar: webbläsarflikar som läses in på enheten, Öppna på den här enheten och portvidarebefordran. Av: webbläsarflikar strömmas från den här datorn.", + "1c5266bf18d0ed24": "Tillåt förhandsgranskningstunneln", "a0e93cca71d0417e": "Auktoriserade klienter", "03b9501ae07b5cf3": "Aktivera nätverksåtkomst?", "a09aff32ef3d89c7": "Inaktivera nätverksåtkomst?", @@ -11636,6 +11640,8 @@ "b5cd79513a06e7c3": "Håll kvar webhooks i offlineläge", "fadd0fcd7b9e1651": "webhook automatiseringar offline kö brevlåda t3 connect", "9bebacdcfbde18d4": "mobil pushaviseringar liveaktiviteter live activities moln tunnel", + "a4e6dee662edc3cf": "Förhandsgranskningstunnel", + "8ed7c2a2226f4663": "localhost loopback portvidarebefordran öppna på den här enheten webbläsarflikar strömma säkerhet port forwarding", "1c3e0ac06c8a1f1e": "anslutningar server backend lokal fjärråtkomst administrativa behörigheter omfång parkopplingslänkar qr-kod auktoriserade klienter sessioner återkalla slutpunkt", "744fd34e8049efeb": "länka peer annan dator vps agenter arbetar där överlämning parkopplingskod", "3d00c452287f50bd": "lägg till parkoppla backend värd kod ssh-konfiguration agent tunnel sparad t3 connect", diff --git a/apps/web/src/i18n/translations/zh.json b/apps/web/src/i18n/translations/zh.json index 74245c4e54300..8f05fc5be57bc 100644 --- a/apps/web/src/i18n/translations/zh.json +++ b/apps/web/src/i18n/translations/zh.json @@ -23,6 +23,7 @@ "ef9533bcc048f17b": "{organization} 的策略不允许使用 T3 Connect。", "986b0873f913a840": "{organization} 的策略不允许使用 webhook 任务。", "eebc538e25b09fe2": "{organization} 的策略不允许导入浏览器 Cookie。", + "7642a133db05f164": "{organization} 的策略不允许在其他设备上打开此机器的本地服务器。", "39f6771b49f9b3b6": "使用默认值", "45bb0e90e1c42046": "在你回来后", "d8fa0a55446bbb0d": "缓存过期前(测试版)", @@ -4202,6 +4203,7 @@ "075398ac562d74b0": "断开智能体会话", "1d2025060ba3d1c3": "无法转发端口 {port}", "086ecbb6f4c2e959": "无法在浏览器中打开", + "112173d046bfc910": "localhost:{port} 运行在另一台机器上,目前无法为它转发端口。", "51052c00ab1ac8cc": "无法打开预览", "0ccd37739f9cf2b6": "无法停止服务器", "a610a81c4061bb4c": "服务器", @@ -8024,6 +8026,8 @@ "9bfddd9a835be5de": "服务器", "43b545c01503eee4": "重试更新", "2f015e6d5459dce9": "更新到 {version}", + "8ebba639f92932c3": "允许其他设备打开此机器的本地服务器:在设备上加载的浏览器标签页、“在此设备上打开”以及端口转发。关闭后:浏览器标签页从此机器串流。", + "1c5266bf18d0ed24": "允许预览隧道", "a0e93cca71d0417e": "已授权的客户端", "03b9501ae07b5cf3": "启用网络访问?", "a09aff32ef3d89c7": "停用网络访问?", @@ -11652,6 +11656,8 @@ "b5cd79513a06e7c3": "离线时保留 webhook", "fadd0fcd7b9e1651": "webhook 自动化 离线 队列 邮箱 t3 connect", "9bebacdcfbde18d4": "移动 推送通知 实时活动 云 隧道", + "a4e6dee662edc3cf": "预览隧道", + "8ed7c2a2226f4663": "localhost 回环 端口转发 在此设备上打开 浏览器 标签页 串流 安全 port forwarding", "1c3e0ac06c8a1f1e": "连接 服务器 后端 本地 远程 访问 管理员 权限 范围 配对链接 二维码 已授权的客户端 客户端连接 撤销 端点", "744fd34e8049efeb": "关联 对等 另一台机器 vps 智能体 在那里工作 移交 配对码", "3d00c452287f50bd": "添加 配对 后端 主机 代码 ssh 配置 认证代理 隧道 已保存 t3 connect", diff --git a/apps/web/src/state/portForwards.ts b/apps/web/src/state/portForwards.ts index 3a0c767791bfb..477ad39885adb 100644 --- a/apps/web/src/state/portForwards.ts +++ b/apps/web/src/state/portForwards.ts @@ -1,5 +1,9 @@ import { useAtomValue } from "@effect/atom-react"; -import type { DesktopPortForward, EnvironmentId } from "@t3tools/contracts"; +import { + allowsPreviewTunnel, + type DesktopPortForward, + type EnvironmentId, +} from "@t3tools/contracts"; import * as Effect from "effect/Effect"; import * as Option from "effect/Option"; import * as Queue from "effect/Queue"; @@ -49,9 +53,15 @@ export function usePortForwards(): ReadonlyArray { return AsyncResult.getOrElse(useAtomValue(portForwardsAtom), () => EMPTY_FORWARDS); } -/** Only the desktop app forwards, and only from environments it reaches through the tunnel. */ -export const canForwardPorts = (target: ConnectionTarget | undefined): boolean => - previewBridge() !== undefined && tunnelsEnvironmentLoopback(target); +/** Only the desktop app forwards, and only from environments whose tunnel it may use. */ +export const canForwardPorts = (environment: { + readonly entry: { readonly target: ConnectionTarget }; + readonly serverConfig: Parameters[0] | null; +}): boolean => + previewBridge() !== undefined && + tunnelsEnvironmentLoopback(environment.entry.target) && + environment.serverConfig !== null && + allowsPreviewTunnel(environment.serverConfig); /** * Whether the environment runs on another machine. A saved route can still lead back to this diff --git a/docs/internals/remote.md b/docs/internals/remote.md index 585c834d40038..818467de54502 100644 --- a/docs/internals/remote.md +++ b/docs/internals/remote.md @@ -181,6 +181,9 @@ undo by accident: up in `/proc/net/tcp` and refuses other users. macOS and Windows have no such check yet. The mobile app's device preview has the same listener while it is open: iOS suspends other apps, but Android lets any app reach it, and apps cannot see another app's socket owner there. +- **Off stays routed.** `allowsPreviewTunnel` (setting plus policy) gates the route and, from + server config, the clients, which then stream. The partition keeps its tunnel proxy anyway, so a + desktop tab left open fails instead of loading the reviewer's own localhost. - **System browser links** have no tunnel. They keep the private-network rewrite in [`browserTargetResolver.ts`](../../apps/web/src/browser/browserTargetResolver.ts). diff --git a/docs/user/managed-policy.md b/docs/user/managed-policy.md index ab8d7133c5dbd..210f3316e046e 100644 --- a/docs/user/managed-policy.md +++ b/docs/user/managed-policy.md @@ -169,6 +169,7 @@ A few settings need care: "connect": false, "webhookTasks": false, "browserCookieImport": false, + "previewTunnel": false, "telemetry": false, "providers": { "allowedDrivers": ["claudeAgent", "codex"], @@ -250,6 +251,10 @@ so restart T3 Code after that. but do not run, and cannot be turned back on. Users can still edit or delete them. - `browserCookieImport: false`: users cannot import cookies from another browser into T3 Code's browser. +- `previewTunnel: false`: other devices cannot load this machine's `localhost` pages themselves. + Browser tabs stream from it instead, and port forwarding and **Open on this device** are + unavailable. This wins over the user's + [Preview tunnel setting](./remote-access.md#browser-on-a-remote-environment). - `telemetry: false`: the server and desktop app send no [product usage data](./telemetry.md) or relay connection traces. A policy cannot turn them on. A browser that opens the server, such as app.t3.codes, still sends its own relay traces. diff --git a/docs/user/remote-access.md b/docs/user/remote-access.md index 17c6e36df1576..1b80179a3f319 100644 --- a/docs/user/remote-access.md +++ b/docs/user/remote-access.md @@ -330,6 +330,14 @@ and site data on the phone. On iPhone and iPad the page runs under a stand-in address while the address bar shows `localhost`, so browser features that need a secure page, such as the clipboard or service workers, aren't available there. +All of this rides the host's preview tunnel. Turn off **Settings → Sharing & +access → Preview tunnel** on the host to stop other devices from loading its +`localhost` pages themselves: port forwarding and **Open on this device** go +away, and open tunnels close. Tabs keep working by streaming from the host, so +anyone who can use the host's browser tabs can still view its `localhost` pages +there. An administrator can also turn it off with a +[managed policy](./managed-policy.md#other-capabilities). + The first tab downloads a headless Chrome, about 120 MB, into the T3 home. It is the same browser [HTML renders](html-renders.md) use, so a host downloads it only once. Some Linux hosts need [setup](#browser-host-setup) before it can diff --git a/packages/client-runtime/src/contractLabels.ts b/packages/client-runtime/src/contractLabels.ts index 2ff6d7f994c34..bfeb284300b09 100644 --- a/packages/client-runtime/src/contractLabels.ts +++ b/packages/client-runtime/src/contractLabels.ts @@ -129,7 +129,8 @@ export type ManagedCapability = | "remoteClients" | "connect" | "webhookTasks" - | "browserCookieImport"; + | "browserCookieImport" + | "previewTunnel"; function managedCapabilityDeniedMessage( organization: string, @@ -155,6 +156,13 @@ function managedCapabilityDeniedMessage( organization, }), ); + case "previewTunnel": + return resolve( + msg( + "{organization}'s policy does not allow opening this machine's local servers on other devices.", + { organization }, + ), + ); } } diff --git a/packages/contracts/src/environment.ts b/packages/contracts/src/environment.ts index f95b7f8c04b97..a7316a9f0482d 100644 --- a/packages/contracts/src/environment.ts +++ b/packages/contracts/src/environment.ts @@ -146,6 +146,8 @@ export const ExecutionEnvironmentCapabilities = Schema.Struct({ threadStop: Schema.optionalKey(Schema.Boolean), /** Absent on older servers and on Windows hosts, which cannot stop a discovered server. */ localServerStop: Schema.optionalKey(Schema.Boolean), + /** Honors `enablePreviewTunnel`; hide the switch where absent, since the tunnel stays on there. */ + previewTunnelSetting: Schema.optionalKey(Schema.Boolean), threadPullRequests: Schema.optionalKey(Schema.Boolean), threadPullRequestWatch: Schema.optionalKey(Schema.Boolean), pullRequestStackActions: Schema.optionalKey(Schema.Boolean), diff --git a/packages/contracts/src/managedPolicy.ts b/packages/contracts/src/managedPolicy.ts index 7d1c7ed8b8aae..e35f9f6e5c173 100644 --- a/packages/contracts/src/managedPolicy.ts +++ b/packages/contracts/src/managedPolicy.ts @@ -81,6 +81,8 @@ export const ManagedPolicyLimits = Schema.Struct({ /** Can only turn product analytics off, never force it on. */ telemetry: Schema.optionalKey(Schema.Boolean), browserCookieImport: Schema.optionalKey(Schema.Boolean), + /** `false` turns the preview tunnel off: no client reaches this machine's loopback ports. */ + previewTunnel: Schema.optionalKey(Schema.Boolean), providers: Schema.optionalKey(ManagedProviderLimits), updates: Schema.optionalKey(ManagedUpdatesPolicy), }); @@ -95,6 +97,7 @@ export const ManagedPolicySummaryLimits = Schema.Struct({ webhookTasks: Schema.optionalKey(Schema.Boolean), telemetry: Schema.optionalKey(Schema.Boolean), browserCookieImport: Schema.optionalKey(Schema.Boolean), + previewTunnel: Schema.optionalKey(Schema.Boolean), providers: Schema.optionalKey( Schema.Struct({ /** Absent means every driver is allowed. */ @@ -209,6 +212,7 @@ const CAPABILITY_LABELS = { connect: "T3 Connect", webhookTasks: "webhook tasks", browserCookieImport: "importing browser cookies", + previewTunnel: "opening this machine's local servers on other devices", } as const; /** Why a capability is unavailable on an environment with `summary`, or undefined when allowed. */ @@ -227,6 +231,16 @@ export function managedCapabilityDenial( : undefined; } +/** Whether the preview tunnel serves: the setting is on and no policy switches it off. */ +export function allowsPreviewTunnel(config: { + readonly settings: { readonly enablePreviewTunnel: boolean }; + readonly managedPolicy?: ManagedPolicySummary | undefined; +}): boolean { + return ( + config.settings.enablePreviewTunnel && config.managedPolicy?.limits?.previewTunnel !== false + ); +} + /** Whether the policy lets `driver` run; clients name it with their own provider label. */ export function isManagedDriverAllowed( summary: ManagedPolicySummary | undefined, diff --git a/packages/contracts/src/settings.ts b/packages/contracts/src/settings.ts index 678f58294c66a..378b8af0e466f 100644 --- a/packages/contracts/src/settings.ts +++ b/packages/contracts/src/settings.ts @@ -1396,6 +1396,8 @@ export const ServerSettings = Schema.Struct({ ), enableAgentBrowserAccess: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))), + /** Lets clients reach this machine's loopback ports over `/api/preview/tunnel`. */ + enablePreviewTunnel: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))), cloudSpeechCredentials: CloudSpeechCredentials.pipe( Schema.withDecodingDefault(Effect.succeed({ openai: "", xai: "", openrouter: "" })), ), @@ -1858,6 +1860,7 @@ export const ServerSettingsPatch = Schema.Struct({ keepAwakeWhileAgentsWork: Schema.optionalKey(Schema.Boolean), requireConnectDeviceApproval: Schema.optionalKey(Schema.Boolean), enableAgentBrowserAccess: Schema.optionalKey(Schema.Boolean), + enablePreviewTunnel: Schema.optionalKey(Schema.Boolean), cloudSpeechCredentials: Schema.optionalKey( Schema.Struct({ openai: Schema.optionalKey(SettingsSecretValue), @@ -2006,7 +2009,7 @@ export function requiredScopesForServerSettingsPatch( let changesAccess = false; for (const [key, value] of Object.entries(patch)) { if (value === undefined) continue; - if (key === "requireConnectDeviceApproval") { + if (key === "requireConnectDeviceApproval" || key === "enablePreviewTunnel") { changesAccess = true; } else if ( key === "providers" || diff --git a/packages/shared/src/managedPolicyFile.ts b/packages/shared/src/managedPolicyFile.ts index 2f775abb8a02a..e222c7cb94190 100644 --- a/packages/shared/src/managedPolicyFile.ts +++ b/packages/shared/src/managedPolicyFile.ts @@ -114,6 +114,7 @@ export const WINDOWS_POLICY_VALUES = { WebhookTasks: { type: "boolean", path: ["limits", "webhookTasks"] }, Telemetry: { type: "boolean", path: ["limits", "telemetry"] }, BrowserCookieImport: { type: "boolean", path: ["limits", "browserCookieImport"] }, + PreviewTunnel: { type: "boolean", path: ["limits", "previewTunnel"] }, ProviderInstances: { type: "json", path: ["limits", "providers", "instances"] }, UpdatesMode: { type: "string", path: ["limits", "updates", "mode"] }, UpdatesFeedUrl: { type: "string", path: ["limits", "updates", "feedUrl"] }, From 5ee1c2f652edbb488592ec93c3bf0096302803d6 Mon Sep 17 00:00:00 2001 From: Simone Date: Fri, 20 Nov 2026 00:51:07 +0100 Subject: [PATCH 154/201] fix(server): accept Antigravity model IDs with thinking levels when delegating (#39413) Co-authored-by: Simone <185146821+Lucenx9@users.noreply.github.com> Co-authored-by: Julius Marminge --- .../src/mcp/OrchestratorMcpService.test.ts | 57 ++++++++++++++++++- apps/server/src/mcp/OrchestratorMcpService.ts | 31 ++++++++-- 2 files changed, 83 insertions(+), 5 deletions(-) diff --git a/apps/server/src/mcp/OrchestratorMcpService.test.ts b/apps/server/src/mcp/OrchestratorMcpService.test.ts index 0890d5de0340e..2afed50b27c6e 100644 --- a/apps/server/src/mcp/OrchestratorMcpService.test.ts +++ b/apps/server/src/mcp/OrchestratorMcpService.test.ts @@ -4361,6 +4361,7 @@ describe("OrchestratorMcpService provider resolution", () => { () => Effect.gen(function* () { const peerId = ProviderInstanceId.make("codex-subscription-2"); + const antigravityId = ProviderInstanceId.make("antigravity"); const driver = ProviderDriverKind.make("codex"); const inherited = { instanceId: codexInstanceId, @@ -4408,6 +4409,33 @@ describe("OrchestratorMcpService provider resolution", () => { target: { providerInstanceId: peerId, options: { reasoningEffort: "max" } }, expected: { instanceId: peerId, model: inherited.model, options: override }, }, + { + name: "Antigravity model with a thinking suffix", + target: { providerInstanceId: antigravityId, model: "gemini-4-neon-high" }, + expected: { + instanceId: antigravityId, + model: "gemini-4-neon", + options: [{ id: "thought_level", value: "high" }], + }, + }, + { + name: "explicit Antigravity thinking overrides the suffix", + target: { + providerInstanceId: antigravityId, + model: "gemini-4-neon-high", + options: { thought_level: "medium" }, + }, + expected: { + instanceId: antigravityId, + model: "gemini-4-neon", + options: [{ id: "thought_level", value: "medium" }], + }, + }, + { + name: "clear Antigravity suffix options", + target: { providerInstanceId: antigravityId, model: "gemini-4-neon-high", options: {} }, + expected: { instanceId: antigravityId, model: "gemini-4-neon", options: [] }, + }, { name: "old Ultracode effort level", target: { model: "ultracode-model", options: { effort: "ultracode" } }, @@ -4495,8 +4523,35 @@ describe("OrchestratorMcpService provider resolution", () => { ], }, providerSnapshot({ instanceId: peerId, driver, model: inherited.model }), + { + ...providerSnapshot({ + instanceId: antigravityId, + driver: ProviderDriverKind.make("antigravity"), + }), + models: [ + { + slug: "gemini-4-neon", + name: "Gemini 4 Neon", + isCustom: false, + capabilities: { + optionDescriptors: [ + { + id: "thought_level", + role: "reasoning", + label: "Thinking", + type: "select", + options: [ + { id: "medium", label: "Medium" }, + { id: "high", label: "High" }, + ], + }, + ], + }, + }, + ], + }, ]), - adapterRegistryLayer([codexInstanceId, peerId]), + adapterRegistryLayer([codexInstanceId, peerId, antigravityId]), Layer.mock(ProjectService.ProjectService)({ getById: () => Effect.succeedNone }), Layer.mock(SecretRequests.SecretRequests)({}), Layer.mock(RemoteDelegation.RemoteDelegation)({}), diff --git a/apps/server/src/mcp/OrchestratorMcpService.ts b/apps/server/src/mcp/OrchestratorMcpService.ts index c9009d6597671..bd57bebb3fc35 100644 --- a/apps/server/src/mcp/OrchestratorMcpService.ts +++ b/apps/server/src/mcp/OrchestratorMcpService.ts @@ -397,6 +397,23 @@ const advertisedModel = (provider: ServerProvider, model: string) => candidate.aliases?.some((alias) => alias.toLowerCase() === model.toLowerCase()), ); +/** Antigravity 1.3 IDs append the thinking level (`gemini-3.8-flash-high`); the agent still accepts them. */ +function antigravitySuffixedModel(provider: ServerProvider, model: string) { + if (provider.driver !== "antigravity" || advertisedModel(provider, model)) return; + const separator = model.lastIndexOf("-"); + if (separator === -1) return; + const family = model.slice(0, separator); + const value = model.slice(separator + 1); + const thinking = provider.models + .find((candidate) => candidate.slug === family) + ?.capabilities?.optionDescriptors?.find( + (descriptor) => descriptor.type === "select" && descriptor.role === "reasoning", + ); + if (thinking?.type === "select" && thinking.options.some((choice) => choice.id === value)) { + return { model: family, thinking: { id: thinking.id, value } }; + } +} + /** A folder's own provider config can add models that only its workspace snapshot lists. */ export const withWorkspaceModels = ( providers: ReadonlyArray, @@ -1690,7 +1707,10 @@ const make = Effect.gen(function* () { const inheritedSelection = input.parent.thread.modelSelection; const requestedModel = input.target?.model; + const antigravityTarget = + requestedModel === undefined ? undefined : antigravitySuffixedModel(provider, requestedModel); const model = + antigravityTarget?.model ?? requestedModel ?? (instanceId === inheritedSelection.instanceId ? inheritedSelection.model @@ -1701,7 +1721,7 @@ const make = Effect.gen(function* () { `Provider ${instanceId} has no model available for inheritance.`, ); } - if (requestedModel !== undefined) yield* requireAdvertisedModel(provider, requestedModel); + if (requestedModel !== undefined) yield* requireAdvertisedModel(provider, model); const advertised = advertisedModel(provider, model); const descriptors = advertised?.capabilities?.optionDescriptors; const requestedOptions = withLegacyUltracodeEffort(descriptors, input.target?.options); @@ -1725,14 +1745,17 @@ const make = Effect.gen(function* () { descriptors, ) : undefined; - if (requestedOptions !== undefined) { + if (requestedOptions !== undefined || antigravityTarget !== undefined) { const selections = new Map( - (requestedOptions.length === 0 ? [] : (options ?? [])).map((selection) => [ + (requestedOptions?.length === 0 ? [] : (options ?? [])).map((selection) => [ selection.id, selection, ]), ); - for (const selection of requestedOptions) { + if (antigravityTarget !== undefined && requestedOptions?.length !== 0) { + selections.set(antigravityTarget.thinking.id, antigravityTarget.thinking); + } + for (const selection of requestedOptions ?? []) { selections.set(selection.id, selection); } options = [...selections.values()]; From 38bac7091a71eb6e01b63b70f6b1bae7441ed5bc Mon Sep 17 00:00:00 2001 From: Viktor Leukocyte Date: Thu, 19 Nov 2026 23:54:11 +0000 Subject: [PATCH 155/201] fix(client-runtime): an unexpected failure no longer stops the reconnect loop for good (#39420) Co-authored-by: Julius Marminge --- .../src/connection/supervisor.test.ts | 339 +++++++++++++++++- .../src/connection/supervisor.ts | 213 ++++++----- ...ig-stream-failing-while-interrupted.e2e.ts | 85 +++++ 3 files changed, 531 insertions(+), 106 deletions(-) create mode 100644 scripts/scenarios/reconnect-survives-config-stream-failing-while-interrupted.e2e.ts diff --git a/packages/client-runtime/src/connection/supervisor.test.ts b/packages/client-runtime/src/connection/supervisor.test.ts index 46b9757d0cd83..81c8bf4064a45 100644 --- a/packages/client-runtime/src/connection/supervisor.test.ts +++ b/packages/client-runtime/src/connection/supervisor.test.ts @@ -6,14 +6,19 @@ import { } from "@t3tools/contracts"; import { describe, expect, it } from "@effect/vitest"; import { RelayClientTracer } from "@t3tools/shared/relayTracing"; +import * as Cause from "effect/Cause"; import * as Deferred from "effect/Deferred"; import * as Effect from "effect/Effect"; +import * as Exit from "effect/Exit"; import * as Fiber from "effect/Fiber"; import * as Layer from "effect/Layer"; +import * as Logger from "effect/Logger"; import * as Option from "effect/Option"; import * as Queue from "effect/Queue"; import * as Random from "effect/Random"; import * as Ref from "effect/Ref"; +import * as References from "effect/References"; +import * as Scope from "effect/Scope"; import * as Stream from "effect/Stream"; import * as SubscriptionRef from "effect/SubscriptionRef"; import * as Clock from "effect/Clock"; @@ -167,6 +172,18 @@ function awaitState( ); } +function recordLogs(logs: Array, annotations?: Array) { + return Logger.layer( + [ + Logger.make(({ message, fiber }) => { + logs.push(message); + annotations?.push(fiber.getRef(References.CurrentLogAnnotations)); + }), + ], + { mergeWithExisting: false }, + ); +} + const makeHarness = Effect.fn("TestConnectionHarness.make")(function* (options?: { readonly networkStatus?: NetworkStatus; readonly prepare?: ( @@ -174,6 +191,7 @@ const makeHarness = Effect.fn("TestConnectionHarness.make")(function* (options?: target: ConnectionTarget, ) => Effect.Effect; readonly ready?: (attempt: number) => Effect.Effect; + readonly release?: (attempt: number) => Effect.Effect; readonly probe?: (attempt: number) => Effect.Effect; readonly configEvents?: Stream.Stream | undefined; readonly initialConfig?: (attempt: number) => Effect.Effect; @@ -245,7 +263,10 @@ const makeHarness = Effect.fn("TestConnectionHarness.make")(function* (options?: inboundFrames: options?.inboundFrames ?? Effect.succeed(0), closed: Deferred.await(closed), } satisfies RpcSession.RpcSession), - () => Ref.update(releaseCount, (count) => count + 1), + () => + Ref.update(releaseCount, (count) => count + 1).pipe( + Effect.andThen(options?.release?.(attempt) ?? Effect.void), + ), ); yield* reportProgress({ stage: "synchronizing", prepared }); @@ -308,12 +329,12 @@ const makeHarness = Effect.fn("TestConnectionHarness.make")(function* (options?: reason, })), closeLatestSession: Effect.fn("TestConnectionHarness.closeLatestSession")(function* ( - error = transient("Session closed."), + exit: Exit.Exit = Exit.fail(transient("Session closed.")), ) { const sessions = yield* Ref.get(closedSessions); const latest = sessions.at(-1); if (latest) { - yield* Deferred.fail(latest, error); + yield* Deferred.done(latest, exit); } }), }; @@ -581,9 +602,11 @@ describe("EnvironmentSupervisor", () => { ? Effect.die(new Error("Native transport defect.")) : Effect.succeed(PREPARED_CONNECTION), }); + const logs: unknown[] = []; + const annotations: unknown[] = []; const supervisor = yield* EnvironmentSupervisor.make(RELAY_ENTRY, { initiallyDesired: true, - }).pipe(Effect.provide(harness.dependencies)); + }).pipe(Effect.provide(Layer.merge(harness.dependencies, recordLogs(logs, annotations)))); const failed = yield* awaitState( supervisor.state, @@ -596,6 +619,10 @@ describe("EnvironmentSupervisor", () => { message: "Test environment connection failed unexpectedly.", }, }); + expect(logs).toEqual([["Connection attempt failed with an unexpected defect."]]); + expect(annotations).toMatchObject([ + { "environment.id": RELAY_TARGET.environmentId, errorName: "Error" }, + ]); yield* TestClock.adjust("3 seconds"); yield* awaitState(supervisor.state, (state) => state.phase === "connected"); @@ -603,42 +630,322 @@ describe("EnvironmentSupervisor", () => { }).pipe(Effect.provide(TestClock.layer())), ); - it.effect("explicit retry interrupts the current backoff", () => + it.effect.each([ + { + label: "the attempt's network-status read dies", + firstPrepare: Effect.never, + statusDefect: true, + log: "Connection attempt failed with an unexpected defect.", + }, + { + label: "an attempt interrupts itself", + firstPrepare: Effect.interrupt, + statusDefect: false, + log: "Connection attempt failed with an unexpected interruption.", + }, + ])("retries after $label", ({ firstPrepare, statusDefect, log }) => + Effect.gen(function* () { + const harness = yield* makeHarness({ + prepare: (attempt) => (attempt === 1 ? firstPrepare : Effect.succeed(PREPARED_CONNECTION)), + }); + const statusReads = yield* Ref.make(0); + const logs: unknown[] = []; + const annotations: Array> = []; + const supervisor = yield* EnvironmentSupervisor.make(TARGET_ENTRY, { + initiallyDesired: true, + }).pipe( + Effect.provideService( + Connectivity.Connectivity, + Connectivity.Connectivity.of({ + // The supervisor reads once at startup; the second read belongs to the first attempt. + status: Ref.updateAndGet(statusReads, (count) => count + 1).pipe( + Effect.flatMap((count) => + statusDefect && count === 2 + ? Effect.die(new Error("Platform connectivity defect.")) + : Effect.succeed("online" as const), + ), + ), + changes: Stream.never, + }), + ), + Effect.provide(Layer.merge(harness.dependencies, recordLogs(logs, annotations))), + ); + + const failed = yield* awaitState( + supervisor.state, + (state) => state.phase === "backoff" && state.attempt === 1, + ); + expect(failed).toMatchObject({ + generation: 0, + lastFailure: { _tag: "ConnectionTransientError", reason: "transport" }, + }); + expect(logs).toEqual([[log]]); + expect(Object.hasOwn(annotations[0]!, "errorType")).toBe(statusDefect); + + yield* TestClock.adjust("999 millis"); + expect(yield* Ref.get(harness.prepareCount)).toBe(1); + yield* TestClock.adjust("2 seconds"); + yield* awaitState(supervisor.state, (state) => state.phase === "connected"); + expect(yield* Ref.get(harness.prepareCount)).toBe(2); + }).pipe(Effect.provide(TestClock.layer())), + ); + + it.effect.each([ + { + label: "is interrupted", + closed: Exit.interrupt(), + releaseDefect: false, + log: "Connection attempt failed with an unexpected interruption.", + }, + { + label: "fails while interrupted", + closed: Exit.failCause( + Cause.combine(Cause.fail(transient("Session closed.")), Cause.interrupt()), + ), + releaseDefect: false, + log: null, + }, + { + label: "closes while its release defects", + closed: Exit.fail(transient("Session closed.")), + releaseDefect: true, + log: "Connection release failed with an unexpected defect.", + }, + ])("reconnects soon after a stable session $label", ({ closed, releaseDefect, log }) => Effect.gen(function* () { const harness = yield* makeHarness({ prepare: (attempt) => attempt === 1 ? Effect.fail(transient()) : Effect.succeed(PREPARED_CONNECTION), + release: (session) => + releaseDefect && session === 1 + ? Effect.die(new Error("Session release defect.")) + : Effect.void, }); + const logs: unknown[] = []; const supervisor = yield* EnvironmentSupervisor.make(TARGET_ENTRY, { initiallyDesired: true, - }).pipe(Effect.provide(harness.dependencies)); + }).pipe(Effect.provide(Layer.merge(harness.dependencies, recordLogs(logs)))); yield* awaitState(supervisor.state, (state) => state.phase === "backoff"); + yield* TestClock.adjust("2 seconds"); + yield* awaitState( + supervisor.state, + (state) => state.phase === "connected" && state.generation === 1, + ); + yield* TestClock.adjust("1 minute"); + yield* harness.closeLatestSession(closed); + const lost = yield* awaitState(supervisor.state, (state) => state.phase !== "connected"); + expect(logs).toEqual(log === null ? [] : [[log]]); + expect(lost).toMatchObject({ phase: "backoff", generation: 1 }); + expect(lost.retryAt).toBeLessThanOrEqual((yield* Clock.currentTimeMillis) + 250); + + yield* TestClock.adjust("250 millis"); + const replaced = yield* awaitState(supervisor.state, (state) => state.phase === "connected"); + expect(replaced.generation).toBe(2); + }).pipe(Effect.provide(TestClock.layer())), + ); + + it.effect( + "does not reuse a live session's generation when its attempt defects after going live", + () => + Effect.gen(function* () { + const harness = yield* makeHarness({ + prepare: (attempt) => + attempt === 1 ? Effect.fail(transient()) : Effect.succeed(PREPARED_CONNECTION), + }); + let logCalls = 0; + const supervisor = yield* EnvironmentSupervisor.make(TARGET_ENTRY, { + initiallyDesired: true, + }).pipe( + Effect.provide( + Layer.merge( + harness.dependencies, + Logger.layer( + [ + // Logging the lost session's interruption throws, so the attempt itself defects. + Logger.make(() => { + logCalls += 1; + if (logCalls === 1) throw new Error("Logger defect."); + }), + ], + { mergeWithExisting: false }, + ), + ), + ), + ); + + yield* awaitState(supervisor.state, (state) => state.phase === "backoff"); + yield* TestClock.adjust("2 seconds"); + yield* awaitState( + supervisor.state, + (state) => state.phase === "connected" && state.generation === 1, + ); + yield* harness.closeLatestSession(Exit.interrupt()); + const backoff = yield* awaitState(supervisor.state, (state) => state.phase === "backoff"); + expect(backoff).toMatchObject({ generation: 1, lastFailure: null }); + + yield* TestClock.adjust("4 seconds"); + const replaced = yield* awaitState( + supervisor.state, + (state) => state.phase === "connected", + ); + expect(replaced.generation).toBe(2); + }).pipe(Effect.provide(TestClock.layer())), + ); + + it.effect("restarts the loop after a defect outside an attempt", () => + Effect.gen(function* () { + const harness = yield* makeHarness(); + const logs: unknown[] = []; + let randomReads = 0; + const supervisor = yield* EnvironmentSupervisor.make(RELAY_ENTRY, { + initiallyDesired: true, + }).pipe( + Effect.provideService(Random.Random, { + // Both session losses below die here, so the second reaches the restart handler again. + nextDoubleUnsafe: () => { + randomReads += 1; + if (randomReads <= 2) throw new Error("Random defect."); + return 1 - Number.EPSILON; + }, + nextIntUnsafe: () => 0, + }), + Effect.provide(Layer.merge(harness.dependencies, recordLogs(logs))), + ); + + yield* awaitState( + supervisor.state, + (state) => state.phase === "connected" && state.generation === 1, + ); + yield* harness.closeLatestSession(); + const restarted = yield* awaitState(supervisor.state, (state) => state.phase === "backoff"); + expect(logs).toEqual([["Connection loop failed with an unexpected defect."]]); + expect(restarted).toMatchObject({ + attempt: 1, + generation: 1, + lastFailure: { _tag: "ConnectionTransientError", reason: "transport" }, + retryAt: (yield* Clock.currentTimeMillis) + 300_000, + }); + + yield* TestClock.adjust("299999 millis"); + expect(yield* Ref.get(harness.sessionCount)).toBe(1); + yield* TestClock.adjust("1 millis"); + const reconnected = yield* awaitState( + supervisor.state, + (state) => state.phase === "connected", + ); + expect(reconnected.generation).toBe(2); + + yield* harness.setNetworkStatus("offline"); + yield* harness.closeLatestSession(); + const offline = yield* awaitState(supervisor.state, (state) => state.phase !== "connected"); + expect(offline).toMatchObject({ + phase: "offline", + attempt: 1, + lastFailure: { _tag: "ConnectionTransientError", reason: "transport" }, + }); + yield* supervisor.retryNow; - yield* awaitState(supervisor.state, (state) => state.phase === "connected"); + const retried = yield* awaitState(supervisor.state, (state) => state.phase === "connected"); + expect(retried.generation).toBe(3); + }).pipe(Effect.provide(TestClock.layer())), + ); - expect(yield* Ref.get(harness.prepareCount)).toBe(2); - }), + it.effect.each(["connecting", "connected"] as const)( + "stops attempting when its scope closes while %s", + (phase) => + Effect.gen(function* () { + const preparing = yield* Deferred.make(); + const harness = yield* makeHarness({ + prepare: () => + Deferred.succeed(preparing, undefined).pipe( + Effect.andThen( + phase === "connected" ? Effect.succeed(PREPARED_CONNECTION) : Effect.never, + ), + ), + }); + const logs: unknown[] = []; + const scope = yield* Scope.make(); + const supervisor = yield* EnvironmentSupervisor.make(TARGET_ENTRY, { + initiallyDesired: true, + }).pipe( + Effect.provide(Layer.merge(harness.dependencies, recordLogs(logs))), + Scope.provide(scope), + ); + + yield* Deferred.await(preparing); + yield* awaitState(supervisor.state, (state) => state.phase === phase); + // Yielding between finalizers lets the loop run if the queue shuts down before its interrupt. + yield* Scope.close(scope, Exit.void).pipe( + Effect.provideService(References.MaxOpsBeforeYield, 1), + ); + yield* TestClock.adjust("10 minutes"); + expect(logs).toEqual([]); + expect(yield* Ref.get(harness.prepareCount)).toBe(1); + }).pipe(Effect.provide(TestClock.layer())), ); - it.effect("keeps blocked failures idle until an external signal requests another attempt", () => + it.effect("explicit retry interrupts the current backoff", () => Effect.gen(function* () { const harness = yield* makeHarness({ prepare: (attempt) => - attempt === 1 ? Effect.fail(blocked()) : Effect.succeed(PREPARED_CONNECTION), + attempt === 1 ? Effect.fail(transient()) : Effect.succeed(PREPARED_CONNECTION), }); const supervisor = yield* EnvironmentSupervisor.make(TARGET_ENTRY, { initiallyDesired: true, }).pipe(Effect.provide(harness.dependencies)); - yield* awaitState(supervisor.state, (state) => state.phase === "blocked"); - yield* TestClock.adjust("1 hour"); - expect(yield* Ref.get(harness.prepareCount)).toBe(1); - + yield* awaitState(supervisor.state, (state) => state.phase === "backoff"); yield* supervisor.retryNow; yield* awaitState(supervisor.state, (state) => state.phase === "connected"); + expect(yield* Ref.get(harness.prepareCount)).toBe(2); - }).pipe(Effect.provide(TestClock.layer())), + }), + ); + + it.effect.each([ + { label: "fails", cause: Cause.fail(blocked()) }, + { + label: "fails while interrupted", + cause: Cause.combine(Cause.fail(blocked()), Cause.interrupt()), + }, + ])( + "keeps a blocked host that $label idle until an external signal requests another attempt", + ({ cause }) => + Effect.gen(function* () { + const harness = yield* makeHarness(); + const driver = yield* ConnectionDriver.ConnectionDriver.pipe( + Effect.provide(harness.dependencies), + ); + const connects = yield* Ref.make(0); + const supervisor = yield* EnvironmentSupervisor.make(TARGET_ENTRY, { + initiallyDesired: true, + }).pipe( + // The driver keeps only the typed error of a failed route, so the cause is mixed here. + Effect.provideService(ConnectionDriver.ConnectionDriver, { + ...driver, + connect: (entry, reportProgress) => + Ref.updateAndGet(connects, (count) => count + 1).pipe( + Effect.flatMap((count) => + count === 1 ? Effect.failCause(cause) : driver.connect(entry, reportProgress), + ), + ), + }), + Effect.provide(harness.dependencies), + ); + + const failed = yield* awaitState(supervisor.state, (state) => state.lastFailure !== null); + expect(failed).toMatchObject({ + phase: "blocked", + lastFailure: { _tag: "ConnectionBlockedError", detail: "Authentication required." }, + }); + yield* TestClock.adjust("1 hour"); + expect(yield* Ref.get(connects)).toBe(1); + + yield* supervisor.retryNow; + yield* awaitState(supervisor.state, (state) => state.phase === "connected"); + expect(yield* Ref.get(connects)).toBe(2); + }).pipe(Effect.provide(TestClock.layer())), ); it.effect("retries a blocked connection when platform credentials change", () => diff --git a/packages/client-runtime/src/connection/supervisor.ts b/packages/client-runtime/src/connection/supervisor.ts index 58411d795b7fc..79e6802805205 100644 --- a/packages/client-runtime/src/connection/supervisor.ts +++ b/packages/client-runtime/src/connection/supervisor.ts @@ -149,16 +149,6 @@ type EstablishmentEvent = | { readonly _tag: "Interrupted"; readonly resetRetry: boolean } | { readonly _tag: "TimedOut" }; -function exitUnlessInterrupted( - effect: Effect.Effect, -): Effect.Effect, never, R> { - return Effect.matchCauseEffect(effect, { - onFailure: (cause) => - Cause.hasInterrupts(cause) ? Effect.interrupt : Effect.succeed(Exit.failCause(cause)), - onSuccess: (value) => Effect.succeed(Exit.succeed(value)), - }); -} - export interface EnvironmentSupervisorOptions { readonly initiallyDesired?: boolean; readonly learnRoutes?: (input: { @@ -247,37 +237,27 @@ function connectingState( }; } -function failureFromExit( +function failureFromCause( target: ConnectionTarget, - exit: Exit.Exit, + cause: Cause.Cause, established: boolean, stable: boolean, -): AttemptOutcome { - if (Exit.isSuccess(exit) || Cause.hasInterruptsOnly(exit.cause)) { - return { _tag: "Interrupted", established, stable, resetRetry: false }; - } - const typedFailure = exit.cause.reasons.find(Cause.isFailReason); - if (typedFailure) { - return { - _tag: "Failure", - established, - stable, - failure: typedFailure.error, - }; - } +) { return { _tag: "Failure", established, stable, - failure: { - error: new ConnectionTransientError({ - reason: "transport", - ...translatableDetail( - msg("{host} connection failed unexpectedly.", { host: target.label }), - ), - }), - attemptSpan: Option.none(), - }, + failure: cause.reasons.find(Cause.isFailReason)?.error ?? unexpectedFailure(target), + } satisfies AttemptOutcome; +} + +function unexpectedFailure(target: ConnectionTarget): TracedAttemptFailure { + return { + error: new ConnectionTransientError({ + reason: "transport", + ...translatableDetail(msg("{host} connection failed unexpectedly.", { host: target.label })), + }), + attemptSpan: Option.none(), }; } @@ -496,9 +476,27 @@ export const make = Effect.fn("EnvironmentSupervisor.make")(function* ( }), ); + const logUnexpectedFailure = ( + failed: "attempt" | "release" | "loop", + cause: Cause.Cause, + ) => { + const died = cause.reasons.find(Cause.isDieReason); + if (!died && cause.reasons.some(Cause.isFailReason)) return Effect.void; + return Effect.logError( + `Connection ${failed} failed with an unexpected ${died ? "defect" : "interruption"}.`, + ).pipe( + Effect.annotateLogs({ + "environment.id": target.environmentId, + "environment.label": target.label, + "cause.reason_count": cause.reasons.length, + ...(died ? safeErrorLogAttributes(died.defect) : {}), + }), + ); + }; + const reportProgress = Effect.fn("EnvironmentSupervisor.reportProgress")(function* ( attempt: number, - generation: number, + nextGeneration: number, lastFailure: ConnectionAttemptError | null, progress: ConnectionDriver.ConnectionDriverProgress, ) { @@ -506,13 +504,13 @@ export const make = Effect.fn("EnvironmentSupervisor.make")(function* ( yield* SubscriptionRef.set(prepared, Option.some(progress.prepared)); } yield* setState( - connectingState(yield* Ref.get(intent), generation, attempt, lastFailure, progress.stage), + connectingState(yield* Ref.get(intent), nextGeneration, attempt, lastFailure, progress.stage), ); }); const establishConnection = Effect.fnUntraced(function* ( attempt: number, - generation: number, + nextGeneration: number, lastFailure: ConnectionAttemptError | null, synchronizedRoutes: Ref.Ref, ) { @@ -520,7 +518,7 @@ export const make = Effect.fn("EnvironmentSupervisor.make")(function* ( (progress.stage === "synchronizing" ? Ref.update(synchronizedRoutes, (count) => count + 1) : Effect.void - ).pipe(Effect.andThen(reportProgress(attempt, generation, lastFailure, progress))), + ).pipe(Effect.andThen(reportProgress(attempt, nextGeneration, lastFailure, progress))), ); }); @@ -559,7 +557,7 @@ export const make = Effect.fn("EnvironmentSupervisor.make")(function* ( Scope.Scope >, attempt: number, - generation: number, + nextGeneration: number, pendingRetry: Option.Option, ) => { // The span must end with the ConnectionAttemptError itself: the exporter @@ -572,7 +570,7 @@ export const make = Effect.fn("EnvironmentSupervisor.make")(function* ( "environment.id": target.environmentId, "environment.target.kind": target._tag, "connection.attempt": attempt, - "connection.generation": generation, + "connection.generation": nextGeneration, "connection.retry.failure_count": Option.match(pendingRetry, { onNone: () => 0, onSome: (retry) => retry.failureCount, @@ -599,20 +597,25 @@ export const make = Effect.fn("EnvironmentSupervisor.make")(function* ( const establishTracedConnection = Effect.fnUntraced(function* ( attempt: number, - generation: number, + nextGeneration: number, lastFailure: ConnectionAttemptError | null, pendingRetry: Option.Option, synchronizedRoutes: Ref.Ref, ) { if (usesRelay) { return yield* traceRelayEstablishment( - establishConnection(attempt, generation, lastFailure, synchronizedRoutes), + establishConnection(attempt, nextGeneration, lastFailure, synchronizedRoutes), attempt, - generation, + nextGeneration, pendingRetry, ); } - return yield* establishConnection(attempt, generation, lastFailure, synchronizedRoutes).pipe( + return yield* establishConnection( + attempt, + nextGeneration, + lastFailure, + synchronizedRoutes, + ).pipe( Effect.map((lease) => ({ attemptSpan: Option.none(), lease, @@ -946,9 +949,11 @@ export const make = Effect.fn("EnvironmentSupervisor.make")(function* ( } }); + // Advanced as a session goes live and kept across loop restarts, so no two sessions share one. + let generation = 0; const runAttempt = Effect.fnUntraced(function* ( attempt: number, - generation: number, + nextGeneration: number, lastFailure: ConnectionAttemptError | null, pendingRetry: Option.Option, ignoreOffline: boolean, @@ -957,10 +962,10 @@ export const make = Effect.fn("EnvironmentSupervisor.make")(function* ( yield* SubscriptionRef.set(prepared, Option.none()); const synchronizedRoutes = yield* Ref.make(0); const establishment = yield* Effect.raceAllFirst([ - exitUnlessInterrupted( + Effect.exit( establishTracedConnection( attempt, - generation, + nextGeneration, lastFailure, pendingRetry, synchronizedRoutes, @@ -1031,22 +1036,8 @@ export const make = Effect.fn("EnvironmentSupervisor.make")(function* ( } satisfies AttemptOutcome; } if (Exit.isFailure(establishment.exit)) { - const isUnexpectedDefect = - !Cause.hasInterruptsOnly(establishment.exit.cause) && - !establishment.exit.cause.reasons.some(Cause.isFailReason); - const outcome = failureFromExit(target, establishment.exit, false, false); - if (isUnexpectedDefect) { - const defect = establishment.exit.cause.reasons.find(Cause.isDieReason)?.defect; - yield* Effect.logError("Connection attempt failed with an unexpected defect.").pipe( - Effect.annotateLogs({ - "environment.id": target.environmentId, - "environment.label": target.label, - "cause.reason_count": establishment.exit.cause.reasons.length, - ...safeErrorLogAttributes(defect), - }), - ); - } - return outcome; + yield* logUnexpectedFailure("attempt", establishment.exit.cause); + return failureFromCause(target, establishment.exit.cause, false, false); } const active = establishment.exit.value; @@ -1075,7 +1066,7 @@ export const make = Effect.fn("EnvironmentSupervisor.make")(function* ( const connectedLease: ConnectedLease = { ...active.lease, activeRoute: routes.find((route) => connectionRouteId(route.target) === activeRouteId), - generation, + generation: nextGeneration, }; const refusedRouteIds = yield* Ref.updateAndGet(refusedRoutes, (known) => mergeRefusedRoutes( @@ -1086,6 +1077,7 @@ export const make = Effect.fn("EnvironmentSupervisor.make")(function* ( ), ); const connectedAt = yield* Clock.currentTimeMillis; + generation = nextGeneration; yield* SubscriptionRef.set(prepared, Option.some(connectedLease.prepared)); yield* SubscriptionRef.set(session, Option.some(connectedLease.session)); if (options?.learnRoutes !== undefined) { @@ -1097,7 +1089,7 @@ export const make = Effect.fn("EnvironmentSupervisor.make")(function* ( phase: "connected", stage: null, attempt, - generation, + generation: nextGeneration, lastFailure: null, retryAt: null, refusedRouteIds, @@ -1116,7 +1108,7 @@ export const make = Effect.fn("EnvironmentSupervisor.make")(function* ( attemptSpan: active.attemptSpan, })), ), - ).pipe(exitUnlessInterrupted); + ).pipe(Effect.exit); const connectedForMs = (yield* Clock.currentTimeMillis) - connectedAt; if (Exit.isSuccess(connectedExit)) { return { @@ -1126,27 +1118,26 @@ export const make = Effect.fn("EnvironmentSupervisor.make")(function* ( resetRetry: connectedExit.value, } satisfies AttemptOutcome; } - const outcome = failureFromExit( + yield* logUnexpectedFailure("attempt", connectedExit.cause); + const outcome = failureFromCause( target, - connectedExit, + connectedExit.cause, true, connectedForMs >= BACKOFF_RESET_AFTER_MS, ); - if (outcome._tag === "Failure") { - yield* Effect.void.pipe( - Effect.withSpan("EnvironmentSupervisor.connectionLost", { - root: true, - attributes: { - "environment.id": target.environmentId, - "environment.label": target.label, - "environment.target.kind": target._tag, - "connection.connected_ms": connectedForMs, - "connection.failure.reason": outcome.failure.error.reason, - "connection.failure.detail": outcome.failure.error.detail, - }, - }), - ); - } + yield* Effect.void.pipe( + Effect.withSpan("EnvironmentSupervisor.connectionLost", { + root: true, + attributes: { + "environment.id": target.environmentId, + "environment.label": target.label, + "environment.target.kind": target._tag, + "connection.connected_ms": connectedForMs, + "connection.failure.reason": outcome.failure.error.reason, + "connection.failure.detail": outcome.failure.error.detail, + }, + }), + ); return outcome; }, Effect.ensuring(clearLease)); @@ -1185,7 +1176,6 @@ export const make = Effect.fn("EnvironmentSupervisor.make")(function* ( // Approval waits count as attempts but not toward backoff, so a later outage starts low. let backoffFailures = 0; let approvalWaits = 0; - let generation = 0; let latestFailure: ConnectionAttemptError | null = null; let pendingRetry = Option.none(); const resetRetryLadder = () => { @@ -1229,13 +1219,25 @@ export const make = Effect.fn("EnvironmentSupervisor.make")(function* ( const attempt = failureCount + 1; const nextGeneration = generation + 1; - const outcome: AttemptOutcome = yield* Effect.scoped( - runAttempt(attempt, nextGeneration, latestFailure, pendingRetry, ignoreOffline), + const outcome: AttemptOutcome = yield* Effect.acquireUseRelease( + Scope.make(), + (scope) => + runAttempt(attempt, nextGeneration, latestFailure, pendingRetry, ignoreOffline).pipe( + Scope.provide(scope), + Effect.catchCause((cause) => + logUnexpectedFailure("attempt", cause).pipe( + Effect.as(failureFromCause(target, cause, generation === nextGeneration, false)), + ), + ), + ), + (scope, exit) => + Scope.close(scope, exit).pipe( + Effect.catchCause((cause) => logUnexpectedFailure("release", cause)), + ), ); replacing = false; const failedProbe = yield* Ref.getAndSet(probeUnanswered, false); if (outcome.established) { - generation = nextGeneration; // A session came up, so no earlier failure describes the connection. // Losing a live session is not a failed connection either, for example // a socket the OS killed while the app was suspended: its replacement @@ -1327,6 +1329,9 @@ export const make = Effect.fn("EnvironmentSupervisor.make")(function* ( } }); + // Registered before the fibers below so closing the scope interrupts them first. + // A loop still running when the queue shuts down would report that as a failure. + yield* Effect.addFinalizer(() => Queue.shutdown(signals).pipe(Effect.andThen(clearLease))); yield* connectivity.changes.pipe( Stream.runForEach((network) => Ref.modify(intent, (current) => { @@ -1362,7 +1367,37 @@ export const make = Effect.fn("EnvironmentSupervisor.make")(function* ( Effect.forever, Effect.forkScoped, ); - yield* run().pipe(Effect.forkScoped); + // A restarted loop has forgotten its retry ladder, so it waits out the + // ladder's ceiling unless a signal cuts the wait short. + yield* run().pipe( + Effect.catchCause((cause) => + Effect.gen(function* () { + yield* logUnexpectedFailure("loop", cause); + const currentIntent = yield* Ref.get(intent); + const lastFailure = unexpectedFailure(target).error; + yield* setState( + !currentIntent.desired + ? availableState(currentIntent, generation) + : currentIntent.network === "offline" + ? offlineState(currentIntent, generation, 1, lastFailure) + : { + desired: true, + network: currentIntent.network, + phase: "backoff", + stage: null, + attempt: 1, + generation, + lastFailure, + retryAt: (yield* Clock.currentTimeMillis) + RETRY_MAX_DELAY_MS, + refusedRouteIds: NO_REFUSED_ROUTES, + }, + ); + yield* waitForRetrySignal(RETRY_MAX_DELAY_MS); + }), + ), + Effect.forever, + Effect.forkScoped, + ); const connect = Ref.update(intent, (current) => ({ ...current, @@ -1385,8 +1420,6 @@ export const make = Effect.fn("EnvironmentSupervisor.make")(function* ( Effect.withSpan("EnvironmentSupervisor.retryNow"), ); - yield* Effect.addFinalizer(() => Queue.shutdown(signals).pipe(Effect.andThen(clearLease))); - return EnvironmentSupervisor.of({ target, state, diff --git a/scripts/scenarios/reconnect-survives-config-stream-failing-while-interrupted.e2e.ts b/scripts/scenarios/reconnect-survives-config-stream-failing-while-interrupted.e2e.ts new file mode 100644 index 0000000000000..8e6a2606c1ba9 --- /dev/null +++ b/scripts/scenarios/reconnect-survives-config-stream-failing-while-interrupted.e2e.ts @@ -0,0 +1,85 @@ +import { expect } from "e2e"; +import * as Effect from "effect/Effect"; + +import { runPromise, test, WEB } from "./t3.ts"; + +interface Fault { + readonly failConfigStreamWhileInterrupted: () => boolean; +} + +test( + "The app reconnects after its config stream fails while interrupted", + WEB, + async ({ t3, app, screen, browser }) => { + const project = await t3.project("demo"); + const thread = await t3.thread({ + project, + title: "Earlier work", + messages: ["Print the JSON"], + model: "command-output", + }); + // Injected fault: the page hands the app one server frame that ends the config + // subscription with a typed failure and an interruption in the same cause. + await browser.addInitScript(() => { + let deliver: (() => void) | null = null; + const NativeWebSocket = window.WebSocket; + window.WebSocket = class extends NativeWebSocket { + override send(data: Parameters[0]) { + if (typeof data === "string" && data.includes('"tag":"subscribeServerConfig"')) { + const requestId = (JSON.parse(data) as { id: number | string }).id; + deliver = () => + this.dispatchEvent( + new MessageEvent("message", { + data: JSON.stringify({ + _tag: "Exit", + requestId, + exit: { + _tag: "Failure", + cause: [ + { + _tag: "Fail", + error: { + _tag: "KeybindingsConfigParseError", + configPath: "/demo/keybindings.json", + detail: "Injected failure.", + }, + }, + { _tag: "Interrupt", fiberId: 1 }, + ], + }, + }), + }), + ); + } + super.send(data); + } + }; + (window as unknown as { __fault: Fault }).__fault = { + failConfigStreamWhileInterrupted: () => { + deliver?.(); + return deliver !== null; + }, + }; + }); + await browser.emulateMedia({ colorScheme: "dark", reducedMotion: "reduce" }); + await t3.open(thread); + + const reply = screen.getByText("The command printed one JSON line."); + await expect(reply.first()).toBeVisible(); + await app.screenshot("1-connected"); + + const delivered = await browser.evaluate(() => + (window as unknown as { __fault: Fault }).__fault.failConfigStreamWhileInterrupted(), + ); + expect(delivered).toBe(true); + // A live loop reconnects well within each wait; a dead one never does. + await runPromise(Effect.sleep("5 seconds")); + await app.screenshot("2-five-seconds-after-the-failure"); + + await screen.getByRole("textbox").fill("Are you still there?"); + await screen.getByRole("textbox").press("Enter"); + await runPromise(Effect.sleep("3 seconds")); + await app.screenshot("3-after-pressing-enter"); + await expect(reply.nth(1)).toBeVisible(); + }, +); From 490a0d687bde4f29a869fdb62ea7c8241e35e082 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Thu, 19 Nov 2026 16:07:39 -0800 Subject: [PATCH 156/201] fix(server): Antigravity usage skips agy index databases instead of reporting partial history (#39435) --- .../Drivers/antigravityUsageReader.test.ts | 53 +++++++++++-------- .../Drivers/antigravityUsageReader.ts | 7 ++- 2 files changed, 35 insertions(+), 25 deletions(-) diff --git a/apps/server/src/provider/Drivers/antigravityUsageReader.test.ts b/apps/server/src/provider/Drivers/antigravityUsageReader.test.ts index 8fd031d43442e..d0def84f1efe0 100644 --- a/apps/server/src/provider/Drivers/antigravityUsageReader.test.ts +++ b/apps/server/src/provider/Drivers/antigravityUsageReader.test.ts @@ -587,27 +587,38 @@ describe("readAntigravityUsage", () => { }).pipe(Effect.provide(NodeServices.layer)), ); - it.effect("reads Antigravity step-only stores and reports malformed databases", () => - Effect.gen(function* () { - const fileSystem = yield* FileSystem.FileSystem; - const path = yield* Path.Path; - const dir = yield* tempDir; - yield* seedDatabase(path.join(dir, "steps.db"), (db) => - Effect.gen(function* () { - yield* db.exec("CREATE TABLE steps (idx INTEGER, metadata BLOB)"); - const usage = [...protoNumber(1, 246), ...protoNumber(2, 10), ...protoNumber(3, 5)]; - yield* db.run("INSERT INTO steps VALUES (?, ?)", [ - 0, - new Uint8Array([...protoBytes(9, usage), ...protoBytes(8, protoNumber(1, 1780000000))]), - ]); - }), - ); - yield* fileSystem.writeFileString(path.join(dir, "broken.db"), "not a sqlite database"); - const result = yield* readAntigravityUsage(dir, 0); - assert.strictEqual(result.errors.length, 1); - assert.strictEqual(records(result)[0]?.model, "gemini-2.5-pro"); - assert.strictEqual(records(result)[0]?.totals.outputTokens, 5); - }).pipe(Effect.provide(NodeServices.layer)), + it.effect( + "reads Antigravity step-only stores, skips index files and reports malformed databases", + () => + Effect.gen(function* () { + const fileSystem = yield* FileSystem.FileSystem; + const path = yield* Path.Path; + const dir = yield* tempDir; + // agy 1.5.x keeps this index beside its conversations; it is not a conversation store. + yield* seedDatabase(path.join(dir, "conversation_summaries.db"), (db) => + db.exec( + "CREATE TABLE conversation_summaries (conversation_id TEXT PRIMARY KEY, title TEXT, step_count INTEGER)", + ), + ); + yield* seedDatabase(path.join(dir, "steps.db"), (db) => + Effect.gen(function* () { + yield* db.exec("CREATE TABLE steps (idx INTEGER, metadata BLOB)"); + const usage = [...protoNumber(1, 246), ...protoNumber(2, 10), ...protoNumber(3, 5)]; + yield* db.run("INSERT INTO steps VALUES (?, ?)", [ + 0, + new Uint8Array([ + ...protoBytes(9, usage), + ...protoBytes(8, protoNumber(1, 1780000000)), + ]), + ]); + }), + ); + yield* fileSystem.writeFileString(path.join(dir, "broken.db"), "not a sqlite database"); + const result = yield* readAntigravityUsage(dir, 0); + assert.deepStrictEqual(result.errors, [path.join(dir, "broken.db")]); + assert.strictEqual(records(result)[0]?.model, "gemini-2.5-pro"); + assert.strictEqual(records(result)[0]?.totals.outputTokens, 5); + }).pipe(Effect.provide(NodeServices.layer)), ); it.effect("ignores large values in unused Antigravity protobuf fields", () => diff --git a/apps/server/src/provider/Drivers/antigravityUsageReader.ts b/apps/server/src/provider/Drivers/antigravityUsageReader.ts index 532233f7facce..4a71c8ed2b056 100644 --- a/apps/server/src/provider/Drivers/antigravityUsageReader.ts +++ b/apps/server/src/provider/Drivers/antigravityUsageReader.ts @@ -253,9 +253,8 @@ const readDatabase = Effect.fn("readDatabase")(function* ( "SELECT name FROM sqlite_master WHERE type = 'table'", )).map((row) => row.name), ); - if (!tables.has("gen_metadata") && !tables.has("steps")) { - return yield* new AntigravityDatabaseDecodeError({ path }); - } + // Not a conversation store, e.g. agy's conversation_summaries.db index. + if (!tables.has("gen_metadata") && !tables.has("steps")) return null; // Seek by rowid regardless of indexes; idx normally aliases rowid, but sort for layouts where it does not. const readMetadata = Effect.fnUntraced(function* ( query: string, @@ -421,7 +420,7 @@ export const readAntigravityUsage = Effect.fn("readAntigravityUsage")(function* const files: Array<{ root: string; path: string; records: UsageRecord[] }> = []; const errors: string[] = []; const models = new Map(); - const pending: Array<{ data: CachedDatabase["data"]; fileIndex: number }> = []; + const pending: Array<{ data: NonNullable; fileIndex: number }> = []; const identities = new Map(); const groups: Array< UsageCandidate & { parent: number; size: number; owner: number; fileIndex: number } From 5872b0a488847d12aa2351fe5af5e7b7b81077ab Mon Sep 17 00:00:00 2001 From: shivam <91240327+shivamhwp@users.noreply.github.com> Date: Fri, 20 Nov 2026 05:57:15 +0530 Subject: [PATCH 157/201] fix(web): a later thread error with the same text shows its banner again (#37419) Co-authored-by: Claude Haiku 5.5 Co-authored-by: Julius Marminge --- .../web/src/components/ChatView.logic.test.ts | 37 ++++++++++++++++ apps/web/src/components/ChatView.logic.ts | 12 +++++ apps/web/src/components/ChatView.tsx | 18 +++++++- .../chat/ThreadErrorBanner.test.tsx | 17 +++++++ .../src/components/chat/ThreadErrorBanner.tsx | 8 +++- packages/client-runtime/src/state/models.ts | 2 + .../src/state/threadExecution.test.ts | 39 ++++++++++++++++ .../src/state/threadExecution.ts | 44 +++++++++++++++++-- .../shared/src/orchestrationV2ThreadError.ts | 9 +++- 9 files changed, 177 insertions(+), 9 deletions(-) diff --git a/apps/web/src/components/ChatView.logic.test.ts b/apps/web/src/components/ChatView.logic.test.ts index dbbb445a5ec95..298a7c9b44f01 100644 --- a/apps/web/src/components/ChatView.logic.test.ts +++ b/apps/web/src/components/ChatView.logic.test.ts @@ -22,6 +22,7 @@ import { isThreadEnvironmentLocked, recallCheckoutIsRepo, rememberCheckoutIsRepo, + threadErrorIsServerRuntime, } from "./ChatView.logic"; import { ProviderDriverKind, type ServerProvider } from "@t3tools/contracts"; import { deriveProviderInstanceEntries } from "../providerInstances"; @@ -1640,3 +1641,39 @@ describe("prepareRevertedMessageAttachments", () => { expect(store.getComposerDraft(target)?.images.map(({ id }) => id)).toEqual(["restored"]); }); }); + +describe("threadErrorIsServerRuntime", () => { + it("is true for a server thread's runtime error, and for a local copy of that same error", () => { + expect( + threadErrorIsServerRuntime({ + isServerThread: true, + localServerError: null, + runtimeError: "E", + }), + ).toBe(true); + expect( + threadErrorIsServerRuntime({ + isServerThread: true, + localServerError: "E", + runtimeError: "E", + }), + ).toBe(true); + }); + + it("is false for a local error that differs from the runtime error, and for draft threads", () => { + expect( + threadErrorIsServerRuntime({ + isServerThread: true, + localServerError: "E2", + runtimeError: "E", + }), + ).toBe(false); + expect( + threadErrorIsServerRuntime({ + isServerThread: false, + localServerError: null, + runtimeError: "E", + }), + ).toBe(false); + }); +}); diff --git a/apps/web/src/components/ChatView.logic.ts b/apps/web/src/components/ChatView.logic.ts index 1992b748331a2..1f8bb8e10043c 100644 --- a/apps/web/src/components/ChatView.logic.ts +++ b/apps/web/src/components/ChatView.logic.ts @@ -1242,6 +1242,18 @@ export function chatActionErrorMessage(error: unknown, resolve: MessageResolver return thrownErrorMessage(error, resolve) ?? resolve(msg("An error occurred.")); } +/** A local copy of the runtime's error shares the runtime's key, so one dismissal covers both. */ +export function threadErrorIsServerRuntime(input: { + readonly isServerThread: boolean; + readonly localServerError: string | null; + readonly runtimeError: string | null; +}): boolean { + return ( + input.isServerThread && + (input.localServerError === null || input.localServerError === input.runtimeError) + ); +} + export function releaseChatTimelineAnchor( current: T, ): T { diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx index 1e1646e3123e6..128f3b16d1dde 100644 --- a/apps/web/src/components/ChatView.tsx +++ b/apps/web/src/components/ChatView.tsx @@ -41,7 +41,11 @@ import { ThreadFind, ThreadFindCanvas } from "./chat/ThreadFindProvider"; import { closeThreadFind, openThreadFind, useThreadFindOpen } from "./chat/threadFindStore"; import { THREAD_FIND_BAR_RESERVED_HEIGHT } from "./chat/ThreadFindBar"; import { usageLimitRecoveryBannerItem } from "./chat/UsageLimitRecoveryBanner"; -import { isThreadEnvironmentLocked, resolveDraftHeroState } from "./ChatView.logic"; +import { + isThreadEnvironmentLocked, + resolveDraftHeroState, + threadErrorIsServerRuntime, +} from "./ChatView.logic"; import { useQueuedRunEdit } from "./chat/useQueuedRunEdit"; import { recallCheckoutIsRepo, rememberCheckoutIsRepo } from "./ChatView.logic"; import { useLogicalProjectEnvironments } from "../hooks/useLogicalProjectEnvironments"; @@ -979,7 +983,17 @@ export default function ChatView(props: ChatViewProps) { const threadError = isServerThread ? (localServerError ?? serverRuntime?.lastError ?? null) : localDraftError; - const threadErrorBannerKey = getThreadErrorBannerKey(routeThreadKey, threadError); + const threadErrorBannerKey = getThreadErrorBannerKey( + routeThreadKey, + threadError, + threadErrorIsServerRuntime({ + isServerThread, + localServerError, + runtimeError: serverRuntime?.lastError ?? null, + }) + ? (serverRuntime?.lastErrorSource ?? null) + : null, + ); const visibleThreadError = shouldShowThreadErrorBanner( routeThreadKey, threadError, diff --git a/apps/web/src/components/chat/ThreadErrorBanner.test.tsx b/apps/web/src/components/chat/ThreadErrorBanner.test.tsx index f43f03ad46db0..efa15aaf6bf21 100644 --- a/apps/web/src/components/chat/ThreadErrorBanner.test.tsx +++ b/apps/web/src/components/chat/ThreadErrorBanner.test.tsx @@ -42,4 +42,21 @@ describe("ThreadErrorBanner", () => { ), ).toBe(true); }); + + it("reappears when a later run fails with the same error on the same thread", () => { + const error = "Turn failed"; + const dismissedKey = getThreadErrorBannerKey("env:thread-c", error, "run-a"); + dismissThreadErrorBannerForSession(dismissedKey); + const laterRunKey = getThreadErrorBannerKey("env:thread-c", error, "run-b"); + + expect(isThreadErrorBannerDismissedForSession(dismissedKey)).toBe(true); + expect(isThreadErrorBannerDismissedForSession(laterRunKey)).toBe(false); + expect( + shouldShowThreadErrorBanner( + "env:thread-c", + error, + isThreadErrorBannerDismissedForSession(laterRunKey), + ), + ).toBe(true); + }); }); diff --git a/apps/web/src/components/chat/ThreadErrorBanner.tsx b/apps/web/src/components/chat/ThreadErrorBanner.tsx index 8d6ebc71fa435..f4a4bc484ffe5 100644 --- a/apps/web/src/components/chat/ThreadErrorBanner.tsx +++ b/apps/web/src/components/chat/ThreadErrorBanner.tsx @@ -51,8 +51,12 @@ export function getThreadErrorBannerMessage(error: string): string { : error; } -export function getThreadErrorBannerKey(threadKey: string, error: string | null): string | null { - return error === null ? null : `${threadKey}\u0000${error}`; +export function getThreadErrorBannerKey( + threadKey: string, + error: string | null, + source: string | null = null, +): string | null { + return error === null ? null : `${threadKey}\u0000${source ?? ""}\u0000${error}`; } export function shouldShowThreadErrorBanner( diff --git a/packages/client-runtime/src/state/models.ts b/packages/client-runtime/src/state/models.ts index b37da2abe28b2..4401f90e898c3 100644 --- a/packages/client-runtime/src/state/models.ts +++ b/packages/client-runtime/src/state/models.ts @@ -114,6 +114,8 @@ export interface ThreadRuntimeSummary { readonly lastError: string | null; readonly lastErrorClass?: OrchestrationV2ProviderFailureClass | null; readonly lastErrorCode?: string | null; + /** The record `lastError` came from, with its change time so a repeated failure differs. */ + readonly lastErrorSource?: string | null; readonly usageLimitResetAt?: string | null; readonly updatedAt: string; } diff --git a/packages/client-runtime/src/state/threadExecution.test.ts b/packages/client-runtime/src/state/threadExecution.test.ts index b03236959d786..2984bb97dbaeb 100644 --- a/packages/client-runtime/src/state/threadExecution.test.ts +++ b/packages/client-runtime/src/state/threadExecution.test.ts @@ -179,7 +179,46 @@ describe("thread execution presentation", () => { expect(deriveThreadRuntime(projection)).toMatchObject({ lastError: "Plan limit reached", lastErrorClass: "usage_limit", + lastErrorSource: "limit-error@2026-07-28T10:00:00.000Z", }); + // A retried run fails again through the same item, so only its failure time tells it apart. + const later = DateTime.makeUnsafe("2026-07-28T10:05:00.000Z"); + const source = (input: Partial[0]>) => + deriveThreadRuntime({ ...projection, ...input })?.lastErrorSource; + expect(source({ turnItems: [{ ...item, completedAt: later, updatedAt: later }] })).toBe( + "limit-error@2026-07-28T10:05:00.000Z", + ); + expect(source({ turnItems: [{ ...item, updatedAt: later }] })).toBe( + "limit-error@2026-07-28T10:00:00.000Z", + ); + const session = (lastError: string) => ({ + id: ProviderSessionId.make("failed-session"), + driver: ProviderDriverKind.make("pi"), + providerInstanceId: v2Projection.thread.providerInstanceId, + status: "error" as const, + cwd: "/repo", + model: null, + capabilities: {} as never, + createdAt: now, + updatedAt: later, + lastError, + }); + // A session that repeats the failure keeps its source, whatever the session's own updates. + expect(source({ providerSessions: [session("Plan limit reached")] })).toBe( + "limit-error@2026-07-28T10:00:00.000Z", + ); + // Otherwise a session error belongs to the latest ended run, kept while a newer run starts. + const ended = { ...failed, completedAt: now }; + const starting = [ended, run("next", 2, "starting")]; + expect(source({ runs: [ended], providerSessions: [session("Session failed")] })).toBe( + "limited@2026-07-28T10:00:00.000Z", + ); + expect(source({ runs: starting, providerSessions: [session("Session failed")] })).toBe( + "limited@2026-07-28T10:00:00.000Z", + ); + expect(source({ runs: starting, providerSessions: [session("Plan limit reached")] })).toBe( + "limit-error@2026-07-28T10:00:00.000Z", + ); expect(deriveResumableRunId(projection, deriveThreadRuntime(projection))).toBe(failed.id); expect( deriveThreadRuntime({ diff --git a/packages/client-runtime/src/state/threadExecution.ts b/packages/client-runtime/src/state/threadExecution.ts index de0c2672cbde8..033930e254f57 100644 --- a/packages/client-runtime/src/state/threadExecution.ts +++ b/packages/client-runtime/src/state/threadExecution.ts @@ -1,6 +1,7 @@ import { latestExecutedRun, latestRootProviderFailure, + latestRootProviderFailureItem, latestUnheldRun, threadErrorSummary, usageLimitRunPresentedAsLatest, @@ -405,6 +406,8 @@ export function deriveThreadStructureRuntime( if (latestRun === null && !backgroundWorkHoldsRun) return null; const activeRunId = latestMatchingRun(projection, (run) => INTERRUPTIBLE_RUN_STATUSES.has(run.status))?.id ?? null; + const failureItem = latestRootProviderFailureItem(latestRunProjection, projection.turnItems); + const sessionError = providerSession?.lastError ?? null; return { status: usageLimitedRun ? "failed" @@ -418,13 +421,46 @@ export function deriveThreadStructureRuntime( : DateTime.formatIso(orchestrationV2RunWorkStartedAt(liveActivityRun)), providerInstanceId: projection.thread.providerInstanceId, providerName: providerSession?.driver ?? null, - ...threadErrorSummary( - latestRootProviderFailure(latestRunProjection, projection.turnItems), - providerSession?.lastError ?? null, - ), + ...threadErrorSummary(failureItem?.failure ?? null, sessionError), + lastErrorSource: threadErrorSource(failureItem, sessionError, projection), }; } +const isoOrEmpty = (at: DateTime.Utc | null) => (at === null ? "" : DateTime.formatIso(at)); + +/** + * A session error belongs to the latest ended run, as that run's failure when the text matches. + * Session timestamps are not used: providers rewrite them on unrelated updates. + */ +function threadErrorSource( + failureItem: ReturnType, + sessionError: string | null, + projection: Pick, +): string | null { + const itemSource = (item: NonNullable) => + `${item.id}@${isoOrEmpty(item.completedAt)}`; + if ( + failureItem !== null && + (sessionError === null || sessionError === failureItem.failure.message) + ) { + return itemSource(failureItem); + } + if (sessionError === null) return null; + let ended: ThreadStructure["runs"][number] | null = null; + for (const run of projection.runs) { + if (run.status !== "failed" && run.status !== "completed") continue; + if (ended === null || run.ordinal > ended.ordinal) ended = run; + } + if (ended === null) return null; + const endedFailure = + failureItem?.runId === ended.id + ? failureItem + : latestRootProviderFailureItem(ended, projection.turnItems); + return endedFailure?.failure.message === sessionError + ? itemSource(endedFailure) + : `${ended.id}@${isoOrEmpty(ended.completedAt)}`; +} + export interface UsageLimitNoticeRows { readonly itemIds: ReadonlySet; /** Hidden only when its text reads as the provider's limit message; see PROVIDER_LIMIT_NOTICE. */ diff --git a/packages/shared/src/orchestrationV2ThreadError.ts b/packages/shared/src/orchestrationV2ThreadError.ts index 141d73f402540..8987593a0b0a5 100644 --- a/packages/shared/src/orchestrationV2ThreadError.ts +++ b/packages/shared/src/orchestrationV2ThreadError.ts @@ -15,6 +15,13 @@ export function latestRootProviderFailure( run: OrchestrationV2Run | null, turnItems: ReadonlyArray, ): OrchestrationV2ProviderFailure | null { + return latestRootProviderFailureItem(run, turnItems)?.failure ?? null; +} + +export function latestRootProviderFailureItem( + run: OrchestrationV2Run | null, + turnItems: ReadonlyArray, +): ErrorTurnItem | null { if (run?.status !== "failed") return null; let latest: ErrorTurnItem | null = null; for (const item of turnItems) { @@ -34,7 +41,7 @@ export function latestRootProviderFailure( latest = item; } } - return latest?.failure ?? null; + return latest; } export function threadErrorSummary( From 003d53ace1f5255eaca52486e35d58fbd299e22e Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Thu, 19 Nov 2026 16:38:38 -0800 Subject: [PATCH 158/201] fix(client-runtime): connection supervisor restarts its background listeners after a defect (#39431) --- .../src/connection/supervisor.test.ts | 120 ++++++++++++++++++ .../src/connection/supervisor.ts | 86 ++++++++----- 2 files changed, 176 insertions(+), 30 deletions(-) diff --git a/packages/client-runtime/src/connection/supervisor.test.ts b/packages/client-runtime/src/connection/supervisor.test.ts index 81c8bf4064a45..c8e241f8f69c0 100644 --- a/packages/client-runtime/src/connection/supervisor.test.ts +++ b/packages/client-runtime/src/connection/supervisor.test.ts @@ -2936,3 +2936,123 @@ describe("EnvironmentSupervisor routes", () => { }), ); }); + +describe("EnvironmentSupervisor background fibers", () => { + it.effect("hears the network return after its connectivity stream died", () => + Effect.gen(function* () { + const harness = yield* makeHarness(); + const status = yield* SubscriptionRef.make("offline"); + const subscriptions = yield* Ref.make(0); + const dying = Connectivity.Connectivity.of({ + status: SubscriptionRef.get(status), + changes: Stream.unwrap( + Ref.updateAndGet(subscriptions, (count) => count + 1).pipe( + Effect.map((count) => + count === 1 + ? Stream.die(new Error("platform connectivity stream died")) + : SubscriptionRef.changes(status), + ), + ), + ), + }); + const supervisor = yield* EnvironmentSupervisor.make(RELAY_ENTRY, { + initiallyDesired: true, + }).pipe( + Effect.provideService(Connectivity.Connectivity, dying), + Effect.provide(harness.dependencies), + ); + yield* TestClock.adjust("10 minutes"); + expect((yield* SubscriptionRef.get(supervisor.state)).phase).toBe("offline"); + + yield* SubscriptionRef.set(status, "online"); + yield* TestClock.adjust("10 minutes"); + expect((yield* SubscriptionRef.get(supervisor.state)).phase).toBe("connected"); + }).pipe(Effect.provide(TestClock.layer())), + ); + + it.effect("replaces a stalled session on return to the app after its wakeup stream died", () => + Effect.gen(function* () { + const harness = yield* makeHarness({ probe: () => Effect.never }); + const returns = yield* SubscriptionRef.make(0); + const subscriptions = yield* Ref.make(0); + const dying = ConnectionWakeups.ConnectionWakeups.of({ + changes: Stream.unwrap( + Ref.updateAndGet(subscriptions, (count) => count + 1).pipe( + Effect.map((count) => + count === 1 + ? Stream.die(new Error("platform wakeup stream died")) + : SubscriptionRef.changes(returns).pipe( + Stream.drop(1), + Stream.map(() => "application-active" as const), + ), + ), + ), + ), + }); + const supervisor = yield* EnvironmentSupervisor.make(TARGET_ENTRY, { + initiallyDesired: true, + }).pipe( + Effect.provideService(ConnectionWakeups.ConnectionWakeups, dying), + Effect.provide(harness.dependencies), + ); + yield* TestClock.adjust("10 minutes"); + expect(yield* SubscriptionRef.get(supervisor.state)).toMatchObject({ + phase: "connected", + generation: 1, + }); + + // The user returns to the app; the session's probe never answers. + yield* SubscriptionRef.update(returns, (count) => count + 1); + yield* TestClock.adjust("15 seconds"); + yield* TestClock.adjust("15 seconds"); + yield* TestClock.adjust("10 minutes"); + expect(yield* SubscriptionRef.get(supervisor.state)).toMatchObject({ + phase: "connected", + generation: 2, + }); + }).pipe(Effect.provide(TestClock.layer())), + ); + + it.effect("still moves to a better route after one route check crashed", () => + Effect.gen(function* () { + const lanReachable = yield* Ref.make(false); + const preflights = yield* Ref.make(0); + const harness = yield* makeHarness({ + checkRoute: (route) => + route.target._tag === "BearerConnectionTarget" + ? Ref.get(lanReachable).pipe( + Effect.map((reachable) => (reachable ? "answered" : "silent")), + ) + : Effect.succeed("unchecked"), + preflight: () => + Ref.updateAndGet(preflights, (count) => count + 1).pipe( + Effect.flatMap((count) => + count === 1 + ? Effect.die(new Error("route check threw")) + : Ref.get(lanReachable).pipe( + Effect.map((reachable) => (reachable ? "ready" : "silent")), + ), + ), + ), + prepare: (_attempt, target) => Effect.succeed(preparedFor(target)), + }); + const supervisor = yield* EnvironmentSupervisor.make(LAN_THEN_RELAY_ENTRY, { + initiallyDesired: true, + }).pipe(Effect.provide(harness.dependencies)); + yield* awaitState( + supervisor.state, + (state) => state.phase === "connected" && state.generation === 1, + ); + yield* TestClock.adjust("60 seconds"); + expect(yield* Ref.get(preflights)).toBeGreaterThanOrEqual(1); + + yield* Ref.set(lanReachable, true); + for (let minute = 0; minute < 60; minute += 1) { + yield* TestClock.adjust("60 seconds"); + } + expect(Option.getOrThrow(yield* SubscriptionRef.get(supervisor.prepared)).target._tag).toBe( + "BearerConnectionTarget", + ); + }).pipe(Effect.provide(TestClock.layer())), + ); +}); diff --git a/packages/client-runtime/src/connection/supervisor.ts b/packages/client-runtime/src/connection/supervisor.ts index 79e6802805205..0964db0359b18 100644 --- a/packages/client-runtime/src/connection/supervisor.ts +++ b/packages/client-runtime/src/connection/supervisor.ts @@ -1332,40 +1332,66 @@ export const make = Effect.fn("EnvironmentSupervisor.make")(function* ( // Registered before the fibers below so closing the scope interrupts them first. // A loop still running when the queue shuts down would report that as a failure. yield* Effect.addFinalizer(() => Queue.shutdown(signals).pipe(Effect.andThen(clearLease))); - yield* connectivity.changes.pipe( - Stream.runForEach((network) => - Ref.modify(intent, (current) => { - const next = targetNetwork(network); - return current.network === next - ? [false, current] - : ([true, { ...current, network: next }] as const); - }).pipe( - Effect.flatMap((changed) => - changed - ? (network === "offline" ? Effect.void : forgetSilentRoutes).pipe( - Effect.andThen(signal({ _tag: "NetworkChanged", network })), - ) - : Effect.void, - ), + // A defect in a background listener would otherwise end it for good, silently. + // Untraced: a span here would stay open for the supervisor's whole lifetime. + const keepRunning = Effect.fnUntraced( + function* (task: string, effect: Effect.Effect, onRestart?: Effect.Effect) { + let current = effect; + while (true) { + const exit = yield* Effect.exit(current); + if (Exit.isSuccess(exit) || Cause.hasInterruptsOnly(exit.cause)) return yield* exit; + yield* Effect.logError("Connection supervisor task failed; restarting it.").pipe( + Effect.annotateLogs({ + "environment.id": target.environmentId, + "environment.label": target.label, + task, + ...safeErrorLogAttributes(exit.cause.reasons.find(Cause.isDieReason)?.defect), + }), + ); + yield* Effect.sleep(RETRY_BASE_DELAY_MS); + current = onRestart ? onRestart.pipe(Effect.andThen(effect)) : effect; + } + }, + (self) => Effect.forkScoped(self), + ); + + const applyNetwork = (network: NetworkStatus) => + Ref.modify(intent, (current) => { + const next = targetNetwork(network); + return current.network === next + ? [false, current] + : ([true, { ...current, network: next }] as const); + }).pipe( + Effect.flatMap((changed) => + changed + ? (network === "offline" ? Effect.void : forgetSilentRoutes).pipe( + Effect.andThen(signal({ _tag: "NetworkChanged", network })), + ) + : Effect.void, ), - ), - Effect.forkScoped, + ); + // A restarted listener may have missed changes while it was down. + yield* keepRunning( + "network-listener", + connectivity.changes.pipe(Stream.runForEach(applyNetwork)), + connectivity.status.pipe(Effect.flatMap(applyNetwork)), ); - yield* wakeups.changes.pipe( - Stream.filter(ConnectionWakeups.reachesConnectionSupervisor), - Stream.runForEach((reason) => - // A long suspension can hide a network change the platform never reported. - (reason === "network-changed" || reason === "application-active-long" - ? forgetSilentRoutes - : Effect.void - ).pipe(Effect.andThen(signal({ _tag: "Wakeup", reason }))), + yield* keepRunning( + "wakeup-listener", + wakeups.changes.pipe( + Stream.filter(ConnectionWakeups.reachesConnectionSupervisor), + Stream.runForEach((reason) => + // A long suspension can hide a network change the platform never reported. + (reason === "network-changed" || reason === "application-active-long" + ? forgetSilentRoutes + : Effect.void + ).pipe(Effect.andThen(signal({ _tag: "Wakeup", reason }))), + ), ), - Effect.forkScoped, ); - yield* Queue.take(betterRouteChecks).pipe( - Effect.flatMap(checkBetterRoutes), - Effect.forever, - Effect.forkScoped, + yield* keepRunning( + "better-route-checker", + Queue.take(betterRouteChecks).pipe(Effect.flatMap(checkBetterRoutes), Effect.forever), ); // A restarted loop has forgotten its retry ladder, so it waits out the // ladder's ceiling unless a signal cuts the wait short. From 57e92b0b98725a2e4ea60790f550b1915b0ac8c2 Mon Sep 17 00:00:00 2001 From: Yash Singh Date: Thu, 19 Nov 2026 18:46:58 -0600 Subject: [PATCH 159/201] fix(cursor): Max Mode tiers keep working after Cursor changes a model (#39453) Co-authored-by: Cursor --- .../provider-cursor/src/server/adapter.ts | 7 +++- packages/provider-cursor/src/server/driver.ts | 17 ++++++++ .../src/server/sdkModel.test.ts | 33 +++++++++++++++ .../provider-cursor/src/server/sdkModel.ts | 42 ++++++++++++++----- .../src/server/textGeneration.ts | 5 ++- 5 files changed, 91 insertions(+), 13 deletions(-) diff --git a/packages/provider-cursor/src/server/adapter.ts b/packages/provider-cursor/src/server/adapter.ts index 5d08119953c06..c2786c9947973 100644 --- a/packages/provider-cursor/src/server/adapter.ts +++ b/packages/provider-cursor/src/server/adapter.ts @@ -4,6 +4,7 @@ import type { InteractionUpdate, McpServerConfig, RunResult, + SDKModel, SDKUserMessage, SettingSource, ToolCall, @@ -309,6 +310,7 @@ export function makeCursorAgentOptions(input: { readonly apiKey?: string; readonly modelSelection: ModelSelection; readonly models?: ReadonlyArray; + readonly sdkModels?: ReadonlyArray; readonly runtimePolicy: ProviderAdapter.ProviderAdapterV2RuntimePolicy; readonly threadId: ThreadId; readonly mcpSession: McpProviderSession.McpProviderSessionConfig | undefined; @@ -317,7 +319,7 @@ export function makeCursorAgentOptions(input: { const policy = cursorRuntimeAgentPolicy(input.runtimePolicy, input.platform); const mcpServers = cursorMcpServers(input.mcpSession); return { - model: cursorSdkModelSelection(input.modelSelection, input.models), + model: cursorSdkModelSelection(input.modelSelection, input.models, input.sdkModels), name: `T3 Code ${input.threadId}`, mode: input.runtimePolicy.interactionMode === "plan" ? "plan" : "agent", ...(input.apiKey === undefined ? {} : { apiKey: input.apiKey }), @@ -1017,6 +1019,7 @@ export interface CursorAdapterV2Options { readonly instanceId: ProviderInstanceId; readonly environment: NodeJS.ProcessEnv; readonly getModels?: () => ReadonlyArray; + readonly getSdkModels?: () => ReadonlyArray; } export const makeCursorAdapterV2 = Effect.fn("makeCursorAdapterV2")(function* ( @@ -2548,6 +2551,7 @@ export const makeCursorAdapterV2 = Effect.fn("makeCursorAdapterV2")(function* ( ...(apiKey === undefined ? {} : { apiKey }), modelSelection: openInput.modelSelection, models: adapterOptions.getModels?.() ?? [], + sdkModels: adapterOptions.getSdkModels?.() ?? [], runtimePolicy: openInput.runtimePolicy, platform, threadId: openInput.threadId, @@ -2775,6 +2779,7 @@ export const makeCursorAdapterV2 = Effect.fn("makeCursorAdapterV2")(function* ( model: cursorSdkModelSelection( turnInput.modelSelection, adapterOptions.getModels?.() ?? [], + adapterOptions.getSdkModels?.() ?? [], ), mode: turnInput.runtimePolicy.interactionMode === "plan" ? "plan" : "agent", ...(Object.keys(turnMcpServers).length === 0 diff --git a/packages/provider-cursor/src/server/driver.ts b/packages/provider-cursor/src/server/driver.ts index 4b7477295fbd8..ebd981330bf4a 100644 --- a/packages/provider-cursor/src/server/driver.ts +++ b/packages/provider-cursor/src/server/driver.ts @@ -4,6 +4,7 @@ import { type ServerProviderModel, } from "@t3tools/contracts"; import { CursorSettings } from "../settings.ts"; +import type { SDKModel } from "@cursor/sdk"; import * as Effect from "effect/Effect"; import * as SecureRandom from "effect/crypto/SecureRandom"; import * as FileSystem from "effect/FileSystem"; @@ -164,10 +165,12 @@ export const CursorDriver: ProviderDriver< }); let catalogModels: ReadonlyArray = []; + let catalogSdkModels: ReadonlyArray = []; const orchestrationAdapter = yield* makeCursorAdapterV2({ instanceId, environment: processEnv, getModels: () => catalogModels, + getSdkModels: () => catalogSdkModels, }).pipe( Effect.provideService(CursorAgentSdk.CursorAgentSdkRunner, { ...sdkRunner, @@ -211,6 +214,7 @@ export const CursorDriver: ProviderDriver< auth.requireApiKey, auth.withAccess, () => catalogModels, + () => catalogSdkModels, ); const checkProvider = auth.readApiKey.pipe( @@ -250,6 +254,19 @@ export const CursorDriver: ProviderDriver< } }), ), + Effect.provideServiceEffect( + CursorSdkCatalog.CursorSdkCatalog, + Effect.map(CursorSdkCatalog.CursorSdkCatalog, (catalog) => + CursorSdkCatalog.CursorSdkCatalog.of({ + // Untraced: CursorSdkCatalog.read already spans this call. + read: Effect.fnUntraced(function* (apiKey) { + const snapshot = yield* catalog.read(apiKey); + if (snapshot.models.length > 0) catalogSdkModels = snapshot.models; + return snapshot; + }), + }), + ), + ), Effect.provide(CursorSdkCatalog.layer), Effect.provideService(HttpClient.HttpClient, httpClient), ); diff --git a/packages/provider-cursor/src/server/sdkModel.test.ts b/packages/provider-cursor/src/server/sdkModel.test.ts index 4ad129e1ae239..a457becef9377 100644 --- a/packages/provider-cursor/src/server/sdkModel.test.ts +++ b/packages/provider-cursor/src/server/sdkModel.test.ts @@ -65,6 +65,39 @@ describe("cursorSdkModelSelection", () => { }); }); + it.each([ + { context: undefined, maxMode: true }, + { context: "1m", maxMode: true }, + { context: "300k", maxMode: undefined }, + ])("sets Max Mode from the catalog for context $context", ({ context, maxMode }) => { + const sdkModels = [ + { + id: "gemini-4-neon", + displayName: "Gemini 4 Neon", + parameters: [{ id: "context", values: [{ value: "300k" }, { value: "1m" }] }], + variants: [ + { displayName: "300K", params: [{ id: "context", value: "300k" }] }, + { + displayName: "1M", + isDefault: true, + isMaxMode: true, + params: [{ id: "context", value: "1m" }], + }, + ], + }, + ]; + const selection = cursorSdkModelSelection( + { + instanceId, + model: "gemini-4-neon", + ...(context === undefined ? {} : { options: [{ id: "contextWindow", value: context }] }), + }, + buildCursorDiscoveredModelsFromSdk(sdkModels), + sdkModels, + ); + expect(selection.maxMode).toBe(maxMode); + }); + it("sends no parameters for a model missing from the catalog", () => { expect(cursorSdkModelSelection({ instanceId, model: "auto" }, models)).toEqual({ id: "default", diff --git a/packages/provider-cursor/src/server/sdkModel.ts b/packages/provider-cursor/src/server/sdkModel.ts index ec2a53b6aea71..eb030a4158344 100644 --- a/packages/provider-cursor/src/server/sdkModel.ts +++ b/packages/provider-cursor/src/server/sdkModel.ts @@ -1,4 +1,8 @@ -import type { ModelSelection as CursorSdkModelSelection, ModelParameterValue } from "@cursor/sdk"; +import type { + ModelSelection as CursorSdkModelSelection, + ModelParameterValue, + SDKModel, +} from "@cursor/sdk"; import type { ModelSelection, ServerProviderModel } from "@t3tools/contracts"; import { getProviderOptionCurrentValue } from "@t3tools/shared/model"; @@ -55,9 +59,27 @@ export function cursorContextWindowTokens( return Number.isSafeInteger(tokens) && tokens > 0 ? tokens : undefined; } +// The SDK infers Max Mode from a model list it never refreshes, so pass it from T3's fresher catalog. +function cursorSdkMaxMode( + sdkModel: SDKModel | undefined, + params: ReadonlyArray, +): boolean { + if (params.length === 0) return false; + const variants = (sdkModel?.variants ?? []).filter((variant) => + params.every((param) => + variant.params.some( + (candidate) => + candidate.id.trim() === param.id.trim() && candidate.value.trim() === param.value.trim(), + ), + ), + ); + return variants.length > 0 && variants.every((variant) => variant.isMaxMode === true); +} + export function cursorSdkModelSelection( modelSelection: ModelSelection, models: ReadonlyArray = [], + sdkModels: ReadonlyArray = [], ): CursorSdkModelSelection { const explicit = modelSelection.options ?? []; const descriptors = @@ -69,16 +91,16 @@ export function cursorSdkModelSelection( const value = descriptor.id === "fastMode" ? false : getProviderOptionCurrentValue(descriptor); return value === undefined ? [] : [{ id: descriptor.id, value }]; }); - const options = [...explicit, ...defaults]; + const params = [...explicit, ...defaults].map((option): ModelParameterValue => ({ + id: cursorSdkParameterId(option.id), + value: String(option.value), + })); + const sdkModel = sdkModels.find( + (model) => model.id === modelSelection.model || model.aliases?.includes(modelSelection.model), + ); return { id: modelSelection.model === "auto" ? "default" : modelSelection.model, - ...(options.length === 0 - ? {} - : { - params: options.map((option): ModelParameterValue => ({ - id: cursorSdkParameterId(option.id), - value: String(option.value), - })), - }), + ...(params.length === 0 ? {} : { params }), + ...(cursorSdkMaxMode(sdkModel, params) ? { maxMode: true } : {}), }; } diff --git a/packages/provider-cursor/src/server/textGeneration.ts b/packages/provider-cursor/src/server/textGeneration.ts index fc15f3ee185e2..21f4f78860512 100644 --- a/packages/provider-cursor/src/server/textGeneration.ts +++ b/packages/provider-cursor/src/server/textGeneration.ts @@ -1,6 +1,6 @@ import * as FileSystem from "effect/FileSystem"; -import type { AgentOptions, RunResult } from "@cursor/sdk"; +import type { AgentOptions, RunResult, SDKModel } from "@cursor/sdk"; import * as Effect from "effect/Effect"; import * as Schema from "effect/Schema"; @@ -55,6 +55,7 @@ export const makeCursorTextGeneration = Effect.fn("makeCursorTextGeneration")(fu resolveApiKey?: Effect.Effect, withAccess?: CursorAuth["withAccess"], getModels?: () => ReadonlyArray, + getSdkModels?: () => ReadonlyArray, ) { const fs = yield* FileSystem.FileSystem; const sdk = yield* CursorSdk.CursorSdk; @@ -121,7 +122,7 @@ export const makeCursorTextGeneration = Effect.fn("makeCursorTextGeneration")(fu const agentOptions = { apiKey, mode: "plan", - model: cursorSdkModelSelection(modelSelection, getModels?.() ?? []), + model: cursorSdkModelSelection(modelSelection, getModels?.() ?? [], getSdkModels?.() ?? []), local: { cwd, store, From 9fde959ac0542e835a2cdafd417125bbdbe4ad07 Mon Sep 17 00:00:00 2001 From: Bilal Bakr <62337003+Bil0000@users.noreply.github.com> Date: Fri, 20 Nov 2026 03:48:08 +0300 Subject: [PATCH 160/201] feat(web): choose which projects the issues list shows (#38799) Co-authored-by: Claude Opus 5.5 --- apps/server/src/issue/IssueService.test.ts | 3 + apps/server/src/issue/IssueService.ts | 11 +- .../issue/IssueListFilterPickers.tsx | 124 ++++++++++++------ apps/web/src/components/issue/IssuesPage.tsx | 117 +++++++++++------ .../components/issue/issueListPreferences.ts | 26 ++-- .../components/issue/issueSavedViews.test.ts | 29 +++- .../src/components/issue/issueSavedViews.ts | 6 +- .../issue/issuesSearch.logic.test.ts | 42 +++++- .../components/issue/issuesSearch.logic.ts | 70 +++++++++- apps/web/src/i18n/translations/de.json | 5 +- apps/web/src/i18n/translations/en.json | 5 +- apps/web/src/i18n/translations/es.json | 5 +- apps/web/src/i18n/translations/fr.json | 5 +- apps/web/src/i18n/translations/ja.json | 5 +- apps/web/src/i18n/translations/ko.json | 5 +- apps/web/src/i18n/translations/pt-BR.json | 5 +- apps/web/src/i18n/translations/ru.json | 5 +- apps/web/src/i18n/translations/sv.json | 5 +- apps/web/src/i18n/translations/zh.json | 5 +- docs/user/source-control.md | 5 +- packages/client-runtime/src/issueList.test.ts | 41 ------ packages/client-runtime/src/issueList.ts | 5 - packages/contracts/src/issue.ts | 6 + 23 files changed, 376 insertions(+), 159 deletions(-) diff --git a/apps/server/src/issue/IssueService.test.ts b/apps/server/src/issue/IssueService.test.ts index e68799eea12e7..362d9b104a45e 100644 --- a/apps/server/src/issue/IssueService.test.ts +++ b/apps/server/src/issue/IssueService.test.ts @@ -613,6 +613,9 @@ describe("IssueService with a standalone tracker", () => { ["web", "ENG"], ["web", "acme/web"], ]); + listed.length = 0; + yield* bound.list({ state: "open", excludeProjectIds: ["web" as ProjectId] }); + expect(listed).toEqual(["github github.com acme/api"]); // A reference picks the project's tracker by kind; both are the project's own, so writable. const linearRef = { projectId: "web" as ProjectId, diff --git a/apps/server/src/issue/IssueService.ts b/apps/server/src/issue/IssueService.ts index e4ffc8817628b..215c07ed82074 100644 --- a/apps/server/src/issue/IssueService.ts +++ b/apps/server/src/issue/IssueService.ts @@ -219,6 +219,7 @@ const make = Effect.gen(function* () { const listProjects = (filter: { readonly projectId?: IssueListInput["projectId"]; + readonly excludeProjectIds?: IssueListInput["excludeProjectIds"]; readonly host?: string | undefined; /** The link's `host:port`, for a host whose binding keeps its port. */ readonly authority?: string | undefined; @@ -236,7 +237,10 @@ const make = Effect.gen(function* () { }), ), Effect.flatMap( - Effect.fnUntraced(function* (shells) { + Effect.fnUntraced(function* (allShells) { + const shells = allShells.filter( + (project) => !filter.excludeProjectIds?.includes(project.id), + ); if (shells.length === 0) return []; // One read per listing, not per project, and never cached so Settings changes apply. const bound = yield* bindings.list.pipe( @@ -322,7 +326,10 @@ const make = Effect.gen(function* () { const list: IssueService["Service"]["list"] = Effect.fn("IssueService.list")(function* (input) { // Trackers name every host so a client narrowed to one can switch to another; only the // narrowed host's scopes are read. - const { supported, unimplemented } = yield* listProjects({ projectId: input.projectId }); + const { supported, unimplemented } = yield* listProjects({ + projectId: input.projectId, + excludeProjectIds: input.excludeProjectIds, + }); const host = input.host?.trim().toLowerCase(); const limit = input.limit ?? DEFAULT_LIST_LIMIT; // Worktrees of one repository are separate projects, and every repository of an Azure diff --git a/apps/web/src/components/issue/IssueListFilterPickers.tsx b/apps/web/src/components/issue/IssueListFilterPickers.tsx index ff40d1c3f8f45..d1d28fa366de0 100644 --- a/apps/web/src/components/issue/IssueListFilterPickers.tsx +++ b/apps/web/src/components/issue/IssueListFilterPickers.tsx @@ -26,7 +26,7 @@ import { } from "~/components/ui/menu"; import { useIssueFilterCandidates } from "~/state/issues"; -import type { ProjectFaviconProject } from "../ProjectFavicon"; +import { ProjectFavicon, type ProjectFaviconProject } from "../ProjectFavicon"; import { PullRequestFilterRadioSubmenu, @@ -36,7 +36,6 @@ import { import { pullRequestLabelColor } from "../pullRequest/pullRequestList.logic"; const VISIBLE_CHOICES = 30; -const ALL_PROJECTS = "all"; const matches = (needle: string, ...fields: ReadonlyArray) => needle.length === 0 || fields.some((field) => field?.toLowerCase().includes(needle)); @@ -54,38 +53,18 @@ export function IssueFiltersMenu(props: { assignee: string | undefined; onAssignee: (assignee: string | undefined) => void; projects: ReadonlyArray; - project: { environmentId: EnvironmentId; projectId: ProjectId } | undefined; - onProject: (project: { environmentId: EnvironmentId; projectId: ProjectId } | undefined) => void; + hiddenProjects: ReadonlySet; + onHiddenProjects: (hidden: ReadonlyArray) => void; }) { const gt = useGT(); const [open, setOpen] = useState(false); const count = [ props.state !== "open", props.involvement !== "all", - props.project, + props.hiddenProjects.size > 0, props.assignee, ...props.labels, ].filter(Boolean).length; - const projectValue = props.project - ? pullRequestProjectKey({ - id: props.project.projectId, - environmentId: props.project.environmentId, - }) - : ALL_PROJECTS; - const projectOptions: ReadonlyArray> = [ - { value: ALL_PROJECTS, label: gt("All projects"), Icon: LayersIcon }, - // A remembered project this client does not list stays shown, so the filter can be taken off. - ...(projectValue !== ALL_PROJECTS && - !props.projects.some((project) => pullRequestProjectKey(project) === projectValue) - ? [{ value: projectValue, label: gt("Unavailable project"), Icon: FolderGit2Icon }] - : []), - ...props.projects.map((project) => ({ - value: pullRequestProjectKey(project), - label: project.title, - Icon: FolderGit2Icon, - project, - })), - ]; // Read when the menu opens, not with every listing: one request per scope. const scopes = open ? props.scopes : []; return ( @@ -114,20 +93,25 @@ export function IssueFiltersMenu(props: { options={props.involvementOptions} onChange={props.onInvolvement} /> - {props.projects.length > 1 || props.project ? ( - { - const project = props.projects.find((p) => pullRequestProjectKey(p) === next); - props.onProject( - project - ? { environmentId: project.environmentId, projectId: project.id } - : undefined, - ); - }} - /> + {props.projects.length > 0 || props.hiddenProjects.size > 0 ? ( + + + + {gt("Projects")} + + {props.hiddenProjects.size === 0 + ? gt("All projects") + : gt("{hidden} hidden", { hidden: props.hiddenProjects.size })} + + + + + ) : null} @@ -169,6 +153,68 @@ export function IssueFiltersMenu(props: { ); } +function ProjectChoices(props: { + projects: ReadonlyArray; + hidden: ReadonlySet; + onChange: (hidden: ReadonlyArray) => void; +}) { + const gt = useGT(); + const [query, setQuery] = useState(""); + const needle = query.trim().toLowerCase(); + const visible = props.projects.filter((project) => matches(needle, project.title)); + const pairsOf = (keys: Iterable) => + [...keys].map((key) => JSON.parse(key) as readonly [EnvironmentId, ProjectId]); + const allShown = props.hidden.size === 0; + return ( + <> + {props.projects.length > 8 ? ( + setQuery(event.currentTarget.value)} + placeholder={gt("Search projects")} + aria-label={gt("Search projects")} + /> + ) : null} + + props.onChange( + shown ? [] : pairsOf(props.projects.map((project) => pullRequestProjectKey(project))), + ) + } + > + + + {gt("Show all")} + + + + {visible.length === 0 ? {gt("No matching projects.")} : null} + {visible.map((project) => { + const key = pullRequestProjectKey(project); + return ( + { + const next = new Set(props.hidden); + if (shown) next.delete(key); + else next.add(key); + props.onChange(pairsOf(next)); + }} + > + + + {project.title} + + + ); + })} + + ); +} + function LabelChoices(props: { scopes: ReadonlyArray; value: ReadonlyArray; diff --git a/apps/web/src/components/issue/IssuesPage.tsx b/apps/web/src/components/issue/IssuesPage.tsx index 39fd8a0ec60ed..ca471a87f975c 100644 --- a/apps/web/src/components/issue/IssuesPage.tsx +++ b/apps/web/src/components/issue/IssuesPage.tsx @@ -49,13 +49,14 @@ import { PullRequestDetailPanel } from "~/components/pullRequest/PullRequestDeta import { PullRequestListGhost } from "~/components/pullRequest/PullRequestGhosts"; import { PullRequestFilterOptionIcon, + pullRequestProjectKey, PullRequestSearchInput, type PullRequestFilterOption, } from "~/components/pullRequest/PullRequestListFilters"; import { m, type MessageResolver } from "~/i18n/messages"; import { resolveFilterOptions } from "../pullRequest/pullRequestListOptions"; import { IssueFiltersMenu } from "./IssueListFilterPickers"; -import { issueFilterProjects } from "./issuesSearch.logic"; +import { issueFilterProjects, issueListTargets, issueProjectKeys } from "./issuesSearch.logic"; import { ISSUE_SAVED_VIEWS } from "./issueSavedViews"; import { SavedViewsMenu } from "~/components/SavedViewsMenu"; import { PullRequestCompactFilterMenu } from "../pullRequest/PullRequestCompactFilterMenu"; @@ -68,6 +69,7 @@ import { PanelLayoutControls } from "~/components/chat/PanelLayoutControls"; import { Button } from "~/components/ui/button"; import { Empty, + EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, @@ -94,7 +96,7 @@ import { useAtomCommand } from "~/state/use-atom-command"; import { squashAtomCommandFailure } from "@t3tools/client-runtime/state/runtime"; import { useProjects } from "~/state/entities"; import { useEnvironments, useIssuesSupported } from "~/state/environments"; -import { issueEnvironment, useIssueList, type IssueListTarget } from "~/state/issues"; +import { issueEnvironment, useIssueList } from "~/state/issues"; import { useDebouncedValue } from "~/state/queries"; import { primaryServerKeybindingsAtom } from "~/state/server"; @@ -206,26 +208,30 @@ export function IssuesPage() { ), environmentLabels, ); - const scopedProject = - search.issueServer && search.issueProject - ? { environmentId: search.issueServer, projectId: search.issueProject } - : undefined; + const hiddenProjects = issueProjectKeys(search.hideProjects); const debouncedQuery = useDebouncedValue(search.q ?? "", 300); const listInput: IssueListInput = { state: search.status, involvement: search.who, limit: PAGE_SIZE, - ...(scopedProject ? { projectId: scopedProject.projectId } : {}), ...(search.host ? { host: search.host } : {}), ...(debouncedQuery ? { query: debouncedQuery } : {}), ...(search.label?.length ? { labels: search.label } : {}), ...(search.assignee ? { assignee: search.assignee } : {}), ...(search.order ? { sort: search.order } : {}), }; - const targets: ReadonlyArray = capableEnvironments - .filter((e) => scopedProject === undefined || e.environmentId === scopedProject.environmentId) - .map((e) => ({ environmentId: e.environmentId, input: listInput })); + const everyProjectHidden = + filterProjects.length > 0 && + filterProjects.every((project) => hiddenProjects.has(pullRequestProjectKey(project))); + const targets = everyProjectHidden + ? [] + : issueListTargets( + capableEnvironments.map((e) => e.environmentId), + filterProjects, + search.hideProjects, + listInput, + ); const list = useIssueList(targets); // Refreshing a list still loading would cancel it and start over, losing the scopes already read. useLiveRefresh( @@ -245,7 +251,9 @@ export function IssuesPage() { const cursors = page ? issueCursorsForHost(page.nextCursors, host) : {}; if (!page || Object.keys(cursors).length === 0 || loadingMore !== null) return; setLoadingMore(`${environmentId} ${host}`); - const result = await loadPage({ environmentId, input: { ...listInput, cursors } }); + const input = targets.find((target) => target.environmentId === environmentId)?.input; + if (!input) return; + const result = await loadPage({ environmentId, input: { ...input, cursors } }); setLoadingMore(null); const failure = result._tag === "Failure" ? squashAtomCommandFailure(result) : null; setPages((current) => { @@ -271,24 +279,49 @@ export function IssuesPage() { // would be, and each tracker's rows carry on from their own cursors. // The server names every tracker so the menu can switch hosts, but reads only the chosen one. const chosenHost = search.host?.toLowerCase(); - const shown = chosenHost - ? new Map( - [...held].map(([environmentId, page]) => [ - environmentId, - { - ...page, - answer: { - ...page.answer, - trackers: page.answer.trackers.filter( - (tracker) => tracker.host.toLowerCase() === chosenHost, + // A server older than `excludeProjectIds` still answers for hidden projects. + const shown = + chosenHost || hiddenProjects.size > 0 + ? new Map( + [...held].map(([environmentId, page]) => [ + environmentId, + { + ...page, + entries: page.entries.filter( + (entry) => + !hiddenProjects.has( + pullRequestProjectKey({ environmentId, id: entry.projectId }), + ), + ), + errors: page.errors.filter( + (error) => + !hiddenProjects.has( + pullRequestProjectKey({ environmentId, id: error.projectId }), + ), ), + answer: { + ...page.answer, + scopes: page.answer.scopes?.filter( + (scope) => + !hiddenProjects.has( + pullRequestProjectKey({ environmentId, id: scope.projectId }), + ), + ), + trackers: chosenHost + ? page.answer.trackers.filter( + (tracker) => tracker.host.toLowerCase() === chosenHost, + ) + : page.answer.trackers, + }, }, - }, - ]), - ) - : held; + ]), + ) + : held; const groups = groupIssues(shown, debouncedQuery, projects, search.order ?? "updated"); - const filterScopes = issueFilterScopes(shown, projects, scopedProject); + const filterScopes = issueFilterScopes( + shown, + projects.filter((project) => !hiddenProjects.has(pullRequestProjectKey(project))), + ); const hostOptions = hostOptionsFor( [...held.values()].flatMap((page) => page.answer.trackers), @@ -301,9 +334,7 @@ export function IssuesPage() { const next: IssuesSearch = { who: merged.who ?? search.who, status: merged.status ?? search.status, - ...(merged.issueServer && merged.issueProject - ? { issueServer: merged.issueServer, issueProject: merged.issueProject } - : {}), + ...(merged.hideProjects?.length ? { hideProjects: merged.hideProjects } : {}), ...(merged.host ? { host: merged.host } : {}), q: merged.q || undefined, ...(merged.label?.length ? { label: merged.label } : {}), @@ -485,6 +516,22 @@ export function IssuesPage() { onRetry={list.retry} refreshing={list.isPending} /> + ) : everyProjectHidden ? ( + + + + + + + Every project is hidden + + + + + + ) : groups.length === 0 ? ( @@ -691,13 +738,8 @@ export function IssuesPage() { assignee={search.assignee} onAssignee={(assignee) => updateSearch({ assignee })} projects={filterProjects} - project={scopedProject} - onProject={(project) => - updateSearch({ - issueServer: project?.environmentId, - issueProject: project?.projectId, - }) - } + hiddenProjects={hiddenProjects} + onHiddenProjects={(hideProjects) => updateSearch({ hideProjects })} /> | undefined; readonly host?: string | undefined; readonly q?: string | undefined; /** `label`, `assignee` and `order` for the same reason: the pull-request page has `labels` and `sort`. */ @@ -32,8 +38,11 @@ const BoundedPreference = Schema.String.check(Schema.isMaxLength(200)); export const IssueListPreferencesSchema = Schema.Struct({ who: IssueInvolvement, status: IssueListState, - issueServer: Schema.optional(EnvironmentId), - issueProject: Schema.optional(ProjectId), + hideProjects: Schema.optional( + Schema.Array(Schema.Tuple([EnvironmentId, ProjectId])).check( + Schema.isMaxLength(ISSUE_LIST_MAX_EXCLUDED_PROJECTS), + ), + ), host: Schema.optional(BoundedPreference), q: Schema.optional(BoundedPreference), label: Schema.optional(Schema.Array(BoundedPreference).check(Schema.isMaxLength(20))), @@ -52,8 +61,7 @@ function storage(): PreferenceStorage | undefined { export function issueListPreferences(search: { readonly who: IssueInvolvement; readonly status: IssueListState; - readonly issueServer?: EnvironmentId | undefined; - readonly issueProject?: ProjectId | undefined; + readonly hideProjects?: ReadonlyArray | undefined; readonly host?: string | undefined; readonly q?: string | undefined; readonly label?: ReadonlyArray | undefined; @@ -63,8 +71,8 @@ export function issueListPreferences(search: { return { who: search.who, status: search.status, - ...(search.issueServer && search.issueProject - ? { issueServer: search.issueServer, issueProject: search.issueProject } + ...(search.hideProjects?.length + ? { hideProjects: search.hideProjects.slice(0, ISSUE_LIST_MAX_EXCLUDED_PROJECTS) } : {}), ...(search.host ? { host: search.host } : {}), ...(search.q ? { q: search.q } : {}), diff --git a/apps/web/src/components/issue/issueSavedViews.test.ts b/apps/web/src/components/issue/issueSavedViews.test.ts index 0933dc008edef..cda0072b5da17 100644 --- a/apps/web/src/components/issue/issueSavedViews.test.ts +++ b/apps/web/src/components/issue/issueSavedViews.test.ts @@ -1,14 +1,21 @@ import { describe, expect, it } from "vite-plus/test"; +import * as Schema from "effect/Schema"; + import { EnvironmentId, ProjectId } from "@t3tools/contracts"; +import { issueListPreferences, IssueListPreferencesSchema } from "./issueListPreferences"; import { issueViewMatches } from "./issueSavedViews"; +const decodePreferences = Schema.decodeOption(IssueListPreferencesSchema); + const preferences = { who: "assigned", status: "open", - issueServer: EnvironmentId.make("env-1"), - issueProject: ProjectId.make("project-1"), + hideProjects: [ + [EnvironmentId.make("env-1"), ProjectId.make("project-1")], + [EnvironmentId.make("env-1"), ProjectId.make("project-2")], + ], host: "github.com", q: "crash", label: ["bug", "priority"], @@ -24,6 +31,22 @@ describe("saved issue views", () => { ); expect(issueViewMatches(view, { ...preferences, assignee: undefined })).toBe(false); expect(issueViewMatches(view, { ...preferences, label: ["bug"] })).toBe(false); - expect(issueViewMatches(view, { ...preferences, issueProject: undefined })).toBe(false); + expect( + issueViewMatches(view, { + ...preferences, + hideProjects: preferences.hideProjects.toReversed(), + }), + ).toBe(true); + expect(issueViewMatches(view, { ...preferences, hideProjects: undefined })).toBe(false); + }); + + it("keeps a selection of every project within what it reads back", () => { + const many = Array.from( + { length: 1_001 }, + (_, index) => [EnvironmentId.make("env-1"), ProjectId.make(`project-${index}`)] as const, + ); + const stored = issueListPreferences({ ...preferences, hideProjects: many }); + const restored = decodePreferences(stored); + expect(restored._tag === "Some" && restored.value.hideProjects).toEqual(many.slice(0, 1_000)); }); }); diff --git a/apps/web/src/components/issue/issueSavedViews.ts b/apps/web/src/components/issue/issueSavedViews.ts index bac3a6c9ab7bb..02a5a851a460f 100644 --- a/apps/web/src/components/issue/issueSavedViews.ts +++ b/apps/web/src/components/issue/issueSavedViews.ts @@ -15,7 +15,11 @@ export function issueViewMatches( ): boolean { const key = (value: IssueListPreferences) => { const normalized = issueListPreferences(value); - return JSON.stringify({ ...normalized, label: normalized.label?.toSorted() }); + return JSON.stringify({ + ...normalized, + label: normalized.label?.toSorted(), + hideProjects: normalized.hideProjects?.map((pair) => JSON.stringify(pair)).toSorted(), + }); }; return key(issueListPreferences(view.preferences)) === key(preferences); } diff --git a/apps/web/src/components/issue/issuesSearch.logic.test.ts b/apps/web/src/components/issue/issuesSearch.logic.test.ts index 2d4aad1072b01..095323fc3d2b2 100644 --- a/apps/web/src/components/issue/issuesSearch.logic.test.ts +++ b/apps/web/src/components/issue/issuesSearch.logic.test.ts @@ -3,7 +3,7 @@ import { describe, expect, it } from "vite-plus/test"; import type { EnvironmentProject } from "@t3tools/client-runtime/state/models"; import { EnvironmentId, ProjectId } from "@t3tools/contracts"; -import { issueFilterProjects, issuesSearchFromUrl } from "./issuesSearch.logic"; +import { issueFilterProjects, issueListTargets, issuesSearchFromUrl } from "./issuesSearch.logic"; describe("issuesSearchFromUrl", () => { it("replaces a malformed filter instead of letting the raw value through", () => { @@ -19,11 +19,48 @@ describe("issuesSearchFromUrl", () => { label: ["bug", "ui"], order: "created", }); + expect( + issuesSearchFromUrl({ hideProjects: [["env", "web"], ["env"], "api", ["env", 3]] }) + .hideProjects, + ).toEqual([ + ["env", "web"], + ["env", "3"], + ]); + }); +}); + +describe("issueListTargets", () => { + it("leaves hidden projects out and skips an environment with every project hidden", () => { + const laptop = EnvironmentId.make("laptop"); + const vps = EnvironmentId.make("vps"); + const projects = [ + { environmentId: laptop, id: ProjectId.make("web") }, + { environmentId: laptop, id: ProjectId.make("api") }, + { environmentId: vps, id: ProjectId.make("docs") }, + ]; + const input = { state: "open" } as const; + const hidden = [ + [laptop, ProjectId.make("api")], + [laptop, ProjectId.make("removed")], + [vps, ProjectId.make("docs")], + ] as const; + expect(issueListTargets([laptop, vps], projects, hidden, input)).toEqual([ + { environmentId: laptop, input: { state: "open", excludeProjectIds: ["api"] } }, + ]); + // Before the project list loads, the saved choice still leaves its projects out. + expect(issueListTargets([laptop, vps], [], hidden, input)).toEqual([ + { environmentId: laptop, input: { state: "open", excludeProjectIds: ["api", "removed"] } }, + { environmentId: vps, input: { state: "open", excludeProjectIds: ["docs"] } }, + ]); + expect(issueListTargets([laptop, vps], projects, undefined, input)).toEqual([ + { environmentId: laptop, input }, + { environmentId: vps, input }, + ]); }); }); describe("issueFilterProjects", () => { - it("keeps every project on one repository as its own choice", () => { + it("keeps every project, scratch ones too, as its own choice", () => { const environmentId = EnvironmentId.make("env"); const project = (id: string, isScratch = false) => ({ @@ -40,6 +77,7 @@ describe("issueFilterProjects", () => { ); expect(choices.map((choice) => [choice.id, choice.title])).toEqual([ ["main", "t3code · laptop · /work/main"], + ["scratch", "t3code · laptop · /work/scratch"], ["worktree", "t3code · laptop · /work/worktree"], ]); }); diff --git a/apps/web/src/components/issue/issuesSearch.logic.ts b/apps/web/src/components/issue/issuesSearch.logic.ts index 808acd1242f0d..01830e48238c2 100644 --- a/apps/web/src/components/issue/issuesSearch.logic.ts +++ b/apps/web/src/components/issue/issuesSearch.logic.ts @@ -1,6 +1,13 @@ import { pullRequestFilterProjects } from "@t3tools/client-runtime/pull-request-project-filter"; import type { EnvironmentProject } from "@t3tools/client-runtime/state/models"; -import type { EnvironmentId, ProjectId } from "@t3tools/contracts"; +import { + ISSUE_LIST_MAX_EXCLUDED_PROJECTS, + type EnvironmentId, + type IssueListInput, + type ProjectId, +} from "@t3tools/contracts"; + +import type { IssueListTarget } from "@t3tools/client-runtime/state/issues"; import type { IssuesSearch } from "./IssuesPage"; @@ -15,14 +22,24 @@ const labels = (raw: unknown): ReadonlyArray | undefined => { return names.length === 0 ? undefined : names.slice(0, 20); }; +const projectPairs = (raw: unknown): IssuesSearch["hideProjects"] => { + const pairs = (Array.isArray(raw) ? raw : []).flatMap((pair) => { + const environmentId = Array.isArray(pair) ? bounded(pair[0]) : undefined; + const projectId = Array.isArray(pair) ? bounded(pair[1]) : undefined; + return environmentId && projectId + ? [[environmentId as EnvironmentId, projectId as ProjectId] as const] + : []; + }); + return pairs.length === 0 ? undefined : pairs.slice(0, ISSUE_LIST_MAX_EXCLUDED_PROJECTS); +}; + // Every optional key is an own key, even when undefined: the router lays these over the parent // route's unvalidated search, where a key left out would keep its raw value. export const issuesSearchFromUrl = (raw: Record): IssuesSearch => ({ who: raw.who === "assigned" || raw.who === "authored" || raw.who === "mentioned" ? raw.who : "all", status: raw.status === "closed" || raw.status === "all" ? raw.status : "open", - issueServer: bounded(raw.issueServer) as EnvironmentId | undefined, - issueProject: bounded(raw.issueProject) as ProjectId | undefined, + hideProjects: projectPairs(raw.hideProjects), host: bounded(raw.host), q: bounded(raw.q), label: labels(raw.label), @@ -36,14 +53,53 @@ export const issuesSearchFromUrl = (raw: Record): IssuesSearch key: bounded(raw.key), }); -/** One choice per project: projects on one repository can read different Linear teams. */ +/** + * One choice per project: projects on one repository can read different Linear teams. Scratch + * projects stay, since Settings can bind one to a Linear team. + */ export const issueFilterProjects = ( projects: ReadonlyArray, environmentLabels: ReadonlyMap, ) => pullRequestFilterProjects( - projects - .filter((project) => !project.isScratch) - .map((project) => ({ ...project, repositoryIdentity: null })), + projects.map((project) => ({ ...project, repositoryIdentity: null })), environmentLabels, ); + +/** The same key as `pullRequestProjectKey`. */ +const projectKey = (project: { readonly id: ProjectId; readonly environmentId: EnvironmentId }) => + JSON.stringify([project.environmentId, project.id]); + +export const issueProjectKeys = (pairs: IssuesSearch["hideProjects"]): ReadonlySet => + new Set((pairs ?? []).map((pair) => JSON.stringify(pair))); + +/** + * Each environment leaves out its hidden projects, named from the saved pairs so a listing sent + * before the project list loads still leaves them out. One with every project hidden is not read. + * Rows past the request limit are hidden on the client. + */ +export function issueListTargets( + environmentIds: ReadonlyArray, + projects: ReadonlyArray<{ readonly id: ProjectId; readonly environmentId: EnvironmentId }>, + hidden: IssuesSearch["hideProjects"], + input: IssueListInput, +): ReadonlyArray { + const keys = issueProjectKeys(hidden); + return environmentIds.flatMap((environmentId) => { + const own = projects.filter((project) => project.environmentId === environmentId); + if (own.length > 0 && own.every((project) => keys.has(projectKey(project)))) return []; + const excludeProjectIds = ( + own.length > 0 + ? own.filter((project) => keys.has(projectKey(project))).map((project) => project.id) + : (hidden ?? []) + .filter(([environment]) => environment === environmentId) + .map(([, projectId]) => projectId) + ).slice(0, ISSUE_LIST_MAX_EXCLUDED_PROJECTS); + return [ + { + environmentId, + input: excludeProjectIds.length ? { ...input, excludeProjectIds } : input, + }, + ]; + }); +} diff --git a/apps/web/src/i18n/translations/de.json b/apps/web/src/i18n/translations/de.json index 2ec76aa57cfd7..76c02fcf63f94 100644 --- a/apps/web/src/i18n/translations/de.json +++ b/apps/web/src/i18n/translations/de.json @@ -5779,9 +5779,12 @@ "1cf216566c1ee064": "Projekt nicht verfügbar", "b5ddadeb0810688c": "Status", "93c1fc19d9bf1db0": "Beteiligung", + "d5a8b335d88b65bc": "{hidden} ausgeblendet", "2160067266a61dd8": "Beliebig", "cd4ec4acf33c65b9": "{count, plural, one {{count} Label} other {{count} Labels}}", "bfd20acb8b7dee6b": "Beliebig", + "ad208e3e32c85029": "Alle ausblenden", + "77ce79d865716719": "Keine passenden Projekte.", "af7eb4f9c7f0f575": "Filter", "08247dd39b0c85ff": "Zugewiesene Person", "5cad5a7879c8d38c": "Keine Labels gefunden", @@ -5818,6 +5821,7 @@ "297613ddcf68d031": "Sortieren", "4aa8190ec693085e": "Nach Tracker filtern", "d44aed6ee67982dd": "Issues aktualisieren", + "df23678c28c56593": "Alle Projekte sind ausgeblendet", "2ccf231996dc89c2": "Keine Tracker zum Lesen", "ffdb63a22901a1fa": "Füge ein Projekt hinzu, dessen Remote bei einem unterstützten Tracker liegt.", "403e9debff81d7df": [ @@ -9724,7 +9728,6 @@ "51497bd401292062": "Gedrückt halten", "9d6cc6ac23312071": "Doppelt drücken", "f001fa7b329c8fbf": "Erfolgreiche ausblenden", - "ad208e3e32c85029": "Alle ausblenden", "c80e4bb3201efd71": "Zen", "0cb9ffcd1fb46b0c": "Nur Status", "cf0f7fc3df26fa75": "Status und Nachrichten", diff --git a/apps/web/src/i18n/translations/en.json b/apps/web/src/i18n/translations/en.json index 83909c95ae905..7895391f00f4b 100644 --- a/apps/web/src/i18n/translations/en.json +++ b/apps/web/src/i18n/translations/en.json @@ -5780,9 +5780,12 @@ "1cf216566c1ee064": "Unavailable project", "b5ddadeb0810688c": "State", "93c1fc19d9bf1db0": "Involvement", + "d5a8b335d88b65bc": "{hidden} hidden", "2160067266a61dd8": "Any", "cd4ec4acf33c65b9": "{count, plural, one {{count} label} other {{count} labels}}", "bfd20acb8b7dee6b": "Anyone", + "ad208e3e32c85029": "Hide all", + "77ce79d865716719": "No matching projects.", "af7eb4f9c7f0f575": "Filters", "08247dd39b0c85ff": "Assignee", "5cad5a7879c8d38c": "No labels found", @@ -5819,6 +5822,7 @@ "297613ddcf68d031": "Sort", "4aa8190ec693085e": "Filter by tracker", "d44aed6ee67982dd": "Refresh issues", + "df23678c28c56593": "Every project is hidden", "2ccf231996dc89c2": "No trackers to read", "ffdb63a22901a1fa": "Add a project whose remote is on a supported tracker.", "403e9debff81d7df": [ @@ -9733,7 +9737,6 @@ "51497bd401292062": "Hold", "9d6cc6ac23312071": "Double press", "f001fa7b329c8fbf": "Hide successful", - "ad208e3e32c85029": "Hide all", "c80e4bb3201efd71": "Zen", "0cb9ffcd1fb46b0c": "Status only", "cf0f7fc3df26fa75": "Status and messages", diff --git a/apps/web/src/i18n/translations/es.json b/apps/web/src/i18n/translations/es.json index 58a70229908d8..9dcdb371970d1 100644 --- a/apps/web/src/i18n/translations/es.json +++ b/apps/web/src/i18n/translations/es.json @@ -5778,9 +5778,12 @@ "1cf216566c1ee064": "Proyecto no disponible", "b5ddadeb0810688c": "Estado", "93c1fc19d9bf1db0": "Participación", + "d5a8b335d88b65bc": "{hidden} ocultos", "2160067266a61dd8": "Cualquiera", "cd4ec4acf33c65b9": "{count, plural, one {{count} etiqueta} other {{count} etiquetas}}", "bfd20acb8b7dee6b": "Cualquiera", + "ad208e3e32c85029": "Ocultar todo", + "77ce79d865716719": "No hay proyectos que coincidan.", "af7eb4f9c7f0f575": "Filtros", "08247dd39b0c85ff": "Asignado", "5cad5a7879c8d38c": "No se encontraron etiquetas", @@ -5817,6 +5820,7 @@ "297613ddcf68d031": "Ordenar", "4aa8190ec693085e": "Filtrar por gestor de issues", "d44aed6ee67982dd": "Actualizar issues", + "df23678c28c56593": "Todos los proyectos están ocultos", "2ccf231996dc89c2": "No hay gestores de issues que leer", "ffdb63a22901a1fa": "Añade un proyecto cuyo remoto esté en un gestor de issues compatible.", "403e9debff81d7df": [ @@ -9721,7 +9725,6 @@ "51497bd401292062": "Mantener pulsado", "9d6cc6ac23312071": "Doble pulsación", "f001fa7b329c8fbf": "Ocultar las correctas", - "ad208e3e32c85029": "Ocultar todo", "c80e4bb3201efd71": "Zen", "0cb9ffcd1fb46b0c": "Solo el estado", "cf0f7fc3df26fa75": "Estado y mensajes", diff --git a/apps/web/src/i18n/translations/fr.json b/apps/web/src/i18n/translations/fr.json index 829d5654d59e5..9ece50a183cf6 100644 --- a/apps/web/src/i18n/translations/fr.json +++ b/apps/web/src/i18n/translations/fr.json @@ -5779,9 +5779,12 @@ "1cf216566c1ee064": "Projet indisponible", "b5ddadeb0810688c": "État", "93c1fc19d9bf1db0": "Participation", + "d5a8b335d88b65bc": "{hidden} masqués", "2160067266a61dd8": "Tous", "cd4ec4acf33c65b9": "{count, plural, one {{count} libellé} other {{count} libellés}}", "bfd20acb8b7dee6b": "N’importe qui", + "ad208e3e32c85029": "Tout masquer", + "77ce79d865716719": "Aucun projet correspondant.", "af7eb4f9c7f0f575": "Filtres", "08247dd39b0c85ff": "Assigné", "5cad5a7879c8d38c": "Aucun libellé trouvé", @@ -5818,6 +5821,7 @@ "297613ddcf68d031": "Trier", "4aa8190ec693085e": "Filtrer par gestionnaire de tickets", "d44aed6ee67982dd": "Actualiser les tickets", + "df23678c28c56593": "Tous les projets sont masqués", "2ccf231996dc89c2": "Aucun gestionnaire de tickets à lire", "ffdb63a22901a1fa": "Ajoutez un projet dont le remote est sur un gestionnaire de tickets pris en charge.", "403e9debff81d7df": [ @@ -9723,7 +9727,6 @@ "51497bd401292062": "Appui long", "9d6cc6ac23312071": "Double appui", "f001fa7b329c8fbf": "Masquer les réussis", - "ad208e3e32c85029": "Tout masquer", "c80e4bb3201efd71": "Zen", "0cb9ffcd1fb46b0c": "Statut uniquement", "cf0f7fc3df26fa75": "Statut et messages", diff --git a/apps/web/src/i18n/translations/ja.json b/apps/web/src/i18n/translations/ja.json index dac6333be5e1a..6370a88d22e68 100644 --- a/apps/web/src/i18n/translations/ja.json +++ b/apps/web/src/i18n/translations/ja.json @@ -5761,9 +5761,12 @@ "1cf216566c1ee064": "利用できないプロジェクト", "b5ddadeb0810688c": "状態", "93c1fc19d9bf1db0": "関与", + "d5a8b335d88b65bc": "{hidden} 件非表示", "2160067266a61dd8": "すべて", "cd4ec4acf33c65b9": "{count, plural, other {{count} 個のラベル}}", "bfd20acb8b7dee6b": "すべてのユーザー", + "ad208e3e32c85029": "すべて非表示", + "77ce79d865716719": "一致するプロジェクトはありません。", "af7eb4f9c7f0f575": "フィルター", "08247dd39b0c85ff": "担当者", "5cad5a7879c8d38c": "ラベルが見つかりません", @@ -5800,6 +5803,7 @@ "297613ddcf68d031": "並べ替え", "4aa8190ec693085e": "トラッカーで絞り込む", "d44aed6ee67982dd": "Issue を更新", + "df23678c28c56593": "すべてのプロジェクトが非表示です", "2ccf231996dc89c2": "読み取れるトラッカーがありません", "ffdb63a22901a1fa": "リモートが対応トラッカー上にあるプロジェクトを追加してください。", "403e9debff81d7df": [ @@ -9675,7 +9679,6 @@ "51497bd401292062": "長押し", "9d6cc6ac23312071": "2 回押し", "f001fa7b329c8fbf": "成功したものを非表示", - "ad208e3e32c85029": "すべて非表示", "c80e4bb3201efd71": "Zen", "0cb9ffcd1fb46b0c": "ステータスのみ", "cf0f7fc3df26fa75": "ステータスとメッセージ", diff --git a/apps/web/src/i18n/translations/ko.json b/apps/web/src/i18n/translations/ko.json index 937913f4ba846..da9457df746ac 100644 --- a/apps/web/src/i18n/translations/ko.json +++ b/apps/web/src/i18n/translations/ko.json @@ -5759,9 +5759,12 @@ "1cf216566c1ee064": "사용할 수 없는 프로젝트", "b5ddadeb0810688c": "상태", "93c1fc19d9bf1db0": "참여", + "d5a8b335d88b65bc": "{hidden}개 숨김", "2160067266a61dd8": "전체", "cd4ec4acf33c65b9": "{count, plural, other {레이블 {count}개}}", "bfd20acb8b7dee6b": "모든 사람", + "ad208e3e32c85029": "모두 숨기기", + "77ce79d865716719": "일치하는 프로젝트가 없습니다.", "af7eb4f9c7f0f575": "필터", "08247dd39b0c85ff": "담당자", "5cad5a7879c8d38c": "레이블을 찾을 수 없음", @@ -5798,6 +5801,7 @@ "297613ddcf68d031": "정렬", "4aa8190ec693085e": "트래커별 필터", "d44aed6ee67982dd": "이슈 새로 고침", + "df23678c28c56593": "모든 프로젝트가 숨겨져 있습니다", "2ccf231996dc89c2": "읽을 트래커 없음", "ffdb63a22901a1fa": "원격 저장소가 지원되는 트래커에 있는 프로젝트를 추가하세요.", "403e9debff81d7df": [ @@ -9678,7 +9682,6 @@ "51497bd401292062": "길게 누르기", "9d6cc6ac23312071": "두 번 누르기", "f001fa7b329c8fbf": "성공한 항목 숨기기", - "ad208e3e32c85029": "모두 숨기기", "c80e4bb3201efd71": "Zen", "0cb9ffcd1fb46b0c": "상태만", "cf0f7fc3df26fa75": "상태 및 메시지", diff --git a/apps/web/src/i18n/translations/pt-BR.json b/apps/web/src/i18n/translations/pt-BR.json index 6ab44ccc24f70..bf2af0b1f9867 100644 --- a/apps/web/src/i18n/translations/pt-BR.json +++ b/apps/web/src/i18n/translations/pt-BR.json @@ -5778,9 +5778,12 @@ "1cf216566c1ee064": "Projeto indisponível", "b5ddadeb0810688c": "Estado", "93c1fc19d9bf1db0": "Envolvimento", + "d5a8b335d88b65bc": "{hidden} ocultos", "2160067266a61dd8": "Qualquer", "cd4ec4acf33c65b9": "{count, plural, one {{count} rótulo} other {{count} rótulos}}", "bfd20acb8b7dee6b": "Qualquer pessoa", + "ad208e3e32c85029": "Ocultar todas", + "77ce79d865716719": "Nenhum projeto correspondente.", "af7eb4f9c7f0f575": "Filtros", "08247dd39b0c85ff": "Responsável", "5cad5a7879c8d38c": "Nenhum rótulo encontrado", @@ -5817,6 +5820,7 @@ "297613ddcf68d031": "Ordenar", "4aa8190ec693085e": "Filtrar por rastreador", "d44aed6ee67982dd": "Atualizar issues", + "df23678c28c56593": "Todos os projetos estão ocultos", "2ccf231996dc89c2": "Nenhum rastreador para ler", "ffdb63a22901a1fa": "Adicione um projeto cujo remoto esteja em um rastreador compatível.", "403e9debff81d7df": [ @@ -9722,7 +9726,6 @@ "51497bd401292062": "Manter pressionado", "9d6cc6ac23312071": "Pressionar duas vezes", "f001fa7b329c8fbf": "Ocultar bem-sucedidas", - "ad208e3e32c85029": "Ocultar todas", "c80e4bb3201efd71": "Zen", "0cb9ffcd1fb46b0c": "Só status", "cf0f7fc3df26fa75": "Status e mensagens", diff --git a/apps/web/src/i18n/translations/ru.json b/apps/web/src/i18n/translations/ru.json index ea00719da3b6b..fefbaa68105b6 100644 --- a/apps/web/src/i18n/translations/ru.json +++ b/apps/web/src/i18n/translations/ru.json @@ -5778,9 +5778,12 @@ "1cf216566c1ee064": "Проект недоступен", "b5ddadeb0810688c": "Состояние", "93c1fc19d9bf1db0": "Участие", + "d5a8b335d88b65bc": "Скрыто: {hidden}", "2160067266a61dd8": "Любая", "cd4ec4acf33c65b9": "{count, plural, one {{count} метка} few {{count} метки} many {{count} меток} other {{count} метки}}", "bfd20acb8b7dee6b": "Любой", + "ad208e3e32c85029": "Скрывать все", + "77ce79d865716719": "Нет подходящих проектов.", "af7eb4f9c7f0f575": "Фильтры", "08247dd39b0c85ff": "Исполнитель", "5cad5a7879c8d38c": "Метки не найдены", @@ -5817,6 +5820,7 @@ "297613ddcf68d031": "Сортировать", "4aa8190ec693085e": "Фильтр по трекеру", "d44aed6ee67982dd": "Обновить issue", + "df23678c28c56593": "Все проекты скрыты", "2ccf231996dc89c2": "Нет трекеров для чтения", "ffdb63a22901a1fa": "Добавьте проект, у которого remote находится в поддерживаемом трекере.", "403e9debff81d7df": [ @@ -9725,7 +9729,6 @@ "51497bd401292062": "Удержание", "9d6cc6ac23312071": "Двойное нажатие", "f001fa7b329c8fbf": "Скрывать успешные", - "ad208e3e32c85029": "Скрывать все", "c80e4bb3201efd71": "Дзен", "0cb9ffcd1fb46b0c": "Только статус", "cf0f7fc3df26fa75": "Статус и сообщения", diff --git a/apps/web/src/i18n/translations/sv.json b/apps/web/src/i18n/translations/sv.json index baf63922386cb..69eca250158a0 100644 --- a/apps/web/src/i18n/translations/sv.json +++ b/apps/web/src/i18n/translations/sv.json @@ -5779,9 +5779,12 @@ "1cf216566c1ee064": "Projektet är inte tillgängligt", "b5ddadeb0810688c": "Status", "93c1fc19d9bf1db0": "Inblandning", + "d5a8b335d88b65bc": "{hidden} dolda", "2160067266a61dd8": "Alla", "cd4ec4acf33c65b9": "{count, plural, one {{count} etikett} other {{count} etiketter}}", "bfd20acb8b7dee6b": "Vem som helst", + "ad208e3e32c85029": "Dölj alla", + "77ce79d865716719": "Inga matchande projekt.", "af7eb4f9c7f0f575": "Filter", "08247dd39b0c85ff": "Tilldelad", "5cad5a7879c8d38c": "Inga etiketter hittades", @@ -5818,6 +5821,7 @@ "297613ddcf68d031": "Sortera", "4aa8190ec693085e": "Filtrera efter ärendehanterare", "d44aed6ee67982dd": "Uppdatera ärenden", + "df23678c28c56593": "Alla projekt är dolda", "2ccf231996dc89c2": "Inga ärendehanterare att läsa", "ffdb63a22901a1fa": "Lägg till ett projekt vars fjärr finns i en ärendehanterare som stöds.", "403e9debff81d7df": [ @@ -9731,7 +9735,6 @@ "51497bd401292062": "Håll ned", "9d6cc6ac23312071": "Dubbeltryck", "f001fa7b329c8fbf": "Dölj lyckade", - "ad208e3e32c85029": "Dölj alla", "c80e4bb3201efd71": "Zen", "0cb9ffcd1fb46b0c": "Endast status", "cf0f7fc3df26fa75": "Status och meddelanden", diff --git a/apps/web/src/i18n/translations/zh.json b/apps/web/src/i18n/translations/zh.json index 8f05fc5be57bc..1fcd0b2f96920 100644 --- a/apps/web/src/i18n/translations/zh.json +++ b/apps/web/src/i18n/translations/zh.json @@ -5785,9 +5785,12 @@ "1cf216566c1ee064": "不可用的项目", "b5ddadeb0810688c": "状态", "93c1fc19d9bf1db0": "参与方式", + "d5a8b335d88b65bc": "已隐藏 {hidden} 个", "2160067266a61dd8": "任意", "cd4ec4acf33c65b9": "{count, plural, other {{count} 个标签}}", "bfd20acb8b7dee6b": "任何人", + "ad208e3e32c85029": "全部隐藏", + "77ce79d865716719": "没有匹配的项目。", "af7eb4f9c7f0f575": "筛选条件", "08247dd39b0c85ff": "受理人", "5cad5a7879c8d38c": "未找到标签", @@ -5824,6 +5827,7 @@ "297613ddcf68d031": "排序", "4aa8190ec693085e": "按跟踪器筛选", "d44aed6ee67982dd": "刷新 issue", + "df23678c28c56593": "所有项目均已隐藏", "2ccf231996dc89c2": "没有可读取的跟踪器", "ffdb63a22901a1fa": "请添加一个远端位于受支持跟踪器上的项目。", "403e9debff81d7df": [ @@ -9738,7 +9742,6 @@ "51497bd401292062": "长按", "9d6cc6ac23312071": "连按两次", "f001fa7b329c8fbf": "隐藏成功的调用", - "ad208e3e32c85029": "全部隐藏", "c80e4bb3201efd71": "专注模式", "0cb9ffcd1fb46b0c": "仅状态", "cf0f7fc3df26fa75": "状态和消息", diff --git a/docs/user/source-control.md b/docs/user/source-control.md index ce57f727ff6ae..138e4c9acf62e 100644 --- a/docs/user/source-control.md +++ b/docs/user/source-control.md @@ -369,8 +369,9 @@ out from the matching organization and repository. The Issues page lists the issues of every project whose remote is on GitHub, GitLab, Azure DevOps or Forgejo, grouped per tracker account. Open it from the sidebar's utility row or with **Open issues** in the command palette. Filter by open or closed, by your involvement -(assigned, opened by you, mentioning you), by project, and by tracker; the search box asks the tracker -itself where it can search. Press **Load more** at the end of a group to read further back. +(assigned, opened by you, mentioning you), and by tracker. Under **Projects**, uncheck the +projects you do not want to see; the list remembers them, and a project you add later shows. +The search box asks the tracker itself where it can search. Press **Load more** at the end of a group to read further back. The **Views** menu saves and restores a search, filter, and sort setup, as it does for pull requests. diff --git a/packages/client-runtime/src/issueList.test.ts b/packages/client-runtime/src/issueList.test.ts index 300eacc5a3408..5085c10e51887 100644 --- a/packages/client-runtime/src/issueList.test.ts +++ b/packages/client-runtime/src/issueList.test.ts @@ -6,7 +6,6 @@ import type { IssueTrackerSummary, ProjectId, } from "@t3tools/contracts"; -import type { EnvironmentProject } from "./state/models.ts"; import { describe, expect, it } from "vite-plus/test"; import { @@ -143,46 +142,6 @@ describe("issueFilterScopes", () => { [environmentId, hold(answer({ trackers: [tracker({})], entries: [], scopes: [scope] }))], ]); expect(issueFilterScopes(held, [])).toEqual([{ environmentId, input: scope }]); - const otherProjectId = "web" as ProjectId; - const projects = [api, otherProjectId].map((id) => ({ - id, - environmentId, - repositoryIdentity: { - provider: "github", - canonicalKey: `github.com/acme/${id}`, - owner: "acme", - name: id, - }, - })) as unknown as ReadonlyArray; - const withRepositories = new Map([ - [ - environmentId, - hold( - answer({ - trackers: [ - tracker({}), - tracker({ tracker: "github" as IssueTrackerKind, host: "github.com" }), - ], - scopes: [scope, { ...scope, projectId: otherProjectId, scope: "WEB" }], - }), - ), - ], - ]); - expect( - issueFilterScopes(withRepositories, projects, { environmentId, projectId: api }), - ).toEqual([ - { - environmentId, - input: { projectId: api, tracker: "github", host: "github.com", scope: "acme/api" }, - }, - { environmentId, input: scope }, - ]); - expect( - issueFilterScopes(withRepositories, projects, { - environmentId: "other" as EnvironmentId, - projectId: api, - }), - ).toEqual([]); }); it("skips a tracker that cannot be read", () => { diff --git a/packages/client-runtime/src/issueList.ts b/packages/client-runtime/src/issueList.ts index a5f3f2d5d1709..df0f80aae5c57 100644 --- a/packages/client-runtime/src/issueList.ts +++ b/packages/client-runtime/src/issueList.ts @@ -8,7 +8,6 @@ import type { IssueScopeRef, IssueTrackerSummary, SourceControlProviderKind, - ProjectId, } from "@t3tools/contracts"; import { mergeIssueListPage } from "./state/issues.ts"; @@ -168,14 +167,11 @@ export function groupIssues( export function issueFilterScopes( held: ReadonlyMap, projects: ReadonlyArray, - selectedProject?: { readonly environmentId: EnvironmentId; readonly projectId: ProjectId }, ) { const scopes: Array<{ readonly environmentId: EnvironmentId; readonly input: IssueScopeRef }> = []; for (const [environmentId, page] of held) { - if (selectedProject && selectedProject.environmentId !== environmentId) continue; for (const project of projects) { - if (selectedProject && selectedProject.projectId !== project.id) continue; if (project.environmentId !== environmentId) continue; const identity = project.repositoryIdentity; const kind = identity?.provider as SourceControlProviderKind | undefined; @@ -208,7 +204,6 @@ export function issueFilterScopes( scope, })); for (const input of covered) { - if (selectedProject && selectedProject.projectId !== input.projectId) continue; const host = input.host?.toLowerCase(); const tracker = page.answer.trackers.find( (t) => t.tracker === input.tracker && t.host.toLowerCase() === host, diff --git a/packages/contracts/src/issue.ts b/packages/contracts/src/issue.ts index 07f2eab6e6a42..b17911da295e2 100644 --- a/packages/contracts/src/issue.ts +++ b/packages/contracts/src/issue.ts @@ -256,10 +256,16 @@ export const IssueListCursors = Schema.Record( ); export type IssueListCursors = typeof IssueListCursors.Type; +export const ISSUE_LIST_MAX_EXCLUDED_PROJECTS = 1_000; + export const IssueListInput = Schema.Struct({ state: IssueListState, involvement: Schema.optional(IssueInvolvement), projectId: Schema.optional(ProjectId), + /** Projects left out of the listing, as the issues page hides them. */ + excludeProjectIds: Schema.optional( + Schema.Array(ProjectId).check(Schema.isMaxLength(ISSUE_LIST_MAX_EXCLUDED_PROJECTS)), + ), /** Narrows to one host, named as the host itself. Absent means every host the workspace has. */ host: Schema.optional(TrimmedNonEmptyString), /** Rows per scope, which with a continuation is rows per slice. */ From 38d27db7467099babcf6dfb39db04938603137a5 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Thu, 19 Nov 2026 16:49:10 -0800 Subject: [PATCH 161/201] perf(server): refreshing a branch list frees the snapshot it replaces (#39440) --- apps/server/src/vcs/GitVcsDriverCore.test.ts | 50 ++++++++++++++++++++ apps/server/src/vcs/GitVcsDriverCore.ts | 32 +++++++++---- 2 files changed, 74 insertions(+), 8 deletions(-) diff --git a/apps/server/src/vcs/GitVcsDriverCore.test.ts b/apps/server/src/vcs/GitVcsDriverCore.test.ts index 1d5c25573a851..4d248f465f454 100644 --- a/apps/server/src/vcs/GitVcsDriverCore.test.ts +++ b/apps/server/src/vcs/GitVcsDriverCore.test.ts @@ -1712,6 +1712,56 @@ it.effect("retries an in-flight ref snapshot invalidated by a mutation", () => ), ); +it.effect("superseded ref snapshots of one repository do not evict another's", () => + Effect.scoped( + Effect.gen(function* () { + const delegate = yield* ChildProcessSpawner.ChildProcessSpawner; + const quietRepo = yield* makeTmpDir(); + const quietRepoRealPath = NodeFS.realpathSync.native(quietRepo); + const quietRepoScans = yield* Ref.make(0); + const countingSpawner = ChildProcessSpawner.make((command) => + Effect.gen(function* () { + if ( + ChildProcess.isStandardCommand(command) && + command.args.includes("for-each-ref") && + command.args.includes("refs/remotes") && + NodeFS.realpathSync.native(String(command.options.cwd)).startsWith(quietRepoRealPath) + ) { + yield* Ref.update(quietRepoScans, (count) => count + 1); + } + return yield* delegate.spawn(command); + }), + ); + const driver = yield* makeGitVcsDriverCore().pipe( + Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, countingSpawner), + ); + const busyRepo = yield* makeTmpDir(); + yield* initRepoWithCommit(quietRepo).pipe( + Effect.provideService(GitVcsDriver.GitVcsDriver, driver), + ); + yield* initRepoWithCommit(busyRepo).pipe( + Effect.provideService(GitVcsDriver.GitVcsDriver, driver), + ); + + yield* driver.listRefs({ cwd: quietRepo }); + // More epochs than the snapshot cache holds. + for (let index = 0; index < 70; index++) { + yield* driver.invalidateRefs(busyRepo); + yield* driver.listRefs({ cwd: busyRepo }); + } + yield* driver.listRefs({ cwd: quietRepo }); + + assert.equal(yield* Ref.get(quietRepoScans), 1); + }), + ).pipe( + Effect.provide( + layerServerConfig.pipe( + Layer.provideMerge(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer)), + ), + ), + ), +); + it.effect("invalidates a ref snapshot when a mutation fails after changing Git", () => Effect.scoped( Effect.gen(function* () { diff --git a/apps/server/src/vcs/GitVcsDriverCore.ts b/apps/server/src/vcs/GitVcsDriverCore.ts index 3b1a066303ba3..b88ade8863259 100644 --- a/apps/server/src/vcs/GitVcsDriverCore.ts +++ b/apps/server/src/vcs/GitVcsDriverCore.ts @@ -5037,15 +5037,31 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* timeToLive: (exit) => (Exit.isSuccess(exit) ? LIST_REFS_SNAPSHOT_CACHE_TTL : Duration.zero), }, ); + // Readers only ask for the current epoch and Cache expires entries lazily, so a superseded + // snapshot (megabytes in a repository with many remote branches) would stay until evicted. + const advanceListRefsEpoch = Effect.fn("GitVcsDriver.advanceListRefsEpoch")(function* ( + gitCommonDir: string, + ) { + const previous = listRefsEpochByCommonDir.get(gitCommonDir); + const epoch = bumpListRefsEpoch(gitCommonDir); + if (previous !== undefined) { + yield* Cache.invalidate( + listRefsSnapshotCache, + new GitRefsSnapshotCacheKey({ gitCommonDir, epoch: previous }), + ); + } + return epoch; + }); const listRefsRefreshSnapshotCache = yield* Cache.makeWith( (cacheKey: GitRefsRefreshCacheKey) => - Effect.suspend(() => { - const epoch = bumpListRefsEpoch(cacheKey.gitCommonDir); - return Cache.get( - listRefsSnapshotCache, - new GitRefsSnapshotCacheKey({ gitCommonDir: cacheKey.gitCommonDir, epoch }), - ); - }), + advanceListRefsEpoch(cacheKey.gitCommonDir).pipe( + Effect.flatMap((epoch) => + Cache.get( + listRefsSnapshotCache, + new GitRefsSnapshotCacheKey({ gitCommonDir: cacheKey.gitCommonDir, epoch }), + ), + ), + ), { capacity: LIST_REFS_SNAPSHOT_CACHE_CAPACITY, timeToLive: (exit) => @@ -5087,7 +5103,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* if (commonDir == null) return; const previousGeneration = currentListRefsGeneration(commonDir); bumpListRefsGeneration(commonDir); - bumpListRefsEpoch(commonDir); + yield* advanceListRefsEpoch(commonDir); yield* Cache.invalidate( listRefsRefreshSnapshotCache, new GitRefsRefreshCacheKey({ From bb1a66a3a45f258da139a2a68f074b9fbc0f4b24 Mon Sep 17 00:00:00 2001 From: Bilal Bakr <62337003+Bil0000@users.noreply.github.com> Date: Fri, 20 Nov 2026 03:58:06 +0300 Subject: [PATCH 162/201] feat(web): reference a side chat from its main thread with Add to chat and @ (#38323) Co-authored-by: Yash Singh --- 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 +- apps/web/src/components/ThreadContextChip.tsx | 17 +++++- .../chat/MarkdownThreadLink.browser.test.tsx | 5 ++ apps/web/src/components/chat/SideChatPane.tsx | 60 ++++++------------- apps/web/src/i18n/translations/de.json | 10 +--- apps/web/src/i18n/translations/en.json | 10 +--- apps/web/src/i18n/translations/es.json | 10 +--- apps/web/src/i18n/translations/fr.json | 10 +--- apps/web/src/i18n/translations/ja.json | 10 +--- apps/web/src/i18n/translations/ko.json | 10 +--- apps/web/src/i18n/translations/pt-BR.json | 10 +--- apps/web/src/i18n/translations/ru.json | 10 +--- apps/web/src/i18n/translations/sv.json | 10 +--- apps/web/src/i18n/translations/zh.json | 10 +--- docs/user/thread-sidebar.md | 8 ++- .../src/composerThreadItems.test.ts | 28 +++++++++ .../client-runtime/src/composerThreadItems.ts | 19 ++++-- 26 files changed, 115 insertions(+), 142 deletions(-) diff --git a/apps/mobile/src/i18n/translations/de.json b/apps/mobile/src/i18n/translations/de.json index 14a72ef456de5..afa1198fff177 100644 --- a/apps/mobile/src/i18n/translations/de.json +++ b/apps/mobile/src/i18n/translations/de.json @@ -1,4 +1,5 @@ { + "4bcfa3b976a421cf": "Nebenchat", "23be753133ae6950": "Thread", "0001ae5846061bb6": "Thread auf {machine}", "eef7f4dacbc3c3f2": "Rechner", @@ -4801,7 +4802,6 @@ "13eb3e529a3e9bff": "Aus dem Thread entfernen", "986951276ab5723d": "Verknüpfung mit Thread lösen", "a9c188a91c93fdb4": "Beobachten konnte nicht geändert werden", - "4bcfa3b976a421cf": "Nebenchat", "afd7cfeb929fcdbd": "Der Nebenchat wurde erstellt, hat dieses Gerät aber nicht erreicht.", "0efeaa8d0ca3a757": "Der Nebenchat ist nicht mehr verfügbar.", "61fc2531d076d396": "Der Berechtigungsmodus des Nebenchats konnte nicht festgelegt werden.", diff --git a/apps/mobile/src/i18n/translations/en.json b/apps/mobile/src/i18n/translations/en.json index 3596aa21e36af..f699ea466b076 100644 --- a/apps/mobile/src/i18n/translations/en.json +++ b/apps/mobile/src/i18n/translations/en.json @@ -1,4 +1,5 @@ { + "4bcfa3b976a421cf": "Side chat", "23be753133ae6950": "Thread", "0001ae5846061bb6": "Thread on {machine}", "eef7f4dacbc3c3f2": "Machine", @@ -4802,7 +4803,6 @@ "13eb3e529a3e9bff": "Dismiss from thread", "986951276ab5723d": "Unlink from thread", "a9c188a91c93fdb4": "Couldn't change watching", - "4bcfa3b976a421cf": "Side chat", "afd7cfeb929fcdbd": "The side chat was created, but it did not reach this device.", "0efeaa8d0ca3a757": "The side chat is no longer available.", "61fc2531d076d396": "Could not set the side chat's permission mode.", diff --git a/apps/mobile/src/i18n/translations/es.json b/apps/mobile/src/i18n/translations/es.json index a18764f050d09..0e9074eea47d1 100644 --- a/apps/mobile/src/i18n/translations/es.json +++ b/apps/mobile/src/i18n/translations/es.json @@ -1,4 +1,5 @@ { + "4bcfa3b976a421cf": "Chat lateral", "23be753133ae6950": "Hilo", "0001ae5846061bb6": "Hilo en {machine}", "eef7f4dacbc3c3f2": "Máquina", @@ -4794,7 +4795,6 @@ "13eb3e529a3e9bff": "Descartar del hilo", "986951276ab5723d": "Desvincular del hilo", "a9c188a91c93fdb4": "No se pudo cambiar el seguimiento", - "4bcfa3b976a421cf": "Chat lateral", "afd7cfeb929fcdbd": "Se creó el chat lateral, pero no llegó a este dispositivo.", "0efeaa8d0ca3a757": "El chat lateral ya no está disponible.", "61fc2531d076d396": "No se pudo definir el modo de permisos del chat lateral.", diff --git a/apps/mobile/src/i18n/translations/fr.json b/apps/mobile/src/i18n/translations/fr.json index 9f12d87dd513b..f353a6b4986d8 100644 --- a/apps/mobile/src/i18n/translations/fr.json +++ b/apps/mobile/src/i18n/translations/fr.json @@ -1,4 +1,5 @@ { + "4bcfa3b976a421cf": "Discussion annexe", "23be753133ae6950": "Fil", "0001ae5846061bb6": "Fil sur {machine}", "eef7f4dacbc3c3f2": "Machine", @@ -4795,7 +4796,6 @@ "13eb3e529a3e9bff": "Écarter du fil", "986951276ab5723d": "Dissocier du fil", "a9c188a91c93fdb4": "Impossible de modifier le suivi", - "4bcfa3b976a421cf": "Discussion annexe", "afd7cfeb929fcdbd": "La discussion annexe a été créée, mais elle n’est pas parvenue sur cet appareil.", "0efeaa8d0ca3a757": "La discussion annexe n’est plus disponible.", "61fc2531d076d396": "Impossible de définir le mode d’autorisation de la discussion annexe.", diff --git a/apps/mobile/src/i18n/translations/ja.json b/apps/mobile/src/i18n/translations/ja.json index 441175f85337e..94a0bd9a1d3e2 100644 --- a/apps/mobile/src/i18n/translations/ja.json +++ b/apps/mobile/src/i18n/translations/ja.json @@ -1,4 +1,5 @@ { + "4bcfa3b976a421cf": "サイドチャット", "23be753133ae6950": "スレッド", "0001ae5846061bb6": "{machine} 上のスレッド", "eef7f4dacbc3c3f2": "マシン", @@ -4776,7 +4777,6 @@ "13eb3e529a3e9bff": "スレッドから除外", "986951276ab5723d": "スレッドからリンクを解除", "a9c188a91c93fdb4": "監視を変更できませんでした", - "4bcfa3b976a421cf": "サイドチャット", "afd7cfeb929fcdbd": "サイドチャットは作成されましたが、このデバイスに届きませんでした。", "0efeaa8d0ca3a757": "サイドチャットは利用できなくなりました。", "61fc2531d076d396": "サイドチャットの権限モードを設定できませんでした。", diff --git a/apps/mobile/src/i18n/translations/ko.json b/apps/mobile/src/i18n/translations/ko.json index c73c767074bde..56ee179e894df 100644 --- a/apps/mobile/src/i18n/translations/ko.json +++ b/apps/mobile/src/i18n/translations/ko.json @@ -1,4 +1,5 @@ { + "4bcfa3b976a421cf": "사이드 채팅", "23be753133ae6950": "스레드", "0001ae5846061bb6": "{machine}의 스레드", "eef7f4dacbc3c3f2": "머신", @@ -4781,7 +4782,6 @@ "13eb3e529a3e9bff": "스레드에서 제외", "986951276ab5723d": "스레드에서 연결 해제", "a9c188a91c93fdb4": "지켜보기를 변경할 수 없습니다", - "4bcfa3b976a421cf": "사이드 채팅", "afd7cfeb929fcdbd": "사이드 채팅이 생성되었지만 이 기기에 도착하지 않았습니다.", "0efeaa8d0ca3a757": "사이드 채팅을 더 이상 사용할 수 없습니다.", "61fc2531d076d396": "사이드 채팅의 권한 모드를 설정할 수 없습니다.", diff --git a/apps/mobile/src/i18n/translations/pt-BR.json b/apps/mobile/src/i18n/translations/pt-BR.json index 8c9071db5dfee..9fbcaaf1d6fa4 100644 --- a/apps/mobile/src/i18n/translations/pt-BR.json +++ b/apps/mobile/src/i18n/translations/pt-BR.json @@ -1,4 +1,5 @@ { + "4bcfa3b976a421cf": "Chat paralelo", "23be753133ae6950": "Thread", "0001ae5846061bb6": "Thread em {machine}", "eef7f4dacbc3c3f2": "Máquina", @@ -4795,7 +4796,6 @@ "13eb3e529a3e9bff": "Dispensar da thread", "986951276ab5723d": "Desvincular da thread", "a9c188a91c93fdb4": "Não foi possível alterar o acompanhamento", - "4bcfa3b976a421cf": "Chat paralelo", "afd7cfeb929fcdbd": "O chat paralelo foi criado, mas não chegou a este dispositivo.", "0efeaa8d0ca3a757": "O chat paralelo não está mais disponível.", "61fc2531d076d396": "Não foi possível definir o modo de permissão do chat paralelo.", diff --git a/apps/mobile/src/i18n/translations/ru.json b/apps/mobile/src/i18n/translations/ru.json index ce752d7d25c6f..31c1677c7e12d 100644 --- a/apps/mobile/src/i18n/translations/ru.json +++ b/apps/mobile/src/i18n/translations/ru.json @@ -1,4 +1,5 @@ { + "4bcfa3b976a421cf": "Боковой чат", "23be753133ae6950": "Тред", "0001ae5846061bb6": "Тред на {machine}", "eef7f4dacbc3c3f2": "Машина", @@ -4873,7 +4874,6 @@ "13eb3e529a3e9bff": "Убрать из треда", "986951276ab5723d": "Отвязать от треда", "a9c188a91c93fdb4": "Не удалось изменить отслеживание", - "4bcfa3b976a421cf": "Боковой чат", "afd7cfeb929fcdbd": "Боковой чат создан, но не дошёл до этого устройства.", "0efeaa8d0ca3a757": "Боковой чат больше недоступен.", "61fc2531d076d396": "Не удалось задать режим разрешений бокового чата.", diff --git a/apps/mobile/src/i18n/translations/sv.json b/apps/mobile/src/i18n/translations/sv.json index c87a75ea47e5d..4c62afb649f59 100644 --- a/apps/mobile/src/i18n/translations/sv.json +++ b/apps/mobile/src/i18n/translations/sv.json @@ -1,4 +1,5 @@ { + "4bcfa3b976a421cf": "Sidochatt", "23be753133ae6950": "Tråd", "0001ae5846061bb6": "Tråd på {machine}", "eef7f4dacbc3c3f2": "Dator", @@ -4801,7 +4802,6 @@ "13eb3e529a3e9bff": "Avfärda från tråden", "986951276ab5723d": "Ta bort länk från tråd", "a9c188a91c93fdb4": "Kunde inte ändra bevakningen", - "4bcfa3b976a421cf": "Sidochatt", "afd7cfeb929fcdbd": "Sidochatten skapades, men den nådde inte den här enheten.", "0efeaa8d0ca3a757": "Sidochatten är inte längre tillgänglig.", "61fc2531d076d396": "Kunde inte ange sidochattens behörighetsläge.", diff --git a/apps/mobile/src/i18n/translations/zh.json b/apps/mobile/src/i18n/translations/zh.json index ce8b8caf281d5..d1d05c0aad116 100644 --- a/apps/mobile/src/i18n/translations/zh.json +++ b/apps/mobile/src/i18n/translations/zh.json @@ -1,4 +1,5 @@ { + "4bcfa3b976a421cf": "侧聊", "23be753133ae6950": "会话", "0001ae5846061bb6": "{machine} 上的会话", "eef7f4dacbc3c3f2": "机器", @@ -4784,7 +4785,6 @@ "13eb3e529a3e9bff": "从会话中忽略", "986951276ab5723d": "取消与会话的关联", "a9c188a91c93fdb4": "无法更改关注状态", - "4bcfa3b976a421cf": "侧聊", "afd7cfeb929fcdbd": "侧聊已创建,但未同步到此设备。", "0efeaa8d0ca3a757": "这段侧聊已不可用。", "61fc2531d076d396": "无法设置侧聊的权限模式。", diff --git a/apps/web/src/components/ThreadContextChip.tsx b/apps/web/src/components/ThreadContextChip.tsx index 997324c50d9f7..cc099fc791a8c 100644 --- a/apps/web/src/components/ThreadContextChip.tsx +++ b/apps/web/src/components/ThreadContextChip.tsx @@ -1,9 +1,11 @@ import { scopeProjectRef } from "@t3tools/client-runtime/environment"; import type { ThreadContextRecord, ProjectId } from "@t3tools/contracts"; -import { Link } from "@tanstack/react-router"; +import { Link, useNavigate } from "@tanstack/react-router"; import { MessagesSquareIcon } from "lucide-react"; import { useGT } from "gt-react"; +import { resolveThreadOpenRoute } from "~/lib/sideChatPane"; +import { buildThreadRouteParams } from "~/threadRoutes"; import { useProject, useThreadShell } from "~/state/entities"; import { orchestrationEnvironment } from "~/state/orchestration"; import { useEnvironmentQuery } from "~/state/query"; @@ -32,6 +34,7 @@ export function ThreadContextChip(props: { const projectId = shell?.projectId ?? props.projectId ?? metadata?.projectId; const project = useProject(projectId ? scopeProjectRef(environmentId, projectId) : null); const title = shell?.title?.trim() || metadata?.title.trim() || props.record.title; + const navigate = useNavigate(); return ( { + if (shell?.lineage.sideChat !== true || event.button !== 0) return; + if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return; + // A side chat opens as a tab beside its parent, not as its own page. + event.preventDefault(); + void navigate({ + to: "/$environmentId/$threadId", + params: buildThreadRouteParams( + resolveThreadOpenRoute({ environmentId, threadId }, shell), + ), + }); + }} draggable={false} /> } diff --git a/apps/web/src/components/chat/MarkdownThreadLink.browser.test.tsx b/apps/web/src/components/chat/MarkdownThreadLink.browser.test.tsx index 6febe0ff8b343..80e8cdf0dbd76 100644 --- a/apps/web/src/components/chat/MarkdownThreadLink.browser.test.tsx +++ b/apps/web/src/components/chat/MarkdownThreadLink.browser.test.tsx @@ -51,6 +51,11 @@ function setup() { id: ThreadId.make("older-thread"), title: "Remote thread", projectId: ProjectId.make("essay-project"), + lineage: { + rootThreadId: ThreadId.make("older-thread"), + parentThreadId: null, + relationshipToParent: null, + }, }; return { reply, registry: AtomRegistry.make() }; } diff --git a/apps/web/src/components/chat/SideChatPane.tsx b/apps/web/src/components/chat/SideChatPane.tsx index 5fd40e5b001cc..ffd3845022a35 100644 --- a/apps/web/src/components/chat/SideChatPane.tsx +++ b/apps/web/src/components/chat/SideChatPane.tsx @@ -1,6 +1,4 @@ import { scopeThreadRef } from "@t3tools/client-runtime/environment"; -import { threadRuntimeIsActive } from "@t3tools/client-runtime/state/shell"; -import { resolveLatestMergeBackRun } from "@t3tools/client-runtime/state/thread-workflows"; import { isAtomCommandInterrupted, settlePromise, @@ -11,6 +9,7 @@ import { type ScopedThreadRef, type ThreadId, } from "@t3tools/contracts"; +import { threadContextRecord } from "@t3tools/shared/composerContextReferences"; import { T, useGT } from "gt-react"; import { Trash2Icon, XIcon } from "lucide-react"; import { useEffect, useState } from "react"; @@ -22,7 +21,7 @@ import { releaseComposerDraftUploads } from "../../lib/composerDraftUploads"; import type { SideChatParentPanel } from "../../lib/sideChatPane"; import { readLocalApi } from "../../localApi"; import { hostRightPanel, useRightPanelStore } from "../../rightPanelStore"; -import { useQuietThreadProjection, useQuietThreadShell } from "../../state/entities"; +import { useQuietThreadShell } from "../../state/entities"; import { useEnvironmentScope } from "../../state/session"; import { useEnvironmentShellHasSnapshot } from "../../state/shell"; import { threadEnvironment } from "../../state/threads"; @@ -33,7 +32,7 @@ import { toastManager } from "../ui/toast"; import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip"; import { BackgroundThreadContext } from "./backgroundThread"; -/** A side chat tab: its title, Bring back, Delete and Close, over the side chat's own chat. */ +/** A side chat tab: its title, Add to chat, Delete and Close, over the side chat's own chat. */ export default function SideChatPane(props: { readonly parentRef: ScopedThreadRef; readonly threadId: ThreadId; @@ -49,47 +48,20 @@ export default function SideChatPane(props: { [parentRef, threadId], ); const shell = useQuietThreadShell(threadRef); - const parent = useQuietThreadShell(parentRef); const snapshotLoaded = useEnvironmentShellHasSnapshot(parentRef.environmentId); - const projection = useQuietThreadProjection(shell === null ? null : threadRef)?.projection; const canOperate = useEnvironmentScope(parentRef.environmentId, AuthOrchestrationOperateScope); - const mergeBack = useAtomCommand(threadEnvironment.mergeBack, { reportFailure: false }); const deleteThread = useAtomCommand(threadEnvironment.delete, { reportFailure: false }); const confirmThreadDelete = useClientSettings((settings) => settings.confirmThreadDelete); - const [bringingBack, setBringingBack] = useState(false); const [deleting, setDeleting] = useState(false); - const mergeRun = projection ? resolveLatestMergeBackRun(projection) : null; - // A pending merge-back would fail the main thread's queued message, so the server refuses it. - const bringBackBlockedReason = !canOperate - ? gt("This connection cannot change threads.") - : threadRuntimeIsActive(parent?.runtime) - ? gt("Available when the main thread is idle.") - : mergeRun === null - ? gt("Available after a finished reply.") - : null; - - const bringBack = async () => { - if (bringBackBlockedReason !== null || mergeRun === null || bringingBack) return; - setBringingBack(true); - const result = await mergeBack({ - environmentId: parentRef.environmentId, - input: { sourceThreadId: threadId, targetThreadId: parentRef.threadId, runId: mergeRun.id }, - }); - setBringingBack(false); - if (result._tag === "Success") { - toastManager.add({ - type: "success", - title: gt("Brought back"), - description: gt("The main thread gets this side chat with your next message there."), - }); - } else if (!isAtomCommandInterrupted(result)) { - const error = squashAtomCommandFailure(result); - toastManager.add({ - type: "error", - title: gt("Could not bring back the side chat"), - ...(error instanceof Error ? { description: error.message } : {}), + // Closing an unused side chat deletes it, which would leave the link unreadable. + const canAddToChat = shell !== null && shell.latestUserMessageAt !== null; + const addToChat = () => { + if (!canAddToChat) return; + useComposerDraftStore + .getState() + .addThreadContexts(parentRef, [threadContextRecord(threadRef, shell.title)], { + insertAtCaret: false, }); - } }; const deleteSideChat = async () => { @@ -140,15 +112,17 @@ export default function SideChatPane(props: { } /> - {bringBackBlockedReason ?? gt("Adds this side chat to the main thread's next message.")} + {canAddToChat + ? gt("Adds this side chat to the main thread's next message.") + : gt("Available after the first message.")}