Skip to content

fix(serve): watch project dir instead of DB storage dir - #51

Merged
mddiosc merged 2 commits into
mainfrom
fix/watcher-watch-root
Jun 22, 2026
Merged

mddiosc merged 2 commits into
mainfrom
fix/watcher-watch-root

Conversation

@mddiosc

@mddiosc mddiosc commented Jun 22, 2026

Copy link
Copy Markdown
Owner

Problem

vectos serve was resolving the watcher root from projectBaseDir (~/.vectos/projects, the DB storage directory). This caused the watcher to monitor its own .db-shm/.db-wal files instead of the actual project source, so file changes by OpenCode agents never triggered reindexing.

Log before fix:

watcher: started watching /Users/.../.vectos/projects
watcher: detected 2 changed files, triggering reindex
warning: skipping .../.vectos/projects/vectos.db-shm — unsupported file type

Fix

  • Add --watch-root flag to vectos serve for explicit watch directory
  • Use watchRoot (falling back to scope.PrimaryRoot) for both the initial active store scope and the watcher root — avoids the double-nested path bug (projects/projects/projects.db) that appeared when resolving scope from the DB dir
  • Plugin passes --watch-root ctx.directory when spawning the server

Log after fix:

watcher: started watching /Users/.../my-project

Changes

  • cmd/vectos/cli_flags.go — watchRoot *string field + --watch-root flag
  • cmd/vectos/cli_help.go — flag documentation
  • cmd/vectos/commands_serve.go — scopeRoot unifies watchRoot vs projectBaseDir; watcher uses correct watchDir
  • internal/setup/plugins/vectos.ts — spawn with --watch-root ctx.directory

mddiosc added 2 commits June 22, 2026 20:55
vectos serve was calling workspace.ResolveScope(projectBaseDir) where
projectBaseDir is ~/.vectos/projects (the DB storage dir). This made
the watcher monitor ~/.vectos/projects instead of the actual project
source, so it only detected changes to its own .db-shm/.db-wal files
and never triggered real reindexing.

Fix:
- Add --watch-root flag to vectos serve for explicit watch directory
- Use watchRoot (falling back to scope.PrimaryRoot) for both the
  active store scope and the watcher root
- Plugin passes --watch-root ctx.directory when spawning the server
@mddiosc mddiosc self-assigned this Jun 22, 2026
@mddiosc
mddiosc merged commit dad7c22 into main Jun 22, 2026
1 check passed
@mddiosc
mddiosc deleted the fix/watcher-watch-root branch June 22, 2026 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant