Skip to content

Truncated tool-call arguments persist in history and block subsequent prompts #752

Description

@leovoon

Observed behavior

An assistant tool call was saved with a truncated function.arguments string that was not valid JSON. The local tool returned [error] missing or non-string argument: command, but the malformed assistant message remained in conversation history and in the saved session. Subsequent user prompts failed at request validation rather than allowing recovery.

Provider error (reported by user):

invalid_prompt: Invalid request: messages.70.tool_calls.0.function.arguments: arguments must be a valid JSON object string

Sanitized local evidence

  • Saved session JSON is parseable, but one nested tool-call arguments string is not.
  • The affected tool is bash; the arguments string is 750 bytes and ends inside the JSON command string.
  • Parsing that string reports Unterminated string starting at: line 1 column 12 (char 11).
  • Its paired tool response reports a missing/non-string command, rather than preventing invalid arguments from being replayed.
  • Trace metadata shows four successive failed API calls after this tool failure, all with zero context tokens and 155-byte responses. This is consistent with request rejection; traces do not contain the response bodies.

Expected behavior

Validate completed/assembled tool-call arguments as JSON objects before execution or persistence into replayable history. Interrupted or truncated calls should become a recoverable local error, not poison subsequent requests. Also validate and safely repair or quarantine legacy malformed calls when loading sessions, preserving tool-call/result pairing and other history.

The cause of the original truncation has not been established. No prompts, command payloads, local paths, or session identifiers are included in this report.

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions