Skip to content

fix(llm): keep label retries above token floor#2103

Draft
Synvoya wants to merge 1 commit into
Graphify-Labs:v8from
Synvoya:agent/label-retry-token-floor
Draft

fix(llm): keep label retries above token floor#2103
Synvoya wants to merge 1 commit into
Graphify-Labs:v8from
Synvoya:agent/label-retry-token-floor

Conversation

@Synvoya

@Synvoya Synvoya commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Fixes #2086.

Root cause

The adaptive community-label retry path reduces max_tokens as it bisects a failed batch. The earlier #1690 adjustment improved the formula from 64 + 24*n to 256 + 48*n, but a single-community retry on current v8 still receives only 304 output tokens. That leaves the recovery base case with the smallest budget.

Change

  • Preserve the existing batch-size scaling and 8192-token cap.
  • Enforce a 512-token minimum before passing the value through _resolve_max_tokens().
  • Keep GRAPHIFY_MAX_OUTPUT_TOKENS authoritative when users explicitly set it.
  • Add a regression test that forces a two-community parse failure, follows both single-community retries, and asserts that every call receives the 512-token floor.

Validation

  • Regression test before fix: failed with budgets [352, 304, 304].
  • python -m pytest tests/test_label_retry.py -q: 2 passed.
  • Full locked Python 3.12 suite: 3550 passed, 3 skipped.
  • ruff check graphify/llm.py tests/test_label_retry.py: passed.
  • All five tools.skillgen validation modes: passed.
  • graphify update .: completed successfully.
  • git diff --check: 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.

Community-label split-retry starves its own base case: max_tokens shrinks with batch size, single-community retries get only 88 tokens

1 participant