auto_index skips a repository that commits a symlink: count-only discovery fails where the full walk skips

Aperta
#3,004 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à
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
68/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
c
Ambito
backend

Direzione di ricerca

Start with walk_dir_process_entry in src/discover/discover.c and compare its count-only handling of symlinks and unreadable directories with the full walk. Check how cbm_discover_count_bounded reports failures and review the auto-index path in src/mcp/mcp.c and src/daemon/application.c. Done means these paths are skipped without failing the count, while deadline and allocation failures still fail; reproduce with the supplied symlink setup.

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

Descrizione

editor/integration

Version

codebase-memory-mcp 0.12.1, Linux x86_64, release binary from install.sh.

What happens

With auto_index = true, a session rooted in a repository that commits one
symlink never gets indexed. The daemon logs on every session start:

level=warn msg=daemon.autoindex.skipped project=<root> reason=unsafe_or_unavailable_path files=-1

We counted 1210 of these lines for one repository and not one
autoindex.start or autoindex.done. index_repository on the same root
succeeds, because the full discovery skips the symlink.

Cause

cbm_mcp_auto_index_within_file_limit (src/mcp/mcp.c) runs
cbm_discover_count_bounded, which runs discover_impl with
count_only = true. In walk_dir_process_entry (src/discover/discover.c),
safe_stat returns -1 for a symlink, and the count-only branch sets
out->failed = true, while the full walk records the entry as ignored
(file_list_add_ignored(out, rel_path, "symlink")) and continues. failed
makes the count return CBM_DISCOVER_ERROR, count -1, and
application_background_initialize_impl (src/daemon/application.c) reports
unsafe_or_unavailable_path. walk_dir does the same for a directory that
cbm_opendir cannot open (count-only fails, full walk continues).

Reproduction

mkdir -p /tmp/cbm-symlink-repro/sub
cd /tmp/cbm-symlink-repro
git init -q
printf 'def f():\n    return 1\n' > sub/a.py
ln -s ../sub sub/link
codebase-memory-mcp config set auto_index true
# start any MCP client session with this directory as its root, then:
grep 'cbm-symlink-repro' ~/.cache/codebase-memory-mcp/logs/cbm-daemon.log

Expected: autoindex.start and autoindex.done. Actual (reproduced with
0.12.1 on 2026-11-14): five
daemon.autoindex.skipped project=tmp-cbm-symlink-repro reason=unsafe_or_unavailable_path files=-1
lines, while an explicit index_repository on the same root logged
daemon.index.result ... status=indexed.

Proposed fix

In count-only mode treat a symlink (and an unreadable directory) the way the
full walk does: skip it without counting it and without setting failed.
Only the deadline and allocation failures should fail the bounded count.

Lingua principale
C
Stelle
45.8k
Fork
3.8k
Merge medio
2g 18h
PR unite (30g)
108

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

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 DeusData/codebase-memory-mcp

Tutte le issue di DeusData/codebase-memory-mcp

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.