Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Aug 4, 2025

This PR fixes issue #6650 where codebase indexing progress was completely erased after receiving a 429 (rate limit) error from the Gemini provider.

Problem

When a 429 error occurred during indexing, the error handling logic would clear both the vector store and cache file, causing all indexing progress to be lost. Users would have to start indexing from scratch after the rate limit was lifted.

Solution

  • Modified the error handling in orchestrator.ts to detect 429 errors using the extractStatusCode helper
  • When a 429 error is detected, the cache and vector store are preserved
  • Added a new translation key for rate limit-specific error messages that inform users their progress has been preserved
  • Added comprehensive tests to verify the behavior

Testing

  • Added new test suite orchestrator.spec.ts with tests covering:
    • Cache preservation on 429 errors
    • Normal cache clearing on other errors
    • Different error formats (direct status, response.status)
    • Error handling during cleanup
  • All existing tests pass without regression

Fixes #6650


Important

Preserve indexing progress on 429 errors by retaining cache and vector store in orchestrator.ts, with comprehensive tests added.

  • Behavior:
    • In orchestrator.ts, preserve cache and vector store on 429 errors using extractStatusCode.
    • Add translation key rateLimitError for user notification.
  • Testing:
    • Add orchestrator.spec.ts with tests for cache preservation on 429 errors, normal cache clearing on other errors, and error handling during cleanup.
  • Misc:
    • Add extractStatusCode usage in orchestrator.ts for error detection.

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

- Modified orchestrator to detect 429 errors and skip cache/vector store cleanup
- Added new translation key for rate limit error messages
- Added comprehensive tests to verify the behavior
- Fixes #6650
@roomote roomote bot requested review from cte, jr and mrubens as code owners August 4, 2025 10:10
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. bug Something isn't working labels Aug 4, 2025
Copy link
Contributor Author

@roomote roomote bot left a comment

Choose a reason for hiding this comment

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

I reviewed my own code and found it surprisingly coherent. The machines are learning.

"fileWatcherStarted": "File watcher started.",
"fileWatcherStopped": "File watcher stopped.",
"failedDuringInitialScan": "Failed during initial scan: {{errorMessage}}",
"rateLimitError": "Indexing paused due to rate limit: {{errorMessage}}. Progress has been preserved. Please try again later.",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I notice the translation key is only added to the English locale. Should we add this key to all other language files (zh-CN, ja, it, pt-BR, ru, ko, nl, pl, tr, vi, zh-TW) to ensure non-English users see a proper message when encountering rate limits?

})

// Check if this is a rate limit error (429)
const statusCode = extractStatusCode(error)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Consider adding a telemetry event specifically for rate limit errors. This could help track how often users encounter rate limits and inform decisions about rate limit handling:

location: "startIndexing.cleanup",
})

// Check if this is a rate limit error (429)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would it be helpful to add a comment explaining why 429 errors are handled differently? This could help future maintainers understand the rationale:

// Verify that the success state was set
expect(mockStateManager.setSystemState).toHaveBeenCalledWith("Indexed", expect.any(String))
})
})
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Consider adding a test case for when returns undefined (no status code found in the error). This would ensure the default error handling path works correctly even when the error doesn't contain status information.

@Juno933
Copy link

Juno933 commented Aug 4, 2025

Why only 429 check in your PR? Would it be rationally to not clear vector store at all on error? But clear it only by direct user command, such a button press??

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Aug 4, 2025
@daniel-lxs
Copy link
Member

The issue needs to be properly scoped first

@daniel-lxs daniel-lxs closed this Aug 4, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Aug 4, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Aug 4, 2025
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:L This PR changes 100-499 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Codebase Indexing Bug - Indexing progress completely erased after 429 code from the Gemini provider

5 participants