Skip to content

fix(pdf): report incomplete long-document reads - #210

Merged
Willi8910 merged 2 commits into
boonfrom
williamlie/pdf-coverage-integrity
Sep 10, 2026
Merged

Willi8910 merged 2 commits into
boonfrom
williamlie/pdf-coverage-integrity

Conversation

@Willi8910

@Willi8910 Willi8910 commented Sep 9, 2026 •

Copy link
Copy Markdown

What Problem This Solves

Fixes an issue where users analyzing long PDFs could receive a confident whole-document answer after extraction stopped early at a page or text limit. In the reported shape, a 59-page construction set stopped around page 17 and later electrical/structural sheets could be described as absent.

Companion regression coverage: https://github.com/getboon/boon/pull/14642

Why This Change Was Made

Fallback PDF analysis now preserves extractor page-count/truncation metadata, reads within the configured page budget in bounded 10-page batches, recursively splits dense batches that hit the text ceiling, and synthesizes grounded chunk findings. Every fallback result reports processed pages; incomplete reads return details.status: partial, emit structured diagnostics, and explicitly prohibit document-wide absence claims.

The native-provider path is unchanged. This targets the extracted-content fallback used by Boon Agent.

User Impact

Users can see whether the PDF was read completely before trusting the findings. Common construction sets within the configured page budget are analyzed beyond the former first-chunk boundary, while genuinely incomplete reads are visibly labeled partial instead of appearing fully verified.

Release note: PDF fallback analysis now reports page coverage and warns when a long document was only partially read.

Evidence

  • 162 focused tests pass across document extraction, PDF fallback/map-reduce, tool-result propagation, audit trace, and the newly landed blocked-detail overlap tests.
  • A 59-page regression proves six bounded extraction batches, complete pages 1-59 coverage, and synthesis across late pages.
  • A dense-batch regression proves a text-limited 10-page chunk is retried as smaller chunks and reaches complete 12/12 coverage.
  • Partial 20/59 coverage is surfaced in user text and structured details, with the final prompt forbidding absence claims.
  • Targeted core and extension Oxlint lanes pass; formatting and docs formatting are clean.
  • Production core and extension TypeScript graphs passed locally. The repository's full test-only graphs were stopped after sustained high-CPU/no-output runs; CI remains the authoritative full type gate.

Summary by cubic

Fixes PDF fallback analysis so long documents are read in bounded 10-page batches instead of stopping at the first extraction limit. Incomplete reads now report page coverage and return details.status: partial, and the model is told not to claim omitted sheets are absent, so users no longer get a confident whole-document answer from a partial read.

Extraction

  • Batches that hit the text ceiling are split recursively and retried.
  • New coverage metadata preserves page counts, processed pages, text limits, and truncation reasons; it is optional for third-party extractors.
  • Results start with a line like "PDF coverage: processed pages 1-59 of 59" when coverage is available.
  • Native-provider PDF analysis is unchanged.

Status propagation

  • Adds partial as a tool outcome status in tool summaries, decision traces, and auto-reply payloads.
  • Partial results are classified as completed with medium confidence, not as errors, but are not counted as completed tool calls.
  • Incomplete reads log structured diagnostics with page and truncation details.

Written for commit 297c570. Summary will update on new commits.

Review in cubic

@Willi8910
Willi8910 requested a review from a team September 9, 2026 02:59
@claude

claude Bot commented Sep 9, 2026 •

Copy link
Copy Markdown

Claude encountered an error —— View job


I'll analyze this and get back to you.

@claude

claude Bot commented Sep 9, 2026

Copy link
Copy Markdown

Claude Code is working…

I'll analyze this and get back to you.

View job run

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 23 files

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread src/agents/tools/pdf-tool.ts Resolved
Comment thread src/agents/tool-failure-digest.ts Resolved

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 7 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread scripts/plugin-sdk-surface-report.mjs Resolved

@gandalfboon gandalfboon Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving.

Traces cleanly to the reported failure mode (59-page set stopping mid-document then getting confident whole-document answers). Fallback path now: bounded 10-page batches, recursive split on text_limit, per-chunk coverage accounting aggregated per file, status: "partial" propagated through toolMetas → decision-trace → reply payload → tool-failure-digest, and the model prompt is explicitly instructed not to claim document-wide absence. Native-provider path untouched, as the PR body states.

Type widening ("blocked" → "blocked" | "partial") is applied consistently across every consumer I checked (run.ts, normalize-tool-metas, handlers.tools, runtime-plan/types, reply-payload, agent-runner, agent-decision-trace, tool-failure-digest). coverage is optional on DocumentExtractionResult so third-party extractors keep working.

Regression coverage is real and hits the shapes that matter: complete 59-page read in 6 bounded batches, dense-batch text-limit split reaching 12/12, partial 20/59 with the no-absence-claim instruction, single-chunk partial path receiving the coverage instruction (the P1 fix in 297c570), partial excluded from completedToolCount (P2 fix), and recoveredEveryFailure refusing to fire when partialCalls > 0 (P2 fix). All 4 cubic threads resolved with regression tests. 162 focused tests reported passing, CI green, both commits signed.

SDK surface +2 is scoped and justified — the two exported types (DocumentExtractionCoverage, DocumentExtractionTruncationReason) are what external extractors need to type the new optional field.

No secrets in the diff (only the pre-existing PDF-decryption password request parameter). No backward-compat concerns. LGTM.

@Willi8910
Willi8910 merged commit 656ed09 into boon Sep 10, 2026
260 of 263 checks passed
@Willi8910
Willi8910 deleted the williamlie/pdf-coverage-integrity branch September 10, 2026 16:04
Willi8910 added a commit that referenced this pull request Sep 14, 2026
…218)

Carries #210 (PDF fallback partial-read reporting) and #217 / ENG-18097
(cron delivery targets the channel disowns are rejected at resolution
time). Lockstep regenerated via `pnpm release:prep` — 208 files.

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants