[codex] Fix code diagnostics LSP startup states#145
Conversation
|
c87d758 to
9a3e2f8
Compare
50c3532 to
f26505c
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 704d08910f
ℹ️ 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".
| if pending_add_fact_request_exists(&store, &add_fact_request) { | ||
| continue; |
There was a problem hiding this comment.
Do not leave deduped fact runs awaiting empty approval
When a session-reflector run proposes only facts that are already pending, this continue makes record_session_fact_proposals return no records, but run_session_reflector_with_backend still computes accepted_count = accepted_facts.len() before calling it and builds proposal_ids from the returned records. That produces a needs_approval run with accepted_count > 0 and an empty approval list, so dashboards/artifacts can ask reviewers to approve facts that have no proposal id. Return the existing proposal or let the runner count only newly persisted proposals.
Useful? React with 👍 / 👎.
| let payload = response.and_then(tool_result_json_payload); | ||
| let memory_matches = payload | ||
| .as_ref() | ||
| .and_then(|payload| payload.get("memory_matches")) | ||
| .and_then(Value::as_array); |
There was a problem hiding this comment.
Count context memory matches for default Markdown calls
For tracedecay_context calls that omit format: "json" (the default), render::finalize stores Markdown text in content, so tool_result_json_payload returns None here and the metadata records match_count: 0 with no fact IDs even when handle_context found memory matches. This underreports the common/default context path; compute these analytics from the structured context value before rendering, or otherwise pass the memory-match metadata separately.
Useful? React with 👍 / 👎.
| && !matches!( | ||
| engine.state, | ||
| EngineState::Disabled | EngineState::Inactive | EngineState::Unavailable |
There was a problem hiding this comment.
Let Refresh all retry unavailable engines
refresh_all reaches this filter via refreshable_languages, so an engine that was previously refreshed while its command was missing stays in the Unavailable override and is skipped even after the user installs the LSP command. Because the override wins over command_available in snapshots, the dashboard's Refresh all button can no longer recover that language; only an individual refresh or settings change will clear it. Skip inactive/disabled engines here, but allow unavailable engines to be retried for manual refresh-all.
Useful? React with 👍 / 👎.
Summary
Root Cause
The stdio LSP client discarded stderr and surfaced "closed before initialize response" when the rustup proxy exited early. The diagnostics broker then classified all refresh failures as crashed, so a missing or unavailable rust-analyzer binary appeared as a crash. Separately, dashboard document selection was extension-only, which could activate language servers for files that did not represent a real project for that adapter.
Impact
Rust analyzer failures now report the actionable rustup/toolchain stderr and are classified as unavailable instead of crashed. Language servers are only activated when project signals indicate they are needed, which reduces noisy startup attempts and makes Code Diagnostics state match the actual repository.
Validation
cargo nextest run --test lsp_code_diagnostics_test --no-fail-fastcargo nextest run --test dashboard_code_diagnostics_api_test --no-fail-fastcargo nextest run documents_for_adapter --no-fail-fastcd dashboard && npm run test:nodecd dashboard && npm run test:dom