Repository navigation
Conversation
dyoshikawa
left a comment
There was a problem hiding this comment.
Thanks for picking this up, and sorry for the overlap. The same fix for #3491 landed on main in #3508 shortly after this PR was opened, so this branch now conflicts with main in rules-processor.ts and the Codex CLI note in file-formats.md, and rebasing it would mostly mean dropping its changes.
Main took a slightly different shape: the .codex/config.toml read lives in codexcli-rule.ts (readCodexcliProjectDocMaxBytes) and is wired into the processor through a per-tool readConfiguredBytes hook, instead of a toolTarget === "codexcli" branch inside the generic warnForInstructionBudget. That keeps tool-specific logic out of the processor.
One difference worth noting: this PR accepts project_doc_max_bytes = 0 and warns against a 0-byte budget, while main falls back to the 32 KiB default for 0. I'll look at how Codex itself treats 0 separately. Your e2e case (raising the budget suppresses the warning and leaves the config untouched) is a nice check too; I'll see whether main already covers it.
Given that, I don't think this can be merged as-is. Unless you see something here that #3508 misses, I'd lean toward closing it as superseded.
Fixes #3491.
The instruction-size warning always used 32,768 bytes, even when the project had explicitly changed
project_doc_max_bytes. This produced repeated warnings for a 42 KB file with a 128 KB budget, and missed files exceeding a smaller configured budget.This reads the top-level setting from the output root's
.codex/config.tomlwhen estimating the Codex project instruction budget. Non-negative safe integers (including zero) apply to both root files and nested chains. Missing, unreadable, malformed or unusable settings retain the default. The warning reports the actual byte limit used. The config is never modified.This intentionally does not resolve Codex's full config hierarchy, profiles or project trust. The documentation now explains this local-estimate limitation and has been regenerated for the bundled docs. Global instructions and other targets keep their existing behavior.
Validation:
rules-processor.test.ts.pnpm checkandpnpm buildpass.pnpm cicheckpasses: 566 test files, 15,126 tests passing and 4 skipped, plus formatting, lint, types, generated-doc checks, spelling and secret scanning.The first full test run, while other checks/build were running, hit the existing symlinked-directory watch timeout. The subsequent full
pnpm cicheckpassed; no watch code or timeout was changed.AI assistance: implemented and tested with OpenAI Codex. Completed the repository's required
review-prreview with separate code-quality and security reviewers; neither found actionable issues. At review time, External Contributor Policy passed, with Code Quality & Tests and Build binaries still running and no failing workflows.