You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
admin account creation with namespace policy persistence
shared session visibility across users in one account
USER delete denied / ADMIN delete allowed
Notes
pytest collection is currently blocked by the repo's existing pytest-asyncio package-collection error (AttributeError: 'Package' object has no attribute 'obj'), so I used compile/lint plus a direct integration harness for this PR.
_get_namespace_resolver uses run_async to load policy; this may block the event loop when called from async functions like initialize_user_directories.
The _get_namespace_resolver method uses run_async() to call the async load_namespace_policy function, which blocks the event loop when invoked from async contexts (like initialize_user_directories). Convert _get_namespace_resolver and get_namespace_resolver to async methods, and update callers to await them.
Why: The suggestion correctly identifies a potential event loop blocking issue with run_async(), but the provided improved_code does not include necessary updates to synchronous callers (like _canonicalize_uri and _is_accessible), which would break existing functionality.
Low
Make policy loading async
Convert _load_namespace_policy to an async method and update its callers to await it, since get_namespace_resolver is now async. This eliminates blocking calls in async functions like initialize_user_directories and initialize_agent_directories.
Why: The suggestion depends on making get_namespace_resolver async (from suggestion 1), which is not addressed independently. Additionally, it does not account for synchronous callers of get_namespace_resolver elsewhere, limiting its standalone validity.
Updated the PR to address the bot suggestions: added the missing license header, tightened namespace-policy fallback logging, and reworked namespace policy loading/cache warmup to avoid blocking async paths.
Thanks for the contribution here. This issue already has an implementation in progress in #1356, so I do not recommend continuing with another parallel implementation to avoid duplicated work and review overhead. If you would like to help on this topic, reviewing or testing #1356 would be more useful.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
#1351Phase 1 account namespace policy persistence under/local/{account_id}/_system/setting.jsonviking://session/{session_id}ADMIN/ROOTWhat Changed
NamespacePolicy+NamespaceResolverand cache policy loading insideVikingFSUserIdentifierPhase 1 Scope
Included in this PR:
Explicitly left for follow-up:
role_ididentity modelValidation
ruff check openviking/core/namespace.py openviking/storage/viking_fs.py openviking/core/directories.py openviking/service/core.py openviking/server/routers/admin.py openviking/service/session_service.py openviking/session/session.py openviking/message/part.py openviking_cli/session/user_id.py tests/unit/test_namespace_resolver.py tests/server/test_admin_api.py tests/server/test_auth.py tests/session/test_session_lifecycle.py tests/test_session_task_tracking.py tests/unit/test_summarizer_context_type.pypython -m compileall openviking/core/namespace.py openviking/core/directories.py openviking/storage/viking_fs.py openviking/service/core.py openviking/server/routers/admin.py openviking/service/session_service.py openviking/session/session.py openviking/message/part.py openviking_cli/session/user_id.py tests/unit/test_namespace_resolver.py tests/server/test_admin_api.py tests/server/test_auth.py tests/session/test_session_lifecycle.py tests/test_session_task_tracking.py tests/unit/test_summarizer_context_type.pyUSERdelete denied /ADMINdelete allowedNotes
pytestcollection is currently blocked by the repo's existingpytest-asynciopackage-collection error (AttributeError: 'Package' object has no attribute 'obj'), so I used compile/lint plus a direct integration harness for this PR.