Skip to content

bug: disk source relative paths not resolved against vault basePath — sibling repos show 0 pages #40

Closed

Description

@jflowers

Problem

External disk sources with relative paths (e.g., ../gaze, ../dewey) are not being indexed. The health endpoint shows 0 pages for these sources despite the directories containing hundreds of Markdown files.

disk-gaze:        0 pages  (../gaze has 399 .md files)
disk-dewey:       0 pages  (../dewey has .md files)
disk-homebrew-tap: 0 pages
disk-org:         0 pages

Meanwhile, disk-replicator (62 pages) and disk-website (130 pages) work intermittently — likely because dewey's CWD happened to be the vault root during those index runs.

Root Cause

In source/manager.go:createDiskSource() (lines 79-103):

func createDiskSource(cfg SourceConfig, basePath string) Source {
    path := "."
    if p, ok := cfg.Config["path"].(string); ok {
        path = p
    }
    if path == "." {
        path = basePath  // Only "." gets resolved
    }
    // ...
    return NewDiskSource(cfg.ID, cfg.Name, path, opts...)
}

When path == ".", it's replaced with basePath (the absolute vault path). But when path == "../gaze", it stays as the relative string and is passed directly to NewDiskSource. The DiskSource stores it as-is — no filepath.Abs() call.

When filepath.Walk("../gaze") runs inside the dewey serve process, it resolves relative to dewey's working directory, not the vault root. If dewey's CWD differs from the vault root (which happens when OpenCode spawns it), the path resolves to the wrong location or a nonexistent directory.

Proposed Fix

In createDiskSource(), resolve non-. relative paths against basePath:

if path == "." {
    path = basePath
} else if !filepath.IsAbs(path) {
    path = filepath.Join(basePath, path)
}

This turns "../gaze" into /Users/.../unbound-force/gaze (resolved relative to the vault root), regardless of dewey's CWD.

The same fix should be applied to createCodeSource() (line 109) which has the same pattern.

Evidence

# From dewey_health MCP tool response:
disk-gaze:    pageCount: 0, status: active
disk-dewey:   pageCount: 0, status: active

# But the directory has files:
$ find ../gaze -name "*.md" | wc -l
399

# Explicit re-index returns 0:
dewey_index({ source_id: "disk-gaze" })
# -> pages_indexed: 0, documents: 0

# dewey.log shows no gaze indexing activity at all
$ grep gaze .uf/dewey/dewey.log
# (empty)

Affected Sources

Any disk source in sources.yaml with a relative path that is not ".":

  • disk-gaze: path: "../gaze"
  • disk-dewey: path: "../dewey"
  • disk-homebrew-tap: path: "../homebrew-tap"
  • disk-org: path: "../"
  • disk-replicator: path: "../replicator" (works intermittently)
  • disk-website: path: "../website" (works intermittently)

Environment

  • dewey version: dev
  • sources.yaml: 17 sources configured
  • Vault path: /Users/jflowers/Projects/github/unbound-force/unbound-force
  • Platform: macOS arm64

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions