Skip to content

feat: add user-scoped memory extraction policies - #3906

Open
heaoxiang-ai wants to merge 4 commits into
volcengine:mainfrom
heaoxiang-ai:feat/user-memory-policy
Open

feat: add user-scoped memory extraction policies#3906
heaoxiang-ai wants to merge 4 commits into
volcengine:mainfrom
heaoxiang-ai:feat/user-memory-policy

Conversation

@heaoxiang-ai

@heaoxiang-ai heaoxiang-ai commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Description

Add user-scoped memory extraction policies for enterprise multi-user OpenViking instances. User defaults are persisted in user_config.json, resolved at commit time, and frozen into the asynchronous extraction task so policy changes apply immediately without restarting the instance.

Human Involvement

  • A human participated in the implementation or review loop
  • This PR was generated entirely by AI agents without human participation in the loop

Related Issue

N/A

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test update

Changes Made

  • Extend MemoryPolicy with independent self/peer type filters, reject Agent memory for peers, and expand experiences to cases/trajectories/experiences only when resolving the effective Self policy.
  • Resolve policy precedence as commit override > session metadata > latest user config > kernel default, apply the account Agent Evolution switch, and freeze the effective policy before the worker runs.
  • Persist user defaults in viking://user/{user_id}/settings/user_config.json; add locked backup/update behavior and allowlisted GET/PATCH admin settings APIs.
  • Propagate separate self/peer filters through the active v3 compressor and the memory isolation/streaming update path; leave the deprecated v2 compressor unchanged.
  • Document the new admin APIs in English and Chinese and add policy, hot-update, and extraction-scope tests.

Testing

  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have tested this on the following platforms:
    • Linux
    • macOS
    • Windows

Commands run:

  • pytest -q -o addopts='' tests/unit/session/test_memory_policy.py tests/unit/session/test_agent_evolution_policy.py tests/server/test_admin_api.py::test_user_memory_policy_can_be_initialized_and_hot_updated — 16 passed.
  • python -m compileall -q openviking — passed.
  • ruff check for all changed Python and test files — passed.

The Session integration fixtures could not initialize in the local environment because native AGFS/VectorDB setup failed before reaching the test assertions (AGFSInvalidOperationError / local store lock). The added integration cases remain in the suite for CI.

Checklist

  • My code follows the project's coding style
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Screenshots (if applicable)

N/A

Additional Notes

  • The dependent Serverless control-plane MR is https://code.byted.org/data-arch/knowledge_base_server/merge_requests/3405 and should be released after the kernel change.
  • npm run check:api still reports the pre-existing missing reference for PATCH /api/v1/sessions/{}/config; the two routes introduced here are present in both overview and detailed API references.
  • This PR intentionally does not add the optional batch Agent Evolution user list API; that endpoint requires a batch asset/policy contract to avoid N+1 settings requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant