Skip to content

Fix NPE and lost chat requests while models are not loaded yet - #503

Merged
Sheng Chen (jdneo) merged 5 commits into
microsoft:mainfrom
travkin79:fix-408-npe
Oct 29, 2026
Merged

Sheng Chen (jdneo) merged 5 commits into
microsoft:mainfrom
travkin79:fix-408-npe

Conversation

@travkin79

@travkin79 Dietrich Travkin (travkin79) commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Related to #408

When the Copilot language server (CLS) is busy, e.g. for minutes after startup in large workspaces, the
model lists arrive late. Until then there is no active model, and sending a chat request fails with an NPE.

Changes

  • Disable chat send until a model is available; the chat input placeholder shows that models are loading.
  • Fail chat requests without an active model with a clear error instead of an NPE (createConversation,
    addConversationTurn, pressing Enter, referenced-file tooltip).

This does not fix the busy CLS itself. It complements #452 – #455, which address UI freezes and shutdown hangs.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Partial-fetch preference loss and availability-binding lifecycle issues remain unresolved.

3 open issues
What changed in this PR

This PR addresses #408 by preventing chat submission before a model is available and handling delayed or failed model loading. It complements the separate preference-loading and shutdown fixes.

Changes:

  • Fetch Copilot and BYOK model lists in parallel, allowing activation despite one list failing.
  • Disable sending while models load and add null-safe chat request and tooltip handling.
  • Add regression tests for model loading, availability notifications, and missing-model requests.
File Description
com.microsoft.copilot.eclipse.ui/​src/​com/​microsoft/​copilot/​eclipse/​ui/​i18n/​messages.properties Adds model-loading placeholder and tooltip text.
com.microsoft.copilot.eclipse.ui/​src/​com/​microsoft/​copilot/​eclipse/​ui/​i18n/​Messages.java Declares the new localized messages.
com.microsoft.copilot.eclipse.ui/​src/​com/​microsoft/​copilot/​eclipse/​ui/​chat/​services/​ModelService.java Loads model lists concurrently and observes availability.
com.microsoft.copilot.eclipse.ui/​src/​com/​microsoft/​copilot/​eclipse/​ui/​chat/​ReferencedFile.java Handles image tooltips without an active model.
com.microsoft.copilot.eclipse.ui/​src/​com/​microsoft/​copilot/​eclipse/​ui/​chat/​ChatView.java Rejects premature sends while preserving input.
com.microsoft.copilot.eclipse.ui/​src/​com/​microsoft/​copilot/​eclipse/​ui/​chat/​ChatInputTextViewer.java Displays the model-loading placeholder.
com.microsoft.copilot.eclipse.ui/​src/​com/​microsoft/​copilot/​eclipse/​ui/​chat/​ActionBar.java Gates sending on model availability.
com.microsoft.copilot.eclipse.ui.test/​src/​com/​microsoft/​copilot/​eclipse/​ui/​chat/​services/​ModelServiceTests.java Tests parallel loading, partial failures, and availability.
com.microsoft.copilot.eclipse.core/​src/​com/​microsoft/​copilot/​eclipse/​core/​lsp/​CopilotLanguageServerConnection.java Returns failed futures for requests without a model.
com.microsoft.copilot.eclipse.core.test/​src/​com/​microsoft/​copilot/​eclipse/​core/​lsp/​CopilotLanguageServerConnectionTests.java Verifies missing-model requests never reach the server.

Review effort: Balanced

@jdneo

Copy link
Copy Markdown
Member

Hi Dietrich Travkin (@travkin79)

Thank you for your contribution. Could you please check those copilot comment?

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

With preview features enabled, switching chat modes while models are pending can enable the delegation button even though sending is rejected without an active model.

1 open issue
3 resolved since last review

Review effort: Balanced

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues were identified for the safeguards against missing models during slow language-server startup.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@jdneo Sheng Chen (jdneo) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you for your contribution!

@jdneo
Sheng Chen (jdneo) merged commit 5b79564 into microsoft:main Oct 29, 2026
4 checks passed
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.

3 participants