Skip to content

feat(ai): add provider video input contract - #121887

Merged
steipete merged 5 commits into
mainfrom
steipete/native-video-llm-contract
Aug 11, 2026
Merged

steipete merged 5 commits into
mainfrom
steipete/native-video-llm-contract

Conversation

@steipete

@steipete steipete commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

OpenClaw needs a typed way for provider adapters to receive user-supplied video without making video part of every agent transcript, plugin harness, worker message, tool result, image-generation API, or model route. Widening the canonical LLM message types would have changed public Plugin SDK declaration closures and implied support in runtimes that cannot carry video.

Why This Change Was Made

This PR adds a provider-only conversation dialect at @openclaw/ai/provider-types: user messages and provider model metadata can describe text, image, and video, while canonical @openclaw/llm-core messages/models remain text-and-image only. Existing built-in providers use a shared projection that converts unsupported video into visible byte-free omission text before their canonical transforms run.

The boundary is intentionally narrow:

  • canonical Agent Core, Plugin SDK harness/session hooks, workers, tool results, image generation, Copilot, and Codex stay image-only;
  • generic runtime model catalogs do not advertise or execute native video;
  • provider adapters must explicitly opt into the provider dialect;
  • structured non-image tool-result blocks remain preserved at runtime.

This is the contract slice extracted from the broader native-video work. Provider-owned Google and Moonshot wire support lands separately.

AI-assisted; implementation and review were performed with coding agents under maintainer supervision.

User Impact

There is no newly enabled provider route in this slice. Developers of provider adapters gain a precise video-capable input contract, and unsupported routes produce an explicit (video omitted: provider does not support video input) result rather than receiving raw bytes, silently dropping the turn, or coercing video into an image.

Evidence

  • packages/llm-core/**: zero diff against the rebased base.
  • Generated Plugin SDK API baseline: zero diff; canonical generator/check passed.
  • Plugin SDK AgentMessage/AgentHarness/session closures remain unchanged.
  • Focused suite: 11 files, 432 tests passed across provider transforms, Anthropic, Google, Mistral, OpenAI Completions/Responses, Ollama, worker transcript, ChatGPT capability firewall, and device-code polling.
  • node scripts/check-changed.mjs: passed, including typechecks, lint, dead exports, SDK manifest, package-lock guard, import cycles, and integrity guards.
  • git diff --check: passed.
  • Mandatory autoreview: no accepted/actionable findings.
  • Production/package LOC: +206/-213, net -7; tooling +1/-0; total non-test/generated/docs/lockfile net -6; tests +139/-3; generated zero.

Package E2E gap: the repository's existing dependency install is missing @lit/context, so the package consumer test could not begin collection. No dependency or timeout workaround was added; exact-head hosted CI remains the package gate.

Dependency boundary checked directly: the sibling Codex protocol exposes text, image, and audio inputs, but no video input, so Codex remains intentionally video-disabled.

@clawsweeper

clawsweeper Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime commands Command implementations agents Agent runtime and tooling extensions: openai extensions: ollama size: M maintainer Maintainer-authored PR labels Aug 11, 2026
@steipete
steipete marked this pull request as ready for review August 11, 2026 06:01
@steipete
steipete force-pushed the steipete/native-video-llm-contract branch from 1915a76 to 6b6a562 Compare August 11, 2026 06:13
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 11, 2026
@clawsweeper

clawsweeper Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 11, 2026, 5:53 AM ET / 09:53 UTC.

ClawSweeper review

What this changes

This PR adds a video-capable provider input type subpath and converts unsupported video to visible omission text before built-in providers use canonical transcript transforms.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep open for maintainer review: the source supports a clean provider-only boundary, but this publishes a new adapter contract and its Codex compatibility claim could not be independently verified in the available checkout.

Priority: P2
Reviewed head: cf41be3849caac4419ad8ac9e5f94baca1d2bcfc
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The implementation is focused and internally consistent, with maintainer confirmation and exact-head completion remaining before merge.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-associated contract slice enables no user-facing provider route; focused source and type-boundary tests are the relevant evidence.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-associated contract slice enables no user-facing provider route; focused source and type-boundary tests are the relevant evidence.
Evidence reviewed 8 items Provider-only contract: The new aliases add video only to provider message and model types, without modifying canonical LLM types.
Byte-free projection boundary: Video is removed from the canonical target model and replaced with visible omission text before the canonical transform is called.
Canonical contract remains narrow: The canonical LLM-core user message still permits only text and image blocks.
Findings None None.
Security None None.

How this fits together

Provider adapters receive model and conversation inputs, then transform them into canonical messages for provider transports. The new dialect permits video only before that boundary; canonical agent, SDK, and transcript contracts remain text-and-image only.

flowchart LR
  A[Provider adapter input] --> B[Provider media types]
  B --> C[Media projection]
  C --> D{Video supported here?}
  D -->|No| E[Visible omission text]
  D -->|Image or text| F[Canonical transcript]
  E --> F
  F --> G[Provider transport]
Loading

Decision needed

Question Recommendation
Should @openclaw/ai/provider-types become the supported public provider-adapter contract now, with native video routing deferred to later provider-owned work? Confirm the narrow provider contract: Approve the public type subpath while retaining canonical messages and all current runtime routes as text-and-image only.

Why: Publishing this type subpath establishes a compatibility surface beyond the current built-in adapters, and the available evidence cannot independently validate the related Codex compatibility statement.

Before merge

  • Resolve merge risk (P1) - @openclaw/ai/provider-types is a new published adapter API, so its intended compatibility and ownership need explicit maintainer confirmation before merge.
  • Resolve merge risk (P1) - The PR body's Codex-disabled claim remains unverified because the required sibling source was unavailable; exact-head CI is also still in progress.
Agent review details

Security

None.

PR surface

Source -12, Tests +136, Config +5, Other +1. Total +130 across 13 files.

View PR surface stats
Area Files Added Removed Net
Source 8 201 213 -12
Tests 3 139 3 +136
Docs 0 0 0 0
Config 1 5 0 +5
Generated 0 0 0 0
Other 1 1 0 +1
Total 13 346 216 +130

Review metrics

Metric Value Why it matters
Production versus test delta production/tooling net -6; tests net +136 (139 added, 3 removed) The new public contract is accompanied by focused boundary coverage while the transcript refactor is net-negative in production code.

Stored data model

Persistent data-model change detected: serialized state: packages/ai/src/providers/transform-messages.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Confirm the published adapter API (recommended)
    Obtain maintainer confirmation that this type-only subpath is the intended long-lived external provider contract, then merge after exact-head checks pass.
  2. Defer public exposure
    Keep the types internal until a provider-owned video transport supplies a complete supported API and upgrade story.

Technical review

Best possible solution:

Publish one provider-only contract only after its external API scope is confirmed, the Codex statement is directly verified or removed, and exact-head checks finish green.

Do we have a high-confidence way to reproduce the issue?

Not applicable: this PR adds an API contract rather than repairing a reported failing user workflow.

Is this the best way to solve the issue?

Unclear: the provider boundary is coherent and no code defect was found, but maintainers must decide whether to publish this adapter contract now and validate or remove the Codex claim.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 4b08d9aa75c1.

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P2: This is a bounded provider adapter capability with no newly enabled user-facing video route in this slice.
  • merge-risk: 🚨 compatibility: The PR adds a published AI package subpath and type aliases that provider adapters may adopt as an external contract.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-associated contract slice enables no user-facing provider route; focused source and type-boundary tests are the relevant evidence.

Evidence

What I checked:

Likely related people:

  • steipete: Peter Steinberger authored the entire PR and the prior shared media-payload and tool-result preservation commits in this package. (role: provider and media-contract contributor; confidence: high; commits: 73ada8fd4ccc, 5a4b48ead617, 1de55ca70f8b; files: packages/ai/src/provider-transcript-transform.ts, packages/ai/src/provider-types.ts, packages/ai/src/providers/tool-result-text.ts)
  • Ayaan Zaidi: Current main attributes the canonical transcript-transform boundary to this contributor's recent commit. (role: recent canonical transcript contributor; confidence: medium; commits: 210aca6de387; files: packages/ai/src/transcript-transform.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Confirm the published provider-adapter contract direction.
  • Verify the Codex statement from the sibling source or remove it from the PR evidence.
  • Let the current exact-head checks complete before merging.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-08-11T07:08:34.347Z sha 987ba175a815301bbd879e17b1134b918aeb5bd8 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-11T07:57:53.697Z sha 4b427bc :: needs maintainer review before merge. :: none

@steipete
steipete force-pushed the steipete/native-video-llm-contract branch from 987ba17 to 4b427bc Compare August 11, 2026 07:31
@steipete
steipete force-pushed the steipete/native-video-llm-contract branch from 4b427bc to cf41be3 Compare August 11, 2026 09:46
@steipete steipete self-assigned this Aug 11, 2026
@steipete steipete changed the title feat(llm): add user video input contract feat(ai): add provider video input contract Aug 11, 2026
@openclaw-barnacle openclaw-barnacle Bot removed docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime commands Command implementations labels Aug 11, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 11, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready proof for cf41be3849caac4419ad8ac9e5f94baca1d2bcfc.

Root problem and owner boundary: provider adapters need a typed way to receive user-supplied video, but widening canonical @openclaw/llm-core messages/models would incorrectly claim video support across Agent Core, Plugin SDK harness/session hooks, workers, tool results, image generation, Copilot, Codex, and generic runtime catalogs. The architectural owner is therefore the AI package's provider-adapter boundary.

Canonical fix: this head publishes one provider-only dialect at @openclaw/ai/provider-types and routes all five built-in provider transcript call sites through a shared provider projection. Unsupported video is removed before canonical serialization and replaced with visible byte-free (video omitted: provider does not support video input) text. Structured non-image tool-result blocks remain preserved.

Removed/widened paths: the canonical LLM, agent, plugin, worker, tool-result, image-generation, Codex, Copilot, and runtime-catalog contracts were not widened. The only widening is the provider-specific message/model dialect and its package export. Duplicate transcript-transform policy was consolidated into the shared provider projection. packages/llm-core/** has zero diff against the reviewed base, and docs/.generated/plugin-sdk-api-baseline.jsonl has zero diff.

LOC: production/package +206/-213 (net -7); tooling +1/-0; total non-test/generated/docs/lockfile net -6; tests +139/-3; generated +0/-0.

Focused proof:

  • node scripts/run-vitest.mjs packages/ai/src/provider-types.test.ts packages/ai/src/providers/transform-messages.test.ts packages/ai/src/providers/anthropic.test.ts packages/ai/src/providers/google-shared.test.ts packages/ai/src/providers/mistral.test.ts packages/ai/src/providers/openai-completions.test.ts packages/ai/src/providers/openai-responses.test.ts extensions/ollama/src/stream-runtime.test.ts src/worker/transcript-message.test.ts extensions/openai/openai-chatgpt-provider.test.ts extensions/openai/openai-chatgpt-device-code.test.ts — 432 tests passed.
  • node scripts/check-changed.mjs — passed, including the changed typecheck, lint, dead-export, SDK-manifest, package-lock, import-cycle, and integrity guards.
  • git diff --check — passed.
  • .agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main — clean; no accepted/actionable findings.
  • node scripts/watch-pr-ci.mjs 121887 cf41be3849caac4419ad8ac9e5f94baca1d2bcfc — exact-head green. Hosted CI run: https://github.com/openclaw/openclaw/actions/runs/31479245535.
  • Testbox: no separate Testbox run was used for this slice; the exact-head hosted pull-request run above is the final package proof.

Package E2E gap: packages/ai/src/package.e2e.test.ts could not begin local collection because the existing dependency install lacks @lit/context. No dependency workaround, fallback, assertion weakening, baseline hand edit, or timeout increase was introduced.

Codex dependency contract inspected directly:

  • ../codex/codex-rs/protocol/src/openai_models.rs:140-171,248-250,433-435 defines text/image/audio model modalities and defaults, with no video modality.
  • ../codex/codex-rs/app-server-protocol/src/protocol/v2/turn.rs:71-75,175-179,288-325 accepts turn input variants for text, image, local image, audio, local audio, skill, and mention, with no video variant.
  • ../codex/codex-rs/protocol/src/local_media.rs:13-49 snapshots local image/audio only.

Latest ClawSweeper review has no code findings. Its rank-up moves are satisfied: the maintainer has explicitly confirmed this durable provider-adapter contract, the Codex compatibility claim is verified from sibling source, and exact-head CI is complete and green.

Known non-goals: no native provider route is enabled here; Google and Moonshot wire support, later durability/agent work, and generic runtime-catalog video support remain separate owner slices.

@steipete
steipete merged commit 226c699 into main Aug 11, 2026
113 of 114 checks passed
@steipete
steipete deleted the steipete/native-video-llm-contract branch August 11, 2026 10:08
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant