Skip to content

fix: allow negative TOC offset scan and page-scaled TOC max_tokens - #324

Merged
EricNGOntos merged 2 commits into
mainfrom
feat/wuchengke/2026-08-23
Aug 24, 2026
Merged

fix: allow negative TOC offset scan and page-scaled TOC max_tokens#324
EricNGOntos merged 2 commits into
mainfrom
feat/wuchengke/2026-08-23

Conversation

@EricNGOntos

Copy link
Copy Markdown
Contributor

Summary

  • Phase1 calibration scans from toc_end + 1 again (printed floor commented for easy restore), so journal-reprint PDFs can calibrate with negative offsets.
  • TOC VLM batch max_tokens is pages × 3000; anchor confirm uses a small fixed 512 budget.
  • Contract tests updated for the Phase1 scan-start behavior.

Test plan

  • make check (lint + typecheck)
  • pytest tests/contract/test_calibration_phase1_contract.py
  • Debug PM Stage2 on EN_Sydney Streets Code (offsets unchanged vs prior)
  • Debug PM Stage0–2 on EN_medical (offset=-110, TOC extract 210 entries)

Made with Cursor

EricNGOntos and others added 2 commits August 24, 2026 23:15
…TOC extraction limits

- Modified the scanning start logic in phase1 to ensure it begins after the TOC, allowing for negative offsets when necessary.
- Updated the TOC extraction tool to use a new maximum token limit for anchor confirmation, improving efficiency.
- Refactored the token calculation in the VLM TOC extractor to be page count dependent, enhancing flexibility.
- Adjusted related tests to reflect changes in scanning behavior and ensure accurate results.
…dget

Co-authored-by: Cursor <cursoragent@cursor.com>
@EricNGOntos
EricNGOntos merged commit 2f10f7f into main Aug 24, 2026
6 checks passed
@EricNGOntos
EricNGOntos deleted the feat/wuchengke/2026-08-23 branch August 24, 2026 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant