Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Chiusa
#170 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
backend, desktop

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.
Lingua principale
TypeScript
Stelle
2
Fork
2
Merge medio
5h 28m
PR unite (30g)
24

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di PierrunoYT/patch

Tutte le issue di PierrunoYT/patch

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.