Skip to content

fix(cli): convert HEIC sequences in model runs - #128578

Merged
steipete merged 1 commit into
openclaw:mainfrom
Leon-SK668:leon/cli-heic-sequence-conversion-20260824
Aug 24, 2026
Merged

steipete merged 1 commit into
openclaw:mainfrom
Leon-SK668:leon/cli-heic-sequence-conversion-20260824

Conversation

@Leon-SK668

Copy link
Copy Markdown
Contributor

Related to #128501

What Problem This Solves

Fixes an issue where openclaw capability model run --file users could pass a HEIC or HEIF sequence image that was detected correctly but sent to the selected model provider without the required JPEG conversion. This affected both local and Gateway model probes.

Why This Change Was Made

The model-run owner now treats the detector's existing image/heic-sequence and image/heif-sequence results the same as the still-image HEIC/HEIF aliases. The change reuses the established JPEG conversion path and does not add a new MIME detector, provider rule, config surface, or dependency.

User Impact

Sequence-form HEIC and HEIF files now reach model providers as JPEG input in both local and Gateway model-run workflows, matching the behavior already established for ordinary HEIC/HEIF files.

Evidence

  • Before the production change, two focused CLI regressions used genuine ISO-BMFF hevc and msf1 brands; the production detector identified the sequence MIME types, but both local and Gateway cases failed because convertHeicToJpeg was called zero times.
  • After the change on the rebased head, node scripts/run-vitest.mjs src/cli/capability-cli.test.ts passed all 188 tests, including both sequence cases and the existing still-HEIC regression.
  • oxfmt --check passed for both changed files; focused type-aware oxlint and git diff --check passed.
  • Fresh Codex autoreview reported no accepted/actionable findings and judged the patch correct with 0.99 confidence; its TruffleHog preflight was clean.
  • Testbox/Crabbox is not available on this host, so the broad remote check:changed lane was not run locally; exact-head GitHub CI remains the broad gate.

@clawsweeper

clawsweeper Bot commented Aug 24, 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 cli CLI command changes size: S labels Aug 24, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 24, 2026
@clawsweeper

clawsweeper Bot commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 24, 2026, 4:30 AM ET / 08:30 UTC.

ClawSweeper review

What this changes

The PR adds HEIC- and HEIF-sequence MIME variants to model-run JPEG normalization and covers local and Gateway CLI delivery.

Regression provenance

Possible regression — probable (reproduction; reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

No blocking findings. Current main still bypasses JPEG conversion for the two sequence MIME values, while this PR extends the shared model-run preparation boundary before the local/Gateway split; the contributor’s real after-fix trace is sufficient proof.

Priority: P2
Reviewed head: 00d986a0d601cc23e2c08ad2e42122d5128e385b

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused owner-boundary repair with real after-fix evidence and transport-specific regression coverage.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (logs): The contributor supplied a redacted after-fix real container run using production MIME detection, conversion, CLI registration, and provider transport; both genuine sequence inputs were observed at the provider boundary as JPEG.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (logs): The contributor supplied a redacted after-fix real container run using production MIME detection, conversion, CLI registration, and provider transport; both genuine sequence inputs were observed at the provider boundary as JPEG.
Evidence reviewed 6 items Current-main gap: Current main accepts image MIME types but its conversion set contains only still HEIC and HEIF, so detected sequence values bypass the existing JPEG conversion branch.
Single owner boundary: The PR adds both sequence aliases to the existing set; image preparation runs before the transport branch, and Gateway receives the same prepared attachments.
Focused regression coverage: The added cases use opaque ISO-BMFF-brand inputs, verify JPEG conversion and local request content for HEIC sequence, and verify Gateway attachment content for HEIF sequence.
Findings None None.
Security None None.

Live Verification

Command: pnpm openclaw capability model run --help

Result: PASS (completed)

pnpm openclaw capability model run --help
runner@runnervm76f27:/tmp/clawsweeper-live-proof-128578-V3MF6X/target$ pnpm openclaw capability model run --help
$ node scripts/run-node.mjs capability model run --help
pnpm openclaw capability model run --help
[openclaw] Building TypeScript (dist is stale: missing_build_stamp - build stamp missing).
[openclaw] Building bundled plugin assets.
[canvas] build: node scripts/bundle-a2ui.mjs
[log] ‹DIR›/a2ui.bundle.js  chunk │ size: 399.96 kB
[log] ‹DIR›/a2ui-v0.9.bundle.js  chunk │ size: 615.66 kB
[log]
[success] rolldown v1.2.0 Finished in 101.74 ms
[diffs] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts curated
[diffs-language-pack] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts full
[discord] build: node --import tsx ../../scripts/build-discord-activity-sdk.mts
[tsdown-build] invocation 1/2 finished in 0.7s
node_modules/playwright-core/lib/coreBundle.js (65821:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65821:29 ]
       │
 65821 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/playwright-core/lib/coreBundle.js (65828:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65828:29 ]
       │
 65828 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2343:30) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2343:31 ]
      │
 2343 │           ASM_CONSTS[start] = eval(func);
      │                               ──┬─
      │                                 ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2366:32) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2366:33 ]
      │
 2366 │           moduleExports[name] = eval(func);
      │                                 ──┬─
      │                                   ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

[tsdown-build] invocation 2/2 finished in 13.8s
[plugin-control-plane-loads] verified 35 built modules with native require and checked doctor closures
runtime-postbuild: 11 phases completed in 4039ms (slowest: built plugin control-plane loads 3333ms)
│
◇

OpenClaw 2026.8.1 (00d986a) — All your chats, one OpenClaw.

Usage: openclaw infer model run [options]

Run a one-shot model turn

Options:
  --agent ‹id›              Agent whose model and credentials own the run (default: agents.defaults.systemAgent.agentId, then the sole agent)
  --file ‹path›             Image file (default: [])
  --gateway                 Force gateway execution (default: fa
… output truncated …

Assertions:

  • PASS expect_output: --file ‹path›

How this fits together

The capability CLI reads image files, detects their MIME type, and normalizes unsupported provider formats before dispatching to a local model transport or Gateway. Both transports consume the same prepared image data.

flowchart LR
  A[CLI image file] --> B[MIME detection]
  B --> C[Model-run image preparation]
  C --> D{HEIC or HEIF family?}
  D -->|sequence or still| E[JPEG conversion]
  D -->|other image| F[Original image bytes]
  E --> G[Local or Gateway model request]
  F --> G
Loading

Before merge

  • Resolve merge risk (P1) - The PR is behind current main; rebase and rerun exact-head required checks before merge.
  • Resolve merge risk (P1) - Production semantics add two MIME aliases (+6/-1 raw lines); this is justified because the existing static set is the canonical model-run conversion boundary and a net-neutral alternative would be less clear.
  • Complete next step (P2) - No repair lane is needed: the submitted branch already contains the focused fix and sufficient evidence; normal rebase and exact-head CI gates remain.
Agent review details

Security

None.

PR surface

Source +5, Tests +56. Total +61 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 6 1 +5
Tests 1 56 0 +56
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 62 1 +61

Review metrics

Metric Value Why it matters
Production vs test LOC production +6/-1 (semantic +2); tests +56/-0 The production change adds exactly two recognized MIME values; the remaining production delta is the multiline representation of the existing set.

Stored data model

Persistent data-model change detected: serialized state: src/cli/capability-cli.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep both sequence aliases in the existing model-run MIME set, preserving one conversion path before local and Gateway dispatch.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep both sequence aliases in the existing model-run MIME set, preserving one conversion path before local and Gateway dispatch.

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

Yes—source reproducible: an input detected as image/heic-sequence or image/heif-sequence reaches the image branch but misses current main’s two-value conversion set; the submitted trace also records the before/after behavior with genuine sequence files.

Is this the best way to solve the issue?

Yes—the model-run reader is the correct boundary because it prepares data once before either transport; duplicating sequence handling in local or Gateway delivery would create drift.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 5cb4bbcd41ef.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The contributor supplied a redacted after-fix real container run using production MIME detection, conversion, CLI registration, and provider transport; both genuine sequence inputs were observed at the provider boundary as JPEG.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (logs): The contributor supplied a redacted after-fix real container run using production MIME detection, conversion, CLI registration, and provider transport; both genuine sequence inputs were observed at the provider boundary as JPEG.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This repairs a bounded image-format failure in the model-run CLI without broader runtime or data-loss impact.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (logs): The contributor supplied a redacted after-fix real container run using production MIME detection, conversion, CLI registration, and provider transport; both genuine sequence inputs were observed at the provider boundary as JPEG.
  • proof: sufficient: Contributor real behavior proof is sufficient. The contributor supplied a redacted after-fix real container run using production MIME detection, conversion, CLI registration, and provider transport; both genuine sequence inputs were observed at the provider boundary as JPEG.

Evidence

What I checked:

  • Current-main gap: Current main accepts image MIME types but its conversion set contains only still HEIC and HEIF, so detected sequence values bypass the existing JPEG conversion branch. (src/cli/capability-cli/model.ts:56, 5cb4bbcd41ef)
  • Single owner boundary: The PR adds both sequence aliases to the existing set; image preparation runs before the transport branch, and Gateway receives the same prepared attachments. (src/cli/capability-cli/model.ts:56, 00d986a0d601)
  • Focused regression coverage: The added cases use opaque ISO-BMFF-brand inputs, verify JPEG conversion and local request content for HEIC sequence, and verify Gateway attachment content for HEIF sequence. (src/cli/capability-cli.test.ts:1295, 00d986a0d601)
  • Sibling-path check: The merged media-input path already collapses the same sequence aliases before conversion, but model-run uses its own file reader and therefore still needs this owner-local repair. (src/media/input-files.ts:306, 5cb4bbcd41ef)
  • History provenance: Blame attributes the current main conversion set to the commit that established this model-run path; the sequence omission is therefore traceable to that existing selection rather than the PR. (src/cli/capability-cli/model.ts:56, 3cb7f6330c76)
  • After-fix real behavior proof: The contributor’s redacted container trace at the reviewed head reports genuine hevc and msf1 inputs detected as sequence MIME types, converted by the production Rastermill/ImageMagick path, and observed by a real loopback OpenAI-compatible provider as JPEG bytes. (00d986a0d601)

Likely related people:

  • steipete: Current-main blame ties the model-run MIME selection to Peter Steinberger’s commit, and the related merged media normalization work is also attributed to this area. (role: introduced current behavior and adjacent media owner; confidence: high; commits: 3cb7f6330c76, f59c743c0b92; files: src/cli/capability-cli/model.ts, src/media/input-files.ts)

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-24T07:02:49.993Z sha 00d986a :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-24T07:48:39.225Z sha 00d986a :: needs real behavior proof before merge. :: none

@Leon-SK668

Copy link
Copy Markdown
Contributor Author

Real behavior proof

Tested the exact current head: 00d986a0d601cc23e2c08ad2e42122d5128e385b.

Environment and production path

  • Node.js 24.19.0 in an isolated node:24-bookworm-slim container.
  • Production MIME detection from @openclaw/media-core/mime.
  • Production convertHeicToJpeg path through Rastermill 0.3.1 and the normal system-binary resolver, using the official ImageMagick 7.1.2-30 Linux binary with its HEIC delegate.
  • Production registerCapabilityCli -> infer model run owner -> local simple-completion transport -> a real loopback OpenAI-compatible HTTP provider. The provider observer decoded the actual request body at /v1/chat/completions; the converter and transport were not mocked.

Genuine sequence inputs

I encoded two 64x64 frames into a real two-image HEIF container, then exercised both sequence brands. heif-info parsed both files as two image items (IDs 1 and 2):

Input Bytes SHA-256 heif-info MIME / brand Production detectMime
HEVC sequence 1,690 48a04e3a8595dc17dd08b99d51cca19572eab20c9f33256ac5c6c5237d9c44bd image/heic-sequence / hevc image/heic-sequence
MSF1 sequence 1,690 249a3db177dc2556a2b86b6ad02a4af7096a90a927fde486d8f7e512c40cee4b image/heif-sequence / msf1 image/heif-sequence

The real production conversion returned a 599-byte JPEG for each input, with magic ffd8ffdb00430005 and SHA-256 dff734b4c0a33a79acd0809d9f1c98376e17e85555c35d79750e64de407a1c7d.

Redacted model-run trace

Both inputs were run independently through the production command action:

node <ephemeral-production-runner> infer model run \
  --prompt "Identify the image colors." \
  --file <sequence-input> \
  --model loopback-proof/vision-proof \
  --local --agent main --json

[provider-transport-fetch] [model-fetch] start provider=loopback-proof api=openai-completions model=vision-proof method=POST url=http://127.0.0.1:<port>/v1/chat/completions proxy=none policy=custom
[provider-transport-fetch] [model-fetch] response provider=loopback-proof api=openai-completions model=vision-proof status=200 contentType=text/event-stream

For both HEVC and MSF1 runs, the production CLI envelope reported:

{
  "ok": true,
  "capability": "model.run",
  "transport": "local",
  "provider": "loopback-proof",
  "model": "vision-proof",
  "inputs": [{ "path": "<redacted>", "mimeType": "image/jpeg" }],
  "outputs": [{ "text": "provider received JPEG", "mediaUrl": null }]
}

The real provider boundary independently read back both requests:

Input Method / path Request Declared image MIME Decoded bytes Magic SHA-256
HEVC POST /v1/chat/completions 1,066 bytes, streaming image/jpeg 599 ffd8ffdb00430005 dff734b4c0a33a79acd0809d9f1c98376e17e85555c35d79750e64de407a1c7d
MSF1 POST /v1/chat/completions 1,066 bytes, streaming image/jpeg 599 ffd8ffdb00430005 dff734b4c0a33a79acd0809d9f1c98376e17e85555c35d79750e64de407a1c7d

The provider recorded only whether an Authorization header was present, never its value.

Runner note

A direct tsx source-CLI launch spent more than two minutes in unrelated TypeScript module compilation (about 782 MB RSS) before any provider request, so I stopped that fanout. The ephemeral runner called the production registerCapabilityCli with Commander and used the repository's esbuild only to precompile that same source graph (--bundle --platform=node --target=node24 --format=esm --packages=external). It did not mock or replace MIME detection, Rastermill/ImageMagick conversion, config/model selection, simple-completion, HTTP fetch, SSE parsing, or the provider boundary. All temporary files, state, server processes, and the container were removed after the readback; the PR worktree remained clean at the exact head above.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 24, 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 exact_review_queue).
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 proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 24, 2026
@steipete

Copy link
Copy Markdown
Contributor

Named follow-up: src/media/input-files.ts independently owns the public input_image MIME allowlist and currently omits image/heic-sequence and image/heif-sequence. Broadening that public accepted-MIME surface requires a separate media-owner/product decision; this PR intentionally changes only the existing CLI model-run conversion owner.

@steipete
steipete merged commit 7a7bb1f into openclaw:main Aug 24, 2026
207 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

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

Labels

cli CLI command changes P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: S 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.

2 participants