Skip to content

[ENG-21106] feat(boon-pdf-prep): prepare inbound PDFs, mark cut attachment text - #273

Merged
orswn merged 17 commits into
boonfrom
okka/eng-21106/pdf-prep-extension
Oct 10, 2026
Merged

orswn merged 17 commits into
boonfrom
okka/eng-21106/pdf-prep-extension

Conversation

@orswn

@orswn orswn commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

Related: ENG-21106

What Problem This Solves

Construction drawing and spec sets often have more than 1,000 pages, and one message can carry several of them. The pdf-index skill can now search page text and prepare big PDFs in a background queue. Preparation only starts when the agent first runs a pdf-index command. So the first targeted question about a big new file often finds an empty index, and the agent does not know how far preparation has got.

Why This Change Was Made

A new bundled plugin, boon-pdf-prep, starts preparation when the message arrives. On each turn it adds one short status line per attached PDF to the model input:

  • message_received: for each PDF attachment (a .pdf suffix or application/pdf, MIME parameters allowed), it spawns pdf-index enqueue <paths> with ignored stdio. The child is unref'd, and the plugin does not wait for it. pdf-index starts its own background worker.

  • before_prompt_build: for the media://inbound PDF refs in the prompt, it runs pdf-index status with a 1.5 s budget and returns appendContext, for example:

    [PDF preparation]
    - "plans.pdf" (sha256 <64 hex chars>): 1546 pages. Text search covers pages 1-400. The rest in about 57 s.
    Use: pdf-index search <sha256> --q="<keywords>". The result states its coverage.
    
  • The note goes to the model input only. It is not written to the session transcript.

  • A file that status does not know yet is enqueued.

  • A file that is not ready gets a line on every turn once its hash is known. Its Ready. line is shown once per session (the session id, else the session key). A run with no session identity gets it on every turn.

  • When pdf-index status reports saved findings for a file, its line ends with Earlier findings: <count> on pages <pages>. Run pdf-index recall <sha256> before you read these pages. The pages value keeps only digits, commas and hyphens. Older pdf-index versions report no findings.

  • When pdf-index status reports findings for a listed file, even a count of 0, PDF memory is available. The note then ends with one line that asks the agent to save its results:

    After you read pages for an answer, save the result once: pdf-index note <sha256> --pages=<N> --kind=<count|extraction|answer> --source=<text_layer|vision> --topic="<short topic>" --body="<result>".
    

    Without this line, the agent did not save findings: the save rule was only in the skill file, which the agent does not open. Older pdf-index versions and hosts without memory get no such line.

Cut attachment text is now marked. The gateway puts the extracted text of an attached file into the model input. That text is cut at files.maxChars (60,000 characters by default) with no marker. Inbound PDF extraction also stops at the page budget (agents.defaults.pdfMaxPages), and the coverage that the extractor reports was dropped. In tests on a 108-page spec, two models saw about the first 22% of the text and told the user that later sections did not exist.

  • When the text was cut by characters, or the PDF coverage reports a page or text limit, the file block now ends with one line, for example: [Incomplete text: it covers 120 of the 243 pages of this PDF. Read the other pages from the file before you say what the document contains or lacks.]
  • The line follows the block content: the untrusted-content end marker, or the images or no-text placeholder. The model reads it as a fact about the file, not as file content.
  • The line gives a page count only for a page cut on extracted text. After the image fallback or a cut at the extractor text limit, it says [Incomplete text: only part of this 243-page PDF was extracted. ...]
  • maxChars still bounds the file text itself. An image-only limit gives no line.
  • Both paths that render file blocks add it: inbound channel attachments (media-understanding/apply.ts) and OpenResponses input_file (gateway/openresponses-http.ts).

Boundaries:

  • The plugin does no PDF work itself. It calls the CLI with an argument list, never through a shell.
  • Every failure gives no note and no error: a missing binary, an older pdf-index without these commands, a timeout, a non-zero exit, or bad JSON. A spawn error has a listener, so a missing binary cannot crash the gateway.
  • before_prompt_build reads only media://inbound/ refs from the prompt, so a media line typed by a user cannot inject a flag or name an arbitrary local file. message_received uses the trusted attachment metadata. File names and failure reasons are cleaned of control characters, Unicode line and paragraph separators, brackets and quotes, and cut to 80 characters.
  • The plugin is enabled by default. A host with a plugins.allow list loads it only when the list holds boon-pdf-prep (config-activation-shared.ts, not-in-allowlist). The fleet allow list changes in a separate deployment repository.
  • Known limit: a turn that is retried within the same session does not repeat the line for a ready file. The model can still run pdf-index status.
  • Known limit: for a very large new file, the first status call can run before enqueue has hashed the file. That turn then gets no line. The next turn does. In the local tests below, the hash was known 0.5 to 0.7 s after receipt and the line was in the first turn.

User Impact

  • A targeted question about a big PDF finds more of the file already indexed, often all of it.
  • When attached text is cut, the model is told so, and it reads the rest instead of saying that a section does not exist.
  • The agent knows each file's coverage, so it can answer from the pages that are searched and name them.
  • No visible change in the chat UI. Hosts that do not allow-list the plugin are not affected.

Evidence

  • pnpm vitest run extensions/boon-pdf-prep src/plugins/bundled-plugin-metadata.test.ts src/plugins/contracts/boundary-invariants.test.ts: Test Files 4 passed (4), Tests 122 passed (122).

  • Plugin contract and runtime-dependency tests: 479 passed.

  • Cut-text line: pnpm vitest run src/media/input-files.text-notice.test.ts src/media/input-files.fetch-guard.test.ts src/media-understanding/apply.test.ts src/gateway/openresponses-http.server.file-only.test.ts src/gateway/openresponses-http.test.ts extensions/boon-pdf-prep: Test Files 8 passed (8), Tests 222 passed (222). The new input-files and rendering tests failed before the change.

  • pnpm tsgo:core and pnpm tsgo:core:test: exit 0. Changed-file oxlint and oxfmt --check: clean. format:docs:check, lint:docs, docs:check-mdx, docs:check-links: pass.

  • pnpm tsgo, pnpm tsgo:extensions and pnpm tsgo:extensions:test: exit 0.

  • Extension oxlint and oxfmt --check: clean. docs:check-mdx and docs:check-links: pass.

  • docs:check-i18n-glossary against the PR base: pass. The new page title has a zh-CN glossary entry.

  • Not part of this change, fails on the base branch too: pnpm config:docs:check (baseline hash drift), and docs:check-i18n-glossary against origin/main (9 labels from earlier fork commits).

  • CI: 118 checks pass. security-fast fails on this PR and on other open PRs into boon ([ENG-20801] fix(agents): sub-agent resumed twice after a gateway restart #269 to [ENG-16829] fix(auto-reply): shell commands keep running after /stop #272): pnpm audit reports high advisories in existing production dependencies (simple-git, proxy-addr). The plugin has no runtime dependencies.

  • Local agent smoke with real model calls: see the tables below.

Local agent smoke. A local agent with the web chat, a local Boon Core, and the matching pdf-index skill change. Model calls were real.

Scenario Result
New 1,547-page PDF, value on one page enqueue 0.3 s after receipt. Hash known 0.54 s after receipt. The line (Queued.) was in the first turn. Index ready 15.7 s after enqueue. The agent searched, waited once and answered the right page. Reply 33.1 s
New 1,543-page PDF The line was in the first turn. Hash known 0.69 s after receipt. Correct answer in 33.6 s
243-page PDF, targeted question enqueue 0.9 s after send. Answer from search in the turn. 11 to 27 s
Ready 32-page PDF with a saved finding, two new conversations, one process Both got Ready. Earlier findings: 1 on pages 32. Run pdf-index recall .... The agent ran recall first and answered in 15.7 s and 23.6 s
The same, before this per-session line and the findings part The second conversation got no line. The agent read the page again for 3 to 4 min. One answer was wrong
Hook cost 0.08 to 0.22 s per call. No plugin error lines in the gateway log

Cut-text line, agent level. The same stack, agent model Opus 4.8, one run each. The file is a public 108-page electrical specification with 256,818 characters of text, so the attached text is cut at 60,000.

Scenario Result
Does the spec have a panelboard section, and what surge rating does it require? The file block ended with [Incomplete text: it stops after 60000 of 200000 extracted characters, part-way through this 108-page PDF. ...]. The section is past the cut. The agent did not say it was missing: pdf-index search, then page-text on 5 pages. Correct section and rating, 29.0 s. A second new thread: the same tools and answer, 26.1 s
Follow-up: which section covers PVC coated conduit, and its warranty? search, then 2 pages. Correct, 24.5 s
Before this change, in separate runs on the same file Two models said that later sections did not exist. One said the spec held only 3 sections

Real files, final heads. The same stack with the final heads of all companion PRs. The files are real PDFs: a 243-page permit drawing set, two smaller drawing sets, and 1,071-page and 796-page text books for size.

Scenario Result
New 1,071-page file, question on a page past 900, slow build The line (Queued.) was in the user turn 1.34 s after send. partial_no_match at 100/1071, one status --wait, correct page, 71.7 s
1,071-page and 796-page files in one message One line per file. Correct page in the smaller file, 33.1 s
243-page set, new thread, visual symbol count The note had the save line. The agent saved one count finding before it answered
243-page set, another new thread, schedule location The line had Earlier findings: 2 on pages 6,196. The agent ran recall first at +4.7 s and answered with no page read, 21.5 s
The same count before the save line No finding saved. A second thread repeated the 2.7 min count

Construction drawing and spec sets often have more than 1,000 pages,
and a message can carry several of them. The pdf-index skill now has a
page-text search with a background preparation queue. The queue only
starts when the agent first runs a pdf-index command, so the first
question about a big new file often finds an index that is still
empty.

Add the bundled plugin boon-pdf-prep:

- message_received: for each PDF attachment (a .pdf suffix or
  application/pdf), spawn `pdf-index enqueue <paths>` detached, with
  ignored stdio, and do not wait for it. A spawn error is swallowed, so
  a host without pdf-index is not affected.
- before_prompt_build: for the media://inbound PDF refs in the prompt,
  run `pdf-index status` with a 1.5 s budget and add one short line per
  file to the model input through appendContext, for example
  `"plans.pdf" (sha256 <hex>): 1546 pages. Text search covers pages
  1-400. The rest in about 57 s.` The note does not go into the
  session transcript. Files that the status call does not know yet are
  enqueued. A ready file is noted once per gateway process.
- Every failure (a missing binary, an old pdf-index, a timeout, bad
  JSON) gives no note and no error. The turn goes on as before.

File names in the note are cleaned of control characters and cut to 80
characters. Only media://inbound refs and absolute paths are passed to
pdf-index, so a media line typed by a user cannot inject a flag.

The plugin is enabled by default but loads only where plugins.allow
lists it; the paid fleet adds it to the allow list in a separate
change.
@orswn
orswn requested a review from a team October 8, 2026 19:38
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown

Dependency Guard

This PR changes dependency-related files. Maintainers should confirm these changes are intentional.

Changed files:

  • extensions/boon-pdf-prep/package.json
  • pnpm-lock.yaml

Maintainer follow-up:

  • Review whether the dependency changes are intentional.
  • Inspect resolved package deltas when lockfile, shrinkwrap, or workspace dependency policy changes are present.
  • Treat package-lock.json and npm-shrinkwrap.json diffs as security-review surfaces.
  • Run pnpm deps:changes:report -- --base-ref origin/main --markdown /tmp/dependency-changes.md --json /tmp/dependency-changes.json locally for detailed release-style evidence.

@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Dependency graph changes noted

This PR includes dependency graph changes. The dependency guard is informational because the PR author is a repository admin or a member of @openclaw/openclaw-secops.

  • Current SHA: 53f230b8934a999f2672f5ae60dcb606b6fe6093
  • Trusted actor: @orswn
  • Trusted role: pull request author; repository admin

Security review is still recommended before merge when the dependency graph change is intentional.

@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 13 files

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

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread extensions/boon-pdf-prep/src/note.ts Resolved
Comment thread docs/gateway/boon-pdf-prep.md Resolved
Comment thread docs/gateway/boon-pdf-prep.md Resolved
Comment thread docs/gateway/boon-pdf-prep.md Resolved
@orswn

orswn commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator Author

/cr

…naged refs only

A file shown as queued or text on an earlier turn never got its
"Ready." line, because the seen set recorded every hash on first sight.
Track only the hashes whose ready line was shown.

before_prompt_build now reads only media://inbound refs from the
prompt. An absolute path in a media line can come from user text.
message_received still enqueues every PDF from the trusted attachment
metadata.

Docs: the status check can delay the model call by at most 1.5 s, and
enqueue receives the inbound paths.
@orswn

orswn commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 9, 2026

Copy link
Copy Markdown

@cubic-dev-ai review

@orswn I have started the AI code review. It will take a few minutes to complete.

@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 13 files

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

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread docs/gateway/boon-pdf-prep.md Resolved
Comment thread extensions/boon-pdf-prep/src/note.ts Resolved
Comment thread extensions/boon-pdf-prep/src/note.ts Resolved
A media line can carry MIME parameters, for example
"application/pdf; charset=binary". The parser took the whole text as
the ref and missed the PDF. It now accepts the parameters and compares
the type before ";", case-insensitive.

The enqueue child is not detached and has no timeout, so its handle
kept the gateway event loop alive. Call unref() after the spawn.

A text-state status with no page count now still gives the coverage
sentence and the ETA instead of "Queued.".
@orswn

orswn commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 9, 2026

Copy link
Copy Markdown

@cubic-dev-ai review

@orswn I have started the AI code review. It will take a few minutes to complete.

@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.

No issues found across 13 files

View guided diff | Turn on auto-fix | Re-trigger cubic

…ings

The ready line for a PDF was shown once per gateway process. Every
later conversation that got the same file had no line for it, so the
model had no hash and no hint to use pdf-index. The line is now shown
once per session (sessionId, else sessionKey), and on every turn when
the run has no session identity.

pdf-index status can now report saved findings for a file. When it
does, the line adds the finding count and pages and tells the model to
run pdf-index recall before it reads those pages. The pages value is
cleaned to digits, commas and hyphens.

@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 5 files (changes from recent commits).

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

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread docs/gateway/boon-pdf-prep.md Resolved
The findings part of the ready line has no page list when status gives
no usable pages value. Say so in the plugin page.
@orswn

orswn commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 9, 2026

Copy link
Copy Markdown

@cubic-dev-ai review

@orswn I have started the AI code review. It will take a few minutes to complete.

@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 13 files

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

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread extensions/boon-pdf-prep/src/note.ts Resolved
A file name or failure reason with U+2028, U+2029 or U+0085 passed
the cleaner and split the PDF preparation note into extra lines. The
cleaner now removes all Unicode line and paragraph separators too.
@orswn

orswn commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 9, 2026

Copy link
Copy Markdown

@cubic-dev-ai review

@orswn I have started the AI code review. It will take a few minutes to complete.

@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 13 files

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

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread extensions/boon-pdf-prep/src/note.ts Resolved
The agent never saved its page findings, because the save rule is only
in the pdf-index skill file, which the agent does not open. A new
thread then repeated the same visual count.

When pdf-index status reports findings for a listed PDF, memory is
available, so the note now ends with one line that asks the agent to
save each result with pdf-index note. Older pdf-index versions and
hosts without memory get no such line.
@orswn

orswn commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 9, 2026

Copy link
Copy Markdown

@cubic-dev-ai review

@orswn I have started the AI code review. It will take a few minutes to complete.

@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 13 files

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

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread docs/gateway/boon-pdf-prep.md Resolved
Comment thread extensions/boon-pdf-prep/src/note.ts Resolved
A count read from page tiles was saved with the default text_layer
source, because the save line did not name --source. List text_layer
and vision in the line.
@cubic-dev-ai

cubic-dev-ai Bot commented Oct 9, 2026

Copy link
Copy Markdown

@cubic-dev-ai review

@orswn I have started the AI code review. It will take a few minutes to complete.

@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.

No issues found across 14 files

View guided diff | Turn on auto-fix | Re-trigger cubic

Attached file text is cut at files.maxChars (60,000 characters by
default) with no marker, and inbound PDF extraction stops at the
configured page budget. The extractor reports the pages it covered,
but that coverage was dropped. The model then saw a cut-off document
as the whole file, and told users that sections after the cut did not
exist.

Add an "[Incomplete text: ...]" line to the file block when the text
was cut by characters, or when PDF coverage reports a page or text
limit. The line gives the shown and total characters or pages and
asks the model to read the rest from the file before it says what the
document contains or lacks. It follows the untrusted-content end
marker, so the model reads it as a fact about the file and not as
file content. maxChars still bounds the file text itself.
@orswn orswn changed the title [ENG-21106] feat(boon-pdf-prep): prepare inbound PDFs before the agent asks [ENG-21106] feat(boon-pdf-prep): prepare inbound PDFs, mark cut attachment text Oct 9, 2026
@orswn

orswn commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 9, 2026

Copy link
Copy Markdown

@cubic-dev-ai review

@orswn I have started the AI code review. It will take a few minutes to complete.

@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 22 files

You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread src/gateway/openresponses-http.ts Resolved
Comment thread src/media/input-files.ts Resolved
Comment thread src/media-understanding/apply.ts Resolved
The notice was added only after non-empty file text. A page-cut PDF
that fell back to page images, or that had no text, got only the
placeholder, so the model was not told that pages were missing.

Add the notice after whatever the file block holds: the wrapped text,
the images placeholder, or the no-text placeholder, in both the
inbound attachment and the OpenResponses paths.

In the low-text fallback the extractor counts rendered image pages as
processed pages, so "covers N of M pages" overstated the text. When
the extractor returned images, the notice now says only that part of
the PDF was extracted.
@orswn

orswn commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 9, 2026

Copy link
Copy Markdown

@cubic-dev-ai review

@orswn I have started the AI code review. It will take a few minutes to complete.

@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 22 files

You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread src/media/input-files.ts Resolved
Comment thread src/media/input-files.ts Resolved
The extractor text limit can stop inside a page after every page was
visited. The notice then said "covers 108 of the 108 pages" and asked
the model to read other pages that do not exist.

Use the page count only for a page cut on extracted text. A text-limit
cut, like the image fallback, now says that only part of the PDF was
extracted.
@orswn

orswn commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 9, 2026

Copy link
Copy Markdown

@cubic-dev-ai review

@orswn I have started the AI code review. It will take a few minutes to complete.

@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 22 files

You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.

View guided diff | Turn on auto-fix | Re-trigger cubic

The default coverage fixture had no requested pages, and the no-notice
cases reused a page-cut coverage with its reasons removed. The
extractor never reports either shape. Request the processed pages in
the default, and use complete all-page coverage in the no-notice
cases.
@orswn

orswn commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 9, 2026

Copy link
Copy Markdown

@cubic-dev-ai review

@orswn I have started the AI code review. It will take a few minutes to complete.

@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.

No issues found across 22 files

You've manually re-run cubic several times on this PR. Each manual re-review checks the full PR again and counts toward your usage quota. To preserve your usage limits, we recommend letting cubic automatically review new commits.

View guided diff | Turn on auto-fix | Re-trigger cubic

…g PDFs

Asked to review a whole 32-page drawing set, the agent read four pages
and the attached file text, which stops part-way, then said it had
reviewed all 32 pages. The fan-out rule was only in the system prompt.
In the same runs the agent did fan out when tool output next to the
turn told it to.

When a listed PDF that has not failed has more than 20 pages, add one
line to the preparation note: split a whole-file read, summary or
review into 10-20 page ranges with one sub-agent each, and attached
file text is not a read of the file.

@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 3 files (changes from recent commits).

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

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread extensions/boon-pdf-prep/src/note.ts Resolved
orswn added 2 commits October 9, 2026 22:52
A sub-agent run allows five active children by default, and
sessions_yield ends the turn. A PDF over 100 pages needs more than
five 10-20 page ranges, so the line could lead to a rejected sixth
spawn or a yield before every range was started.

Tell the agent to spawn at most five, call sessions_yield last, and
spawn the rest after the results arrive.
The line asked the agent to split a whole-file read of a PDF over 20
pages across sub-agents. In a local run on a 32-page drawing set, with
the line in the note, the agent still read a few pages and the
attachment text and did not fan out, the same as without it. A prompt
line with no measured effect adds about 55 tokens to every turn that
lists a big PDF.

This reverts commits 2311280 and ba79bde.

@boon-hermes-bot boon-hermes-bot 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.

✅ Approved

Prepares inbound PDFs in the background via pdf-index and marks cut attachment text with clear out-of-band notices.

Strengths

  • Clean non-blocking enqueue lifecycle (unref(), stdio: ignore) on message_received and strict 1.5s timeout with SIGKILL on before_prompt_build.
  • Robust injection protection: command execution uses direct argv arrays (spawn/execFile, no shell interpolation); prompt refs are restricted to media://inbound/; filenames, failure reasons, and page numbers are strictly sanitized and length-capped.
  • Safe failure behavior: missing pdf-index, slow execution, or legacy CLI versions cleanly fall back to no injected note without crashing the gateway or failing the turn.
  • Accurate incomplete-text notices: distinguishes character cutoffs from PDF page/text extraction coverage limits, positioned after untrusted content wrappers so models treat them as system metadata.
  • Per-session deduplication: Ready. status is noted once per session ID/key (bounded LRU 1,000 entries), avoiding prompt bloat.

Technical Review

  • ✅ Execution & Process Management: Subprocess spawning is non-blocking with proper error handling and process cleanup on timeout.
  • ✅ Security & Prompt Safety: Strict sanitization regexes prevent prompt injection and shell escape risks.
  • ✅ Attachment Handling: buildTextNotice correctly computes text and coverage limits for both plain text and PDF files.
  • ✅ Test Coverage: All unit and contract tests pass (extensions/boon-pdf-prep, input-files.text-notice, apply, openresponses-http).

Verification Evidence

  • Tests: extensions/boon-pdf-prep (72 tests across 2 files), src/media/input-files.text-notice.test.ts (12 tests), src/media-understanding/apply.test.ts (56 tests), src/gateway/openresponses-http.server.file-only.test.ts (8 tests) all pass.
  • Types & Lints: pnpm tsgo:core and pnpm tsgo:extensions exit 0; oxlint and oxfmt --check pass clean.
  • All 22 prior bot review threads are resolved.

PR is solid and ready to merge.

@ikhsanuddin ikhsanuddin 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.

LGTM

…ep-extension

boon moved to 2026.6.34-boon.4 (#274), which bumped every plugin
manifest. The new boon-pdf-prep manifest still said boon.3, so the
release preflight would fail on the next version bump:
plugins:sync:check reported "update required: @openclaw/boon-pdf-prep".

Align it with pnpm plugins:sync. Regenerate the plugin inventory, the
plugin reference page and the config baseline, which the new plugin
changes and which plugins:inventory:check and config:docs:check
reported as stale. The baseline also picks up
tools.web.fetch.ssrfPolicy.allowedHostnames from #270, which boon did
not regenerate.

The remaining preflight drift is the npm shrinkwrap check on the
@opentelemetry packages under @sentry/node. It is the same on boon.
@orswn
orswn merged commit 8d5b5d4 into boon Oct 10, 2026
142 of 143 checks passed
@orswn
orswn deleted the okka/eng-21106/pdf-prep-extension branch October 10, 2026 04:18
orswn added a commit that referenced this pull request Oct 10, 2026
…-> 2026.6.34-boon.5 (#277)

Cut the fork release that ships the two commits on boon since
v2026.6.34-boon.4. The bundled boon-pdf-prep plugin queues inbound
PDFs for background text preparation and adds a short preparation note
to the model input, and cut attachment text now says where it stops
(#273, ENG-21106). A sub-agent stopped by /stop stays killed, and
stopping a service-mode exec shell on Linux also signals its
descendants (#276, ENG-16829).

Bump root package.json and npm-shrinkwrap.json, all 136 plugin
manifests, and the version and openclaw peer floor in every extension
npm-shrinkwrap.json. Add the 2026.6.34-boon.5 CHANGELOG.md section and
the generated extensions/matrix/CHANGELOG.md entry. No dependency
changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants