Skip to content

fix(cli): reject non-decimal byte-entropy window options - #8598

Closed
Plastic-time wants to merge 3 commits into
morluto:mainfrom
Plastic-time:claude/fix-byte-entropy-decimal-window
Closed

Plastic-time wants to merge 3 commits into
morluto:mainfrom
Plastic-time:claude/fix-byte-entropy-decimal-window

Conversation

@Plastic-time

@Plastic-time Plastic-time commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Supersedes #7877, which was closed without review. This is the same change rebased onto d3ab0faf5. Greptile's earlier review (5/5) is on #7877. After Greptile's review here, 40f40d199 takes bounds and defaults from the canonical schema fields and trims the spelling matrix.

Problem and outcome

Fixes #7376. inspect-byte-entropy coerced CLI tokens before validation: --length= selected an empty window, --offset=0x10 selected offset 16, and --offset=1e2 selected offset 100. These invocations returned successful inspection results despite the documented decimal-byte-count contract.

Parse --offset, --length and --block-size through a new cliDecimalField helper. It checks the decimal token, then validates the number with the matching inspectByteEntropyInputSchema field. Empty and non-decimal tokens now return VALIDATION_ERROR naming the option. Omitted defaults, leading-zero decimal tokens and explicit --length=0 remain supported. A decimal block size that is not a power of two, such as 384, is still refused during argument validation, as on main.

Evidence and validation

Updated with upstream 9bea563e3 on 2026-11-02 (merge commit 77a6bf61c). Windows, Node 24.22.1, npm 11.19.1: npm run test:focused -- tests/boundary/cli/cliIntegerArguments.test.ts 71/71 passed; npm run check:fast and npm run docs:check passed. The upstream update includes 00c4f44a1, which repairs the old formatting/verifier failures. Earlier evidence below is historical; see the checks on the current head for hosted CI status.

Local environment: Windows 11 x64 (10.0.26200), Node 24.22.1, npm 11.19.1, head 40f40d199 on d3ab0faf5 (main, 2026-11-01).

  • npm run test:focused -- tests/boundary/cli/cliIntegerArguments.test.ts: 71/71 passed.
  • Same command with only src/cli/binaryDiagnosticsCommands.ts and src/cli/options.ts reset to d3ab0faf5: 12 failed / 59 passed. The defect still reproduces on current main.
  • Same command with those two files at the previous head 3af8e795d: 1 failed / 70 passed. The failing case is --block-size=384, which the copied bounds passed on to the service.
  • --offset runs every malformed spelling (empty, whitespace, newline, hexadecimal, binary, exponent, signed, fractional, unsafe, -0). --length and --block-size share the parser and run one representative token each.
  • rea inspect-byte-entropy --schema --format json: byte-identical to main.
  • Related suite (cliIntegerArguments, cliInputSchemaRequired, both referenceSourceSummary tests, binaryDiagnosticsMcp, analysisSummaryDetailMcp, markdownMissingSelectionWindow, localPathAdmissionCli, byteEntropy.test.ts, ByteEntropyService.test.ts): 156 passed, 4 skipped, 1 failed. The failure is ByteEntropyService.test.ts > reports a changed artifact when its parent directory moves during streaming. It fails the same way on clean main, because it renames a parent directory while a file is open, which Windows refuses ([Bug] Windows: five artifact tests fail because they rename a parent directory while its admitted file is open #7846).
  • npm run check:fast passed (typecheck and lint), as did npm run docs:check and npx oxfmt --check on the changed files.

Earlier hosted CI (before the 2026-11-02 upstream merge): Static checks, one test shard and Portable tests fail the same way on maintainer PRs opened on d3ab0faf5 (#8602, #8605). The causes are format:check on files on main, providerVerifierCleanup and javascriptRuntimeObservationMcp.

Remaining limits: local validation was on Windows with synthetic input.

Contract and boundary impact

The change is owned by CLI argument admission. cliDecimalField uses the canonical field's inner number schema and its default or optionality, so the CLI copies no limits. cliIntegerArgument is unchanged. MCP numeric inputs, provider behavior, dependencies and execution authority are unchanged. Ordinary correction within existing scope; no separate maintainer scope decision is required.

Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Prepared with AI assistance.

Author readiness

Human owner: @Plastic-time

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

Parse --offset, --length and --block-size as decimal tokens, so an empty --length= no longer becomes a zero-byte window and hex or exponent tokens no longer select a different window. The advertised option schema is unchanged.

Fixes morluto#7376
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-02T21:20:18.894281Z 77a6bf6 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@greptile-apps

greptile-apps Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: apex

[Low impact] The reviewed changes appear safe to merge; no actionable issue remains.

Summary

Makes inspect-byte-entropy reject non-decimal window options while keeping the shared numeric checks.

  • The byte-entropy command rejects option values that are not decimal digits.

Reviews (3) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." · Reviewed by Greptile

Comment thread src/cli/binaryDiagnosticsCommands.ts Resolved
Pipe each decimal byte-entropy token into its inspect_byte_entropy schema
field, so the CLI copies no block-size bounds or defaults and rejects a
non-power-of-two block size at argument validation. Keep one option on the
full malformed-spelling list and one representative case for the others.
@morluto morluto added area: cli CLI adapter and one-shot commands bug Something isn't working labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: cli CLI adapter and one-shot commands bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Byte-entropy CLI accepts empty and non-decimal window options

2 participants