[Bug]: snapshot log path filter never matches file paths; zero matches return "scan limit exceeded" instead of an empty list
Summary
Two related problems in GET /api/v1/snapshot/log (VikingFS.log / RAGFS):
- The
pathsfilter never matches a file path. A directory path works; the same commit queried by one of the files it touched returns zero matches. - When zero matches are found, the endpoint returns an error instead of an empty list, so callers cannot distinguish "no history yet" from a failure.
Environment
- OpenViking 0.5.2, installed with
uv tool install "openviking[bot]==0.5.2", single node,api_keyauth mode. - Studio bundled with that wheel (
/studio/, Filesystem page).
Repro
# 1. Pick a memory file that was just modified by an extraction.
URI='viking://user/<user>/memories/experiences/<file>.md'
# 2. Directory-level query: works.
curl -H "Authorization: Bearer $KEY" \
"http://127.0.0.1:1933/api/v1/snapshot/log?limit=3&paths=viking://user/<user>/memories/experiences"
# -> {"status":"ok","result":[ ... 3 commits ... ]}
# 3. File-level query on the same file: fails.
curl -H "Authorization: Bearer $KEY" \
"http://127.0.0.1:1933/api/v1/snapshot/log?limit=3&paths=$URI"
# -> {"status":"error","error":{"code":"INVALID_ARGUMENT",
# "message":"snapshot log scan limit exceeded: scanned 1000/1000 commits, matched 0/3"}}
To rule out "the file simply was never committed", we then created a commit that touches exactly that one file:
ov snapshot commit -m 'manual test: single-file snapshot' --paths "$URI"
# -> commit_oid ad5a6450..., changed 1
- The new commit is visible via the directory query (
ad5a6450 | manual test: single-file snapshot, newest entry). - The file-level query still returns
matched 0/3and the scan-limit error.
So the commit contains the file, but the filter cannot match it.
Additional observations
- Directories that were never snapshotted (
viking://resources,viking://user/<user>/skills,viking://user/<user>/sessions) produce the same scan-limit error rather than an empty result. paths=viking://returns a different error ("git tree path cannot be the account root"), which is fine, but it shows the filter parses inputs differently per shape.
Impact
- In Studio → Filesystem, opening History on any file always errors with
snapshot log scan limit exceeded. Only directories can show history. ov snapshot log --paths <file>fails the same way, so scripting a single file's history is impossible.- Because the error replaces the empty result, the UI cannot show its own "no snapshots yet" state (
noSnapshots: 当前路径还没有快照).
Expected
pathsshould accept file paths and match commits that touch those files (both auto commits and manual commits that pass--paths <file>), consistent with the endpoint description "filter history to commits touching any path".- When the commit walk reaches its budget (or the end of history) without enough matches, return the matches found so far (possibly empty) instead of raising
scan limit exceeded. If a hard failure is still wanted, expose the budget and let clients distinguish "truncated" from "error".
Notes
- The 1000-commit scan budget is hard-coded in the Rust core; it is not exposed in
ov.confor the CLI. With a large history it also truncates legitimate directory history. GET /api/v1/snapshot/logaccepts onlybranch,limit(<=500) andpaths(<=32); there is no pagination/cursor, so a caller cannot walk past the budget.
Happy to test a patch or provide more traces.
Thanks for the detailed repro. I traced current main: GET /log validates the paths; VikingFS.commit and VikingFS.log both convert inputs through _uri_to_tree_path; and Rust git_log has a direct test for exact file-path filtering. That does not reproduce the reported file-only mismatch. Open PR #6551 addresses scan-budget behavior, not file matching. I have not changed source or treated this as resolved.
Could you confirm the file-filter failure with a synthetic, non-sensitive viking://resources/.../file.md path and share the exact sanitized paths= values (including URL encoding) and the changed path reported by the manual commit? That would help isolate URI parsing versus Rust tree lookup. Please do not include API keys or private file contents.
AI-assisted source review; no live account, credentials, or server was used.