OpenViking icon indicating copy to clipboard operation
OpenViking copied to clipboard

[Bug]: Web Studio requests a non-existent user space (viking://user/claude/…) and probes never-generated peer sidecars, producing 404/403 noise

Open za8209 opened this issue 2 months ago • 1 comments

Summary

Web Studio issues fs/stat / fs/ls requests for a non-existent user space — viking://user/claude/memories/experiences. On this instance viking://user/ contains only default, so every such request returns 404. Over a few minutes of browsing this accumulated 422 × 404 / 91 × 403 lines in server.log (cumulative since Sep 15). No functional impact — server behaviour is correct; it is the client that keeps asking for a path that cannot exist.

Environment

  • OpenViking 0.4.21 (server + CLI), macOS, auth_mode: dev
  • Single user default; peers claude-code / codex / hermes
  • Web Studio opened in a browser

Reproduction (curl)

BASE=http://127.0.0.1:1933

# 1) the reported request → 404
curl -s -o /dev/null -w '%{http_code}\n' \
 "$BASE/api/v1/fs/ls?limit=11&offset=0&output=original&sort_by=mtime&sort_order=desc&uri=viking%3A%2F%2Fuser%2Fclaude%2Fmemories%2Fexperiences"
# → 404

# 2) control — same shape, existing user → 200
curl -s -o /dev/null -w '%{http_code}\n' \
 "$BASE/api/v1/fs/ls?limit=11&offset=0&output=original&sort_by=mtime&sort_order=desc&uri=viking%3A%2F%2Fuser%2Fdefault%2Fmemories%2Fexperiences"
# → 200

# 3) the path shape that would actually be "the peer" also 404s (no such directory)
curl -s -o /dev/null -w '%{http_code}\n' \
 "$BASE/api/v1/fs/ls?limit=11&offset=0&output=original&sort_by=mtime&sort_order=desc&uri=viking%3A%2F%2Fuser%2Fdefault%2Fpeers%2Fclaude-code%2Fmemories%2Fexperiences"
# → 404

viking://user/ listing confirms only default exists:

ov ls "viking://user/"
# 1. dir · viking://user/default

Where the id appears to come from

The Studio bundle builds user paths with a runtime value, not a constant:

function U(t){const n=t.trim()||"default";return `viking://user/${encodeURIComponent(n)}/${h}`}
// elsewhere: `viking://user/${R.userId||"default"}/resources/`

There is no literal "claude" anywhere in the bundle (checked the built JS assets), so the id is supplied by runtime state (a user/identity switcher). The observed value claude looks like it is derived from the peer/agent name claude-code rather than from a user id.

Secondary observation: optimistic sidecar probes

Studio also probes directory sidecars that were never generated:

curl -s -o /dev/null -w '%{http_code}\n' \
 "$BASE/api/v1/content/read?uri=viking%3A%2F%2Fuser%2Fdefault%2Fpeers%2Fcodex%2Fmemories%2F.abstract.md&offset=0&limit=-1&raw=true"
# → 404   (same for viking://user/default/peers/codex/.overview.md)

# control — generated sidecar
curl -s -o /dev/null -w '%{http_code}\n' \
 "$BASE/api/v1/content/read?uri=viking%3A%2F%2Fuser%2Fdefault%2Fmemories%2F.abstract.md&offset=0&limit=-1&raw=true"
# → 200

Cause: peer subtrees never ran the semantic pipeline on this instance (Semantic queue had 0 consumption history; sidecars only appear after ov reindex <uri> --mode semantic_and_vectors). Workaround applied here: running that for the two peer directories makes both sidecars return 200 with generated_by.trigger: reindex.

Evidence that the requests come from Studio (not a client library)

  • Parameter signatures unique to Studio: offset=0&limit=-1&raw=true, and limit=11&offset=0&output=original&sort_by=mtime&sort_order=desc
  • Same time cluster includes /api/v1/admin/accounts and /api/v1/admin/accounts/default/settings (403 in dev mode — expected) and /api/v1/console/*
  • Raw log lines:
2026-09-24 13:31:51,276 - uvicorn.access - INFO - [request_id=964650ca-...] 127.0.0.1:59855 - "GET /api/v1/fs/stat?uri=viking%3A%2F%2Fuser%2Fclaude%2Fmemories%2Fexperiences HTTP/1.1" 404
2026-09-24 13:31:00,588 - uvicorn.access - INFO - [request_id=e31daee7-...] 127.0.0.1:59644 - "GET /api/v1/fs/ls?limit=11&offset=0&output=original&sort_by=mtime&sort_order=desc&uri=viking%3A%2F%2Fuser%2Fclaude%2Fmemories%2Fexperiences HTTP/1.1" 404

Impact

  • Functional: none — no writes, retrieval/memory pipelines unaffected
  • Cost: log noise (422 × 404, 91 × 403 cumulative) and misleading empty states when browsing those sidebar entries

Suggestions

  1. When the selected user id does not resolve, fall back to default (or hide the entry) instead of issuing repeated 404s.
  2. For peer views, use the real location viking://user/<user>/peers/<peer>/memories/....
  3. Avoid probing each sidecar when the containing directory is already known to be missing.
  4. In dev auth mode, treat admin 403 as expected rather than retrying.

Duplicate check

Searched existing issues; #5217 ("Keyless trusted connections remain unknown in Studio and show a false Root key requirement") is adjacent (Studio admin/root-key UI) but closed and a different cause. No open issue matches this report.

za8209 avatar Sep 24 '26 05:09 za8209

Update — root-cause source identified; the stale id now blanks the Agent Experience page (0.4.23)

1. Where the user/claude id actually comes from (supersedes the earlier peer-name guess)

It is the Studio connection's userId, persisted in the browser at localStorage["ov_console_connection"] (record shape: {accountId, userId, baseUrl, apiKey, adminApiKey}). The Agent Experience page builds its list URI as buildExperiencesUri(connection.userId) → viking://user/<userId>/memories/experiences (web-studio/src/routes/agent-experience/-lib/experience.ts). A stale value ("userId": "claude" on our instance) therefore keeps producing these 404s indefinitely, independent of peers.

2. New user-visible impact: a false empty state

fetchExperiences (web-studio/src/routes/agent-experience/-lib/api.ts) swallows 404s as empty results:

if (isOvClientError(error) && error.statusCode === 404) {
  return { items: [], hasMore: false, page, pageSize }
}

So /studio/agent-experience renders the "no experiences yet — they appear after a session commit" empty state although extraction is healthy. On our instance: viking://user/default/memories/experiences holds 412 entries, ov system consistency reports missing_record_count: 0, the newest files were written minutes earlier, and the identical fs/ls request against user/default returns items. After resetting the stored "userId" to "default" in ov_console_connection, the page listed the experiences again (server log confirms the URI switched to user/default).

3. In dev mode there is no UI path to correct the value

  • Settings → Connection renders only the base URL ("identity is determined automatically"); account/user fields are not shown.
  • The header identity menu cannot switch either: switchIdentity throws identitySwitchUnsupported when serverMode === 'dev' || 'checking'.

Suggestion: ignore/clear the persisted userId while the server is in dev mode, or expose an edit/clear control — users otherwise cannot fix this without manually editing localStorage.

4. Suggested empty-state handling

When the experiences URI 404s, distinguish "user space viking://user/<id> does not exist" from "no experiences yet" (or fall back to the resolved caller identity). The current copy sent us down the extraction pipeline for a long detour.

Environment: OpenViking 0.4.23 (server + CLI), macOS, auth_mode: dev, single user default. The original 404/403 log-noise finding is unchanged; adding the new consequence here instead of opening a duplicate.

za8209 avatar Oct 04 '26 12:10 za8209