Skip to content

[Bug]: fallback freeform wrappers stream raw JSON deltas then finish with unwrapped input #5047

Description

@Ingwannu

Client or integration

Streaming Responses clients using freeform custom tools.

Area

SSE custom-tool input projection.

Summary

The fallback wrappers accepted by #4983 are repaired only at completion. Partial input handling in src/bridge/sse.ts recognizes and holds only the compact {"input":" prefix.

For a newly accepted wrapper such as {"code":"const x = 1"}, the bridge streams raw JSON through response.custom_tool_call_input.delta, then publishes only const x = 1 in the done/completed item. Concatenated deltas no longer equal the authoritative final input, creating a mid-stream rewind for clients that render or accumulate tool input.

Expected behaviour

A supported wrapper must have one stable streaming representation. Hold recognized fallback-wrapper prefixes until repair is resolved, or emit deltas whose concatenation equals the final repaired input. Unsupported/ordinary freeform inputs must keep current byte behavior.

Required regressions

  • delta concatenation equals done/completed input for every accepted fallback key;
  • a wrapper split at every byte boundary does not leak raw JSON then rewind;
  • ambiguous or multi-field objects stay unrepaired and byte-exact; and
  • cancellation/EOF releases any held buffer without manufacturing a successful tool call.

Regression origin

Merged in #4983; current dev still defines only FREEFORM_WRAP_PREFIX = '{"input":"' for partial streaming.

Activity

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

    bugSomething isn't workingstreamingSSE, WebSocket, terminal stream framestoolstool_calls, MCP, web-search / sidecar tools

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions