feat/add cancel button to stop repository indexing immediately - #24
Open
devanshroyal-7 wants to merge 1 commit into
Open
feat/add cancel button to stop repository indexing immediately#24devanshroyal-7 wants to merge 1 commit into
devanshroyal-7 wants to merge 1 commit into
Conversation
Expose AbortController in the indexing overlay/sidebar so users can bail out of chunking/embedding without waiting for the run to finish, and propagate AbortSignal into GitHub fetches so in-flight work stops promptly. Co-authored-by: Devansh Royal J <jdevansh2000@gmail.com>
Contributor
|
@cursoragent is attempting to deploy a commit to the floaredor's projects Team on Vercel. A member of the Team first needs to authorize it. |
CosmoBean
approved these changes
Aug 11, 2026
There was a problem hiding this comment.
Pull request overview
This PR adds user-facing cancellation for repository indexing and threads an AbortSignal through GitHub fetches (and abort/error mapping in the indexer) so in-flight work stops promptly when the user cancels.
Changes:
- Propagate
AbortSignalinto GitHub API/tree/compare/raw-file fetches and add abort-error detection utilities. - Add indexer-side helpers to normalize abort-like failures into
IndexAbortError. - Expose “Cancel indexing” actions in the overlay and sidebar, with UI state for “cancelling…”, plus a Vitest regression test for abort propagation.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/lib/indexer.ts | Adds abort/error mapping helpers and passes AbortSignal into GitHub fetches and embedding calls. |
| src/lib/github.ts | Adds isAbortError, abort-signal combining for timeouts + external cancellation, and threads signal into fetch calls. |
| src/lib/github.abort.test.ts | Adds tests ensuring abort errors are detected and propagated when the external signal aborts. |
| src/components/chat/IndexingOverlay.tsx | Adds cancel button + “Stopping…” state while cancellation is in progress. |
| src/components/chat/ChatSidebar.tsx | Adds a cancel indexing button in the sidebar while indexing is running. |
| src/app/[owner]/[repo]/page.tsx | Stores the active AbortController, wires cancel callbacks into UI, and updates abort handling. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+592
to
+598
| const handleCancelIndexing = useCallback(() => { | ||
| if (isCancellingIndex) return; | ||
| setIsCancellingIndex(true); | ||
| storeRef.current.clear(); | ||
| indexAbortControllerRef.current?.abort(); | ||
| router.push("/"); | ||
| }, [isCancellingIndex, router]); |
Comment on lines
+80
to
+84
| async function withAbort<T>(promise: Promise<T>, signal?: AbortSignal): Promise<T> { | ||
| try { | ||
| return await promise; | ||
| } catch (error) { | ||
| rethrowIfAborted(error, signal); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Expose AbortController in the indexing overlay/sidebar so users can bail out of chunking/embedding without waiting for the run to finish, and propagate AbortSignal into GitHub fetches so in-flight work stops promptly.