Add page-memory VLM capacity gate#208
Merged
suguanYang merged 4 commits intoJul 7, 2026
Merged
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
UnavailableExceptionbackpressure instead of degraded empty OCR/title/summary output.usage_taskvalues prefixed withpage_memory.in the shared OpenAI-compatible sync client; non-page-memory LLM calls keep existing behavior.3; existing scope/tag defaults remain5/4but are tunable through settings.page_memory_config.Verification
uv run pytest packages/shared-python/shared/tests/test_page_memory_config.py packages/shared-python/shared/tests/test_page_memory_vlm_limiter.py apps/worker/tests/contract/test_page_memory_page_tagger_contract.py apps/worker/tests/contract/test_page_memory_node_assembler_contract.pyuv run pytest apps/worker/tests/contract/test_page_memory_*.py packages/shared-python/shared/tests/test_page_memory_config.py packages/shared-python/shared/tests/test_page_memory_vlm_limiter.pyuv run pytest apps/worker/tests/contract/test_page_memory_*.pyuv run pytest apps/worker/tests/contractmake checkcurl -sS http://localhost:5005/healthjob_c5bd6e3f7b34, TSLA 35-page PDF, completeddone,parse_track=page_memory, result ZIP/tmp/tsla-page-memory-real-parse.zip.job_af2bc76242f3, synthetic 8-page scanned PDF, completeddone, produced 8 non-empty page chunks, result ZIP/tmp/scanned-page-memory-real-parse-with-env.zip.job_af2bc76242f3showedpage_memory.vlm_gate.acquiredforpage_memory.title_detection,page_memory.hierarchy,page_memory.tag, andpage_memory.node_ocr; observed in-flight counts up to 4. This real parse was run before the final concurrency default bump, so it observed OCR concurrency2.page_memory:vlm:inflightwas empty after completion.Deployment Notes
PAGE_MEMORY_VLM_MAX_INFLIGHT=16,PAGE_MEMORY_VLM_LEASE_TTL_SECONDS=600,PAGE_MEMORY_VLM_WAIT_TIMEOUT_SECONDS=120,PAGE_MEMORY_SCOPE_CONCURRENCY=5,PAGE_MEMORY_TAG_CONCURRENCY=4,PAGE_MEMORY_TITLE_DETECTION_CONCURRENCY=3,PAGE_MEMORY_NODE_ASSEMBLY_CONCURRENCY=3.IMAGE_MODELexported for page-memory page-level VLM tagging/OCR. During local testing, a worker started withoutapps/worker/.envskipped page VLM calls; restarting with.envsourced exercised the limiter.Checklist