Skip to content

fix(session): batch long-term extraction of a large commit without an auto-commit policy - #6086

Open
OnePerson2020 wants to merge 1 commit into
volcengine:mainfrom
OnePerson2020:fix/long-term-extraction-fallback-batches
Open

OnePerson2020 wants to merge 1 commit into
volcengine:mainfrom
OnePerson2020:fix/long-term-extraction-fallback-batches

Conversation

@OnePerson2020

Copy link
Copy Markdown

Description

Long-term extraction is batched only when the session has an auto-commit policy, so a commit without one (explicit commit(), imports/backfills) sends the whole archive to the model in one call however large it is. Auto-commit never lets an archive exceed pending_token_threshold (default 150k), so this is the one unbounded path. A policy-less archive larger than DEFAULT_PENDING_TOKEN_THRESHOLD is now split with that threshold, exactly as an auto-committed archive would be; smaller ones keep the single-call path.

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 #6085

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

  • extraction_batch.py: long_term_extraction_batch_limits(limits, messages) returns the policy limits, or ExtractionBatchLimits(max_message_tokens=DEFAULT_PENDING_TOKEN_THRESHOLD) for a policy-less archive above that threshold.
  • session.py: the long-term step uses it (one call site).
  • New test test_long_term_extraction_without_policy_batches_only_a_large_commit.

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/unit/service/test_session_auto_commit.py -q --no-cov --ignore=tests/session/test_session_commit_race.py
uv run --extra dev ruff check openviking/session/session.py openviking/session/extraction_batch.py tests/unit/session/test_extraction_batch.py
uv run --extra dev ruff format --check (same files)
git diff --check
  • New test passes; the set of other failures in these suites is identical before and after the change in my environment (vectordb-engine / full-config / real-LLM tests; test_session_commit_race.py hangs on main locally, so it is excluded). Ruff and git diff --check clean.
  • We run the equivalent change in production (since 2026-10-10).

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]: Long-term extraction of a commit without an auto-commit policy is never batched

2 participants