fix(core): retry workspace search auto-index with context#1257
fix(core): retry workspace search auto-index with context#1257
Conversation
🦋 Changeset detectedLatest commit: 51004a5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis change fixes workspace search auto-indexing for tenant-aware filesystems by deferring auto-index initialization from the constructor to lazy evaluation when search is first invoked. This allows the auto-index operation to access the operation context containing tenant information. A test validates that auto-index now correctly handles both failed (no-tenant) and successful (tenant-specific) backend invocations. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
1 issue found across 3 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/core/src/workspace/search/index.ts">
<violation number="1" location="packages/core/src/workspace/search/index.ts:272">
P2: Auto-index retry is skipped on partial failures, so failed files can remain permanently unindexed.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| this.autoIndexPromise = this.indexPaths(this.autoIndexPaths, { context }) | ||
| const promise = this.indexPaths(this.autoIndexPaths, { context }) | ||
| .then((summary) => { | ||
| if (summary.indexed === 0 && summary.errors.length > 0) { |
There was a problem hiding this comment.
P2: Auto-index retry is skipped on partial failures, so failed files can remain permanently unindexed.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/core/src/workspace/search/index.ts, line 272:
<comment>Auto-index retry is skipped on partial failures, so failed files can remain permanently unindexed.</comment>
<file context>
@@ -276,12 +267,22 @@ export class WorkspaceSearch {
- this.autoIndexPromise = this.indexPaths(this.autoIndexPaths, { context })
+ const promise = this.indexPaths(this.autoIndexPaths, { context })
+ .then((summary) => {
+ if (summary.indexed === 0 && summary.errors.length > 0) {
+ throw new Error(summary.errors.join("; "));
+ }
</file context>
PR Checklist
Please check if your PR fulfills the following requirements:
Bugs / Features
What is the current behavior?
Workspace search auto-index starts without operation context and caches the failed attempt. Tenant-aware filesystem backends that require
operationContext.conversationIdcannot auto-index, and later context-aware searches return no results.What is the new behavior?
Workspace search auto-index runs lazily and retries after failures, so a later search with operation context can index tenant-scoped files successfully.
fixes #1252
Notes for reviewers
Validated with:
pnpm -C packages/core test -- src/workspace/search/index.spec.tspnpm exec biome check packages/core/src/workspace/search/index.ts packages/core/src/workspace/search/index.spec.ts .changeset/tenant-auto-index-workspace-search.mdSummary by cubic
Fixes auto-indexing in workspace search to retry with operation context. Prevents caching a failed, context-less index for tenant-aware filesystems that require
operationContext.conversationId(fixes #1252).Written for commit 51004a5. Summary will update on new commits. Review in cubic
Summary by CodeRabbit