commit d34058df636afd1f3e5d6930c7cb3a324cb1ae0e from: ale date: Thu Jul 23 21:10:06 2026 UTC Fix real: SSH_AUTH_SOCK llegaba null al proceso de IntelliJ mismo Confirmado en vivo con el diagnóstico anterior: [SSH_AUTH_SOCK=null] en el mensaje de error. No era un problema de GeneralCommandLine ni de su snapshot de entorno -- System.getenv("SSH_AUTH_SOCK") es null en el proceso de IntelliJ mismo esa sesión (depende de cómo Hyprland lo haya lanzado). Ningún override dentro del plugin puede inventar un valor que no existe en el proceso. Fix: sshAuthSock() cae a la ruta fija del socket ssh de gpg-agent (/run/user/1000/gnupg/S.gpg-agent.ssh, uid 1000, único usuario de esta máquina) cuando System.getenv() no lo tiene, verificando que el archivo exista antes de usarlo. Mismo patrón que ya se usa para la ruta del binario got -- deuda pendiente de hacer configurable en la Fase 6. commit - 9be28298176a33ce9e66c71491a8542868357c44 commit + d34058df636afd1f3e5d6930c7cb3a324cb1ae0e blob - ca1c724995286dc63875bd1e1e3a5386cdf4466d blob + 4d1f516c6ed3564d9e955b825316fb6a7414aa52 --- src/main/kotlin/dev/nezzontli/gotvcs/GotCommandLineWrapper.kt +++ src/main/kotlin/dev/nezzontli/gotvcs/GotCommandLineWrapper.kt @@ -27,31 +27,37 @@ class GotCommandLineWrapper { return if (nixPath.canExecute()) nixPath.path else "got" } + /** + * Confirmado en vivo: SSH_AUTH_SOCK puede llegar null al proceso de + * IntelliJ mismo (System.getenv, no solo el snapshot cacheado de + * GeneralCommandLine) según cómo Hyprland lo haya lanzado esa sesión -- + * no es algo que este plugin pueda forzar si el valor real no existe. + * Fallback a la ruta fija del socket ssh de gpg-agent en este sistema + * (uid 1000, único usuario). Igual que la ruta de `got`, debería ser + * configurable en la Fase 6 en vez de estar fija. + */ + private fun sshAuthSock(): String? { + System.getenv("SSH_AUTH_SOCK")?.let { return it } + val fallback = File("/run/user/1000/gnupg/S.gpg-agent.ssh") + return if (fallback.exists()) fallback.path else null + } + private fun run(workDir: File, vararg args: String): String { val commandLine = GeneralCommandLine(binaryPath(), *args) .withWorkDirectory(workDir) .withCharset(StandardCharsets.UTF_8) - // Fuerza el entorno real del proceso de IntelliJ (System.getenv, - // el mismo que ve /proc//environ) en vez del snapshot - // cacheado por la plataforma (EnvironmentUtil) que usa CONSOLE - // por defecto. Ver GotCommandLineWrapper: el fix anterior (solo - // forzar SSH_AUTH_SOCK sobre el snapshot CONSOLE) no fue - // suficiente para got fetch por SSH -- se prueba reemplazando - // la base entera del entorno. .withParentEnvironmentType(GeneralCommandLine.ParentEnvironmentType.SYSTEM) - System.getenv("SSH_AUTH_SOCK")?.let { commandLine.environment["SSH_AUTH_SOCK"] = it } + val sshAuthSock = sshAuthSock() + sshAuthSock?.let { commandLine.environment["SSH_AUTH_SOCK"] = it } val output = try { ExecUtil.execAndGetOutput(commandLine) } catch (e: ExecutionException) { throw VcsException("No se pudo ejecutar got ${args.joinToString(" ")}: ${e.message}", e) } if (output.exitCode != 0) { - // SSH_AUTH_SOCK visto por el JVM se incluye temporalmente en el - // mensaje (deuda de diagnóstico, Fase 6) para confirmar en vivo - // qué valor recibe realmente el subproceso. throw VcsException( "got ${args.joinToString(" ")} salió con código ${output.exitCode}: " + - "${output.stderr.trim()} [SSH_AUTH_SOCK=${System.getenv("SSH_AUTH_SOCK")}]" + "${output.stderr.trim()} [SSH_AUTH_SOCK=$sshAuthSock]" ) } return output.stdout