Skip to content

fix: await async codec.compile in export_model#49

Open
nhjydywd wants to merge 1 commit into
jasonjgardner:mainfrom
nhjydywd:fix/export-await-async-compile
Open

fix: await async codec.compile in export_model#49
nhjydywd wants to merge 1 commit into
jasonjgardner:mainfrom
nhjydywd:fix/export-await-async-compile

Conversation

@nhjydywd

@nhjydywd nhjydywd commented Jul 17, 2026

Copy link
Copy Markdown

Summary

export_model did not await codec.compile(). For async codecs (e.g. glTF),
the unresolved Promise was stringified as "{}".

Before: export_model(codec_id: "gltf") → content "{}"
After: same call → real glTF JSON (non-empty, includes asset.generator)

Sync codecs that already return strings continue to work via Promise.resolve.

Test plan

  • bun run build + load dist/mcp.js
  • glTF export no longer returns "{}"
  • Spot-check a sync codec (e.g. obj) still exports

Summary by CodeRabbit

  • Bug Fixes
    • Fixed model exports for codecs that compile asynchronously.
    • Exported content is now fully processed and serialized before completion.

glTF (and other async codecs) return a Promise from compile();
without awaiting, export_model stringified it as "{}".

Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: eccfdc9e-5748-40fa-a29e-8fd212ed7574

📥 Commits

Reviewing files that changed from the base of the PR and between 6b069e3 and cc8f05e.

📒 Files selected for processing (1)
  • server/tools/export.ts

Walkthrough

The export_model tool now supports codecs whose compile() method returns either a direct value or a Promise, resolving the result before output processing and serialization.

Changes

Export model codec handling

Layer / File(s) Summary
Await codec compilation results
server/tools/export.ts
The codec registry accepts synchronous or asynchronous compile() results, and export_model resolves both forms before processing output.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Suggested reviewers: jasonjgardner

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: awaiting async codec.compile in export_model.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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