Repository navigation
Conversation
Finder and Dock launches inherit launchd's minimal environment, so Maven and JDKs installed by mise, asdf or SDKMAN were missing and a Homebrew JDK could be picked instead. Runtime discovery now merges a bounded login-shell environment into the inherited one (inherited values and PATH order still win) and scans the mise, asdf and SDKMAN install roots for both Java and Maven. The shell capture is read after a marker, capped by size and variable count, and falls back to the inherited environment on timeout or failure. Each managed root is read up to a fixed number of entries. When /usr/bin/java or a non-JDK shim comes first on PATH, discovery keeps scanning for a real JDK and only uses java_home's default when the system launcher is the sole Java on PATH.
Lithe Review结论: ⛔ 有阻塞 Findings
Scope Check
Suggestions
Summary目录发现和解析边界有所改善,但新增 shell 执行进入了界面同步选择链路,构成需要修复的交互回归。环境恢复目前也只接到候选路径枚举,尚未覆盖 Maven 子进程。P1 应在合并前修复;P2 为非阻塞修改建议。 Verification
|
…Maven probes Runtime selection (systemMavenExecutable, javaHomeOnPath) is called on the main actor from the run configuration UI, so it must not start a login shell or java_home. Background discovery now stores the login shell environment and /usr/bin/java's default JDK in MacShellEnvironmentCache; selection only merges what that cache holds and otherwise uses the inherited environment as before. Discovery also passes the enriched environment to the Maven -version probe, so a managed Maven that needs the shell's JAVA_HOME or PATH is not dropped. The probe cache key includes the variables that change the probed runtime.
|
两个问题都已在 a9b0c1a 中修复。 P1: P2: 新增测试:一个只有在 本地运行: |
这个还是觉得作为插件契约去进行约束,暂时不考虑进行硬编码的方案,但是非常感觉你提交的 PR |
Problem
Issue #1514: when Lithe starts from Finder or the Dock it gets launchd's minimal environment, so
PATHandJAVA_HOMEfrom the login shell are missing. Maven installed with mise (or asdf, SDKMAN) is not found, and Java selection can quietly fall back to a Homebrew JDK. Launching from a terminal works because the shell environment is inherited.MacRuntimeDiscoveryonly looked at the process environment, fixed Homebrew/system paths and SDKMAN's Java candidates. Maven had no managed-install lookup at all.Fix
All changes are in
macos/Sources/Lithe/Platform/MacOS/Runtime/MacRuntimeDiscovery.swift.enrichedEnvironmentruns the user's login shell once per discovery ($SHELL -ilc, 1.5 s timeout) and merges its environment into the inherited one. Inherited non-empty values keep priority, and inheritedPATHentries stay ahead of the shell's, so an explicitJAVA_HOME,MAVEN_HOMEorM2_HOMEstill wins.parseLoginShellEnvironmentreads only theenv -0records printed after a marker, because startup files can write to stderr andMacProcessRunnermerges it into the output. The capture is cut at 256 KB and 1024 variables, and anything over either limit is dropped as a whole, so a truncatedPATHnever replaces the inherited one. A timeout or non-zero exit falls back to the inherited environment.managedInstallationRootsadds mise (MISE_DATA_DIR), asdf (ASDF_DATA_DIR) and SDKMAN (SDKMAN_DIR) install roots for both Java and Maven. Each root is read up to 256 entries. Maven executables are de-duplicated by their resolved path, so acurrentsymlink and the version directory are probed once.javaHomeOnPathno longer stops at/usr/bin/java. A GUI launch puts/usr/binahead of the shell'sPATH, so it keeps scanning for a real JDK, skips launchers that are not inside a JDK home, and uses/usr/libexec/java_home's default only when the system launcher is the only Java onPATH.The Java runtime discovery capability record (
shared/platform-feature-matrix/features/java-runtime-discovery.json) listsMacRuntimeLocator.swiftand adds the Finder/Dock versus terminal checks to its manual verification steps.verificationStatusstays as it was.Testing
./.agents/skills/write-stable-tests/scripts/test-stability-macos.sh -- --filter MacRuntimeDiscoveryTests: all 10 tests pass. New cases cover managed mise/asdf Java and Maven roots with acurrentsymlink and inherited-priority merging, the/usr/bin/javaand non-JDK shim cases onPATH, the marker and size limits of the shell capture, and the bounded directory read. Fixtures are temp directories removed indefer, and a failed cleanup is recorded withIssue.record.verify-test-stability.sh,verify-platform-feature-matrix.sh,verify-platform-feature-matrix-change.sh upstream/preview,verify-agent-notes.sh,verify-service-boundaries.sh,verify-runtime-bundle-immutability.shandgenerate-i18n.mjs --checkpass.I have not done the manual Finder/Dock launch check with real mise/asdf/SDKMAN installs listed in the capability record.
Fixes #1514