Fix overview generation failing on large repos (codex input_too_large) - #92
Merged
Conversation
Parent/repo overview prompts embedded the entire module tree — every module's components list — as indent-4 JSON plus the full markdown of every child doc. On large repos (wazuh: ~2.2M chars) that exceeds codex's hard per-turn input cap of 1,048,576 chars, so every overview call failed with input_too_large, surfaced misleadingly as "LLM returned empty content". - build_overview_structure now strips components lists recursively and sets an absolute docs_path per child instead of inlining docs (None when the doc is missing). Wazuh-scale prompts drop from ~2.2M to ~83K chars. - REPO_OVERVIEW_PROMPT / MODULE_OVERVIEW_PROMPT instruct the agent to read the referenced files itself (backend.complete runs with ToolGroup.READER, so file reads are available). Placeholders are unchanged, keeping the MCP prompt_server rendering path working. - Pin coding-agent-wrapper to the fork branch carrying the matching codex provider fixes (stdin prompts, resume sandbox flag, and surfacing CLI failures that were silently returned as empty turns). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The Lint job runs ruff (modern defaults) over every changed file, so the
pre-existing violations in documentation_generator.py and prompt_template.py
count against this PR. Mechanical cleanup only: import sorting, ruff format,
Dict/List -> dict/list, explicit Optional, timezone-aware metadata timestamp,
no mutable argument defaults, and dropping two duplicated dict keys
(".hpp"/".jsx" in EXTENSION_TO_LANGUAGE). The two intentional blanket
`except Exception` handlers are noqa'd with justification.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
anhnh2002
force-pushed
the
fix/overview-prompt-file-paths
branch
from
August 16, 2026 10:26
2f6c782 to
72c3574
Compare
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
On large repos, every parent/repo overview call fails. The overview prompt embeds the entire module tree (every module's
componentslist,json.dumps(indent=4)) plus the full markdown of every child doc. On wazuh that is ~2.2M chars — over codex's hard per-turn input cap of 1,048,576 chars. codex rejects the turn instantly (input_too_large, code -32602), and the failure surfaced misleadingly asLLM returned empty content ... (possible output truncation at max_tokens)— 84 consecutive overview failures in a single wazuh run.Fix
build_overview_structurestripscomponentslists recursively and replaces inlined child docs with an absolutedocs_pathper child (Nonewhen the doc file is missing). Measured on wazuh: overview prompts drop from ~2.2M to ~83K chars.REPO_OVERVIEW_PROMPT/MODULE_OVERVIEW_PROMPTnow instruct the agent to read the referenced doc files itself.backend.complete()runs withToolGroup.READER(codex:--sandbox read-only), so file reads are available. Format placeholders are unchanged, so the MCPprompt_serverrendering path keeps working.coding-agent-wrapperis pinned to a fork branch (https://github.com/anhnh2002/caw/tree/fix/codex-exec-robustness) carrying the matching codex provider fixes: prompt via stdin (argv size limits),codex exec resumesandbox flag mapping, and no longer silently returning an empty turn when the codex CLI exits nonzero after printing a plain-textError:line.EXTENSION_TO_LANGUAGE.Tests
tests/test_overview_structure.py: components stripped at every depth, docs referenced by absolute path and not inlined, target marking, and a wazuh-scale synthetic tree staying an order of magnitude under the codex cap.ruff check+ruff format --checkclean on all changed files.