You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve.
Summary
Keep open. Current main still builds the PDF tool during the core tool-prep hot path, and the reported release has identical code, so the per-request stall is plausible; the exact 10-12s root cause still needs live validation because current source only imports pdfjs-dist during actual PDF extraction.
Reproducibility: unclear. there is not yet a high-confidence live reproduction of the reported 10-12s WeCom/Linux arm64 stall. Source inspection does show the PDF tool is rebuilt on the request hot path and performs immediate model/auth resolution, so the performance bug is source-reproducible enough to keep open.
Next step
This is a focused performance repair candidate, but not an automatic high-confidence bugfix because the live 10-12s stall was not reproduced in the review environment.
Review details
Best possible solution:
Make PDF tool registration cheap on every agent turn by caching scoped availability/model/auth resolution or deferring expensive discovery, while keeping pdfjs-dist and canvas loading confined to actual PDF execution.
Do we have a high-confidence way to reproduce the issue?
Unclear: there is not yet a high-confidence live reproduction of the reported 10-12s WeCom/Linux arm64 stall. Source inspection does show the PDF tool is rebuilt on the request hot path and performs immediate model/auth resolution, so the performance bug is source-reproducible enough to keep open.
Is this the best way to solve the issue?
Unclear: adding a video-style async PDF completion mode or new config knob is not the narrowest first fix. The better first solution is to make PDF tool prep lazy/cached without changing PDF execution semantics.
Acceptance criteria:
pnpm test src/agents/openclaw-tools.pdf-registration.test.ts src/agents/tools/pdf-tool.model-config.test.ts src/agents/tools/pdf-tool.test.ts src/media/document-extractors.runtime.test.ts src/plugins/document-extractors.runtime.test.ts
pnpm check:changed in Testbox before handoff if production code changes
What I checked:
PDF tool is built on the agent-turn tool-prep path:createOpenClawTools calls createPdfTool(...) before marking openclaw-tools:pdf-tool, so that trace stage includes synchronous PDF tool construction on each tool build. (src/agents/openclaw-tools.ts:408, a92e2b13b8b8)
PDF tool construction performs model resolution immediately:createPdfTool calls resolvePdfModelConfigForTool before returning a tool object, so availability/model probing is on the hot path even when no PDF is used. (src/agents/tools/pdf-tool.ts:262, a92e2b13b8b8)
PDF model resolution probes provider/auth candidates: The resolver checks Google/default-provider auth and enumerates native/generic image candidates, which is the likely source area for repeated request-time cost. (src/agents/tools/pdf-tool.model-config.ts:76, a92e2b13b8b8)
Document extraction dependency load is deferred to extraction: The document-extract plugin caches pdfjs-dist behind loadPdfJsModule() and calls it from extractPdfContent, which is reached during actual PDF extraction rather than PDF tool registration. (extensions/document-extract/document-extractor.ts:67, a92e2b13b8b8)
Reported release and current main match on the relevant files: The relevant PDF tool/document-extract blobs are identical between v2026.5.2 and current HEAD, and git diff v2026.5.2..HEAD is empty for those paths. (8b2a6e57fef6)
Liveness warning threshold is consistent with the report: Diagnostics classify event_loop_delay when p99 or max event-loop delay reaches the configured 1000ms threshold; the reporter's 10-13s samples exceed that threshold substantially. (src/logging/diagnostic.ts:58, a92e2b13b8b8)
Likely related people:
buyitsydney: Current-main blame for the PDF tool registration, createPdfTool, PDF model resolver, and document-extractor runtime points to commit 2ffdb5d248, which adds the relevant files in this checkout. (role: current-main path owner; confidence: medium; commits: 2ffdb5d248a1; files: src/agents/openclaw-tools.ts, src/agents/tools/pdf-tool.ts, src/agents/tools/pdf-tool.model-config.ts)
Peter Steinberger: The reported v2026.5.2 tag is commit 8b2a6e57fe, authored by Peter Steinberger, and that tag first ships identical blobs for the relevant PDF/document-extract paths in this checkout. (role: release introducer/maintainer; confidence: medium; commits: 8b2a6e57fef6; files: src/agents/openclaw-tools.ts, src/agents/tools/pdf-tool.ts, src/agents/tools/pdf-tool.model-config.ts)
Remaining risk / open question:
No live WeCom/Linux arm64/Node 24 reproduction was run, so the reported 10-12s latency remains reporter-observed rather than locally measured.
The report attributes the stall to document-extract/pdfjs-dist, but source inspection shows pdfjs-dist is loaded only during actual PDF extraction; a fix should measure the expensive prep-time call before changing plugin APIs.
Codex review notes: model gpt-5.5, reasoning high; reviewed against a92e2b13b8b8.
@steipete Is this issue intended to be solved by #73039, or would you accept a narrower PDF-only PR that avoids repeated PDF model/auth resolution during createOpenClawTools?
Activity
clawsweeper commentedon May 3, 2026
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve.
Summary
Keep open. Current main still builds the PDF tool during the core tool-prep hot path, and the reported release has identical code, so the per-request stall is plausible; the exact 10-12s root cause still needs live validation because current source only imports
pdfjs-distduring actual PDF extraction.Reproducibility: unclear. there is not yet a high-confidence live reproduction of the reported 10-12s WeCom/Linux arm64 stall. Source inspection does show the PDF tool is rebuilt on the request hot path and performs immediate model/auth resolution, so the performance bug is source-reproducible enough to keep open.
Next step
This is a focused performance repair candidate, but not an automatic high-confidence bugfix because the live 10-12s stall was not reproduced in the review environment.
Review details
Best possible solution:
Make PDF tool registration cheap on every agent turn by caching scoped availability/model/auth resolution or deferring expensive discovery, while keeping
pdfjs-distand canvas loading confined to actual PDF execution.Do we have a high-confidence way to reproduce the issue?
Unclear: there is not yet a high-confidence live reproduction of the reported 10-12s WeCom/Linux arm64 stall. Source inspection does show the PDF tool is rebuilt on the request hot path and performs immediate model/auth resolution, so the performance bug is source-reproducible enough to keep open.
Is this the best way to solve the issue?
Unclear: adding a video-style async PDF completion mode or new config knob is not the narrowest first fix. The better first solution is to make PDF tool prep lazy/cached without changing PDF execution semantics.
Acceptance criteria:
What I checked:
createOpenClawToolscallscreatePdfTool(...)before markingopenclaw-tools:pdf-tool, so that trace stage includes synchronous PDF tool construction on each tool build. (src/agents/openclaw-tools.ts:408, a92e2b13b8b8)createPdfToolcallsresolvePdfModelConfigForToolbefore returning a tool object, so availability/model probing is on the hot path even when no PDF is used. (src/agents/tools/pdf-tool.ts:262, a92e2b13b8b8)src/agents/tools/pdf-tool.model-config.ts:76, a92e2b13b8b8)document-extractplugin cachespdfjs-distbehindloadPdfJsModule()and calls it fromextractPdfContent, which is reached during actual PDF extraction rather than PDF tool registration. (extensions/document-extract/document-extractor.ts:67, a92e2b13b8b8)v2026.5.2and currentHEAD, andgit diff v2026.5.2..HEADis empty for those paths. (8b2a6e57fef6)event_loop_delaywhen p99 or max event-loop delay reaches the configured 1000ms threshold; the reporter's 10-13s samples exceed that threshold substantially. (src/logging/diagnostic.ts:58, a92e2b13b8b8)Likely related people:
createPdfTool, PDF model resolver, and document-extractor runtime points to commit2ffdb5d248, which adds the relevant files in this checkout. (role: current-main path owner; confidence: medium; commits: 2ffdb5d248a1; files:src/agents/openclaw-tools.ts,src/agents/tools/pdf-tool.ts,src/agents/tools/pdf-tool.model-config.ts)v2026.5.2tag is commit8b2a6e57fe, authored by Peter Steinberger, and that tag first ships identical blobs for the relevant PDF/document-extract paths in this checkout. (role: release introducer/maintainer; confidence: medium; commits: 8b2a6e57fef6; files:src/agents/openclaw-tools.ts,src/agents/tools/pdf-tool.ts,src/agents/tools/pdf-tool.model-config.ts)Remaining risk / open question:
document-extract/pdfjs-dist, but source inspection showspdfjs-distis loaded only during actual PDF extraction; a fix should measure the expensive prep-time call before changing plugin APIs.Codex review notes: model gpt-5.5, reasoning high; reviewed against a92e2b13b8b8.
mkdev5 commentedon May 3, 2026
@steipete Is this issue intended to be solved by #73039, or would you accept a narrower PDF-only PR that avoids repeated PDF model/auth resolution during createOpenClawTools?
fix(pdf-tool): defer PDF model resolution (#76728)
fix(pdf-tool): defer PDF model resolution (openclaw#76728)
fix(pdf-tool): defer PDF model resolution (openclaw#76728)
fix(pdf-tool): defer PDF model resolution (openclaw#76728)
fix(pdf-tool): defer PDF model resolution (openclaw#76728)