Skip to content

Cloudflare gpt-oss multi-turn tool loop fails on continuation schema #106

Closed

Description

@stackbilt-admin

Summary

generateResponseWithTools() fails on the second tool iteration for Cloudflare Workers AI @cf/openai/gpt-oss-120b.

The first inference returns a valid native tool call. After the executor runs it, the factory appends an assistant message with toolCalls plus a user message with toolResults. The Cloudflare adapter expands that into OpenAI-style tool_calls / tool_call_id messages. The Workers AI binding rejects the second request with error 5006.

Observed error

5006: Error: oneOf at '/' not met, 0 matches:
Type mismatch of '/messages/0/content', 'array' not in 'string',
Type mismatch of '/messages/1/content', 'array' not in 'string',
Type mismatch of '/messages/2/content', 'string' not in 'null',
required properties at '/messages/2' are 'role,content'

Production evidence

AEGIS task 5e585cb1-b26c-451a-91a2-9bbab9fe6309 on release 2.38.23:

  • model: @cf/openai/gpt-oss-120b
  • one successful native list_files tool call
  • failure occurs when sending the continuation round
  • durable harness transcript preserved the 5006 response

Expected

The Cloudflare adapter should serialize multi-turn tool-call continuations in a Workers AI binding-compatible form, with a regression test covering a first tool call, tool result, and second inference.

Downstream workaround

AEGIS uses an explicit bounded loop and feeds selected tools/results back as plain messages, matching Cloudflare's documented traditional function-calling continuation shape.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions