Skip to content

fix(openviking): resolve viking_read 500/412 on file URIs and pseudo-summary URIs (salvage #5886 + #12757 + #12937) - #17869

Merged
teknium1 merged 4 commits into
mainfrom
hermes/hermes-2ce7fc43
Apr 30, 2026
Merged

fix(openviking): resolve viking_read 500/412 on file URIs and pseudo-summary URIs (salvage #5886 + #12757 + #12937)#17869
teknium1 merged 4 commits into
mainfrom
hermes/hermes-2ce7fc43

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

viking_read no longer returns 500/412 against live OpenViking servers for file URIs or pseudo-summary URIs.

Salvages @htsh's PR #5886 with its 3 original commits intact, then adds an fs/stat pre-check on top — the same idea @pty819 (#12757) and @chennest (#12937) independently arrived at.

Root cause

OpenViking's /api/v1/content/abstract and /api/v1/content/overview endpoints are directory-only. The plugin was forwarding both pseudo-summary file URIs (viking://.../.overview.md) and real file URIs (mem_*.md) to them, which the server rejected with HTTP 500 (v0.3.3) / 412 (newer builds).

Changes

Why keep both the pre-check AND the exception fallback

The pre-check (fs/stat) is the fast path when the server cooperates — it avoids a failing /content/overview round-trip. The exception fallback (#5886's original approach) is the safety net when fs/stat is unavailable, returns an unfamiliar shape, or is slower than eating the 500. Keeping both means no regression for any OpenViking version that #5886 already supported.

Credit

Validation

Before After
tests/openviking_plugin/ no tests shipped 9 passing
File URI + level=overview HTTP 500/412 fs/stat/content/read
Pseudo /.overview.md HTTP 500 normalized to dir → /content/overview
Directory URI + level=overview works still works (stat → overview)

Closes #5886
Closes #12757
Closes #12937
Fixes #12755

htsh and others added 4 commits April 30, 2026 02:30
OpenViking v0.3.3 expects directory URIs for abstract/overview reads.
Passing pseudo-files like /.overview.md and /.abstract.md to
/api/v1/content/overview|abstract triggers HTTP 500.

This change normalizes those pseudo-URIs to their parent directory for
abstract/overview requests, preserves full reads, and hardens parsing for
wrapped/unwrapped result payloads and fs list response shapes.
OpenViking returns 500 for /content/abstract and /content/overview when URI points to mem_*.md files.
Add resilient fallback to /content/read for non-pseudo summary file URIs while preserving pseudo summary normalization.
Also add regression tests for fallback behavior.
…directory-only endpoints

Adds a deterministic pre-check on top of htsh's exception-based fallback:
before calling /content/abstract or /content/overview on a non-pseudo URI,
probe /api/v1/fs/stat. If the server says the URI is a file, route straight
to /content/read instead of eating a failing 500 round-trip.

This is the same idea pty819 and chennest independently landed in PRs
#12757 and #12937 — merged here on top of htsh's broader fix so we keep
pseudo-URI normalization and v0.3.3 browse-shape handling while avoiding
the slow exception path on servers that return a raised 500 every time.

The exception fallback from #5886 stays in place for environments where
fs/stat is unavailable or returns an unfamiliar shape.

Also credits pty819, chennest, and htsh in AUTHOR_MAP so future release
notes attribute them correctly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: openviking plugin — viking_read returns 500 for file URIs on abstract/overview levels

3 participants