Skip to content

refactor(google): share video capability metadata - #130406

Merged
vincentkoc merged 1 commit into
mainfrom
refactor/google-generation-common-capabilities
Aug 27, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
refactor/google-generation-common-capabilities

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Aug 26, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Google video generation metadata repeated the same eight capability fields across generate, image-to-video, and video-to-video modes. That made future capability changes easier to apply inconsistently.

Why This Change Was Made

Use one private capability factory while keeping mode-specific limits inline. The factory is called separately for each mode, preserving fresh arrays, exact field ordering, and all existing values.

User Impact

No user-visible behavior changes. Provider metadata is easier to keep consistent.

Evidence

  • 43 focused Google generation metadata tests passed.

  • Native PR review reran the focused video/music provider suites successfully.

  • Native node scripts/check-changed.mjs passed, including extension production/test typecheck, lint, dead exports, plugin boundaries, and import cycles.

  • Scoped TypeScript typecheck, formatting, and git diff --check passed.

  • Exact-head one-shot metadata proof passed at 81c91b819ea77f73f59cc48d97e99d77e81def1c:

    EXPECTED_SHA=81c91b819ea77f73f59cc48d97e99d77e81def1c node --import tsx --input-type=module -e '
    import { createGoogleVideoGenerationProviderMetadata } from "./extensions/google/generation-provider-metadata.ts";
    const first = createGoogleVideoGenerationProviderMetadata().capabilities;
    const second = createGoogleVideoGenerationProviderMetadata().capabilities;
    if (!first || !second || !first.generate || !first.imageToVideo || !first.videoToVideo || !second.generate || !second.imageToVideo || !second.videoToVideo) throw new Error("missing mode capabilities");
    const modes = ["generate", "imageToVideo", "videoToVideo"];
    const fields = ["supportedDurationSeconds", "aspectRatios", "resolutions"];
    const expectedKeys = {
      generate: ["maxVideos", "maxDurationSeconds", "supportedDurationSeconds", "aspectRatios", "resolutions", "supportsAspectRatio", "supportsResolution", "supportsSize", "supportsAudio"],
      imageToVideo: ["enabled", "maxVideos", "maxInputImages", "maxDurationSeconds", "supportedDurationSeconds", "aspectRatios", "resolutions", "supportsAspectRatio", "supportsResolution", "supportsSize", "supportsAudio"],
      videoToVideo: ["enabled", "maxVideos", "maxInputVideos", "maxDurationSeconds", "supportedDurationSeconds", "aspectRatios", "resolutions", "supportsAspectRatio", "supportsResolution", "supportsSize", "supportsAudio"],
    };
    const keys = Object.fromEntries(modes.map((mode) => [mode, Object.keys(first[mode])]));
    for (const mode of modes) {
      if (JSON.stringify(keys[mode]) !== JSON.stringify(expectedKeys[mode])) throw new Error(`key order mismatch: ${mode}`);
    }
    const references = Object.fromEntries(fields.map((field) => [field, {
      acrossModes: new Set(modes.map((mode) => first[mode][field])).size === modes.length,
      acrossCalls: modes.every((mode) => first[mode][field] !== second[mode][field]),
    }]));
    if (Object.values(references).some((result) => !result.acrossModes || !result.acrossCalls)) throw new Error("shared array reference detected");
    console.log(JSON.stringify({ sha: process.env.EXPECTED_SHA, keys, references, result: "pass" }, null, 2));
    '

    Result: pass; exact Object.keys order matched for all three modes, and supportedDurationSeconds, aspectRatios, and resolutions were separate references across modes and across two metadata calls.

  • Blacksmith Testbox exact-head proof passed 43/43 with exitCode: 0 and runStatus: succeeded: lease tbx_01m10ntmdehvddbwpmrwv13hz3, Actions run https://github.com/openclaw/openclaw/actions/runs/33037904045.

  • Fresh branch autoreview reported no accepted/actionable findings (0.99 confidence).

  • Production delta: +17/-24, net -7.

ClawSweeper Disposition

  • The persistent-data classification is false: this change constructs ephemeral, nonstored provider capability metadata. It does not alter SQLite, files, migrations, schemas, retention, vectors, or embedding data.
  • Rebase/refresh and the matching rank-up move are skipped. Against current main 8dac217ce94e14a67ad2fc65837e518a2fbe0669, the metadata owner, Plugin SDK capability type, concrete video caller, and focused video/music tests are byte-identical to the PR parent. The only drift in the lazy entry file is unrelated embedding-provider registration; its video-specific lazy caller is unchanged. The synthetic merge completed cleanly.

@vincentkoc vincentkoc self-assigned this Aug 26, 2026
@clawsweeper

clawsweeper Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@vincentkoc
vincentkoc marked this pull request as ready for review August 26, 2026 21:12
@clawsweeper

clawsweeper Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 5:51 PM ET / 21:51 UTC.

ClawSweeper review

What this changes

The PR replaces repeated Google video-generation capability fields with a private factory while retaining each mode’s distinct input limits.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

This behavior-preserving refactor remains useful because current main still repeats the same capability fields across the three Google video modes. No correctness or security defect was found; keep it for normal exact-head maintainer review.

Priority: P3
Reviewed head: 81c91b819ea77f73f59cc48d97e99d77e81def1c

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, net-negative provider-local refactor with no actionable correctness or security findings.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored internal metadata refactor has no user-visible behavior change requiring the external-contributor proof gate.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored internal metadata refactor has no user-visible behavior change requiring the external-contributor proof gate.
Evidence reviewed 6 items Behavior-preserving metadata refactor: The new local factory returns the eight fields shared by generate, image-to-video, and video-to-video, and each mode invokes it separately, preserving fresh array values while retaining its own input limits.
Runtime and lazy registration callers: Both the concrete Google provider and the lazy plugin entry spread this metadata into their provider objects, so the refactor covers both registration paths without adding a second policy path.
SDK contract: The shared fields are valid VideoGenerationModeCapabilities, while transform-only enabled flags remain on their mode objects.
Findings None None.
Security None None.

Live Verification

Command: node scripts/run-vitest.mjs extensions/google/video-generation-provider.test.ts

Result: FAIL (failed) — step 1 run node scripts/run-vitest.mjs extensions/google/video-generation-provider.test.ts: previous terminal command was still running after 30 seconds: "node scripts/run-vitest.mjs extensions/google/video-generation-provider.test.ts"

[test] starting test/vitest/vitest.extension-providers.config.ts

 RUN  v4.1.11 /tmp/clawsweeper-live-proof-130406-lB2Whs/target

 ✓  extension-providers  extensions/google/video-generation-provider.test.ts (25 tests) 3153ms
     ✓ advertises Gemini video generation with a config-only Google API key  466ms
     ✓ cancels each captured failed video download without waiting for its cloned stream  342ms
     ✓ preserves the video download error when a failed response has no body  344ms

 Test Files  1 passed (1)
      Tests  25 passed (25)
   Start at  21:52:15
   Duration  29.63s (transform 21.92s, setup 1.14s, import 25.18s, tests 3.15s, environment 0ms)

[test] passed 1 Vitest shard in 36.10s

Assertions:

  • FAIL expect_output: declares explicit mode capabilities

How this fits together

The Google plugin supplies video-generation capabilities to OpenClaw’s media tools. Those capabilities determine which generation modes and controls the runtime advertises to an agent.

flowchart LR
  A[Google plugin] --> B[Video metadata builder]
  B --> C[Common capability factory]
  C --> D[Three video modes]
  D --> E[Google video provider]
  E --> F[Media generation tools]
Loading

Before merge

  • Resolve merge risk (P1) - GitHub currently reports the branch as behind main; rebase or refresh it and retain focused validation against the exact merge head before landing.
  • Complete next step (P2) - This protected maintainer PR needs normal exact-head merge review and a branch refresh, not an automated repair.
Agent review details

Security

None.

PR surface

Source -7. Total -7 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 1 17 24 -7
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 17 24 -7

Review metrics

Metric Value Why it matters
Production versus test delta production -7 net (17 added, 24 removed); tests 0 The one production-file refactor removes duplicated metadata without expanding behavior or test-support surface.

Stored data model

Persistent data-model change detected: unknown-data-model-change: extensions/google/generation-provider-metadata.ts, vector/embedding metadata: extensions/google/generation-provider-metadata.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep the provider-local factory, rebase onto current main, and verify that all three modes still advertise identical shared fields with independent arrays.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep the provider-local factory, rebase onto current main, and verify that all three modes still advertise identical shared fields with independent arrays.

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

Not applicable: this PR is an internal metadata consolidation, not a report of broken runtime behavior; source comparison shows the prior values and ordering are retained.

Is this the best way to solve the issue?

Yes: a private helper at the Google provider boundary removes repeated policy while retaining mode-specific limits and avoids creating a broader shared API.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 54db7d4f99e8.

Labels

Label changes:

  • add P3: This is a small internal provider-metadata cleanup with no intended user-visible behavior change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored internal metadata refactor has no user-visible behavior change requiring the external-contributor proof gate.

Label justifications:

  • P3: This is a small internal provider-metadata cleanup with no intended user-visible behavior change.
  • 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-authored internal metadata refactor has no user-visible behavior change requiring the external-contributor proof gate.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Current-main blame attributes the metadata builder and its concrete and lazy provider call sites to this commit. (role: recent area contributor; confidence: high; commits: 94b7d0898878; files: extensions/google/generation-provider-metadata.ts, extensions/google/video-generation-provider.ts, extensions/google/index.ts)
  • vincentkoc: Current file history includes prior merged video-generation metadata work by this contributor, in addition to this proposed refactor. (role: prior video-metadata contributor; confidence: medium; commits: 177167c846ef, 81c91b819ea7; files: extensions/google/generation-provider-metadata.ts)

Rank-up moves

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

  • Rebase or refresh against current main and rerun the focused Google provider test on the exact merge head.

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 (1 earlier review cycle)
  • reviewed 2026-08-26T21:08:30.632Z sha 81c91b8 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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. labels Aug 26, 2026
@vincentkoc
vincentkoc merged commit 751e6c5 into main Aug 27, 2026
499 of 507 checks passed
@vincentkoc
vincentkoc deleted the refactor/google-generation-common-capabilities branch August 27, 2026 04:05
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: google maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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