Skip to content

fix: preserve audio responses in generated commands - #439

Open
petebacondarwin wants to merge 2 commits into
mainfrom
codex/fix-audio-response-output
Open

petebacondarwin wants to merge 2 commits into
mainfrom
codex/fix-audio-response-output

Conversation

@petebacondarwin

@petebacondarwin petebacondarwin commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

The generator classified audio/* responses as JSON, and operation descriptors could discard audio responses when their schemas omitted format: binary. Recognize audio MIME types as binary in both paths so future commands generated for audio endpoints will write the exact response bytes to stdout.

No commands generated from the currently pinned OpenAPI specification declare audio responses, and regeneration produces no tracked changes. This fixes future command generation without changing the behavior of any currently shipped command. Retain a patch changeset that explicitly describes this scope.

Add regression coverage for audio classification, generated POST handlers, operation descriptors without binary schema annotations, and the existing hand-written cf ai run byte output for MP3, WAV, PNG, and octet-stream responses.

Related to #437. The current hand-written cf ai run already preserves non-JSON response bytes, and its expanded mocked-response tests pass before this generator fix. This PR does not establish that the reported live API behavior is fixed.

Validation:

  • pnpm check
  • 122 focused tests across output-kind.test.ts, emit.test.ts, forge-model.test.ts, and ai-run.test.ts

@pkg-pr-new

pkg-pr-new Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
npm i https://pkg.pr.new/cf@439

commit: 2b2c2de

@ask-bonk

ask-bonk Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

LGTM!

github run

@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

cf --help startup

mean stddev min max
PR 282.2 ms 10.5 ms 269.4 ms 309.5 ms
base 274.5 ms 3.4 ms 269.2 ms 281.2 ms

Δ (PR vs base): ↑ +7.7 ms (+2.8%)

Measured with hyperfine on ubuntu-latest (3 warmup runs, 20 timed runs). CI numbers carry ±a few ms of runner jitter; treat small deltas as noise.

@clanky-the-clanker

clanky-the-clanker Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

✅ Approved — The generator fix is correct and has regression tests for each changed path. The changeset now accurately says this only affects future command generation, which resolves the one earlier warning.

The decision is advisory: this comment never approves, blocks or requests changes on the pull request.


✅ All checks passed

🚀 Release: ✅ LGTM

Risk: Low

.changeset/audio-binary-output.md now says the fix prepares future generated commands and does not change any command shipped today. That resolves the earlier warning.


🔒 Security: ✅ LGTM

No security concerns.


📖 AGENTS.md: ✅ LGTM

The pull request follows the repository conventions: conventional commits, a patch changeset for a fix, and the generic emission rule kept in the generator plugin.


📋 Code Quality: ✅ LGTM

The audio/* checks in emit/index.ts and operation.ts follow the existing image/* handling. The tests cover each changed path:

  • output-kind classification
  • generated POST handlers
  • descriptors whose schemas lack format: binary
  • byte output from cf ai run for MP3, WAV, PNG and octet-stream responses

⚡ Performance: ✅ LGTM

No performance concerns.


📝 Documentation: ✅ LGTM

No documentation concerns.


Reviewed commit: 2b2c2dea

Comment thread packages/cli/generator/plugin/emit/index.ts
Comment thread packages/cli/generator/plugin/operation.ts
@ask-bonk

ask-bonk Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Review: 1 findings.

Posted 2 inline suggestions covering case-insensitive audio MIME handling.

github run

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant