{
  "title": "Scope-order repair: executed teaching sample",
  "origin": "Original constructed miniature; scripted teacher actions executed locally. Not the original OAuthlib task or a model-generated trajectory. No model was trained.",
  "public_reference": {
    "dataset": "SWE-bench/SWE-smith",
    "instance_id": "oauthlib__oauthlib.1fd52536.combine_file__09vlzwgc",
    "url": "https://huggingface.co/datasets/SWE-bench/SWE-smith"
  },
  "demonstration": {
    "tools": [
      {
        "type": "function",
        "function": {
          "name": "read_file",
          "description": "Read a file from the workspace.",
          "parameters": {
            "type": "object",
            "properties": {
              "path": {
                "type": "string"
              }
            },
            "required": [
              "path"
            ],
            "additionalProperties": false
          }
        }
      },
      {
        "type": "function",
        "function": {
          "name": "replace_text",
          "description": "Replace one exact occurrence in a workspace file.",
          "parameters": {
            "type": "object",
            "properties": {
              "path": {
                "type": "string"
              },
              "old": {
                "type": "string"
              },
              "new": {
                "type": "string"
              }
            },
            "required": [
              "path",
              "old",
              "new"
            ],
            "additionalProperties": false
          }
        }
      },
      {
        "type": "function",
        "function": {
          "name": "run_smoke",
          "description": "Run the public smoke tests on scopes.py.",
          "parameters": {
            "type": "object",
            "properties": {},
            "additionalProperties": false
          }
        }
      }
    ],
    "messages": [
      {
        "role": "system",
        "content": "You repair Python code using the supplied workspace tools."
      },
      {
        "role": "user",
        "content": "Repair scopes.py. list_to_scope receives a list of strings, a string, or None. For a list, join its items with one space in the original order, preserving duplicates; an empty list returns an empty string. Return string inputs and None unchanged. Use read_file, replace_text and run_smoke, then report completion."
      },
      {
        "role": "assistant",
        "tool_calls": [
          {
            "id": "read_1",
            "type": "function",
            "function": {
              "name": "read_file",
              "arguments": "{\"path\": \"scopes.py\"}"
            }
          }
        ]
      },
      {
        "role": "tool",
        "tool_call_id": "read_1",
        "content": "def list_to_scope(scope):\n    if scope is None:\n        return None\n    if isinstance(scope, str):\n        return scope\n    return \" \".join(reversed(scope))\n"
      },
      {
        "role": "assistant",
        "tool_calls": [
          {
            "id": "edit_1",
            "type": "function",
            "function": {
              "name": "replace_text",
              "arguments": "{\"path\": \"scopes.py\", \"old\": \"reversed(scope)\", \"new\": \"scope\"}"
            }
          }
        ]
      },
      {
        "role": "tool",
        "tool_call_id": "edit_1",
        "content": "{\"replacement_count\": 1}"
      },
      {
        "role": "assistant",
        "tool_calls": [
          {
            "id": "test_1",
            "type": "function",
            "function": {
              "name": "run_smoke",
              "arguments": "{}"
            }
          }
        ]
      },
      {
        "role": "tool",
        "tool_call_id": "test_1",
        "content": "{\"passed\": true, \"cases\": [{\"name\": \"order_pair\", \"group\": \"FAIL_TO_PASS\", \"passed\": true}, {\"name\": \"string_unchanged\", \"group\": \"PASS_TO_PASS\", \"passed\": true}]}"
      },
      {
        "role": "assistant",
        "content": "Removed reversal from list joining. The public ordering and string-preservation smoke tests pass."
      }
    ]
  },
  "provenance_and_grader": {
    "source": "original_constructed_miniature_not_original_oauthlib_trajectory",
    "attempt": "scripted_teacher_actions_executed_locally",
    "not_a_model_training_run": true,
    "task_id": "original-scope-ordering-miniature-v1",
    "initial_source": "def list_to_scope(scope):\n    if scope is None:\n        return None\n    if isinstance(scope, str):\n        return scope\n    return \" \".join(reversed(scope))\n",
    "public_case_names": [
      "order_pair",
      "string_unchanged"
    ],
    "full_case_definitions": [
      {
        "name": "order_pair",
        "group": "FAIL_TO_PASS",
        "input": [
          "write",
          "read"
        ],
        "expected": "write read"
      },
      {
        "name": "order_three",
        "group": "FAIL_TO_PASS",
        "input": [
          "zeta",
          "alpha",
          "mu"
        ],
        "expected": "zeta alpha mu"
      },
      {
        "name": "string_unchanged",
        "group": "PASS_TO_PASS",
        "input": "read write",
        "expected": "read write"
      },
      {
        "name": "none_unchanged",
        "group": "PASS_TO_PASS",
        "input": null,
        "expected": null
      },
      {
        "name": "empty_list",
        "group": "PASS_TO_PASS",
        "input": [],
        "expected": ""
      },
      {
        "name": "duplicates",
        "group": "PASS_TO_PASS",
        "input": [
          "read",
          "write",
          "read"
        ],
        "expected": "read write read"
      }
    ],
    "independent_grader_result": {
      "passed": true,
      "cases": [
        {
          "name": "order_pair",
          "group": "FAIL_TO_PASS",
          "passed": true
        },
        {
          "name": "order_three",
          "group": "FAIL_TO_PASS",
          "passed": true
        },
        {
          "name": "string_unchanged",
          "group": "PASS_TO_PASS",
          "passed": true
        },
        {
          "name": "none_unchanged",
          "group": "PASS_TO_PASS",
          "passed": true
        },
        {
          "name": "empty_list",
          "group": "PASS_TO_PASS",
          "passed": true
        },
        {
          "name": "duplicates",
          "group": "PASS_TO_PASS",
          "passed": true
        }
      ]
    },
    "grader_not_automatically_actor_context": true,
    "recommended_loss_mask": "assistant-only; user/system/tool observations are conditioning context",
    "portability_note": "Tool-call serialization and assistant-token masking must be verified with the selected model's tokenizer/chat template and trainer."
  }
}
