Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Code index: progress lost on failure, shared stop cancels other callers, any settings change starts a duplicate embedding run

Closed
#170 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript
Domain
backend, desktop

Research direction

Start with src/main/search/code_index.ts at runUpdate and update(), then inspect the cache invalidation listener in src/main/index.ts:124. Trace batching, shared callers’ abort signals and settings changes, and run the code-index tests or probes if available. Done means partial progress survives failures, one caller cannot cancel others, and unrelated settings changes do not trigger duplicate indexing.

Written by the indexing model from the issue text.

Description

bug performance priority: medium severity: medium

Found in the 2026-10-07 code review and confirmed with probes.

Problems

  1. Nothing is saved until the end. runUpdate (src/main/search/code_index.ts:204-261) embeds every batch before committing anything. A failure in the last batch (rate limit, a stopped search_code) throws away every embedding already paid for. Probe: 70 files with the second batch failing → fileCount 0.
  2. One caller's stop cancels everyone. update() (:102-111) shares one run, but the run uses only the first caller's signal and progress callback. If the first caller stops, the second fails with aborted. A later caller's stop does nothing.
  3. Any settings change clears the cache. settings.on('change', () => codeIndexes.clear()) (src/main/index.ts:124) runs on every change, including theme, model and approval mode. A running update stays on the old instance. The next search_code/index:status creates a second instance from the stale file and starts a second full embedding run of the same project. Both write the same file, and the last one to finish wins. The status bar shows "not indexing" while the first run continues.

Fix

  • Commit each file's chunks after each batch, and call writeJson every N batches and in finally.
  • Give the shared run its own AbortController, aborted only when every waiting caller has aborted. Each caller races its own signal against the shared promise.
  • Clear the cache only when the OpenRouter key or endpoint changes.
Dominant language
TypeScript
Stars
2
Forks
2
Avg merge
5h 28m
Merged PRs (30d)
24

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from PierrunoYT/patch

All issues in PierrunoYT/patch

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.