Skip to content

Conversation

@roomote
Copy link

@roomote roomote bot commented Oct 22, 2025

Description

This PR attempts to address Issue #8777 where the extension would get stuck loading indefinitely when the embedder service is unavailable.

Problem

When the CodeIndexManager cannot connect to the embedder service, the extension gets stuck loading and never fully activates until all folders in the VSCode workspace fail. This prevents users from using the extension UI even to fix configuration issues.

Solution

The fix involves two key changes:

  1. Non-blocking initialization: Changed the CodeIndexManager initialization from blocking (await) to non-blocking (using .catch()) during extension activation. This allows the extension to fully activate even if the embedder service is unavailable.

  2. Timeout for embedder validation: Added a 5-second timeout to the embedder validation process using Promise.race(). This prevents indefinite hanging when trying to connect to an unavailable service.

Changes Made

  • Modified src/extension.ts to make CodeIndexManager initialization non-blocking
  • Updated src/services/code-index/service-factory.ts to add a 5-second timeout to embedder validation
  • Error messages are properly logged to the output channel for debugging

Testing

  • All existing tests pass
  • Extension now loads successfully even when embedder service is unavailable
  • Error messages are displayed in the output log when connection fails

Related Issues

Fixes #8777

Feedback and guidance are welcome!


Important

Fixes extension hanging by making CodeIndexManager initialization non-blocking and adding a timeout to embedder validation.

  • Behavior:
    • CodeIndexManager initialization in src/extension.ts changed to non-blocking using .catch() to prevent extension hanging.
    • Added 5-second timeout to validateEmbedder() in service-factory.ts using Promise.race() to avoid indefinite hanging.
  • Logging:
    • Error messages logged to output channel in src/extension.ts for debugging when connection fails.
  • Testing:
    • Extension loads successfully even when embedder service is unavailable.
    • All existing tests pass.

This description was created by Ellipsis for 0ac7f5a. You can customize this summary. It will automatically update as commits are pushed.

- Made CodeIndexManager initialization non-blocking during extension activation
- Added 5-second timeout to embedder validation to prevent indefinite hanging
- Extension now loads successfully even if embedder service is missing

Fixes #8777
@roomote roomote bot requested review from cte, jr and mrubens as code owners October 22, 2025 18:11
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. bug Something isn't working labels Oct 22, 2025
@roomote
Copy link
Author

roomote bot commented Oct 22, 2025

Review Summary

I've reviewed the changes in this PR. The approach successfully makes CodeIndexManager initialization non-blocking and adds a timeout to prevent indefinite hanging when the embedder service is unavailable. However, I found one minor issue with type annotations:

Issues to Address

  • Fix type annotation for timeout promise in service-factory.ts (line 99) - the promise only rejects, so Promise<never> would be more accurate than Promise<{ valid: boolean; error: string }>

Follow Along on Roo Code Cloud

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Oct 22, 2025
// Add a timeout to prevent hanging when the embedder service is unavailable
const VALIDATION_TIMEOUT_MS = 5000 // 5 seconds timeout

const timeoutPromise = new Promise<{ valid: boolean; error: string }>((_, reject) => {
Copy link
Author

Choose a reason for hiding this comment

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

The timeout promise is typed as Promise<{ valid: boolean; error: string }> but only ever calls reject(), never resolve(). The type annotation is misleading since this promise will never successfully resolve to that type. Consider using Promise<never> or removing the type annotation entirely to let TypeScript infer it correctly, since the promise only rejects.

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

Labels

bug Something isn't working Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

[BUG] Extension stuck loading if embedder service is missing

2 participants