Repository navigation
fix(desktop): surface unavailable LSP details in plugin settings and deduplicate toolchain retry notices - #2101
Merged
Merged
Conversation
…deduplicate toolchain retry notices
1lck
marked this pull request as ready for review
November 17, 2026 10:47
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
当语言服务器因缺少运行环境(例如 Windows 未找到
jdtls)而启动失败后,用户在设置窗口会遇到三个关联问题:restart效果)时,因语言服务器当前处于失败未运行状态(server == nil),不会触发重启提示,重启按钮也保持不可点击。改动 / Changes
desktop/internal/workbench/pluginbackends.goretryFailedPluginServers()不再清空a.pluginServerNotifiedErrors,使工具链保存触发自动重试时保留同一失败原因的通知去重;若重试后产生新的错误消息或服务恢复成功再正常更新/清除。desktop/internal/pluginbackend/pluginbackend.goSessionUnavailableError,Unwrap()返回ErrNoSession,同时保留可选的启动/退出诊断详情Detail。desktop/internal/workbench/debug_start.gowaitReadyPluginServer在语言服务器未运行超时退出时返回*pluginbackend.SessionUnavailableError,并透传a.pluginServerFailed[languageID]记录的当前项目失败原因。desktop/internal/settingswindow/controller.goPluginRuntimeState新增Failed bool字段,使失败态与真正运行中的Running bool语义解耦。desktop/internal/workbench/settings_plugin_effects.go、desktop/internal/workbench/settings_plugin_restart.goapplyPluginSettingsEffects在restart效果下同时检查当前项目中是否存在匹配的pluginServerFailed记录,若存在则写入pluginSettingsRestart。pluginSettingsRuntime在无活动会话但存在失败记录时返回Failed: true与对应Version/Workspace(Running仍保持false)。restartSettingsPlugin在重试失败语言服务器分支清理a.pluginSettingsRestart。desktop/internal/settingswindow/plugin_settings_view.gop.failed携带*pluginbackend.SessionUnavailableError且Detail非空时,在desktop.pluginSettings.actionProviderUnavailable提示下方展示原始失败原因。runtime.Running || runtime.Failed时启用「重启语言服务器」按钮。desktop/internal/workbench/pluginbackends_test.go:新增TestRetryFailedPluginServersPreservesNotifiedErrorDeduplication、TestWaitReadyPluginServerWrapsErrNoSession。desktop/internal/workbench/settings_plugin_effects_test.go:新增TestPluginSettingsRestartEffectMarksFailedServerRetryable。desktop/internal/settingswindow/plugin_settings_actions_view_test.go:新增TestSettingsActionUnavailableShowsProviderReasonAndRestartForFailedServer。desktop/internal/settingswindow/plugin_settings_visual_test.go:新增TestVisualPluginSettingsUnavailableAction。shared/platform-feature-matrix/features/declarative-plugin-settings.json:补充证据路径与#2079验证说明。不在本 PR 范围内 / Out of scope
jdtls下载/指引文案)仍在各自插件仓库维护,不在宿主仓库处理。类型专属:fix
复现与根因
jdtls时打开 Java 项目,先在「构建、执行、部署」修改 JDK 并保存,或在「Java 编译器」点击「读取编译设置」;修复前前者每次保存都重新弹出同一条plugin_server_start通知,后者显示“无法读取或保存设置”,且保存restart效果插件设置后没有出现可用的重启按钮。修复后保存工具链不会重复弹同一条错,动作失败展示提供方未运行指引与原始原因,保存restart设置后可直接点击「重启语言服务器」重试。git log -S或git blame查):retryFailedPluginServers()清空a.pluginServerNotifiedErrors由10184c201(feat(desktop): 语言服务器启动失败或异常退出时发送通知并显示 LSP 出错状态与重试入口 #2090)引入;waitReadyPluginServer返回裸fmt.Errorf以及applyPluginSettingsEffects/pluginSettingsRuntime仅检查a.pluginServers[id]来自0faecba49(Epic(0.7.0): 基于 Viva 框架的跨平台方案的迁移(#1794) #1799)。settingswindow与workbench)。检查项
desktop/internal/workbench/pluginbackends_test.go(TestRetryFailedPluginServersPreservesNotifiedErrorDeduplication、TestWaitReadyPluginServerWrapsErrNoSession):修复前分别失败于notifications after identical retry failure = [...], want 1 with count=1 (deduplicated)与waitReadyPluginServer err = the java language server of dev.lithe.test.lsp is not running, want errors.Is(_, pluginbackend.ErrNoSession)。desktop/internal/workbench/settings_plugin_effects_test.go(TestPluginSettingsRestartEffectMarksFailedServerRetryable):修复前失败于saving a restart-effect setting for a failed server did not set RestartRequired。desktop/internal/settingswindow/plugin_settings_actions_view_test.go(TestSettingsActionUnavailableShowsProviderReasonAndRestartForFailedServer)全部通过。PluginRuntimeState、ErrNoSession、waitReadyPluginServer、retryFailedPluginServers、pluginSettingsRestart的全部调用方,并保留TestPluginServerExitedWithErrorRetainsFailureAndLogs对Running == false的断言不变。desktop/实现。.agents/notes/implemented/bug-fix/记录:属于既有错误分类、通知去重与失败态重启接线的补全,未改变既有架构约束。范围检查 / Scope checks
功能矩阵 / Feature matrix
shared/platform-feature-matrix/features/declarative-plugin-settings.json:证据路径与验证记录已如实补充;两端保持partial/pending。./scripts/platform-feature-matrix/verify-platform-feature-matrix.sh和./scripts/platform-feature-matrix/verify-platform-feature-matrix-change.sh origin/main HEAD,均通过。.artifacts/下生成的矩阵视图。插件归属 / Plugin ownership
develop-lithe第三节“插件归属与宿主零依赖”的自查命令,结果为空。contractfixture.CoreFixture("plugins/settings-documents.json")与虚构 IDdev.lithe.test.*/dev.example.settings;没有读取具体插件包、仓库或真实插件 ID。shared/i18n/;未向docs/ci-builds.md、Agent Note 或 Skill 写入具体插件信息。UI 验证 / UI evidence
LITHE_VISUAL_OUTPUT_DIR=... ./scripts/desktop/desktop-go.sh test -tags 'vivahead lithevisual' ./internal/settingswindow -run TestVisualPluginSettingsUnavailableAction(覆盖dark/中文、light/英文,窗口高度 760px,包含提供方未运行提示、原始启动错误详情与启用态「重启语言服务器」按钮)。ghCLI 提交无法直接上传二进制图片附件;待 CI 产物或人工补充附图。统一日志系统 / Structured logging
N/A:未新增、修改或删除日志事件,也未改动日志记录边界(
scripts/logging/已移除,未执行旧日志生成/校验脚本)。界面文案 / i18n
desktop/internal/i18n已有词条(desktop.pluginSettings.actionProviderUnavailable、desktop.pluginSettings.restartRequired、desktop.pluginSettings.restart),原始失败详情unavailable.Detail按原文呈现不作改写。shared/i18n/。node scripts/i18n/verify-app-language-localization.mjs和node scripts/i18n/generate-i18n.mjs --check,均通过(11412/11412)。逻辑归属 / Logic placement
N/A:本次改动属于 Viva 宿主会话管理与错误展示接线,未新增或修改可共享的领域解析、校验或配置规则。
性能与内存 / Performance and memory
N/A:未新增后台线程、轮询、定时器或缓存,仅复用了既有的异步启动去重与状态查询锁。
设置 / Settings
N/A:未新增或移动设置页、设置项或配置持久化来源。
插件契约 / Plugin contract
N/A:未改动 Rust Core 插件契约、能力版本或宿主方法。
发行包与资源 / Bundle and resources
./scripts/desktop/verify/verify-runtime-bundle-immutability.sh通过。无用代码与重构 / Dead code and refactoring
验证 / Verification
./scripts/desktop/desktop-go.sh vet ./internal/pluginbackend ./internal/workbench ./internal/settingswindow./scripts/desktop/desktop-go.sh test -race ./internal/pluginbackend ./internal/workbench ./internal/settingswindow -run 'TestRetryFailedPluginServersPreservesNotifiedErrorDeduplication|TestWaitReadyPluginServerWrapsErrNoSession|TestPluginSettingsRestartEffectMarksFailedServerRetryable|TestPluginServerExitedWithErrorRetainsFailureAndLogs|TestFinishPluginServerStartFailureNotifiesAndDeduplicates|TestRetryFailedLSPServerClearsFailureState|TestSettingsActionUnavailableShowsProviderReasonAndRestartForFailedServer|TestPluginSettingsRestartWaitsForTeardownAndHonorsRevocation|TestSettingsActionConfirmsInvokesExistingProviderWithoutSaving'pluginbackend2.123s [no tests to run],workbench8.415s,settingswindow4.131s)node .agents/skills/write-stable-tests/scripts/run-go-tests-with-timing.mjs --warn-ms 1000 --max-ms 15000 --suite-timeout-ms 600000 --report .artifacts/test-stability/macos-desktop-go.json -- ./scripts/desktop/desktop-go.sh test -json -count=1 -p=1 -parallel=1 -timeout=600s -run 'TestRetryFailedPluginServersPreservesNotifiedErrorDeduplication|TestWaitReadyPluginServerWrapsErrNoSession|TestPluginSettingsRestartEffectMarksFailedServerRetryable|TestSettingsActionUnavailableShowsProviderReasonAndRestartForFailedServer' ./internal/workbench ./internal/settingswindowLITHE_VISUAL_OUTPUT_DIR=... ./scripts/desktop/desktop-go.sh test -tags 'vivahead lithevisual' ./internal/settingswindow -run TestVisualPluginSettingsUnavailableAction./scripts/desktop/desktop-go.sh test ./...internal/pluginbackend(5.118s)、internal/settingswindow(9.300s)、internal/workbench(217.325s) 及除internal/localshell外的其余包通过;internal/localshell的TestClosingAnIntegratedShellHangsUpTheShellAndItsJobs/bash与TestClosingAnIntegratedShellRightAfterACommandHangsUpItsJobs/bash*在当前环境失败(与本次改动无关)./.agents/skills/write-stable-tests/scripts/verify-test-stability.sh --base origin/mainnode scripts/i18n/verify-app-language-localization.mjs && node scripts/i18n/generate-i18n.mjs --check./scripts/desktop/verify/verify-runtime-bundle-immutability.sh./scripts/platform-feature-matrix/verify-platform-feature-matrix.sh && ./scripts/platform-feature-matrix/verify-platform-feature-matrix-change.sh origin/main HEADvalidated 197 platform capabilities)未能执行的检查和原因:
提交前确认 / Final checks
fix/2079-settings-lsp-errors从最新origin/main创建;目标分支:main.build/、target/、dist/、.artifacts/等产物及未脱敏日志/截图