Skip to content

Conversation

@vibegui
Copy link

@vibegui vibegui commented Jan 5, 2026

  • Add default empty object for callOptions destructuring to prevent 'Cannot destructure property abortSignal from null' error
  • Decode Uint8Array response.body to string for proper JSON serialization
  • Fixes LLM_DO_GENERATE and LLM_DO_STREAM when called without callOptions

Summary by cubic

Prevent crashes in LLM_DO_GENERATE and LLM_DO_STREAM when callOptions is null by defaulting destructuring to an empty object. Decode Uint8Array response.body to a string to ensure correct JSON serialization over MCP.

Written for commit 87a3212. Summary will update on new commits.

- Add default empty object for callOptions destructuring to prevent
  'Cannot destructure property abortSignal from null' error
- Decode Uint8Array response.body to string for proper JSON serialization
- Fixes LLM_DO_GENERATE and LLM_DO_STREAM when called without callOptions
@github-actions
Copy link

github-actions bot commented Jan 5, 2026

🚀 Preview Deployments Ready!

Your changes have been deployed to preview environments:

📦 openrouter

🔗 View Preview

These previews will be automatically updated with new commits to this PR.


Deployed from commit: ec95e77

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="openrouter/server/tools/llm-binding.ts">

<violation number="1" location="openrouter/server/tools/llm-binding.ts:484">
P1: Same issue: destructuring default `= {}` does not handle `null` values. Consider extracting `callOptions` first and using nullish coalescing: `const { abortSignal: _abortSignal, ...callOptions } = context.callOptions ?? {};`</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

const {
modelId,
callOptions: { abortSignal: _abortSignal, ...callOptions },
callOptions: { abortSignal: _abortSignal, ...callOptions } = {},
Copy link

@cubic-dev-ai cubic-dev-ai bot Jan 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: Same issue: destructuring default = {} does not handle null values. Consider extracting callOptions first and using nullish coalescing: const { abortSignal: _abortSignal, ...callOptions } = context.callOptions ?? {};

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At openrouter/server/tools/llm-binding.ts, line 484:

<comment>Same issue: destructuring default `= {}` does not handle `null` values. Consider extracting `callOptions` first and using nullish coalescing: `const { abortSignal: _abortSignal, ...callOptions } = context.callOptions ?? {};`</comment>

<file context>
@@ -481,7 +481,7 @@ export const createLLMStreamTool = (env: Env) =&gt;
       const {
         modelId,
-        callOptions: { abortSignal: _abortSignal, ...callOptions },
+        callOptions: { abortSignal: _abortSignal, ...callOptions } = {},
       } = context;
       env.MESH_REQUEST_CONTEXT.ensureAuthenticated();
</file context>
Fix with Cubic

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.

2 participants