Code index: progress lost on failure, shared stop cancels other callers, any settings change starts a duplicate embedding run
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
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
Found in the 2026-10-07 code review and confirmed with probes.
Problems
- 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 stoppedsearch_code) throws away every embedding already paid for. Probe: 70 files with the second batch failing →fileCount0. - 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 withaborted. A later caller's stop does nothing. - 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 nextsearch_code/index:statuscreates 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
writeJsonevery N batches and infinally. - 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
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from PierrunoYT/patch
-
Claude Code chats: tool calls made inside Claude Code subagents leave cards that end as "(stopped)"Openbug priority: low severity: low
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
PierrunoYT/patch#289 ·
Maintainers usually reply within 1 day
-
bug priority: medium severity: low
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
PierrunoYT/patch#285 ·
Maintainers usually reply within 1 day
-
priority: medium security severity: low
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
PierrunoYT/patch#283 ·
Maintainers usually reply within 1 day
-
enhancement priority: medium security severity: medium
Difficulty 5/5 Over a week Newbie friendliness 35/100
PierrunoYT/patch#294 ·
Maintainers usually reply within 1 day
-
priority: low security severity: low
Difficulty 4/5 1-2 days Newbie friendliness 38/100
PierrunoYT/patch#293 ·
Maintainers usually reply within 1 day
All issues in PierrunoYT/patch
Similar issues
-
submodule-pointer-regression
Difficulty 1/5 Under an hour Newbie friendliness 72/100
smith-horn/skillsmith#3061 ·
Maintainers usually reply within 1 day
-
area: ops type: test
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
accensa/x402-facilitator-stellar#559 ·
Maintainers usually reply within 1 day
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
cosimochellini/one-piece-zero-spoiler#551 ·
Maintainers usually reply within 1 day
-
getWatched() omits __proto__ directories when cwd is setPossibly taken @maxazure claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
-
area:web enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day