Skip to content

Expose an optional protocol-aware LLM completion cap #130

Description

@xeonvs

Problem

OCR 1.9.10 sends its embedded completion cap of 58888 on full OpenAI Chat Completions review requests. Some compatible gateways reserve spend from the requested output cap and reject a full review before generation even when short probes succeed. OCR 1.9.10 has no public completion-cap setting, while its private llm.extra_body overlay can replace the protocol-specific wire field.

Implementation checklist

  • Add optional OCR_LLM_MAX_COMPLETION_TOKENS; exact default is unset and inherits the qualified OCR behavior.
  • Accept only a positive decimal integer from 1 through 1000000, with length bounded before conversion.
  • Map openai to max_completion_tokens, openai-responses to max_output_tokens, and anthropic to max_tokens.
  • Preserve unrelated OCR_LLM_EXTRA_BODY; deduplicate an equal JSON integer and reject conflicting or non-integer ownership.
  • Leave OCR prompt/context max_tokens, OCR_MAX_TOKENS_BUDGET, receipt v5, DLP, telemetry, outcomes, severity, findings, and approval unchanged.
  • Do not derive the value from /models.max_completion_tokens.
  • Checksum-verify official Darwin arm64 OCR 1.9.10 (c626347bafcdbf25cf058af403d16568a3a9ffa1814046ff7c9d1e6becaf60d2).
  • Observe exact no-LLM production-config wire behavior: unset 58888, explicit 4096; remove every temporary probe artifact.
  • Add environment, generated-config, compatibility, and installed wheel/sdist tests.
  • Document exact default, protocol mapping, collision migration, the three token controls, spending reservation, /models non-claim, and the 4096 example.
  • Add the separate 130.feature.md operator/agent-facing changelog fragment.
  • Complete focused, full quality/coverage, Gitleaks, manifest/lock, Towncrier, reproducible package, Twine, and Python 3.12–3.14 install gates.

Release lifecycle

  • Implemented and pushed at Draft PR Release 0.8.1: completion cap and safe provider failures #131 exact head 53c6374da216bf88aa27ba6dd146b3322d8c8463 (tree 25e4340ce9a076edc28e5412edd11de7ac876d76).
  • All hosted checks pass on that exact head.
  • Protected feature PR is reviewed and merged.
  • TestPyPI development artifact is independently verified.
  • Protected 0.8.1 release and external registry/GitHub/provenance reconciliation complete.

Related safe diagnostics: #129. Keep this issue open until stable reconciliation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions