Skip to content

Make v2 memory lock acquisition configurable and resilient#2

Open
heaoxiang-ai wants to merge 1 commit intomainfrom
codex/enhance-long-term-memory-features-in-v2
Open

Make v2 memory lock acquisition configurable and resilient#2
heaoxiang-ai wants to merge 1 commit intomainfrom
codex/enhance-long-term-memory-features-in-v2

Conversation

@heaoxiang-ai
Copy link
Copy Markdown
Owner

Motivation

  • The v2 memory extractor used an unbounded while True loop to acquire subtree locks, which can block session commits indefinitely under contention.
  • Provide operational controls so operators can tune retry pacing and impose an upper bound on lock acquisition attempts.

Description

  • Added two new memory configuration fields in MemoryConfig: v2_lock_retry_interval_seconds and v2_lock_max_retries to control retry pacing and limits.
  • Updated SessionCompressorV2.extract_long_term_memories to honor the new config values, perform paced retries using asyncio.sleep, and raise TimeoutError when the retry limit is hit.
  • Kept existing behavior of ordered batch locking to avoid deadlocks while making retries observable via logs.
  • Added unit test test_v2_lock_acquire_respects_max_retries to validate that the extractor stops retrying after the configured maximum and that the retry loop is exercised.

Testing

  • python -m compileall openviking/session/compressor_v2.py openviking_cli/utils/config/memory_config.py tests/session/memory/test_compressor_v2.py completed successfully.
  • Attempted to run the targeted pytest for the new test, but the test bootstrap (tests/conftest.py) failed at import time due to a missing yaml dependency in the environment, so the new test was not executed in this run.
  • The new test is included and designed to run in CI where project test dependencies are satisfied.

Codex Task

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 7, 2026

Failed to generate code suggestions for PR

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant