Skip to content

fix(session): requeue Phase 2 on lock contention and pause before requeue - #6083

Open
OnePerson2020 wants to merge 1 commit into
volcengine:mainfrom
OnePerson2020:fix/session-commit-lock-requeue
Open

OnePerson2020 wants to merge 1 commit into
volcengine:mainfrom
OnePerson2020:fix/session-commit-lock-requeue

Conversation

@OnePerson2020

Copy link
Copy Markdown

Description

  • LockAcquisitionError in Phase 2 no longer fails the archive: _run_memory_extraction re-raises it without writing .failed.json or failing the task, and resume_queued_commit returns False, so SessionCommitProcessor requeues the message. Completed steps are already checkpointed in completed_memory_steps, so the rerun continues where it stopped.
  • SessionCommitProcessor pauses 2 s before re-enqueueing a commit that has to wait (predecessor pending or lock contention), instead of cycling it continuously (the embedding processor already sleeps retry_after before re-enqueueing).

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

Fixes #6082

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

  • session.py: except LockAcquisitionError before the generic handler in _run_memory_extraction (telemetry + warning, re-raise); resume_queued_commit maps it to False.
  • session_commit_processor.py: await asyncio.sleep(_REQUEUE_DELAY_S) (2 s) before the re-enqueue.
  • Tests: new test_phase2_lock_contention_requeues_without_failing_archive; test_process_requeues_deferred_commit_and_resets_root_context now also checks the pause comes before the enqueue.

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
echo '{}' > /tmp/min.conf
OPENVIKING_CONFIG_FILE=/tmp/min.conf uv run --extra test pytest tests/unit/session tests/session tests/storage/test_session_commit_processor_identity.py -q --no-cov --ignore=tests/session/test_session_commit_race.py
uv run --extra dev ruff check openviking/session/session.py openviking/storage/queuefs/session_commit_processor.py tests/storage/test_session_commit_processor_identity.py tests/unit/session/test_session_commit_resume.py
uv run --extra dev ruff format --check (same files)
git diff --check
  • Without the code change both tests fail (resume_queued_commit returns True after marking the archive failed; no pause before the enqueue); with it they pass.
  • Across tests/unit/session, tests/session and the processor tests, the set of other failures is identical before and after the change in my environment (vectordb-engine / full-config tests; test_session_commit_race.py hangs on main locally, so it is excluded). Ruff and git diff --check clean.
  • Running in our deployment since 2026-10-09.

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

Additional Notes

No API or data-format change; no new dependency.

🤖 Generated with Claude Code

@ZaynJarvis ZaynJarvis added the kernel Core server, runtime, storage, retrieval, SDK, and CLI. label Oct 15, 2026

This branch has not been deployed

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

Labels

kernel Core server, runtime, storage, retrieval, SDK, and CLI.

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

[Bug]: Phase 2 fails the archive on lock contention, and waiting commits requeue in a hot loop

2 participants