Skip to content

fix: slim calibration submit and track worker debug scripts - #300

Merged
EricNGOntos merged 2 commits into
mainfrom
feat/wuchengke/slim-calibration-submit
Aug 16, 2026
Merged

EricNGOntos merged 2 commits into
mainfrom
feat/wuchengke/slim-calibration-submit

Conversation

@EricNGOntos

Copy link
Copy Markdown
Contributor

Summary

  • Slim calibration.submit to status/regimes/notes (kind+offset+optional samples) so oversized Phase-1 JSON no longer aborts the loop as a false no-offset failure; record failure_kind (invalid_json vs no_offset, etc.) for diagnosis without retry.
  • Drop unused profile-agent token burn (category_rationale, empty h1_* payload keys, inspect.pages page_notes/confidence/raw, page-count diagnostic counters) and stop reading Phase-2-only fields from submit.
  • Track apps/worker/scripts/ (remove from .gitignore) so page_memory/text-track debug tools stay in version control.

Test plan

  • make check
  • uv run pytest apps/worker/tests/contract -q (221 passed)
  • uv run pytest apps/api/tests -q (216 passed)
  • Stage 0→2 on ZH_空调新风技术标文件.pdf: status=ok offset=5 bulk=65

Made with Cursor

Prevent oversized Phase-1 submit payloads from killing the calibration loop, keep failure_kind records for invalid_json vs no_offset, drop unused profile token fields, and version apps/worker/scripts/.

Co-authored-by: Cursor <cursoragent@cursor.com>

@github-advanced-security github-advanced-security AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

Drop obsolete kwargs that CodeQL flagged after tracking scripts, restore local TocPagePolicy and artifact loaders so staged debug tools match production serializers.

Co-authored-by: Cursor <cursoragent@cursor.com>
logger.info(" 📊 POST-PARSE TIMELINE")
logger.info("═" * 58)
for phase, elapsed in timings.items():
pct = (elapsed / t_total * 100) if t_total > 0 else 0
token_usage_dict = get_current_token_tracker()
owns_token_tracker = token_usage_dict is None
if token_usage_dict is None:
token_usage_dict = init_token_tracker()
stage_timing_dict = get_current_stage_tracker()
owns_stage_tracker = stage_timing_dict is None
if stage_timing_dict is None:
stage_timing_dict = init_stage_tracker()


async def main() -> None:
import re
Comment on lines +38 to +42
from app.services.page_memory._utils import (
page_scope_info,
scope_id_for_pages,
sort_skeletons,
)

sys.path.insert(0, str(_Path(__file__).resolve().parent))

from _debug_pm_shared import * # noqa: F401,F403

sys.path.insert(0, str(_Path(__file__).resolve().parent))

from _debug_pm_shared import * # noqa: F401,F403

sys.path.insert(0, str(_Path(__file__).resolve().parent))

from _debug_pm_shared import * # noqa: F401,F403

sys.path.insert(0, str(_Path(__file__).resolve().parent))

from _debug_pm_shared import * # noqa: F401,F403
if assets_path.exists():
try:
assets_by_page = load_assets_artifact(assets_path)
except Exception:
@EricNGOntos
EricNGOntos merged commit ee927a6 into main Aug 16, 2026
6 checks passed
@EricNGOntos
EricNGOntos deleted the feat/wuchengke/slim-calibration-submit branch August 16, 2026 15:34
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.

2 participants