Repository navigation
feat(lsp): reload repository configuration safely - #1659
Conversation
Summary by CodeRabbit
WalkthroughThe LSP preserves session configuration overrides, fingerprints repository configuration in refresh identities, tracks configuration failures, reloads ChangesLSP configuration refresh
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant VSCode
participant Backend
participant RepositoryConfig
participant RefreshScheduler
VSCode->>Backend: initialize
Backend->>RepositoryConfig: load ripr.toml
Backend->>Backend: publish configuration failure or analysis status
VSCode->>Backend: didChangeWatchedFiles
Backend->>RepositoryConfig: reload repository config
Backend->>RefreshScheduler: request ConfigReload
RefreshScheduler-->>Backend: schedule diagnostics refresh
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Code Review
This pull request implements dynamic configuration reloading and session option management in the LSP backend, allowing the server to watch for changes in ripr.toml and apply session configuration updates dynamically. Feedback on these changes highlights a potential issue where stale configuration failures may persist across workspace root changes, a recommendation to use more idiomatic Rust when cloning options from a mutex guard, and a warning regarding non-deterministic JSON serialization of session options which could trigger redundant workspace refreshes.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 538568c7fe
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/ripr/src/lsp/backend.rs`:
- Around line 997-1015: Update apply_session_configuration_change to account for
an existing configuration_failure before invalidating analysis input. Preserve
the latched config_invalid health signal when configuration is gated, and skip
the invalidate/publish/refresh path that cannot rerun diagnostics; retain the
current behavior for sessions without a configuration failure.
In `@editors/vscode/src/client.ts`:
- Around line 305-309: Update the existing watcher assertion in the extension
test around the single-Cargo-watcher expectation to recognize the combined
Cargo.toml/ripr.toml glob configured by the synchronize block in the client
initialization. Preserve the test’s validation of watcher registration while
adjusting its expected pattern/count to match the broadened watcher.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 8d58b263-7ad6-4b1c-aebb-a4d3ace0bf4f
📒 Files selected for processing (6)
crates/ripr/src/lsp/backend.rscrates/ripr/src/lsp/config.rscrates/ripr/src/lsp/input_identity.rscrates/ripr/src/lsp/refresh_scheduler.rscrates/ripr/src/lsp/tests.rseditors/vscode/src/client.ts
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
EffortlessMetrics/ripr(auto-detected)EffortlessMetrics/unsafe-review(auto-detected)EffortlessMetrics/perl-lsp(auto-detected)EffortlessMetrics/ub-review(auto-detected)
…/1598-config-reload # Conflicts: # crates/ripr/src/lsp/backend.rs # editors/vscode/test/suite/extension.test.ts
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
crates/ripr/src/lsp/backend.rs (1)
966-995: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winConfig-reload retry after failure never runs the
Fullscope theripr.refreshDiagnosticscommand promises.
reload_repository_configalways callsrefresh_diagnostics(RefreshScope::Interactive, ...)on success. That's fine for thedid_change_watched_files/did_change_workspace_folderstriggers, butexecute_command'sripr.refreshDiagnosticsretry path (Lines 1682-1689) reloads config through this same function and then returns immediately — it never issues theRefreshScope::Fullrefresh that this command normally performs when configuration is healthy. Per the doc comment onrefresh_diagnostics(Lines 110-125),Fullis what runs the complete seam inventory;Interactiveonly produces aseams_deferredsnapshot. So a user who explicitly retries after fixingripr.tomlsilently gets a partial/deferred refresh instead of the full one the same command delivers in the non-failure case.🐛 Proposed fix — let callers choose the refresh scope
- async fn reload_repository_config(&self) { + async fn reload_repository_config(&self, scope: RefreshScope) { let Some(root) = self.effective_root() else { return; }; let current = self.analysis_config().unwrap_or_default(); let had_configuration_failure = self.configuration_failure().is_some(); match crate::config::load_for_root(&root) { Ok(repo_config) => { let next = current.reload_repo_config(repo_config); self.clear_configuration_failure(); if next != current || had_configuration_failure { self.set_analysis_config(next); self.invalidate_analysis_input(RefreshReason::ConfigReload.as_str()); self.publish_analysis_status().await; - self.refresh_diagnostics( - RefreshScope::Interactive, - RefreshReason::ConfigReload, - ) - .await; + self.refresh_diagnostics(scope, RefreshReason::ConfigReload) + .await; } else { self.publish_analysis_status().await; } } Err(error) => { self.invalidate_analysis_input(RefreshReason::ConfigReload.as_str()); self.set_configuration_failure(error); self.publish_analysis_status().await; } } }Then update call sites:
did_change_watched_files/did_change_workspace_folderspassRefreshScope::Interactive, and theripr.refreshDiagnosticsretry branch (Line 1687) passesRefreshScope::Full.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@crates/ripr/src/lsp/backend.rs` around lines 966 - 995, Update reload_repository_config to accept a RefreshScope parameter and use it when calling refresh_diagnostics after a successful reload. Pass RefreshScope::Interactive from did_change_watched_files and did_change_workspace_folders, while the ripr.refreshDiagnostics retry branch in execute_command must pass RefreshScope::Full so configuration recovery performs the complete refresh.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@crates/ripr/src/lsp/backend.rs`:
- Around line 966-995: Update reload_repository_config to accept a RefreshScope
parameter and use it when calling refresh_diagnostics after a successful reload.
Pass RefreshScope::Interactive from did_change_watched_files and
did_change_workspace_folders, while the ripr.refreshDiagnostics retry branch in
execute_command must pass RefreshScope::Full so configuration recovery performs
the complete refresh.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: d45c1f08-0c09-4809-89b2-a517acdad1f4
📒 Files selected for processing (3)
crates/ripr/src/lsp/backend.rscrates/ripr/src/lsp/tests.rseditors/vscode/test/suite/extension.test.ts
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
EffortlessMetrics/ripr(auto-detected)EffortlessMetrics/unsafe-review(auto-detected)EffortlessMetrics/ub-review(auto-detected)EffortlessMetrics/perl-lsp(auto-detected)
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
crates/ripr/src/lsp/config.rs (2)
53-75: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDuplicate
diagnosticProfileapplication.
apply_session_options(lines 186-192) already parses and appliesdiagnosticProfileontoconfig.from_repo_config_and_optionsthen repeats the exact same parse-and-assign logic immediately afterward (lines 67-73). This is dead, redundant work — harmless today since both blocks compute the same result, but it's an easy source of future divergence if one copy is updated and the other isn't.♻️ Proposed fix — remove the duplicate block
config.session_options = Some(Value::Object(options.clone())); apply_session_options(&mut config, &options); - if let Some(profile) = options - .get("diagnosticProfile") - .and_then(|value| value.as_str()) - .and_then(|value| LspDiagnosticProfile::parse(value).ok()) - { - config.diagnostic_profile = profile; - } config }Also applies to: 186-192
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@crates/ripr/src/lsp/config.rs` around lines 53 - 75, Remove the duplicate diagnosticProfile parsing and assignment block from from_repo_config_and_options, relying on apply_session_options to apply it. Preserve the existing session-options filtering, storage, and application flow without changing apply_session_options.
16-20: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winStale doc comment: "four supported LSP options" is now five.
The
session_optionsfield doc says this is a projection of "the four supported LSP options, not an authority for arbitrary client settings."is_supported_session_optionnow lists five keys (baseRef,checkMode,includeUnchangedTests,seamDiagnostics,diagnosticProfile) afterdiagnosticProfilewas added. Update the comment to avoid confusing future readers about the supported-option contract.♻️ Proposed fix
- /// Session overrides are retained so a repository configuration reload - /// preserves the initialization precedence contract. This is a bounded - /// projection of the four supported LSP options, not an authority for - /// arbitrary client settings. + /// Session overrides are retained so a repository configuration reload + /// preserves the initialization precedence contract. This is a bounded + /// projection of the five supported LSP options, not an authority for + /// arbitrary client settings. pub(super) session_options: Option<Value>,Also applies to: 205-209
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@crates/ripr/src/lsp/config.rs` around lines 16 - 20, Update the documentation for the session_options field to state that it projects the five supported LSP options, matching the keys recognized by is_supported_session_option, while preserving the clarification that it is not an authority for arbitrary client settings.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@crates/ripr/src/lsp/config.rs`:
- Around line 53-75: Remove the duplicate diagnosticProfile parsing and
assignment block from from_repo_config_and_options, relying on
apply_session_options to apply it. Preserve the existing session-options
filtering, storage, and application flow without changing apply_session_options.
- Around line 16-20: Update the documentation for the session_options field to
state that it projects the five supported LSP options, matching the keys
recognized by is_supported_session_option, while preserving the clarification
that it is not an authority for arbitrary client settings.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 5b942f3f-6bf3-4eb4-9ff9-47ec288f28ae
📒 Files selected for processing (4)
crates/ripr/src/lsp/backend.rscrates/ripr/src/lsp/config.rscrates/ripr/src/lsp/tests.rseditors/vscode/test/suite/extension.test.ts
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
EffortlessMetrics/ripr(auto-detected)EffortlessMetrics/unsafe-review(auto-detected)EffortlessMetrics/ub-review(auto-detected)EffortlessMetrics/perl-lsp(auto-detected)
Summary
Implements the configuration and session-option reload slice for #1598, building on the landed
LspAnalysisInputIdentitymodel from #1642.What changed
ripr.tomlthroughworkspace/didChangeWatchedFilesand coalesces the resulting refresh through the existing scheduler.config_invalidhealth, pauses analysis, and preserves last-known-good evidence without pretending defaults were accepted.ripr.tomland synchronizes theriprsettings section.config_reloadrefresh reason and focused precedence, identity, and recovery regressions.Scope and non-goals
This is PR-B of #1598. Manifest/lockfile relevance and broader snapshot-handle identity remain for follow-up input slices. It does not add pull diagnostics or public headless-agent protocol surface.
Proof
Pass:
cargo fmt --checkcargo check -p ripr --libcargo clippy -p ripr --lib -- -D warningscargo clippy --workspace --all-targets -- -D warningscargo test -p ripr --lib lsp:: -- --test-threads=1— 301 passedcargo test --workspace— 4,537 passed, 1 ignored before the final review-only correction; the final head has focused LSP proof and protected CI rerunscargo xtask check-output-contractscargo xtask check-traceabilitycargo xtask check-generated-cleangit diff --checkNot run locally:
editors/vscode/node_modules; the compile reached the Rust bridge and stopped at the missingtsc.cmdpath.cargo xtask check-pr: the five-minute wrapper timed out during its workspace-test phase; the underlying workspace test and workspace Clippy passed directly.Claim boundary
This PR makes selected-root repository configuration and supported session options reloadable with honest invalidation and recovery state. It does not claim completion of the full #1598 input matrix.