Repository navigation
refactor(run): 自动识别的运行配置只存在内存里,不再写进用户工程 - #1580
Merged
Merged
Conversation
…n actor The engine copied the whole client state for every request, document change, and server message while holding the session locks. That state holds the full text of every open document, so a jdtls project import, which publishes thousands of messages, kept completion and navigation waiting behind the copies. Open document text is now shared (Arc<str>, still a plain JSON string), and each server message is parsed once, outside the state lock, instead of up to three times. macOS drained Core's event queue on the main actor every 10 ms while requests were pending, waiting on the same session lock. The drain now runs off the main actor; a send waits for a drain already in flight, so a drain still never returns a reply before its operation is registered. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The JDT -data fingerprint no longer includes build-file mtime or size. jdtls already detects pom and Gradle script edits itself (MavenProjectImporter.needsMavenUpdate, GradleProjectImporter. checkGradlePersistence), so switching to a fresh -data directory on every edit only turned an incremental update into a full re-import. The Gradle wrapper distribution stays part of the key because jdtls does not check it. jdtls now launches with the GC and logging defaults vscode-java and the upstream CI use (ParallelGC with GCTimeRatio=4 and AdaptiveSizePolicyWeight=90, -Xlog:disable, DetectVMInstallationsJob disabled). A plugin option with the same key replaces each default, and a plugin collector choice replaces ParallelGC. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… workspace Identifying a project wrote .lithe/run/generated.json, toolchains/ requirements.json, project.json and .gitignore into the user's workspace, and Run and Debug stayed unavailable until the user pressed "Identify project". Core now owns the detected layer: - runConfig.generate stores its result per workspace in process memory (execution/generated_layer.rs); inspect, resolve, user-configuration id checks and toolchain diagnostics read it from there. - An optional cacheDirectory records the result in the application cache so a new session can list JDT's previous Java entry points before JDT answers. A .lithe/run/generated.json left by older versions is only read as that seed, never written. - resolve picks the default configuration (framework service first, else the first detected entry other than Current File) when project.json names none. - selectJava derives the project JDK minimum from pom.xml / .java-version / the Maven wrapper before any generation. Hosts stop writing detection files and identify automatically: - Windows removes run_write_generated; the run store identifies a project on load when inspect reports missing, without the entry-count notice. - macOS removes MacRunConfigurationStore.writeGenerated, passes the cache directory, identifies after the workspace snapshot is applied, and drops the "regenerate broken generated.json" action. - UI copy no longer mentions generated.json (shared i18n regenerated). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1lck
marked this pull request as ready for review
October 29, 2026 10:36
Lithe Review结论: ⛔ 有阻塞 Findings
Scope Check
Suggestions
Summary内存检测层及平台接口的调整方向一致,但首次加载仍有工程写入,保存构建配置后的重启也会漏掉检测入口。这两项影响核心运行流程,需要修复后合并。 Verification
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
打开项目后,Lithe 识别运行入口时会往用户工程里写
.lithe/run/generated.json、.lithe/toolchains/requirements.json、.lithe/project.json和.lithe/.gitignore。在写这些文件之前,Run 和 Debug 都不可用,需要先手动点“识别项目”。这带来几个问题:只读检出会失败,版本控制里多出用户没要的文件,文件监听把这些写入当成工程变化;两端还各自维护了“generated.json 损坏后重新生成”的入口。本 PR 参考 openidea 的做法:检测结果只放在内存里,只有用户保存的配置才写进工程。
改动
Rust Core
execution/generated_layer.rs:按规范化后的工作区路径,在进程内存中保存最近一次runConfig.generate的结果(运行配置文档和工具链需求)。inspect、resolve、创建用户配置时的 id 冲突检查、toolchain_diagnostics都改为读内存,不再读.lithe/run/generated.json和.lithe/toolchains/requirements.json。本进程还没识别过的工作区,inspect返回status: "missing"。GenerateRequest新增可选的cacheDirectory:生成结果写到<cacheDirectory>/run-configurations/<sha256(工作区路径)>.json。JDT 还没回答时,生成器按“本进程的结果 → 应用缓存 → 旧版本留下的generated.json(只读)”的顺序取上次的 Java 入口,运行列表不会因 JDT 冷启动而变空。缓存读写失败只是少一份加速,不会报错。resolve:project.json没写defaultRunConfiguration时,由 Core 选默认项——框架服务(Spring Boot、Quarkus、Micronaut)优先,否则选第一个不是 Current File 的检测入口。这条规则以前两端各写了一份,并在第一次生成时写进project.json。read_requirements/runConfig.selectJava:还没识别时,直接从pom.xml、.java-version、Maven Wrapper 推导最低 JDK 版本,供 JDT 启动前选 JDK 使用,不再读一份可能过期的requirements.json。read_document。Windows
run_write_generated及write_generated_documents、WriteGeneratedArgs、pretty_json,tauri-core.ts中的路由同步删除。generateRunConfiguration通过appCacheDir()传cacheDirectory。run.store.ts:loadProject遇到missing时直接调用generate(root, undefined, { automatic: true }),不再停在“请生成”状态。loadProject只在打开运行面板、设置、Agent 查询或启动 Java 时触发,打开工程本身不会触发。自动识别不显示“识别到 N 个入口”的提示;JDT 就绪后的刷新沿用发起那次识别的标记。编辑器保存后重新加载时,遇到missing也会先识别。defaultGeneratedConfigurationId(改由 Core 选),恢复路径列表中去掉generated.json和requirements.json。macOS
MacRunConfigurationStore.writeGenerated和writeJSONObject;generate传storage.cacheDirectory()。.lithe/.gitignore仍由保存本机配置时的ensureLocalRunIgnored维护。AppModel.loadProjectServices:工作区快照就绪后,如果状态是missing,自动调用generateFromJavaEntrypoints(..., automatic: true)。automatic参数一路传到RunService.generateRunConfigurations:自动识别成功后generationState保持.idle,没有入口时仍显示.noEntries。RunView删除“重新生成损坏的 generated.json / requirements.json”按钮(这两个文件不再存在);“打开配置”的默认路径改为.lithe/run/configurations.json;恢复路径列表同步去掉这两个文件。界面文案(共享 i18n)
run.missingMessage不再提generated.json,例如“Identify the project to enable Run and Debug…”/“识别项目后即可使用运行和调试…”。已重新生成Localizable.strings和shared.generated.ts。文档
2026-10-29-run-configuration-detection-in-memory.md:记录决策、被否方案,以及缓存文件的生命周期、所有权和可写位置。缓存位于应用缓存目录,不影响 app bundle、代码签名和 Sparkle 增量更新。shared/contracts/rust-core-api.md更新generate、resolve、selectJava的行为说明;功能矩阵run-discovery补充说明和证据。.artifacts资源,因此不涉及worktree-resources.json。兼容性
.lithe/run/generated.json、requirements.json不会被删除或改写,只作为上次 Java 入口的只读来源。.lithe/project.json仍是用户可编辑的团队文档,其中的defaultRunConfiguration继续优先。runtimeRequirements仍读取远端文件,远程运行配置发现本来就未接入。仓库 Skill 自审与修复(2026-10-29)
结论:已修复一项 P1 回归;最终改动未发现需要阻塞合并的问题。 按
lithe-code-review、develop-lithe、write-stable-tests和agent-notes完成自审。发现并修复的问题
保存过构建任务的工程重启后,内存检测层消失,但
inspect因保存的任务仍返回ready,两端便跳过自动识别。实测重启前为 Spring Boot 服务 + 保存任务,重启后只剩保存任务。问题由本 PR 将生成层改为进程内存后引入。修复提交
145ddc33d:Core 返回独立的requiresGeneration标记;Mac 和 Windows 在已保存任务可用时仍按该标记补齐自动入口,完成识别后不重复生成。Windows 保存配置后的重新加载也处理该标记。共享契约、fixture、功能矩阵、Agent Note 及两端回归测试同步更新。已合入最新 previewd3072abd4和 #1573 的e57008986。范围与验证
verify-rust-core.sh通过:1349 个 Core 单元测试、其他 Rust targets、Swift 编译、C ABI、符号和执行集成验证。🤖 Generated with Claude Code
真实 macOS 应用验收补充(2026-10-29)
在包含两项 PR 的
145ddc33d预览包中实际操作 RuoYi-Vue(13db1fc,266 个 Java 源文件):打开项目自动出现运行配置并默认选中 ruoyi-admin;Java 导入完成;输入 SpringApplication.r 得到 run 方法补全,F12 能进入 Spring 依赖源码。独立 Hello.java 样例经界面完成编译、启动、输出和停止,未留下样例进程。完整退出并启动新进程后,使用 Core 文档转换准备的已保存 build.provider 测试任务与自动检测的 8 个 Java/服务入口同时显示,无需手动识别,验证了本次重启回归修复。此项未覆盖通过 UI 保存任务。操作前后 1,394 个 bundle 文件哈希一致;基线在初次启动后采集,因此不将此结果描述为完整启动期间的哈希验证。验收后应用与 Java 子进程全部退出。
限制:未运行 Windows 虚拟机,未做前后版本性能基准,也未启动依赖数据库/Redis 的若依服务。真实界面还暴露出既有检测器把继承 Spring Boot 插件的库模块列作服务的问题;该检测器不在两项 PR 的改动中,保留后续优化项。自动识别未创建 generated.json、requirements.json、project.json;项目仍会出现原有的 local.json。不能据此声称所有 Windows 体验问题已解决。