Repository navigation
Conversation
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. |
[Medium impact] The PR appears safe to merge; the previous test placement issue is fixed. SummaryThe PR rejects negative and fractional token-window values with
Reviews (3) · Last reviewed commit: "fix(cli): reject negative and fractional..." · Reviewed by Greptile |
|
TL;DR: The fix works on Linux. Negative and fractional token window values now stop with a clear Thanks, Som0111, for the fix. Thanks, coygeek, for the clear report in #5532. I tested head 1ab5663 on Linux.
The 16 failures are your new tests: 12 helper tests and your 4 command-line cases. The 43 older tests still pass. Does it fix #5532? Yes, in the "reject clearly" way the issue allows. I ran the built CLI with
The "before" rows use a copy of the head with only Bot threads at this head:
Not run
Test setupCommandsInstall, build and test:prepare ran on Node 24, exit 0 each. The two test files ran once per Node version on the head, exit 0 each. The no-fix copy ran on Node 24 only, exit 1. The CLI probes ran with HOME and the XDG folders pointed at a temp folder. 🤖 Generated with Claude Code (Sonnet 5.5, verified by Opus 5.5) 🦊 |
|
Source-derived replacement: pinned main commit 4ed33ef validates --token-limit and --token-offset as nonnegative safe integers before dispatch in src/cliOutput.ts#L54-L70, so negative and fractional windows are rejected. tests/boundary/cli/cliOutput.test.ts#L80-L117 covers invalid negative/fractional values for both flags. Main reports the current generic INVALID_OUTPUT_VALUE contract; the requested rejection behavior and coverage are present. |
Summary
--token-limitand--token-offsetaccepted negative and fractional values, producing negativenextOffsetin failure envelopes (breaking paging callers) and fractional display markers like "tokens 2.5–7.5 of 518".Fixes #5532
Problem and expected behavior
Trigger:
inspect-plist --token-limit -5or--token-offset 2.5Violated invariant: Token window bounds must be non-negative integers. Negative limits caused
Math.min(end, total)to preserve a negativeend, makingnextOffsetnegative. Fractional values produced fractional display markers.Expected: A clear
INVALID_TOKEN_VALUEerror naming the offending flag. Zero remains valid as an empty window. Non-numeric input (e.g.abc) is still left to Incur to report.Change and scope
Added
invalidTokenValuetracking toparseCliOutputArguments. After the existingNumber.isFiniteguard, values that failNumber.isInteger(v) && v >= 0are recorded as invalid.validateCliOutputArgumentschecks this and returns a newINVALID_TOKEN_VALUEerror before any other validation. No changes tofullFailureEnvelope— invalid values never reach it.Contribution scope: not applicable (input validation fix within existing CLI output boundary).
Contract and boundary impact
src/cliOutput.ts)INVALID_TOKEN_VALUEerror code added toCliOutputArgumentValidation; existing valid integer inputs are unaffectedExpected effects:
Evidence and regression coverage
Tests added: 17 new tests in
src/cliOutput.test.tscovering valid integers, zero, negative limit/offset, fractional limit/offset, multi-flag combinations, format propagation, and precedence overUNSUPPORTED_OUTPUT_COMBINATIONBase reproduction:
parseCliOutputArguments(["--token-limit", "-5"])previously settokenLimit = -5; now setsinvalidTokenValue = "--token-limit"and leavestokenLimitundefinedUser-visible CLI output:
{"ok":false,"error":{"code":"INVALID_TOKEN_VALUE","message":"--token-limit requires a non-negative integer (0, 1, 2, …)."}}Remaining proof gaps: not tested against a live
inspect-plistinvocationObserved, derived, and inferred claims remain distinguishable.
Artifact identity, source provenance, and failed attempts remain preserved.
Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.
Validation performed
npm run test:local -- src/cliOutput.test.ts— 17 of 17 passednpm run check:fast— typecheck and lint passed (2 of 2 tasks)Compatibility, safety, and release
Author readiness
Human owner: @Som0111
Before merge
type(scope): outcome.