fix(pdf): reject fractional page selections#99399
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 6, 2026, 1:37 AM ET / 05:37 UTC. Summary PR surface: Source +2, Tests +38. Total +40 across 4 files. Reproducibility: yes. Source-level reproduction is high confidence: current main parses fractional single-page tokens with Review metrics: 2 noteworthy metrics.
Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review detailsBest possible solution: Land exactly one parser-boundary integer-validation fix with helper and tool-boundary coverage, then close the linked issue and duplicate unmerged PRs. Do we have a high-confidence way to reproduce the issue? Yes. Source-level reproduction is high confidence: current main parses fractional single-page tokens with Is this the best way to solve the issue? Yes. The parser boundary is the best fix layer because it is the shared conversion point for the public AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 89f911f322c9. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +2, Tests +38. Total +40 across 4 files. View PR surface stats
Acceptance criteria:
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (3 earlier review cycles) |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
45c2b60 to
6ef2bbe
Compare
|
Maintainer review and fixup are complete on What changed:
Contract review:
Exact-head proof:
Broad CI run https://github.com/openclaw/openclaw/actions/runs/28768542718 has no PDF-related failure. Its failures are outside this diff: missing UI sidebar exports on the base (subsequently restored on main by Proof gap: no provider API call was made because invalid page input must terminate before provider selection. The exact runtime smoke proves that contract. |
6ef2bbe to
a19643b
Compare
a19643b to
f3233b1
Compare
|
Merged via squash.
|
* fix(pdf): reject fractional page selections * chore: refresh pdf fractional page checks * chore: refresh failed checkout checks * test(pdf): prove fractional pages fail at tool boundary * test(pdf): cover mixed fractional page ranges * fix(pdf): validate page selections before loading --------- Co-authored-by: Peter Steinberger <[email protected]>
* fix(pdf): reject fractional page selections * chore: refresh pdf fractional page checks * chore: refresh failed checkout checks * test(pdf): prove fractional pages fail at tool boundary * test(pdf): cover mixed fractional page ranges * fix(pdf): validate page selections before loading --------- Co-authored-by: Peter Steinberger <[email protected]>
Closes #99393
What Problem This Solves
Fixes an issue where users who pass fractional PDF
pagesvalues, such as1.5, could have the PDF tool accept the input even though downstream extraction only keeps integer page numbers. In fallback extraction mode that can leave the request with no selected PDF page content instead of a clear input error.Why This Change Was Made
The PDF tool parser is the source-of-truth boundary for converting user
pagestext into page numbers. This change makes single-page tokens match the same positive-integer contract already used by range tokens, so fractional values fail fast as invalid page numbers before any provider or extractor path sees them.User Impact
Users now get an actionable
Invalid page numbererror for fractional PDF page selections. Valid integer pages, ranges, sorting, deduping, max-page clamping, and the existing empty-selection error remain unchanged.Evidence
Current prepared head:
f3233b1c22b95fe4901ef2419e614cf108060549(rebased onto89f911f322c90c3e7e3ec51120686256de19b4b1).parsePageRange("1.5", 20)accepted the fractional token as[1.5], andparsePageRange("1,1.5", 20)accepted[1,1.5].parsePageRange("1.5", 20)andparsePageRange("1,2.5", 20)reject withInvalid page number.createPdfTool().execute(...)rejectspages: "1.5"andpages: "1,2.5"before media loading, extraction, or model completion. A separate exact-head runtime smoke uses a nonexistent PDF and no configured model yet still returnsInvalid page number: "1.5", proving parser validation runs before file/network I/O and model resolution.cbx_864980d2079con reviewed pre-rebase head6ef2bbecb1e64800de50851f28a60cfd56feafda, public networking/no Tailscale/no instance profile. The later native sync only rebased the same four-file patch.pnpm test src/agents/tools/pdf-tool.helpers.test.ts src/agents/tools/pdf-tool.test.ts: passed, 2 files / 51 tests (run).oxfmt --checkandgit diff --check: passed.OPENCLAW_TESTBOX=1 scripts/pr prepare-run 99399recordedgates_mode=hosted_exact_headforf3233b1c22b95fe4901ef2419e614cf108060549.pagesinput is rejected before fallback extraction or model completion.