Skip to content

fix(tui): add null guards for lsp and mcp state data#20444

Closed
Echoziness wants to merge 1 commit into
anomalyco:devfrom
Echoziness:fix/lsp-mcp-null-guard
Closed

fix(tui): add null guards for lsp and mcp state data#20444
Echoziness wants to merge 1 commit into
anomalyco:devfrom
Echoziness:fix/lsp-mcp-null-guard

Conversation

@Echoziness
Copy link
Copy Markdown

@Echoziness Echoziness commented Apr 1, 2026

Closed as the fix has been implemented in v1.4.7 via other PRs (#22099, #22206). Thanks for the initial report!

@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. needs:issue labels Apr 1, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 1, 2026

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@Echoziness Echoziness force-pushed the fix/lsp-mcp-null-guard branch 2 times, most recently from 3508458 to 3d53271 Compare April 1, 2026 10:22
@github-actions github-actions Bot removed needs:compliance This means the issue will auto-close after 2 hours. needs:issue labels Apr 1, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 1, 2026

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@Echoziness
Copy link
Copy Markdown
Author

Echoziness commented Apr 1, 2026

Note on the initial typecheck failure

The first typecheck run failed with ../app/node_modules/.ts-dist/src/i18n/ru.d.ts(757,24): error TS1002: Unterminated string literal. This is in an auto-generated .d.ts file inside node_modules, not in any source code this PR touches. Re-running the check resolved it, confirming this is an intermittent issue in Bun/tsgo declaration file generation rather than a code problem.

The e2e (linux/windows) failures are a known issue affecting all open PRs and are unrelated to this change.

@Echoziness Echoziness force-pushed the fix/lsp-mcp-null-guard branch 2 times, most recently from d6555ac to fb4cc9a Compare April 2, 2026 05:04
@Echoziness
Copy link
Copy Markdown
Author

Echoziness commented Apr 2, 2026

Final Local Verification & A/B Test Results

I have conducted a series of controlled tests on Windows 11 with clangd to verify the fix across different project scales.

Scenario Path (CWD) Version Action Result
1 algo/string_concat (Subdir) 1.3.13 (Global) Open Sidebar Pass
2 AI_Workspace (Root) 1.3.13 (Global) Access nested .cpp Crash
3 algo/string_concat (Subdir) This PR (Dev) Open Sidebar Pass
4 AI_Workspace (Root) This PR (Dev) Access nested .cpp Pass

Key Findings:

  • Reproduced: In large workspaces (Scenario 2), the global 1.3.13 version consistently crashes due to the longer LSP initialization window.
  • Verified: In the exact same environment (Scenario 4), this PR handles the initialization window perfectly and no longer crashes.
  • The ?? [] and ?? {} null guards provide 100% stability regardless of project size or indexing speed.

All CI checks are green. Ready for review/merge.

@Echoziness
Copy link
Copy Markdown
Author

Hi @kommander and @Hona, hope you're doing well!

I noticed you've both been actively reviewing TUI-related changes recently. This PR adds a few null guards to \sync.data.lsp\ and \sync.data.mcp\ in the TUI status dialog and footer to prevent a crash during service initialization. It's a small, low-risk fix (+11/-11 lines) and all CI checks are green.

I know the PR queue is quite busy right now, so no rush at all—just wanted to gently bump it in case it slipped through the cracks. Thanks for all your hard work on the project!

Prevents crash when sidebar renders LSP/MCP panels before services
are initialized. sync.data.lsp and sync.data.mcp can be undefined
during initial load, causing TypeError on .map() and Object.entries().

Fixes crash: 'undefined is not an object (evaluating sync8.data.lsp.map)'
@github-actions
Copy link
Copy Markdown
Contributor

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs:compliance This means the issue will auto-close after 2 hours. needs:issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant