Skip to content

Index staleness: automatic reindex not triggering for merged changes #137

Description

@alfhen

Context

During a dogfooding session (2026-02-06), the MCP server was running with an index from 2/5. After merging PR #136 (changes to response-budget.ts), the index remained stale:

  • get_files_context on response-budget.ts returned old line numbers (pre-refactor)
  • pendingFileCount: 0 reported — the server didn't detect the changes
  • lastReindexDurationMs and msSinceLastReindex were null in every tool response

Expected Behavior

Lien has two automatic change detection mechanisms:

  1. Git change detection — polls for git state changes (branch switches, new commits)
  2. File watching — watches for filesystem changes via chokidar

After pulling/merging new code on main, one of these should trigger a reindex of changed files, and indexInfo should reflect accurate reindex metadata.

Observed Behavior

Neither mechanism triggered. The index stayed on the 2/5 version despite new commits being pulled. lastReindexDurationMs and msSinceLastReindex remain null, suggesting no automatic reindex has ever fired during this server session.

Investigation Areas

  • Is the git change handler (createGitChangeHandler) actually firing on git pull?
  • Is the file watcher (FileWatcher) picking up changes to files modified by merge?
  • Are lastReindexDurationMs / msSinceLastReindex being populated correctly in indexInfo?
  • Could there be a race condition where the MCP server starts before the watcher is ready?

Found During

Dogfooding session — .wip/dogfood-report.md has full details.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions