Repository navigation
fix: bound --token-limit and --token-offset windows - #319
Merged
Merged
Conversation
Reject negative --token-limit and --token-offset values before the command runs, and clamp the start of the truncation footer so an offset past the end reads `13–13 of 13` instead of a reversed range. Ports the fix to Rust, Python, and Zig, drops their now-unreachable negative token slicing, and adds differential cases. Fixes #273 Fixes #247 Co-authored-by: Debojyoti De Majumder <[email protected]> Co-authored-by: forthetech.eth <[email protected]> Amp-Thread-ID: https://ampcode.com/threads/T-01a20b38-b5a6-738c-870c-833aef311fdc Co-authored-by: jxom <[email protected]>
Codex Review Summary: ✅ CompletedThis 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. |
commit: |
This was referenced Nov 24, 2026
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.
Fixes #273
Fixes #247
Supersedes #296, thanks @debojyoti10CC, and supersedes #254, thanks @HereForTheTechNFT.
Both PRs touch the same token window code, so this combines them and ports them to Rust, Python, and Zig.
--token-limitand--token-offsetreject negative values with the same error as a non-numeric value (Invalid value for --token-limit: "-3"), so the command doesn't run and the exit code is 1.0and-0stay valid.showing tokens 100000–13 of 13is now13–13 of 13. The slice andmeta.nextOffsetare unchanged.tokenx), since nothing can pass one now.--full-output),-1,-0.5, and-0. Existing negative cases now expect the error.e2e.test.tssnapshot that captured the reversed6–3 of 3footer now shows3–3 of 3.