Skip to content

fix(models): enforce global call limits before model queries - #1072

Open
Golden007-prog wants to merge 1 commit into
SWE-agent:mainfrom
Golden007-prog:fix/1071-global-model-call-limit
Open

Golden007-prog wants to merge 1 commit into
SWE-agent:mainfrom
Golden007-prog:fix/1071-global-model-call-limit

Conversation

@Golden007-prog

Copy link
Copy Markdown

Closes #1071.

The global call limit currently raises after counting the final allowed response, which prevents the agent from using it. Provider requests can also start before the shared count is checked.

Reserve a call slot before the provider retry loop in each built-in provider adapter. Concurrent workers share the same allowance. Retries reuse the slot, failed queries release it, and a completed query records its cost and call count together before parsing the response. The dollar threshold continues to use the actual response cost.

Verification

  • On the current upstream commit, the eight new tests reproduced seven failures. The unlimited-mode control passed.
  • All 147 Windows model tests passed. The new synthetic cases cover limits of one, two, and unlimited, concurrent admission, retry and failure cleanup, and receipt and cost accounting.
  • Linux Python 3.12 passed 566 tests and skipped 61 for unavailable container backends or live provider credentials. Full-source pylint --errors-only passed. These runs used the compatible optional contree-sdk==0.2.1.
  • The applicable pinned pre-commit hooks, strict documentation build, and source distribution and wheel builds passed.

This branch has not been deployed

No deployments
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.

Global call limit discards the last allowed model response

1 participant