Skip to content

Conversation

@TooTallNate
Copy link
Member

@TooTallNate TooTallNate commented Jan 15, 2026

Fixed serialization issue when executing tool calls in DurableAgent.

What changed?

Modified the executeTool function in durable-agent.ts to extract the execute method from the tool object before calling it, rather than invoking it directly on the tool object. This prevents JavaScript from binding this to the tool object, which contains non-serializable properties like inputSchema.

How to test?

Test tool execution in workflows where tools have complex properties that can't be serialized. Verify that tool calls complete successfully without serialization errors.

Why make this change?

When a tool's execute function is used as a workflow step (marked with 'use step'), the step system attempts to capture and serialize this. Since the tool object contains non-serializable properties, this was causing failures. By extracting the execute function before calling it, we avoid the serialization of the entire tool object.

@changeset-bot
Copy link

changeset-bot bot commented Jan 15, 2026

🦋 Changeset detected

Latest commit: 2e34af0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@workflow/ai Patch
@workflow/docs-typecheck Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link
Contributor

vercel bot commented Jan 15, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
example-nextjs-workflow-turbopack Ready Ready Preview, Comment Jan 15, 2026 6:59pm
example-nextjs-workflow-webpack Ready Ready Preview, Comment Jan 15, 2026 6:59pm
example-workflow Ready Ready Preview, Comment Jan 15, 2026 6:59pm
workbench-astro-workflow Ready Ready Preview, Comment Jan 15, 2026 6:59pm
workbench-express-workflow Ready Ready Preview, Comment Jan 15, 2026 6:59pm
workbench-fastify-workflow Ready Ready Preview, Comment Jan 15, 2026 6:59pm
workbench-hono-workflow Ready Ready Preview, Comment Jan 15, 2026 6:59pm
workbench-nitro-workflow Ready Ready Preview, Comment Jan 15, 2026 6:59pm
workbench-nuxt-workflow Ready Ready Preview, Comment Jan 15, 2026 6:59pm
workbench-sveltekit-workflow Ready Ready Preview, Comment Jan 15, 2026 6:59pm
workbench-vite-workflow Ready Ready Preview, Comment Jan 15, 2026 6:59pm
workflow-docs Ready Ready Preview, Comment Jan 15, 2026 6:59pm

@github-actions
Copy link
Contributor

github-actions bot commented Jan 15, 2026

🧪 E2E Test Results

Some tests failed

Summary

Passed Failed Skipped Total
✅ ▲ Vercel Production 418 0 11 429
✅ 💻 Local Development 382 0 8 390
✅ 📦 Local Production 382 0 8 390
✅ 🐘 Local Postgres 382 0 8 390
✅ 🪟 Windows 39 0 0 39
❌ 🌍 Community Worlds 147 21 0 168
Total 1750 21 35 1806

❌ Failed Tests

🌍 Community Worlds (21 failed)

mongodb (1 failed):

  • webhookWorkflow

redis (1 failed):

  • webhookWorkflow

starter (18 failed):

  • addTenWorkflow
  • addTenWorkflow
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • hookCleanupTestWorkflow - hook token reuse after workflow completion
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars)
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly
  • Calculator.calculate - static workflow method using static step methods from another class
  • AllInOneService.processNumber - static workflow method using sibling static step methods
  • ChainableService.processWithThis - static step methods using this to reference the class
  • thisSerializationWorkflow - step function invoked with .call() and .apply()

turso (1 failed):

  • webhookWorkflow

Details by Category

✅ ▲ Vercel Production
App Passed Failed Skipped
✅ astro 38 0 1
✅ example 38 0 1
✅ express 38 0 1
✅ fastify 38 0 1
✅ hono 38 0 1
✅ nextjs-turbopack 38 0 1
✅ nextjs-webpack 38 0 1
✅ nitro 38 0 1
✅ nuxt 38 0 1
✅ sveltekit 38 0 1
✅ vite 38 0 1
✅ 💻 Local Development
App Passed Failed Skipped
✅ astro-stable 38 0 1
✅ express-stable 38 0 1
✅ fastify-stable 38 0 1
✅ hono-stable 38 0 1
✅ nextjs-turbopack-stable 39 0 0
✅ nextjs-webpack-stable 39 0 0
✅ nitro-stable 38 0 1
✅ nuxt-stable 38 0 1
✅ sveltekit-stable 38 0 1
✅ vite-stable 38 0 1
✅ 📦 Local Production
App Passed Failed Skipped
✅ astro-stable 38 0 1
✅ express-stable 38 0 1
✅ fastify-stable 38 0 1
✅ hono-stable 38 0 1
✅ nextjs-turbopack-stable 39 0 0
✅ nextjs-webpack-stable 39 0 0
✅ nitro-stable 38 0 1
✅ nuxt-stable 38 0 1
✅ sveltekit-stable 38 0 1
✅ vite-stable 38 0 1
✅ 🐘 Local Postgres
App Passed Failed Skipped
✅ astro-stable 38 0 1
✅ express-stable 38 0 1
✅ fastify-stable 38 0 1
✅ hono-stable 38 0 1
✅ nextjs-turbopack-stable 39 0 0
✅ nextjs-webpack-stable 39 0 0
✅ nitro-stable 38 0 1
✅ nuxt-stable 38 0 1
✅ sveltekit-stable 38 0 1
✅ vite-stable 38 0 1
✅ 🪟 Windows
App Passed Failed Skipped
✅ nextjs-turbopack 39 0 0
❌ 🌍 Community Worlds
App Passed Failed Skipped
✅ mongodb-dev 3 0 0
❌ mongodb 38 1 0
✅ redis-dev 3 0 0
❌ redis 38 1 0
✅ starter-dev 3 0 0
❌ starter 21 18 0
✅ turso-dev 3 0 0
❌ turso 38 1 0

📋 View full workflow run

Copy link
Member Author

TooTallNate commented Jan 15, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copilot AI review requested due to automatic review settings January 15, 2026 18:56
@TooTallNate TooTallNate changed the base branch from 01-09-add_support_for_custom_class_instance_serialization to graphite-base/790 January 15, 2026 18:57
@TooTallNate TooTallNate force-pushed the 01-15-avoid_attempting_to_serialize_the_tool_during_tool_call_execution branch from 119e416 to 2e34af0 Compare January 15, 2026 18:57
@TooTallNate TooTallNate changed the base branch from graphite-base/790 to main January 15, 2026 18:57
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a serialization error that occurs when executing tool calls in DurableAgent where the tool's execute function is marked with 'use step'. The workflow step system attempts to capture and serialize the this context, which fails when this is bound to the tool object containing non-serializable properties like inputSchema.

Changes:

  • Modified executeTool function to extract the execute method before calling it, preventing this binding to the tool object
  • Added changeset documenting the fix

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/ai/src/agent/durable-agent.ts Extracted execute function to avoid this binding during tool execution
.changeset/rude-suits-wonder.md Added changeset for patch version bump

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@TooTallNate TooTallNate merged commit 49a1c5f into main Jan 15, 2026
130 of 134 checks passed
@TooTallNate TooTallNate deleted the 01-15-avoid_attempting_to_serialize_the_tool_during_tool_call_execution branch January 15, 2026 21:43
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.

3 participants