Repository navigation
feat(pdf): add explicit OpenAI native document opt-in - #127770
shannon0430 wants to merge 87 commits into
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
ec19d4b to
6544389
Compare
|
Codex review: blocked before merge. What this changesAdds a default-off setting and optional provider hook for sending eligible complete PDFs to the OpenAI Responses API. Example: Analyze a complete two-page report.pdf with openai/gpt-4.1-mini and pdfNativeOpenai enabled.
Review scores
ProductKind: Feature · Worth it: Needs a maintainer decision · Fix scope: Complete Merge readiness⛔ Blocked before merge - 1 item remains Keep this PR open: it provides a distinct capability absent from current main, has substantive maintainer engagement, and awaits product adoption and current-head CI approval. Reviewed head: Decision needed
Before merge
FindingsNone. Agent review detailsHow this fits togetherThe PDF tool loads permitted documents, resolves the selected model and credentials, checks extraction completeness, and dispatches either native document input or extracted content before returning analysis text. flowchart TD
A[PDF tool invocation] --> B[Document access and loading]
B --> C[Model and credential resolution]
C --> D[Opt-in and completeness checks]
D --> E[OpenAI provider hook]
D --> F[Existing extraction completion]
E --> G[Analysis result]
F --> G
Technical reviewBest possible solution: Have the feature owner settle the default-off configuration and additive SDK contract, then complete the approved current-head CI gate. Do we have a high-confidence way to reproduce the issue? This is a missing capability rather than a demonstrated broken contract: current main intentionally uses extraction for OpenAI PDF analysis. Is this the best way to solve the issue? The proposal extends existing PDF and media-provider owners without changing model ordering, but adoption of a vendor-specific core setting remains a product decision. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 153168fd09e4. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +226, Tests +672, Docs +13, Generated 0, Other +5. Total +916 across 21 files. Added test files: 4. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes: No label changes. Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (33 earlier review cycles; latest 8 shown)
Reviewed November 29, 2026, 8:35 AM ET / 13:35 UTC (Revision 34). |
|
@openclaw-mantis Prove this PR's fix through the real Telegram flow. The claim: the built-in Suggested proof shape:
If the mock provider transport does not qualify as |
|
Automated Shannon blocked-handoff checkpoint:
The Shannon cron's perfect condition is: no author-side item remains merely detected and unhandled. When the next action is low-risk, the cron performs it. When the next action is an unattended branch rewrite, code push, merge, close, autofix, or security-boundary decision, the cron does not perform that mutation silently; it creates this durable handoff instead. This historical checkpoint did not modify source code or repository state. Follow-up is tracked in this pull request. |
… head The Telegram Desktop proof previously built the candidate from the raw PR head, so a head behind main failed for reasons main already fixed (observed on #127770: 59 commits behind, hitting the Unknown-model defect fixed by #127952). GitHub's cached PR test merge cannot be the candidate either: it was observed 50 commits / 12 hours stale and never refreshed. The workflow now resolves the live refs/heads/main tip and merge base at dispatch, requires a main-targeting PR, and builds a deterministic local merge (merge-tree --merge-base + commit-tree with pinned identity/date) as the candidate; conflicts fail with a direct rebase message and there is no fallback to the raw head. Lane labels and docs now say the candidate is the PR merged onto main.
Mantis Telegram Desktop ProofSummary: Mantis captured native Telegram Desktop before/after GIF evidence for a Telegram PDF attachment followed by a Code Mode pdf(...) tool call. Baseline completed through the extraction fallback; candidate sent a native OpenAI Responses input_file request but the pdf tool failed with a malformed JSON response before returning content.
Motion-trimmed clips: |
… head (#127961) The Telegram Desktop proof previously built the candidate from the raw PR head, so a head behind main failed for reasons main already fixed (observed on #127770: 59 commits behind, hitting the Unknown-model defect fixed by #127952). GitHub's cached PR test merge cannot be the candidate either: it was observed 50 commits / 12 hours stale and never refreshed. The workflow now resolves the live refs/heads/main tip and merge base at dispatch, requires a main-targeting PR, and builds a deterministic local merge (merge-tree --merge-base + commit-tree with pinned identity/date) as the candidate; conflicts fail with a direct rebase message and there is no fallback to the raw head. Lane labels and docs now say the candidate is the PR merged onto main.
… head (openclaw#127961) The Telegram Desktop proof previously built the candidate from the raw PR head, so a head behind main failed for reasons main already fixed (observed on openclaw#127770: 59 commits behind, hitting the Unknown-model defect fixed by openclaw#127952). GitHub's cached PR test merge cannot be the candidate either: it was observed 50 commits / 12 hours stale and never refreshed. The workflow now resolves the live refs/heads/main tip and merge base at dispatch, requires a main-targeting PR, and builds a deterministic local merge (merge-tree --merge-base + commit-tree with pinned identity/date) as the candidate; conflicts fail with a direct rebase message and there is no fallback to the raw head. Lane labels and docs now say the candidate is the PR merged onto main.
6544389 to
d639f62
Compare
|
Addressed the P1 endpoint-boundary finding at
Local verification:
Proof gap: this host has no OpenAI Platform API-key credential, so I did not claim a real-provider success. The previous Mantis result exercised the old head and remains a failed scripted-provider proof, not evidence for this head. Exact-head CI is attached but currently waiting for GitHub runners; several auxiliary workflows were cancelled before their first step by an event/concurrency collision, and the author account cannot rerun repository workflows. @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
d639f62 to
d0deb62
Compare
|
Integrated pinned official Exact head: The only conflict was The prior hosted review on the immediately preceding head found no actionable findings. This is a behavior-neutral mechanical main integration, so the current contributor rule does not call for a redundant re-review request. No paid provider request or maintainer workflow approval was performed. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
# Conflicts: # docs/.generated/config-baseline.counts.json # docs/.generated/config-baseline.sha256
|
Integrated pinned official Exact head: Focused exact-head proof:
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
# Conflicts: # docs/.generated/config-baseline.sha256
|
Refreshed this branch onto current upstream The nine-commit upstream delta only changes release/package/session-share and generated metadata, not the native-PDF transport path. On the new head, @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|




What Problem This Solves
OpenAI Platform users cannot explicitly choose native PDF document input through the PDF tool while preserving existing upload and model-selection behavior.
User Impact
agents.defaults.pdfNativeOpenai: trueopts an already-selected OpenAI vision model into complete-document input. Unset or false preserves extraction and the existing provider order, including saved configurations upgraded from the latest stable release. Selecting an OpenAI model alone does not authorize complete-document upload.Page selection, passwords, unknown completeness, page/text/image truncation, size-limit violations, custom endpoints, Codex/ChatGPT transports and text-only models retain bounded extraction. Completeness checks still require the configured extractor. Existing Anthropic and Google paths are unchanged.
Implementation
This replaces the earlier automatic-upload/provider-preference proposal with one default-off core boolean at the existing PDF configuration owner. The bundled OpenAI provider implements a narrow optional media-understanding hook using the official PDF input contract: inline
input_file, official Platform HTTPS/v1/responses,store: false, each PDF under 50 MB and combined PDF input at most 50 MB. There is no persistent Files upload, automatic provider preference or new dependency. The official configuration generator records the single additional core leaf; channel/plugin surfaces are unchanged.Prepared credentials, headers and symbol-attached request/auth overrides use the existing scoped egress helpers. The native branch also reuses the host-owned
withGuardedFetchRequestAuthorityscope withassertModelCurrent, the original model's credential authority and the retained provider-resource assertion. The existing HTTP guard rechecks these synchronously immediately before dispatch after asynchronous preparation and on redirects. This closes the assert-only operator/credential retirement gap across lazy provider and DNS awaits without adding an authorization abstraction or changing shared HTTP behavior.Capability adoption and the proposed setting placement remain normal maintainer product decisions. This branch provides a concrete default-preserving candidate for that decision.
Evidence
Current main integration — 2026-11-17 UTC
Current head:
8b861d6974eb48062717f6e79481a9b5fe067057; pinned official main:a958f1d25c1d77aff39bfcbf86d0d4c7bd8f539a. The normal merge had one generated config-baseline conflict, regenerated by its canonical owner. The explicit default-off OpenAI native PDF implementation and tests are unchanged.Focused current-head proof passed 50 config, prepared-runtime, authority, PDF tool, and OpenAI transport assertions. Config docs and staged diff checks pass. No paid provider request or maintainer workflow approval was performed.
Earlier validated head:
95d83ad28f203ee6ec15ad60f69c06060a7235a5. Exact-head CI39994486818 passed: 75 jobs (47 success, 28 skipped), no failures or pending jobs.ac5c3699; the relevant native transport/payload owners remain unchanged. It is separate from the real Gateway proof below.Real isolated Gateway, normal agent route
The built official CLI and GatewayClient used real pinned WSS admission,
healthRPC, one durable synthetic profile, normalagent/same-runagent.wait,deliver: false, and actualusers.setRoleplus effective-role readback. The planner model remained allowed while the nearest negative excluded only the PDF model. PDF model/fallback selection was fixed explicitly.The Gateway ran the actual run-owned PDF tool. Its planner/PDF HTTP used a synthetic loopback sink through the existing runtime-dependency seam, retaining real DNS/Agent/pinned dispatcher and the final synchronous HTTP authority check. Body/auth inspection was in memory only.
pages: "2"All four submissions occurred once, and the original runs reached terminal state with backend work settled. The held-input Gateway retirement proves actual operator wiring; precise provider/DNS timing is covered separately by the focused red/green tests above.
The seven planner requests and seven other intercepted requests are counted separately. The latter remain unclassified and are not treated as PDF/fallback proof; there is no all-process external-egress claim. Gateway runtime build
4b0f4c12was exercised from test-only source head7c7816f3, with explicit runtime-owner bindings to this head. The build is not relabeled as a build of the later merge commit. No production service, employee role, customer document or real channel delivery was used. All task-owned Gateway/driver processes and temporary credential/config/profile/TLS/log state, including failed attempts, have been removed.Current main integration (2026-11-18)
Exact head:
c9a6ed237a73a7aa1fd0ca3bc825772f64939e85. Normally merged pinned officialmainf7c6804343843245d8ab6f37a91675ecc257a7b9and regenerated the config counts/hash with their canonical generator. Main changed the test helper from(agentDir, options)to(options): the old second argument was ignored, producing 10 focused failures. Both authored fixture callers now use its current signature; production PDF behavior is unchanged.The same 50 focused config, prepared-runtime, PDF-tool authority/opt-in, and provider-transport assertions now pass. Targeted agent-tools test typecheck, focused lint/format,
config:docs:check, the authored diff whitespace check and publication secret gate pass. Historical paid-provider proof stays bound to its original head and scope; no paid request, channel send, workflow approval, or duplicate hosted re-review was performed here. Maintainer contract adoption and current-head native CI remain separate.CI and Review Follow-through
Earlier CI found the generated config baseline and an inherited subagent fixture problem. Later official main changed that fixture's completion contract, so the borrowed adjustment was retired in favor of the exact official fixture files and its negative assertion. An authority test's private-extension import was also replaced with the existing public bundled-provider facade; both formal boundaries pass. These repairs add no PDF production behavior.
Previous implementation CI 39968310938 and authority CI 39986691358 passed at their respective heads. A final true conflict against official main
53fb615awas limited to the generated configuration hash. This branch normally merges that fixed main and resolves the hash with the official generator. Independent blob review preserves the feature/authority/Gateway owners; the only tracked help-file change comes from official main. Current-head CI is reported above separately from preceding evidence.The items in the prior/current review are covered by explicit consent, bounded fallback, actual conflict repair, a concrete opt-in proposal, published-stable compatibility, the final-effect authority fence and actual Gateway evidence. The later evidence reminder is addressed by this refreshed evidence and description. The remaining adoption, setting-placement and merge decisions belong to maintainers.
2026-10-24 current-main integration
mainat05bc4bf5c9fc717841df38d169bb69fa3d88a52anormally into candidatef43a6edbca54b5e3ac6d288f0a9e79e919d6e427; no force push. The only merge conflict was the generated config-baseline hash, regenerated from the merged schemas.Current main integration — 2026-10-27
Integrated official shared-budget ancestor a6c, retaining6300000 (#185911 proposal), with no generated-file conflict. The exact official786 borrowed-workspace caller replaces our duplicate implementation; native-PDF defaults, provider/header behavior, lease/configless/metadata/foreign/freshness guards remain intact. Direct feature/caller inputs are unchanged. Fresh affected-boundary proof covers6 PDF final-effect authority cases and7 hello-first queue cases, plus current types and counter (6287819/6300000). Earlier real catalog HTTP/image/withdrawal proof retains its measured scope. The immutable candidate passes independent P0-P2 review and the fixed32679 merge model.
Integration base:
a6c11850723c4c47fa30eba37d7a58dff9ef8ec4. Current PR head:67fa979b96a30e6b8afa6de5a354887a70beaba4.This exact head passed the hosted CI gate, including dependency and security-sensitive review. All current check lanes completed without failures. Previous-head results are not counted as this head's CI proof.
The existing maintainer adoption decision remains open. No downstream runtime or modified package was distributed.
2026-11-11 config-conflict maintenance
Integrated official main
a38ea90f53272bd6e64ea7230d6556523d05c7aato resolve actual generated-config conflicts and regenerated artifacts with their owning generators. The focused five-file PDF command, generated config checks, and the test-line ratchet against the exact prepared main all passed. The existing 661-line regression allocation and shared scalar are unchanged.The earlier UI fixture failures map to official fixes #197016 and #197036 in that main. The earlier six-line test-budget excess was inherited from the exact CI base, rather than missing feature allocation. Current-head native CI 43034022492 completed successfully on attempt 1: 72 terminal jobs (44 success, 28 skipped), with no failures or reruns. The immutable CI merge contains exact PR head
5e609f185572a4c6dc2fc16a2cac0376956bcb2aand official main04e941df29283d3c7a2e770c552a464e465f47ad. This maintenance provides no new live provider, Slack transport or employee-runtime acceptance.2026-11-13 generated-conflict maintenance
Current published head
5f606b7b09e1426fa80d607a20509f93c02f21e8normally merges immutable official main439a9c3552da1e939803fc3c69d87bc6e16a6553into the existing branch. The actual conflicts were the generated config counts and hash outputs; both were regenerated by their canonical owner. All 19 non-generated contribution inputs remain byte-identical to the preceding public headed7cb9aba08f41dc422e843874ad12d02368218b.Focused PDF/config/authority tests, core and OpenAI type-aware lint and typechecks passed. Canonical config/base-schema/bundled-channel checks, formatting, whitespace and the test-line ratchet against that exact main passed. Existing assertions, timeouts and allocations are unchanged. Native wrapper totals are routed pass events, so no distinct whole-suite test count is claimed. Earlier public Gateway/provider proofs retain their dated scope; no new provider transport or employee acceptance is claimed. The new head's first native CI is tracked independently from these local checks. Feature adoption and official package delivery remain maintainer decisions.
Exact-head CI disposition — 2026-11-13
The exact head's first native CI43436898958, attempt1, is terminal FAILURE, with the four post-cancel completion assertions in
src/gateway/talk/handlers/client-native-control.test.ts:474and the dependent CI gate. Actual logged checkouta407c3b16e2bce157197dafb43961f286944b8d8has official main parent6eb8095ae971f51bfa547644d4d249c21ebb8335and this exact PR-head parent. The four controls are transcript-first/rejection, delegation-first/rejection, transcript-first/empty and delegation-first/partial.Merged official #198248 explicitly documents the same four remaining post-readiness-repair assertions in its own CI43420254088. Its repair is already present in this prepared and actual source. The existing producer-retention proposal #179237 remains unmerged; its one-line probe is not full integration acceptance and was not applied here. Matching direct owner bytes and this official failure evidence identify the existing owner dependency; they do not claim that we executed the exact pure CI base or excluded every indirect interaction. Required CI remains blocking. No unrelated patch, CI rerun, assertion/timeout/line-budget change or private runtime was added.
Current upstream integration
Merged upstream main
20c363dbd03binto062e51f5b767. Regenerated the configuration documentation baseline. The targeted PDF routing, authority, configuration and runtime context tests passed. Hosted CI awaits maintainer approval.Published stable 2026.11.10 wrote an ordered PDF model and fallback list and two limits in an isolated saved configuration. The built candidate
a75fd7c50718validated and edited the same file. The ordered list and page limit survived the edit, the optional transport flag stayed absent, and an explicitly disabled flag remained false after reopening. This config-only check used no provider credentials or external delivery.