Skip to content

fix: lsp startup failure#2060

Merged
bajrangCoder merged 1 commit into
Acode-Foundation:mainfrom
bajrangCoder:fix/lsp-failure
Apr 27, 2026
Merged

fix: lsp startup failure#2060
bajrangCoder merged 1 commit into
Acode-Foundation:mainfrom
bajrangCoder:fix/lsp-failure

Conversation

@bajrangCoder
Copy link
Copy Markdown
Member

No description provided.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 27, 2026

Greptile Summary

This PR fixes LSP startup failures by expanding port file discovery to include a new /public directory path used by newer Terminal builds, in addition to the legacy /alpine/home path. It also makes port discovery failures explicit by throwing an error (surfacing it in the status bar and cleaning up state) instead of silently proceeding without a discovered port.

Confidence Score: 4/5

Safe to merge — the fix correctly broadens port file search paths and makes startup failures explicit with proper cleanup.

No P0/P1 bugs found. Changes are well-scoped: multi-path discovery is correct, the new throw surfaces real failures, and cleanup in the catch block is complete. One minor silent-failure edge (already-managed server, bridge mode, no port found) falls through without a port but is pre-existing behaviour not worsened by this PR.

No files require special attention.

Important Files Changed

Filename Overview
src/cm/lsp/serverLauncher.ts Refactored port file discovery to return multiple candidate paths (public + alpine/home) and iterate them; added explicit error throw when port discovery fails post-start; new early-return path in ensureServerRunning for already-managed servers missing a port
bun.lock DOMPurify bumped from 3.3.3 to 3.4.1 (dependency range updated to ^3.4.0); a scoped alias mermaid/dompurify pinned to 3.3.3 was added to preserve mermaid's internal DOMPurify version

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[ensureServerRunning] --> B{managedServers has key?}
    B -- Yes --> C{bridge && !bridge.port?}
    C -- Yes --> D{existing.port?}
    D -- Yes --> E[Return uuid + existing.port]
    D -- No --> F[getLspPort - try /public then /alpine/home]
    F -- Found --> G[Cache port, return uuid + port]
    F -- Not found --> H[Return uuid only - no port]
    C -- No --> H
    B -- No --> I[resolveStartCommand]
    I --> J[startInteractiveServer]
    J --> K{bridge && !bridge.port?}
    K -- Yes --> L[waitForPort 10s]
    L -- Found --> M[Cache port in entry]
    M --> N[Return uuid + discoveredPort]
    L -- Not found --> O[throw Error - port undiscovered]
    O --> P[catch: show error, stop server, delete entry, throw LSP_SERVER_UNAVAILABLE]
    K -- No --> Q{server.transport.url?}
    Q -- Yes --> R[waitForWebSocket]
    R --> N
    Q -- No --> N
Loading

Reviews (1): Last reviewed commit: "fix: lsp startup failure" | Re-trigger Greptile

@bajrangCoder bajrangCoder merged commit fea54b4 into Acode-Foundation:main Apr 27, 2026
5 checks passed
@bajrangCoder bajrangCoder deleted the fix/lsp-failure branch April 27, 2026 06:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant