{
  "scope": "Public retained example and task-specific verification checklist; no inference or correction executed.",
  "repairId": "fix-llamacpp-incomplete-tool-history",
  "repairURL": "https://kingy.ai/ai-fix-finder/fix-llamacpp-incomplete-tool-history/",
  "example": {
    "request": {
      "model": "kingy-repair-fixture",
      "messages": [
        {
          "role": "system",
          "content": "Call lookup_items exactly once with the two items supplied by the user. After its result reply exactly: Stock total: 37. Never invent the result."
        },
        {
          "role": "user",
          "content": "Look up items [{\"sku\":\"KINGY-017\",\"count\":2},{\"sku\":\"KINGY-042\",\"count\":1}] using lookup_items."
        },
        {
          "role": "assistant",
          "content": null,
          "tool_calls": [
            {
              "id": "call_incomplete_fixture",
              "type": "function",
              "function": {
                "name": "lookup_items",
                "arguments": "{"
              }
            }
          ]
        }
      ],
      "tools": [
        {
          "type": "function",
          "function": {
            "name": "lookup_items",
            "description": "Look up inventory for all supplied items.",
            "parameters": {
              "type": "object",
              "properties": {
                "items": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "sku": {
                        "type": "string"
                      },
                      "count": {
                        "type": "integer"
                      }
                    },
                    "required": [
                      "sku",
                      "count"
                    ],
                    "additionalProperties": false
                  }
                }
              },
              "required": [
                "items"
              ],
              "additionalProperties": false
            }
          }
        }
      ],
      "tool_choice": "required",
      "chat_template_kwargs": {
        "enable_thinking": false
      },
      "max_tokens": 256,
      "temperature": 0,
      "seed": 42,
      "cache_prompt": false
    },
    "response": {},
    "endpoint": "/v1/chat/completions",
    "context": 2048,
    "repairId": "fix-llamacpp-incomplete-tool-history",
    "runtime": "llamacpp",
    "note": "Retained repair 007 example, originally qualified 2026-10-16. This preview sends no request and does not retest the model.",
    "checks": [
      "Keep a copy of the last valid conversation checkpoint. Treat stream deltas as provisional.",
      "Use complete_call in client_fixes.py with the fixture contract to reject unfinished or malformed arguments before any history mutation or tool result.",
      "Retry the unchanged original array-of-object request from the valid checkpoint; preserve both item objects and counts.",
      "Supply one synthetic stock result using the actual returned call ID. Require Stock total: 37. and a successful following turn.",
      "For an already-corrupted conversation, restore a known valid checkpoint using the failed turn provenance. Do not delete arbitrary real history or report a failed operation as successful."
    ],
    "correction": "Stage the whole tool turn outside committed history. Require a complete tool_calls finish, the expected tool identity and valid original arguments before committing or executing it. Discard the failed staged turn and retry the unchanged original request.",
    "evidenceDate": "2026-10-16"
  }
}
