fix(video): parse multipart/form-data create body (OpenAI SDK 6.28+)#247
Merged
Conversation
commit: |
AlemTuzlak
added a commit
to TanStack/ai
that referenced
this pull request
Jun 3, 2026
…rop stopgap patch @copilotkit/aimock now parses multipart/form-data video-create bodies natively (CopilotKit/aimock#247), so the local pnpm patch is no longer needed. Bump the e2e dependency to ^1.28.1 (the release carrying that fix) and remove the patch file + patchedDependencies entry. Note: CI is expected to be RED until @copilotkit/aimock >=1.28.1 is published — the lockfile still resolves 1.27.0 and the unpatched mock 400s video-create. Once the release is out, `pnpm install` refreshes the lockfile to 1.28.1 and the video-gen E2E goes green.
The OpenAI SDK 6.28.0+ sends POST /v1/videos (videos.create) as multipart/form-data instead of JSON — even for File-less bodies — which handleVideoCreate previously rejected with 400 invalid_json. Detect the multipart content-type and parse the prompt/model/size/seconds fields (reusing the exported transcription multipart helpers), coercing numeric fields to match the JSON shape; the JSON path is preserved for older SDKs. Closes the regression where openai>=6.28 video-create requests fail against the mock.
2003b4d to
ab66cbb
Compare
Merged
AlemTuzlak
added a commit
that referenced
this pull request
Jun 4, 2026
## Release 1.29.0 Cuts the accumulated `[Unreleased]` changes as **1.29.0** (semver minor — there are `Added` + `Deprecated` entries). Bumps `package.json` `1.28.0 → 1.29.0` and moves the CHANGELOG `[Unreleased]` section under `## [1.29.0] - 2026-06-04`. **Merging to `main` triggers the Release workflow to publish `1.29.0` to npm** (the workflow publishes when `package.json`'s version isn't yet on the registry). ### What ships in 1.29.0 **Added** - `POST /__aimock/reset/fixtures` and `POST /__aimock/reset/journal` - `aimock-pytest`: `reset_fixtures()` / `reset_journal()` - Control API reference docs **Changed** - `engines.node` lowered to `>=20.15.0` **Deprecated** - `POST /__aimock/reset` (alias for `/reset/fixtures`) **Fixed** - **Video** — `POST /v1/videos` now parses `multipart/form-data` bodies (OpenAI SDK ≥6.28 sends video-create as multipart) — #247 - `aimock-pytest` per-fixture option forwarding + startup-timeout/teardown hardening - `DELETE /v1/_requests` clears only journal entries (preserves fixture match-counts) ### Downstream Unblocks **TanStack/ai#695**, which pins `@copilotkit/aimock: ^1.28.1` and drops its temporary local video-multipart patch — once 1.29.0 is on npm, that PR's E2E goes green. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
AlemTuzlak
added a commit
to TanStack/ai
that referenced
this pull request
Jun 4, 2026
…695) * feat(openai): support shell-tool skills via environment.skills Add an optional `environment` config to `shellTool()` (ShellToolFactoryConfig) so hosted provider Skills can ride the OpenAI Responses shell tool, e.g. `shellTool({ environment: { type: 'container_auto', skills: [...] } })`. The converter now passes `environment` through to the request. Bumps the openai SDK to ^6.41.0 (required for the typed shell environment.skills surface) across ai-openai, openai-base, ai-grok, and ai-groq, with the small SDK-compat adjustments the bump requires (ComputerUsePreviewTool import; dropped now-redundant casts in image.ts/video.ts). * feat(anthropic): support code-execution skills via container.skills + beta headers Add an optional `{ skills }` to `codeExecutionTool(config, options)`. The adapter lifts those skills into the request's top-level `container.skills` (preserving any `container.id`) and attaches the required beta headers via `computeAnthropicBetas`: `code-execution-2025-08-25` (or `code-execution-2025-05-22` for the legacy `code_execution_20250522` variant) plus `skills-2025-10-02` when skills are present. Betas are now applied on both the streaming and structuredOutput request paths. Skills set via `modelOptions.container.skills` are deprecated in favor of the tool option. Adds unit tests for the lift, the version-aware betas, the skills/lift agreement across multi-tool configs, and skill_id validation. * test(e2e): cover provider skills; docs + skill; patch aimock video multipart Add wire-assertion E2E for both providers (Anthropic container.skills + beta headers; OpenAI shell environment.skills) plus the docs page (docs/tools/ provider-skills.md, nav + cross-links) and the tool-calling agent skill section. The openai 6.41 bump makes videos.create send multipart/form-data, which the pinned @copilotkit/aimock (1.27.0) only JSON-parses; add a pnpm patch teaching its video handler to parse multipart (reusing the existing transcription helpers), and give the video-gen fixture the id/status the flow needs. The same fix should be upstreamed to @copilotkit/aimock so the patch can be dropped. * chore(e2e): consume @copilotkit/aimock with native multipart video; drop stopgap patch @copilotkit/aimock now parses multipart/form-data video-create bodies natively (CopilotKit/aimock#247), so the local pnpm patch is no longer needed. Bump the e2e dependency to ^1.28.1 (the release carrying that fix) and remove the patch file + patchedDependencies entry. Note: CI is expected to be RED until @copilotkit/aimock >=1.28.1 is published — the lockfile still resolves 1.27.0 and the unpatched mock 400s video-create. Once the release is out, `pnpm install` refreshes the lockfile to 1.28.1 and the video-gen E2E goes green. * chore(e2e): lock @copilotkit/aimock to 1.29.0 1.29.0 is published with native multipart/form-data video-create parsing, satisfying the ^1.28.1 spec. Refreshes the lockfile off the now-removed local patch; video-gen E2E passes natively against the published mock.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The OpenAI SDK 6.28.0+ sends
POST /v1/videos(videos.create) asmultipart/form-datainstead of JSON — even for File-less bodies (6.27 and earlier sent JSON when no File/Blob was present). aimock'shandleVideoCreateonlyJSON.parses the body, so video-create requests from a current OpenAI SDK fail with400 invalid_json.This teaches the video handler to detect a
multipart/form-datacontent-type and parse theprompt/model/size/secondsfields, reusing the existing exportedextractBoundary/extractFormFieldtranscription helpers (no new parser).secondsis coerced to a number to match the JSON shape. The JSON path (and its400 invalid_jsonfallback) is preserved unchanged for older SDKs.Why
Downstream consumers on
openai@^6.28(e.g. TanStack AI's E2E suite after bumping to 6.41) hit this — the mock 400s every video-create. This restores video-create compatibility with current OpenAI SDKs.Changes
src/video.ts— content-type-aware body parse inhandleVideoCreate(multipart branch + preserved JSON branch).src/__tests__/multimedia.test.ts— new test posting a realFormData(multipart) video-create body and asserting the fixture matches.CHANGELOG.md—[Unreleased] › Fixedentry.Test Plan
pnpm build— cleanpnpm lint— cleanprettier --check src/video.ts— cleanpnpm test src/__tests__/multimedia.test.ts— 25/25 (incl. the new multipart case)pnpm test— the new test passes; the only failures are pre-existing Windows-local flakes unrelated to this change (cli.test.tsSIGTERM/exit-code,fixtures-remote.test.tsXDG_CACHE_HOME,timing-replay.test.tsreplaySpeedtiming — the failing count varied 3↔4 between runs). None touch video; CI (Linux) should be green.Release
Compatibility fix → patch (e.g.
1.28.1) by the repo's precedent (cf. 1.27.3 "correct OpenAI images endpoint path"). The CHANGELOG entry sits under[Unreleased]for the maintainer to cut viapnpm release.🤖 Generated with Claude Code