Skip to content

fix: always send tenant headers in OpenViking _headers() when account/user are set#22414

Merged
kshitijk4poor merged 1 commit into
NousResearch:mainfrom
kshitijk4poor:fix/openviking-root-key-tenant-headers
May 9, 2026
Merged

fix: always send tenant headers in OpenViking _headers() when account/user are set#22414
kshitijk4poor merged 1 commit into
NousResearch:mainfrom
kshitijk4poor:fix/openviking-root-key-tenant-headers

Conversation

@kshitijk4poor

Copy link
Copy Markdown
Collaborator

Salvage of #21775 (happy5318) — with test fixes

Original PR removed the != "default" guard from _headers() so ROOT API keys can send tenant headers even when account/user are "default". OpenViking 0.3.x requires these headers for tenant-scoped APIs.

Changes vs original

Item Status
Production fix (remove != "default" guard) ✅ Cherry-picked as-is
test_omit_tenant_when_legacy_defaulttest_headers_send_tenant_when_default ✅ Renamed, assertions flipped to == "default"
test_omit_tenant_when_emptytest_headers_send_tenant_when_empty_falls_back_to_default ✅ Renamed, assertions flipped to == "default"
Author in AUTHOR_MAP Already present ✅

Test results

20 passed in tests/plugins/memory/test_openviking_provider.py

Based on #21775 by @happy5318 (NouseResearch/hermes-agent#21775)

…/user are set

OpenViking 0.3.x requires X-OpenViking-Account and X-OpenViking-User headers
for ROOT API key requests to tenant-scoped APIs. Previously the `!= "default"`
guard skipped these headers when account/user were the literal string
"default", causing INVALID_ARGUMENT errors.

Remove the `!= "default"` guard so headers are sent whenever account/user
are truthy. Empty strings are still correctly skipped since `""` is falsy.

Update tests to reflect the new behavior:
- test_viking_client_headers_send_tenant_when_default: asserts "default"
  headers ARE present (was test_omit_tenant_when_legacy_default)
- test_viking_client_headers_send_tenant_when_empty_falls_back_to_default:
  asserts "default" headers ARE present from constructor fallback
  (was test_omit_tenant_when_empty)

Based on NousResearch#21775 by @happy5318

Co-authored-by: kshitijk4poor <82637225+kshitijk4poor@users.noreply.github.com>
@kshitijk4poor kshitijk4poor merged commit 8fb3e2d into NousResearch:main May 9, 2026
9 of 11 checks passed
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/plugins Plugin system and bundled plugins labels May 9, 2026
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.

3 participants