fix: slim calibration submit and track worker debug scripts - #300
Merged
Merged
Conversation
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>
Contributor
There was a problem hiding this comment.
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: |
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
calibration.submitto status/regimes/notes (kind+offset+optional samples) so oversized Phase-1 JSON no longer aborts the loop as a false no-offset failure; recordfailure_kind(invalid_jsonvsno_offset, etc.) for diagnosis without retry.category_rationale, emptyh1_*payload keys,inspect.pagespage_notes/confidence/raw, page-count diagnostic counters) and stop reading Phase-2-only fields from submit.apps/worker/scripts/(remove from.gitignore) so page_memory/text-track debug tools stay in version control.Test plan
make checkuv run pytest apps/worker/tests/contract -q(221 passed)uv run pytest apps/api/tests -q(216 passed)ZH_空调新风技术标文件.pdf:status=ok offset=5 bulk=65Made with Cursor