Conversation
pydantic-ai's own default (UsageLimits(request_limit=50)) is too low for "complex" modules whose agent loop reads several code components and/or spins off sub-module docs via generate_sub_module_documentation_tool. On a real-world run (voll-intelligence, a 5,381-file TypeScript monorepo, 16,720 functions), 4 modules hit UsageLimitExceeded mid-run and were skipped outright — no retry, no fallback to the configured fallback-model, and no CLI flag to raise the limit. All 4 succeeded on the same input once the limit was raised to 100, with no other change.
fabceolin
marked this pull request as draft
September 25, 2026 11:53
The previous commit fixed UsageLimitExceeded on complex modules by raising pydantic-ai's request_limit from 50 (its own default) to 100, but hardcoded the new value with no way to tune it. Some repos/modules need more than 100 requests per agent run, so expose it the same way as the other generation knobs (max_tokens, max_token_per_module, ...): - Config.request_limit (backend), default DEFAULT_REQUEST_LIMIT = 100 - --request-limit on `codewiki generate` and `codewiki config set` - persisted in ~/.codewiki/config.json, shown in `codewiki config show`
This was referenced Sep 29, 2026
Collaborator
|
fixed at #121 |
pull Bot
pushed a commit
to soitun/CodeWiki
that referenced
this pull request
Sep 29, 2026
…ons, ship updater - Package: add codewiki.src.be.updater to [tool.setuptools] packages; a non-editable install had no updater, so every --update failed on import. New test checks every package directory is listed. (FSoft-AI4Code#119) - Agent limits: pass UsageLimits(request_limit=...) to every agent run and retries=... to every Agent. pydantic-ai defaults are 50 requests per run and 1 retry per failing tool call, which complex modules and generate_sub_module_documentation hit. New settings request_limit (default 100) and agent_retries (default 3), in `codewiki config set`, `config show` and as per-run overrides on `codewiki generate`. (FSoft-AI4Code#115, FSoft-AI4Code#118) - Fallback: FallbackModel now also falls back on UnexpectedModelBehavior (a 200 response whose body does not parse), keeping ModelAPIError. (FSoft-AI4Code#117) - Overview pages: MODULE_OVERVIEW_PROMPT / REPO_OVERVIEW_PROMPT had no slot for the user's instructions. complete() takes an optional system_prompt (OpenAI- compatible, litellm, Azure, and caw via CawAgent(system_prompt=...)), and parent/repo overviews send the instructions as a system message. (FSoft-AI4Code#116) - Sub-module agents built their system prompt with a raw .format(), so with no instructions the prompt ended in the literal text "None"; they now use format_system_prompt / format_leaf_system_prompt like the top-level agents. Reported in FSoft-AI4Code#115, FSoft-AI4Code#116, FSoft-AI4Code#117, FSoft-AI4Code#118, FSoft-AI4Code#119.
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.
Problem
pydantic-ai's own default (
UsageLimits(request_limit=50)) is too low for "complex" modules whose agent loop reads several code components and/or spins off sub-module docs viagenerate_sub_module_documentation_tool.On a real-world run (
voll-intelligence, a 5,381-file TypeScript monorepo, 16,720 functions), 4 modules hitUsageLimitExceededmid-run and were skipped outright:No retry, no fallback to the configured
fallback-model, and no CLI flag to raise the limit.Fix
UsageLimits(request_limit=100), passed explicitly to bothagent.run(...)call sites inpydantic_ai_backend.py(run_update_agentandrun_module_agent).request_limitnow follows the exact same pattern as the other generation knobs (max_tokens,max_token_per_module, ...):Config.request_limitin the backend (codewiki/src/config.py), defaultDEFAULT_REQUEST_LIMIT = 100--request-limitoncodewiki generateandcodewiki config set~/.codewiki/config.json, shown incodewiki config show(text and--json)Usage
Validation
request_limit=50succeeded on the exact same input once the limit was raised to 100, with no other change.Config.from_cli(...)with and without arequest_limitoverride;PydanticAIBackend._agent_usage_limitspicks up the configured value.Configuration.to_dict/from_dict/to_backend_configround-trip forrequest_limit.codewiki config set --request-limit N+codewiki config showend-to-end (isolatedHOME).codewiki generate --helpshows the new flag; invalid (< 1) values are rejected the same way as the siblingmax_*options.🤖 Generated with Claude Code