Skip to content

feat/add cancel button to stop repository indexing immediately - #24

Open
devanshroyal-7 wants to merge 1 commit into
FloareDor:mainfrom
devanshroyal-7:cursor/cancel-indexing-button-2d2e
Open

feat/add cancel button to stop repository indexing immediately#24
devanshroyal-7 wants to merge 1 commit into
FloareDor:mainfrom
devanshroyal-7:cursor/cancel-indexing-button-2d2e

Conversation

@devanshroyal-7

Copy link
Copy Markdown

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.

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>
@vercel

vercel Bot commented Aug 11, 2026

Copy link
Copy Markdown
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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 AbortSignal into 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 thread src/lib/indexer.ts
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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants