chore: Fix CI cleanup utility classpath issues #215
+36
−9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix CI cleanup utility classpath issues and improve IndexCleanupUtility reliability
Problem
The CI cleanup workflows were failing with
okhttp3/Interceptorclasspath errors because they usedbuild/libs/*which includes multiple JAR files (regular JAR, shadow JAR, javadoc, sources). When Java loads classes from multiple JARs, it can cause conflicts because the shadow JAR relocates packages likeokhttp3toio.pinecone.shadow.okhttp3.Additionally, the
IndexCleanupUtilitywas experiencing two issues:SocketTimeoutExceptionbecause the defaultOkHttpClientuses ~10 second timeouts, which is insufficient for long-running delete operations on large indexesSolution
1. Fix CI Workflow Classpath Issues
Files changed:
.github/workflows/pr.yml.github/workflows/cleanup-test-resources.ymlChanges:
build/libs/*tobuild/libs/*-all.jarto use only the shadow JARbuild/classes/java/mainpath from cleanup-test-resources.ymlage_threshold_daysdefault from string'1'to number1This ensures only the shadow JAR (which contains all dependencies with relocated packages) is used, preventing classpath conflicts.
2. Add Rate Limiting to IndexCleanupUtility
File changed:
src/main/java/io/pinecone/helpers/IndexCleanupUtility.javaChanges:
This prevents overwhelming the backend when cleaning up many resources.
3. Add HTTP Timeout Configuration
File changed:
src/main/java/io/pinecone/helpers/IndexCleanupUtility.javaChanges:
OkHttpClientwith longer timeouts:Pinecone.BuilderusingwithOkHttpClient()This prevents
SocketTimeoutExceptionerrors during delete operations on large indexes.Testing
./gradlew test --tests IndexCleanupUtilityTest./gradlew shadowJarjava -cp build/libs/*-all.jar io.pinecone.helpers.IndexCleanupUtility --dry-runRelated Issues
Example Usage
The cleanup utility can now be run reliably in CI:
Impact
Notes
The timeout configuration in
IndexCleanupUtilityis a temporary workaround. The root cause (default timeouts being too short) is being addressed in SDK-65, which will set reasonable defaults at the SDK level. Once that's implemented, the custom timeout configuration inIndexCleanupUtilitycan be removed.Note
Improves CI cleanup reliability and makes deletion operations more resilient.
pr.ymlandcleanup-test-resources.ymlto runIndexCleanupUtilitywithbuild/libs/*-all.jar(shadow JAR only) and fix input default typesIndexCleanupUtility.java, configure a customOkHttpClientwith longer timeouts and add a 30s delay (with logs) after index/collection deletions.env.examplewithPINECONE_API_KEYand ignore.envfiles; minor wording fix in.cursordocsWritten by Cursor Bugbot for commit b8099dd. This will update automatically on new commits. Configure here.