Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Dec 30, 2025

Related GitHub Issue

Closes: #10396

Description

This PR attempts to address Issue #10396 by adding a user-configurable setting for the maximum number of batch retries during codebase indexing.

Implementation details:

  1. Type definitions (packages/types/src/codebase-index.ts):

    • Added batch retry constants to CODEBASE_INDEX_DEFAULTS: MIN_BATCH_RETRIES: 1, MAX_BATCH_RETRIES: 10, DEFAULT_BATCH_RETRIES: 3, BATCH_RETRIES_STEP: 1
    • Added codebaseIndexMaxBatchRetries field to the config schema
  2. Config manager (src/services/code-index/config-manager.ts):

    • Added maxBatchRetries private field
    • Added currentMaxBatchRetries getter to expose the setting
    • Updated _loadAndSetConfiguration() to read the new setting from globalState
  3. Scanner (src/services/code-index/processors/scanner.ts):

    • Modified constructor to accept maxBatchRetries parameter
    • Changed hardcoded MAX_BATCH_RETRIES references to use this.maxBatchRetries
  4. Service factory (src/services/code-index/service-factory.ts):

    • Updated createDirectoryScanner() to pass maxBatchRetries from config manager
  5. UI (webview-ui/src/components/chat/CodeIndexPopover.tsx):

    • Added codebaseIndexMaxBatchRetries to LocalCodeIndexSettings interface
    • Added default value in getDefaultSettings()
    • Added initialization from codebaseIndexConfig
    • Added slider control in Advanced Settings section (range 1-10, step 1)
  6. i18n (webview-ui/src/i18n/locales/en/settings.json):

    • Added translation keys: maxBatchRetriesLabel and maxBatchRetriesDescription

Test Procedure

  1. Unit tests: Ran existing scanner and config-manager tests - all pass
  2. Type checking: Ran tsc --noEmit for both src/ and webview-ui/ - no errors
  3. Manual testing:
    • Open Code Index settings popover
    • Expand "Advanced Settings" section
    • Verify "Maximum Batch Retries" slider appears with range 1-10
    • Adjust slider and verify value updates
    • Save settings and verify they persist

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Testing: New and/or updated tests have been added to cover my changes (if applicable).
  • Documentation Impact: I have considered if my changes require documentation updates (see "Documentation Updates" section below).
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Documentation Updates

  • No documentation updates are required.
  • Yes, documentation updates are required. User-facing docs should mention the new "Maximum Batch Retries" setting in the Code Index Advanced Settings.

Additional Notes

This is part of the ongoing work to expose configurable chunking and batch processing parameters for codebase indexing (Issue #10396). Feedback and guidance are welcome!

This PR addresses Issue #10396 by adding a user-configurable setting
for the maximum number of batch retries during codebase indexing.

Changes:
- Add batch retry constants to CODEBASE_INDEX_DEFAULTS (min: 1, max: 10, default: 3)
- Add codebaseIndexMaxBatchRetries field to config schema
- Update config-manager.ts to expose currentMaxBatchRetries getter
- Update scanner.ts to accept and use configurable maxBatchRetries
- Update service-factory.ts to pass configured value to DirectoryScanner
- Add UI slider in Advanced Settings section of CodeIndexPopover
- Add i18n translation strings for the new setting
@roomote
Copy link
Contributor Author

roomote bot commented Dec 30, 2025

Rooviewer Clock   See task on Roo Cloud

All issues resolved. The type assertion fix has been implemented and the i18n translation keys have been added to all locale files.

Previous reviews

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

Comment on lines 68 to 70
codebaseIndexSearchMaxResults,
} = codebaseIndexConfig
codebaseIndexMaxBatchRetries,
} = codebaseIndexConfig as any
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The as any type assertion was introduced to support the new property. Since codebaseIndexMaxBatchRetries is properly defined as optional in the Zod schema (packages/types/src/codebase-index.ts), consider using a more targeted approach that preserves type safety for the other properties. For example, you could access the new field separately:

Suggested change
codebaseIndexSearchMaxResults,
} = codebaseIndexConfig
codebaseIndexMaxBatchRetries,
} = codebaseIndexConfig as any
} = codebaseIndexConfig
const codebaseIndexMaxBatchRetries = (codebaseIndexConfig as { codebaseIndexMaxBatchRetries?: number }).codebaseIndexMaxBatchRetries

This is a minor suggestion - the current implementation works correctly.

Fix it with Roo Code or mention @roomote and request a fix.

Choose a reason for hiding this comment

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

@roomote request a fix

Copy link
Contributor Author

@roomote roomote bot Dec 30, 2025

Choose a reason for hiding this comment

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

Fixaroo Clock   See task on Roo Cloud

Fixed the reported issue. Replaced as any with a targeted type cast for codebaseIndexMaxBatchRetries. All local checks passed.

View commit | Revert commit

Copy link
Contributor Author

@roomote roomote bot Dec 30, 2025

Choose a reason for hiding this comment

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

Fixaroo Clock   See task on Roo Cloud

Added missing maxBatchRetriesLabel and maxBatchRetriesDescription translation keys to all 17 webview-ui locale settings.json files. All local checks passed.

View commit | Revert commit

Choose a reason for hiding this comment

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

@roomote The translation file is currently missing, please fix it

Copy link
Contributor Author

@roomote roomote bot Dec 30, 2025

Choose a reason for hiding this comment

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

Fixaroo Clock   See task on Roo Cloud

The missing translation keys have been added to all locale files.

View commit | Revert commit

Copy link
Contributor Author

@roomote roomote bot Dec 30, 2025

Choose a reason for hiding this comment

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

Fixaroo Clock   See task on Roo Cloud

The fix was already applied in previous commits. Verified all local checks pass:

  • Unit tests: 5031 passed
  • Type checks: pass
  • Lint: pass
  • Translations: complete

The earlier CI failure was in check-translations (not platform-unit-test), and this was resolved in commit 3 which added the missing i18n keys to all locale files.

View commit | Revert commit

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Dec 30, 2025
@SKIPPINGpetticoatconvent

@roomote Review the changes and fix them to ensure they pass Code QA Roo Code / platform-unit-test.

@roomote
Copy link
Contributor Author

roomote bot commented Dec 30, 2025

Fixaroo Clock   See task on Roo Cloud

The CI failure was identified as a flaky Windows build issue (race condition in esbuild between rmDir and copyfile operations), not related to the PR code changes. Re-ran the failed CI checks and all tests now pass.

No code changes were required.

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

Labels

Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels.

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

Feature Request: Expose Configurable Chunking and Batch Processing Parameters for Codebase Indexing

4 participants