Skip to content

fix(openviking): viking_read fails on file URIs — route to /content/read - #12937

Closed
chennest wants to merge 2 commits into
NousResearch:mainfrom
chennest:fix/openviking-viking-read-file-uri
Closed

fix(openviking): viking_read fails on file URIs — route to /content/read#12937
chennest wants to merge 2 commits into
NousResearch:mainfrom
chennest:fix/openviking-viking-read-file-uri

Conversation

@chennest

@chennest chennest commented Apr 20, 2026

Copy link
Copy Markdown

Summary

viking_read routes file URIs to /api/v1/content/abstract and /api/v1/content/overview, but these endpoints only accept directory URIs, causing all file-level reads to return 412 Precondition Failed.

Root Cause

OpenViking API endpoint design:

  • /api/v1/content/abstract — accepts directory URIs only
  • /api/v1/content/overview — accepts directory URIs only
  • /api/v1/content/read — accepts file URIs only

The original code did not distinguish between URI types, so file URIs with level=abstract|overview always hit 412.

Fix

  1. Add _is_directory() method to detect URI type via /api/v1/fs/stat
  2. File URIs → route to /api/v1/content/read (ignore level parameter)
  3. Directory URIs → route to /content/abstract or /content/overview by level

Test Plan

  • File URI + level=abstract → calls /content/read, returns file content
  • File URI + level=overview → calls /content/read, returns file content
  • Directory URI + level=overview → calls /content/overview, returns directory summary

Closes #4740
Closes #10124
Closes #12755

…ints

- Add _is_directory() to detect URI type via /fs/stat
- Route file URIs to /api/v1/content/read (all levels)
- Route directory URIs to /content/abstract or /content/overview by level
- Closes NousResearch#4740 NousResearch#10124 NousResearch#12755
@chennest
chennest force-pushed the fix/openviking-viking-read-file-uri branch from a03c4d4 to 2961b8a Compare April 20, 2026 09:28
@pty819

pty819 commented Apr 21, 2026

Copy link
Copy Markdown
Contributor

bro I have submitted this PR yesterday. But seems no one care about this

@chennest

Copy link
Copy Markdown
Author

Yeah, seems like it. I'll just fix it on my end then.

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/plugins Plugin system and bundled plugins tool/memory Memory tool and memory providers labels Apr 22, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Related to PR #12757 — same fix for OpenViking file URI routing. Maintainers should pick one.

@ZaynJarvis

Copy link
Copy Markdown
Contributor

thx this will be fixed.

teknium1 added a commit that referenced this pull request Apr 30, 2026
…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.
@teknium1

Copy link
Copy Markdown
Contributor

Merged via #17869#17869

Your fs/stat pre-check idea was wired in as the follow-up commit (5d253e6) on top of @htsh's broader fix from #5886. @pty819 independently proposed the same pre-check in #12757, also credited. All three of you credited in the salvage PR body and in scripts/release.py AUTHOR_MAP. Thanks!

donald131 pushed a commit to donald131/hermes-agent that referenced this pull request May 2, 2026
…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
NousResearch#12757 and NousResearch#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 NousResearch#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.
nickdlkk pushed a commit to nickdlkk/hermes-agent that referenced this pull request May 11, 2026
…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
NousResearch#12757 and NousResearch#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 NousResearch#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.
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
…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
NousResearch#12757 and NousResearch#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 NousResearch#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.
jsboige pushed a commit to jsboige/hermes-agent that referenced this pull request May 14, 2026
…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
NousResearch#12757 and NousResearch#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 NousResearch#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.
dannyJ848 pushed a commit to dannyJ848/hermes-agent that referenced this pull request May 17, 2026
…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
NousResearch#12757 and NousResearch#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 NousResearch#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.
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
…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
NousResearch#12757 and NousResearch#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 NousResearch#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.
Seven74AI pushed a commit to Seven74AI/hermes-agent that referenced this pull request Jun 13, 2026
…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
NousResearch#12757 and NousResearch#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 NousResearch#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.
waefrebeorn pushed a commit to waefrebeorn/slermes that referenced this pull request Jul 2, 2026
…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
NousResearch#12757 and NousResearch#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 NousResearch#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.
Gravezzz pushed a commit to Gravezzz/hermes-agent that referenced this pull request Jul 21, 2026
…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
NousResearch#12757 and NousResearch#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 NousResearch#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 P2 Medium — degraded but workaround exists tool/memory Memory tool and memory providers type/bug Something isn't working

Projects

None yet

5 participants