Repository navigation
fix(desktop): 插件设置改动后重启构建提供者,并显示提供者自己的报错 - #2145
Merged
Merged
Conversation
- 构建提供者按启动时的插件设置(全局 + 项目)记录;设置变了,下一次请求启动新进程, 旧进程在手上的请求结束后关闭,关闭项目时与其他提供者一起立即关闭。符合契约 “A change of the plugin's settings restarts it on the next request”。 - buildprovider 解码 Core 的 underlyingMessage,取提供者 JSON-RPC 错误的 message; 运行、调试准备、构建模型和依赖树失败时显示它,日志仍只记录 Core 的代码和消息。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1lck
marked this pull request as ready for review
November 18, 2026 08:00
12 of 15 tasks
29 of 35 tasks
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.
关联 Issue / Linked issue
PR 类型 / Type
改动说明 / What changes
背景 / Why
用 Tomcat 社区插件做宿主端到端测试时发现两个通用缺陷,所有使用独立构建提供者进程的插件都受影响:
serverError: Language server returned an error.,用户看不到原因。改动 / Changes
desktop/internal/workbench/build.gobuildRuntime为每个运行中的提供者记录启动时的插件设置(buildSettingsKey:全局值和项目值的 JSON,map 键有序)。provider发现记录的设置与当前设置不同,就把旧客户端移出、放进retired,启动新进程,并把旧客户端返回给调用方。retire:等旧客户端手上的请求结束(最多buildRequestTimeout),再在buildStopTimeout内关闭。等待超时或关闭失败都会返回错误。App.retireBuildProvider在后台执行退役,失败记为app.background.operation_failed(operationbuild_provider_restart),挂在触发重启的那次用户操作下。detach也会立即关闭retired里的客户端:关闭项目或插件变化时不等旧请求。desktop/internal/buildprovider/buildprovider.goProviderError新增Detail和UserMessage()。providerError解码 Core 的underlyingMessage(提供者 JSON-RPC 错误原文),从中取出message作为Detail。Error()不变,日志里仍只有 Core 的代码和通用消息,不含插件文案。Client.Drain(ctx):等待调用时正在运行的请求结束、会话结束或 ctx 结束。desktop/internal/workbench/command_installers.go:launchFailureText识别ProviderError,返回提供者自己的消息。launchFailureText生成界面文字的位置:finishBuildError:运行和构建的失败说明、状态。build.go)。build_dependencies.go)。tests_provider_test.go:假提供者在initialize.marker存在时,把每次启动收到的initializationOptions追加到initialize.log。TestProviderRunPreparationShowsItsBuildOutput增加断言:运行摘要必须是提供者的 “The build failed.”。build_provider_restart_test.go,覆盖以下场景:pluginsettings.Save+applyPluginSettingsEffects)保存后,下一次请求启动新进程,并收到新值。ErrClosed;请求结束后旧进程才关闭。launchFailureText显示提供者的消息;提供者没有给消息时,回落到 Core 的消息。lifecycle_regression_test.go:测试underlyingMessage的解码(包括非 JSON 内容回落)和Drain。不在本 PR 范围内 / Out of scope
pluginSettingsRestart),本 PR 不改。类型专属:fix
复现与根因
buildRuntime.provider只要进程活着就复用,applyPluginSettingsEffects的restart只处理语言服务器会话。providerError只解码code、message,丢掉了underlyingMessage。检查项
build_provider_restart_test.go:135: the request after the settings changed reused the provider started with the old valuesbuild_provider_restart_test.go:169: the request after the settings changed reused the old providertests_provider_test.go:550: the run summary = "Language server returned an error.", want the provider's messagebuildRuntime.provider只有App.buildProvider调用。ProviderError另有vcsFailureText使用,VCS 失败由 Core 直接给出消息,没有underlyingMessage,行为不变。launchFailureText的其他调用方(调试、子调试、构建同步)对非提供者错误行为不变。.agents/notes/implemented/bug-fix/记录:约束就是契约原文,由新增的回归测试锁定,没有新的取舍需要记录。范围检查 / Scope checks
功能矩阵 / Feature matrix
shared/platform-feature-matrix/features/<id>.json:declarative-plugin-settings:补写“独立构建提供者进程在设置变化后的下一次请求重启,旧进程在已有请求结束后关闭”,加入证据build_provider_restart_test.go。build-system-plugins:补写“Provider 的 JSON-RPC 错误显示 Provider 自己的说明,日志只记 Core 的错误代码”,加入证据lifecycle_regression_test.go。partial / pending)。./scripts/platform-feature-matrix/verify-platform-feature-matrix.sh(204 项通过)和./scripts/platform-feature-matrix/verify-platform-feature-matrix-change.sh origin/main HEAD(通过).artifacts/下生成的矩阵视图插件归属 / Plugin ownership
develop-lithe第三节“插件归属与宿主零依赖”的自查命令,结果为空dev.lithe.test.provider-tests)shared/i18n/TestTomcatPluginRunsAWebModule、TestTomcatPluginDebugsAWebModule,以 overlay 方式在本分支运行,两项都通过。在 main 之前的宿主上,运行项会因 [Bug] 修改插件设置后,独立构建提供者进程不重启,运行仍使用旧设置 #2142 报 noHome。UI 验证 / UI evidence
N/A:布局和控件不变。只是失败状态文字改为显示提供者自己的消息,由上面的测试断言覆盖。
统一日志系统 / Structured logging
app.background.operation_failed,没有新事件retireBuildProvider记录一次ProviderError.Error()不含Detail界面文案 / i18n
shared/i18n/node scripts/i18n/verify-app-language-localization.mjs和node scripts/i18n/generate-i18n.mjs --check逻辑归属 / Logic placement
underlyingMessage,宿主只负责解码和呈现性能与内存 / Performance and memory
设置 / Settings
N/A:没有新增或修改设置项,只让已有插件设置按契约生效。
插件契约 / Plugin contract
N/A:没有修改契约。本 PR 按契约现有文字实现。
发行包与资源 / Bundle and resources
zsh scripts/desktop/verify/verify-runtime-bundle-immutability.sh,通过无用代码与重构 / Dead code and refactoring
验证 / Verification
desktop-go.sh test ./internal/buildprovider(含-race)desktop-go.sh test -run '<新增和相关的 7 个测试>' ./internal/workbench(新增测试也用-race跑过)desktop-go.sh test -run 'Build|Provider|PluginSettings|Settings|Run' ./internal/workbenchdesktop-go.sh vet ./internal/buildprovider ./internal/workbench、gofmt -lverify-app-language-localization.mjs、generate-i18n.mjs --checkverify-runtime-bundle-immutability.sh| Draft CI(run 44261985289):Format and script tests、Verify pins、矩阵门禁 | Linux | 通过 |
| Draft CI:Vet and test on Linux | Linux |
workbench、buildprovider通过;只有localshell的TestClosingAnIntegratedShellRightAfterACommandHangsUpItsJobs失败,main 最近 5 次都同样失败,已有 #2054,与本 PR 无关 |未能执行的检查和原因: 没有在 Windows 本地跑;改动是两端共用的 Go 代码。main 上 Windows CI 已因两项与本 PR 无关的测试稳定失败(已建 #2146),本 PR 按本地验证合并。
提交前确认 / Final checks
main(9f4d5fb05)创建,目标分支main🤖 Generated with Claude Code