OpenViking icon indicating copy to clipboard operation
OpenViking copied to clipboard

[Bug]: Web Studio Agent Experience page shows empty state when the newest ls page is filled with directories

Open za8209 opened this issue 2 months ago • 1 comments

Bug Description

In Web Studio, the Agent Experience module (/studio/playground?uri=viking://user/default/memories/experiences) renders its empty state ("还没有 Agent 经验" / "no agent experiences yet") even though the account has 181 experience files.

Root cause: the module fetches one page of fs/ls results and then drops every entry whose isDir === true client-side. ls intentionally returns directories first (documented: sort_by — "Sort directories and files within their groups by name or mtime before pagination; directories remain first"). So whenever the newest page contains only directories, the filtered result is empty and the page shows the empty state — regardless of how many memory files exist. The same happens on the Events / Entities / Preferences tabs, which use the same list helper.

Steps to Reproduce

  1. Put more than one page (page size = 10) of directories at the head of a memory listing — e.g. render 25 directories into viking://user/default/memories/experiences/ (in this environment that happened accidentally: a file-shaped URI was materialized as a directory).
  2. Keep 181 normal *.md experience files in the same directory.
  3. Open Studio → Agent Experience (URI viking://user/default/memories/experiences).
  4. Page 1 and page 2 show the empty state.

Expected Behavior

The module should list the experience files that exist (skipping/ignoring directories when counting a page, or continuing to fetch pages until it has enough non-directory entries), or at least not claim "no experiences" when the underlying directory has files.

Actual Behavior

Page 1 and page 2 (offsets 0–9, 10–19) contain only directories, which the client drops → empty state. The first file appears at offset 25, i.e. page 3, which the user has no reason to open after seeing the empty state.

Minimal Reproducible Example

# listing the memory directory, one page = 10 entries
GET /api/v1/fs/ls?uri=viking://user/default/memories/experiences&limit=11&offset=0&output=original

Response (trimmed): 206 entries, offsets 0–24 are directories:

offset=0   isDir=True  size=64   relocation穿透悬空来源校验修复.md
offset=1   isDir=True  size=64   void指针链遍历修复轮.md
...
offset=24  isDir=True  size=64   财务清洗呈现层问题修复.md
offset=25  isDir=False size=2450 A3夹具独立范围复核.md   <-- first real file, page 3

The Studio helper drops directories after pagination (assets/api-DGwKU0SF.js):

t.flatMap(n=>{const e=l(n)?n:null;if(!e||e.isDir===!0)return[]; ... })

Error Logs

No server-side error — GET /api/v1/system/consistency for the subtree returns {"ok": true, "expected_count": 206, "missing_record_count": 0}, and ov find retrieves the files normally. This is a Studio-side listing/pagination defect only.

OpenViking Version

0.4.21

Python Version

3.13

Operating System

macOS

Model Backend

Volcengine (Doubao)

Additional Context

  • The 25 directories that triggered this were leftovers of the file-shaped URI materialized as a directory class of bug (#4461): each directory had exactly the name of a memory file that should exist (<name>.md), was 0 bytes, and was created during normal session commits (2026-09-16 … 2026-09-20). The content of those memories was still present in the workspace snapshot store, so it was restored with the documented path (ov snapshot show <ref> --path <uri> → ov rm --recursive → ov write --mode create), after which the Studio page lists files again.
  • Verified on 0.4.21 with three controlled probes (write to a path with missing parents, delete + ov reindex --mode semantic_and_vectors, delete + rewrite the same URI): none of them re-created a directory at a file path, so this report is limited to the Studio listing behavior.

za8209 avatar Sep 23 '26 05:09 za8209

Thanks for the detailed reproduction. For this incident, the entries ahead of the experience files are historical empty .md/ directories, not meaningful experience data. One confirmed creation path (snapshot commits locking a deleted file URI) was fixed in #5070.

The remaining confirmed empty directories can simply be deleted, either manually or by VikingBot. Once they are removed, the existing listing shows the experience files again. We do not need special client-side pagination for this anomalous data state, so I do not plan to take the Web Studio patch in #5331.

If intentional subdirectories under memories/experiences independently expose a pagination problem, that can be evaluated separately.

yufeng201 avatar Sep 23 '26 09:09 yufeng201