Skip to content

Persist parse token usage on job metadata - #322

Merged
suguanYang merged 3 commits into
mainfrom
feat/wangbinqi/persist-job-token-usage
Aug 25, 2026
Merged

Persist parse token usage on job metadata#322
suguanYang merged 3 commits into
mainfrom
feat/wangbinqi/persist-job-token-usage

Conversation

@suguanYang

Copy link
Copy Markdown
Contributor

Summary

  • Write stages.token_usage (and timing) into durable jobs.job_metadata, not only Redis.
  • Cover both successful completion and parse failures so token totals remain queryable after Redis TTL.

Test plan

  • uv run pytest apps/worker/tests/unit/test_processing_metadata_persist.py
  • After deploy, parse a document and confirm jobs.job_metadata->'stages'->'token_usage' is populated.

Made with Cursor

Write stages.token_usage to the durable jobs.job_metadata JSON so usage survives Redis TTL.

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread apps/worker/tests/unit/test_processing_metadata_persist.py Fixed
Comment thread apps/worker/tests/unit/test_processing_metadata_persist.py Fixed
suguanYang and others added 2 commits August 25, 2026 09:19
…ith 'import' and 'import from''

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
CodeQL flagged mixing from-import with module import for the same package. Use one module alias for both monkeypatching and the call.

Co-authored-by: Cursor <cursoragent@cursor.com>
@suguanYang
suguanYang merged commit 850e11e into main Aug 25, 2026
6 checks passed
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