Repository navigation
fix(cli): honor token controls for builtin documents - #7897
Merged
Merged
Conversation
Contributor
[Low impact] The PR appears safe to merge; no actionable defect was established. SummaryBuilt-in manifests and schemas now pass through REA's token count and text-window output path when requested.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[CLI arguments] --> B{Built-in document with token controls?}
B -->|Yes| C[Capture SDK output]
B -->|No| D[Existing output path]
C --> E{SDK exit status}
E -->|Success| F[Count tokens or apply text window]
E -->|Failure| G[Keep SDK diagnostics]
F --> H[Write stdout]
G --> H
Reviews (1) · Last reviewed commit: "fix(cli): honor token controls for built..." · Reviewed by Greptile |
morluto
marked this pull request as ready for review
October 28, 2026 20:56
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
Summary
--llms-full --token-countpreviously printed the complete manifest, and--token-limit 1ignored the requested window. Built-in manifest, index and schema documents now honor the caller's token controls. Fixes #7581.Problem and expected behavior
Incur emits built-in documents outside command-result handlers, bypassing REA's token output owner. A requested count or text window must apply to the selected emitted document.
Change and scope
Capture only the SDK's built-in document output when token controls apply, then use the existing token estimator and text-window projection. Retain built-in help/version/completion precedence and non-JSONL SDK error rendering. No target execution or new authority is introduced.
Contract and boundary impact
Evidence and regression coverage
The built CLI regression checks full/index manifests and schemas, text windows, JSON counts, structured-window rejection, invalid schema diagnostics, and help/version/completion precedence. It would fail on the old behavior that emitted a full document instead of a count or window.
Validation performed
npm run test:focused -- tests/acceptance/cliBuiltinDocumentTokens.test.ts— 1 test passed.npm run test:focused -- tests/boundary/cli/cliTokenWindowOutput.test.ts tests/boundary/cli/jsonLinesOutput.test.ts— 68 tests passed.npm run check:fastandgit diff --check— passed.Compatibility, safety, and release
Token-controlled built-in requests now return their requested count/window rather than a complete document. No provider or target was used; non-macOS behavior was not separately verified.
Author readiness
Human owner: @morluto
Before merge
type(scope): outcome.