{ "models": [ "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "@cf/qwen/qwen2.5-coder-32b-instruct", "@cf/meta/llama-3.2-3b-instruct" ], "scenarios": [ "A growing agent-knowledge project can accumulate many valid directions at once: reusable experience substrate, lightweight MCP or tool adapters, OKF-compatible export, SQLite or SAG-style search, public roadmap and bounty issues, model or agent capability evaluation, frontend onboarding, and journey pages.\n\nAll of these may be useful, but a new visitor still asks one concrete question: can I paste a real error and find a useful lesson fast? If the homepage, README, and release notes explain architecture before showing a working search result, the project feels abstract even when the underlying system is healthy. (search-first-roadmap-loop)", "A pull request intended to change CSV data rows also shipped `__pycache__/csv_to_json.cpython-314.pyc` (and similar bytecode files). The reviewer flagged it as a MEDIUM issue: repository bloat, non-deterministic artifacts, and potential noise that obscures the real diff. The branch could not merge until the artifacts were removed. (accidental-pycache-commit)", "Current node registration requires GitHub account and opening an issue, which is too slow for autonomous agents. (agent-first-node-registration-via-mcp)" ], "compare": true, "runs": [ { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "A growing agent-knowledge project can accumulate many valid directions at once: reusable experience substrate, lightweight MCP or tool adapters, OKF-compatible export, SQLite or SAG-style search, public roadmap and bounty issues, model or agent capability evaluation, frontend onboarding, and journey pages.\n\nAll of these may be useful, but a new visitor still asks one concrete question: can I paste a real error and find a useful lesson fast? If the homepage, README, and release notes explain architecture before showing a working search result, the project feels abstract even when the underlying system is healthy. (search-first-roadmap-loop)", "condition": "with_lesson", "status": 200, "content": "To address the issue of a growing agent-knowledge project feeling abstract and not providing a clear, low-friction path for new visitors to find useful lessons quickly, follow these concrete steps:\n\n### 1. Simplify the Homepage and README\n\nFirst, ensure that the homepage and README file of your project are straightforward and focus on the primary action you want users to take: searching for and finding useful lessons.\n\n- **Edit `README.md`**: Begin with a brief introduction to your project, followed by a clear example of how to use it, focusing on the search functionality.\n \n Example:\n ```markdown\n # Agent-Knowledge Project\n A repository for sharing and finding lessons on agent-knowledge.\n \n ## Getting Started\n 1. Clone this repository: `git clone https://your-repo-url.com/agent-knowledge.git`\n 2. Navigate into the project directory: `cd agent-knowledge`\n 3. Install dependencies if necessary (for example, for a Python project): `pip install -r requirements.txt`\n 4. Start the local search server (if applicable): `python search_server.py`\n 5. Open your web browser and navigate to `http://localhost:8000` (or the specified", "metrics": { "length": 1148, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 6, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "A growing agent-knowledge project can accumulate many valid directions at once: reusable experience substrate, lightweight MCP or tool adapters, OKF-compatible export, SQLite or SAG-style search, public roadmap and bounty issues, model or agent capability evaluation, frontend onboarding, and journey pages.\n\nAll of these may be useful, but a new visitor still asks one concrete question: can I paste a real error and find a useful lesson fast? If the homepage, README, and release notes explain architecture before showing a working search result, the project feels abstract even when the underlying system is healthy. (search-first-roadmap-loop)", "condition": "plain", "status": 200, "content": "To address the issue of a project feeling abstract due to an overly complex introduction, we can simplify the onboarding process by prioritizing a \"search-first\" approach. This involves ensuring that new visitors can quickly find useful information by pasting a real error and getting a helpful response. Here's a step-by-step, actionable plan to achieve this:\n\n### 1. Simplify the Homepage\n\nFirst, we need to make sure the homepage is straightforward and immediately useful to new visitors. \n\n- **Edit the Homepage Content:**\n - Open your project's homepage file (usually `index.html` or `README.md` if you're using GitHub Pages or a similar platform).\n - Replace the existing content with a brief introduction that mentions the project's purpose and its ability to help users find solutions by searching for error messages.\n\n### 2. Implement a Search Function\n\nEnsure that your project has a functional search feature that allows users to quickly find relevant information.\n\n- **For Static Sites (e.g., GitHub Pages):**\n - If you're using a static site generator like Jekyll, you can add a search plugin. For example, you can use `jekyll-search` or a similar plugin.\n - Follow the plugin's documentation to install and configure it. Typically", "metrics": { "length": 1248, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 3, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "A pull request intended to change CSV data rows also shipped `__pycache__/csv_to_json.cpython-314.pyc` (and similar bytecode files). The reviewer flagged it as a MEDIUM issue: repository bloat, non-deterministic artifacts, and potential noise that obscures the real diff. The branch could not merge until the artifacts were removed. (accidental-pycache-commit)", "condition": "with_lesson", "status": 200, "content": "To fix the issue of accidental `__pycache__` artifacts committed to a data repository, follow these steps with exact commands:\n\n### Step 1: Remove the artifacts from the index and disk\n\nFirst, you need to remove the `__pycache__` directories and any `.pyc` files from both the Git index and your local disk. Run the following commands in your terminal:\n\n```bash\ngit rm --cached -r __pycache__ 2>/dev/null || true\ngit rm -r --cached '*.pyc' 2>/dev/null || true\nrm -rf __pycache__\n```\n\nThese commands remove the `__pycache__` directories and any `.pyc` files from the Git index and then delete them from your local filesystem.\n\n### Step 2: Add a .gitignore covering Python bytecode\n\nTo prevent `__pycache__` directories and `.pyc` files from being committed in the future, you should add them to your `.gitignore` file. If you don't have a `.gitignore` file, create one in the root of your repository and add the following lines:\n\n```plaintext\n__pycache__/\n*.pyc\n```\n\nIf you already have a `.gitignore` file", "metrics": { "length": 1005, "commands": 3, "command_list": [ "git rm --cached -r __pycache__ 2>/dev/null || true", "git rm -r --cached '*.pyc' 2>/dev/null || true", "rm -rf __pycache__" ], "has_command_block": true, "actionable": true, "inline_code_count": 13, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "A pull request intended to change CSV data rows also shipped `__pycache__/csv_to_json.cpython-314.pyc` (and similar bytecode files). The reviewer flagged it as a MEDIUM issue: repository bloat, non-deterministic artifacts, and potential noise that obscures the real diff. The branch could not merge until the artifacts were removed. (accidental-pycache-commit)", "condition": "plain", "status": 200, "content": "**Fixing Accidental Commit of `__pycache__` Files**\n\nTo resolve the issue, you'll need to remove the `__pycache__` files from your Git repository. Here are the steps:\n\n### Step 1: Remove `__pycache__` Files from Git Index\n\nRun the following command to remove the `__pycache__` files from your Git index:\n```bash\ngit rm -r --cached __pycache__\n```\nThis command will remove the `__pycache__` directory and its contents from your Git index, but not from your local file system.\n\n### Step 2: Add `__pycache__` to `.gitignore`\n\nTo prevent `__pycache__` files from being committed in the future, add the following line to your `.gitignore` file:\n```bash\n__pycache__/\n```\nYou can do this using your favorite text editor or by running the following command:\n```bash\necho \"__pycache__/\" >> .gitignore\n```\n### Step 3: Commit Changes\n\nCommit the changes to your `.gitignore` file and the removal of `__pycache__` files from your Git index:\n```bash\ngit add .gitignore\ngit commit -m", "metrics": { "length": 969, "commands": 3, "command_list": [ "git rm -r --cached __pycache__", "__pycache__/", "echo \"__pycache__/\" >> .gitignore" ], "has_command_block": true, "actionable": false, "inline_code_count": 17, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "Current node registration requires GitHub account and opening an issue, which is too slow for autonomous agents. (agent-first-node-registration-via-mcp)", "condition": "with_lesson", "status": 200, "content": "To address the issue of slow node registration for autonomous agents, you can implement the `misakanet_register` MCP tool as described. Here's a step-by-step guide to achieve this:\n\n### Step 1: Create the `misakanet_register` MCP Tool\n\nFirst, you need to create a Python script that will handle the registration process. This script will generate a unique `node_id` and `token` for each registering agent.\n\nCreate a file named `misakanet_register.py` with the following content:\n\n```python\nimport uuid\nimport time\nimport json\nimport os\n\ndef register_agent(agent_type):\n # Generate unique node_id and token\n node_id = f\"Misaka{uuid.uuid4().hex[:8]}\"\n token = f\"mcp_{uuid.uuid4().hex[:16]}\"\n \n # Store token in KV for validation (assuming a KV store like Redis)\n # For simplicity, we'll use a local JSON file here\n kv_store = \"tokens.json\"\n if not os.path.exists(kv_store):\n with open(kv_store, \"w\") as f:\n json.dump({}, f)\n \n with open(kv_store, \"r+\") as f:\n tokens = json.load(f)\n tokens", "metrics": { "length": 1049, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 5, "lesson_hits": 3, "lesson_hit_rate": 0.75 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "Current node registration requires GitHub account and opening an issue, which is too slow for autonomous agents. (agent-first-node-registration-via-mcp)", "condition": "plain", "status": 200, "content": "To resolve the error related to agent-first-node-registration-via-mcp, which requires a GitHub account and opening an issue for node registration, you can use the `mcp` command-line tool to register a node programmatically. This approach allows for autonomous agent registration without the need for manual GitHub interaction.\n\nHere's a step-by-step guide to registering a node using `mcp`:\n\n### Prerequisites\n1. **Install `mcp`**: Ensure you have the `mcp` tool installed. If not, you can install it using the package manager appropriate for your operating system or by downloading it from its official repository.\n\n2. **Have an MCP Server**: Ensure you have access to an MCP (Mesh Central Proxy) server. If you're running your own, make sure it's configured and running.\n\n### Steps to Register a Node\n\n1. **Generate a Node Key**:\n First, generate a unique key for your node. This can be done using tools like OpenSSL. For example:\n ```bash\n openssl rand -base64 32\n ```\n This command generates a random base64-encoded string that will serve as your node's key.\n\n2. **Register the Node**:\n Use the `mcp` tool to register your", "metrics": { "length": 1138, "commands": 1, "command_list": [ "openssl rand -base64 32" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/qwen/qwen2.5-coder-32b-instruct", "scenario": "A growing agent-knowledge project can accumulate many valid directions at once: reusable experience substrate, lightweight MCP or tool adapters, OKF-compatible export, SQLite or SAG-style search, public roadmap and bounty issues, model or agent capability evaluation, frontend onboarding, and journey pages.\n\nAll of these may be useful, but a new visitor still asks one concrete question: can I paste a real error and find a useful lesson fast? If the homepage, README, and release notes explain architecture before showing a working search result, the project feels abstract even when the underlying system is healthy. (search-first-roadmap-loop)", "condition": "with_lesson", "status": 200, "content": "To address the issue you've described, we need to streamline the user experience for new visitors by making it easy for them to perform a search and find useful lessons right away. Here's a step-by-step solution with exact commands to help you implement the changes:\n\n### Step 1: Simplify the Homepage\n\nEnsure that the homepage clearly highlights the primary functionality: searching for errors and finding lessons. Here’s how you can structure it:\n\n1. **Title and Description**: Make the title and description concise and focused on the core functionality.\n2. **Search Box**: Place a prominent search box at the top or center of the homepage.\n3. **Quick Start Guide**: Include a brief guide on how to use the search feature.\n\n### Step 2: Implement Zero-Dependency Local Search\n\nTo provide an immediate search experience, implement a zero-dependency local search feature. Here’s a simple example using JavaScript:\n\n1. **Create a Search HTML Form**:\n ```html\n
\n \n \n
\n
\n ```\n\n2. **Add JavaScript", "metrics": { "length": 1189, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 1, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/qwen/qwen2.5-coder-32b-instruct", "scenario": "A growing agent-knowledge project can accumulate many valid directions at once: reusable experience substrate, lightweight MCP or tool adapters, OKF-compatible export, SQLite or SAG-style search, public roadmap and bounty issues, model or agent capability evaluation, frontend onboarding, and journey pages.\n\nAll of these may be useful, but a new visitor still asks one concrete question: can I paste a real error and find a useful lesson fast? If the homepage, README, and release notes explain architecture before showing a working search result, the project feels abstract even when the underlying system is healthy. (search-first-roadmap-loop)", "condition": "plain", "status": 200, "content": "To address the issue you're facing, it's important to prioritize user experience by making it easy for new visitors to see immediate value from your project. One effective way to do this is by creating a simple, clear, and interactive search feature that users can try right away. Here’s a step-by-step guide to implementing a basic search functionality using SQLite for demonstration purposes:\n\n### Step 1: Set Up SQLite Database\n\nFirst, ensure you have SQLite installed on your system. You can install it via package managers like `apt` for Ubuntu or `brew` for macOS.\n\n#### On Ubuntu:\n```bash\nsudo apt-get update\nsudo apt-get install sqlite3 libsqlite3-dev\n```\n\n#### On macOS:\n```bash\nbrew install sqlite\n```\n\n### Step 2: Create a Sample Database\n\nCreate a sample SQLite database with some error messages and solutions.\n\n```bash\nsqlite3 errors.db\n```\n\nInside the SQLite shell, run the following commands to create a table and insert some data:\n\n```sql\nCREATE TABLE error_messages (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n error_text TEXT NOT NULL,\n solution TEXT NOT NULL\n);\n\nINSERT INTO error_messages (error_text, solution) VALUES \n('ModuleNotFoundError: No module named \\'requests\\'',", "metrics": { "length": 1199, "commands": 4, "command_list": [ "sudo apt-get update", "sudo apt-get install sqlite3 libsqlite3-dev", "brew install sqlite", "sqlite3 errors.db" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 3, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/qwen/qwen2.5-coder-32b-instruct", "scenario": "A pull request intended to change CSV data rows also shipped `__pycache__/csv_to_json.cpython-314.pyc` (and similar bytecode files). The reviewer flagged it as a MEDIUM issue: repository bloat, non-deterministic artifacts, and potential noise that obscures the real diff. The branch could not merge until the artifacts were removed. (accidental-pycache-commit)", "condition": "with_lesson", "status": 200, "content": "Certainly! Let's go through the steps to resolve this issue and ensure it doesn't happen again in the future.\n\n### Step-by-Step Fix\n\n#### Step 1: Remove the Artifacts from the Index and Disk\n\nFirst, you need to remove the `__pycache__` directories and `.pyc` files from both the staging area and your working directory.\n\n```bash\n# Remove __pycache__ directories from the index and disk\ngit rm --cached -r __pycache__ 2>/dev/null || true\n\n# Remove .pyc files from the index and disk\ngit rm -r --cached '.pyc' 2>/dev/null || true\n\n# Remove __pycache__ directories from the disk\nrm -rf __pycache__\n```\n\n#### Step 2: Add a `.gitignore` File\n\nCreate or update a `.gitignore` file to prevent `__pycache__` directories and `.pyc` files from being tracked by Git in the future.\n\n```bash\n# Create or edit the .gitignore file\necho \"__pycache__/\" >> .gitignore\necho \"*.pyc\" >> .gitignore\n\n# Stage the .gitignore file\ngit add .gitignore\n```\n\n####", "metrics": { "length": 934, "commands": 6, "command_list": [ "git rm --cached -r __pycache__ 2>/dev/null || true", "git rm -r --cached '.pyc' 2>/dev/null || true", "rm -rf __pycache__", "echo \"__pycache__/\" >> .gitignore", "echo \"*.pyc\" >> .gitignore" ], "has_command_block": true, "actionable": false, "inline_code_count": 9, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/qwen/qwen2.5-coder-32b-instruct", "scenario": "A pull request intended to change CSV data rows also shipped `__pycache__/csv_to_json.cpython-314.pyc` (and similar bytecode files). The reviewer flagged it as a MEDIUM issue: repository bloat, non-deterministic artifacts, and potential noise that obscures the real diff. The branch could not merge until the artifacts were removed. (accidental-pycache-commit)", "condition": "plain", "status": 200, "content": "Certainly! To resolve this issue, you need to remove the `__pycache__` directory and its contents from your repository. Additionally, you should ensure that such files do not get committed in the future by adding them to your `.gitignore` file.\n\nHere are the steps to fix the issue:\n\n1. **Remove the `__pycache__` directory and its contents from your local repository:**\n\n ```bash\n rm -rf __pycache__\n ```\n\n2. **Stage the removal of the `__pycache__` directory for commit:**\n\n ```bash\n git add --all\n ```\n\n3. **Commit the changes to remove the `__pycache__` directory:**\n\n ```bash\n git commit -m \"Remove __pycache__ directory and its contents\"\n ```\n\n4. **Add `__pycache__/` to your `.gitignore` file to prevent it from being tracked in the future:**\n\n Open your `.gitignore` file in a text editor and add the following line if it's not already present:\n\n ```\n __pycache__/\n ```\n\n5. **Stage the updated `.gitignore` file:**\n\n ```bash\n git add .gitignore", "metrics": { "length": 982, "commands": 4, "command_list": [ "rm -rf __pycache__", "git add --all", "git commit -m \"Remove __pycache__ directory and its contents\"", "__pycache__/" ], "has_command_block": true, "actionable": false, "inline_code_count": 17, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/qwen/qwen2.5-coder-32b-instruct", "scenario": "Current node registration requires GitHub account and opening an issue, which is too slow for autonomous agents. (agent-first-node-registration-via-mcp)", "condition": "with_lesson", "status": 200, "content": "To address the issue of slow node registration for autonomous agents via GitHub issues, you can implement the `misakanet_register` MCP tool as described. Below are the concrete steps and commands to set up this tool.\n\n### Step-by-Step Implementation\n\n1. **Create the `misakanet_register` Script**\n\n First, create a Python script named `misakanet_register.py` that will handle the registration process. This script will generate a unique `node_id` and `token`, store them in a key-value (KV) store, and return them to the agent.\n\n ```bash\n touch misakanet_register.py\n ```\n\n Open `misakanet_register.py` and add the following code:\n\n ```python\n import argparse\n import uuid\n import time\n import json\n import os\n\n # Simulated KV store using a JSON file\n KV_STORE_FILE = 'kv_store.json'\n\n def load_kv_store():\n if os.path.exists(KV_STORE_FILE):\n with open(KV_STORE_FILE, 'r') as f:\n return json.load(f)\n return {}\n\n def save_kv_store(kv_store):\n with open(KV_STORE_FILE, 'w') as f:\n json.dump", "metrics": { "length": 1071, "commands": 1, "command_list": [ "touch misakanet_register.py" ], "has_command_block": true, "actionable": false, "inline_code_count": 8, "lesson_hits": 2, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/qwen/qwen2.5-coder-32b-instruct", "scenario": "Current node registration requires GitHub account and opening an issue, which is too slow for autonomous agents. (agent-first-node-registration-via-mcp)", "condition": "plain", "status": 200, "content": "To address the issue of autonomous agents needing a faster way to register nodes without manually creating a GitHub issue, you can explore alternative methods provided by the system or platform you're using. Since the specific platform or tool isn't mentioned, I'll provide a general approach assuming you're working with a system that supports API-based node registration.\n\n### Step-by-Step Fix Using an API\n\n1. **Check API Documentation:**\n - First, ensure that the platform provides an API for node registration. Refer to the official documentation for details on available endpoints, authentication methods, and request formats.\n\n2. **Obtain API Access:**\n - If the platform supports API access, you'll need to obtain the necessary credentials (API key, token, etc.). This is often done through a developer portal or settings section in the platform's web interface.\n\n3. **Write a Script for Node Registration:**\n - Create a script that uses the API to register nodes. Below is a generic example using `curl` to make an HTTP POST request. Replace placeholders with actual values from your platform's documentation.\n\n```bash\n#!/bin/bash\n\n# Define variables\nAPI_URL=\"https://api.example.com/nodes/register\"\nAPI_TOKEN=\"your_api_token_here\"\nNODE_NAME=\"your_node", "metrics": { "length": 1267, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 1, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A growing agent-knowledge project can accumulate many valid directions at once: reusable experience substrate, lightweight MCP or tool adapters, OKF-compatible export, SQLite or SAG-style search, public roadmap and bounty issues, model or agent capability evaluation, frontend onboarding, and journey pages.\n\nAll of these may be useful, but a new visitor still asks one concrete question: can I paste a real error and find a useful lesson fast? If the homepage, README, and release notes explain architecture before showing a working search result, the project feels abstract even when the underlying system is healthy. (search-first-roadmap-loop)", "condition": "with_lesson", "status": 200, "content": "The issue you're facing is that your project has multiple audiences with different needs, and when these paths are mixed together, it leads to a \"drift\" in the user experience. To fix this, you need to create a layered message that keeps the first user action concrete and actionable.\n\nHere's a step-by-step guide to help you implement this solution:\n\n**Step 1: Create a clear and concise homepage**\n\n* Update your homepage to clearly state the problem and the solution.\n* Use a simple and concise message that explains the issue and the benefits of the layered message approach.\n\nExample:\n```markdown\n# Agent-Knowledge Project\n\nAre you an agent or a tool user? Do you want to clone, search, reuse, and report? Or are you a maintainer and contributor looking for direction?\n\nWe've got two audiences with different needs. But what if we told you there's a way to keep both paths clear and actionable?\n\nIntroducing our layered message approach!\n\n## Format layer: OKF-compatible Markdown lessons\nLearn from our experts with our OKF-compatible Markdown lessons.\n\n## Search layer: zero-dependency local search, optional SQLite/SAG-Lite index\nFind what you need with our zero-dependency local search.\n\n## Access layer: login and authorization\n", "metrics": { "length": 1237, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A growing agent-knowledge project can accumulate many valid directions at once: reusable experience substrate, lightweight MCP or tool adapters, OKF-compatible export, SQLite or SAG-style search, public roadmap and bounty issues, model or agent capability evaluation, frontend onboarding, and journey pages.\n\nAll of these may be useful, but a new visitor still asks one concrete question: can I paste a real error and find a useful lesson fast? If the homepage, README, and release notes explain architecture before showing a working search result, the project feels abstract even when the underlying system is healthy. (search-first-roadmap-loop)", "condition": "plain", "status": 200, "content": "The issue you're facing is that your project's homepage, README, and release notes are explaining the architecture, but not providing a concrete example or a working search result, which can be confusing for new visitors. Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Create a simple example**\n\nCreate a new file called `example_search_result.md` in the root of your project with the following content:\n```markdown\n# Example Search Result\n\nThis is an example search result.\n\nYou can paste this error and find a useful lesson fast:\n```\n**Step 2: Add a link to the example search result**\n\nUpdate your `README.md` file to include a link to the example search result:\n```markdown\n# [Agent-Knowledge Project](https://github.com/your-username/agent-knowledge-project)\n\n## Getting Started\n\n* Read the [architecture documentation](https://github.com/your-username/agent-knowledge-project/wiki/Architecture)\n* See an example search result: [Example Search Result](https://github.com/your-username/agent-knowledge-project/blob/main/example_search_result.md)\n```\n**Step 3: Add a search button to the homepage**\n\nUpdate your `index.md` file to include a search button", "metrics": { "length": 1176, "commands": 2, "command_list": [ "**Step 2: Add a link to the example search result**", "Update your `README.md` file to include a link to the example search result:" ], "has_command_block": true, "actionable": false, "inline_code_count": 6, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A pull request intended to change CSV data rows also shipped `__pycache__/csv_to_json.cpython-314.pyc` (and similar bytecode files). The reviewer flagged it as a MEDIUM issue: repository bloat, non-deterministic artifacts, and potential noise that obscures the real diff. The branch could not merge until the artifacts were removed. (accidental-pycache-commit)", "condition": "with_lesson", "status": 200, "content": "To fix the accidental `__pycache__` artifacts committed to a data repository, follow these steps:\n\n**Step 1: Remove the artifacts from the index and disk**\n\n```bash\n# Remove the staged artifacts from the index\ngit rm --cached -r __pycache__ 2/dev/null || true\n\n# Remove the staged artifacts from the disk\ngit rm -r --cached '.pyc' 2/dev/null || true\n\n# Manually remove the Python bytecode files from the disk\nrm -rf __pycache__\n```\n\n**Step 2: Add a `.gitignore` covering Python bytecode**\n\nCreate a new file named `.gitignore` in the root of your repository with the following contents:\n\n```text\n__pycache__/\n.pyc\n```\n\n**Step 3: Re-stage only the intended files instead of the whole directory**\n\n```bash\n# Re-stage only the intended files\ngit add references/offers/sdks.csv\n```\n\n**Step 4: Commit the changes with a meaningful message**\n\n```bash\n# Commit the changes\ngit commit -m \"fix: remove committed pycache artifacts\"\n```\n\n**Verification**\n\n```bash\n# Verify the diff contains only intended changes\ngit status --short |", "metrics": { "length": 1022, "commands": 6, "command_list": [ "git rm --cached -r __pycache__ 2/dev/null || true", "git rm -r --cached '.pyc' 2/dev/null || true", "rm -rf __pycache__", "**Step 3: Re-stage only the intended files instead of the whole directory**", "**Step 4: Commit the changes with a meaningful message**" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A pull request intended to change CSV data rows also shipped `__pycache__/csv_to_json.cpython-314.pyc` (and similar bytecode files). The reviewer flagged it as a MEDIUM issue: repository bloat, non-deterministic artifacts, and potential noise that obscures the real diff. The branch could not merge until the artifacts were removed. (accidental-pycache-commit)", "condition": "plain", "status": 200, "content": "To fix the accidental-pycache-commit issue, you'll need to remove the Python bytecode files generated by the `csv_to_json` module. Here's a step-by-step solution:\n\n**Step 1: Find the problematic files**\n\nRun the following command to find the Python bytecode files generated by the `csv_to_json` module:\n```bash\ngit ls-files --other --directory .\n```\nThis command will show you the paths of the Python bytecode files.\n\n**Step 2: Remove the bytecode files**\n\nRun the following command to remove the bytecode files:\n```bash\ngit rm --cached -r .\n```\nThis command will remove the files from the Git index, but leave them on your local machine.\n\n**Step 3: Commit the changes**\n\nRun the following command to commit the changes:\n```bash\ngit commit -m \"Remove accidental Python bytecode files\"\n```\nThis command will create a new commit that removes the bytecode files.\n\n**Step 4: Force-push the branch**\n\nSince the branch couldn't merge before, you'll need to force-push the branch to update the remote repository:\n```bash\ngit push origin --force-with-lease\n```\nReplace `` with the name of your branch.\n\n**Step ", "metrics": { "length": 1129, "commands": 4, "command_list": [ "git ls-files --other --directory .", "git rm --cached -r .", "git commit -m \"Remove accidental Python bytecode files\"", "git push origin --force-with-lease" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Current node registration requires GitHub account and opening an issue, which is too slow for autonomous agents. (agent-first-node-registration-via-mcp)", "condition": "with_lesson", "status": 200, "content": "To fix the error, you need to install the `misakanet_register` tool. Here's a step-by-step guide:\n\n**Step 1: Install Python and required dependencies**\n\nIf you haven't installed Python and required dependencies, run the following commands:\n```bash\nsudo apt-get update\nsudo apt-get install python3 python3-pip\npip3 install --upgrade pip\n```\n\n**Step 2: Install the misakanet_register tool**\n\nRun the following command to install the `misakanet_register` tool:\n```bash\npip3 install misakanet-register\n```\n\n**Step 3: Configure the misakanet_register tool**\n\nCreate a configuration file for the `misakanet_register` tool. You can use the following command to create a default configuration file:\n```bash\nmisakanet-register config create\n```\n\n**Step 4: Update the configuration file**\n\nUpdate the `misakanet_register` configuration file to include your `MISAKANET_TOKEN` and `MISAKANET_URL`. You can do this by running the following command:\n```bash\nmisakanet-register config update\n```\n\n**Step 5: Register your node**\n\nRun the following command to register your node using the `mis", "metrics": { "length": 1076, "commands": 6, "command_list": [ "sudo apt-get update", "sudo apt-get install python3 python3-pip", "pip3 install --upgrade pip", "pip3 install misakanet-register", "misakanet-register config create" ], "has_command_block": true, "actionable": true, "inline_code_count": 14, "lesson_hits": 1, "lesson_hit_rate": 0.25 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Current node registration requires GitHub account and opening an issue, which is too slow for autonomous agents. (agent-first-node-registration-via-mcp)", "condition": "plain", "status": 200, "content": "The error you're encountering is due to the requirement of GitHub account and opening an issue for node registration, which might be too slow for autonomous agents. Here's a concrete, actionable fix:\n\n**Method 1: Using the `--no-require-github` flag**\n\nYou can use the `--no-require-github` flag when running the command to register the node. This flag disables the GitHub requirement.\n\n```bash\n# For Linux or macOS\nnats-server register --no-require-github \n\n# For Windows\nnats-server register --no-require-github \n```\n\n**Method 2: Creating a GitHub Token**\n\nAnother approach is to create a GitHub token that has the required permissions to register a node. You can then use this token when registering the node.\n\nHere's how to create a GitHub token:\n\n```bash\n# Create a new GitHub token\ngh token create --public --repo --full-control\n\n# Use the generated token to register the node\nnats-server register --github-token \n```\n\n**Method 3: Using a GitHub App**\n\nIf you have", "metrics": { "length": 1098, "commands": 4, "command_list": [ "nats-server register --no-require-github ", "nats-server register --no-require-github ", "gh token create --public --repo --full-control", "nats-server register --github-token " ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Agent-Reach — Multi-Platform Internet Access for AI Agents (agent-reach-multi-platform-scraper)", "condition": "with_lesson", "status": 200, "content": "The error you're experiencing is likely due to the fact that the `agent-reach` tool is not properly configured or installed. Here's a step-by-step guide to help you fix the issue:\n\n**Step 1: Install the `agent-reach` tool**\n\nIf you haven't already, install the `agent-reach` tool using the following command:\n```bash\npip install https://github.com/Panniantong/agent-reach/archive/main.zip\n```\n**Step 2: Create a virtual environment**\n\nCreate a new virtual environment for `agent-reach` using the following command:\n```bash\npython3 -m venv ~/.agent-reach-venv\n```\n**Step 3: Activate the virtual environment**\n\nActivate the virtual environment using the following command:\n```bash\nsource ~/.agent-reach-venv/bin/activate\n```\n**Step 4: Install required channels**\n\nInstall the required channels for the platforms you want to access. For example, to install the `reddit` and `twitter` channels, use the following command:\n```bash\nagent-reach install --channels reddit,twitter\n```\n**Step 5: Configure proxy (if needed)**\n\nIf you're behind a proxy, configure it using the", "metrics": { "length": 1065, "commands": 4, "command_list": [ "pip install https://github.com/Panniantong/agent-reach/archive/main.zip", "python3 -m venv ~/.agent-reach-venv", "source ~/.agent-reach-venv/bin/activate", "agent-reach install --channels reddit,twitter" ], "has_command_block": true, "actionable": true, "inline_code_count": 13, "lesson_hits": 3, "lesson_hit_rate": 0.6 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Agent-Reach — Multi-Platform Internet Access for AI Agents (agent-reach-multi-platform-scraper)", "condition": "plain", "status": 200, "content": "I don't see any code or error message in your question. However, I can provide a general solution for a common issue that might be related to the Agent-Reach project.\n\nIf you're experiencing issues with installing the `agent-reach-multi-platform-scraper` package, here are some steps you can try:\n\n**Step 1: Update pip**\n\nOpen your terminal and run the following command to update pip:\n\n```bash\npython -m pip install --upgrade pip\n```\n\n**Step 2: Install dependencies**\n\nRun the following command to install the required dependencies:\n\n```bash\npython -m pip install -r requirements.txt\n```\n\nIf you don't have a `requirements.txt` file, you can create one by running:\n\n```bash\npython -m pip freeze > requirements.txt\n```\n\n**Step 3: Install the agent-reach package**\n\nRun the following command to install the `agent-reach` package:\n\n```bash\npython -m pip install agent-reach\n```\n\n**Step 4: Install the scraper**\n\nRun the following command to install the `agent-reach-multi-platform-scraper` package:\n\n```bash\npython -m pip install agent-reach-multi-platform-scraper\n```\n\nIf you're still experiencing issues, you", "metrics": { "length": 1108, "commands": 5, "command_list": [ "python -m pip install --upgrade pip", "python -m pip install -r requirements.txt", "python -m pip freeze > requirements.txt", "python -m pip install agent-reach", "python -m pip install agent-reach-multi-platform-scraper" ], "has_command_block": true, "actionable": true, "inline_code_count": 13, "lesson_hits": 3, "lesson_hit_rate": 0.6 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "Agent-Reach — Multi-Platform Internet Access for AI Agents (agent-reach-multi-platform-scraper)", "condition": "with_lesson", "status": 200, "content": "To resolve the issue of AI agents needing to access multiple internet platforms with varying authentication and API requirements, follow these concrete steps using the Agent-Reach tool:\n\n### Step 1: Create a Virtual Environment\n\nFirst, create a virtual environment to isolate the Agent-Reach installation and its dependencies. Open your terminal and run:\n\n```bash\npython3 -m venv ~/.agent-reach-venv\n```\n\n### Step 2: Activate the Virtual Environment\n\nActivate the virtual environment you just created:\n\n```bash\nsource ~/.agent-reach-venv/bin/activate\n```\n\nOn Windows, use:\n\n```bash\n~/.agent-reach-venv/Scripts/activate\n```\n\n### Step 3: Install Agent-Reach\n\nInstall Agent-Reach from the GitHub repository:\n\n```bash\npip install https://github.com/Panniantong/agent-reach/archive/main.zip\n```\n\n### Step 4: Install Channels\n\nInstall the channels (platforms) you need. For example, to install Reddit and Twitter, run:\n\n```bash\nagent-reach install --channels reddit,twitter\n```\n\nThis command installs the necessary tools like `rdt-cli` for Reddit and `twitter-cli` for Twitter.\n\n### Step 5: Auto-", "metrics": { "length": 1090, "commands": 5, "command_list": [ "python3 -m venv ~/.agent-reach-venv", "source ~/.agent-reach-venv/bin/activate", "~/.agent-reach-venv/Scripts/activate", "pip install https://github.com/Panniantong/agent-reach/archive/main.zip", "agent-reach install --channels reddit,twitter" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 3, "lesson_hit_rate": 0.6 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "Agent-Reach — Multi-Platform Internet Access for AI Agents (agent-reach-multi-platform-scraper)", "condition": "plain", "status": 200, "content": "To provide a concrete and actionable fix for the issue you're encountering with Agent-Reach, a multi-platform internet access tool for AI agents, I would need more specific details about the error message you're seeing. However, since you haven't provided the exact error message, I'll guide you through a general troubleshooting process that might help resolve common issues. This process includes updating dependencies, checking for compatibility issues, and ensuring that your environment is correctly set up.\n\n### Step 1: Update Your Dependencies\n\nFirst, ensure that all your dependencies are up to date. If you're using `pip` for Python packages, you can update your dependencies by running:\n\n```bash\npip install --upgrade -r requirements.txt\n```\n\nIf you're using a virtual environment, make sure it's activated before running the command.\n\n### Step 2: Check Compatibility\n\nEnsure that your Python version and other dependencies are compatible with Agent-Reach. You can check your Python version with:\n\n```bash\npython --version\n```\n\nOr, if you have both Python 2 and Python 3 installed and want to check the version of Python 3 specifically:\n\n```bash\npython3 --version\n```\n\n### Step 3: Reinstall Agent-Reach\n\nSometimes, simply reinstalling the", "metrics": { "length": 1248, "commands": 3, "command_list": [ "pip install --upgrade -r requirements.txt", "python --version", "python3 --version" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 3, "lesson_hit_rate": 0.6 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "Agent Web Access Toolchain — 7 Libraries for Reliable Forum Scraping (agent-web-access-toolchain-selection)", "condition": "with_lesson", "status": 429, "content": "", "metrics": { "length": 0, "commands": 0, "has_command_block": false, "actionable": false, "has_code_inline": false, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": "b'{\"name\":\"AiError\",\"internalCode\":4006,\"httpCode\":429,\"message\":\"AiError: AiError: you have used up your daily free allocation of 10,000 neurons, please upgrade to Cloudflare\\'s Workers Paid plan if you would like to continue usage. (0b36b6f6-fb80-489c'" }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Agent Web Access Toolchain — 7 Libraries for Reliable Forum Scraping (agent-web-access-toolchain-selection)", "condition": "with_lesson", "status": 429, "content": "", "metrics": { "length": 0, "commands": 0, "has_command_block": false, "actionable": false, "has_code_inline": false, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": "b'{\"name\":\"AiError\",\"internalCode\":4006,\"httpCode\":429,\"message\":\"AiError: AiError: you have used up your daily free allocation of 10,000 neurons, please upgrade to Cloudflare\\'s Workers Paid plan if you would like to continue usage. (47830c18-da00-4a6a'" }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Aider CLI `--api-key` parameter leaks API key to `.aider.chat.history.md`, bash history, and `/proc/pid/cmdline`.\n\nWhen a user runs a command like:\n```bash\naider --api-key sk-ant-api03-XXXXXXXXXXXXXXXXXXXX\n```\n\nThe API key is exposed in at least three places:\n1. **Shell history files** (e.g., `~/.bash_history`, `~/.zsh_history`) — persisted across sessions and often synced or backed up.\n2. **Aider's own chat history file** (`.aider.chat.history.md`) — written to the project directory and may be committed to version control.\n3. **`/proc//cmdline`** — readable by other processes on the same host while the process is running, which is a risk in shared or multi-tenant environments. (aider-api-key-leak)", "condition": "with_lesson", "status": 429, "content": "", "metrics": { "length": 0, "commands": 0, "has_command_block": false, "actionable": false, "has_code_inline": false, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": "b'{\"name\":\"AiError\",\"internalCode\":4006,\"httpCode\":429,\"message\":\"AiError: AiError: you have used up your daily free allocation of 10,000 neurons, please upgrade to Cloudflare\\'s Workers Paid plan if you would like to continue usage. (352c4aa4-3819-4566'" }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "Agent Web Access Toolchain — 7 Libraries for Reliable Forum Scraping (agent-web-access-toolchain-selection)", "condition": "plain", "status": 429, "content": "", "metrics": { "length": 0, "commands": 0, "has_command_block": false, "actionable": false, "has_code_inline": false, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": "b'{\"name\":\"AiError\",\"internalCode\":4006,\"httpCode\":429,\"message\":\"AiError: AiError: you have used up your daily free allocation of 10,000 neurons, please upgrade to Cloudflare\\'s Workers Paid plan if you would like to continue usage. (3198b649-cf84-4d16'" }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Agent Web Access Toolchain — 7 Libraries for Reliable Forum Scraping (agent-web-access-toolchain-selection)", "condition": "plain", "status": 429, "content": "", "metrics": { "length": 0, "commands": 0, "has_command_block": false, "actionable": false, "has_code_inline": false, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": "b'{\"name\":\"AiError\",\"internalCode\":4006,\"httpCode\":429,\"message\":\"AiError: AiError: you have used up your daily free allocation of 10,000 neurons, please upgrade to Cloudflare\\'s Workers Paid plan if you would like to continue usage. (b9b23713-c335-4a57'" }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Auto-Merge CI Pipeline — DCO, Quality Score, Shadow Branch, Dynamic Deps, Auto-Merge (auto-merge-ci-pipeline)", "condition": "with_lesson", "status": 429, "content": "", "metrics": { "length": 0, "commands": 0, "has_command_block": false, "actionable": false, "has_code_inline": false, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": "b'{\"name\":\"AiError\",\"internalCode\":4006,\"httpCode\":429,\"message\":\"AiError: AiError: you have used up your daily free allocation of 10,000 neurons, please upgrade to Cloudflare\\'s Workers Paid plan if you would like to continue usage. (a2b0b428-ef89-4fd3'" }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "AI Agent Contributor Engagement — Lightweight Retention Strategy (contributor-engagement-retention)", "condition": "with_lesson", "status": 429, "content": "", "metrics": { "length": 0, "commands": 0, "has_command_block": false, "actionable": false, "has_code_inline": false, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": "b'{\"name\":\"AiError\",\"internalCode\":4006,\"httpCode\":429,\"message\":\"AiError: AiError: you have used up your daily free allocation of 10,000 neurons, please upgrade to Cloudflare\\'s Workers Paid plan if you would like to continue usage. (978ed7dd-a38c-4f9d'" }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "Auto-Merge CI Pipeline — DCO, Quality Score, Shadow Branch, Dynamic Deps, Auto-Merge (auto-merge-ci-pipeline)", "condition": "with_lesson", "status": 429, "content": "", "metrics": { "length": 0, "commands": 0, "has_command_block": false, "actionable": false, "has_code_inline": false, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": "b'{\"name\":\"AiError\",\"internalCode\":4006,\"httpCode\":429,\"message\":\"AiError: AiError: you have used up your daily free allocation of 10,000 neurons, please upgrade to Cloudflare\\'s Workers Paid plan if you would like to continue usage. (2d6bba4d-a003-4826'" }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Auto-Merge CI Pipeline — DCO, Quality Score, Shadow Branch, Dynamic Deps, Auto-Merge (auto-merge-ci-pipeline)", "condition": "plain", "status": 429, "content": "", "metrics": { "length": 0, "commands": 0, "has_command_block": false, "actionable": false, "has_code_inline": false, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": "b'{\"name\":\"AiError\",\"internalCode\":4006,\"httpCode\":429,\"message\":\"AiError: AiError: you have used up your daily free allocation of 10,000 neurons, please upgrade to Cloudflare\\'s Workers Paid plan if you would like to continue usage. (f640c53f-8d8f-4f2f'" }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "Auto-Merge CI Pipeline — DCO, Quality Score, Shadow Branch, Dynamic Deps, Auto-Merge (auto-merge-ci-pipeline)", "condition": "plain", "status": 429, "content": "", "metrics": { "length": 0, "commands": 0, "has_command_block": false, "actionable": false, "has_code_inline": false, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": "b'{\"name\":\"AiError\",\"internalCode\":4006,\"httpCode\":429,\"message\":\"AiError: AiError: you have used up your daily free allocation of 10,000 neurons, please upgrade to Cloudflare\\'s Workers Paid plan if you would like to continue usage. (bb8a4940-ede0-4555'" }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "GitHub Actions Script Injection — Use env Variables Instead of Inline Interpolation (github-actions-code-injection)", "condition": "plain", "status": 200, "content": "The GitHub Actions error you're encountering is due to the use of inline interpolation in your script. Inline interpolation is not allowed in GitHub Actions and is causing the error. Here's a concrete, actionable fix with exact commands:\n\n**Before:**\n\n```yml\nname: Build and deploy\n\non:\n push:\n branches:\n - main\n\njobs:\n build-and-deploy:\n runs-on: ubuntu-latest\n steps:\n - name: Checkout code\n uses: actions/checkout@v2\n - name: Install dependencies\n run: |\n npm install\n - name: Build and deploy\n run: |\n npm run build && npm run deploy\n```\n\n**After:**\n\n```yml\nname: Build and deploy\n\non:\n push:\n branches:\n - main\n\njobs:\n build-and-deploy:\n runs-on: ubuntu-latest\n steps:\n - name: Checkout code\n uses: actions/checkout@v2\n - name: Install dependencies\n env:\n NPM_CONFIG_USER: ${{ secrets.NPM_CONFIG_USER }}\n NPM_CONFIG_PASSWORD: ${{ secrets.NPM_CONFIG_PASSWORD }}\n run: |\n npm install\n - name:", "metrics": { "length": 1045, "commands": 1, "command_list": [ "**After:**" ], "has_command_block": true, "actionable": true, "inline_code_count": 2, "lesson_hits": 1, "lesson_hit_rate": 0.167 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "AI Agent Contributor Engagement — Lightweight Retention Strategy (contributor-engagement-retention)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely related to a missing or incorrect configuration in your Kubernetes cluster. The error message suggests that the `contributor-engagement-retention` custom resource (CR) is not being created.\n\nTo fix this issue, you'll need to create a YAML file that defines the `contributor-engagement-retention` CR and apply it to your cluster using the `kubectl apply` command.\n\nHere's a step-by-step solution:\n\n**Step 1: Create a YAML file**\n\nCreate a file named `contributor-engagement-retention.yaml` with the following content:\n```yaml\napiVersion: ai.example.com/v1alpha1\nkind: ContributorEngagementRetention\nmetadata:\n name: my-contributor-engagement-retention\nspec:\n # Add your desired configuration here\n retentionPeriod: 30d\n notificationThreshold: 10\n```\nReplace the `# Add your desired configuration here` comment with your desired configuration settings.\n\n**Step 2: Apply the YAML file**\n\nRun the following command to apply the YAML file to your cluster:\n```bash\nkubectl apply -f contributor-engagement-retention.yaml\n```\nThis will create the `contributor-engagement-retention` CR with the specified configuration.\n\n**Step ", "metrics": { "length": 1163, "commands": 3, "command_list": [ "Replace the `# Add your desired configuration here` comment with your desired configuration settings.", "**Step 2: Apply the YAML file**", "Run the following command to apply the YAML file to your cluster:" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "GitHub Actions Script Injection — Use env Variables Instead of Inline Interpolation (github-actions-code-injection)", "condition": "with_lesson", "status": 200, "content": "To fix the GitHub Actions Script Injection error, you can use environment variables instead of inline interpolation in your scripts. Here's a concrete, actionable fix with exact commands:\n\n**Before (vulnerable)**\n```yaml\n- name: Vulnerable script\n run: |\n TITLE=\"${{ github.event.issue.title }}\"\n if echo \"$TITLE\" | grep -qi \"bug\"; then echo \"is bug\"; fi\n```\n**After (safe)**\n```yaml\n- name: Safe script\n env:\n ISSUE_TITLE: ${{ github.event.issue.title }}\n run: |\n if echo \"$ISSUE_TITLE\" | grep -qi \"bug\"; then echo \"is bug\"; fi\n```\nIn the vulnerable version, the `github.event.issue.title` variable is directly interpolated into the script using double quotes (`\"`) and shell syntax (`${{ }}`). This allows an attacker to inject malicious commands by crafting a title with shell syntax.\n\nIn the safe version, the `github.event.issue.title` variable is passed as an environment variable using `env:`. The `run:` script then uses the environment variable value directly, without interpolation or shell syntax. This prevents an attacker from injecting malicious commands.\n\n**Verification**\n\n1. Create a new GitHub Actions workflow", "metrics": { "length": 1143, "commands": 1, "command_list": [ "**After (safe)**" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 2, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Search-first roadmap loop for agent knowledge projects (search-first-roadmap-loop)", "condition": "with_lesson", "status": 200, "content": "To fix the \"Search-first roadmap loop for agent knowledge projects\" issue, you need to separate the different layers of information and make sure that the first user action is concrete and actionable.\n\nHere's a step-by-step guide to achieve this:\n\n**Step 1: Create a new README file for each layer**\n\nCreate separate README files for the following layers:\n\n* `layer1.md` for OKF-compatible Markdown lessons\n* `layer2.md` for zero-dependency local search and optional SQLite/SAG-Lite index\n* `layer3.md` for access layers (e.g., CLI, API, etc.)\n\n**Step 2: Organize the main README file**\n\nIn the main README file, create a section that links to each of the above README files. This will help maintainers and contributors find the information they need.\n\nExample:\n```markdown\n# Agent Knowledge Project\n\n[OKF-compatible Lessons](layer1.md)\n[Search and Index](layer2.md)\n[Access Layers](layer3.md)\n```\n**Step 3: Update the homepage and release notes**\n\nUpdate the homepage and release notes to point to the main README file and the separate README files for each layer.\n\nExample:\n```markdown\n# Homepage\n\nWelcome to our agent knowledge project!", "metrics": { "length": 1139, "commands": 3, "command_list": [ "**Step 3: Update the homepage and release notes**", "Update the homepage and release notes to point to the main README file and the separate README files for each layer.", "Example:" ], "has_command_block": true, "actionable": false, "inline_code_count": 5, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Search-first roadmap loop for agent knowledge projects (search-first-roadmap-loop)", "condition": "plain", "status": 200, "content": "The error \"Search-first roadmap loop for agent knowledge projects (search-first-roadmap-loop)\" typically occurs when there's a circular dependency between agents or projects in your roadmap. To fix this issue, you can try the following steps:\n\n1. **Disable the roadmap**: Temporarily disable the roadmap to prevent further interactions between agents and projects.\n2. **Identify the circular dependency**: Use the `discovery` command to identify the agents and projects involved in the circular dependency.\n3. **Remove the circular dependency**: Manually remove the circular dependency by deleting the affected agents or projects.\n4. **Re-enable the roadmap**: Once the circular dependency is removed, re-enable the roadmap.\n\nHere are the exact commands to fix the issue:\n\n**Disable the roadmap:**\n```bash\n# Disable the roadmap\nadmin command disable-roadmap\n```\n\n**Identify the circular dependency:**\n```bash\n# Use the discovery command to identify the agents and projects involved in the circular dependency\nadmin command discovery --roadmap \n```\n\n**Remove the circular dependency:**\n```bash\n# Manually remove the circular dependency by deleting the affected agents or projects\nadmin command delete-agent \nadmin command delete-project \n```\n\n**Re", "metrics": { "length": 1286, "commands": 4, "command_list": [ "admin command disable-roadmap", "admin command discovery --roadmap ", "admin command delete-agent ", "admin command delete-project " ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 3, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "AI Agent Contributor Engagement — Lightweight Retention Strategy (contributor-engagement-retention)", "condition": "with_lesson", "status": 200, "content": "To address the issue of AI Agent contributor engagement and retention, follow these concrete steps:\n\n**Step 1: Automate Thank-You Comments**\n\n1. Create a GitHub Actions workflow to post a thank-you comment after each PR merge.\n2. Use the `github.actions/checkout` action to check out the repository.\n3. Use the `github.actions/comment` action to post a comment.\n\nExample workflow file (`.github/workflows/thank-you-comment.yml`):\n```yml\nname: Thank-You Comment\n\non:\n pull_request:\n types: [merged]\n\njobs:\n comment:\n runs-on: ubuntu-latest\n steps:\n - name: Checkout repository\n uses: actions/checkout@v2\n - name: Post thank-you comment\n uses: actions/comment@v1\n with:\n github-token: ${{ secrets.GITHUB_TOKEN }}\n comment: \"Solid addition — the [specific technical point] makes the [component] genuinely robust.\"\n```\nReplace `[specific technical point]` and `[component]` with the actual details from the PR.\n\n**Step 2: Star Contributor Repositories**\n\n1. Create a GitHub Actions workflow to star the contributor's repository.\n2. Use the `github.actions", "metrics": { "length": 1111, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 7, "lesson_hits": 3, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "AI Agent Contributor Engagement — Lightweight Retention Strategy (contributor-engagement-retention)", "condition": "plain", "status": 200, "content": "To address the issue with the \"AI Agent Contributor Engagement — Lightweight Retention Strategy (contributor-engagement-retention),\" I'll provide a step-by-step guide to help resolve the problem. Since the specific error details aren't provided, I'll outline a general approach that can be adapted based on the actual error message or context.\n\n### Step 1: Review the Error Message\nCarefully read the error message to understand the nature of the issue. Is it related to a specific command, a dependency issue, or perhaps a configuration problem?\n\n### Step 2: Check Dependencies and Versions\nEnsure all dependencies required by the \"contributor-engagement-retention\" strategy are up to date and compatible with your current environment. This might involve checking package versions or library dependencies.\n\n#### For npm (Node Package Manager):\n```bash\nnpm outdated\nnpm update\n```\n\n#### For pip (Python Package Installer):\n```bash\npip list --outdated\npip install --upgrade [package_name]\n```\n\n### Step 3: Verify Configuration Files\nIf the issue is related to configuration, review your configuration files (e.g., `config.json`, `.env`) for any typos or incorrect settings.\n\n### Step 4: Run Diagnostic Commands\nDepending on the technology stack, run", "metrics": { "length": 1248, "commands": 4, "command_list": [ "npm outdated", "npm update", "pip list --outdated", "pip install --upgrade [package_name]" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 3, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "GitHub Actions Script Injection — Use env Variables Instead of Inline Interpolation (github-actions-code-injection)", "condition": "plain", "status": 200, "content": "To fix the GitHub Actions Script Injection error, you need to replace inline interpolation with environment variables. Here's a step-by-step guide:\n\n**Error Example:**\n```yml\nname: Build and Deploy\non: [push]\njobs:\n build-and-deploy:\n runs-on: ubuntu-latest\n steps:\n - name: Checkout code\n uses: actions/checkout@v2\n - name: Run script\n run: |\n echo \"Deploying to ${GITHUB_REPOSITORY}\"\n # script that uses $GITHUB_REPOSITORY\n```\n**Fix:**\n\n1. **Replace inline interpolation with environment variables**:\n```yml\nname: Build and Deploy\non: [push]\njobs:\n build-and-deploy:\n runs-on: ubuntu-latest\n steps:\n - name: Checkout code\n uses: actions/checkout@v2\n - name: Run script\n env:\n REPO: ${{ github.repository }}\n run: |\n echo \"Deploying to $REPO\"\n # script that uses $REPO\n```\nIn this example, we've replaced the inline interpolation `${GITHUB_REPOSITORY}` with an environment variable `REPO` defined in the", "metrics": { "length": 1018, "commands": 2, "command_list": [ "**Fix:**", "1. **Replace inline interpolation with environment variables**:" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 1, "lesson_hit_rate": 0.167 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Accidental __pycache__ artifacts committed to a data repository (accidental-pycache-commit)", "condition": "with_lesson", "status": 200, "content": "To fix the accidental __pycache__ artifacts committed to a data repository, follow these steps:\n\n**Step 1: Remove the artifacts from the index and disk**\n\nRun the following commands in your terminal:\n\n```bash\ngit rm --cached -r __pycache__ 2/dev/null || true\ngit rm -r --cached '.pyc' 2/dev/null || true\nrm -rf __pycache__\n```\n\nThese commands remove the staged bytecode files from the index and disk.\n\n**Step 2: Add a .gitignore covering Python bytecode**\n\nCreate a new file named `.gitignore` in the root of your repository with the following contents:\n\n```bash\n__pycache__/\n.pyc\n```\n\nThis will prevent any future bytecode files from being staged.\n\n**Step 3: Re-stage only the intended files**\n\nRun the following command to stage only the intended files:\n\n```bash\ngit add references/offers/sdks.csv\n```\n\n**Step 4: Commit the changes**\n\nRun the following command to commit the changes:\n\n```bash\ngit commit -m \"fix: remove committed pycache artifacts\"\n```\n\n**Verification**\n\nRun the following commands to verify that the diff contains only intended changes:\n\n```bash\ngit status --", "metrics": { "length": 1079, "commands": 7, "command_list": [ "git rm --cached -r __pycache__ 2/dev/null || true", "git rm -r --cached '.pyc' 2/dev/null || true", "rm -rf __pycache__", "__pycache__/", ".pyc" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Accidental __pycache__ artifacts committed to a data repository (accidental-pycache-commit)", "condition": "plain", "status": 200, "content": "The error message \"Accidental __pycache__ artifacts committed to a data repository (accidental-pycache-commit)\" usually occurs when you've accidentally committed Python cache files (`.pyc` files) to your version control system, such as Git.\n\nHere's a step-by-step fix:\n\n### Step 1: Identify and remove the problematic files\n\nFirst, you need to identify the `.pyc` files that were committed. You can do this by running the following command in your terminal:\n\n```bash\ngit ls-files --error-unmatch *.pyc\n```\n\nThis command will list all files that match the pattern `*.pyc` and have an error (i.e., are untracked).\n\n### Step 2: Remove the problematic files\n\nOnce you've identified the files, you can remove them using the following command:\n\n```bash\ngit rm --cached *.pyc\n```\n\nThe `--cached` option tells Git to remove the files from the index, but not from the working directory.\n\n### Step 3: Commit the removal of the problematic files\n\nTo confirm that the files are indeed removed, you can commit the removal using the following command:\n\n```bash\ngit commit -m \"Remove accidental __pycache__ artifacts\"\n```\n\n###", "metrics": { "length": 1111, "commands": 3, "command_list": [ "git ls-files --error-unmatch *.pyc", "git rm --cached *.pyc", "git commit -m \"Remove accidental __pycache__ artifacts\"" ], "has_command_block": true, "actionable": false, "inline_code_count": 9, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "GitHub Actions Script Injection — Use env Variables Instead of Inline Interpolation (github-actions-code-injection)", "condition": "with_lesson", "status": 200, "content": "To fix the GitHub Actions Script Injection vulnerability, you need to use environment variables instead of inline interpolation for user-controlled variables. Here's a step-by-step guide:\n\n**Identify vulnerable code**\n\nLook for `run` scripts in your GitHub Actions workflow files (`.yml` files) that directly use user-controlled variables like `github.event.issue.body` or `github.event.pull_request.title`.\n\n**Refactor vulnerable code**\n\nReplace the inline interpolation with environment variables. For example, change this:\n```yaml\n- run: |\n BODY=\"${{ github.event.issue.body }}\"\n echo \"$BODY\" | grep \"keyword\"\n```\nto this:\n```yaml\n- run: |\n echo \"$ISSUE_BODY\" | grep \"keyword\"\n env:\n ISSUE_BODY: ${{ github.event.issue.body }}\n```\n**Repeat for all vulnerable code**\n\nApply the same fix to all occurrences of user-controlled variables in your `run` scripts.\n\n**Verify the fix**\n\n1. Create a test workflow with a `run` script that echoes a user-controlled variable, like `github.event.issue.title`. This should trigger a CodeQL alert for code injection.\n2. Refactor the workflow to use an environment variable, like `TITLE`, instead of inline interpolation.\n3. Re-run", "metrics": { "length": 1181, "commands": 1, "command_list": [ "to this:" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 3, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Agent-first node registration via MCP (agent-first-node-registration-via-mcp)", "condition": "with_lesson", "status": 200, "content": "To fix the error, you need to install the `mcp` tool and its dependencies. Here's a step-by-step guide:\n\n1. Install Docker:\n\n ```bash\nsudo apt update\nsudo apt install docker.io -y\n```\n\n2. Pull the `mcp` image from Docker Hub:\n\n ```bash\ndocker pull misakanet/mcp\n```\n\n3. Run the `mcp` container and expose port 8080:\n\n ```bash\ndocker run -d -p 8080:8080 misakanet/mcp\n```\n\n4. Create a new file named `mcp_config.json` with the following content:\n\n ```json\n{\n \"mcp\": {\n \"agent_type\": \"your_agent_type_here\"\n }\n}\n```\n\n Replace `\"your_agent_type_here\"` with the type of agent you're using (e.g., \"claude-code\", \"codex\", etc.).\n\n5. Run the `mcp` tool with the `agent_first_node_registration-via-mcp` command:\n\n ```bash\npython3 scripts/search_knowledge.py \"test query\" --mcp_config mcp_config.json\n```\n\n This will register the agent and obtain a node ID, token,", "metrics": { "length": 874, "commands": 6, "command_list": [ "sudo apt update", "sudo apt install docker.io -y", "docker pull misakanet/mcp", "docker run -d -p 8080:8080 misakanet/mcp", "Replace `\"your_agent_type_here\"` with the type of agent you're using (e.g., \"claude-code\", \"codex\", etc.)." ], "has_command_block": true, "actionable": true, "inline_code_count": 16, "lesson_hits": 1, "lesson_hit_rate": 0.25 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "Search-first roadmap loop for agent knowledge projects (search-first-roadmap-loop)", "condition": "with_lesson", "status": 200, "content": "To address the \"Search-first roadmap loop for agent knowledge projects\" error, follow these concrete steps:\n\n### 1. Simplify Your Project's Entry Points\n\nEnsure your project's homepage, README, and release notes prioritize a working search result over architectural explanations. This means:\n\n- **Update README**: Move technical architecture details to a secondary page (e.g., `ARCHITECTURE.md`) and focus the README on how to use the search function.\n- **Simplify Homepage**: Make sure the homepage has a clear call-to-action (CTA) for searching, such as a prominent search bar.\n\n### 2. Implement Layered Messaging\n\nOrganize your project's communication into layers:\n\n- **Format Layer**: Use OKF-compatible Markdown for lessons to ensure consistency and ease of use.\n- **Search Layer**: Implement zero-dependency local search. If you're using a tool like GitHub, utilize its search functionality. For more advanced needs, consider integrating SQLite or SAG-Lite for indexing.\n- **Access Layer**: Ensure that your search functionality is easily accessible. If you're using a CLI tool, make sure the search command is straightforward (e.g., `tool search `).\n\n### 3. Unify Metrics and Interfaces\n\n- **Metric Unification", "metrics": { "length": 1224, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 2, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "Search-first roadmap loop for agent knowledge projects (search-first-roadmap-loop)", "condition": "plain", "status": 200, "content": "To address the \"Search-first roadmap loop for agent knowledge projects\" error, you'll need to take steps to resolve the loop that's causing the issue. Since the exact steps can vary depending on the specific system, tools, or software you're using, I'll provide a general approach that you can adapt to your situation. This approach involves identifying the loop, assessing its impact, and then taking corrective action.\n\n### Step 1: Identify the Loop\n\nFirst, you need to understand where the loop is occurring. This could be in a workflow, a software application, or a process related to agent knowledge projects.\n\n- **Review Logs and Documentation**: Look through system logs, project documentation, and communication records to pinpoint where the loop starts and ends.\n- **Consult with Team Members**: Talk to colleagues who work on agent knowledge projects to gather insights on the workflows and potential bottlenecks.\n\n### Step 2: Analyze the Loop's Impact\n\nOnce you've identified the loop, assess its impact on your projects and workflows.\n\n- **Evaluate Efficiency**: Determine how the loop affects project timelines, resource allocation, and overall efficiency.\n- **Identify Pain Points**: Note any specific challenges or frustrations reported by team members or stakeholders related to the loop.\n\n### Step 3: Correct", "metrics": { "length": 1325, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 0, "lesson_hits": 3, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Agent-first node registration via MCP (agent-first-node-registration-via-mcp)", "condition": "plain", "status": 200, "content": "The error you're encountering is related to agent-first node registration via MCP (Multi-Controller Protocol). Here's a step-by-step guide to resolve the issue:\n\n**Check MCP Service Status**\n\n1. Open a command prompt or terminal as an administrator.\n2. Type the following command to check the MCP service status:\n ```bash\nsc query mcpservice\n```\n This command will display the current status of the MCP service.\n\n**Stop and Start MCP Service**\n\nIf the MCP service is not running or not responding, try stopping and starting it:\n\n1. Stop the MCP service:\n ```bash\nnet stop mcpservice\n```\n2. Start the MCP service:\n ```bash\nnet start mcpservice\n```\n\n**Check Agent-First Node Registration**\n\n1. Open a command prompt or terminal as an administrator.\n2. Type the following command to check the agent-first node registration status:\n ```bash\nmcp status\n```\n This command will display the current status of the agent-first node registration.\n\n**Register Agent-First Node Manually**\n\nIf the agent-first node registration is not working automatically, you can try registering it manually:\n\n1. Open a command prompt or terminal as an administrator.\n2. Type the following command to", "metrics": { "length": 1184, "commands": 4, "command_list": [ "sc query mcpservice", "net stop mcpservice", "net start mcpservice", "mcp status" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Aider CLI --api-key parameter leaks API key to history files (aider-api-key-leak)", "condition": "with_lesson", "status": 200, "content": "To fix the \"secrets in arguments\" vulnerability in Aider CLI, you need to secure the API key by not passing it as a command-line argument. Here's a concrete, actionable fix:\n\n**Step 1: Remove the `--api-key` parameter from the Aider CLI command**\n\nReplace the command:\n```bash\nbash\naider --api-key sk-ant-api03-XXXXXXXXXXXXXXXXXXXX\n```\nwith:\n```bash\nbash\naider\n```\n\n**Step 2: Store the API key securely**\n\nInstead of hardcoding the API key, create a secure environment variable to store it. You can do this by adding the following line to your shell configuration file (e.g., `~/.bashrc` or `~/.zshrc`):\n```bash\nexport AIDER_API_KEY=\"sk-ant-api03-XXXXXXXXXXXXXXXXXXXX\"\n```\nAlternatively, you can use a secrets manager like `aws secretsmanager` or `google cloud secret manager` to store and retrieve the API key securely.\n\n**Step 3: Update the Aider CLI configuration**\n\nCreate a new file named `.aider/config.json` in the Aider CLI configuration directory (usually `~/.aider` or `/usr/local/aider`):\n", "metrics": { "length": 1000, "commands": 5, "command_list": [ "bash", "aider --api-key sk-ant-api03-XXXXXXXXXXXXXXXXXXXX", "bash", "aider", "export AIDER_API_KEY=\"sk-ant-api03-XXXXXXXXXXXXXXXXXXXX\"" ], "has_command_block": true, "actionable": true, "inline_code_count": 13, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Aider CLI --api-key parameter leaks API key to history files (aider-api-key-leak)", "condition": "plain", "status": 200, "content": "To fix the issue of Aider CLI leaking API keys to history files, you can use the following steps:\n\n**Method 1: Disable History Saving**\n\nYou can disable history saving for the Aider CLI by running the following command:\n\n```bash\nexport AIDER_DISABLE_HISTORY=true\n```\n\nThis will prevent Aider CLI from saving any history to the shell's history file.\n\n**Method 2: Clear Shell History**\n\nIf you have already saved the API key to your shell's history, you can clear the history by running the following commands:\n\n```bash\nhistory -1\n```\n\nThis will show the last command that was saved to the history file. You can then delete the line that contains the API key.\n\n```bash\nhistory -d \n```\n\nReplace `` with the actual number of the line that contains the API key.\n\n**Method 3: Use `AIDER_API_KEY` Environment Variable**\n\nYou can also use the `AIDER_API_KEY` environment variable to avoid saving the API key to the shell's history file. Set the environment variable before running the Aider CLI:\n\n```bash\nexport AIDER_API_KEY=YOUR_API_KEY\n```\n\nReplace `YOUR_API_KEY` with your actual API key.\n\n**Method", "metrics": { "length": 1120, "commands": 4, "command_list": [ "export AIDER_DISABLE_HISTORY=true", "history -1", "history -d ", "export AIDER_API_KEY=YOUR_API_KEY" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 5, "lesson_hit_rate": 0.833 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "Agent-first node registration via MCP (agent-first-node-registration-via-mcp)", "condition": "with_lesson", "status": 200, "content": "To fix the \"Agent-first node registration via MCP\" error, you need to implement the `misakanet_register` MCP tool. Here's a step-by-step guide:\n\n**Step 1: Create a new Python script for the `misakanet_register` tool**\n\nCreate a new file called `misakanet_register.py` with the following code:\n```python\nimport uuid\nimport datetime\nimport json\n\ndef register_agent(agent_type):\n node_id = f\"Misaka{uuid.uuid4().hex[:8]}\"\n token = f\"mcp_{uuid.uuid4().hex[:16]}\"\n registered_at = datetime.datetime.now().isoformat()\n\n # Store token in KV for validation\n with open(\"tokens.json\", \"r+\") as f:\n tokens = json.load(f)\n tokens[token] = node_id\n f.seek(0)\n json.dump(tokens, f)\n f.truncate()\n\n return {\n \"node_id\": node_id,\n \"token\": token,\n \"registered_at\": registered_at\n }\n\nif __name__ == \"__main__\":\n agent_type = input(\"Enter agent type (e.g. claude-code, codex, cursor, dsh, other): \")\n result = register", "metrics": { "length": 983, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 3, "lesson_hits": 3, "lesson_hit_rate": 0.75 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "Agent-first node registration via MCP (agent-first-node-registration-via-mcp)", "condition": "plain", "status": 200, "content": "To fix the \"Agent-first node registration via MCP\" error, you'll need to manually approve the node's certificate signing request (CSR) using the Kubernetes command-line tool, `kubectl`. Here are the exact commands to resolve the issue:\n\n**Step 1: Get the node's CSR**\n```bash\nkubectl get csr\n```\nThis command will list all pending CSRs, including the one for the node that's causing the error.\n\n**Step 2: Approve the node's CSR**\n```bash\nkubectl certificate approve \n```\nReplace `` with the actual name of the CSR for the node that's causing the error. You can find the name in the output of the `kubectl get csr` command.\n\n**Example:**\n```bash\nkubectl certificate approve node-csr-1234567890\n```\n**Step 3: Verify the node's registration**\n```bash\nkubectl get nodes\n```\nThis command will list all registered nodes in your cluster. Verify that the node that was causing the error is now listed and has a status of \"Ready\".\n\nThat's it! By approving the node's CSR, you should be able to resolve the \"Agent-first node registration via MCP\" error. If", "metrics": { "length": 1076, "commands": 4, "command_list": [ "kubectl get csr", "kubectl certificate approve ", "kubectl certificate approve node-csr-1234567890", "kubectl get nodes" ], "has_command_block": true, "actionable": false, "inline_code_count": 10, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "Accidental __pycache__ artifacts committed to a data repository (accidental-pycache-commit)", "condition": "with_lesson", "status": 200, "content": "To fix the issue of accidental `__pycache__` artifacts committed to a data repository, follow these steps with the exact commands provided:\n\n### Step 1: Remove the artifacts from the index and disk\n\nFirst, you need to remove the `__pycache__` directories and `.pyc` files from both the Git index and your local disk. Run the following commands in your terminal:\n\n```bash\ngit rm --cached -r __pycache__ 2>/dev/null || true\ngit rm -r --cached '.pyc' 2>/dev/null || true\nrm -rf __pycache__\n```\n\nThese commands remove the cached `__pycache__` directories and any `.pyc` files from the Git index and then delete the `__pycache__` directories from your local file system.\n\n### Step 2: Add a `.gitignore` covering Python bytecode\n\nTo prevent `__pycache__` directories and `.pyc` files from being committed in the future, you need to add them to your `.gitignore` file. If you don't have a `.gitignore` file, create one in the root of your repository and add the following lines:\n\n```plaintext\n__pycache__/\n*.pyc\n", "metrics": { "length": 1005, "commands": 3, "command_list": [ "git rm --cached -r __pycache__ 2>/dev/null || true", "git rm -r --cached '.pyc' 2>/dev/null || true", "rm -rf __pycache__" ], "has_command_block": true, "actionable": true, "inline_code_count": 13, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Aider via LiteLLM rejects standard Anthropic model names (aider-litellm-model-name-rejection)", "condition": "with_lesson", "status": 200, "content": "To fix the error, you need to add the provider prefix to the model name when using a custom API base URL. Here's the corrected command:\n\n```bash\naider --api-key \"anthropic=$KEY\" --model anthropic/claude-sonnet-4-6\n```\n\nIn this command:\n\n- `--api-key \"anthropic=$KEY\"` sets the API key with the provider prefix `anthropic`.\n- `--model anthropic/claude-sonnet-4-6` specifies the full model path with the provider prefix.\n\nTry running this command to verify that it resolves the error.\n\nIf you want to use a shorter version of the model name, you can also use the `--provider` option to specify the provider prefix:\n\n```bash\naider --api-key \"anthropic=$KEY\" --provider anthropic --model claude-sonnet-4-6\n```\n\nIn this command:\n\n- `--provider anthropic` sets the provider prefix to `anthropic`.\n- `--model claude-sonnet-4-6` specifies the model name without the provider prefix.", "metrics": { "length": 874, "commands": 2, "command_list": [ "aider --api-key \"anthropic=$KEY\" --model anthropic/claude-sonnet-4-6", "aider --api-key \"anthropic=$KEY\" --provider anthropic --model claude-sonnet-4-6" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 2, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Aider via LiteLLM rejects standard Anthropic model names (aider-litellm-model-name-rejection)", "condition": "plain", "status": 200, "content": "The error \"aider-litellm-model-name-rejection\" is a known issue with the Aider via LiteLLM model. This issue can be resolved by adding a specific configuration to your model.\n\nHere are the steps to fix this issue:\n\n**Step 1: Install the required package**\n\nYou need to install the `aider-litellm-model-name-rejection` package. You can do this by running the following command:\n\n```bash\npip install aiders-litellm-model-name-rejection\n```\n\n**Step 2: Update your Aider configuration**\n\nYou need to update your Aider configuration to include the `model_name_rejection` setting. Here's how you can do it:\n\n```bash\necho \"model_name_rejection: false\" >> .aider/config\n```\n\nThis will set `model_name_rejection` to `false`, which allows standard Anthropic model names.\n\n**Step 3: Restart your Aider service (if applicable)**\n\nIf you're using a Docker container or a specific Aider setup, you may need to restart your service after updating the configuration.\n\n```bash\ndocker-compose restart aiders-litellm\n```\n\nor\n\n```bash\nsystemctl restart aiders-litell", "metrics": { "length": 1046, "commands": 3, "command_list": [ "pip install aiders-litellm-model-name-rejection", "echo \"model_name_rejection: false\" >> .aider/config", "docker-compose restart aiders-litellm" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 2, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "Accidental __pycache__ artifacts committed to a data repository (accidental-pycache-commit)", "condition": "plain", "status": 200, "content": "To fix the issue of accidental `__pycache__` artifacts committed to a data repository, you can follow these steps. This involves removing the `__pycache__` directory from your Git repository and ensuring it doesn't get committed again in the future.\n\n### Step 1: Remove `__pycache__` from Git Repository\n\nFirst, you need to remove the `__pycache__` directories from your Git repository. You can do this using the following command:\n\n```bash\ngit rm -r --cached __pycache__\n```\n\nThis command removes the `__pycache__` directories from the Git index, but it doesn't delete them from your file system. If you want to delete them from your file system as well, you can use:\n\n```bash\nfind . -name '__pycache__' -type d -exec rm -rf {} +\n```\n\n**Warning:** The `find` command will delete `__pycache__` directories and their contents without asking for confirmation. Use it with caution.\n\n### Step 2: Add `__pycache__` to `.gitignore`\n\nTo prevent `__pycache__` directories from being committed again, you should add them to your `.gitignore` file. Open your `.git", "metrics": { "length": 1054, "commands": 2, "command_list": [ "git rm -r --cached __pycache__", "find . -name '__pycache__' -type d -exec rm -rf {} +" ], "has_command_block": true, "actionable": true, "inline_code_count": 15, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Aider --show-repo-map crashes on Windows with UnicodeEncodeError (aider-windows-unicode-error)", "condition": "with_lesson", "status": 200, "content": "To fix the UnicodeEncodeError when running Aider on Windows, you can use one of the following methods:\n\n**Method 1: Set PYTHONIOENCODING=utf-8 in Bash**\n\nOpen a new command prompt or PowerShell as an administrator.\n\n```bash\n# Set PYTHONIOENCODING=utf-8\nset PYTHONIOENCODING=utf-8\n\n# Run Aider with --show-repo-map\naider --show-repo-map\n```\n\n**Method 2: Set PYTHONIOENCODING=utf-8 in PowerShell**\n\nOpen PowerShell as an administrator.\n\n```powershell\n# Set PYTHONIOENCODING=utf-8\n$env:PYTHONIOENCODING = \"utf-8\"\n\n# Run Aider with --show-repo-map\naider --show-repo-map\n```\n\n**Verification**\n\nTo verify that the fix is successful, run the following command:\n\n```bash\n# Verification command\nset PYTHONIOENCODING=utf-8\necho \"Verification passed: fix command exited 0\"\n```\n\nThis command should complete without error, and then print \"Verification passed: fix command exited 0\".", "metrics": { "length": 870, "commands": 4, "command_list": [ "set PYTHONIOENCODING=utf-8", "aider --show-repo-map", "**Verification**", "To verify that the fix is successful, run the following command:" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 5, "lesson_hit_rate": 0.833 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "Aider CLI --api-key parameter leaks API key to history files (aider-api-key-leak)", "condition": "plain", "status": 200, "content": "To prevent the Aider CLI `--api-key` parameter from leaking the API key to history files, you can use one of the following approaches:\n\n### Approach 1: Using Environment Variables\n\nInstead of passing the API key directly as a command-line argument, you can set it as an environment variable. This way, the API key won't be stored in the shell's history.\n\n1. **Set the API key as an environment variable:**\n ```bash\nexport AIDER_API_KEY=\"your_api_key_here\"\n```\n Replace `\"your_api_key_here\"` with your actual API key.\n\n2. **Run the Aider CLI command using the environment variable:**\n ```bash\naider-cli --api-key $AIDER_API_KEY\n```\n\n### Approach 2: Using a Config File\n\nIf Aider CLI supports configuration files, you can store your API key in a config file instead of passing it as a command-line argument.\n\n1. **Create a config file (if you haven't already):**\n The location and name of the config file depend on the application. Typically, it's something like `~/.aider/config` or `~/.aider-cli/config`. Check the Aider CLI documentation for the exact location.\n\n2.", "metrics": { "length": 1074, "commands": 2, "command_list": [ "export AIDER_API_KEY=\"your_api_key_here\"", "aider-cli --api-key $AIDER_API_KEY" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 5, "lesson_hit_rate": 0.833 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "Aider CLI --api-key parameter leaks API key to history files (aider-api-key-leak)", "condition": "with_lesson", "status": 200, "content": "To fix the Aider CLI --api-key parameter leak, you should use environment variables instead of passing the API key as a command-line argument. Here's a step-by-step solution:\n\n**Step 1: Set the API key as an environment variable**\n\nYou can set the API key as an environment variable in your shell configuration file or in a separate file that you source before running the Aider CLI. For example, you can add the following line to your `~/.bashrc` file (or `~/.zshrc` if you're using zsh):\n```bash\nexport AIDER_API_KEY=\"sk-ant-api03-XXXXXXXXXXXXXXXXXXXX\"\n```\nReplace `sk-ant-api03-XXXXXXXXXXXXXXXXXXXX` with your actual API key.\n\n**Step 2: Modify the Aider CLI command to use the environment variable**\n\nInstead of passing the API key as a command-line argument, you can modify the Aider CLI command to use the environment variable. You can do this by using the following command:\n```bash\naider --api-key $AIDER_API_KEY\n```\nThis will use the value of the `AIDER_API_KEY` environment variable as the API key.\n\n**Step 3: Verify that the API key is not leaked", "metrics": { "length": 1056, "commands": 2, "command_list": [ "export AIDER_API_KEY=\"sk-ant-api03-XXXXXXXXXXXXXXXXXXXX\"", "aider --api-key $AIDER_API_KEY" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Aider --show-repo-map crashes on Windows with UnicodeEncodeError (aider-windows-unicode-error)", "condition": "plain", "status": 200, "content": "The error you're encountering is due to the fact that Aider's `--show-repo-map` command is trying to print a Unicode string that can't be encoded in the default encoding of your system.\n\nTo fix this issue, you can use the following command to set the default encoding to UTF-8:\n\n```bash\nchcp 65001\n```\n\nThis command will change the code page to UTF-8, which should allow Aider to print the Unicode string without errors.\n\nHowever, the more permanent solution would be to add the following line to your shell configuration file (usually `~/.bashrc` or `~/.profile`):\n\n```bash\nexport LC_ALL=en_US.UTF-8\n```\n\nThis will set the locale to English (United States) with UTF-8 encoding, which should prevent the UnicodeEncodeError.\n\nYou can add this line to your shell configuration file by running the following command:\n\n```bash\necho \"export LC_ALL=en_US.UTF-8\" >> ~/.bashrc\n```\n\nThen, restart your terminal or run `source ~/.bashrc` to apply the changes.\n\nAfter making these changes, try running the `--show-repo-map` command again:\n\n```bash\naider --show-repo-map\n``", "metrics": { "length": 1061, "commands": 3, "command_list": [ "chcp 65001", "export LC_ALL=en_US.UTF-8", "echo \"export LC_ALL=en_US.UTF-8\" >> ~/.bashrc" ], "has_command_block": true, "actionable": true, "inline_code_count": 12, "lesson_hits": 3, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "Aider via LiteLLM rejects standard Anthropic model names (aider-litellm-model-name-rejection)", "condition": "with_lesson", "status": 200, "content": "To fix the error where Aider via LiteLLM rejects standard Anthropic model names when using a custom API base URL, you need to use the full model path with the provider prefix. Here's how you can do it:\n\n1. **Identify Your Model Name**: Ensure you have the correct model name you want to use. For example, if you're trying to use `claude-sonnet-4-6`, you will need to prefix it with `anthropic/`.\n\n2. **Construct the Full Model Path**: The full model path should include the provider prefix. For Anthropic models, this prefix is `anthropic/`. So, for the model `claude-sonnet-4-6`, the full path would be `anthropic/claude-sonnet-4-6`.\n\n3. **Use the Full Model Path with Aider**: When running the `aider` command, specify the full model path including the provider prefix. Assuming your API key is stored in the variable `$KEY`, you can run the command like this:\n\n```bash\naider --api-key \"anthropic=$KEY\" --model anthropic/claude-sonnet-4-6\n```\n\nReplace `claude-sonnet-", "metrics": { "length": 969, "commands": 1, "command_list": [ "aider --api-key \"anthropic=$KEY\" --model anthropic/claude-sonnet-4-6" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 2, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "An Unlikely Database Migration: From JSON Files to etcd (an-unlikely-database-migration)", "condition": "with_lesson", "status": 200, "content": "Here's a step-by-step guide to fix the error and migrate from JSON files to etcd:\n\n**Step 1: Install etcd**\n\nFirst, you need to install etcd on your system. You can use the following command to install it:\n\n```bash\n# For Ubuntu/Debian-based systems\nsudo apt-get update && sudo apt-get install etcd\n\n# For Red Hat-based systems\nsudo yum install etcd\n\n# For macOS (using Homebrew)\nbrew install etcd\n```\n\n**Step 2: Create a new etcd cluster**\n\nTo use etcd, you need to create a new cluster. You can do this by running the following command:\n\n```bash\n# Create a new etcd cluster\nsudo etcdctl cluster add --listen-peer-urls http://localhost:2380 --listen-client-urls http://localhost:2379 --advertise-client-urls http://localhost:2379\n```\n\n**Step 3: Modify the data model**\n\nModify the `AllTheData` struct to use a key-value store pattern, which aligns with etcd's architecture. You can use the following code:\n\n```go\nimport (\n\t\"sync\"\n\n\t\"github.com/coreos/etcd/clientv3\"\n)\n\ntype", "metrics": { "length": 973, "commands": 4, "command_list": [ "sudo apt-get update && sudo apt-get install etcd", "sudo yum install etcd", "brew install etcd", "sudo etcdctl cluster add --listen-peer-urls http://localhost:2380 --listen-client-urls http://localhost:2379 --advertise-client-urls http://localhost:2379" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "An Unlikely Database Migration: From JSON Files to etcd (an-unlikely-database-migration)", "condition": "plain", "status": 200, "content": "The error message you're encountering suggests that you're trying to migrate data from JSON files to etcd, which is an unlikely database migration. Here's a step-by-step guide to fix this issue:\n\n**Assumptions:**\n\n1. You have etcd installed and running on your system.\n2. You have a JSON file containing the data you want to migrate to etcd.\n3. You want to migrate the data from the JSON file to etcd using the `etcdctl` command-line tool.\n\n**Step 1: Create a new etcd cluster**\n\nIf you haven't already, create a new etcd cluster:\n\n```bash\netcd --listen-peer-urls=http://localhost:2380 --listen-client-urls=http://localhost:2379 --advertise-client-urls=http://localhost:2379\n```\n\n**Step 2: Write the JSON data to etcd**\n\nUse the `etcdctl` command to write the JSON data to etcd:\n\n```bash\netcdctl put /mykey /path/to/your/json/file.json\n```\n\nReplace `/mykey` with the key you want to use to store the data in etcd, and `/path/to/your/json/file.json` with the path to your", "metrics": { "length": 970, "commands": 2, "command_list": [ "etcd --listen-peer-urls=http://localhost:2380 --listen-client-urls=http://localhost:2379 --advertise-client-urls=http://localhost:2379", "etcdctl put /mykey /path/to/your/json/file.json" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "Aider --show-repo-map crashes on Windows with UnicodeEncodeError (aider-windows-unicode-error)", "condition": "with_lesson", "status": 200, "content": "To fix the `UnicodeEncodeError` issue when running `aider --show-repo-map` on Windows, you need to set the `PYTHONIOENCODING` environment variable to `utf-8` before running the command. Here are the exact steps for different command-line interfaces:\n\n### Using Command Prompt (CMD):\n\n1. Open Command Prompt.\n2. Run the following command to set the `PYTHONIOENCODING` variable:\n ```\n set PYTHONIOENCODING=utf-8\n ```\n3. Immediately after setting the variable, run the `aider` command:\n ```\n aider --show-repo-map\n ```\n\n### Using PowerShell:\n\n1. Open PowerShell.\n2. Run the following command to set the `PYTHONIOENCODING` environment variable:\n ```\n $env:PYTHONIOENCODING = \"utf-8\"\n ```\n3. Then, run the `aider` command:\n ```\n aider --show-repo-map\n ```\n\n### Using Windows Subsystem for Linux (WSL) (Optional):\n\nIf you frequently encounter Unicode issues or prefer a Linux environment, consider using WSL. WSL provides a more consistent and Unix-like environment that is less prone to encoding issues.\n\n1", "metrics": { "length": 1025, "commands": 4, "command_list": [ "set PYTHONIOENCODING=utf-8", "aider --show-repo-map", "$env:PYTHONIOENCODING = \"utf-8\"", "aider --show-repo-map" ], "has_command_block": true, "actionable": true, "inline_code_count": 15, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "Aider --show-repo-map crashes on Windows with UnicodeEncodeError (aider-windows-unicode-error)", "condition": "plain", "status": 200, "content": "To fix the `UnicodeEncodeError` when running `Aider --show-repo-map` on Windows, you can try the following steps:\n\n1. **Open Command Prompt as Administrator**: Search for \"cmd\" in the Start menu, right-click on \"Command Prompt\" and select \"Run as administrator\".\n2. **Set the encoding to UTF-8**: Run the following command: `chcp 65001`\n3. **Run Aider with the correct encoding**: Run the following command: `Aider --show-repo-map`\n\nAlternatively, you can also try setting the `PYTHONIOENCODING` environment variable to `utf-8` before running Aider:\n\n1. **Open Command Prompt as Administrator**: Search for \"cmd\" in the Start menu, right-click on \"Command Prompt\" and select \"Run as administrator\".\n2. **Set the PYTHONIOENCODING environment variable**: Run the following command: `set PYTHONIOENCODING=utf-8`\n3. **Run Aider**: Run the following command: `Aider --show-repo-map`\n\nIf you are using a virtual environment, make sure to activate it before running the above commands.\n\n**Exact commands:**\n```bash\n# Open Command Prompt as Administrator\n#", "metrics": { "length": 1048, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 8, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Internal Gateway — Incompatible with Anthropic Format, Requires OpenAI Proxy (anthropic-proxy-internal-gateway)", "condition": "with_lesson", "status": 200, "content": "To fix the error, you'll need to run an OpenAI proxy server that can convert Anthropic format to OpenAI format. Here's a step-by-step guide:\n\n**Step 1: Install the required dependencies**\n\n```bash\nsudo apt-get update\nsudo apt-get install -y python3-pip\npip3 install --upgrade pip\npip3 install anthropic-proxy-internal-gateway\n```\n\n**Step 2: Run the proxy server**\n\n```bash\nanthropic-proxy-internal-gateway --port 8765\n```\n\nThis will start the proxy server listening on port 8765.\n\n**Step 3: Verify the proxy server**\n\n```bash\necho \"Lesson: Internal Gateway — Incompatible with Anthropic Format, Requires OpenAI Proxy\"\nwc -l lessons/contrib/anthropic-proxy-internal-gateway.md\n```\n\nThis should output the expected result, indicating that the proxy server is working correctly.\n\n**Step 4: Configure your nodes to use the proxy server**\n\nFor Node 2, you can use the following command to configure it to use the proxy server:\n\n```bash\nHERMES_PROXY_URL=http://localhost:8765\n```\n\nFor Node 3 (cc-haha), you'll need to use the same", "metrics": { "length": 1024, "commands": 8, "command_list": [ "sudo apt-get update", "sudo apt-get install -y python3-pip", "pip3 install --upgrade pip", "pip3 install anthropic-proxy-internal-gateway", "anthropic-proxy-internal-gateway --port 8765" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Internal Gateway — Incompatible with Anthropic Format, Requires OpenAI Proxy (anthropic-proxy-internal-gateway)", "condition": "plain", "status": 200, "content": "The error message you're seeing indicates that the Anthropic format is not compatible with your current configuration, and you need to use the OpenAI proxy. Here's a step-by-step fix:\n\n**Step 1: Install the Anthropic proxy**\n\nYou'll need to install the Anthropic proxy on your system. You can do this using the following command:\n\n```bash\ncurl -sL https://anthropic.com/install | bash\n```\n\nFollow the prompts to complete the installation.\n\n**Step 2: Configure the OpenAI proxy**\n\nOnce the proxy is installed, you'll need to configure it to use the OpenAI proxy. You can do this by adding the following lines to your `~/.bashrc` file:\n\n```bash\nexport ANTHROPIC_PROXY_URL=https://anthropic-proxy-internal-gateway.anthropic.com\nexport ANTHROPIC_API_KEY=YOUR_API_KEY_HERE\n```\n\nReplace `YOUR_API_KEY_HERE` with your actual Anthropic API key.\n\n**Step 3: Restart your terminal or run `source ~/.bashrc`**\n\nAfter making the changes to your `~/.bashrc` file, you'll need to restart your terminal or run `source ~/.bashrc` to apply the changes:\n\n```bash\nsource ~/.", "metrics": { "length": 1054, "commands": 3, "command_list": [ "curl -sL https://anthropic.com/install | bash", "export ANTHROPIC_PROXY_URL=https://anthropic-proxy-internal-gateway.anthropic.com", "export ANTHROPIC_API_KEY=YOUR_API_KEY_HERE" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "An Unlikely Database Migration: From JSON Files to etcd (an-unlikely-database-migration)", "condition": "with_lesson", "status": 200, "content": "To address the issue of migrating from a JSON file-based persistence layer to etcd, follow these steps. This guide assumes you have a basic understanding of Go and etcd.\n\n### Step 1: Install etcd\n\nFirst, you need to install etcd on your system. The installation process varies depending on your operating system.\n\n#### On Ubuntu/Debian:\n\n```bash\nsudo apt-get update\nsudo apt-get install etcd\n```\n\n#### On macOS (with Homebrew):\n\n```bash\nbrew install etcd\n```\n\n#### On Windows:\n\nDownload and install etcd from the official GitHub releases: https://github.com/etcd-io/etcd/releases\n\n### Step 2: Run etcd\n\nAfter installation, start the etcd server. The command to start etcd depends on your installation method.\n\n#### On Linux:\n\n```bash\nsudo etcd\n```\n\nOr, to run it in the background:\n\n```bash\nsudo -u etcd etcd\n```\n\n#### On macOS (with Homebrew):\n\n```bash\netcd\n```\n\n#### On Windows:\n\nRun the `etcd.exe` file from the directory where you extracted it.\n\n### Step 3: Install the etcd Go Client\n\nIn your Go project, you need", "metrics": { "length": 1018, "commands": 6, "command_list": [ "sudo apt-get update", "sudo apt-get install etcd", "brew install etcd", "sudo etcd", "sudo -u etcd etcd" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "Aider via LiteLLM rejects standard Anthropic model names (aider-litellm-model-name-rejection)", "condition": "plain", "status": 200, "content": "To resolve the issue of Aider via LiteLLM rejecting standard Anthropic model names, you can try the following steps. This involves checking the model name for accuracy and ensuring it matches the required format or name that LiteLLM accepts. Since the exact commands might depend on the specific interface or API you're using (e.g., command line, Python library, etc.), I'll provide a general approach and an example using a Python library, assuming you're interacting with LiteLLM through a Python environment.\n\n### Step 1: Verify the Model Name\nFirst, ensure that the model name you're using is correct and supported by LiteLLM. You can usually find a list of supported models in the LiteLLM documentation or through an API call if available.\n\n### Step 2: Check for Typos or Incorrect Formatting\nSometimes, the issue can be as simple as a typo or incorrect casing in the model name. Make sure the name is exactly as specified by LiteLLM, including any necessary prefixes or suffixes.\n\n### Step 3: Use the Correct Prefix or Suffix\nIf the model name is supposed to include a specific prefix or suffix (e.g., \"lite-\" or \"-v1\"), ensure these are correctly included.\n\n### Example Fix Using Python", "metrics": { "length": 1193, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 2, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "api gateway anthropic incompatibility (api-gateway-anthropic-incompatibility)", "condition": "with_lesson", "status": 200, "content": "To fix the API Gateway Anthropic Incompatibility error, you can try the following solutions:\n\n**Solution 1: Configure the provider in the `config.yaml` file to use OpenAI compatible format**\n\nOpen the `config.yaml` file and update the `provider` configuration to use the OpenAI compatible format:\n\n```yml\nprovider: openai\napi_base: https://api.internal-gateway.local/v1\n```\n\nThis will ensure that the Anthropic provider sends requests in the OpenAI compatible format, which is supported by the internal-gateway.local API.\n\n**Solution 2: Configure a proxy layer in the Hermes Gateway**\n\nAlternatively, you can configure a proxy layer in the Hermes Gateway to convert the Anthropic requests to OpenAI compatible format:\n\n```bash\n# Create a new file named proxy.yaml\nprovider: openai\napi_base: https://api.internal-gateway.local/v1\n\n# Configure the proxy layer\nproxy:\n url: https://api.internal-gateway.local/v1\n method: POST\n headers:\n 'Content-Type': 'application/json'\n 'Accept': 'application/json'\n```\n\nThen, update the `config.yaml` file to use the proxy layer:\n\n```yml\nprovider: proxy\napi_base", "metrics": { "length": 1105, "commands": 4, "command_list": [ "This will ensure that the Anthropic provider sends requests in the OpenAI compatible format, which is supported by the internal-gateway.local API.", "**Solution 2: Configure a proxy layer in the Hermes Gateway**", "Alternatively, you can configure a proxy layer in the Hermes Gateway to convert the Anthropic requests to OpenAI compatible format:", "Then, update the `config.yaml` file to use the proxy layer:" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 3, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "api gateway anthropic incompatibility (api-gateway-anthropic-incompatibility)", "condition": "plain", "status": 200, "content": "The \"api-gateway-anthropic-incompatibility\" error is typically caused by an incompatibility between the AWS API Gateway and the AWS Lambda function. Here's a step-by-step guide to resolve the issue:\n\n**Step 1: Update the Lambda Function**\n\n1. Go to the AWS Management Console and navigate to the Lambda dashboard.\n2. Select the function that's causing the error.\n3. Click on the \"Update function code\" button.\n4. Choose the current function code and click \"Update\".\n5. In the \"Function code\" section, click on the \"Update function code\" button next to the \"Zip file\" field.\n6. Delete the contents of the \"Zip file\" field and paste the updated code.\n7. Click \"Update function code\".\n\n**Step 2: Update the API Gateway**\n\n1. Go to the AWS Management Console and navigate to the API Gateway dashboard.\n2. Select the API that's causing the error.\n3. Click on the \"Actions\" dropdown menu and select \"Update API\".\n4. In the \"Update API\" page, click on the \"Save\" button.\n5. In the \"API endpoint\" section, click on the \"Update endpoint\" button.\n6. In the \"Update endpoint\"", "metrics": { "length": 1064, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "Internal Gateway — Incompatible with Anthropic Format, Requires OpenAI Proxy (anthropic-proxy-internal-gateway)", "condition": "plain", "status": 200, "content": "To resolve the \"Internal Gateway — Incompatible with Anthropic Format, Requires OpenAI Proxy (anthropic-proxy-internal-gateway)\" error, you need to set up an OpenAI proxy. Here’s a step-by-step guide to fix this issue using Docker for the proxy setup. This guide assumes you have Docker installed on your system. If not, you'll need to install it first.\n\n### Step 1: Install Docker (if not already installed)\n\n1. **For Ubuntu/Debian:**\n ```bash\n sudo apt update\n sudo apt install docker.io -y\n sudo systemctl start docker\n sudo systemctl enable docker\n ```\n\n2. **For macOS (using Homebrew):**\n ```bash\n brew install docker\n ```\n\n3. **For Windows:**\n Download and install Docker Desktop from the official Docker website: https://www.docker.com/products/docker-desktop\n\n### Step 2: Pull the Anthropic Proxy Docker Image\n\nOpen a terminal or command prompt and run:\n\n```bash\ndocker pull anthropic/anthropic-proxy\n```\n\n### Step 3: Run the Anthropic Proxy Container\n\nAfter the image is downloaded, start a container from the image:\n\n```bash\ndocker run -d --name", "metrics": { "length": 1075, "commands": 6, "command_list": [ "sudo apt update", "sudo apt install docker.io -y", "sudo systemctl start docker", "sudo systemctl enable docker", "brew install docker" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "api rate limit handling best practices (api-rate-limit-handling-best-practices)", "condition": "with_lesson", "status": 200, "content": "Here's a concrete, actionable fix for the API rate limit handling issue:\n\n**Step 1: Implement exponential backoff and retry mechanism**\n\nYou can use the `tenacity` library in Python to implement an exponential backoff and retry mechanism. This will ensure that your program doesn't make too many requests in a short period of time, which can trigger rate limits.\n\nFirst, install the `tenacity` library:\n```bash\npip install tenacity\n```\nThen, modify your code to use the `tenacity` library:\n```python\nimport time\nimport requests\nimport tenacity\n\n@tenacity.retry(wait=tenacity.wait_exponential(multiplier=1, min=4, max=10))\ndef make_request(api_url, headers):\n try:\n resp = requests.get(api_url, headers=headers)\n resp.raise_for_status()\n except requests.HTTPError as e:\n if e.response.status_code == 429:\n raise\n else:\n raise\n\n# Usage\napi_url = \"https://example.com/api/endpoint\"\nheaders = {\"Authorization\": \"Bearer YOUR_TOKEN\"}\nmake_request(api_url, headers)\n```\nIn this code, the `make_request` function is decorated with the `@tenacity.retry` decorator", "metrics": { "length": 1110, "commands": 1, "command_list": [ "pip install tenacity" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 3, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "api rate limit handling best practices (api-rate-limit-handling-best-practices)", "condition": "plain", "status": 200, "content": "To handle API rate limits effectively, you can implement the following best practices:\n\n### 1. Use a Rate Limiting Library\n\nOne popular library for rate limiting in Python is `ratelimit`. You can install it using pip:\n\n```bash\npip install ratelimit\n```\n\n### 2. Implement a Retry Mechanism\n\nWhen an API returns a rate limit error, you can retry the request after a certain delay. This approach can help you avoid hitting the rate limit too frequently.\n\nHere's an example implementation using `ratelimit` and `time`:\n\n```python\nimport ratelimit\nimport time\nimport requests\n\ndef make_request(url, params):\n @ratelimit.limits(calls=10, period=60) # 10 calls per minute\n def wrapper():\n response = requests.get(url, params=params)\n response.raise_for_status()\n return response.json()\n return wrapper()\n\nurl = 'https://api.example.com/endpoint'\nparams = {'key': 'value'}\n\ntry:\n result = make_request(url, params)\n print(result)\nexcept requests.exceptions.HTTPError as errh:\n print(f'HTTP Error: {errh}')\nexcept requests.exceptions.ConnectionError as errc:\n print(f", "metrics": { "length": 1101, "commands": 1, "command_list": [ "pip install ratelimit" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 3, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "An Unlikely Database Migration: From JSON Files to etcd (an-unlikely-database-migration)", "condition": "plain", "status": 200, "content": "To migrate data from JSON files to etcd, you'll need to follow these steps. This guide assumes you have etcd installed and running, and you have JSON files containing the data you wish to migrate.\n\n### Step 1: Install etcd\n\nIf you haven't installed etcd yet, you can do so by following the instructions for your operating system on the [etcd installation page](https://etcd.io/docs/v3.5/install/). For a quick setup on a Linux system, you might use:\n\n```bash\n# Download and install etcd\nwget https://github.com/etcd-io/etcd/releases/download/v3.5.4/etcd-v3.5.4-linux-amd64.tar.gz\ntar -xvf etcd-v3.5.4-linux-amd64.tar.gz\nmv etcd-v3.5.4-linux-amd64/etcd* /usr/local/bin/\n\n# Start etcd\netcd\n```\n\nFor production environments, consider running etcd as a service and configuring it appropriately for your needs.\n\n### Step 2: Prepare Your JSON Data\n\nEnsure your JSON files are properly formatted and contain the data you wish to migrate. For example, if you have a file", "metrics": { "length": 962, "commands": 4, "command_list": [ "wget https://github.com/etcd-io/etcd/releases/download/v3.5.4/etcd-v3.5.4-linux-amd64.tar.gz", "tar -xvf etcd-v3.5.4-linux-amd64.tar.gz", "mv etcd-v3.5.4-linux-amd64/etcd* /usr/local/bin/", "etcd" ], "has_command_block": true, "actionable": true, "inline_code_count": 1, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "Internal Gateway — Incompatible with Anthropic Format, Requires OpenAI Proxy (anthropic-proxy-internal-gateway)", "condition": "with_lesson", "status": 200, "content": "To fix the \"Internal Gateway — Incompatible with Anthropic Format, Requires OpenAI Proxy\" error, you need to set up a local proxy server that converts the Anthropic format to the OpenAI format. Here's a step-by-step guide to achieve this:\n\n### Step 1: Install `node` and `npm` (if not already installed)\n\nFirst, ensure you have Node.js and npm installed on your system. You can download them from [https://nodejs.org/](https://nodejs.org/).\n\n### Step 2: Create a New Node.js Project\n\nCreate a new directory for your proxy project and initialize a new Node.js project:\n\n```bash\nmkdir anthropic-to-openai-proxy\ncd anthropic-to-openai-proxy\nnpm init -y\n```\n\n### Step 3: Install Required Packages\n\nInstall the required packages, including `express` for the server and `axios` for making HTTP requests:\n\n```bash\nnpm install express axios\n```\n\n### Step 4: Create the Proxy Server\n\nCreate a file named `proxy.js` in your project directory and add the following code:\n\n```javascript\nconst express = require('express');\nconst axios = require('axios');\nconst app = express();\napp.use(express.json());\n\nconst", "metrics": { "length": 1097, "commands": 4, "command_list": [ "mkdir anthropic-to-openai-proxy", "cd anthropic-to-openai-proxy", "npm init -y", "npm install express axios" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "api gateway anthropic incompatibility (api-gateway-anthropic-incompatibility)", "condition": "plain", "status": 200, "content": "The \"api gateway anthropic incompatibility\" error is not a standard or known error in the context of API Gateway or related technologies. It seems to be a fictional or humorous error message, possibly referencing the concept of \"anthropic principle\" in a whimsical way. However, I'll provide a structured approach to troubleshooting API Gateway issues, which might help resolve actual problems you're facing.\n\n### Step 1: Review API Gateway Logs\nFirst, check the API Gateway logs for any specific error messages that might indicate the cause of the issue. You can do this using the AWS Management Console or AWS CLI.\n\n- **Using AWS CLI:**\n ```bash\n aws apigateway get-rest-apis --query 'items[]|{name, id}'\n ```\n This command lists all your REST APIs. Note the ID of the API you're interested in.\n\n Then, to get logs for a specific API, you might need to use CloudWatch Logs if you have logging enabled:\n ```bash\n aws logs describe-log-groups --query 'logGroups[]|{logGroupName}'\n ```\n Look for the log group related to your API Gateway and use the `aws logs` commands to filter and view logs.\n\n### Step 2: Check API", "metrics": { "length": 1125, "commands": 2, "command_list": [ "aws apigateway get-rest-apis --query 'items[]|{name, id}'", "aws logs describe-log-groups --query 'logGroups[]|{logGroupName}'" ], "has_command_block": true, "actionable": true, "inline_code_count": 4, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "API 请求限流 (Rate Limit) 处理方案 (api-rate-limit-handling)", "condition": "with_lesson", "status": 200, "content": "Here is a concrete and actionable fix for the API request limit handling issue:\n\n**Fix 1: Implement Exponential Backoff**\n\nWe'll modify the `api_call_with_retry` function to implement exponential backoff. This will ensure that the script waits for an increasing amount of time between retries.\n\n```python\nimport time\nimport requests\nimport random\n\ndef api_call_with_retry(url, headers, max_retries=5, initial_delay=2):\n delay = initial_delay\n for i in range(max_retries):\n resp = requests.get(url, headers=headers)\n \n if resp.status_code == 200:\n return resp.json()\n \n if resp.status_code == 429:\n wait = int(resp.headers.get(\"Retry-After\", 0))\n print(f\"限流,等待 {wait} 秒后重试...\")\n time.sleep(wait)\n delay *= 2 # exponential backoff\n delay += random.uniform(0, 1) # add some randomness to avoid synchronization\n continue\n \n # other errors don't retry\n resp.raise_for_status()\n \n raise Exception(f\"超过最大重试次数: {url}\")\n\n# Test the function\nurl = \"https://api.github.com/r", "metrics": { "length": 1110, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 1, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "API 请求限流 (Rate Limit) 处理方案 (api-rate-limit-handling)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely related to the API rate limit being exceeded. Here's a concrete, actionable fix with exact commands for popular programming languages:\n\n**For Node.js using `axios` library:**\n\n1. Install the `rate-limiter-flexible` library using npm:\n\n```bash\nnpm install rate-limiter-flexible\n```\n\n2. Import the library and create a rate limiter instance:\n\n```javascript\nconst rateLimiter = require('rate-limiter-flexible');\nconst axios = require('axios');\n\nconst apiEndpoint = 'https://api.example.com';\nconst limiter = rateLimiter({\n points: 10, // 10 requests per minute\n duration: 60, // in seconds\n});\n\nconst axiosInstance = axios.create({\n adapter: (config) => {\n return new Promise((resolve, reject) => {\n limiter.consume(config.headers['x-rate-limit-requests'], config.headers['x-rate-limit-reset'])\n .then(() => {\n resolve(axios(config));\n })\n .catch((error) => {\n reject(error);\n });\n });\n },\n});\n\n// Use the axios instance to make API requests\naxiosInstance.get(apiEndpoint)\n .then((response) => {\n console.log", "metrics": { "length": 1110, "commands": 1, "command_list": [ "npm install rate-limiter-flexible" ], "has_command_block": true, "actionable": true, "inline_code_count": 4, "lesson_hits": 3, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "api rate limit handling best practices (api-rate-limit-handling-best-practices)", "condition": "with_lesson", "status": 200, "content": "To address the API rate limit handling issue, we'll implement the following concrete and actionable fixes:\n\n### Step 1: Pilot Test to Determine Rate Limit Threshold\n\nFirst, we need to determine the rate limit threshold of the API. We can do this by running a small pilot test with an increasing rate of requests.\n\n```python\nimport time\nimport requests\n\ndef pilot_test(api_url, headers, sample_size=100, rate_per_second=5):\n \"\"\"Use a small sample to test API rate limit threshold\"\"\"\n success = 0\n rate_limited = 0\n interval = 1.0 / rate_per_second\n\n for i in range(sample_size):\n resp = requests.get(api_url, headers=headers)\n if resp.status_code == 200:\n success += 1\n elif resp.status_code == 429:\n rate_limited += 1\n print(f\"Rate limit triggered at request {i+1}, current rate: {rate_per_second} req/s\")\n break\n time.sleep(interval)\n\n print(f\"Success: {success}, Rate Limited: {rate_limited}\")\n\n# Example usage:\napi_url = \"https://example.com/api/endpoint\"\nheaders = {\"Authorization\": \"Bearer YOUR_API", "metrics": { "length": 1093, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 0, "lesson_hits": 5, "lesson_hit_rate": 0.833 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "api gateway anthropic incompatibility (api-gateway-anthropic-incompatibility)", "condition": "with_lesson", "status": 200, "content": "To resolve the \"api gateway anthropic incompatibility\" error, you need to adjust the configuration of your Hermes Agent to ensure compatibility with the internal-gateway.local API. The API endpoint `https://api.internal-gateway.local/v1` only supports OpenAI format (`/v1/chat/completions`), but your Hermes Agent is configured to send requests in Anthropic native format (`/v1/messages`).\n\nHere's a step-by-step guide to fix this issue:\n\n### Option 1: Configure Hermes to Use OpenAI Compatible Format\n\n1. **Open your `config.yaml` file** in a text editor. This file is typically located in the root directory of your Hermes Agent installation.\n\n2. **Update the `provider` configuration** to use OpenAI compatible format. Change or add the following lines in your `config.yaml`:\n\n```yaml\nprovider: openai\napi_base: https://api.internal-gateway.local/v1\n```\n\n3. **Save the changes** to the `config.yaml` file.\n\n4. **Restart your Hermes Agent** to apply the changes. The exact command to restart may vary depending on how you're running Hermes. If you're running it as a service, you might use a command like:\n\n```bash", "metrics": { "length": 1116, "commands": 2, "command_list": [ "3. **Save the changes** to the `config.yaml` file.", "4. **Restart your Hermes Agent** to apply the changes. The exact command to restart may vary depending on how you're running Hermes. If you're running it as a service, you might use a command like:" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 3, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "api rate limit handling best practices (api-rate-limit-handling-best-practices)", "condition": "plain", "status": 200, "content": "To handle API rate limits effectively, consider implementing the following best practices. I'll provide a concrete example using Python and the `requests` library, along with the `time` module for handling delays.\n\n### Step 1: Understand the Rate Limit\n\nFirst, you need to understand the rate limit imposed by the API you're interacting with. This information is usually found in the API's documentation and includes details such as the number of requests allowed per minute/hour/day and the reset time.\n\n### Step 2: Implement Rate Limiting in Your Code\n\nHere's an example of how you can implement a basic rate limiter in Python. This script will make requests to an API, wait if the rate limit is exceeded, and then continue.\n\n```python\nimport requests\nimport time\n\nclass RateLimiter:\n def __init__(self, max_requests, period):\n \"\"\"\n Initialize the rate limiter.\n\n :param max_requests: Maximum number of requests allowed within the period.\n :param period: Time period in seconds.\n \"\"\"\n self.max_requests = max_requests\n self.period = period\n self.requests_made = 0\n self.reset_time = time.time()\n\n def make_request(self, url):\n \"\"\"\n Make a request", "metrics": { "length": 1231, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 2, "lesson_hits": 3, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Python asyncio CancelledError Silently Swallows Resources in Long-Running Services (asyncio-cancellederror-swallows-resources)", "condition": "with_lesson", "status": 200, "content": "**Fixing asyncio CancelledError Silently Swallows Resources in Long-Running Services**\n\nThe issue arises when an asyncio task is cancelled during `await`, causing a `CancelledError` that is silently swallowed by the task's exception handler. This leads to resource leaks, as the task's resources (e.g., file handles, connections, locks) are not released.\n\nTo fix this issue, we need to explicitly clean up resources held by the task before it is garbage collected. We can achieve this by using `task.add_done_callback()` to check for `CancelledError` and perform cleanup.\n\nHere's a concrete, actionable fix with exact commands:\n\n**Step 1: Update the `fetch_data` coroutine to use a `try`-`finally` block for cleanup**\n\n```python\nimport asyncio\n\nasync def fetch_data():\n conn = await create_connection()\n try:\n data = await conn.read()\n return data\n finally:\n await conn.close()\n```\n\n**Step 2: Create a `safe_task_wrapper` function that adds a cleanup callback**\n\n```python\nasync def safe_task_wrapper(coro):\n task = asyncio.create_task(coro)\n \n def cleanup_callback(task):\n if task.cancelled():\n print(f\"Task {", "metrics": { "length": 1167, "commands": 1, "command_list": [ "**Step 2: Create a `safe_task_wrapper` function that adds a cleanup callback**" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 5, "lesson_hit_rate": 0.833 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Python asyncio CancelledError Silently Swallows Resources in Long-Running Services (asyncio-cancellederror-swallows-resources)", "condition": "plain", "status": 200, "content": "The `asyncio.CancelledError` silently swallows resources in long-running services because it doesn't properly clean up the task's resources when it's cancelled. This is a known issue in Python's asyncio library.\n\nHere's a concrete, actionable fix to address this issue:\n\n**Step 1: Upgrade to Python 3.10 or later**\n\nPython 3.10 and later versions include a fix for this issue. If you're using an earlier version, upgrade to the latest version of Python.\n\n**Step 2: Use `asyncio.create_task` with `return_exceptions=True`**\n\nYou can use the `return_exceptions=True` parameter when creating a task to ensure that tasks that are cancelled will raise a `CancelledError` instead of silently swallowing resources. Here's an example:\n\n```python\nimport asyncio\n\nasync def my_long_running_service():\n # Your long-running service code here\n await asyncio.sleep(10)\n\nasync def main():\n task = asyncio.create_task(my_long_running_service(), return_exceptions=True)\n try:\n await asyncio.sleep(5) # Cancel the task after 5 seconds\n except asyncio.CancelledError:\n pass\n else:\n print(\"Task completed normally\")\n finally:\n task.cancel()\n\nasyncio", "metrics": { "length": 1179, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 5, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "API 请求限流 (Rate Limit) 处理方案 (api-rate-limit-handling)", "condition": "with_lesson", "status": 200, "content": "To handle API rate limiting, you can implement an exponential backoff strategy in your Python script. Here's a concrete and actionable fix:\n\n**Step 1: Install the required libraries**\n\nYou'll need the `requests` library to make API calls. You can install it using pip:\n```bash\npip install requests\n```\n**Step 2: Implement exponential backoff**\n\nCreate a new Python file (e.g., `api_rate_limit_handling.py`) and add the following code:\n```python\nimport time\nimport requests\n\ndef api_call_with_retry(url, headers, max_retries=5):\n for i in range(max_retries):\n resp = requests.get(url, headers=headers)\n \n if resp.status_code == 200:\n return resp.json()\n \n if resp.status_code == 429:\n wait = int(resp.headers.get(\"Retry-After\", 2 ** i))\n print(f\"Rate limit exceeded, waiting {wait} seconds before retrying...\")\n time.sleep(wait)\n continue\n \n # Other errors are not retried\n resp.raise_for_status()\n \n raise Exception(f\"Exceeded maximum retry count: {url}\")\n\n# Example usage:\nurl = \"https://api.example.com/endpoint\"\nheaders = {\"", "metrics": { "length": 1147, "commands": 1, "command_list": [ "pip install requests" ], "has_command_block": true, "actionable": true, "inline_code_count": 4, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Moorcheh API Auth Header Bug (auth-header-bug)", "condition": "with_lesson", "status": 200, "content": "To fix the Moorcheh API Auth Header Bug, you need to add the `Bearer` prefix to your authentication token before sending it in the `Authorization` header. Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Update your Python code**\n\n```python\nimport requests\n\n# Assuming you have a token variable\ntoken = 'your_auth_token_here'\n\n# Check if token exists\nif not token:\n print(\"Error: Token is missing\")\n exit(1)\n\n# Add Bearer prefix to the token\nheaders = {\n \"Authorization\": f\"Bearer {token}\",\n \"Content-Type\": \"application/json\"\n}\n\n# Send the request\ntry:\n response = requests.get('https://api.moorcheh.com/api/v1/your-endpoint', headers=headers)\n response.raise_for_status() # Raise an exception for HTTP errors\nexcept requests.exceptions.RequestException as e:\n print(f\"Error: {e}\")\n exit(1)\n```\n\n**Step 2: Verify the fix**\n\n```bash\necho \"Lesson: Moorcheh API Auth Header Bug\"\nwc -l lessons/contrib/auth-header-bug.md\n```\n\nThis should print the line count for the `auth-header-bug.md", "metrics": { "length": 1025, "commands": 1, "command_list": [ "**Step 2: Verify the fix**" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Moorcheh API Auth Header Bug (auth-header-bug)", "condition": "plain", "status": 200, "content": "The Moorcheh API Auth Header Bug is typically caused by a mismatch between the expected and actual authentication headers. Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Check the expected authentication headers**\n\nYou can check the expected authentication headers by looking at the Moorcheh API documentation or contacting their support team.\n\n**Step 2: Update your code to include the correct authentication headers**\n\nAssuming you're using Python and the `requests` library, here's an example of how to update your code to include the correct authentication headers:\n\n```bash\n# Update the authentication headers in your Python code\nimport requests\nimport json\n\n# Replace with your Moorcheh API credentials\nusername = 'your-username'\npassword = 'your-password'\n\n# Set the authentication headers\nheaders = {\n 'Authorization': f'Bearer {username}',\n 'Content-Type': 'application/json',\n 'X-Moorcheh-Api-Key': 'your-api-key'\n}\n\n# Set the API endpoint URL\nurl = 'https://api.moorcheh.com/v1/endpoint'\n\n# Set the request data\ndata = {\n 'key': 'your-data-key',\n 'value': 'your-data-value'\n}\n\n# Make the GET request\nresponse", "metrics": { "length": 1153, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 1, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "API 请求限流 (Rate Limit) 处理方案 (api-rate-limit-handling)", "condition": "plain", "status": 200, "content": "To handle API rate limiting, you can implement the following steps:\n\n1. **Check the API documentation**: Review the API documentation to understand the rate limiting rules, including the number of requests allowed per minute, hour, or day.\n2. **Implement exponential backoff**: When you receive a rate limit error, wait for a certain amount of time before retrying the request. The wait time should increase exponentially after each retry.\n3. **Use a queue or buffer**: Store incoming requests in a queue or buffer and process them at a rate that is within the allowed limits.\n4. **Cache responses**: Cache responses from the API to reduce the number of requests made.\n\nHere is an example of how you can implement exponential backoff in Python:\n```python\nimport time\nimport random\n\ndef api_request(url):\n # Simulate an API request\n print(f\"Making request to {url}\")\n\ndef handle_rate_limit(error):\n # Implement exponential backoff\n wait_time = 1\n for attempt in range(5):\n print(f\"Rate limit error, waiting {wait_time} seconds...\")\n time.sleep(wait_time)\n wait_time *= 2\n try:\n api_request(url)\n break\n except Exception as e:\n print", "metrics": { "length": 1214, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 3, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "Python asyncio CancelledError Silently Swallows Resources in Long-Running Services (asyncio-cancellederror-swallows-resources)", "condition": "with_lesson", "status": 200, "content": "To fix the issue of Python asyncio CancelledError silently swallowing resources in long-running services, follow these steps:\n\n### Step 1: Modify Your Coroutine to Clean Up Resources\n\nFirst, ensure that your coroutine (in this case, `fetch_data`) cleans up any resources it uses, regardless of whether it completes normally or is cancelled. You can achieve this by using a `try`/`finally` block.\n\n```python\nimport asyncio\n\nasync def fetch_data():\n conn = await create_connection()\n try:\n return await conn.read()\n finally:\n await conn.close() # Cleanup on any exit\n```\n\n### Step 2: Implement a Safe Task Wrapper\n\nCreate a function that wraps your coroutine in a task and adds a done callback to handle the cleanup when the task is cancelled.\n\n```python\nasync def safe_task_wrapper(coro):\n task = asyncio.create_task(coro)\n \n def cleanup_callback(t):\n if t.cancelled():\n print(f\"Task {t.get_name()} was cancelled, cleaning up\")\n # Any additional cleanup here, e.g., closing files, releasing locks\n # For demonstration, assume we have a function to release resources\n release_resources()\n \n task.add_done_callback(cleanup_callback)\n", "metrics": { "length": 1220, "commands": 1, "command_list": [ "Create a function that wraps your coroutine in a task and adds a done callback to handle the cleanup when the task is cancelled." ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Benchmark Honesty — Distinguishing Simulated vs Real Results (benchmark-honesty-simulated-vs-real)", "condition": "with_lesson", "status": 200, "content": "To fix the benchmark honesty issue, you need to clearly label what's real vs simulated and use honest framing. Here's a concrete, actionable fix with exact commands:\n\n1. Clearly Label What's Real vs Simulated:\n\nUpdate the `benchmark.json` file to include the following information:\n\n```json\n{\n \"kind\": \"search_retrieval_probe\",\n \"simulated_execution\": true,\n \"note\": \"task_b_pass and ci_pr_compliance are simulated\"\n}\n```\n\n2. Use Honest Framing:\n\nUpdate the `benchmark-honesty-simulated-vs-real` benchmark to use honest framing:\n\n```bash\necho \"Search retrieval probe shows lessons can be found for 5/5 scenarios\" > benchmark-honesty-simulated-vs-real.txt\n```\n\n3. Separate Concerns:\n\nUpdate the `benchmark-honesty-simulated-vs-real` benchmark to separate concerns:\n\n```bash\necho \"Task execution was simulated (hardcoded)\" >> benchmark-honesty-simulated-vs-real.txt\necho \"Result verification was simulated (hardcoded)\" >> benchmark-honesty-simulated-vs-real.txt\necho \"Lesson search was real (using search_knowledge.py)\" >> benchmark-honesty-simulated-vs-real.txt\n``", "metrics": { "length": 1066, "commands": 4, "command_list": [ "2. Use Honest Framing:", "Update the `benchmark-honesty-simulated-vs-real` benchmark to use honest framing:", "3. Separate Concerns:", "Update the `benchmark-honesty-simulated-vs-real` benchmark to separate concerns:" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Benchmark Honesty — Distinguishing Simulated vs Real Results (benchmark-honesty-simulated-vs-real)", "condition": "plain", "status": 200, "content": "To fix the error \"Benchmark Honesty — Distinguishing Simulated vs Real Results (benchmark-honesty-simulated-vs-real)\", you need to make sure that you have the required packages installed.\n\nHere are the steps to fix the error:\n\n**Step 1: Install required packages**\n\nIf you're using Python, you can install the required packages using pip:\n\n```bash\npip install benchmark-honesty\npip install pytest\n```\n\nIf you're using R, you can install the required packages using R Studio or the command line:\n\n```bash\ninstall.packages(\"benchmark\")\ninstall.packages(\"honesty\")\n```\n\n**Step 2: Update your code**\n\nAfter installing the required packages, update your code to use the correct benchmarking functions. For example, if you're using Python, you can use the `benchmark_honesty` function from the `benchmark-honesty` package to compare simulated and real results:\n\n```python\nimport benchmark_honesty as bh\nimport pandas as pd\n\n# Define your data\ndata = pd.DataFrame({'column1': [1, 2, 3], 'column2': [4, 5, 6]})\n\n# Define your simulation function\ndef simulation():\n return data *", "metrics": { "length": 1073, "commands": 4, "command_list": [ "pip install benchmark-honesty", "pip install pytest", "install.packages(\"benchmark\")", "install.packages(\"honesty\")" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 2, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "Moorcheh API Auth Header Bug (auth-header-bug)", "condition": "with_lesson", "status": 200, "content": "To fix the Moorcheh API Auth Header Bug, follow these steps:\n\n### Step 1: Update the Authorization Header\n\nIn your Python code, update the `headers` dictionary to include the `Bearer` prefix in the `Authorization` header. Replace the existing code with the following:\n\n```python\nheaders = {\n \"Authorization\": f\"Bearer {token}\",\n \"Content-Type\": \"application/json\"\n}\n```\n\n### Step 2: Add Token Validation\n\nAdd a validation check to ensure that the `token` exists before sending the request. You can do this by adding a simple `if` statement:\n\n```python\nif token:\n headers = {\n \"Authorization\": f\"Bearer {token}\",\n \"Content-Type\": \"application/json\"\n }\n # Send the request\nelse:\n print(\"Error: Token is missing\")\n # Handle the error\n```\n\n### Step 3: Add Error Handling\n\nAdd error handling to catch any exceptions that may occur during the request. You can use a `try-except` block to catch any errors:\n\n```python\ntry:\n if token:\n headers = {\n \"Authorization\": f\"Bearer {token}\",\n \"Content-Type\": \"application/json\"\n }\n # Send", "metrics": { "length": 1104, "commands": 2, "command_list": [ "Add a validation check to ensure that the `token` exists before sending the request. You can do this by adding a simple `if` statement:", "Add error handling to catch any exceptions that may occur during the request. You can use a `try-except` block to catch any errors:" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "Python asyncio CancelledError Silently Swallows Resources in Long-Running Services (asyncio-cancellederror-swallows-resources)", "condition": "plain", "status": 200, "content": "**Fixing asyncio CancelledError Resource Swallowing**\n\nTo prevent `asyncio.CancelledError` from silently swallowing resources in long-running services, you can use the following approach:\n\n### Step 1: Ensure Cleanup in Except Blocks\n\nWhen using `try-except` blocks in your asynchronous code, make sure to include cleanup code in the `except` block to handle the `CancelledError` exception. This ensures that resources are properly released even when a task is cancelled.\n\n```python\nimport asyncio\n\nasync def my_task():\n try:\n # Your task code here\n await asyncio.sleep(10)\n except asyncio.CancelledError:\n # Cleanup code here\n print(\"Task was cancelled, cleaning up resources...\")\n finally:\n # Additional cleanup code that should always run\n print(\"Releasing resources...\")\n\n# Example usage:\nasync def main():\n task = asyncio.create_task(my_task())\n await asyncio.sleep(5)\n task.cancel()\n\nasyncio.run(main())\n```\n\n### Step 2: Use `try-except` with `asyncio.gather`\n\nWhen using `asyncio.gather` to run multiple tasks concurrently, you can use a `try-except` block to catch `CancelledError` exceptions and ensure cleanup", "metrics": { "length": 1178, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 10, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "BGE Embedding Fallback Crash (bge-embedding-fallback-crash)", "condition": "with_lesson", "status": 200, "content": "To fix the BGE Embedding Fallback Crash, you'll need to make the following changes:\n\n### 1. Remove the hard-coded absolute path and use the EMBEDDING_MODEL_PATH environment variable\n\nUpdate the `skill_indexer.py` file to use the `EMBEDDING_MODEL_PATH` environment variable instead of a hard-coded absolute path:\n\n```python\nimport os\n\n# ...\n\ndef _init_embedding_model(model_name):\n embedding_model_path = os.environ.get('EMBEDDING_MODEL_PATH')\n if embedding_model_path is None:\n raise ValueError(\"EMBEDDING_MODEL_PATH environment variable not set\")\n\n # ...\n```\n\n### 2. Wrap loading failures in try/except and degrade to no-embedding mode\n\nUpdate the `skill_indexer.py` file to wrap loading failures in try/except and degrade to no-embedding mode:\n\n```python\ntry:\n _init_embedding_model(model_name)\nexcept Exception as e:\n # degrade to no-embedding mode\n register_skill(model_name, skip_semantic_deduplication=True)\n```\n\n### 3. Make _generate_embedding() return an empty list\n\nUpdate the `skill_indexer.py` file to make `_generate_embedding()` return an empty list:\n\n```python", "metrics": { "length": 1099, "commands": 2, "command_list": [ "Update the `skill_indexer.py` file to wrap loading failures in try/except and degrade to no-embedding mode:", "Update the `skill_indexer.py` file to make `_generate_embedding()` return an empty list:" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 3, "lesson_hit_rate": 0.75 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "BGE Embedding Fallback Crash (bge-embedding-fallback-crash)", "condition": "plain", "status": 200, "content": "The BGE Embedding Fallback Crash error is typically caused by a mismatch between the Blender version and the Blender Embedded (BGE) version. Here's a step-by-step guide to fix the issue:\n\n**Prerequisites:**\n\n* You have Blender installed on your system.\n* You have the latest version of Blender installed (at least 3.0).\n\n**Step 1: Update Blender Embedded (BGE)**\n\n1. Open Blender and go to **Window** > **System Properties**.\n2. In the **System Properties** window, click on **Blender Embedded**.\n3. Click on the **Update** button next to **Blender Embedded**.\n4. Wait for the update to complete.\n\n**Step 2: Update Blender**\n\n1. Open Blender and go to **Help** > **Check for Updates**.\n2. If an update is available, click on the **Update Now** button.\n3. Wait for the update to complete.\n\n**Step 3: Re-Enable Blender Embedded**\n\n1. Go back to **Window** > **System Properties**.\n2. In the **System Properties** window, click on **Blender Embedded**.\n3. Check the box next to **Enable Blender Embedded**.\n4. Click on", "metrics": { "length": 1015, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "Benchmark Honesty — Distinguishing Simulated vs Real Results (benchmark-honesty-simulated-vs-real)", "condition": "with_lesson", "status": 200, "content": "To address the issue of presenting simulated or partial results as real evidence in benchmark contributions, follow these concrete, actionable steps:\n\n### 1. Clearly Label What's Real vs Simulated\n\nFirst, ensure that your benchmark results are clearly labeled as either real or simulated. This can be done by including a JSON object in your results that specifies the nature of the execution. For example:\n\n```json\n{\n \"kind\": \"search_retrieval_probe\",\n \"simulated_execution\": true,\n \"note\": \"task_b_pass and ci_pr_compliance are simulated\"\n}\n```\n\n**Command to Create a JSON File:**\n\nIf you're working in a Linux or macOS environment, you can create a JSON file with the above content using the following command:\n\n```bash\necho '{\n \"kind\": \"search_retrieval_probe\",\n \"simulated_execution\": true,\n \"note\": \"task_b_pass and ci_pr_compliance are simulated\"\n}' > benchmark_results.json\n```\n\n### 2. Use Honest Framing\n\nWhen describing your benchmark results, use framing that accurately reflects the nature of the results. Avoid making claims that could be misleading.\n\n- **Incorrect:** \"Benchmark shows +31% improvement with lessons\"\n- **Correct:** \"Search", "metrics": { "length": 1157, "commands": 2, "command_list": [ "**Command to Create a JSON File:**", "If you're working in a Linux or macOS environment, you can create a JSON file with the above content using the following command:" ], "has_command_block": true, "actionable": true, "inline_code_count": 3, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "中文 BM25 搜索:滑动窗口子串加分与唯一候选加分 (bm25-chinese-sliding-window-tuning)", "condition": "with_lesson", "status": 200, "content": "To fix the issue with the Chinese BM25 search having low recall and insufficient sensitivity to short tokens, you can apply the following modifications to your BM25 implementation. We will use the `sliding_window_boost` and `unique_candidate_boost` functions provided in the lesson.\n\nHere's the updated Python code:\n\n```python\nimport numpy as np\nfrom scipy import spatial\n\n# BM25 parameters\nk1 = 1.2\nb = 0.75\nalpha = 1.2\nnum_docs = 1000\nnum_terms = 1000\n\n# Calculate IDF\ndef calculate_idf(doc_freq, num_docs):\n idf = np.log(num_docs / doc_freq)\n return idf\n\n# BM25 scoring function\ndef bm25_score(query, doc):\n doc_tokens = doc.split()\n query_tokens = query.split()\n doc_length = len(doc_tokens)\n query_length = len(query_tokens)\n idf = calculate_idf(doc_freq, num_docs)\n \n # Calculate BM25 score\n score = (k1 * (query_length + 0.5) * np.log((1 + 0.5 + b * (doc_length - 1)) / (1 + b * (doc_length", "metrics": { "length": 927, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 2, "lesson_hits": 3, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "Benchmark Honesty — Distinguishing Simulated vs Real Results (benchmark-honesty-simulated-vs-real)", "condition": "plain", "status": 200, "content": "To address the \"Benchmark Honesty — Distinguishing Simulated vs Real Results\" issue, it's essential to understand that this problem often arises in the context of evaluating the performance of algorithms, systems, or applications. Benchmark honesty refers to the practice of ensuring that benchmarks accurately reflect real-world performance and are not skewed by artificial or simulated conditions that might not represent typical usage scenarios.\n\nWithout a specific context (e.g., programming language, framework, or application), I'll provide a general approach to tackling this issue, focusing on distinguishing simulated from real results in benchmarking:\n\n### 1. Identify the Benchmarking Goals\n\nClearly define what aspects of performance you are trying to measure (e.g., execution time, memory usage, throughput). This step is crucial for designing honest and relevant benchmarks.\n\n### 2. Choose Realistic Data and Scenarios\n\n- **Use Real Data:** When possible, use real data that your application or system would encounter in production. This helps ensure that your benchmarks reflect real-world performance.\n- **Simulate Realistic Scenarios:** If you must simulate data or scenarios, ensure they closely mimic real-world conditions. Consider factors like data distribution, user behavior, and potential edge cases.\n\n### 3. Implement Benchmarking Tools\n\nDepending on your environment,", "metrics": { "length": 1393, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "中文 BM25 搜索:滑动窗口子串加分与唯一候选加分 (bm25-chinese-sliding-window-tuning)", "condition": "plain", "status": 200, "content": "To fix the error \"中文 BM25 搜索:滑动窗口子串加分与唯一候选加分 (bm25-chinese-sliding-window-tuning)\", we need to update the BM25 scoring function to support Chinese characters.\n\nHere's a step-by-step solution:\n\n**Step 1: Install the required library**\n\nYou need to install the `nltk` library with the `cmudict` and `pyspellchecker` packages. You can install them using the following command:\n\n```bash\npip install nltk cmudict pyspellchecker\n```\n\n**Step 2: Download the required data**\n\nYou need to download the following NLTK data:\n\n```python\nimport nltk\nnltk.download('cmudict')\nnltk.download('pyspellchecker')\n```\n\n**Step 3: Update the BM25 scoring function**\n\nYou need to update the BM25 scoring function to support Chinese characters. Here's an example of how you can do it:\n\n```python\nimport re\nfrom nltk.corpus import cmudict\nfrom pyspellchecker import SpellChecker\n\nclass BM25:\n def __init__(self, idf, weight):\n self.idf = idf\n self.weight = weight\n\n def calculate", "metrics": { "length": 974, "commands": 3, "command_list": [ "pip install nltk cmudict pyspellchecker", "**Step 3: Update the BM25 scoring function**", "You need to update the BM25 scoring function to support Chinese characters. Here's an example of how you can do it:" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 1, "lesson_hit_rate": 0.167 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "BGE Embedding Fallback Crash (bge-embedding-fallback-crash)", "condition": "plain", "status": 200, "content": "To address the \"BGE Embedding Fallback Crash\" issue, you'll need to update your graphics drivers and possibly adjust some system settings. Here's a step-by-step guide to help you resolve this problem:\n\n### 1. Update Graphics Drivers\n\nOutdated graphics drivers can cause compatibility issues leading to crashes. Update your drivers to the latest version:\n\n- **For Windows:**\n 1. Press `Win + X` and select Device Manager.\n 2. Expand the \"Display Adapters\" section.\n 3. Right-click your graphics card and select \"Update driver\".\n 4. Choose \"Search automatically for updated driver software\" and follow the prompts.\n\n- **For macOS (if applicable):**\n - Updates for macOS usually include graphics driver updates. Ensure your macOS is up to date:\n 1. Click the Apple menu and select \"System Preferences\".\n 2. Click \"Software Update\".\n\n- **For Linux:**\n - The process can vary depending on your distribution. For Ubuntu/Debian-based systems:\n 1. Open a terminal.\n 2. Run `sudo apt update`.\n 3. Run `sudo apt full-upgrade`.\n 4. Reboot your system.\n\n### 2", "metrics": { "length": 1071, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 3, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "BM25 + Vector Hybrid Search: configurable blending weights (bm25-vector-hybrid-search-weights)", "condition": "with_lesson", "status": 200, "content": "To fix the error, you need to add the configurable blending weights for BM25 + Vector Hybrid Search to your config.yaml or env vars. Here's a step-by-step guide:\n\n**Step 1: Update config.yaml**\n\nIf you have a config.yaml file, update it with the following configuration:\n\n```yaml\nsearch:\n hybrid:\n enabled: true\n bm25_weight: 0.7 # adjust the weight for BM25 score (0.0 - 1.0)\n vector_weight: 0.3 # adjust the weight for vector score (0.0 - 1.0)\n blend_method: rrf # options: rrf | linear\n```\n\nIn this example, we're setting the BM25 weight to 0.7 and the vector weight to 0.3, which means BM25 will have a higher impact on the search results.\n\n**Step 2: Update env vars (if applicable)**\n\nIf you're using environment variables, update them with the following commands:\n\n```bash\n# Set the BM25 weight\nexport BM25_WEIGHT=0.7\n\n# Set the vector weight\nexport VECTOR_WEIGHT=0.3\n\n# Set the blend method (optional)\nexport BLEND_METHOD", "metrics": { "length": 955, "commands": 3, "command_list": [ "In this example, we're setting the BM25 weight to 0.7 and the vector weight to 0.3, which means BM25 will have a higher impact on the search results.", "**Step 2: Update env vars (if applicable)**", "If you're using environment variables, update them with the following commands:" ], "has_command_block": true, "actionable": true, "inline_code_count": 2, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "Moorcheh API Auth Header Bug (auth-header-bug)", "condition": "plain", "status": 200, "content": "To fix the Moorcheh API Auth Header Bug (auth-header-bug), follow these steps. This solution assumes you are working with a typical API authentication setup and have access to modify the API's authentication headers.\n\n### Step 1: Identify the Issue\n\nFirst, you need to understand the nature of the bug. The Moorcheh API Auth Header Bug typically involves issues with how authentication headers are set or interpreted by the API. This could be due to incorrect header names, values, or formatting.\n\n### Step 2: Review API Documentation\n\nReview the Moorcheh API documentation to ensure you are setting the authentication headers correctly. Look for sections related to authentication, specifically how to format the `Authorization` header or any other headers required for authentication.\n\n### Step 3: Correct Header Format\n\nEnsure your authentication header is correctly formatted. For many APIs, the `Authorization` header should be in the format:\n```\nAuthorization: Bearer YOUR_TOKEN_HERE\n```\nReplace `YOUR_TOKEN_HERE` with your actual API token.\n\n### Step 4: Use Correct Header Name\n\nVerify that you are using the correct header name. While `Authorization` is standard, some APIs might use custom headers (e.g., `X-Auth-Token`).\n\n### Step 5:", "metrics": { "length": 1243, "commands": 1, "command_list": [ "Authorization: Bearer YOUR_TOKEN_HERE" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "BGE Embedding Fallback Crash (bge-embedding-fallback-crash)", "condition": "with_lesson", "status": 200, "content": "To fix the BGE Embedding Fallback Crash, follow these steps:\n\n### Step 1: Modify the `skill_indexer.py` File\n\n1. Open the `skill_indexer.py` file in your text editor.\n2. Locate the `_init_embedding_model()` function.\n3. Replace the hard-coded absolute path with a constructor parameter, and add a fallback mechanism to use the `EMBEDDING_MODEL_PATH` environment variable.\n\n```python\nimport os\n\nclass SkillIndexer:\n def __init__(self, embedding_model_path=None):\n self.embedding_model_path = embedding_model_path\n\n def _init_embedding_model(self):\n if self.embedding_model_path is None:\n self.embedding_model_path = os.environ.get('EMBEDDING_MODEL_PATH')\n if self.embedding_model_path is None:\n self.embedding_model_path = 'bge-m3' # auto-download\n\n try:\n # Load the model with local_files_only=False to allow auto-download\n self.embedding_model = EmbeddingModel(self.embedding_model_path, local_files_only=False)\n except Exception as e:\n # Degrade to no-embedding mode if loading fails\n print(f\"Error loading embedding model: {e}\")\n self.embedding_model = None", "metrics": { "length": 1179, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 4, "lesson_hits": 1, "lesson_hit_rate": 0.25 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "BM25 + Vector Hybrid Search: configurable blending weights (bm25-vector-hybrid-search-weights)", "condition": "plain", "status": 200, "content": "To fix the error \"BM25 + Vector Hybrid Search: configurable blending weights (bm25-vector-hybrid-search-weights)\" in Elasticsearch, you need to add the `bm25_vector` and `vector` modules to your `analysis-analyzer` configuration in your Elasticsearch index settings.\n\nHere's an example of how to do it:\n\n```json\n{\n \"settings\": {\n \"analysis\": {\n \"analyzer\": {\n \"my_analyzer\": {\n \"type\": \"custom\",\n \"tokenizer\": \"standard\",\n \"filter\": [\n \"lowercase\",\n \" PorterStemmer\",\n \"my BM25 filter\"\n ],\n \"char_filter\": [\n \"html\"\n ],\n \"filter\": [\n {\n \"name\": \"my BM25 filter\"\n },\n {\n \"name\": \"bm25_vector\"\n },\n {\n \"name\": \"vector\"\n }\n ]\n }\n },\n \"filter\": {\n \"my BM25 filter\": {\n \"type\": \"BM25\",\n \"lowercase_expansion\": true,\n \"field\": \"content\"\n }\n }\n }\n },\n \"mappings\": {\n \"properties\": {\n \"content\": {\n", "metrics": { "length": 1103, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 3, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "中文 BM25 搜索:滑动窗口子串加分与唯一候选加分 (bm25-chinese-sliding-window-tuning)", "condition": "with_lesson", "status": 200, "content": "To address the issue of low recall rates for long Chinese queries using the BM25 search algorithm, you can implement the following concrete and actionable fixes:\n\n### Step 1: Implement Sliding Window Substring Boosting\n\nFirst, you need to modify your search algorithm to include a sliding window approach for substring matching. This involves checking for substrings of the query within the documents and applying a boost to the score if matches are found.\n\n```python\ndef sliding_window_boost(query, doc, window_min=4, window_max=6, threshold=10):\n \"\"\"\n Apply a boost to the score based on sliding window substring matches.\n \n :param query: The search query.\n :param doc: The document to check against.\n :param window_min: Minimum window size (default=4).\n :param window_max: Maximum window size (default=6).\n :param threshold: Minimum query length to apply the boost (default=10).\n :return: The boost value.\n \"\"\"\n if len(query) < threshold:\n return 0\n boost = 0\n for w in range(window_min, window_max + 1):\n for i in range(len(query) - w + 1):\n substring = query[i:i", "metrics": { "length": 1131, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 0, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "CSP blocks JavaScript injection in browser automation of authenticated pages (browser-automation-csp-bypass)", "condition": "with_lesson", "status": 200, "content": "To bypass CSP and inject JavaScript into pages with strict Content Security Policy headers, you can use the following approaches:\n\n**Approach 1: Use a nonce**\n\nIf the CSP policy includes a nonce, you can use it to inject scripts. Here's an example using Puppeteer:\n\n```javascript\nconst puppeteer = require('puppeteer');\n\n(async () => {\n const browser = await puppeteer.launch();\n const page = await browser.newPage();\n await page.goto('https://example.com');\n\n // Get the nonce from the CSP header\n const cspHeader = await page.$eval('head', (head) => head.content);\n const cspPolicy = await page.$eval('head', (head) => head.content.split(';').find((line) => line.trim() === 'Content-Security-Policy'));\n const nonce = cspPolicy.split(';').find((line) => line.trim().startsWith('nonce-')).split('=')[1].trim();\n\n // Inject script with nonce\n await page.evaluate((nonce) => {\n document.head.innerHTML = document.head.innerHTML + `\n \n {\n res.writeHead(302, {\n Location: targetUrl + req.url\n });\n res.end();\n});\n\napp.use('/proxy', httpProxy.createProxyServer({\n target: proxyUrl,\n changeOrigin: true,\n onProxyRes: (proxy", "metrics": { "length": 1110, "commands": 1, "command_list": [ "npm install http-proxy" ], "has_command_block": true, "actionable": true, "inline_code_count": 4, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "中文 BM25 搜索:滑动窗口子串加分与唯一候选加分 (bm25-chinese-sliding-window-tuning)", "condition": "plain", "status": 200, "content": "To address the issue with BM25 Chinese sliding window tuning, we need to adjust the parameters to optimize the search results. Here's a step-by-step solution:\n\n1. **Adjust the sliding window size**: Increase the sliding window size to capture more context. You can do this by setting the `window_size` parameter to a larger value, such as 10 or 20.\n\n ```python\nfrom pybm25 import BM25\n\n# Initialize the BM25 object with a larger window size\nbm25 = BM25(window_size=10)\n```\n\n2. **Tune the BM25 parameters**: Adjust the `k1` and `b` parameters to fine-tune the ranking. A higher `k1` value gives more weight to term frequency, while a higher `b` value gives more weight to document length.\n\n ```python\nbm25 = BM25(k1=1.2, b=0.75)\n```\n\n3. **Implement a custom scoring function**: Create a custom scoring function that incorporates the sliding window and unique candidate boosts. This function should take into account the term frequency, document length, and the sliding window context.\n\n ```python\ndef custom_scoring(bm25, query, doc):\n # Calculate the BM", "metrics": { "length": 1062, "commands": 2, "command_list": [ "2. **Tune the BM25 parameters**: Adjust the `k1` and `b` parameters to fine-tune the ranking. A higher `k1` value gives more weight to term frequency, while a higher `b` value gives more weight to document length.", "3. **Implement a custom scoring function**: Create a custom scoring function that incorporates the sliding window and unique candidate boosts. This function should take into account the term frequency, document length, and the sliding window context." ], "has_command_block": true, "actionable": false, "inline_code_count": 9, "lesson_hits": 2, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Chroma 建库无 Checkpoint — 进程一死全部丢失 (chroma-rebuild-no-checkpoint-cn)", "condition": "with_lesson", "status": 200, "content": "Based on the provided information, here's a concrete, actionable fix for the error:\n\n**Fix 1: Modify `build_edoc_chroma.py` to use batch processing**\n\n```python\npython\nimport os\n\ndef embed_and_build(chunks, model, collection, batch_size=5000):\n for i in range(0, len(chunks), batch_size):\n batch = chunks[i:i+batch_size]\n embeddings = model.encode([c[\"text\"] for c in batch])\n collection.add(\n ids=[c[\"id\"] for c in batch],\n embeddings=embeddings.tolist(),\n documents=[c[\"text\"] for c in batch]\n )\n print(f\"[Checkpoint] Written {i+batch_size}/{len(chunks)}\")\n\ndef main():\n # Your code here\n chunks = ... # Load chunks from somewhere\n model = ... # Load model from somewhere\n collection = ... # Load collection from somewhere\n embed_and_build(chunks, model, collection)\n\nif __name__ == \"__main__\":\n main()\n```\n\n**Fix 2: Run `build_edoc_chroma.py` in a separate terminal**\n\nOpen a new terminal and navigate to the directory where `build_edoc_ch", "metrics": { "length": 1034, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 4, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Chroma 建库无 Checkpoint — 进程一死全部丢失 (chroma-rebuild-no-checkpoint-cn)", "condition": "plain", "status": 200, "content": "The error you're encountering is a known issue with Chroma, a popular tool for building and managing Kubernetes clusters. The error message indicates that there's a checkpoint issue during the rebuild process, which can result in data loss if not addressed promptly.\n\nTo fix this issue, you'll need to delete the existing checkpoint and rebuild the cluster from scratch. Here are the steps:\n\n**Step 1: Delete the existing checkpoint**\n\nRun the following command to delete the checkpoint:\n```bash\nchroma delete-rebuild-checkpoint --cluster-name \n```\nReplace `` with the name of your Chroma cluster.\n\n**Step 2: Rebuild the cluster**\n\nRun the following command to rebuild the cluster:\n```bash\nchroma rebuild --cluster-name \n```\nAgain, replace `` with the name of your Chroma cluster.\n\n**Optional: Verify the checkpoint deletion**\n\nTo verify that the checkpoint has been deleted, run the following command:\n```bash\nchroma status --cluster-name \n```\nThis will display the current status of your cluster, including the checkpoint information.\n\n**Note:** Rebuilding the cluster from scratch can take some time, depending on the size of your cluster and the complexity of the rebuild process", "metrics": { "length": 1253, "commands": 3, "command_list": [ "chroma delete-rebuild-checkpoint --cluster-name ", "chroma rebuild --cluster-name ", "chroma status --cluster-name " ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 1, "lesson_hit_rate": 0.167 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "BM25 + Vector Hybrid Search: configurable blending weights (bm25-vector-hybrid-search-weights)", "condition": "with_lesson", "status": 200, "content": "To fix the issue with BM25 + Vector Hybrid Search, you need to configure the blending weights. Here's a step-by-step solution:\n\n**Step 1: Open your `config.yaml` file**\n\nOpen the `config.yaml` file in a text editor. This file is usually located in the root directory of your project.\n\n**Step 2: Add the hybrid search configuration**\n\nAdd the following configuration to the `config.yaml` file:\n```yml\nsearch:\n hybrid:\n enabled: true\n bm25_weight: 0.5\n vector_weight: 0.5\n blend_method: rrf\n```\n**Explanation:**\n\n* `enabled`: Set to `true` to enable hybrid search.\n* `bm25_weight`: Set the weight for the BM25 score (range: 0.0 - 1.0). A higher value gives more importance to BM25.\n* `vector_weight`: Set the weight for the vector score (range: 0.0 - 1.0). A higher value gives more importance to vector embeddings.\n* `blend_method`: Choose the blending method. Options are `rrf` (default) or `linear`.\n\n**Step 3: Adjust the weights (optional)**\n\n", "metrics": { "length": 958, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 11, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "Chroma 建库无 Checkpoint — 进程一死全部丢失 (chroma-rebuild-no-checkpoint-cn)", "condition": "with_lesson", "status": 200, "content": "To address the issue of Chroma database loss upon process death due to the lack of checkpointing, you need to modify the `build_edoc_chroma.py` script to write data to Chroma in batches. This ensures that even if the process dies, the data written up to the last batch will not be lost. Here are the concrete steps and commands to follow:\n\n### Step 1: Modify `build_edoc_chroma.py`\n\nOpen the `build_edoc_chroma.py` file in your preferred text editor. Locate the part of the script where it embeds and writes data to Chroma. Replace that section with the following code to enable batch writing:\n\n```python\ndef embed_and_build(chunks, model, collection, batch_size=5000):\n for i in range(0, len(chunks), batch_size):\n batch = chunks[i:i+batch_size]\n embeddings = model.encode([c[\"text\"] for c in batch])\n collection.add(\n ids=[c[\"id\"] for c in batch],\n embeddings=embeddings.tolist(),\n documents=[c[\"text\"] for c in batch]\n )\n print(f\"[Checkpoint] Written {i+batch_size}/{len(chunks)}\")\n```\n\nThis modification allows the", "metrics": { "length": 1089, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 4, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Chrome Relay 浏览器Automation — CDP over WebSocket 控制无头浏览器 (chrome-relay-browser-automation)", "condition": "with_lesson", "status": 200, "content": "解决 Chrome Relay 浏览器Automation — CDP over WebSocket 控制无头浏览器的错误步骤如下:\n\n**步骤 1:启动带调试端口的 Chrome**\n\n**方式 A — WSL/Linux 下的无头 Chrome**\n```bash\nchromium-browser --remote-debugging-port=9222 --no-sandbox --headless \\\n --user-data-dir=/tmp/chrome-dev-profile\n```\n**方式 B — 复用 Windows 已打开的 Chrome(WSL 网络隔离下不可行)**\n```powershell\nchrome.exe --remote-debugging-port=9222\n```\n**注意:WSL2 和 Windows 之间有 NAT 隔离,WSL 内无法直接访问 Windows localhost 的调试端口。如果用 Windows Chrome,Claw Relay 需要部署在 Windows 上。**\n\n**步骤 2:启动 Claw Relay 连接 Chrome**\n\n```bash\nnpm install -g openclaw\n\n# 配置文件 ~/.claw-relay/config.yaml\ncat ~/.claw-relay/config.yaml << 'EOF'\nserver:\n port: 9333\n host: \"127.0.0.1\"\nagents:\n {\n const browser = await puppeteer.launch({\n headless: false,\n args: ['--disable-web-security'],\n });\n const page = await browser.newPage();\n // Your automation code here\n})();\n```\nFor Playwright, use the following code:\n```javascript\nconst playwright = require('playwright');\n\n(async () => {\n const browser = await playwright.chromium.launch({\n headless: false,\n args: ['--disable-web-security'],\n });\n const page = await browser.newPage();\n // Your automation code here\n})();\n```\n**Approach 2: Set a custom CSP header (Puppeteer/Playwright)**\n\nYou can set a custom CSP header that allows inline scripts and evaluation using the `page.setExtraHTTPHeaders()` method:\n```javascript\nconst puppeteer = require('puppeteer", "metrics": { "length": 1109, "commands": 3, "command_list": [ "For Playwright, use the following code:", "**Approach 2: Set a custom CSP header (Puppeteer/Playwright)**", "You can set a custom CSP header that allows inline scripts and evaluation using the `page.setExtraHTTPHeaders()` method:" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 2, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "Chrome Relay 浏览器Automation — CDP over WebSocket 控制无头浏览器 (chrome-relay-browser-automation)", "condition": "with_lesson", "status": 200, "content": "根据提供的信息,以下是具体的解决步骤:\n\n**步骤 1:启动带调试端口的 Chrome**\n\n您可以选择以下两种方式之一启动 Chrome:\n\n方式 A — WSL/Linux 下的无头 Chrome:\n```bash\nchromium-browser --remote-debugging-port=9222 --no-sandbox --headless \\\n --user-data-dir=/tmp/chrome-dev-profile\n```\n方式 B — 复用 Windows 已打开的 Chrome(WSL 网络隔离下不可行):\n```powershell\nchrome.exe --remote-debugging-port=9222\n```\n**步骤 2:启动 Claw Relay 连接 Chrome**\n\n1. 安装 OpenClaw:\n```bash\nnpm install -g openclaw\n```\n2. 创建配置文件 `~/.claw-relay/config.yaml`:\n```bash\ncat << 'EOF' > ~/.claw-relay/config.yaml\nserver:\n port: 9333\n host: \"127.0.0.1\"\nagents:\n my-agent:\n token: \"my-token\"\n scopes: [\"read\", \"interact\", \"navigate\"]\n allowlist: [\"\"]\n rateLimit: ", "metrics": { "length": 668, "commands": 5, "command_list": [ "chromium-browser --remote-debugging-port=9222 --no-sandbox --headless \\", "--user-data-dir=/tmp/chrome-dev-profile", "**步骤 2:启动 Claw Relay 连接 Chrome**", "1. 安装 OpenClaw:", "2. 创建配置文件 `~/.claw-relay/config.yaml`:" ], "has_command_block": true, "actionable": false, "inline_code_count": 6, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "BM25 + Vector Hybrid Search: configurable blending weights (bm25-vector-hybrid-search-weights)", "condition": "plain", "status": 200, "content": "To address the issue of implementing BM25 + Vector Hybrid Search with configurable blending weights, you'll need to adjust your search configuration. The exact steps can vary depending on the specific search engine or framework you're using (e.g., Elasticsearch, Weaviate, etc.). However, I'll provide a general approach and an example using Elasticsearch, a popular search engine, to demonstrate how you might implement this.\n\n### Step 1: Understand BM25 and Vector Search\n\n- **BM25 (Best Match 25)**: A traditional TF-IDF ranking algorithm that is effective for keyword-based searches.\n- **Vector Search**: Utilizes vector embeddings (like those from transformer models) to capture semantic meaning, useful for more nuanced searches.\n\n### Step 2: Configure Elasticsearch\n\nFor this example, let's assume you're using Elasticsearch 8.x. You'll need to create an index with a custom mapping that includes both text fields for BM25 search and vector fields for vector search.\n\n1. **Create Index with Custom Mapping**:\n\nFirst, create an index named `hybrid_search_index` with a mapping that includes a text field for BM25 and a dense_vector field for vector search.\n\n```bash\ncurl -X PUT \"localhost:9200/hybrid_search_index\" -", "metrics": { "length": 1222, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 1, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "GitHub Actions CI for AI Agent PRs — DCO decoupling & PYTHONPATH fix (ci-dco-decouple-pythonpath-fork-pr)", "condition": "with_lesson", "status": 200, "content": "以下是一些具体的修复步骤和命令:\n\n1. 用 PYTHONPATH 替代 pip install -e。\n\n在 `pr-checks.yml` 中,替换以下行:\n\n```yaml\n- name: 📦 Install Dependencies\n run: |\n pip install -r requirements.txt 2/dev/null || true\n pip install pytest pytest-cov\n echo \"PYTHONPATH=$(pwd):$PYTHONPATH\" $GITHUB_ENV\n```\n\n替换为:\n\n```yaml\n- name: 📦 Install Dependencies\n run: |\n python -m pip install --no-deps -r requirements.txt 2/dev/null || true\n python -m pip install pytest pytest-cov\n export PYTHONPATH=$PYTHONPATH:.\n```\n\n2. 解耦 DCO 与测试执行。\n\n在 `pr-checks.yml` 中,删除以下行:\n\n```yaml\nif: steps.dco.outputs.dco_passed == 'true'\n```\n\n3. coverage 阈值适配小 PR。\n\n在 `pr-checks.yml` 中,添加以下行:\n\n```yaml\n- name: Run tests and report coverage\n run: |\n pytest --cov=.\n pytest-cov --cov", "metrics": { "length": 740, "commands": 5, "command_list": [ "替换为:", "2. 解耦 DCO 与测试执行。", "在 `pr-checks.yml` 中,删除以下行:", "3. coverage 阈值适配小 PR。", "在 `pr-checks.yml` 中,添加以下行:" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 1, "lesson_hit_rate": 0.167 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "GitHub Actions CI for AI Agent PRs — DCO decoupling & PYTHONPATH fix (ci-dco-decouple-pythonpath-fork-pr)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely due to the fact that the `PYTHONPATH` environment variable is not being set correctly in your GitHub Actions workflow. Here's a concrete, actionable fix with exact commands:\n\n**Fix:**\n\n1. Update your `ci.yml` file to include the following lines:\n\n```yaml\nname: Python package\n\non:\n pull_request:\n branches:\n - main\n\njobs:\n build:\n runs-on: ubuntu-latest\n steps:\n - name: Checkout code\n uses: actions/checkout@v3\n\n - name: Set up Python 3.9\n uses: actions/setup-python@v3\n with:\n python-version: '3.9'\n\n - name: Install dependencies\n run: |\n pip install --upgrade pip\n pip install -r requirements.txt\n\n - name: Set PYTHONPATH\n run: |\n export PYTHONPATH=$PYTHONPATH:/path/to/your/project\n\n - name: Run tests\n run: |\n python -m unittest discover -s tests\n```\n\nReplace `/path/to/your/project` with the actual path to your project's Python packages.\n\n2. Create a new file named `.github/workflows/ci.yml", "metrics": { "length": 1066, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 5, "lesson_hits": 2, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "CI 测试陷阱 — 模块级副作用导致 import 失败 (ci-lambda-module-level-side-effects)", "condition": "with_lesson", "status": 200, "content": "To fix the `CI 测试陷阱 — 模块级副作用导致 import 失败 (ci-lambda-module-level-side-effects)` error, you can follow these steps:\n\n1. **Modify the test file to read the source code directly instead of importing the module**:\n\n * Replace the `_import_lambda_module` function with `_extract_default` function that reads the source code text and extracts the default value using regular expressions.\n\n ```python\nimport re\nimport sys\n\ndef _extract_default(source: str) -> str:\n match = re.search(\n r'''os\\.environ\\.get\\(\\s[\"']EXCLUDE_CHARACTERS[\"']\\s,\\s(['\"])((?:[^\\\\]|\\\\.)?)\\1''',\n source,\n )\n return match.group(2)\n\n# Read the source code from the file\nsource = (Path(\"lambda\") / \"index.py\").read_text()\n\n# Extract the default value\ndefault_value = _extract_default(source)\n\n# Assert that the default value contains the expected string\nassert \"/@\" in default_value\n```\n\n2. **Update the test command to run with the correct Python version**:\n\n * Use the `python3` command to", "metrics": { "length": 994, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 5, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "CI 测试陷阱 — 模块级副作用导致 import 失败 (ci-lambda-module-level-side-effects)", "condition": "plain", "status": 200, "content": "The error \"CI 测试陷阱 — 模块级副作用导致 import 失败 (ci-lambda-module-level-side-effects)\" is a common issue in CI/CD pipelines, especially when using AWS Lambda functions. This error occurs when a Lambda function has side effects that affect the import statements, causing the function to fail.\n\nHere's a concrete, actionable fix with exact commands:\n\n**Solution 1: Use a `__init__.py` file to avoid side effects**\n\nIn your Lambda function's directory, create a new file called `__init__.py`. This file will help avoid side effects by allowing Python to import modules without executing the entire function.\n\n```bash\n# Create a new file called __init__.py in your Lambda function's directory\ntouch __init__.py\n```\n\n**Solution 2: Use a separate file for imports**\n\nCreate a new file called `imports.py` in your Lambda function's directory. This file will contain all the imports, and you can avoid side effects by importing modules in this file.\n\n```bash\n# Create a new file called imports.py in your Lambda function's directory\ntouch imports.py\n```\n\n**Solution 3: Use a Lambda function with a fixed set of imports**\n\nIf you're", "metrics": { "length": 1115, "commands": 2, "command_list": [ "touch __init__.py", "touch imports.py" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 1, "lesson_hit_rate": 0.167 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "CSP blocks JavaScript injection in browser automation of authenticated pages (browser-automation-csp-bypass)", "condition": "plain", "status": 200, "content": "To bypass Content Security Policy (CSP) blocks for JavaScript injection in browser automation of authenticated pages, you can use the following approaches. Please note that these solutions are for testing and development purposes only. Always ensure you have the right to automate and inject scripts into the websites you're working with.\n\n### 1. Using Selenium with Python\n\nIf you're using Selenium with Python for browser automation, you can disable CSP by modifying the browser's settings. However, directly disabling CSP might not be straightforward due to browser security restrictions. Instead, you can try to bypass it by injecting scripts that are allowed by the policy or by using a proxy to modify the CSP headers.\n\nFor Selenium, you can try setting up a custom Chrome profile or modifying the command-line arguments to disable web security, which might help in some cases:\n\n```python\nfrom selenium import webdriver\nfrom selenium.webdriver.chrome.options import Options\n\n# Create a new instance of the Chrome driver with disabled web security\nchrome_options = Options()\nchrome_options.add_argument(\"--disable-web-security\")\nchrome_options.add_argument(\"--allow-running-insecure-content\")\n\n# Create the driver\ndriver = webdriver.Chrome(options=chrome_options)\n\n# Navigate to your page\ndriver.get(\"your_target_url\")\n```\n\n### 2. Using Puppeteer with Node", "metrics": { "length": 1361, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 1, "lesson_hits": 1, "lesson_hit_rate": 0.167 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "GitHub Actions CI for AI Agent PRs — DCO decoupling & PYTHONPATH fix (ci-dco-decouple-pythonpath-fork-pr)", "condition": "with_lesson", "status": 200, "content": "To address the issues with your GitHub Actions CI for AI Agent PRs, follow these concrete steps:\n\n### 1. Replace `pip install -e .` with `PYTHONPATH`\n\nIn your `pr-checks.yml` file, update the step that installs dependencies to use `PYTHONPATH` instead of `pip install -e .`. This will help avoid compatibility issues with `pyproject.toml` and speed up the installation process.\n\n```yaml\n- name: Install Dependencies\n run: |\n pip install -r requirements.txt 2>/dev/null || true\n pip install pytest pytest-cov\n echo \"PYTHONPATH=$(pwd):$PYTHONPATH\" >> $GITHUB_ENV\n```\n\n### 2. Decouple DCO from Test Execution\n\nRemove the `if: steps.dco.outputs.dco_passed == 'true'` condition from all test steps in your workflow. This will allow tests to run regardless of the DCO status. The DCO check will still run and report, but it won't block the tests.\n\n```yaml\n# Remove this condition from all test steps\n# if: steps.dco.outputs.dco_passed == 'true'\n```\n\nThen, in your final reporting step, check both the DCO status and", "metrics": { "length": 1019, "commands": 1, "command_list": [ "Remove the `if: steps.dco.outputs.dco_passed == 'true'` condition from all test steps in your workflow. This will allow tests to run regardless of the DCO status. The DCO check will still run and report, but it won't block the tests." ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 2, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "GitHub Actions CI for AI Agent PRs — DCO decoupling & PYTHONPATH fix (ci-dco-decouple-pythonpath-fork-pr)", "condition": "plain", "status": 200, "content": "To address the error you're encountering with GitHub Actions CI for AI Agent PRs, specifically related to DCO (Developer Certificate of Origin) decoupling and PYTHONPATH fix, follow these steps. This guide assumes you are working on a GitHub repository and have basic knowledge of Git and GitHub Actions.\n\n### Step 1: Understand the Error\nFirst, identify the exact error message you're seeing. The error might be related to:\n- DCO checks failing due to incorrect commit signatures.\n- PYTHONPATH issues causing import errors in your Python scripts.\n\n### Step 2: Fix DCO Issues\nFor DCO issues, ensure that your commits are signed off correctly. You can do this by adding a sign-off line to your commit messages:\n```bash\ngit commit -m \"Your commit message\nSigned-off-by: Your Name \"\n```\nAlternatively, if you've already made commits without proper sign-off, you can amend the last commit:\n```bash\ngit commit --amend -s -m \"Your commit message\"\ngit push origin --force\n```\n\n### Step 3: Fix PYTHONPATH Issues\nFor PYTHONPATH issues, you need to ensure that your GitHub Actions workflow correctly sets the PYTHONPATH environment variable.", "metrics": { "length": 1169, "commands": 4, "command_list": [ "git commit -m \"Your commit message", "Signed-off-by: Your Name \"", "git commit --amend -s -m \"Your commit message\"", "git push origin --force" ], "has_command_block": true, "actionable": true, "inline_code_count": 3, "lesson_hits": 3, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "CI security checks: action pinning, permissions, README, code style (ci-security-advisory-checks)", "condition": "with_lesson", "status": 200, "content": "To fix the CI security checks, you'll need to add the following YAML script to your `.github/workflows/your-workflow-name.yml` file. Replace `your-workflow-name` with the name of your workflow.\n\n```yml\nname: Security Advisory Checks\non:\n pull_request:\n types: [opened, synchronize]\njobs:\n security-checks:\n runs-on: ubuntu-latest\n steps:\n - name: Checkout code\n uses: actions/checkout@v3\n\n - name: Run security advisory checks\n run: |\n # Check workflow action pinning (SHA vs version tag)\n for wf in .github/workflows/.yml; do\n UNPINNED=$(grep -E 'uses: [a-zA-Z0-9_-]+/[a-zA-Z0-9_-]+@v[0-9]' \"$wf\" | grep -v '@[a-f0-9]{40}' || true)\n if [ -n \"$UNPINNED\" ]; then\n echo \"::warning file=$wf::Unpinned actions: $UNPINNED\"\n fi\n done\n\n # Check overly broad permissions\n for wf in .github/workflows/.", "metrics": { "length": 919, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 2, "lesson_hits": 5, "lesson_hit_rate": 0.833 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "CI security checks: action pinning, permissions, README, code style (ci-security-advisory-checks)", "condition": "plain", "status": 200, "content": "The error you're encountering is related to CI security checks. Here's a step-by-step solution to fix it:\n\n**Step 1: Install required dependencies**\n\nYou'll need to install `ci-security-advisory-checks` and `github-action-security-scanner`. Run the following commands:\n\n```bash\ngo get -u github.com/securego/gsighook\ngo get -u github.com/securego/gsighook/cmd/gsighook\ngo get -u github.com/google/go-github-v3/github\ngo get -u github.com/google/go-github-v3/github/actions\ngo get -u github.com/google/go-github-v3/github/actions/github-security-scanner\ngo get -u github.com/google/go-github-v3/github/actions/github-security-scanner/cmd/github-security-scanner\n```\n\n**Step 2: Configure GitHub Actions**\n\nCreate a new file in your repository's `.github/workflows` directory called `security.yml`. Add the following YAML configuration:\n\n```yml\nname: Security\n\non:\n push:\n branches:\n - main\n\njobs:\n security:\n runs-on: ubuntu-latest\n steps:\n - name: Checkout code\n uses: actions/checkout@v2\n\n", "metrics": { "length": 1017, "commands": 6, "command_list": [ "go get -u github.com/securego/gsighook", "go get -u github.com/securego/gsighook/cmd/gsighook", "go get -u github.com/google/go-github-v3/github", "go get -u github.com/google/go-github-v3/github/actions", "go get -u github.com/google/go-github-v3/github/actions/github-security-scanner" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 2, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "CI 测试陷阱 — 模块级副作用导致 import 失败 (ci-lambda-module-level-side-effects)", "condition": "plain", "status": 200, "content": "The error \"CI 测试陷阱 — 模块级副作用导致 import 失败\" (CI test trap - module-level side effects cause import failure) typically occurs when there are side effects in your module that are executed during import, causing issues in a CI (Continuous Integration) environment. This can happen when your code is designed to run in an environment where certain conditions are assumed to be met, but those conditions are not present in the CI environment.\n\nTo fix this issue, you need to ensure that your code does not execute any side effects at the module level. Side effects can include database connections, file I/O, network requests, or any other operation that affects external state. Here are steps you can take to address the problem:\n\n### 1. Identify the Side Effects\n\nFirst, you need to identify where the side effects are happening in your code. Look for any code that is executed at the module level (i.e., not inside a function or class method) and that interacts with external resources.\n\n### 2. Move Side Effects into Functions\n\nOnce you've identified the side effects, you should move them into functions. This way, they will only be executed when the function is explicitly called, rather than automatically when the module is imported.\n\n", "metrics": { "length": 1235, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 1, "lesson_hit_rate": 0.167 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "Chrome Relay 浏览器Automation — CDP over WebSocket 控制无头浏览器 (chrome-relay-browser-automation)", "condition": "plain", "status": 200, "content": "To fix the issue with Chrome Relay browser automation using CDP (Chrome DevTools Protocol) over WebSocket for controlling a headless browser, follow these steps. The error you're encountering isn't specified, but I'll guide you through a general setup and troubleshooting process.\n\n### 1. Ensure Chrome Browser and ChromeDriver are Up-to-Date\n\nFirst, make sure your Chrome browser and ChromeDriver are updated to the latest versions. This can often resolve compatibility issues.\n\n- **Update Chrome Browser:**\n - Open Chrome, go to `chrome://version/` to check your version.\n - If not up-to-date, go to `chrome://settings/help` to update.\n\n- **Update ChromeDriver:**\n - Check your ChromeDriver version by running `chromedriver --version` in your terminal/command prompt.\n - Download the latest ChromeDriver from [here](https://chromedriver.chromium.org/downloads) that matches your Chrome browser version.\n\n### 2. Set Up ChromeDriver for Headless Mode\n\nEnsure you can run Chrome in headless mode using ChromeDriver. Here’s how you can do it:\n\n- **For Windows:**\n ```bash\n chromedriver --headless --disable-gpu --window-size=1920,1080\n", "metrics": { "length": 1139, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 3, "lesson_hits": 3, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Claude Code can debug low-level cryptography — ML-DSA signature verification (claude-code-debugging-ml-dsa-cryptography)", "condition": "plain", "status": 200, "content": "To debug low-level cryptography, specifically with the `claude-code-debugging-ml-dsa-cryptography` error, you can follow these steps:\n\n**Step 1: Install required packages**\n\nYou'll need to install the following packages:\n```bash\npip install cryptography\n```\nThis will install the `cryptography` library, which provides a common interface to many different cryptographic algorithms.\n\n**Step 2: Update your code**\n\nMake sure your code is up-to-date and uses the latest version of the `cryptography` library. You can do this by updating your `requirements.txt` file or by running the following command:\n```bash\npip install --upgrade cryptography\n```\n**Step 3: Verify your code**\n\nBefore running your code, verify that it's correctly implemented. Make sure you're using the correct algorithms and parameters for your specific use case.\n\n**Step 4: Debug your code**\n\nTo debug your code, you can use the `cryptography` library's built-in debugging tools. Here's an example:\n```python\nfrom cryptography.hazmat.primitives import serialization\nfrom cryptography.hazmat.primitives.asymmetric import padding\nfrom cryptography.hazmat.backends import default_backend\nimport hashlib\n\n# Load your private key\nwith open('", "metrics": { "length": 1205, "commands": 2, "command_list": [ "pip install cryptography", "pip install --upgrade cryptography" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 1, "lesson_hit_rate": 0.167 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Claude Code can debug low-level cryptography — ML-DSA signature verification (claude-code-debugging-ml-dsa-cryptography)", "condition": "with_lesson", "status": 200, "content": "To fix the bug, we need to refactor the `w1Encode` function in the Verify path to accept pre-computed high bits. Here are the steps:\n\n1. Identify the problematic line in the Verify path:\n\n```go\nw1 := w1Encode(highBits(UseHint(...)))\n```\n\n2. Refactor the `w1Encode` function to accept pre-computed high bits:\n\n```go\n// Before:\nfunc w1Encode(w []poly) []poly { ... }\n\n// After:\nfunc w1Encode(w1 []poly, highBits []poly) []poly { ... }\n```\n\n3. Update the Verify path to pass the pre-computed high bits:\n\n```go\nhighBits := UseHint(...)\nw1 := w1Encode(w1, highBits)\n```\n\nHere's the complete code snippet with the fix:\n\n```go\n// Sign path: w1Encode(highBits(w)) — correct\nfunc Sign() []poly {\n // ... (rest of the Sign implementation remains the same)\n w1 := w1Encode(highBits(w))\n return w1\n}\n\n// Verify path: w1Encode(highBits(UseHint(...))) — double high bits!\nfunc Verify() bool {\n // ... (rest of the", "metrics": { "length": 911, "commands": 3, "command_list": [ "2. Refactor the `w1Encode` function to accept pre-computed high bits:", "3. Update the Verify path to pass the pre-computed high bits:", "Here's the complete code snippet with the fix:" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "CI security checks: action pinning, permissions, README, code style (ci-security-advisory-checks)", "condition": "plain", "status": 200, "content": "To address the error related to CI security checks, specifically action pinning, permissions, README, and code style (ci-security-advisory-checks), you'll need to take several steps. These steps are designed to enhance the security and compliance of your GitHub Actions workflow. Here’s how you can fix these issues:\n\n### 1. Action Pinning\n\nAction pinning involves specifying the exact version of an action you're using in your workflow. This is crucial for security and reliability, as it prevents unexpected changes in the actions used by your workflow.\n\n**Fix:**\n\nEdit your workflow file (usually in `.github/workflows/`) and update any actions to pin them to a specific version. For example, if you're using `actions/checkout@v2`, update it to `actions/checkout@v3` or the latest version available.\n\n```yaml\nsteps:\n - name: Checkout code\n uses: actions/checkout@v3\n```\n\nReplace `v3` with the version you intend to use.\n\n### 2. Permissions\n\nEnsure that the permissions in your workflow are set appropriately to minimize exposure. This involves setting `permissions` at the workflow or job level.\n\n**Fix:**\n\nAdd or modify the `permissions` section in your", "metrics": { "length": 1161, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 7, "lesson_hits": 2, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "CI security checks: action pinning, permissions, README, code style (ci-security-advisory-checks)", "condition": "with_lesson", "status": 200, "content": "To fix the error \"CI security checks: action pinning, permissions, README, code style (ci-security-advisory-checks)\", you need to add a new step to your GitHub Actions workflow that performs the security advisory checks. Here's a concrete, actionable fix:\n\n**Step 1: Create a new file in your repository's `.github/workflows` directory**\n\nCreate a new file named `security-advisory-checks.yml` in the `.github/workflows` directory of your repository. You can do this by running the following command in your terminal:\n```bash\nmkdir -p .github/workflows\ntouch .github/workflows/security-advisory-checks.yml\n```\n**Step 2: Add the security advisory checks to the new file**\n\nAdd the following YAML code to the `security-advisory-checks.yml` file:\n```yaml\nname: Security Advisory Checks\n\non:\n push:\n branches:\n - main\n\njobs:\n security-checks:\n runs-on: ubuntu-latest\n steps:\n - name: Security Advisory Checks\n run: |\n # Check workflow action pinning (SHA vs version tag)\n for wf in .github/workflows/*.yml; do\n UNPINNED", "metrics": { "length": 1072, "commands": 2, "command_list": [ "mkdir -p .github/workflows", "touch .github/workflows/security-advisory-checks.yml" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Cloudflare Email Worker 邮件注册踩坑Notes — message.raw、MIME 与 SPF (cloudflare-email-worker-registration-trap)", "condition": "with_lesson", "status": 200, "content": "根据给出的错误信息和解决方案,以下是针对每个错误的具体修复方案和命令:\n\n**错误1:message.text 不存在**\n\n修复: 需要从 `message.raw` 流式读取和解码邮件内容。\n\n命令:\n```bash\necho \"Lesson: Cloudflare Email Worker 邮件注册踩坑Notes — message.raw、MIME 与 SPF\n修复: \n 1. 修改 Worker 代码:\njavascript\nlet rawText = '';\nconst reader = message.raw.getReader();\nconst decoder = new TextDecoder();\nwhile (true) {\n const { done, value } = await reader.read();\n if (done) break;\n rawText += decoder.decode(value, { stream: true });\n}\nmessage.text = rawText;\n\"\n```\n\n**错误2:Node.js crypto 模块不可用**\n\n修复: 使用 Web Crypto API 代替 Node.js crypto 模块。\n\n命令:\n```bash\necho \"Lesson: Cloudflare Email Worker 邮件注册踩坑Notes — message.raw、MIME 与 SPF\n修复: \n 1. 修改 Worker 代码:\njavascript\nconst array = new Uint8Array(16);\ncrypto.getRandomValues(array);\n", "metrics": { "length": 742, "commands": 14, "command_list": [ "echo \"Lesson: Cloudflare Email Worker 邮件注册踩坑Notes — message.raw、MIME 与 SPF", "修复:", "1. 修改 Worker 代码:", "javascript", "let rawText = '';" ], "has_command_block": true, "actionable": false, "inline_code_count": 3, "lesson_hits": 2, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Cloudflare Email Worker 邮件注册踩坑Notes — message.raw、MIME 与 SPF (cloudflare-email-worker-registration-trap)", "condition": "plain", "status": 200, "content": "The error you're encountering is related to Cloudflare Email Worker registration. This issue typically arises when the email server is not configured correctly, causing the registration process to fail.\n\nHere's a step-by-step guide to resolve this issue:\n\n**Step 1: Check your SPF record**\n\n1. Log in to your Cloudflare account.\n2. Go to the \"DNS\" tab.\n3. Click on \"Add a record\" and select \"TXT\" as the record type.\n4. Create a new record with the following settings:\n\t* Name: `_spf`\n\t* Type: TXT\n\t* Content: \"v=spf1 include:cloudflare.com -all\"\n\t* TTL: 1 hour (or lower if you prefer a shorter TTL)\n5. Click \"Add\" to save the changes.\n\n**Step 2: Verify your DKIM record**\n\n1. Log in to your Cloudflare account.\n2. Go to the \"DNS\" tab.\n3. Click on \"Add a record\" and select \"TXT\" as the record type.\n4. Create a new record with the following settings:\n\t* Name: `_dkim`\n\t* Type: TXT\n\t* Content: \"v=DKIM1; k=rsa;", "metrics": { "length": 911, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 2, "lesson_hits": 2, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "Claude Code can debug low-level cryptography — ML-DSA signature verification (claude-code-debugging-ml-dsa-cryptography)", "condition": "with_lesson", "status": 200, "content": "To fix the issue with the ML-DSA signature verification, follow these steps:\n\n### Step 1: Refactor `w1Encode` Function\n\nModify the `w1Encode` function to accept pre-computed high bits as input. Change the function signature from:\n```go\nfunc w1Encode(w []poly) []poly { ... }\n```\nto:\n```go\nfunc w1Encode(highBits []poly) []poly { ... }\n```\nUpdate the function implementation to use the provided `highBits` instead of computing them internally.\n\n### Step 2: Update `Sign` Path\n\nNo changes are needed in the `Sign` path, as it is already working correctly. The `w1Encode` function is called with the correct high bits computed by `highBits(w)`.\n\n### Step 3: Update `Verify` Path\n\nIn the `Verify` path, pass the pre-computed high bits from `UseHint` to the refactored `w1Encode` function:\n```go\nhighBits := UseHint(...)\nw1Encoded := w1Encode(highBits)\n```\n### Step 4: Test and Verify\n\nWrite a hypothesis test to reimplement half of the verification process and confirm that the fix resolves the issue. Run", "metrics": { "length": 1001, "commands": 4, "command_list": [ "to:", "Update the function implementation to use the provided `highBits` instead of computing them internally.", "No changes are needed in the `Sign` path, as it is already working correctly. The `w1Encode` function is called with the correct high bits computed by `highBits(w)`.", "In the `Verify` path, pass the pre-computed high bits from `UseHint` to the refactored `w1Encode` function:" ], "has_command_block": true, "actionable": true, "inline_code_count": 16, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "Claude Code can debug low-level cryptography — ML-DSA signature verification (claude-code-debugging-ml-dsa-cryptography)", "condition": "plain", "status": 200, "content": "To debug low-level cryptography issues, specifically with ML-DSA signature verification, follow these steps. This guide assumes you're working in a Python environment, given the nature of the task. If you're using a different language, the principles will be similar, but the commands and libraries will differ.\n\n### Step 1: Ensure Correct Libraries Are Installed\n\nFirst, make sure you have the necessary libraries installed. For cryptographic operations in Python, `cryptography` is a powerful library.\n\n```bash\npip install cryptography\n```\n\n### Step 2: Review Your Code\n\nEnsure your code for generating and verifying ML-DSA signatures is correct. Here's a simplified example of how to generate and verify a signature using the `cryptography` library with DSA (which is similar to ML-DSA in concept, but note that ML-DSA might require specific implementations not directly available in standard libraries):\n\n```python\nfrom cryptography.hazmat.primitives import serialization\nfrom cryptography.hazmat.primitives.asymmetric import dsa\nfrom cryptography.hazmat.primitives import hashes\nfrom cryptography.hazmat.primitives.asymmetric import padding\n\n# Generate a new DSA key pair\nprivate_key = dsa.generate_private_key(\n key_size=2048,\n)\n\n# Get the", "metrics": { "length": 1248, "commands": 1, "command_list": [ "pip install cryptography" ], "has_command_block": true, "actionable": false, "inline_code_count": 4, "lesson_hits": 1, "lesson_hit_rate": 0.167 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Cloudflare Worker Programmatic Deploy: Three Pitfalls — Sandbox Egress, 32KB (cloudflare-worker-deploy-three-pitfalls)", "condition": "with_lesson", "status": 200, "content": "Here's a concrete, actionable fix for the Cloudflare Worker Programmatic Deploy issue using Bash script.\n\n**Step 1: Create a new Cloudflare Worker**\n\nFirst, create a new Cloudflare Worker. You can do this by navigating to your Cloudflare dashboard, going to Workers, and clicking on the \"Create Worker\" button.\n\n**Step 2: Write the Bash script**\n\nNext, write a Bash script that will handle the deployment of your Worker. Here's an example script:\n\n```bash\n#!/bin/bash\n\n# Set your Cloudflare account ID and Worker name\nACCOUNT_ID=\"your_account_id\"\nWORKER_NAME=\"your_worker_name\"\n\n# Set the namespace and key for your KV store\nNAMESPACE=\"your_namespace\"\nKEY=\"your_key\"\n\n# Set the GitHub repository URL and branch\nREPO_URL=\"https://raw.githubusercontent.com/your-repo/your-branch/main/your-worker.js\"\nBRANCH=\"main\"\n\n# Set the chunk size for base64 encoding\nCHUNK_SIZE=24 * 1024\n\n# Base64 encode the Worker code and chunk it\nencoded_code=$(echo -n \"$(cat your-worker.js)\" | base64)\nchunks=()\nwhile [ ${#encoded_code} -gt $CHUNK_SIZE ]; do\n ", "metrics": { "length": 1036, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Cloudflare Worker Programmatic Deploy: Three Pitfalls — Sandbox Egress, 32KB (cloudflare-worker-deploy-three-pitfalls)", "condition": "plain", "status": 200, "content": "The error you're encountering is related to the Cloudflare Worker's sandbox egress limitation. To overcome this limitation, you'll need to update your worker to use a more efficient method of accessing external resources.\n\nHere's a concrete, actionable fix with exact commands:\n\n**Step 1: Update your worker to use `fetch` instead of `XMLHttpRequest`**\n\nReplace any occurrences of `XMLHttpRequest` with `fetch` in your worker code. This will help Cloudflare's workers to handle external requests more efficiently.\n\nFor example:\n```javascript\n// Before\nXMLHttpRequest({\n method: 'GET',\n url: 'https://example.com/api/data'\n}).on('load', function() {\n // Process the response\n});\n\n// After\nfetch('https://example.com/api/data')\n .then(response => response.json())\n .then(data => {\n // Process the response\n });\n```\n\n**Step 2: Use `fetch` with the `cache` option set to `false`**\n\nSet the `cache` option to `false` when making external requests using `fetch`. This will prevent the worker from caching the response, which is necessary to avoid the sandbox egress limitation.\n\nFor example:\n```javascript\nfetch('https://example.com/api", "metrics": { "length": 1139, "commands": 3, "command_list": [ "**Step 2: Use `fetch` with the `cache` option set to `false`**", "Set the `cache` option to `false` when making external requests using `fetch`. This will prevent the worker from caching the response, which is necessary to avoid the sandbox egress limitation.", "For example:" ], "has_command_block": true, "actionable": true, "inline_code_count": 12, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "Cloudflare Email Worker 邮件注册踩坑Notes — message.raw、MIME 与 SPF (cloudflare-email-worker-registration-trap)", "condition": "plain", "status": 200, "content": "To address the issues related to `message.raw`, MIME, and SPF in the context of a Cloudflare Email Worker, especially when dealing with email registration, follow these concrete steps. Note that the specific commands might vary slightly depending on your exact setup and requirements.\n\n### 1. Handling `message.raw`\n\nWhen dealing with `message.raw`, you're likely trying to access the raw content of an email message. Cloudflare Workers provide a `Request` object that can be used to parse incoming requests, including emails. However, directly accessing `message.raw` might not be straightforward due to how Cloudflare handles email messages.\n\n**Actionable Fix:**\n\nEnsure you're correctly parsing the email message. If you're trying to access the raw email content, consider the following example in your worker script:\n\n```javascript\naddEventListener('fetch', (event) => {\n event.respondWith(handleRequest(event.request))\n})\n\nasync function handleRequest(request) {\n const { headers, body } = request;\n // Ensure you're handling the email content correctly\n const emailContent = await request.arrayBuffer();\n const decoder = new TextDecoder('utf-8');\n const emailRaw = decoder.decode(emailContent);\n\n // Process emailRaw as needed\n console.log(emailRaw);\n\n ", "metrics": { "length": 1267, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 5, "lesson_hits": 2, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Dismiss CodeQL False Positive Alerts (codeql-alert-dismissal-false-positive)", "condition": "with_lesson", "status": 200, "content": "To dismiss a false positive alert in CodeQL, you'll need to use the GitHub API to update the alert's state. Here's a step-by-step guide:\n\n1. **Get the alert ID**: First, find the ID of the alert you want to dismiss. You can do this by listing all alerts for your repository using the CodeQL API.\n\n ```bash\ncurl -s -X GET \\\n -H \"Authorization: token $TOKEN\" \\\n -H \"Accept: application/vnd.github.v3+json\" \\\n https://api.github.com/repos/Ikalus1988/MisakaNet/code-scanning/alerts\n```\n\n This command will return a JSON response with a list of alerts. Look for the `id` field in the response.\n\n2. **Dismiss the alert**: Once you have the alert ID, you can use the `PATCH` endpoint to dismiss the alert.\n\n ```bash\ncurl -s -X PATCH \\\n -H \"Authorization: token $TOKEN\" \\\n -H \"Accept: application/vnd.github.v3+json\" \\\n https://api.github.com/repos/Ikalus1988/MisakaNet/code-scanning/alerts/ \\\n -d '{\n \"state", "metrics": { "length": 926, "commands": 4, "command_list": [ "curl -s -X GET \\", "-H \"Authorization: token $TOKEN\" \\", "-H \"Accept: application/vnd.github.v3+json\" \\", "https://api.github.com/repos/Ikalus1988/MisakaNet/code-scanning/alerts" ], "has_command_block": true, "actionable": true, "inline_code_count": 4, "lesson_hits": 1, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "Cloudflare Worker Programmatic Deploy: Three Pitfalls — Sandbox Egress, 32KB (cloudflare-worker-deploy-three-pitfalls)", "condition": "with_lesson", "status": 200, "content": "To address the three pitfalls encountered when deploying large modular Workers via Cloudflare MCP execute, follow these concrete, actionable steps. This solution involves base64 encoding and chunking your code, storing it in a Cloudflare KV namespace, reassembling the code, and then uploading it to Cloudflare Workers using the correct multipart/form-data format.\n\n### Step 1: Base64 Encode and Chunk Your Code\n\nFirst, you need to base64 encode your Worker code and split it into chunks of 24KB or less. You can use the following command to encode your code:\n\n```bash\nbase64 your-worker-code.js > encoded-worker-code.txt\n```\n\nThen, you'll need to split this encoded file into chunks. You can use a tool like `split` to achieve this:\n\n```bash\nsplit -b 24KB encoded-worker-code.txt chunk-\n```\n\nThis will create multiple files named `chunk-aa`, `chunk-ab`, etc., each containing a part of your encoded Worker code.\n\n### Step 2: Store Chunks in Cloudflare KV\n\nNext, you'll store each chunk in a Cloudflare KV namespace. You'll need to use the Cloudflare API for this. First, ensure you have the `curl` command available.\n\n1. **Authenticate", "metrics": { "length": 1136, "commands": 2, "command_list": [ "base64 your-worker-code.js > encoded-worker-code.txt", "split -b 24KB encoded-worker-code.txt chunk-" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "CI 测试陷阱 — 模块级副作用导致 import 失败 (ci-lambda-module-level-side-effects)", "condition": "with_lesson", "status": 200, "content": "To fix the issue of CI testing failures due to module-level side effects when importing Lambda functions, follow these concrete steps. The goal is to avoid importing the Lambda module directly and instead analyze its source code text.\n\n### Step 1: Modify Your Test Function\n\nInstead of importing the Lambda module, you will read its source code as text and then analyze it. Replace your existing `_import_lambda_module` function with a new function named `_extract_default` that reads the source code and extracts necessary information using regular expressions.\n\n```python\nimport re\nfrom pathlib import Path\n\ndef _extract_default(source: str) -> str:\n \"\"\"\n Extracts the default value for 'EXCLUDE_CHARACTERS' from the given source code.\n \n :param source: The source code of the Lambda function as a string.\n :return: The default value as a string.\n \"\"\"\n match = re.search(\n r'''os\\.environ\\.get\\(\\s[\"']EXCLUDE_CHARACTERS[\"']\\s,\\s(['\"])((?:[^\\\\]|\\\\.)?)\\1''',\n source,\n )\n return match.group(2) if match else None\n\n# Example usage\nsource_path = Path(\"lambda\") / \"index.py\"\nsource", "metrics": { "length": 1119, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 2, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "Cloudflare Email Worker 邮件注册踩坑Notes — message.raw、MIME 与 SPF (cloudflare-email-worker-registration-trap)", "condition": "with_lesson", "status": 200, "content": "To address the issues encountered with the Cloudflare Email Worker registration process, follow these concrete and actionable fixes:\n\n### Fix for 坑1:message.text 不存在\n\nTo read the email content from `message.raw`, use the following JavaScript code:\n\n```javascript\nlet rawText = '';\nconst reader = message.raw.getReader();\nconst decoder = new TextDecoder();\nwhile (true) {\n const { done, value } = await reader.read();\n if (done) break;\n rawText += decoder.decode(value, { stream: true });\n}\nconsole.log(rawText); // This will log the email content\n```\n\n### Fix for 坑2:Node.js crypto 模块不可用\n\nReplace the `node:crypto` import with the Web Crypto API. To generate a random token, use:\n\n```javascript\nconst array = new Uint8Array(16);\ncrypto.getRandomValues(array);\nconst token = Array.from(array, b => b.toString(16).padStart(2, '0')).join('');\nconsole.log(token); // This will log a random token\n```\n\n### Fix for 坑3:回复邮件被 QQ/163/ Foxmail 拒收\n\nTo avoid email rejection due to SPF issues, modify your registration process to not", "metrics": { "length": 1024, "commands": 1, "command_list": [ "Replace the `node:crypto` import with the Web Crypto API. To generate a random token, use:" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 2, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "Cloudflare Worker Programmatic Deploy: Three Pitfalls — Sandbox Egress, 32KB (cloudflare-worker-deploy-three-pitfalls)", "condition": "plain", "status": 200, "content": "The article \"Cloudflare Worker Programmatic Deploy: Three Pitfalls — Sandbox Egress, 32KB\" highlights common issues encountered when deploying Cloudflare Workers programmatically. To address these pitfalls, particularly the 32KB limit and sandbox egress issues, follow these concrete steps. Note that these instructions assume you have a basic understanding of Cloudflare Workers, Node.js, and npm.\n\n### 1. Minifying Your Worker Code\n\nTo avoid hitting the 32KB limit, minify your worker code. You can use tools like `terser` or `uglify-js` for this purpose.\n\nFirst, install `terser` as a development dependency in your project:\n\n```bash\nnpm install terser --save-dev\n```\n\nThen, you can minify your worker code using the following command. Replace `worker.js` with the path to your worker script and `minified-worker.js` with the desired output path:\n\n```bash\nnpx terser worker.js -o minified-worker.js\n```\n\n### 2. Handling Sandbox Egress\n\nFor sandbox egress issues, ensure that your worker is correctly configured to handle external requests. If your worker needs to fetch data from external sources, you might need to adjust the `fetch` calls to comply with", "metrics": { "length": 1158, "commands": 2, "command_list": [ "npm install terser --save-dev", "npx terser worker.js -o minified-worker.js" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Dismiss CodeQL False Positive Alerts (codeql-alert-dismissal-false-positive)", "condition": "plain", "status": 200, "content": "The error \"Dismiss CodeQL False Positive Alerts (codeql-alert-dismissal-f false-positive)\" typically occurs when the CodeQL engine is incorrectly identifying certain alerts as false positives and suggesting that they be dismissed. Here's a concrete, actionable fix to resolve this issue:\n\n**Step 1: Update CodeQL**\n\nFirst, you need to update CodeQL to the latest version. You can do this by running the following command in your terminal:\n\n```bash\ngit pull https://github.com/github/codeql codeql\n```\n\n**Step 2: Re-run the CodeQL analysis**\n\nAfter updating CodeQL, re-run the analysis to ensure that the issue is resolved:\n\n```bash\ncodeql analyze --output /path/to/output --ruleset /path/to/ruleset\n```\n\nReplace `/path/to/output` and `/path/to/ruleset` with the actual paths to your output directory and ruleset file, respectively.\n\n**Step 3: Check the CodeQL configuration**\n\nIf the issue persists, check the CodeQL configuration file (`codeql.yml` or `codeql.json`) for any incorrect settings. You can do this by running the following command:\n\n```bash\ncodeql config --list\n```\n\nThis will display the current CodeQL configuration. Review the configuration", "metrics": { "length": 1157, "commands": 3, "command_list": [ "git pull https://github.com/github/codeql codeql", "codeql analyze --output /path/to/output --ruleset /path/to/ruleset", "codeql config --list" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Cross-Repo Contribution Strategy — Finding and Contributing to New Repos (cross-repo-contribution-strategy)", "condition": "with_lesson", "status": 200, "content": "Based on the provided lesson, it seems like the error is related to the \"pr-strategy.md\" file and the \"maintainer\" label. Here's a concrete, actionable fix with exact commands:\n\n1. Check if PR would pass review before submitting:\n\n```bash\npython3 skill/pr_genius.py coach \"feat: add feature\" --repo org/repo --body \"Fixes 123\"\n```\n\n2. Look for Repos with These Signals:\n\nYou can use the following command to check for good first issue labels, help wanted labels, recent merged PRs from external contributors, and active maintainer responses:\n\n```bash\ngit clone https://github.com/org/repo.git\ncd repo\ngit log --format=%an --since=30days\ngit log --format=%an --since=30days --author=external\ngit log --format=%an --since=30days --author=external --author=external\ngit log --format=%an --since=30days --author=external --author=external --author=external\n```\n\n3. Avoid These Red Flags:\n\nYou can use the following command to check for no CONTRIBUTING.md files:\n\n```bash\ngit ls-files CONTRIBUTING.md\n```\n\nIf the file is not found", "metrics": { "length": 1025, "commands": 8, "command_list": [ "python3 skill/pr_genius.py coach \"feat: add feature\" --repo org/repo --body \"Fixes 123\"", "git clone https://github.com/org/repo.git", "cd repo", "git log --format=%an --since=30days", "git log --format=%an --since=30days --author=external" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 2, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Cross-Repo Contribution Strategy — Finding and Contributing to New Repos (cross-repo-contribution-strategy)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely due to the fact that the `cross-repo-contribution-strategy` repository is private, and you're trying to contribute to it directly from your local repository.\n\nTo fix this issue, you'll need to create a fork of the `cross-repo-contribution-strategy` repository, then submit a pull request to the original repository. Here's a step-by-step guide with exact commands:\n\n### Step 1: Create a fork of the `cross-repo-contribution-strategy` repository\n\n1. Open a terminal or command prompt.\n2. Navigate to your local repository where you want to make the contribution.\n3. Run the following command to create a fork of the `cross-repo-contribution-strategy` repository:\n\n```bash\ngit fork https://github.com/github/cross-repo-contribution-strategy.git my-fork\n```\n\nReplace `my-fork` with a name of your choice for your forked repository.\n\n### Step 2: Clone your forked repository\n\n1. Clone your forked repository to your local machine:\n\n```bash\ngit clone https://github.com/your-username/my-fork.git\n```\n\nReplace `your-username` with the actual username of the owner of your fork", "metrics": { "length": 1110, "commands": 2, "command_list": [ "git fork https://github.com/github/cross-repo-contribution-strategy.git my-fork", "git clone https://github.com/your-username/my-fork.git" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "跨 Sheet 同名合并导致数据混乱:机器人唯一标识必须带前缀 (cross-sheet-name-merge-data-chaos)", "condition": "with_lesson", "status": 200, "content": "Here's a concrete, actionable fix for the error you're encountering:\n\n**Step 1: Update the `robot_id` column with the correct prefix**\n\nReplace the following code in your loop:\n\n```python\ndf['robot_id'] = df['robotName']\n```\n\nwith the following code:\n\n```python\ndf['robot_id'] = sheet_name + '_' + df['robotName']\n```\n\nThis will add the sheet name prefix to the `robot_id` column.\n\n**Step 2: Update the `groupby` aggregation**\n\nReplace the following line in your `groupby` aggregation:\n\n```python\nresult = pd.concat(all_data).groupby('robotName').agg(...)\n```\n\nwith the following line:\n\n```python\nresult = pd.concat(all_data).groupby('robot_id').agg(...)\n```\n\nThis will use the `robot_id` column as the key for grouping instead of `robotName`.\n\nHere's the updated code:\n\n```python\nfor sheet_name, df in sheets.items():\n df['robot_id'] = sheet_name + '_' + df['robotName']\n all_data.append(df)\nresult = pd.concat(all_data).groupby('robot_id').agg(...)\n```\n\n**Step 3: Verify the fix**\n\nRun the following", "metrics": { "length": 1007, "commands": 7, "command_list": [ "with the following code:", "This will add the sheet name prefix to the `robot_id` column.", "**Step 2: Update the `groupby` aggregation**", "Replace the following line in your `groupby` aggregation:", "with the following line:" ], "has_command_block": true, "actionable": true, "inline_code_count": 15, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "跨 Sheet 同名合并导致数据混乱:机器人唯一标识必须带前缀 (cross-sheet-name-merge-data-chaos)", "condition": "plain", "status": 200, "content": "The error message you're encountering, \"跨 Sheet 同名合并导致数据混乱:机器人唯一标识必须带前缀\" which translates to \"Cross sheet name merge data chaos: Robot unique identifier must have a prefix,\" typically occurs when you're trying to merge data from multiple sheets in a spreadsheet using a script or macro that doesn't properly handle unique identifiers.\n\nTo fix this issue, you'll need to ensure that each unique identifier (e.g., employee IDs, order numbers, etc.) is prefixed with the sheet name or a unique identifier for each sheet. Here's an example of how you can modify your script or macro to achieve this:\n\n### For Google Sheets using Google Apps Script\n\nLet's assume you have a script that merges data from multiple sheets and doesn't handle unique identifiers correctly. You can modify it as follows:\n\n```javascript\nfunction mergeData() {\n var ss = SpreadsheetApp.getActiveSpreadsheet();\n var sourceSheets = ['Sheet1', 'Sheet2', 'Sheet3']; // List of source sheets\n \n // Create an object to store data from each sheet\n var data = {};\n sourceSheets.forEach(function(sheetName) {\n var sheet = ss.getSheetByName(sheetName);\n var range =", "metrics": { "length": 1137, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "Dismiss CodeQL False Positive Alerts (codeql-alert-dismissal-false-positive)", "condition": "plain", "status": 200, "content": "To dismiss CodeQL false positive alerts, you'll need to use the CodeQL command-line interface. Here's a step-by-step fix:\n\n**Prerequisites:**\n\n1. Ensure you have CodeQL installed and configured on your system.\n2. Familiarize yourself with the CodeQL command-line interface.\n\n**Dismiss False Positive Alerts:**\n\n1. **Identify the alert ID**: First, you need to identify the ID of the false positive alert you want to dismiss. You can do this by running the following command:\n```bash\ncodeql database analyze --search-path /path/to/your/code --format=csv --output=alerts.csv\n```\nThis command will generate a CSV file (`alerts.csv`) containing all the alerts, including their IDs.\n\n2. **Open the CSV file**: Open the `alerts.csv` file and find the ID of the false positive alert you want to dismiss.\n\n3. **Dismiss the alert**: Run the following command to dismiss the false positive alert:\n```bash\ncodeql alert dismiss --alert-id --database /path/to/your/codeql/database\n```\nReplace `` with the actual ID of the false positive alert you want to dismiss.\n\n**Example:**\n```bash\ncodeql alert", "metrics": { "length": 1106, "commands": 2, "command_list": [ "codeql database analyze --search-path /path/to/your/code --format=csv --output=alerts.csv", "codeql alert dismiss --alert-id --database /path/to/your/codeql/database" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "Cross-Repo Contribution Strategy — Finding and Contributing to New Repos (cross-repo-contribution-strategy)", "condition": "plain", "status": 200, "content": "To address the issue of implementing a cross-repo contribution strategy for finding and contributing to new repositories, follow these steps. This guide assumes you are using Git for version control and have a GitHub account, as it's one of the most common platforms for open-source contributions.\n\n### Step 1: Identify Repositories to Contribute To\n\n1. **Use GitHub's Explore Page**: Start by visiting GitHub's Explore page (https://github.com/explore) to find trending repositories or topics that interest you.\n2. **Search for Repositories**: Use GitHub's search bar to find repositories related to your interests or skills. For example, if you're interested in contributing to Python projects, you can search for `language:Python`.\n\n### Step 2: Evaluate a Repository\n\nBefore contributing, evaluate the repository by checking:\n\n1. **Star and Fork Count**: A higher number indicates the project is more popular and possibly more maintained.\n2. **Issues and Pull Requests**: Look at the issues tab to see if there are open issues you can work on. Also, check the pull requests tab to see how active the maintainers are in reviewing and merging contributions.\n3. **README and CONTRIBUTING Files**: These files usually contain information on how to contribute to the project, including setup", "metrics": { "length": 1289, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 1, "lesson_hits": 1, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "CSS z-index Not Working — Stacking Context Inversion in Modal Overlays (css-z-index-stacking-context-modal)", "condition": "with_lesson", "status": 200, "content": "The problem arises from the fact that the parent element with `transform: translateX(...)` creates a new stacking context, which overrides the `z-index` of the modal overlay. To fix this issue, you can use the `will-change` property to force the browser to create a new stacking context for the modal overlay, or you can use the `z-index` property on the parent element that contains the modal overlay, but with a value that is higher than the modal overlay's `z-index`. Here's an example of how you can do it:\n\n```css\n/* Make the parent element with transform create a new stacking context */\n.sidebar {\n position: relative;\n transform: translateX(0);\n will-change: transform; /* Add this line */\n z-index: 1000; /* Increase the z-index of the parent */\n}\n\n/* Make the modal overlay appear on top of the parent */\n.modal-overlay {\n position: fixed;\n z-index: 9999;\n}\n\n/* Make the modal content appear on top of the modal overlay */\n.modal-content {\n position: relative;\n z-index: 10000;\n}\n```\n\nAlternatively, you can also use the `z-index` property on the parent element that contains the modal overlay, but", "metrics": { "length": 1116, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 7, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "Dismiss CodeQL False Positive Alerts (codeql-alert-dismissal-false-positive)", "condition": "with_lesson", "status": 200, "content": "To dismiss a CodeQL false positive alert, you will need to use the GitHub API to update the alert's state. Here's a step-by-step guide:\n\n1. **Find the Alert ID**: First, you need to identify the ID of the alert you want to dismiss. You can find this by listing all open alerts using the GitHub API. Replace `YOUR_REPO_OWNER` and `YOUR_REPO_NAME` with your actual repository owner and name, and `YOUR_TOKEN` with your GitHub personal access token.\n\n ```bash\n curl -s -X GET \\\n -H \"Authorization: token YOUR_TOKEN\" \\\n -H \"Accept: application/vnd.github.v3+json\" \\\n https://api.github.com/repos/YOUR_REPO_OWNER/YOUR_REPO_NAME/code-scanning/alerts\n ```\n\n This command will list all code scanning alerts, including their IDs.\n\n2. **Dismiss the Alert**: Once you have the ID of the alert you want to dismiss, you can use the following command to dismiss it. Replace `ALERT_ID` with the actual ID of the alert, and adjust the `dismissed_comment` to explain why the alert is a false positive.\n\n ```bash\n curl -s -X PATCH \\\n -H \"", "metrics": { "length": 1058, "commands": 4, "command_list": [ "curl -s -X GET \\", "-H \"Authorization: token YOUR_TOKEN\" \\", "-H \"Accept: application/vnd.github.v3+json\" \\", "https://api.github.com/repos/YOUR_REPO_OWNER/YOUR_REPO_NAME/code-scanning/alerts" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 1, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "CSS z-index Not Working — Stacking Context Inversion in Modal Overlays (css-z-index-stacking-context-modal)", "condition": "plain", "status": 200, "content": "The CSS z-index not working issue can be caused by the stacking context inversion in modal overlays. Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Add `position: relative` to the modal container**\n\nAdd the following CSS rule to your modal container:\n```css\n.modal-container {\n position: relative;\n}\n```\nThis sets the modal container to be a positioning context, allowing you to control its z-index.\n\n**Step 2: Add `position: relative` to the overlay**\n\nAdd the following CSS rule to your overlay:\n```css\n.overlay {\n position: relative;\n z-index: 1000; /* adjust the z-index as needed */\n}\n```\nThis sets the overlay to be a positioning context and sets its initial z-index to a high value.\n\n**Step 3: Add `z-index` to the modal content**\n\nAdd the following CSS rule to your modal content:\n```css\n.modal-content {\n z-index: 1001; /* adjust the z-index as needed */\n}\n```\nThis sets the modal content's z-index to a higher value than the overlay, ensuring it appears on top of the overlay.\n\n**Step 4: Adjust the z-index of other elements**\n\nIf you have other elements on", "metrics": { "length": 1090, "commands": 6, "command_list": [ "This sets the modal container to be a positioning context, allowing you to control its z-index.", "**Step 2: Add `position: relative` to the overlay**", "Add the following CSS rule to your overlay:", "This sets the overlay to be a positioning context and sets its initial z-index to a high value.", "**Step 3: Add `z-index` to the modal content**" ], "has_command_block": true, "actionable": false, "inline_code_count": 8, "lesson_hits": 5, "lesson_hit_rate": 0.833 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "跨 Sheet 同名合并导致数据混乱:机器人唯一标识必须带前缀 (cross-sheet-name-merge-data-chaos)", "condition": "with_lesson", "status": 200, "content": "To fix the issue of cross-sheet name merge data chaos, you need to ensure that each robot has a unique identifier that includes the sheet prefix. Here's a step-by-step solution:\n\n### Step 1: Modify the Data Import Process\n\nWhen reading data from multiple sheets, add a prefix to the `robotName` field that includes the sheet name. This will create a unique identifier for each robot across all sheets.\n\n```python\nimport pandas as pd\n\n# Assuming 'sheets' is a dictionary where keys are sheet names and values are DataFrames\nall_data = []\nfor sheet_name, df in sheets.items():\n # Create a new column 'robot_id' that combines the sheet name and robotName\n df['robot_id'] = sheet_name + '_' + df['robotName']\n all_data.append(df)\n\n# Concatenate all DataFrames into one\nresult = pd.concat(all_data)\n```\n\n### Step 2: Use the New Unique Identifier for Grouping\n\nWhen performing aggregation operations, use the `robot_id` column as the key instead of `robotName`. This ensures that robots from different sheets are not merged incorrectly.\n\n```python\n# Group by the new 'robot_id' column and perform aggregation\naggregated_result = result.groupby('robot", "metrics": { "length": 1153, "commands": 1, "command_list": [ "When performing aggregation operations, use the `robot_id` column as the key instead of `robotName`. This ensures that robots from different sheets are not merged incorrectly." ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "Cross-Repo Contribution Strategy — Finding and Contributing to New Repos (cross-repo-contribution-strategy)", "condition": "with_lesson", "status": 200, "content": "To address the issue of finding and contributing to new repositories effectively, follow these concrete steps:\n\n### Step 1: Evaluate Before Contributing\n\nFirst, ensure that your potential contribution would pass review before submitting it. You can use a tool like `Coach` to evaluate your pull request (PR) beforehand.\n\n```bash\npython3 skill/pr_genius.py coach \"feat: add feature\" --repo org/repo --body \"Fixes 123\"\n```\n\nReplace `\"feat: add feature\"` with your feature description, `org/repo` with the target repository, and `\"Fixes 123\"` with your actual commit body or issue reference.\n\n### Step 2: Identify Promising Repositories\n\nLook for repositories with signals that indicate they are open to contributions:\n\n1. **Good First Issue Label**: Indicates the maintainer wants new contributors.\n2. **Help Wanted Label**: Shows an active need for contributions.\n3. **Recent Merged PRs from External Contributors**: Indicates a proven track record of accepting external contributions.\n4. **Active Maintainer Responses**: Suggests you will get feedback on your contributions.\n\nYou can search for these signals on GitHub using the search bar with keywords like `org/repo is:issue label:\"good first issue\"` or `", "metrics": { "length": 1208, "commands": 1, "command_list": [ "python3 skill/pr_genius.py coach \"feat: add feature\" --repo org/repo --body \"Fixes 123\"" ], "has_command_block": true, "actionable": false, "inline_code_count": 7, "lesson_hits": 2, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "curl / wget 请求失败通用Diagnosis (curl-request-troubleshoot)", "condition": "with_lesson", "status": 200, "content": "根据给出的错误信息和解决方案,下面是一些具体的解决方案和命令:\n\n1. 检查 DNS 问题:\n - 使用 `nslookup` 检查 DNS 问题:\n ```bash\nnslookup example.com\n```\n - 如果返回 NXDOMAIN,表示 DNS 问题。需要检查 `/etc/resolv.conf` 和 DNS 服务是否正常工作。\n\n2. 检查网络连通性:\n - 使用 `curl -v --noproxy \"\" https://example.com` 检查网络连通性:\n ```bash\ncurl -v --noproxy \"\" https://example.com\n```\n - 如果返回超时,可能是防火墙或代理问题。\n\n3. 检查证书问题:\n - 使用 `curl -v https://example.com` 检查证书问题:\n ```bash\ncurl -v https://example.com\n```\n - 如果返回 SSL 证书问题,需要检查证书是否过期或自签。\n\n - 临时跳过 SSL 证书验证:\n ```bash\ncurl -k https://example.com\n```\n - **注意:** 这个选项不建议在生产", "metrics": { "length": 566, "commands": 4, "command_list": [ "nslookup example.com", "curl -v --noproxy \"\" https://example.com", "curl -v https://example.com", "curl -k https://example.com" ], "has_command_block": true, "actionable": false, "inline_code_count": 11, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "curl / wget 请求失败通用Diagnosis (curl-request-troubleshoot)", "condition": "plain", "status": 200, "content": "The error \"curl-request-troubleshoot\" typically indicates a problem with the curl request. Here are a few common causes and solutions:\n\n**Cause 1: Insufficient permissions**\n\n* Cause: The curl command is not executed with sufficient permissions.\n* Solution:\n\n ```bash\n# For Linux and macOS\nsudo curl -o output.txt https://example.com\n\n# For Windows\ncurl.exe -o output.txt https://example.com\n```\n\n**Cause 2: Proxy issues**\n\n* Cause: The curl request is being blocked by a proxy.\n* Solution:\n\n ```bash\n# Set the proxy environment variable\nexport HTTP_PROXY=http://your-proxy:8080\nexport HTTPS_PROXY=http://your-proxy:8080\n\n# Run the curl command\ncurl -o output.txt https://example.com\n```\n\n**Cause 3: SSL verification issues**\n\n* Cause: The curl request is having trouble verifying the SSL certificate.\n* Solution:\n\n ```bash\n# Disable SSL verification\ncurl -k -o output.txt https://example.com\n\n# Verify the SSL certificate\ncurl --cert-type PEM --cacert /path/to/ca.crt --key /path/to/your-key.pem https://example.com\n```\n\n**Cause 4: Connection timeout**\n\n*", "metrics": { "length": 1059, "commands": 7, "command_list": [ "sudo curl -o output.txt https://example.com", "curl.exe -o output.txt https://example.com", "export HTTP_PROXY=http://your-proxy:8080", "export HTTPS_PROXY=http://your-proxy:8080", "curl -o output.txt https://example.com" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "跨 Sheet 同名合并导致数据混乱:机器人唯一标识必须带前缀 (cross-sheet-name-merge-data-chaos)", "condition": "plain", "status": 200, "content": "To address the issue of \"跨 Sheet 同名合并导致数据混乱:机器人唯一标识必须带前缀\" which translates to \"Cross-sheet same-name merge causing data chaos: Robot unique identifier must have a prefix,\" you need to ensure that each robot or entity across different sheets has a unique identifier that includes a prefix to avoid confusion. Here’s a step-by-step guide to fix this issue, assuming you are working with Excel or a similar spreadsheet program:\n\n### Step 1: Identify the Sheets and Data\n1. **Open your spreadsheet**: Go to the file that contains the sheets with the merging issue.\n2. **List all sheets**: Note down the names of all sheets involved in the merge.\n\n### Step 2: Standardize Unique Identifiers\n1. **Choose a prefix format**: Decide on a prefix format for each sheet. For example, if you have sheets named \"RobotData1\", \"RobotData2\", etc., you could use \"RD1_\", \"RD2_\", etc., as prefixes.\n2. **Apply prefixes**: Go through each sheet and add the corresponding prefix to the unique identifier of each robot or entity. You can do this manually or use a formula.\n\n### Manual Method:\n- **Select the cell", "metrics": { "length": 1090, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "CSS z-index Not Working — Stacking Context Inversion in Modal Overlays (css-z-index-stacking-context-modal)", "condition": "with_lesson", "status": 200, "content": "To fix the issue of the modal overlay being hidden behind another page element due to a stacking context inversion, you need to ensure that the modal overlay is placed outside of any stacking context that could interfere with its visibility. Here's a step-by-step solution:\n\n### 1. Move the Modal Overlay Outside of the Interfering Stacking Context\n\nFirst, you need to move the `.modal-overlay` element outside of the `.sidebar` element that has a `transform` property applied, which creates a new stacking context. Ideally, the `.modal-overlay` should be a direct child of the `body` element to ensure it's at the root level of the stacking context.\n\n```html\n\n \n
\n \n
\n
\n \n
\n \n
\n
\n \n
\n \n
\n Advanced Settings.\n2. Look for the \"Cache Cleanup\" or \"Disk Space Cleanup\" option and select it.\n3. Choose the frequency for the cache cleanup (e.g., \"Daily\" or \"Weekly\").\n4. Click \"Apply\"", "metrics": { "length": 1036, "commands": 1, "command_list": [ "rm -rf chroma_db_v4_cache/*" ], "has_command_block": true, "actionable": true, "inline_code_count": 3, "lesson_hits": 1, "lesson_hit_rate": 0.167 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "curl / wget 请求失败通用Diagnosis (curl-request-troubleshoot)", "condition": "with_lesson", "status": 200, "content": "To troubleshoot the `curl` request failure, follow these steps with exact commands:\n\n### 1. Check DNS Resolution\n\nFirst, ensure that the domain name can be resolved to an IP address. You can use `nslookup` or `dig` for this:\n\n```bash\nnslookup example.com\n```\nor\n```bash\ndig example.com\n```\n\nIf the domain resolves correctly, you should see an IP address returned. If not, you may have a DNS issue.\n\n### 2. Check Network Connectivity (Bypassing Proxy)\n\nTry connecting to the server without using a proxy to see if the issue is related to your proxy settings:\n\n```bash\ncurl -v --noproxy \"\" https://example.com\n```\n\nIf this command can connect but times out, it might indicate a firewall or proxy issue.\n\n### 3. Check Certificate Validation\n\nCertificate issues can cause `curl` to fail. Check the certificate validation:\n\n```bash\ncurl -v https://example.com\n```\n\nIf you encounter an SSL certificate problem, you can temporarily bypass certificate validation for testing purposes (not recommended for production):\n\n```bash\ncurl -k https://example.com\n```\n\n### 4. Check Proxy Settings\n\nView your current proxy settings:\n\n```", "metrics": { "length": 1119, "commands": 5, "command_list": [ "nslookup example.com", "dig example.com", "curl -v --noproxy \"\" https://example.com", "curl -v https://example.com", "curl -k https://example.com" ], "has_command_block": true, "actionable": true, "inline_code_count": 14, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Erreur de permission Docker: permission denied sur /var/run/docker.sock (erreur-permission-docker-linux)", "condition": "with_lesson", "status": 200, "content": "To fix the \"permission denied\" error when trying to run Docker commands on Linux, follow these steps:\n\n**Step 1: Check if the docker group exists**\n\nOpen a terminal and run the following command to check if the docker group exists:\n\n```bash\ngrep docker /etc/group\n```\n\nIf the group does not exist, proceed to Step 2.\n\n**Step 2: Create the docker group if it does not exist**\n\nIf the docker group does not exist, create it using the following command:\n\n```bash\nsudo groupadd docker\n```\n\n**Step 3: Add your user to the docker group**\n\nAdd your user to the docker group using the following command:\n\n```bash\nsudo usermod -aG docker $USER\n```\n\nReplace `$USER` with your actual username.\n\n**Step 4: Activate the group change**\n\nLog out of your current session and log back in. Alternatively, you can run the following command to activate the group change:\n\n```bash\nnewgrp docker\n```\n\n**Step 5: Verify the fix (optional)**\n\nIf you want to verify that the fix was successful, run the following command:\n\n```bash\ngrep docker /etc/group\n```\n\nIf the fix was successful, the output should indicate that", "metrics": { "length": 1091, "commands": 5, "command_list": [ "grep docker /etc/group", "sudo groupadd docker", "sudo usermod -aG docker $USER", "newgrp docker", "grep docker /etc/group" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "DCO Signoff Lost During Force Push (dco-signoff-force-push-pitfall)", "condition": "plain", "status": 200, "content": "To fix the \"DCO Signoff Lost During Force Push\" issue, you can follow these steps. This problem occurs when you force push changes to a repository, potentially overwriting commits that included DCO (Developer Certificate of Origin) signoffs, which are crucial for verifying the origin and licensing of contributions.\n\nHere's how to handle the situation:\n\n### 1. Rebase Your Local Branch\n\nFirst, make sure you're on the branch you want to work on. Let's assume it's named `feature/new-feature`. If you've already force-pushed and lost DCO signoffs, you'll need to rebase your branch to reapply the DCO signoffs.\n\n```bash\n# Checkout your branch\ngit checkout feature/new-feature\n\n# Rebase interactively to edit commits\ngit rebase -i origin/main # Assuming 'main' is your upstream branch\n```\n\nIn the interactive rebase menu, you can choose to `edit` the commits where the DCO signoff was lost.\n\n### 2. Amend Commits to Add DCO Signoff\n\nFor each commit you want to edit, you'll amend it to add the DCO signoff. After selecting `edit` for a commit in the rebase menu, Git will pause", "metrics": { "length": 1077, "commands": 2, "command_list": [ "git checkout feature/new-feature", "git rebase -i origin/main # Assuming 'main' is your upstream branch" ], "has_command_block": true, "actionable": false, "inline_code_count": 4, "lesson_hits": 3, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "磁盘空间不足 / chroma_db_v4 CacheCleanup (disk-space-cleanup)", "condition": "with_lesson", "status": 200, "content": "To address the \"磁盘空间不足 / chroma_db_v4 CacheCleanup (disk-space-cleanup)\" error, follow these steps. The goal is to free up disk space by cleaning up unnecessary files in `chroma_db_v4`, Hugging Face cache, temporary files, and log files.\n\n### Step 1: Identify Space Occupation\n\nFirst, identify which directories are occupying the most space:\n```bash\ndu -sh ~/.hermes/ 2>/dev/null | sort -h\ndu -sh /mnt/d/Eric/知识库/chroma_db_v4/ 2>/dev/null\n```\n\n### Step 2: Clean Up `chroma_db_v4`\n\n1. **Backup `chroma_db_v4`**: Before making any changes, create a backup.\n ```bash\n cp -r /mnt/d/Eric/知识库/chroma_db_v4/ ~/chroma_db_v4_backup_$(date +%Y%m%d)\n ```\n2. **Check Versions**: List the versions of `chroma_db_v4` to decide which ones to keep.\n ```bash\n ls /mnt/d/Eric/知识库/chroma_db_v4/\n ```\n3. **Remove Old Versions**: Decide which versions", "metrics": { "length": 842, "commands": 4, "command_list": [ "du -sh ~/.hermes/ 2>/dev/null | sort -h", "du -sh /mnt/d/Eric/知识库/chroma_db_v4/ 2>/dev/null", "cp -r /mnt/d/Eric/知识库/chroma_db_v4/ ~/chroma_db_v4_backup_$(date +%Y%m%d)", "ls /mnt/d/Eric/知识库/chroma_db_v4/" ], "has_command_block": true, "actionable": false, "inline_code_count": 9, "lesson_hits": 3, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "磁盘空间不足 / chroma_db_v4 CacheCleanup (disk-space-cleanup)", "condition": "plain", "status": 200, "content": "To address the \"磁盘空间不足\" (insufficient disk space) error related to `chroma_db_v4 CacheCleanup` (disk-space-cleanup), you'll need to free up disk space. Here's a step-by-step guide to help you resolve this issue. Please note, the exact commands might vary slightly depending on your operating system (the instructions below are tailored for a Linux-based system, which is common for servers and databases).\n\n### 1. Check Available Disk Space\n\nFirst, check how much disk space is available and which partitions are running low. Open a terminal and run:\n\n```bash\ndf -h\n```\n\nThis command will show you the available disk space on your system.\n\n### 2. Identify Large Files and Directories\n\nTo find large files or directories that might be consuming a lot of space, use:\n\n```bash\nsudo du -h --max-depth=1 /\n```\n\nThis command scans the root directory and its immediate subdirectories for large files and directories. You might need to wait a bit for it to complete.\n\n### 3. Clean Up Package Cache (if applicable)\n\nIf you're using a Debian-based system (like Ubuntu), you can clean up the package cache to free up some space:\n\n```bash\nsudo", "metrics": { "length": 1131, "commands": 2, "command_list": [ "df -h", "sudo du -h --max-depth=1 /" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 1, "lesson_hit_rate": 0.167 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Erreur de permission Docker: permission denied sur /var/run/docker.sock (erreur-permission-docker-linux)", "condition": "plain", "status": 200, "content": "The error you're experiencing is due to a lack of permissions to access the Docker socket. Here's a step-by-step solution:\n\n**Step 1: Check the current permissions**\n\nRun the following command to check the current permissions of the Docker socket:\n```bash\nls -l /var/run/docker.sock\n```\nThis will display the current permissions of the socket.\n\n**Step 2: Add your user to the Docker group**\n\nTo access the Docker socket, you need to add your user to the Docker group. Run the following command:\n```bash\nsudo usermod -aG docker $USER\n```\nThis command adds your user to the Docker group.\n\n**Step 3: Log out and log back in**\n\nAfter adding your user to the Docker group, you need to log out and log back in to apply the changes.\n\n**Step 4: Verify the permissions**\n\nAfter logging back in, run the following command to verify the permissions of the Docker socket:\n```bash\nls -l /var/run/docker.sock\n```\nThis should display the updated permissions.\n\n**Step 5: Test Docker**\n\nFinally, test Docker by running the following command:\n```bash\ndocker run hello-world\n```\nThis command should run successfully if you have the necessary permissions", "metrics": { "length": 1134, "commands": 4, "command_list": [ "ls -l /var/run/docker.sock", "sudo usermod -aG docker $USER", "ls -l /var/run/docker.sock", "docker run hello-world" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Erro de push rejeitado no Git: branches divergentes e como resolver (erro-push-git-rejeitado-divergente)", "condition": "with_lesson", "status": 200, "content": "Here's a concrete, actionable fix for the error \"branches divergentes e como resolver (erro-push-git-rejeitado-divergente)\" with exact commands:\n\n**Step 1: Pull the latest changes from the remote repository**\n\nOpen your terminal and navigate to your local repository. Run the following command to pull the latest changes from the remote repository:\n```bash\ngit pull origin main\n```\nThis command will fetch the latest changes from the remote repository and merge them into your local branch.\n\n**Step 2: Resolve any merge conflicts**\n\nIf there are any merge conflicts, Git will show you the conflicting files. Open the file in a text editor and manually resolve the conflicts. You can use a tool like `git mergetool` to help you resolve conflicts.\n\nOnce you've resolved the conflicts, add the file to the staging area and commit the changes:\n```bash\ngit add arquivo.txt\ngit commit -m \"Resolve merge conflicts with origin/main\"\n```\n**Step 3: Push the updated changes to the remote repository**\n\nNow that you've resolved any merge conflicts, you can push the updated changes to the remote repository:\n```bash\ngit push origin main\n```\nThis command will update the remote repository with your latest changes.\n\nAlternatively,", "metrics": { "length": 1218, "commands": 4, "command_list": [ "git pull origin main", "git add arquivo.txt", "git commit -m \"Resolve merge conflicts with origin/main\"", "git push origin main" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 5, "lesson_hit_rate": 0.833 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Erro de push rejeitado no Git: branches divergentes e como resolver (erro-push-git-rejeitado-divergente)", "condition": "plain", "status": 200, "content": "O erro \"branches divergentes\" ocorre quando você tenta push para um branch que não está em sincronia com a branch remota. Aqui está uma solução passo a passo:\n\n**Passo 1: Verifique a situação atual**\n\n```bash\ngit status\n```\n\nIsso mostrará quais branches estão em sincronia e quais estão divergentes.\n\n**Passo 2: Resolva a divergência**\n\nExistem várias formas de resolver a divergência, dependendo da situação. Aqui estão algumas opções:\n\n### 1. Rebase (reorganize os commits)\n\n```bash\ngit rebase -i HEAD~n\n```\n\nSubstitua `n` pelo número de commits que você deseja reorganizar. Isso irá reorganizar os commits para que eles sejam mais linhosos e em ordem cronológica.\n\n### 2. Merge (unir os branches)\n\n```bash\ngit merge branch-remota\n```\n\nSubstitua `branch-remota` pelo nome do branch remoto que você deseja unir.\n\n### 3. Reset (redefinir o HEAD)\n\n```bash\ngit", "metrics": { "length": 858, "commands": 3, "command_list": [ "git status", "git rebase -i HEAD~n", "git merge branch-remota" ], "has_command_block": true, "actionable": false, "inline_code_count": 8, "lesson_hits": 2, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Error de DCO sign-off en commits de Git en Windows (error-dco-signoff-windows)", "condition": "plain", "status": 200, "content": "The \"error-dco-signoff-windows\" error typically occurs when you're trying to commit changes to a Git repository on Windows and the `dco` (Distributed Commit Options) sign-off check fails. This check ensures that all files have a valid DCO sign-off.\n\nTo fix this issue, you'll need to add a DCO sign-off to all files that are missing it. Here are the steps:\n\n1. **Check for missing DCO sign-off**:\n\n Open a Git Bash terminal and navigate to your repository directory. Then, run the following command to check which files are missing a DCO sign-off:\n\n ```bash\ngit diff --name-only --diff-filter=ACMRTUXB\n```\n\n This command will show you the files that have been modified (A), added (C), renamed (R), copied (M), or deleted (D), but do not have a DCO sign-off.\n\n2. **Add DCO sign-off to missing files**:\n\n Once you have identified the missing files, you can add a DCO sign-off to them using the following command:\n\n ```bash\ngit add -u\n```\n\n This command will stage all changes, including the ones without a DCO sign-off.\n\n", "metrics": { "length": 1031, "commands": 2, "command_list": [ "git diff --name-only --diff-filter=ACMRTUXB", "git add -u" ], "has_command_block": true, "actionable": true, "inline_code_count": 4, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Error de DCO sign-off en commits de Git en Windows (error-dco-signoff-windows)", "condition": "with_lesson", "status": 200, "content": "El error de DCO sign-off en commits de Git en Windows se debe a varias causas, como la configuración de usuario no establecida, el entorno mixto y la diferencia entre mayúsculas y minúsculas en el email. Aquí te presento una serie de pasos y comandos para solucionar este problema:\n\n**Paso 1: Verificar la configuración actual**\n\n Primero, debemos verificar la configuración actual de Git en nuestro sistema. Para hacer esto, podemos utilizar el comando `git config --list --show-origin` con el parámetro `user`. Esto nos mostrará la configuración de usuario actual en cada nivel (sistema, global y local).\n\n```bash\ngit config --list --show-origin user\n```\n\n**Paso 2: Establecer la configuración de usuario**\n\n Para establecer la configuración de usuario, debemos configurar las variables `user.name` y `user.email` en cada nivel (sistema, global y local). Podemos hacer esto utilizando el comando `git config`.\n\n Primero, configuramos la variable `user.name`:\n\n```bash\ngit config --global user.name \"Tu Nombre\"\n```\n\n Luego, configuramos", "metrics": { "length": 1037, "commands": 2, "command_list": [ "git config --list --show-origin user", "git config --global user.name \"Tu Nombre\"" ], "has_command_block": true, "actionable": false, "inline_code_count": 9, "lesson_hits": 2, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC Backup Payload Extraction — .VR/.SV Binary Parsing and .LS Text Fallback (fanuc-backup-payload-extraction)", "condition": "with_lesson", "status": 200, "content": "To extract the payload configuration from a FANUC robot backup directory, you can follow these steps:\n\n**Step 1: Install WinOLPC**\n\nFirst, you need to install WinOLPC, which includes the kconvars.exe tool. You can download WinOLPC from the official FANUC website.\n\n**Step 2: Set up robot.ini**\n\nCreate a `robot.ini` file in the root directory of the backup directory. This file is required by the kconvars.exe tool. The contents of the file are as follows:\n```ini\n[DEFAULT]\nBinPath=C:\\path\\to\\kconvars.exe\n```\nReplace `C:\\path\\to\\kconvars.exe` with the actual path to the kconvars.exe executable.\n\n**Step 3: Extract payload configuration using kconvars.exe**\n\nOpen a Command Prompt or PowerShell and navigate to the root directory of the backup directory. Run the following command to extract the payload configuration:\n```bash\nkconvars.exe -p -l\n```\nThis command will extract the payload configuration from the backup directory and display it in the Command Prompt or PowerShell.\n\n**Step 4: Parse the output**\n\nThe output of the kconvars.exe command will be a series of lines", "metrics": { "length": 1076, "commands": 3, "command_list": [ "Replace `C:\\path\\to\\kconvars.exe` with the actual path to the kconvars.exe executable.", "**Step 3: Extract payload configuration using kconvars.exe**", "Open a Command Prompt or PowerShell and navigate to the root directory of the backup directory. Run the following command to extract the payload configuration:" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 3, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC Backup Payload Extraction — .VR/.SV Binary Parsing and .LS Text Fallback (fanuc-backup-payload-extraction)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely related to the FANUC Backup Payload Extraction tool, which is used to extract data from FANUC backup files. Here's a step-by-step guide to fix the issue:\n\n**Error Analysis:**\n\nThe error message `.VR/.SV Binary Parsing and .LS Text Fallback` suggests that the tool is having trouble parsing the binary data in the `.VR` or `.SV` files. This could be due to a corrupted file or an incompatible version of the tool.\n\n**Fix:**\n\nTo resolve the issue, try the following steps:\n\n1. **Update the FANUC Backup Payload Extraction tool:**\n\n ```bash\nsudo apt update\nsudo apt install -y fanuc-backup-payload-extraction\n```\n\n or\n\n ```bash\nsudo yum update\nsudo yum install -y fanuc-backup-payload-extraction\n```\n\n or\n\n ```bash\nsudo pip install fanuc-backup-payload-extraction\n```\n\n2. **Check the file format:**\n\n Verify that the `.VR` or `.SV` files are in the correct format. You can use the `file` command to check the file type:\n\n ```bash\nfile -b *.vr\nfile -b", "metrics": { "length": 1001, "commands": 5, "command_list": [ "sudo apt update", "sudo apt install -y fanuc-backup-payload-extraction", "sudo yum update", "sudo yum install -y fanuc-backup-payload-extraction", "sudo pip install fanuc-backup-payload-extraction" ], "has_command_block": true, "actionable": true, "inline_code_count": 12, "lesson_hits": 3, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC INTP-102 DETECT JOINT — OLP Whitespace Bug (fanuc-intp-102-detect-joint-olp-whitespace)", "condition": "with_lesson", "status": 200, "content": "To fix the FANUC INTP-102 DETECT JOINT — OLP Whitespace Bug, follow these steps:\n\n**Step 1: Compare .ls Files**\n\nExtract the `.ls` file from the robot controller and compare it with the OLP-generated version.\n\n```bash\n# Extract the .ls file from the robot controller\nscp robot_original.ls user@server:/path/to/robot/ls\n\n# Compare the .ls files\ndiff robot_original.ls olp_generated.ls\n```\n\n**Step 2: Fix Trailing Whitespace**\n\nRemove extra spaces before semicolons in sensor instructions. Use the following command to fix the trailing whitespace:\n\n```bash\n# Use sed to remove trailing whitespace before semicolons\nsed -i 's/ ;/ ;/g' /path/to/robot/ls\n```\n\nReplace `/path/to/robot/ls` with the actual path to your `.ls` file.\n\n**Step 3: Report to OLP Vendor**\n\nFile a bug with RoboDK (or your OLP tool) about trailing whitespace in sensor instruction generation.\n\n```bash\n# Create a new issue in RoboDK\ncurl -X POST \\\n https://example.com/robodk/issues \\\n -", "metrics": { "length": 958, "commands": 3, "command_list": [ "scp robot_original.ls user@server:/path/to/robot/ls", "diff robot_original.ls olp_generated.ls", "sed -i 's/ ;/ ;/g' /path/to/robot/ls" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 2, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC INTP-102 DETECT JOINT — OLP Whitespace Bug (fanuc-intp-102-detect-joint-olp-whitespace)", "condition": "plain", "status": 200, "content": "The error you're encountering is related to a whitespace bug in the FANUC INTP-102's OLP (Optical Linear Position) system. This issue can be fixed by updating the OLP system's firmware. Here's a step-by-step guide to help you resolve the problem:\n\n**Prerequisites:**\n\n* Make sure you have a FANUC INTP-102 robot with an OLP system installed.\n* Ensure that the robot's firmware is up-to-date. You can check the current firmware version using the `FANUC Robot Controller` software.\n* Familiarize yourself with the robot's safety features and operating procedures.\n\n**Fixing the OLP Whitespace Bug:**\n\n1. **Update the OLP system's firmware:**\n - Open the `FANUC Robot Controller` software and navigate to the `Maintenance` tab.\n - Select the `OLP` system and click on the `Update` button.\n - Follow the on-screen instructions to download and install the latest firmware for the OLP system.\n\n Example command:\n ```bash\n # Update OLP system firmware\n FANUC-INTP-102-OLP-Update\n ```\n\n2. **Verify the firmware update:**\n ", "metrics": { "length": 1031, "commands": 1, "command_list": [ "FANUC-INTP-102-OLP-Update" ], "has_command_block": true, "actionable": false, "inline_code_count": 6, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC IO Marker M[] Instruction — Background Logic Alternative (fanuc-io-marker-m-instruction)", "condition": "with_lesson", "status": 200, "content": "To fix the error, you need to enable the Marker register by setting `$MIX_LOGIC.$USE_MKR = TRUE` in your FANUC program. Here are the steps:\n\n1. Open your FANUC program in the FANUC HandlingTool.\n2. Go to `MENU → I/O → I/O Replace`.\n3. In the I/O Replace menu, click on the \"M[]\" option.\n4. Since the M[] option is not documented in standard TP programming guides, you will need to enable the Marker register by setting `$MIX_LOGIC.$USE_MKR = TRUE` in the program.\n5. Add the following code to your program: `$MIX_LOGIC.$USE_MKR = TRUE;`\n6. Save your changes and restart the FANUC program.\n\nHere's an example of how to set a Marker register:\n\n```fanuc\n-- Enable Marker register\n$MIX_LOGIC.$USE_MKR = TRUE;\n\n-- Set Marker register M[1]\nM[1] = (DI[1] AND DI[2]);\n```\n\nIn this example, the Marker register M[1] is set to true if both DI[1] and DI[2] are true.\n\nNote: The `$MIX", "metrics": { "length": 872, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 6, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC IO Marker M[] Instruction — Background Logic Alternative (fanuc-io-marker-m-instruction)", "condition": "plain", "status": 200, "content": "The error message \"FANUC IO Marker M[] Instruction — Background Logic Alternative\" is not a standard error message, and it's likely a custom error message specific to your FANUC machine or your organization's configuration.\n\nHowever, I can provide you with some general steps to troubleshoot and resolve common issues related to FANUC IO Marker M[] instructions. Please note that these steps are based on general knowledge and may not be specific to your situation.\n\n**Step 1: Check the FANUC machine settings**\n\n1. Log in to the FANUC machine and navigate to the \"Machine Settings\" or \"Configuration\" menu.\n2. Check if the \"IO Marker\" or \"M[]\" settings are enabled and configured correctly.\n3. Verify that the \"Background Logic Alternative\" setting is not causing any issues.\n\n**Step 2: Check the program code**\n\n1. Check the program code for any errors or inconsistencies related to the IO Marker M[] instruction.\n2. Verify that the program code is correctly configured to use the IO Marker M[] instruction.\n3. Check for any errors or warnings related to the IO Marker M[] instruction in the program code.\n\n**Step 3: Check the FANUC machine logs**\n\n1. Check the FAN", "metrics": { "length": 1167, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC MI Standard Software — Complete Instruction Reference (MI01-MI22) (fanuc-mi-standard-software-instructions)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely related to the FANUC MI Standard Software, and I'll provide a general solution. However, please note that without the specific error message, it's difficult to provide an exact fix.\n\nAssuming the error is related to a configuration issue or a missing library, here are some general steps you can try:\n\n**Step 1: Check the software version**\n\nMake sure you're running the latest version of the FANUC MI Standard Software. You can check the version by running the following command:\n\n```bash\nmi_version\n```\n\n**Step 2: Check for missing libraries**\n\nRun the following command to check for missing libraries:\n\n```bash\nmi_libraries\n```\n\nThis will display a list of installed libraries. If you find any missing libraries, you can install them using the following command:\n\n```bash\nmi_install_library \n```\n\nReplace `` with the name of the missing library.\n\n**Step 3: Check configuration files**\n\nCheck the configuration files for any errors or inconsistencies. Run the following command to display the configuration files:\n\n```bash\nmi_config\n```\n\nThis will display a list of configuration files. You can then edit these files manually to resolve any errors or inconsistencies.\n\n**Step", "metrics": { "length": 1245, "commands": 4, "command_list": [ "mi_version", "mi_libraries", "mi_install_library ", "mi_config" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC MI Standard Software — Complete Instruction Reference (MI01-MI22) (fanuc-mi-standard-software-instructions)", "condition": "with_lesson", "status": 200, "content": "Based on the provided information, the error is likely due to the incorrect usage of the CALL MIxx_MOD(parameters) instruction. The correct format for the CALL instruction is:\n\nCALL MIxx_MOD(parameters)\n\nHowever, in the provided instruction, the parameters are not enclosed in parentheses.\n\nHere is a concrete, actionable fix with exact commands:\n\nReplace the following instruction:\n\nCALL MI01_CMN(CollZone, Request/Release, ZoneNo.=1, '...')\n\nWith:\n\nCALL MI01_CMN(CollZone, Request/Release, 1, '...')\n\nAnd also replace the following instruction:\n\nCALL MI01_CMN(FestoCheck, '...')\n\nWith:\n\nCALL MI01_CMN(FestoCheck, '...') // No change needed here\n\nThe corrected instruction is:\n\nCALL MI01_CMN(CollZone, Request/Release, 1, '...')\n\nThis fix assumes that the zone number is always 1. If the zone number is dynamic, you should replace the number 1 with the actual zone number.\n\nSimilarly, for the MI02_TCH module, the instruction is:\n\n| Instruction | Function | Format\n|-------------|----------|--------|\n| Init | Reset tool change; check tool change; verify MI03 installation | CALL MI02", "metrics": { "length": 1086, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC R-2000iC 检索混淆Fix — 关键词强制召回 (fanuc-r-2000ic-retrieval-fix)", "condition": "with_lesson", "status": 200, "content": "To fix the error, you need to add a keyword recovery module to the `retrieve()` function in `rag_core.py`. Here's the updated code:\n\n1. Open the `rag_core.py` file in your favorite text editor.\n2. Add the following code before the `type_model()` function:\n```python\nimport re\n\n_KW = re.compile(r'上位机|robot interface|寄存器读|寄存器写|读写寄存器', re.I)\n\ndef keyword_recovery(query):\n if _KW.search(query):\n kw_results = collection.get(\n where_document={\"$contains\": \"Robot Interface\"},\n limit=10,\n )\n for doc, meta in zip(kw_results[\"documents\"], kw_results[\"metadatas\"]):\n score = 0.92 if \"Robot Interface\" in doc[:500] else 0.85\n return score\n return 0.0\n\ndef retrieve(query):\n # ... (rest of the function remains the same)\n score = keyword_recovery(query)\n if score > 0.85:\n # ... (rest of the function remains the same)\n```\n3. Save the changes to the `rag_core.py` file.\n4. Run the", "metrics": { "length": 959, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 6, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC R-2000iC 检索混淆Fix — 关键词强制召回 (fanuc-r-2000ic-retrieval-fix)", "condition": "plain", "status": 200, "content": "The error message \"FANUC R-2000iC 检索混淆Fix — 关键词强制召回 (fanuc-r-2000ic-retrieval-fix)\" is a Chinese error message, but I'll provide a general solution for a similar issue that might occur in Fanuc R-2000iC programming.\n\nThe error is likely related to a keyword conflict or undefined keyword in your program. Here's a step-by-step fix:\n\n**Step 1: Check your program for keyword conflicts**\n\n Review your program to ensure that you're not using a keyword as a variable or label name. Fanuc R-2000iC uses specific keywords for programming, such as `MOV`, `ADD`, `SUB`, etc. If you're using a keyword as a variable name, it may cause a conflict.\n\n**Step 2: Check for undefined keywords**\n\n Verify that all the keywords you're using are defined in your program or in the library. You can check the Fanuc R-2000iC documentation or online resources to ensure that the keyword is valid.\n\n**Step 3: Update your program**\n\nIf you've identified a keyword conflict or undefined keyword, update your program to use a different name or define the keyword.\n\n", "metrics": { "length": 1040, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 3, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC Spot Weld Tip Max Wear Amount — sysspot.sv Variable Lookup via kconvars (fanuc-spot-wear-max-lookup)", "condition": "plain", "status": 200, "content": "The error message you're encountering is due to an invalid variable lookup in the FANUC Spot Welding system. To resolve this issue, you need to update the `fanuc-spot-wear-max-lookup` variable with the correct value.\n\nHere are the steps to fix this issue:\n\n**Method 1: Update the variable through the FANUC System**\n\n1. Open the FANUC System.\n2. Go to the \"Parameter\" menu.\n3. Select \"Variable\" and then \"Lookup\".\n4. In the \"Lookup\" window, select \"fanuc-spot-wear-max-lookup\" from the list of variables.\n5. Update the value in the \"Value\" field to the correct maximum wear amount.\n6. Click \"OK\" to save the changes.\n\n**Method 2: Update the variable through the FANUC kConVars**\n\n1. Open the FANUC kConVars.\n2. In the \"Variables\" section, find the \"fanuc-spot-wear-max-lookup\" variable.\n3. Update the value in the \"Value\" field to the correct maximum wear amount.\n4. Click \"OK\" to save the changes.\n\n**Method 3: Update the variable through the FANUC System Configuration**\n\n1.", "metrics": { "length": 976, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 1, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC Spot Weld Tip Max Wear Amount — sysspot.sv Variable Lookup via kconvars (fanuc-spot-wear-max-lookup)", "condition": "with_lesson", "status": 200, "content": "To fix the FANUC Spot Weld Tip Max Wear Amount error, follow these steps:\n\n**Step 1: Locate the sysspot.sv file**\n\n```bash\ncd \nls -l sysspot.sv\n```\n\n**Step 2: Convert the sysspot.sv file with kconvars**\n\n```bash\nkconvars.exe sysspot.sv sysspot_decoded.txt\n```\n\nNote: Make sure the `kconvars.exe` tool is in the same directory or parent as the `sysspot.sv` file. If it's not, you can specify the full path to `kconvars.exe`:\n\n```bash\nkconvars.exe path/to/kconvars.exe sysspot.sv sysspot_decoded.txt\n```\n\n**Step 3: Find the wear parameter**\n\n```bash\ncat sysspot_decoded.txt | grep $SPOTEQSETUP[1].$EPAF_TRGDST\n```\n\nThis command searches for the line containing `$SPOTEQSETUP[1].$EPAF_TRGDST` in the `sysspot_decoded.txt` file.\n\n**Step 4: Extract the maximum wear amount (", "metrics": { "length": 783, "commands": 5, "command_list": [ "cd ", "ls -l sysspot.sv", "kconvars.exe sysspot.sv sysspot_decoded.txt", "kconvars.exe path/to/kconvars.exe sysspot.sv sysspot_decoded.txt", "cat sysspot_decoded.txt | grep $SPOTEQSETUP[1].$EPAF_TRGDST" ], "has_command_block": true, "actionable": false, "inline_code_count": 12, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "scenario": "DCO Signoff Lost During Force Push (dco-signoff-force-push-pitfall)", "condition": "with_lesson", "status": 200, "content": "To fix the \"DCO Signoff Lost During Force Push\" issue, follow these steps:\n\n1. **Reset your branch to the upstream main branch**:\n ```bash\ngit fetch upstream main\ngit reset --hard upstream/main\n```\n\n2. **Cherry-pick your commit with the `--signoff` option**:\n Replace `` with the actual hash of the commit you want to cherry-pick:\n ```bash\ngit cherry-pick --signoff\n```\n\n3. **Force push your changes to your fork**:\n Replace `fork` with the name of your fork and `branch` with the name of your branch:\n ```bash\ngit push fork branch --force\n```\n\n**Verification**:\nTo ensure that your PR only contains one commit and that the DCO signoff is present, you can use the following commands:\n\n1. **Check the number of commits in your PR**:\n Replace `UPSTREAM` with the name of the upstream repository, `REPO` with the name of the repository, and `NUMBER` with the number of your PR:\n ```bash\ngh api repos/UPSTREAM/REPO/pulls/NUMBER/commits --jq '", "metrics": { "length": 979, "commands": 4, "command_list": [ "git fetch upstream main", "git reset --hard upstream/main", "git cherry-pick --signoff", "git push fork branch --force" ], "has_command_block": true, "actionable": true, "inline_code_count": 13, "lesson_hits": 3, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Fatal-guard CLI: harden entry point with --help, --version, exit codes (fatal-guard-cli-hardening)", "condition": "with_lesson", "status": 200, "content": "Here's a concrete, actionable fix for the given error:\n\n**Step 1: Install `argparse` if not already installed**\n\nOpen your terminal and run the following command to install `argparse` if it's not already installed:\n```bash\npip install argparse\n```\n**Step 2: Create a new file for your CLI tool**\n\nCreate a new file, e.g., `fatal-guard-cli.py`, and add the following code:\n```python\nimport argparse\nimport sys\n\n__version__ = \"1.4.2\"\n\ndef build_parser():\n parser = argparse.ArgumentParser(\n prog=\"fatal-guard\",\n description=\"Monitor and guard critical processes against fatal failures.\",\n epilog=\"Exit codes: 0=success, 1=guard failure, 2=usage error, 3=timeout\",\n )\n parser.add_argument(\n \"--version\", action=\"version\", version=f\"%(prog)s {__version__}\"\n )\n parser.add_argument(\n \"--timeout\",\n type=int,\n default=30,\n metavar=\"SECONDS\",\n help=\"Maximum seconds to wait for a guarded process to respond (default: 30)\",\n )\n parser.add_argument(\n \"--config\",\n type=str,\n default=\"/", "metrics": { "length": 1081, "commands": 1, "command_list": [ "pip install argparse" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 2, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Fatal-guard CLI: harden entry point with --help, --version, exit codes (fatal-guard-cli-hardening)", "condition": "plain", "status": 200, "content": "The error you're encountering is related to the hardening of entry points in Fatal-guard CLI. Here's a concrete, actionable fix:\n\n**Step 1: Install Fatal-guard CLI**\n\nFirst, make sure you have Fatal-guard CLI installed. If not, you can install it using the following command:\n\n```bash\npip install fatal-guard-cli\n```\n\n**Step 2: Hardening Entry Point**\n\nTo harden the entry point, you'll need to create a `hardening.toml` file in the root directory of your project. This file will contain the configuration for the hardening.\n\nHere's an example `hardening.toml` file:\n\n```toml\n[hardening]\nentry_points = [\n {\n name = \"fatal-guard-cli\"\n paths = [\n \"fatal-guard-cli --help\",\n \"fatal-guard-cli --version\",\n \"fatal-guard-cli exit\"\n ]\n }\n]\n```\n\n**Step 3: Configure Fatal-guard CLI**\n\nNext, you'll need to configure Fatal-guard CLI to use the `hardening.toml` file. You can do this by adding the following command to your `~/.bashrc` or `~/.bash_profile` file:\n\n```bash\nexport FATAL_GUARD_CONFIG=~/.", "metrics": { "length": 1018, "commands": 3, "command_list": [ "pip install fatal-guard-cli", "**Step 3: Configure Fatal-guard CLI**", "Next, you'll need to configure Fatal-guard CLI to use the `hardening.toml` file. You can do this by adding the following command to your `~/.bashrc` or `~/.bash_profile` file:" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 2, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "ModuleNotFoundError in Python trotz pip install (fehler-python-modul-nicht-gefunden)", "condition": "with_lesson", "status": 200, "content": "To fix the `ModuleNotFoundError` in Python despite `pip install` succeeding, you need to ensure that the Python environment where `pip install` was run is the same as the environment executing the script. Here are the steps to follow:\n\n**Step 1: Identify the Python and pip versions in use**\n\nOpen a terminal and run the following commands to identify the Python and pip versions in use:\n```bash\n# Check the Python version\npython --version\n\n# Check the pip version\npip --version\n```\nTake note of the versions of Python and pip.\n\n**Step 2: Check if the Python and pip versions match**\n\nCompare the versions of Python and pip from the previous step. If they don't match, you may need to adjust the Python interpreter or pip version.\n\n**Step 3: Create a virtual environment (if not already created)**\n\nCreate a new virtual environment using the following command:\n```bash\npython -m venv myenv # Replace 'myenv' with your desired environment name\n```\n**Step 4: Activate the virtual environment**\n\nActivate the virtual environment using the following command:\n```bash\nsource myenv/bin/activate # On Linux/Mac\n. myenv\\Scripts\\activate # On Windows", "metrics": { "length": 1144, "commands": 3, "command_list": [ "python --version", "pip --version", "python -m venv myenv # Replace 'myenv' with your desired environment name" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "ModuleNotFoundError in Python trotz pip install (fehler-python-modul-nicht-gefunden)", "condition": "plain", "status": 200, "content": "The error \"ModuleNotFoundError in Python trotz pip install\" usually occurs when the Python interpreter is unable to find the module that you're trying to import, even after installing it using pip. Here's a step-by-step solution to fix this issue:\n\n**Step 1: Update pip**\n\nBefore we proceed, make sure you're using the latest version of pip. Run the following command:\n\n```bash\npython -m pip install --upgrade pip\n```\n\n**Step 2: Check for package name spelling mistake**\n\nDouble-check that the package name is spelled correctly. Make sure to use the exact same name as the package you're trying to install.\n\n**Step 3: Install the package using pip**\n\nTry installing the package again using pip:\n\n```bash\npython -m pip install python-modul\n```\n\nReplace `python-modul` with the actual name of the package you're trying to install.\n\n**Step 4: Check if the package is installed correctly**\n\nAfter installation, try importing the package again in your Python script:\n\n```python\nimport python_modul\n```\n\nIf the package is installed correctly, this command should not raise a ModuleNotFoundError.\n\n**Step 5: Check the Python path**\n\nIf the package is installed correctly, but still can't be", "metrics": { "length": 1183, "commands": 2, "command_list": [ "python -m pip install --upgrade pip", "python -m pip install python-modul" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 5, "lesson_hit_rate": 0.833 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Feishu Block API returns code=0 but creates zero blocks under rate limiting (feishu-block-api-false-success)", "condition": "plain", "status": 200, "content": "The error \"feishu-block-api-false-success\" typically indicates that the Feishu Block API is returning a successful response (code=0) but not actually creating any blocks due to rate limiting.\n\nTo fix this issue, you can try the following steps:\n\n1. **Increase the rate limit**: You can increase the rate limit by setting the `X-Feishu-Block-Api-Limit` header to a higher value. This will allow more requests to be made within a certain time frame.\n\n```bash\ncurl -X POST \\\n https://open.feishu.cn/open-apis/block/api/v1/blocks \\\n -H 'Content-Type: application/json' \\\n -H 'X-Feishu-Block-Api-Limit: 100' \\\n -d '{\"block_type\": \"text\", \"content\": \"Hello, world!\", \"trigger_type\": \"user\", \"trigger_value\": \"John\", \"trigger_operator\": \"==\"}'\n```\n\n2. **Wait for the rate limit reset**: If you're making requests too quickly, the rate limit might not have reset yet. You can wait for a few minutes and then try again.\n\n3. **Use a different block type**: Try using a different block", "metrics": { "length": 978, "commands": 5, "command_list": [ "curl -X POST \\", "https://open.feishu.cn/open-apis/block/api/v1/blocks \\", "-H 'Content-Type: application/json' \\", "-H 'X-Feishu-Block-Api-Limit: 100' \\", "-d '{\"block_type\": \"text\", \"content\": \"Hello, world!\", \"trigger_type\": \"user\", \"trigger_value\": \"John\", \"trigger_operator\": \"==\"}'" ], "has_command_block": true, "actionable": true, "inline_code_count": 2, "lesson_hits": 3, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Feishu Block API returns code=0 but creates zero blocks under rate limiting (feishu-block-api-false-success)", "condition": "with_lesson", "status": 200, "content": "To fix this issue, you can add a validation step to ensure that the response contains actual block data. Here's a concrete, actionable fix:\n\n```bash\n# Update your script to include the validation step\nimport time\nimport requests\n\ndef create_blocks_safe(doc_id, parent_id, blocks, max_retries=3):\n \"\"\"Create blocks with rate limiting and body size limit checks\"\"\"\n \n # Initialize retry counter\n retries = 0\n \n while retries <= max_retries:\n try:\n # Send the POST request\n response = requests.post(\n f\"https://openapi.feishu.cn/open-apis/docx/v1/documents/{doc_id}/blocks/{parent_id}/children\",\n json=blocks,\n headers={\"Content-Type\": \"application/json\"},\n timeout=30\n )\n \n # Check if the response was successful\n if response.status_code == 200:\n # Parse the response JSON\n response_data = response.json()\n \n # Check if the response contains actual block data\n if \"children\" in response_data and len(response_data[\"children\"]) > 0:\n return True\n else:\n print(\"No blocks created. Response data:\", response_data)\n else:\n print", "metrics": { "length": 1327, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "feishu block batch limit (feishu-block-batch-limit)", "condition": "with_lesson", "status": 200, "content": "To fix the error, you can modify the code to control the batch size and add a delay between batches. Here's an updated version of the code:\n\n```python\nimport time\n\ndef batch_create_blocks(client, doc_id, blocks):\n batch_size = 20\n interval = 0.5\n\n for i in range(0, len(blocks), batch_size):\n batch = blocks[i:i + batch_size]\n client.document.blocks.children.create(doc_id, children=batch)\n if i + batch_size < len(blocks):\n time.sleep(interval)\n\n# Usage\nblocks = [...] # your list of blocks\nbatch_create_blocks(client, doc_id, blocks)\n```\n\nHowever, this code still doesn't handle the case where the batch size exceeds the limit of 20 blocks. To handle this, you can add a check to ensure the batch size doesn't exceed 20:\n\n```python\nimport time\n\ndef batch_create_blocks(client, doc_id, blocks):\n max_batch_size = 20\n interval = 0.5\n\n for i in range(0, len(blocks), max_batch_size):\n batch = blocks[i:i + max_batch_size]\n if len(batch) < max_batch_size:\n client.document.blocks.children.create", "metrics": { "length": 1069, "commands": 1, "command_list": [ "However, this code still doesn't handle the case where the batch size exceeds the limit of 20 blocks. To handle this, you can add a check to ensure the batch size doesn't exceed 20:" ], "has_command_block": true, "actionable": false, "inline_code_count": 2, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "feishu block batch limit (feishu-block-batch-limit)", "condition": "plain", "status": 200, "content": "The error message \"feishu block batch limit (feishu-block-batch-limit)\" is related to the Feishu bot API, which has a limit on the number of batches you can send per second.\n\nTo fix this issue, you can try the following steps:\n\n1. **Increase the request rate limit**:\n You can increase the request rate limit by setting the `X-Feishu-Request-Rate-Limit` header to a higher value. You can do this by adding the following header to your request:\n ```bash\ncurl -X POST \\\n https://open.feishu.cn/open-apis/bot/v3/batchSend \\\n -H 'Authorization: Bearer YOUR_BOT_TOKEN' \\\n -H 'X-Feishu-Request-Rate-Limit: 1000' \\\n -H 'Content-Type: application/json' \\\n -d '[\n {\n \"type\": \"text\",\n \"text\": \"Hello, world!\"\n },\n {\n \"type\": \"text\",\n \"text\": \"This is a test message.\"\n }\n ]'\n```\n Replace `YOUR_BOT_TOKEN` with your actual bot token.\n\n2. **Use a queueing", "metrics": { "length": 905, "commands": 15, "command_list": [ "curl -X POST \\", "https://open.feishu.cn/open-apis/bot/v3/batchSend \\", "-H 'Authorization: Bearer YOUR_BOT_TOKEN' \\", "-H 'X-Feishu-Request-Rate-Limit: 1000' \\", "-H 'Content-Type: application/json' \\" ], "has_command_block": true, "actionable": true, "inline_code_count": 3, "lesson_hits": 2, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "feishu block type values limits (feishu-block-type-values-limits)", "condition": "with_lesson", "status": 200, "content": "To fix the error \"feishu block type values limits (feishu-block-type-values-limits)\", you need to update your code to use the correct block type values and handle any potential issues with image tokens.\n\nHere's a concrete, actionable fix with exact commands:\n\n**Update your JSON payload to use the correct block type values**\n\nReplace the following lines:\n```json\n{\n \"block_type\": 3,\n \"heading\": {\n \"level\": 3,\n \"elements\": [\n {\n \"type\": \"text_run\",\n \"text_run\": {\n \"content\": \"This is a heading\"\n }\n }\n ]\n }\n},\n{\n \"block_type\": 27,\n \"image\": {\n \"src\": \"https://example.com/image.jpg\"\n }\n}\n```\nWith the following updated lines:\n```json\n{\n \"block_type\": 1770001, // Use the correct heading type\n \"heading\": {\n \"level\": 3,\n \"elements\": [\n {\n \"type\": \"text_run\",\n \"text_run\": {\n \"content\": \"This is a heading\"\n }\n }\n ]\n }\n},\n{\n \"block_type\": 2,", "metrics": { "length": 952, "commands": 1, "command_list": [ "With the following updated lines:" ], "has_command_block": true, "actionable": true, "inline_code_count": 2, "lesson_hits": 5, "lesson_hit_rate": 0.833 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "feishu block type values limits (feishu-block-type-values-limits)", "condition": "plain", "status": 200, "content": "The error you're encountering is related to Feishu block type values limits. To resolve this issue, you'll need to update the block type values limits in your Feishu configuration.\n\nHere's a step-by-step guide to fix the issue:\n\n**Prerequisites:**\n\n* You have the Feishu SDK installed in your project.\n* You have a Feishu workspace set up.\n\n**Fix:**\n\n1. **Update the block type values limits in the Feishu configuration file:**\n\n If you're using a YAML configuration file, open the file in a text editor and update the block type values limits as follows:\n\n ```yml\nblock_type_values_limits:\n - type: text\n values:\n - short\n - long\n - type: image\n values:\n - small\n - medium\n - large\n```\n\n If you're using a JSON configuration file, update the block type values limits as follows:\n\n ```json\n{\n \"block_type_values_limits\": [\n {\n \"type\": \"text\",\n \"values\": [\"short\", \"long\"]\n },\n {\n \"type\": \"image\",\n \"values\": [\"small\", \"medium\", \"large\"]\n }\n ", "metrics": { "length": 1015, "commands": 1, "command_list": [ "If you're using a JSON configuration file, update the block type values limits as follows:" ], "has_command_block": true, "actionable": true, "inline_code_count": 2, "lesson_hits": 2, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Near-duplicate Feishu bot lessons: keep cc-connect, archive generic stub (feishu-bot-setup-complete)", "condition": "with_lesson", "status": 200, "content": "To fix the error, you'll need to follow these steps:\n\n1. Move the old generic body to a new file in the `_archive` directory.\n2. Update the canonical setup guide to point to the new file.\n3. Create a decision lesson at the old path.\n\nHere are the exact commands to achieve this:\n\n```bash\n# Move the old generic body to a new file in the _archive directory\ngit mv lessons/contrib/cc-connect-feishu-setup-complete.md lessons/_archive/cc-connect-feishu-setup-complete.md\n\n# Update the canonical setup guide to point to the new file\ngit mv lessons/contrib/feishu-bot-setup-complete.md lessons/contrib/cc-connect-feishu-setup-complete.md\n\n# Create a decision lesson at the old path\necho \"# Feishu Bot Setup\" > lessons/contrib/feishu-bot-setup-complete.md\necho \"## Problem\" >> lessons/contrib/feishu-bot-setup-complete.md\necho \"## Cause\" >> lessons/contrib/feishu-bot-setup-complete.md\necho \"## Fix\" >> lessons/contrib/feishu-bot-setup-complete.md\necho \"## Verify\" >> lessons/contrib/feishu-bot-setup-complete.md\n\n# Add a see_also", "metrics": { "length": 1024, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 1, "lesson_hits": 3, "lesson_hit_rate": 0.6 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "飞书 doc_delete_blocks_by_range 不传 end 会删到文档末尾 (feishu-doc-delete-blocks-by-range-pitfall)", "condition": "with_lesson", "status": 200, "content": "The error you're encountering is due to the fact that when you don't provide the `end` parameter in the `doc_delete_blocks_by_range` method, it will delete all remaining blocks in the document instead of stopping at the specified `start` index.\n\nTo fix this issue, you can modify your code to always provide the `end` parameter, even if it's set to `start + count`. Here's an example of how you can do this in Python:\n\n```python\nimport requests\n\n# Replace with your Feishu API token and document ID\ntoken = \"your_token\"\ndoc_id = \"your_doc_id\"\n\n# Define the start and end indices\nstart = 0\ncount = 5\n\n# Get the block IDs for the specified range\nresponse = requests.get(f\"https://open.feishu.cn/document_api/v1/document/{doc_id}/fetch?scope=block&start={start}&count={count}&keyword=&order=desc\")\nblock_ids = response.json()[\"data\"][\"block_ids\"]\n\n# Delete the blocks\nresponse = requests.post(f\"https://open.feishu.cn/document_api/v1/document/{doc_id}/delete_blocks_by_ids\", \n json={\"block_ids\": block_ids}, \n headers={\"Authorization\": f", "metrics": { "length": 1082, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 5, "lesson_hits": 2, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Near-duplicate Feishu bot lessons: keep cc-connect, archive generic stub (feishu-bot-setup-complete)", "condition": "plain", "status": 200, "content": "The error message you're seeing is related to duplicate Feishu bot lessons. To fix this, you'll need to delete the duplicate lessons. Here are the steps to follow:\n\n**Step 1: Delete the duplicate lesson**\n\nYou can delete the duplicate lesson by running the following command:\n\n```bash\nfeishu delete-lesson --lesson-name keep cc-connect, archive generic stub (feishu-bot-setup-complete)\n```\n\nReplace `feishu-bot-setup-complete` with the actual name of the duplicate lesson.\n\n**Step 2: Verify the lesson is deleted**\n\nAfter deleting the lesson, you can verify that it's been removed by running the following command:\n\n```bash\nfeishu lessons\n```\n\nThis will list all your Feishu bot lessons. If the duplicate lesson is deleted, you should no longer see it in the list.\n\n**Step 3: Re-create the lesson (if necessary)**\n\nIf the lesson was deleted by mistake, you'll need to re-create it. You can re-create the lesson by running the following command:\n\n```bash\nfeishu create-lesson --lesson-name keep cc-connect, archive generic stub (feishu-bot-setup-complete)\n```\n\nReplace `feishu-bot-setup-complete` with the actual", "metrics": { "length": 1111, "commands": 3, "command_list": [ "feishu delete-lesson --lesson-name keep cc-connect, archive generic stub (feishu-bot-setup-complete)", "feishu lessons", "feishu create-lesson --lesson-name keep cc-connect, archive generic stub (feishu-bot-setup-complete)" ], "has_command_block": true, "actionable": false, "inline_code_count": 7, "lesson_hits": 2, "lesson_hit_rate": 0.4 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "飞书 doc_delete_blocks_by_range 不传 end 会删到文档末尾 (feishu-doc-delete-blocks-by-range-pitfall)", "condition": "plain", "status": 200, "content": "The error you're encountering is due to the `end` parameter not being provided in the `doc_delete_blocks_by_range` API method of the Feishu SDK. This can lead to unintended deletion of blocks at the end of the document.\n\nTo fix this issue, you need to provide the `end` parameter with the correct value. Here's an example of how to do it:\n\n```python\nfrom feishu import *\n\n# Initialize the client\nclient = Client()\n\n# Define the document ID and the start and end positions of the block range\ndoc_id = \"your_document_id\"\nstart = 1\nend = 5\n\n# Define the request body\nbody = {\n \"doc_id\": doc_id,\n \"start\": start,\n \"end\": end\n}\n\n# Send the request\nresponse = client.doc.delete_blocks_by_range(body)\n\n# Check if the request was successful\nif response.status_code == 200:\n print(\"Blocks deleted successfully\")\nelse:\n print(\"Error deleting blocks:\", response.text)\n```\n\nIn the above code:\n\n* `doc_id` is the ID of the document where you want to delete blocks.\n* `start` and `end` are the positions of the block range that you want to", "metrics": { "length": 1044, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 7, "lesson_hits": 2, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "飞书 bot 在群聊里静默吞消息 — gateway 与 adapter 双层 allowlist 陷阱 (feishu-gateway-group-policy-silently-drops-messages)", "condition": "with_lesson", "status": 200, "content": "以下是修复错误的步骤:\n\n**步骤 1: 创建一个新文件 `feishu-allowlist-example.py`**\n\n```bash\ntouch feishu-allowlist-example.py\n```\n\n**步骤 2: 将以下代码写入 `feishu-allowlist-example.py`**\n\n```python\nimport os\nimport logging\n\nfrom hermes import Hermes\n\n# 使 logger 显示详细信息\nlogging.basicConfig(level=logging.INFO)\n\n# 读取 Hermes Agent 的配置文件\nconfig_file = 'config.yaml'\nconfig = Hermes().config\n\n# 读取环境变量\nenv_file = '.env'\nenv = Hermes().env\n\n# 使 adapter 支持 allowlist\nadapter_config = {\n 'feishu': {\n 'policy': 'allowlist',\n 'allowed_users': env.get('FEISHU_ALLOWED_USERS', '')\n }\n}\n\n# 使 gateway 支持 allowall\ngateway_config = {\n 'feishu': {\n 'allowed_chats': env.get('FEISHU_GROUP_ALLOWED_CHATS', '')\n }\n}\n\n# 使 GATEWAY_ALLOW_ALL_USERS=false\ngateway_config['feishu']['allow_all_users'] = False\n\n", "metrics": { "length": 788, "commands": 1, "command_list": [ "touch feishu-allowlist-example.py" ], "has_command_block": true, "actionable": false, "inline_code_count": 4, "lesson_hits": 2, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "飞书 bot 在群聊里静默吞消息 — gateway 与 adapter 双层 allowlist 陷阱 (feishu-gateway-group-policy-silently-drops-messages)", "condition": "plain", "status": 200, "content": "The error message \"飞书 bot 在群聊里静默吞消息 — gateway 与 adapter 双层 allowlist 陷阱 (feishu-gateway-group-policy-silently-drops-messages)\" indicates that the Feishu bot is silently dropping messages in a group chat due to a configuration issue with the gateway and adapter layers.\n\nTo fix this issue, you can try the following steps:\n\n1. Check the Feishu dashboard for any updates or changes to the gateway and adapter configurations.\n2. Ensure that the `allowlist` configuration is set correctly for the bot. You can do this by checking the `feishu-gateway-group-policy-silently-drops-messages` log for any errors related to the `allowlist`.\n3. Update the `feishu-gateway` and `feishu-adapter` configurations to ensure that they are compatible with each other.\n\nHere are some exact commands you can use to troubleshoot and fix the issue:\n\n**Step 1: Check the Feishu dashboard**\n\nOpen the Feishu dashboard and navigate to the \"Gateway\" tab. Check if there are any updates or changes to the gateway configuration.\n\n**Step 2: Check the `allowlist` configuration**\n\nRun the following command to", "metrics": { "length": 1079, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 6, "lesson_hits": 1, "lesson_hit_rate": 0.167 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "feishu markdown table not rendered (feishu-markdown-table-not-rendered)", "condition": "plain", "status": 200, "content": "The error \"feishu markdown table not rendered\" is typically caused by a missing or incorrect markdown syntax for tables in the Feishu bot. Here's a concrete and actionable fix:\n\n**Fix:**\n\n1. **Check your markdown syntax**: Ensure that your table is formatted correctly using the following syntax:\n```markdown\n| Column 1 | Column 2 | Column 3 |\n|----------|----------|----------|\n| Cell 1 | Cell 2 | Cell 3 |\n|----------|----------|----------|\n| Cell 4 | Cell 5 | Cell 6 |\n```\nNote the pipe (`|`) characters separating the columns and rows.\n\n2. **Use the correct table syntax**: If you're using Feishu's `markdown_table` element, make sure to use the correct syntax:\n```javascript\n{\n \"markdown_table\": {\n \"title\": \"Example Table\",\n \"rows\": [\n [\"Cell 1\", \"Cell 2\", \"Cell 3\"],\n [\"Cell 4\", \"Cell 5\", \"Cell 6\"]\n ]\n }\n}\n```\n3. **Test your markdown table**: Before sending the message, test your markdown table using a markdown parser like Markdown.it", "metrics": { "length": 977, "commands": 2, "command_list": [ "Note the pipe (`|`) characters separating the columns and rows.", "2. **Use the correct table syntax**: If you're using Feishu's `markdown_table` element, make sure to use the correct syntax:" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "feishu markdown table not rendered (feishu-markdown-table-not-rendered)", "condition": "with_lesson", "status": 200, "content": "To fix the issue with the Feishu markdown table not rendering, you can use the following steps:\n\n1. Install the required Python package:\n\n```bash\npip install re\n```\n\n2. Create a new file named `optimize_markdown_style.py` and add the following code:\n\n```python\nimport re\n\ndef optimize_markdown_style(content: str) -> str:\n \"\"\"Feishu post middle markdown table render fix: use
', line)\n # Clean up extra
before and after spaces\n line = re.sub(r'\\s before and after the line\n line = f'
{line}
'\n in_table = True\n else:\n in_table = False\n result.append(line)\n \n return '\\n'.join(result)\n```\n\n3. Run", "metrics": { "length": 1027, "commands": 1, "command_list": [ "pip install re" ], "has_command_block": true, "actionable": true, "inline_code_count": 4, "lesson_hits": 2, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Finding and fixing Ghostty's largest memory leak (finding-and-fixing-ghostty-s-largest-memory-leak)", "condition": "with_lesson", "status": 200, "content": "To fix the memory leak in Ghostty, you'll need to modify the `scrollback_pruning` function to properly handle non-standard pages. Here's a concrete, actionable fix with exact commands:\n\n**Ghostty Code Modification**\n\n```c\n// In ghostty/scrollback.c\n\n// Modify the scrollback_pruning function to properly handle non-standard pages\nvoid scrollback_prune(PageList *page_list) {\n // ... (rest of the function remains the same)\n\n // Check if the page is non-standard and needs to be destroyed\n if (page->mmap_len > PAGE_SIZE) {\n munmap(page->mmap, page->mmap_len);\n }\n\n // Allocate a fresh standard-sized page from the pool\n page = page_list->pool->alloc_page(PAGE_SIZE);\n if (page) {\n // ... (rest of the function remains the same)\n }\n}\n\n// Modify the page_list_destroy function to properly free non-standard pages\nvoid page_list_destroy(PageList *page_list) {\n // ... (rest of the function remains the same)\n\n // Check if the page is non-standard and needs to be destroyed\n if (page->mmap_len > PAGE_SIZE) {\n munmap", "metrics": { "length": 1066, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 1, "lesson_hits": 1, "lesson_hit_rate": 0.2 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "cc-connect Feishu bot complete setup guide (feishu-setup-complete-cc-connect)", "condition": "plain", "status": 200, "content": "The error message \"cc-connect Feishu bot complete setup guide (feishu-setup-complete-cc-connect)\" suggests that there might be an issue with the Feishu bot setup or the connection to the Feishu platform.\n\nHere's a step-by-step guide to resolve this issue:\n\n**Step 1: Check your Feishu bot token**\n\n1. Open the Feishu platform and navigate to your bot's settings.\n2. Look for the \"Bot Token\" or \"API Token\" section.\n3. Make sure you have copied the bot token correctly.\n\n**Step 2: Update your `~/.cc` configuration file**\n\n1. Open a terminal and navigate to your home directory (`cd ~`).\n2. Run the following command to update the `~/.cc` configuration file:\n```\ncc config update\n```\n3. If you don't have a `~/.cc` file, create it with the following command:\n```\ncc config init\n```\n4. Update the Feishu bot token in the `~/.cc` file by running:\n```\ncc config set feishu.token \n```\nReplace `` with the actual bot token you copied from the Feishu", "metrics": { "length": 975, "commands": 3, "command_list": [ "cc config update", "cc config init", "cc config set feishu.token " ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 5, "lesson_hit_rate": 0.833 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "cc-connect Feishu bot complete setup guide (feishu-setup-complete-cc-connect)", "condition": "with_lesson", "status": 200, "content": "Here's a concrete, actionable fix for the error:\n\n1. **Update the `cc-connect` package to the latest version**:\n\n ```bash\nnpm install -g cc-connect@latest\n```\n\n2. **Create a configuration file for `cc-connect`**:\n\n ```bash\nmkdir -p ~/.cc-connect\ncp /path/to/cc-connect/config.example.toml ~/.cc-connect/config.toml\n```\n\n3. **Update the configuration file with the correct `app_id` and `app_secret`**:\n\n Replace `/path/to/your/project` with your actual project path.\n\n ```toml\n[[projects]]\nname = \"cc-connect-feishu\"\n\n[projects.agent]\ntype = \"claudecode\"\n\n[projects.agent.options]\nwork_dir = \"/path/to/your/project\"\nmode = \"default\"\n\n[[projects.platforms]]\ntype = \"feishu\"\n\n[projects.platforms.options]\napp_id = \"YOUR_APP_ID\"\napp_secret = \"YOUR_APP_SECRET\"\n\n```\n\n4. **Verify the installation and configuration**:\n\n ```bash\nnpm install -g cc-connect@latest\ncc-connect --version\n```\n\n5. **Display the optimized configuration**:\n\n ```bash\ncc-connect", "metrics": { "length": 968, "commands": 5, "command_list": [ "npm install -g cc-connect@latest", "mkdir -p ~/.cc-connect", "cp /path/to/cc-connect/config.example.toml ~/.cc-connect/config.toml", "4. **Verify the installation and configuration**:", "5. **Display the optimized configuration**:" ], "has_command_block": true, "actionable": true, "inline_code_count": 13, "lesson_hits": 5, "lesson_hit_rate": 0.833 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Finding and fixing Ghostty's largest memory leak (finding-and-fixing-ghostty-s-largest-memory-leak)", "condition": "plain", "status": 200, "content": "To fix Ghostty's largest memory leak, you'll need to identify the cause of the memory leak and then address it. Here are some general steps and concrete commands to help you get started:\n\n**Step 1: Identify the cause of the memory leak**\n\nYou can use the following command to get a list of processes that are consuming the most memory:\n```bash\nps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem\n```\nThis command will show you a list of processes, sorted by the amount of memory they are consuming.\n\n**Step 2: Analyze the memory usage**\n\nYou can use the `pmap` command to analyze the memory usage of a specific process:\n```bash\npmap -d \n```\nReplace `` with the ID of the process you want to analyze.\n\n**Step 3: Identify the memory leak**\n\nYou can use the `strace` command to analyze the system calls made by a process and identify the source of the memory leak:\n```bash\nstrace -s 1000 -p \n```\nThis command will show you a list of system calls made by the process, including the amount of memory used by each call.\n\n**Step", "metrics": { "length": 1048, "commands": 3, "command_list": [ "ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem", "pmap -d ", "strace -s 1000 -p " ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Frontmatter Parsing Edge Cases — Silent Failures and Data Loss (frontmatter-parsing-edge-cases)", "condition": "with_lesson", "status": 200, "content": "The issue you're experiencing is due to the `extract_frontmatter` function not handling edge cases properly. Here's a concrete, actionable fix:\n\n**Step 1: Update the `extract_frontmatter` function**\n\n```python\nimport re\nimport json\nimport yaml\nfrom typing import Tuple\n\ndef extract_frontmatter(path: 'Path') -> Tuple[dict | None, str | None]:\n \"\"\"\n Extract frontmatter from a file.\n\n Args:\n path: The path to the file.\n\n Returns:\n A tuple containing the extracted frontmatter as a dictionary or None, and an error message or None.\n \"\"\"\n content = path.read_text(encoding=\"utf-8\")\n # Check for UTF-8 BOM encoding\n if content.startswith('\\ufeff'):\n content = content[1:]\n\n m = re.match(r\"^---\\s*\\n(.?)\\n---\", content, re.DOTALL)\n if not m:\n # Return empty dict for empty frontmatter blocks\n return {}, None\n\n raw = m.group(1).strip()\n try:\n # Try to parse as JSON\n fm = json.loads(raw)\n except json.JSONDecodeError:\n # Fall back to simple YAML-like parser", "metrics": { "length": 1040, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 2, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Game MCP: End Turn Returns 409 Conflict (game-mcp-end-turn-conflict-409)", "condition": "with_lesson", "status": 200, "content": "To fix the error \"Game MCP: End Turn Returns 409 Conflict\", you can follow these steps:\n\n1. Send the `end_turn` command to the MCP endpoint.\n2. Check if the response is a 409 Conflict. If it is, ignore it and proceed with the next steps.\n3. Use the `get_state` command to query the current game state.\n4. Verify that the game state shows the next turn has started.\n\nHere are the exact commands:\n\n```bash\n# Send end_turn command\nend_turn\n\n# Check if the response is a 409 Conflict\nif [ $? -eq 409 ]; then\n # Ignore the 409 response and proceed with the next steps\n echo \"Ignoring 409 response\"\nelse\n echo \"Received non-409 response\"\nfi\n\n# Query game state\nget_state\n\n# Verify that the game state shows the next turn has started\nif [ \"$(get_state | jq -r '.turn')\" == \"next\" ]; then\n echo \"Game state shows next turn has started\"\nelse\n echo \"Game state does not show next turn has started\"\nfi\n```\n\nNote: The `jq` command is used to parse the JSON response from the `get_state` command.\n\n", "metrics": { "length": 990, "commands": 12, "command_list": [ "end_turn", "if [ $? -eq 409 ]; then", "echo \"Ignoring 409 response\"", "else", "echo \"Received non-409 response\"" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 1, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Game MCP: End Turn Returns 409 Conflict (game-mcp-end-turn-conflict-409)", "condition": "plain", "status": 200, "content": "The error \"Game MCP: End Turn Returns 409 Conflict (game-mcp-end-turn-conflict-409)\" typically occurs when the MCP (Multiplayer Combat Protocol) is unable to update the game state because it has been modified by another player. This conflict can happen when multiple players try to end their turns simultaneously.\n\nHere's a concrete, actionable fix:\n\n**Step 1: Wait for 30 seconds**\n\nThe MCP will retry updating the game state after a short delay. Wait for 30 seconds to see if the conflict resolves itself.\n\n**Step 2: Check for conflicting players**\n\nIf the conflict persists, check the game's chat or observer window to see if any other players are trying to end their turns. If you find another player attempting to end their turn, inform them of the conflict and ask them to wait until the game is updated.\n\n**Step 3: End your turn manually**\n\nIf the conflict persists, try ending your turn manually by typing `/endturn` in the chat window. This will force the game to update the state without relying on the MCP.\n\n**Step 4: Reconnect to the game**\n\nIf the conflict still persists, try reconnecting to the game. Sometimes, reconnecting can resolve the conflict and allow the MCP to update", "metrics": { "length": 1192, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 1, "lesson_hits": 1, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Frontmatter Parsing Edge Cases — Silent Failures and Data Loss (frontmatter-parsing-edge-cases)", "condition": "plain", "status": 200, "content": "The error \"Frontmatter Parsing Edge Cases — Silent Failures and Data Loss\" typically occurs when the `frontmatter-parsing-edge-cases` plugin is used in conjunction with other plugins that modify or delete frontmatter data. To resolve this issue, you can try the following steps:\n\n1. **Update the `frontmatter-parsing-edge-cases` plugin**:\n\n * If you're using npm or yarn, run the following command to update the plugin:\n\n ```bash\nnpm install --save-dev frontmatter-parsing-edge-cases@latest\n```\n\n or\n\n ```bash\nyarn add frontmatter-parsing-edge-cases@latest --dev\n```\n\n2. **Disable the `frontmatter-parsing-edge-cases` plugin temporarily**:\n\n * If the issue persists, try disabling the plugin temporarily by commenting out the line in your `package.json` file that enables it:\n\n ```json\n \"scripts\": {\n // ...\n \"build\": \"gatsby build --disable-plugin=frontmatter-parsing-edge-cases\",\n // ...\n },\n```\n\n Then, run the following command to build your site:\n\n ```bash\nnpm run build\n```\n\n or\n\n ```bash\ny", "metrics": { "length": 1085, "commands": 4, "command_list": [ "npm install --save-dev frontmatter-parsing-edge-cases@latest", "yarn add frontmatter-parsing-edge-cases@latest --dev", "Then, run the following command to build your site:", "or" ], "has_command_block": true, "actionable": true, "inline_code_count": 12, "lesson_hits": 2, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Gateway 进程挂死未崩溃 — watchdog 自动Recovery (gateway-hang-watchdog-recovery)", "condition": "with_lesson", "status": 200, "content": "根据给出的解决方案,这是解决 Gateway 进程挂死未崩溃的问题的具体步骤:\n\n1. **杀掉 TTY 里的 Hermes CLI过程**:\n\n ```bash\n pkill -f \"hermes cli\" || true\n ```\n\n 这个命令会杀掉 TTY 里的 Hermes CLI过程。如果 Hermes CLI过程存在,则会被杀掉。\n\n2. **通过 systemd 运行 Gateway**:\n\n ```bash\n systemctl --user status hermes-gateway.service\n ```\n\n 这个命令会检查 Gateway 服务是否通过 systemd 运行。如果服务没有运行,则会显示错误信息。\n\n3. **验证命令**:\n\n ```bash\n pkill -f \"hermes cli\" || true\n echo \"Verification passed: fix command exited 0\"\n ```\n\n 这个命令会杀掉 TTY 里的 Hermes CLI过程。如果 Hermes CLI过程存在,则会被杀掉。然后,会打印 \"Verification passed: fix command exited 0\" 的信息,表明命令执行成功。\n\n**具体步骤:**\n\n1. **使用命令 pkill -f \"hermes cli\" || true**:", "metrics": { "length": 648, "commands": 4, "command_list": [ "pkill -f \"hermes cli\" || true", "systemctl --user status hermes-gateway.service", "pkill -f \"hermes cli\" || true", "echo \"Verification passed: fix command exited 0\"" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 3, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Gateway 进程挂死未崩溃 — watchdog 自动Recovery (gateway-hang-watchdog-recovery)", "condition": "plain", "status": 200, "content": "The error message \"Gateway 进程挂死未崩溃 — watchdog 自动Recovery (gateway-hang-watchdog-recovery)\" is a common issue in Linux systems. This error occurs when the gateway process hangs and the watchdog timer fails to recover from it.\n\nTo fix this issue, you can try the following steps:\n\n**Step 1: Check the system logs**\n\nFirst, check the system logs to see if there are any error messages related to the gateway process.\n\n```bash\nsudo journalctl -u systemd-networkd\n```\n\nThis command will display the journal entries for the systemd-networkd service, which is responsible for managing network interfaces.\n\n**Step 2: Restart the gateway service**\n\nTry restarting the gateway service to see if it resolves the issue.\n\n```bash\nsudo systemctl restart gateway\n```\n\nor\n\n```bash\nsudo systemctl restart systemd-networkd\n```\n\n**Step 3: Disable and re-enable the gateway service**\n\nDisable the gateway service, wait for a few seconds, and then re-enable it.\n\n```bash\nsudo systemctl stop gateway\nsudo systemctl disable gateway\nsudo systemctl enable gateway\n```\n\n**Step 4: Check the watchdog configuration**\n\nCheck the watchdog configuration file to ensure it is set up correctly.\n\n```bash", "metrics": { "length": 1170, "commands": 6, "command_list": [ "sudo journalctl -u systemd-networkd", "sudo systemctl restart gateway", "sudo systemctl restart systemd-networkd", "sudo systemctl stop gateway", "sudo systemctl disable gateway" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 2, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "GFW TLS SNI 阻断:工具层全部无效,只有代理能解 (gfw-tls-sni-blocking-tool-layer-ineffective)", "condition": "plain", "status": 200, "content": "The error message \"GFW TLS SNI 阻断:工具层全部无效,只有代理能解\" indicates that the TLS SNI (Server Name Indication) is blocked by the Great Firewall of China (GFW), and only proxy servers can resolve it. Here's a concrete fix using a proxy server:\n\n**Method 1: Using a proxy server with a VPN**\n\n1. Install a VPN client on your device (e.g., TunnelBear, ExpressVPN, or NordVPN).\n2. Connect to a VPN server that bypasses the GFW (e.g., a server in the US or Canada).\n3. Configure your browser to use the VPN connection as the proxy server. The steps vary depending on your browser:\n\n**Google Chrome:**\n\n* Open Chrome settings (chrome://settings/)\n* Click on \"Advanced\"\n* Click on \"System\"\n* Click on \"Proxy settings\"\n* Select \"Use a proxy server\"\n* Enter the VPN server's IP address and port (e.g., `tunnelbear.com:8080`)\n* Click \"Save\"\n\n**Mozilla Firefox:**\n\n* Open Firefox settings (about:config)\n* Search for \"network.proxy.type\" and set it to 3 (System proxy)\n* Search for \"network", "metrics": { "length": 970, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 1, "lesson_hits": 1, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Ghidra MCP Server — AI-Assisted Reverse Engineering (ghidra-mcp-server-reverse-engineering)", "condition": "with_lesson", "status": 200, "content": "To fix the error, you'll need to install the Ghidra plugin and MCP server, and then connect from any MCP client. Here's a step-by-step guide:\n\n**Step 1: Install Ghidra plugin and MCP server**\n\n1. Clone the GhidraMCP repository:\n ```bash\ngit clone https://github.com/LaurieWired/GhidraMCP.git\n```\n\n2. Navigate to the cloned repository:\n ```bash\ncd GhidraMCP\n```\n\n3. Install the Ghidra plugin:\n ```bash\n./install-plugin.sh\n```\n\n4. Install the MCP server:\n ```bash\n./install-server.sh\n```\n\n5. Start the MCP server:\n ```bash\n./start-server.sh\n```\n\n**Step 2: Connect from any MCP client**\n\n1. Clone the MCP client repository (e.g., MCP-Client):\n ```bash\ngit clone https://github.com/LaurieWired/MCP-Client.git\n```\n\n2. Navigate to the cloned repository:\n ```bash\ncd MCP-Client\n```\n\n3. Build the MCP client:\n ```bash\n./build.sh\n```\n\n4. Connect to the MCP server:\n ```", "metrics": { "length": 878, "commands": 8, "command_list": [ "git clone https://github.com/LaurieWired/GhidraMCP.git", "cd GhidraMCP", "./install-plugin.sh", "./install-server.sh", "./start-server.sh" ], "has_command_block": true, "actionable": true, "inline_code_count": 16, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "GFW TLS SNI 阻断:工具层全部无效,只有代理能解 (gfw-tls-sni-blocking-tool-layer-ineffective)", "condition": "with_lesson", "status": 200, "content": "解决GFW TLS SNI 阻断问题的步骤如下:\n\n**步骤 1: 安装 proxychains**\n\n由于 GFW 阻断了所有工具层,需要使用代理来解析。我们需要安装 `proxychains` 和 `tor`:\n\n```bash\nsudo apt-get update\nsudo apt-get install proxychains tor\n```\n\n**步骤 2: 配置 proxychains**\n\n编辑 `~/.proxychains.conf`文件:\n\n```bash\nsudo nano ~/.proxychains.conf\n```\n\n添加以下内容:\n\n```\nroot\n # No Tor connection\n 0 0.0.0.0 0.0.0.0 TOR\n```\n\n**步骤 3: 配置 tor**\n\n编辑 `~/.torrc`文件:\n\n```bash\nsudo nano ~/.torrc\n```\n\n添加以下内容:\n\n```\nControlPort 443\nListenAddress 127.0.0.1\n```\n\n**步骤 4: 启动 tor**\n\n```bash\nsudo systemctl start tor\n```\n\n**步骤 5: 配置 curl**\n\n编辑 `~/.curlrc`文件:\n\n```bash\nsudo nano ~/.curlrc\n", "metrics": { "length": 598, "commands": 9, "command_list": [ "sudo apt-get update", "sudo apt-get install proxychains tor", "sudo nano ~/.proxychains.conf", "root", "0 0.0.0.0 0.0.0.0 TOR" ], "has_command_block": true, "actionable": false, "inline_code_count": 17, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Ghidra MCP Server — AI-Assisted Reverse Engineering (ghidra-mcp-server-reverse-engineering)", "condition": "plain", "status": 200, "content": "I can help you troubleshoot the issue with Ghidra MCP Server. However, I need more information about the error message you're seeing. Could you please provide the exact error message you're encountering?\n\nThat being said, here are some common issues that might cause problems with Ghidra MCP Server:\n\n1. Missing dependencies:\nGhidra requires several dependencies to be installed on your system. Make sure that you have the following packages installed:\n\n - `libssl-dev` (for SSL support)\n - `libgmp-dev` (for arbitrary-precision arithmetic)\n - `liblzma-dev` (for LZMA compression)\n\n You can install these packages using the following commands:\n\n ```bash\nsudo apt-get update\nsudo apt-get install -y libssl-dev libgmp-dev liblzma-dev\n```\n\n2. Ghidra not installed:\n Make sure that Ghidra is installed on your system. You can install it using the following command:\n\n ```bash\nsudo apt-get install -y ghidra\n```\n\n3. MCP Server not running:\n If you're trying to use the MCP Server with Ghidra, make sure that it's running. You can start the MCP Server using the following command:\n\n", "metrics": { "length": 1092, "commands": 3, "command_list": [ "sudo apt-get update", "sudo apt-get install -y libssl-dev libgmp-dev liblzma-dev", "sudo apt-get install -y ghidra" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Чистая ветка после слияния предыдущего pull request (git-clean-branch-after-merged-pr-ru)", "condition": "with_lesson", "status": 200, "content": "Чтобы решить эту проблему, нужно сделать следующее:\n\n1. Войти в исходную ветку `main` с помощью `git checkout main`.\n2. Сравнить HEAD с основной веткой `origin/main` с помощью `git log --oneline origin/main..HEAD`.\n3. Если есть конфликты, решить их с помощью `git merge --abort` и повторить шаги.\n4. Если все ок, то создать новую ветку с помощью `git switch -c docs/next-lesson` (или любая другая комбинация, используемая в вашем репозитории).\n\nHere's как это выглядит в терминале:\n\n```bash\n# Войти в исходную ветку main\ngit checkout main\n\n# Сравнить HEAD с основной веткой origin/main\ngit log --oneline origin/main..HEAD\n\n# Решить конфликты, если есть\ngit merge --abort\n\n# Повторить шаги, если все еще есть конфликты\ngit log --oneline origin/main..HEAD\n\n# Если все ок, то создать новую ветку\ngit switch -c docs/next-lesson\n```\n\nAlternatively, если вы хот", "metrics": { "length": 855, "commands": 5, "command_list": [ "git checkout main", "git log --oneline origin/main..HEAD", "git merge --abort", "git log --oneline origin/main..HEAD", "git switch -c docs/next-lesson" ], "has_command_block": true, "actionable": false, "inline_code_count": 7, "lesson_hits": 2, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Чистая ветка после слияния предыдущего pull request (git-clean-branch-after-merged-pr-ru)", "condition": "plain", "status": 200, "content": "The error \"Чистая ветка после слияния предыдущего pull request (git-clean-branch-after-merged-pr-ru)\" is a Russian translation of a Git error that occurs when you try to delete a branch that has unmerged commits.\n\nTo fix this error, you need to use the following command:\n\n```bash\ngit merge --no-ff -m \"Clean up the branch\" \n```\n\nHere's what each part of the command does:\n\n- `git merge`: This command merges the current branch with another branch.\n- `--no-ff`: This option prevents the merge from being a fast-forward. When a merge is a fast-forward, Git doesn't create a new merge commit, but instead updates the tip of the current branch to point directly to the tip of the other branch.\n- `-m \"Clean up the branch\"`: This is the commit message for the merge commit. You can customize it as needed.\n- ``: Replace `` with the name of the branch you want to clean up.\n\nAfter running the command, you can then delete the branch:\n\n```bash\ngit branch -d \n```\n\nIf you want to force delete the branch (i.e", "metrics": { "length": 1053, "commands": 2, "command_list": [ "git merge --no-ff -m \"Clean up the branch\" ", "git branch -d " ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 1, "lesson_hit_rate": 0.167 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "gh credential helper 路径Error导致 git push 静默失败 (git-credential-helper-gh-path-mismatch)", "condition": "with_lesson", "status": 200, "content": "解决 gh credential helper 路径Error导致 git push 靜默失败的问题步骤如下:\n\n**步骤 1: 查看当前 credential helper 配置**\n\n```bash\ngit config --global --list | grep credential\n```\n\n**步骤 2: 移除路径错误的 gh credential helper**\n\n```bash\ngit config --global --unset-all credential.https://github.com.helper\ngit config --global --unset-all credential.https://gist.github.com.helper\n```\n\n**步骤 3: 确保保留正确的 credential store**\n\n```bash\ngit config --global credential.helper store\n```\n\n**步骤 4: 确认 .git-credentials 里有有效 token**\n\n```bash\ncat ~/.git-credentials\n```\n\n**步骤 5: 验证**\n\n```bash\ngit ls-remote origin HEAD\n```\n\n如果没有报错,说明解决方案成功。\n\n**步骤 6: 验证配置**\n\n```bash\ngit config --global --list | grep credential\necho \"Verification passed: fix command exited 0\"\n```\n\n如果没有报错,说明验证成功。", "metrics": { "length": 727, "commands": 8, "command_list": [ "git config --global --list | grep credential", "git config --global --unset-all credential.https://github.com.helper", "git config --global --unset-all credential.https://gist.github.com.helper", "git config --global credential.helper store", "cat ~/.git-credentials" ], "has_command_block": true, "actionable": false, "inline_code_count": 11, "lesson_hits": 2, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "gh credential helper 路径Error导致 git push 静默失败 (git-credential-helper-gh-path-mismatch)", "condition": "plain", "status": 200, "content": "The error \"git-credential-helper-gh-path-mismatch\" occurs when the path to the GitHub credential helper is not correctly set. Here's a step-by-step fix:\n\n**Fix 1: Update the GitHub Credential Helper Path**\n\n1. Open your terminal or command prompt.\n2. Run the following command to update the path to the GitHub credential helper:\n ```bash\ngit config --global credential.helper path /usr/bin/git-credential-cache\n```\n If you're on Windows, replace `/usr/bin/git-credential-cache` with the path to the `git-credential-cache` executable on your system.\n\n**Fix 2: Verify the Path (Optional)**\n\n1. Run the following command to verify the path to the GitHub credential helper:\n ```bash\ngit config --global credential.helper path\n```\n This command should display the updated path.\n\n**Fix 3: Run `git push` Again**\n\n1. Try running `git push` again to see if the issue is resolved.\n\nIf you're still facing issues, you can try resetting the credential helper path to its default value:\n```bash\ngit config --global --unset credential.helper\n```\nThis will reset the credential helper path to its default value, which should resolve the issue", "metrics": { "length": 1136, "commands": 3, "command_list": [ "git config --global credential.helper path /usr/bin/git-credential-cache", "git config --global credential.helper path", "git config --global --unset credential.helper" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 2, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Git 凭证Setup — Automation push 免密码 (git-credentials-automation)", "condition": "with_lesson", "status": 200, "content": "To fix the error \"Git 凭证Setup — Automation push 免密码\" when running a script that automates a git push, you can follow these steps:\n\n**Step 1: Configure Git to use a non-interactive credential helper**\n\nOpen your terminal and run the following command to configure Git to use a non-interactive credential helper:\n```bash\ngit config --global credential.helper store\n```\nThis will store your credentials in a file instead of prompting you for input.\n\n**Step 2: Create a file to store your credentials**\n\nCreate a file named `.git-credentials` in your home directory (e.g., `~/.git-credentials`) with the following contents:\n```bash\nhttps://username:${GITHUB_TOKEN}@github.com\n```\nReplace `username` with your actual GitHub username and `GITHUB_TOKEN` with your personal access token (more on this later).\n\n**Step 3: Test the configuration**\n\nRun the following command to test the configuration:\n```bash\ngit ls-remote https://github.com/your-org/your-repo.git\n```\nThis should return the HEAD reference without prompting you for input.\n\n**Verification**\n\nTo verify that the fix worked, run the following command:\n```bash\ngit config --global credential", "metrics": { "length": 1145, "commands": 3, "command_list": [ "git config --global credential.helper store", "https://username:${GITHUB_TOKEN}@github.com", "git ls-remote https://github.com/your-org/your-repo.git" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 5, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Git 凭证Setup — Automation push 免密码 (git-credentials-automation)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely due to Git not being able to find your credentials. To fix this, you can use the `git-credential-store` and `git credential store` commands to automate the process of storing your credentials. Here are the steps:\n\n**Step 1: Install the required packages**\n\nIf you're using a Linux or macOS system, you can install the required packages using the following commands:\n\n```bash\nsudo apt-get update\nsudo apt-get install git-credential-store\n```\n\nFor Windows, you can use the following commands:\n\n```bash\ngit config --global credential.helper store\ngit credential store --add --server https://github.com --username your-username --password your-password\n```\n\n**Step 2: Configure Git to use credential store**\n\nTo configure Git to use the credential store, you can run the following command:\n\n```bash\ngit config --global credential.helper store\n```\n\n**Step 3: Add your credentials to the credential store**\n\nTo add your credentials to the credential store, you can run the following command:\n\n```bash\ngit credential store --add --server https://github.com --username your-username --password your-password\n```\n\nReplace `your-username` and `your-password` with your", "metrics": { "length": 1198, "commands": 6, "command_list": [ "sudo apt-get update", "sudo apt-get install git-credential-store", "git config --global credential.helper store", "git credential store --add --server https://github.com --username your-username --password your-password", "git config --global credential.helper store" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 3, "lesson_hit_rate": 0.6 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Git Push Force-With-Lease — Detached HEAD Recovery After Hash Change (git-force-with-lease-detached-head)", "condition": "with_lesson", "status": 200, "content": "To fix the error \"Git Push Force-With-Lease — Detached HEAD Recovery After Hash Change\" (git-force-with-lease-detached-head), you need to use `git push --force-with-lease` instead of `git push --force`. This command checks that the remote ref is still at the commit you expect before overwriting.\n\nHere are the exact steps to follow:\n\n1. First, pull the latest changes from the remote repository to ensure you have the most up-to-date information.\n\n```bash\ngit pull origin feat/foo\n```\n\n2. Then, force-push your changes using `git push --force-with-lease`.\n\n```bash\ngit push --force-with-lease origin feat/foo\n```\n\nBy using `--force-with-lease`, Git will check that the remote ref is still at the commit you expect before overwriting it. If someone else has pushed in the meantime, Git will reject the push with an error message.\n\nNote that if you're using a Git version older than 2.24, you won't have the `--force-with-lease` option. In that case, you can use `--force` with the `--no-verify` option to achieve similar behavior:\n\n```bash\ngit push origin feat/foo --", "metrics": { "length": 1067, "commands": 2, "command_list": [ "git pull origin feat/foo", "git push --force-with-lease origin feat/foo" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Git Push Force-With-Lease — Detached HEAD Recovery After Hash Change (git-force-with-lease-detached-head)", "condition": "plain", "status": 200, "content": "The error \"Git Push Force-With-Lease — Detached HEAD Recovery After Hash Change (git-force-with-lease-detached-head)\" occurs when you try to push a detached HEAD to a remote repository using the `--force-with-lease` option. This option is used to prevent accidental overwrites of remote branches.\n\nHere's a step-by-step fix:\n\n**Step 1: Identify the detached HEAD**\n\nFirst, check if your HEAD is detached:\n```bash\ngit status\n```\nThis will show you the current state of your repository. If your HEAD is detached, it should indicate that you're working on a new branch or have made changes to the current branch without checking out a new branch.\n\n**Step 2: Reset your HEAD to a valid branch**\n\nReset your HEAD to a valid branch, such as the master branch:\n```bash\ngit checkout master\n```\nAlternatively, you can reset your HEAD to the previous commit:\n```bash\ngit reset --hard HEAD~1\n```\nThis will move your HEAD to the previous commit, which should be a valid branch.\n\n**Step 3: Force-push your changes (if necessary)**\n\nIf you've made changes to your repository and want to push them to the remote repository, you'll need to", "metrics": { "length": 1123, "commands": 3, "command_list": [ "git status", "git checkout master", "git reset --hard HEAD~1" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 5, "lesson_hit_rate": 0.833 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Git 合并ConflictHandling — 手动解决最佳实践 (git-merge-conflict-resolution)", "condition": "with_lesson", "status": 200, "content": "解决 Git 合并冲突时的最佳实践如下:\n\n**步骤 1:查看冲突文件**\n\n```bash\ngit status\n```\n\n**步骤 2:查看冲突的具体差异**\n\n```bash\ngit diff\n```\n\n**步骤 3:选择解决方法**\n\n### 3a. 快捷方式:直接选择某一方的完整版本\n\n```bash\ngit checkout --ours src/config.py\n```\n\n或\n\n```bash\ngit checkout --theirs src/config.py\n```\n\n这将保留当前分支(HEAD)的版本或合并进来的分支的版本。\n\n### 3b. 推荐方式:手动编辑,精确合并双方改动\n\n1. 打开编辑器,找到 <<<<<<< 标记。\n2. 手动决定最终内容。\n3. 删除 <<<<<<<、=======、>>>= 三行标记。\n4. 保存编辑。\n\n**步骤 4:确认文件中已无残留冲突标记**\n\n```bash\ngrep -rn \"<<<<<<\" src/\n```\n\n**步骤 5:标记为已解决**\n\n```bash\ngit add src/config.py\n", "metrics": { "length": 494, "commands": 5, "command_list": [ "git status", "git diff", "git checkout --ours src/config.py", "git checkout --theirs src/config.py", "grep -rn \"<<<<<<\" src/" ], "has_command_block": true, "actionable": false, "inline_code_count": 10, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Git 合并ConflictHandling — 手动解决最佳实践 (git-merge-conflict-resolution)", "condition": "plain", "status": 200, "content": "Git 合并 ConflictHandling 是一个常见的错误,下面是如何手动解决它的最佳实践:\n\n1. **停止工作**:使用 `git checkout --theirs` 或 `git checkout --ours` 来停止工作并保留一个版本。\n\n ```bash\ngit checkout --theirs <文件名>\n```\n\n 或者\n\n ```bash\ngit checkout --ours <文件名>\n```\n\n2. **手动修改**:打开 conflicts.txt 文件并手动修改它。\n\n 例如:\n\n ```markdown\n# conflicts.txt\n<<<<<<< HEAD\n\n=======\n\n\n>>>>>>> current-branch-name\n```\n\n 例如:\n\n ```markdown\n# conflicts.txt\n<<<<<<< HEAD\n\n<<<<<<< HEAD\n\n>>>>>>> current-branch-name\n```\n\n3. **保存并提交**:使用 `git add` 和 `git commit` 来保存并提交修改。\n\n ```bash\ngit add .\ngit commit -m \"手动解决合并冲突\"\n```\n\n4. **合并**:使用 `git merge` 来合并两个分支。\n\n ", "metrics": { "length": 775, "commands": 4, "command_list": [ "git checkout --theirs <文件名>", "git checkout --ours <文件名>", "例如:", "3. **保存并提交**:使用 `git add` 和 `git commit` 来保存并提交修改。" ], "has_command_block": true, "actionable": false, "inline_code_count": 14, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "GitHub TLS 握手失败 — gnutls_handshake() Error (git-tls-handshake-failure)", "condition": "plain", "status": 200, "content": "The error you're experiencing, \"git-tls-handshake-failure,\" typically occurs when there's a problem with the TLS handshake between your Git client and the remote repository. Here's a step-by-step guide to resolve the issue:\n\n**Method 1: Update Git and GnuTLS**\n\n1. **Update Git**: Run the following command to ensure you have the latest version of Git installed.\n\n ```bash\ngit --version\n```\n\n If you're not on the latest version, update Git using the following command.\n\n ```bash\nsudo apt update && sudo apt install git -y\n```\n\n (For macOS users, use Homebrew to update Git.)\n\n ```bash\nbrew update && brew upgrade git\n```\n\n2. **Update GnuTLS**: GnuTLS is a dependency for Git. Run the following command to update GnuTLS.\n\n ```bash\nsudo apt update && sudo apt install libgnutls28-dev -y\n```\n\n (For macOS users, use Homebrew to update GnuTLS.)\n\n ```bash\nbrew update && brew install gnustl\n```\n\n**Method 2: Remove and Reinstall Git**\n\n1. **Remove Git**: Run the following command to remove Git", "metrics": { "length": 1017, "commands": 5, "command_list": [ "git --version", "sudo apt update && sudo apt install git -y", "brew update && brew upgrade git", "sudo apt update && sudo apt install libgnutls28-dev -y", "brew update && brew install gnustl" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "GitHub TLS 握手失败 — gnutls_handshake() Error (git-tls-handshake-failure)", "condition": "with_lesson", "status": 200, "content": "解决 GitHub TLS 握手失败 — gnutls_handshake() Error 的方法如下:\n\n### 步骤 1:重试(排除瞬时抖动)\n\n```bash\ngit pull origin main\n```\n\n### 步骤 2:检查并配置代理\n\n#### 1.查看当前 git 代理设置\n\n```bash\ngit config --global --list | grep proxy\n```\n\n#### 2.配置 git 走代理(如果使用代理)\n\n```bash\ngit config --global http.proxy http://127.0.0.1:7890\ngit config --global https.proxy http://127.0.0.1:7890\n```\n\n#### 3.清除错误的代理配置(如果不需要代理)\n\n```bash\ngit config --global --unset http.proxy\ngit config --global --unset https.proxy\n```\n\n### 步骤 3:更新 CA 证书\n\n#### 1. Debian / Ubuntu\n\n```bash\nsudo apt update && sudo apt install --reinstall ca-certificates\n```\n\n#### 2. RHEL / CentOS / Fedora\n\n```bash\nsudo update-ca-trust\n```\n\n### 步骤 4:切换", "metrics": { "length": 666, "commands": 8, "command_list": [ "git pull origin main", "git config --global --list | grep proxy", "git config --global http.proxy http://127.0.0.1:7890", "git config --global https.proxy http://127.0.0.1:7890", "git config --global --unset http.proxy" ], "has_command_block": true, "actionable": false, "inline_code_count": 11, "lesson_hits": 2, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "GitGuardian 误报 Basic Auth String:教程里凭证占位符必须用尖括号,不写完整 user:pass@host (gitguardian-placeholder-url-credential-safe-form)", "condition": "plain", "status": 200, "content": "The error message is indicating that the placeholder for the Basic Auth credentials in your GitGuardian configuration is not properly formatted. The fix is to replace the placeholder with the correct syntax, which includes the `@` symbol.\n\nHere's a step-by-step guide to resolve the issue:\n\n1. Open your GitGuardian configuration file in a text editor. The file name may vary depending on your setup, but it's usually `gitguardian.yml` or `gitguardian.json`.\n\n2. Locate the section related to Basic Auth credentials. It should look something like this:\n\n```yml\nbasic_auth:\n username: user\n password: pass\n host: host\n```\n\n3. Replace the placeholder with the correct syntax:\n\n```yml\nbasic_auth:\n username: user\n password: pass\n host: user:pass@host\n```\n\nOr, if you prefer to use the credential-safe-form:\n\n```yml\nbasic_auth:\n username: user\n password: pass\n host: gitguardian-placeholder-url-credential-safe-form\n```\n\n4. Save the changes to the configuration file.\n\nAfter making these changes, GitGuardian should be able to properly parse the Basic Auth credentials from your configuration file.\n\nIf you", "metrics": { "length": 1111, "commands": 2, "command_list": [ "3. Replace the placeholder with the correct syntax:", "Or, if you prefer to use the credential-safe-form:" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "GitGuardian 误报 Basic Auth String:教程里凭证占位符必须用尖括号,不写完整 user:pass@host (gitguardian-placeholder-url-credential-safe-form)", "condition": "with_lesson", "status": 200, "content": "To fix this issue, you'll need to update your GitGuardian configuration and lessons.json files. Here are the steps:\n\n**Step 1: Update lessons.json**\n\nOpen your lessons.json file and search for the `preview` field. Replace any occurrences of the following pattern:\n\n```json\n\"preview\": \"git push https://username:TOKEN@github.com/owner/repo.git\"\n```\n\nwith the following pattern:\n\n```json\n\"preview\": \"git push https://\npassword: bin/downloads/large-file\n\n# 生成 .version 标记文件\necho $(date +%Y-%m-%d-%H-%M-%S) > .version\n\n# 分段下载\nfor i in {0..5}; do\n start=$((i * 10485760))\n end=$(( (i + 1) * 10485760 - 1 ))\n curl -C - -R -o \"segment_$i\" \\\n \"https://ghproxy.net/https://github.com/owner/repo/releases/download/v1.0/large-file\" \\\n -H \"Range: bytes=$start-$end\" \\\n --retry 3 --retry-delay 5 &\ndone\n\n# 等待所有下载完成\nwait\n\n# 合并分段\ncat bin/downloads/segment_*. > bin/downloads/large-file\n\n# 校验\nsha256sum -c", "metrics": { "length": 668, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "GitHub Release 大文件下载在 CN 网络超时:分段并行下载方案 (github-release-large-asset-download-cn)", "condition": "plain", "status": 200, "content": "The error message you're encountering is due to the GitHub release large asset download being timed out when downloading on Chinese networks. Here's a concrete, actionable fix:\n\n**Solution:**\n\n1. **Use a VPN:** Install a VPN (Virtual Private Network) on your device. A VPN will mask your IP address and make it appear as if you're accessing the internet from a different location. This can help bypass the network restrictions imposed by your ISP (Internet Service Provider) on Chinese networks.\n\n * For Windows: Download and install TunnelBear VPN. Create an account, then install the app and set it to connect automatically when you start your computer.\n * For macOS: Download and install ExpressVPN. Create an account, then install the app and set it to connect automatically when you start your computer.\n * For Linux: Download and install NordVPN. Create an account, then install the app and set it to connect automatically when you start your computer.\n\n2. **Use a proxy server:** Another alternative is to use a proxy server to bypass the network restrictions imposed by your ISP on Chinese networks.\n\n * For Windows: Download and install the \"Free Proxy\" software. Create an account, then install the software and set it to connect automatically", "metrics": { "length": 1275, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 1, "lesson_hit_rate": 0.167 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "GitHub sudo email OTP fails when the wrong input is filled (github-sudo-email-otp-wrong-input-field)", "condition": "plain", "status": 200, "content": "The error you're experiencing is likely due to the incorrect input in the GitHub sudo email OTP field. Here's a step-by-step guide to resolve the issue:\n\n**Step 1: Clear the OTP field**\n\nRun the following command in your terminal:\n```bash\necho -e \"\\033[2J\\033[H\" # Clear the terminal screen\n```\nThis will clear the OTP field.\n\n**Step 2: Re-enter the OTP**\n\nEnter the correct OTP code when prompted.\n\n**Step 3: Verify the OTP**\n\nIf you're still having trouble, you can try re-entering the OTP manually:\n```bash\ngit config --global user.password \n```\nReplace `` with your actual GitHub username.\n\n**Step 4: Add the OTP to the Git config**\n\nRun the following command to add the OTP to the Git config:\n```bash\ngit config --global user.password \"\"\n```\nReplace `` with the correct OTP code.\n\n**Step 5: Update the Git config**\n\nRun the following command to update the Git config:\n```bash\ngit config --global --list\n```\nThis will display the updated Git config.\n\n**Troubleshooting**\n\nIf you", "metrics": { "length": 1043, "commands": 4, "command_list": [ "echo -e \"\\033[2J\\033[H\" # Clear the terminal screen", "git config --global user.password ", "git config --global user.password \"\"", "git config --global --list" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "GitHub sudo email OTP fails when the wrong input is filled (github-sudo-email-otp-wrong-input-field)", "condition": "with_lesson", "status": 200, "content": "The issue you're facing is due to the hidden input fields on the GitHub sudo email verification page. To fix this, you need to target the hidden input fields specifically. Here's a concrete, actionable fix with exact commands using Playwright:\n\n```javascript\nconst playwright = require('playwright');\n\n(async () => {\n const browser = await playwright.chromium.launch();\n const page = await browser.newPage();\n\n // Navigate to the GitHub sudo email verification page\n await page.goto('https://github.com/login');\n\n // Click Verify via email\n await page.click('text=Verify via email');\n\n // Wait for the OTP code to be displayed\n await page.waitForSelector('#email-otp');\n\n // Get the OTP code from Gmail\n const otpCode = await page.$eval('#email-otp', (el) => el.textContent());\n\n // Fill the hidden input fields for CSRF and credential type\n await page.fill('#sudo-credential-options-github-mobile-csrf', '');\n await page.fill('#sudo-credential-options-totp-email-csrf', '');\n await page.fill('#authenticity_token', '');\n await page.fill('#sudo_return_to', '');\n await page.fill('#credential_type', '');\n\n // Fill the visible OTP", "metrics": { "length": 1146, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 3, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Glama MCP Server Deployment — 10 Build Failures and Fixes (glama-mcp-server-deploy-lessons)", "condition": "with_lesson", "status": 200, "content": "To fix the 10 build failures and fixes, you can follow these concrete, actionable steps:\n\n**Step 1: Use uv pip install instead of pip install**\n\n Replace `pip install` with `uv pip install` in your `setup.py` file.\n\n```python\n# Before\npip install -r requirements.txt\n\n# After\nuv pip install -r requirements.txt\n```\n\n**Step 2: Create a virtual environment using uv venv**\n\n Run the following command before installing dependencies:\n\n```bash\nuv venv myenv\n```\n\nThen, activate the virtual environment:\n\n```bash\nuv venv myenv/bin/activate\n```\n\n**Step 3: Don't use --system flag**\n\n Replace `pip install --system` with `pip install` in your `setup.py` file.\n\n```python\n# Before\npip install --system -r requirements.txt\n\n# After\npip install -r requirements.txt\n```\n\n**Step 4: Install the package using uv pip install -e .**\n\n Run the following command in your project directory:\n\n```bash\nuv pip install -e .\n```\n\nThis will install the package and its dependencies.\n\n**Additional Steps**\n\nAfter making these changes, you can re-deploy your Python MCP server to Gl", "metrics": { "length": 1056, "commands": 7, "command_list": [ "**Step 2: Create a virtual environment using uv venv**", "Run the following command before installing dependencies:", "Then, activate the virtual environment:", "**Step 3: Don't use --system flag**", "Replace `pip install --system` with `pip install` in your `setup.py` file." ], "has_command_block": true, "actionable": true, "inline_code_count": 15, "lesson_hits": 1, "lesson_hit_rate": 0.167 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Go Scheduler Deadlock — Nested Lock Acquisition in gocron v1 (go-scheduler-deadlock-lock-order)", "condition": "with_lesson", "status": 200, "content": "To fix the deadlock issue, we need to ensure that the locks are released in the correct order. Here's the corrected code:\n\n```go\n// Original (fixed) code:\nfunc (s Scheduler) RemoveByID(job Job) error {\n // Release RLock before acquiring LLock\n s.jobsMutex.RUnlock()\n s.jobsMutex.Lock()\n defer s.jobsMutex.Unlock() // Lock held through entire function\n if _, ok := s.jobs[job.id]; ok {\n s.stopJob(job) // no longer holding jobsMutex.Lock!\n delete(s.jobs, job.id)\n return nil\n }\n return ErrJobNotFound\n}\n\nfunc (s Scheduler) runJobs() {\n // Release LLock before acquiring RLock\n s.jobsMutex.Unlock()\n s.jobsMutex.RLock()\n defer s.jobsMutex.RUnlock()\n for _, job := range s.jobs {\n // send job to executor...\n s.runContinuous(job)\n }\n}\n```\n\nIn the `RemoveByID` method, we first release the `RLock` using `s.jobsMutex.RUnlock()` before acquiring the `LLock` using `s.jobsMutex.Lock()`. This ensures that the `RLock` is released before the `LLock", "metrics": { "length": 1024, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 8, "lesson_hits": 2, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Glama MCP Server Deployment — 10 Build Failures and Fixes (glama-mcp-server-deploy-lessons)", "condition": "plain", "status": 200, "content": "The error \"Glama MCP Server Deployment — 10 Build Failures and Fixes\" typically occurs when the deployment of the Glama MCP server fails due to various reasons such as configuration issues, missing dependencies, or incorrect settings. Here's a step-by-step guide to fix this issue:\n\n**Prerequisites:**\n\n* Ensure you have a clean and updated environment.\n* Make sure you have the latest version of the Glama MCP server and its dependencies.\n\n**Step 1: Check the Glama MCP Server Logs**\n\nTo identify the root cause of the issue, check the Glama MCP server logs for any errors or warnings:\n```bash\n# Navigate to the Glama MCP server logs directory\ncd /path/to/glama-mcp-server-logs\n\n# Check the latest log file for errors\ntail -f log.txt\n```\nThis will show you the latest log entries, which can help you identify the issue.\n\n**Step 2: Update the Glama MCP Server**\n\nEnsure you have the latest version of the Glama MCP server installed:\n```bash\n# Update the Glama MCP server package\nsudo apt-get update\nsudo apt-get upgrade -y glama-mcp-server\n```\n**Step 3: Check for Missing Dependencies**\n\nVerify that all required", "metrics": { "length": 1112, "commands": 4, "command_list": [ "cd /path/to/glama-mcp-server-logs", "tail -f log.txt", "sudo apt-get update", "sudo apt-get upgrade -y glama-mcp-server" ], "has_command_block": true, "actionable": false, "inline_code_count": 3, "lesson_hits": 1, "lesson_hit_rate": 0.167 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Go Scheduler Deadlock — Nested Lock Acquisition in gocron v1 (go-scheduler-deadlock-lock-order)", "condition": "plain", "status": 200, "content": "The \"Go Scheduler Deadlock — Nested Lock Acquisition\" error is typically caused by a deadlock situation in the Go scheduler. This error is usually a result of the way the scheduler handles goroutines and locks.\n\nHere's a concrete, actionable fix with exact commands to resolve the issue:\n\n**Step 1: Update gocron to the latest version**\n\nFirst, update gocron to the latest version using the following command:\n\n```bash\ngo get -u github.com/jroimartin/gocron\n```\n\n**Step 2: Update gocron to use the new lock order**\n\nThe new lock order in gocron v1 is designed to prevent deadlocks. To update gocron to use the new lock order, you need to update the `gocron.conf` file. Here's an example of how to do it:\n\n```bash\n# Create a new file called gocron.conf\necho \"schedule: 0 0 * * *\" > gocron.conf\n```\n\nThen, update the `gocron.conf` file to use the new lock order by adding the following lines:\n\n```bash\nlock:\n - main\n - job\n```\n\n**Step 3: Update the cron job to use the", "metrics": { "length": 968, "commands": 5, "command_list": [ "go get -u github.com/jroimartin/gocron", "echo \"schedule: 0 0 * * *\" > gocron.conf", "lock:", "- main", "- job" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 1, "lesson_hit_rate": 0.167 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "GitHub Contribution Heartbeat Scan (heartbeat-scan-improvement)", "condition": "with_lesson", "status": 200, "content": "To fix the error, you need to modify your GitHub Heartbeat Scan script to include the three required scans: opened PRs, claimed issues, and closed PRs. Here's an example of how you can modify your script:\n\n```bash\n#!/bin/bash\n\n# Set your GitHub username and token\nUSER=\"your-username\"\nTOKEN=\"your-github-token\"\n\n# Set the date for the closed PR scan (YYYY-MM-DD)\nCLOSED_PR_DATE=\"2023-03-01\"\n\n# Run the three scans\ngh search prs --author=$USER --state=open --limit=30\ngh search issues --involves=$USER --state=open --updated=$CLOSED_PR_DATE --limit=20\ngh search prs --author=$USER --state=closed --sort=updated --limit=10\n```\n\nMake sure to replace `your-username` and `your-github-token` with your actual GitHub username and token.\n\nIf you're using a script, you can also add some error handling to ensure that all three scans are successful:\n\n```bash\n#!/bin/bash\n\n# Set your GitHub username and token\nUSER=\"your-username\"\nTOKEN=\"your-github-token\"\n\n# Set the date for the closed PR scan (YYYY-MM", "metrics": { "length": 995, "commands": 6, "command_list": [ "USER=\"your-username\"", "TOKEN=\"your-github-token\"", "CLOSED_PR_DATE=\"2023-03-01\"", "gh search prs --author=$USER --state=open --limit=30", "gh search issues --involves=$USER --state=open --updated=$CLOSED_PR_DATE --limit=20" ], "has_command_block": true, "actionable": true, "inline_code_count": 4, "lesson_hits": 4, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "GitHub Contribution Heartbeat Scan (heartbeat-scan-improvement)", "condition": "plain", "status": 200, "content": "To fix the GitHub Contribution Heartbeat Scan error, you'll need to update your `package.json` file to include the required `github-contribution-heartbeat` version. Here's a step-by-step solution:\n\n**Step 1: Install the required package**\n\nOpen your terminal and navigate to your project directory. Run the following command to install the required package:\n\n```bash\nnpm install github-contribution-heartbeat@latest\n```\n\nor if you're using yarn:\n\n```bash\nyarn add github-contribution-heartbeat@latest\n```\n\n**Step 2: Update the `package.json` file**\n\nOpen your `package.json` file in a text editor. Look for the `dependencies` or `devDependencies` section, which should contain the `github-contribution-heartbeat` package. Update the version number to `@latest`, which will install the latest version of the package.\n\nHere's an example of what the updated `package.json` file might look like:\n\n```json\n{\n \"name\": \"your-project-name\",\n \"version\": \"1.0.0\",\n \"description\": \"Your project description\",\n \"main\": \"index.js\",\n \"scripts\": {\n \"start\": \"node index.js\"\n },\n \"", "metrics": { "length": 1075, "commands": 2, "command_list": [ "npm install github-contribution-heartbeat@latest", "yarn add github-contribution-heartbeat@latest" ], "has_command_block": true, "actionable": true, "inline_code_count": 13, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Hub Hermes 凭证体系 — Gateway vs Hub 各自读哪里 (hub-credential-gateway-vs-hub)", "condition": "plain", "status": 200, "content": "The error message you're encountering is likely due to a configuration issue with the Hub Hermes credential system. The error is suggesting that there's a difference between the gateway and hub credential systems.\n\nTo resolve this issue, you can try the following steps:\n\n1. Check the Hub Hermes configuration:\n - Open a terminal and navigate to the directory where your Hub Hermes configuration file is located.\n - Run the following command to check the configuration:\n ```bash\nhub config\n```\n This will display the current configuration of your Hub Hermes system.\n\n2. Check the credential system configuration:\n - Run the following command to check the credential system configuration:\n ```bash\nhub credential config\n```\n This will display the current configuration of your credential system.\n\n3. Check the gateway and hub configurations:\n - Run the following command to check the gateway configuration:\n ```bash\nhub gateway config\n```\n - Run the following command to check the hub configuration:\n ```bash\nhub hub config\n```\n These commands will display the current configuration of your gateway and hub systems.\n\n4. Update the configuration:\n - If you find any discrepancies between the gateway and hub configurations, you can update the configuration using the following command:\n ```bash\nhub config", "metrics": { "length": 1341, "commands": 4, "command_list": [ "hub config", "hub credential config", "hub gateway config", "hub hub config" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 3, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Hub Hermes 凭证体系 — Gateway vs Hub 各自读哪里 (hub-credential-gateway-vs-hub)", "condition": "with_lesson", "status": 200, "content": "To fix the error, you need to set the `FEISHU_APP_SECRET` environment variable in the Hub configuration. Here are the steps:\n\n1. Open your terminal and navigate to the directory where your `config.yaml` file is located.\n2. Run the following command to set the `FEISHU_APP_SECRET` environment variable:\n ```bash\nexport FEISHU_APP_SECRET=\n```\n Replace `` with your actual Feishu App Secret.\n\n3. Update the `config.yaml` file by adding the following lines:\n ```yaml\nfeishu:\n app_id: \"\"\n app_secret: \"\"\n webhook_url: \"\"\nmaster:\n shared_secret: \"\"\n```\n Replace the placeholders with your actual Feishu App ID, App Secret, Webhook URL, and Shared Secret.\n\n4. Run the following command to verify that the configuration is correct:\n ```bash\nfeishu:\necho \"Verification passed: fix command exited 0\"\n```\n This command should complete without error, and then print \"Verification passed: fix command exited 0\".\n\nHere's the complete command sequence:\n\n```bash", "metrics": { "length": 1050, "commands": 5, "command_list": [ "export FEISHU_APP_SECRET=", "Replace the placeholders with your actual Feishu App ID, App Secret, Webhook URL, and Shared Secret.", "4. Run the following command to verify that the configuration is correct:", "This command should complete without error, and then print \"Verification passed: fix command exited 0\".", "Here's the complete command sequence:" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 5, "lesson_hit_rate": 0.833 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "hub feishu wsclient start never called (hub-feishu-wsclient-start-never-called)", "condition": "with_lesson", "status": 200, "content": "To fix the error \"hub feishu wsclient start never called (hub-feishu-wsclient-start-never-called)\", you need to add the following line of code to your `hermes_hub.py` file in the `start()` method:\n\n```python\nawait self.feishu_ws_client.start()\n```\n\nHere's how you can do it:\n\n1. Open your `hermes_hub.py` file in a text editor.\n2. Locate the `start()` method.\n3. Add the following line of code after `await self._register_handlers()`:\n\n```python\nawait self.feishu_ws_client.start()\n```\n\nHere's what the updated `start()` method should look like:\n\n```python\nasync def start(self):\n await self._load_config()\n await self._init_storage()\n await self._init_feishu_client()\n await self._init_vector_store()\n await self.feishu_ws_client.start()\n await self._register_handlers()\n self._start_background_tasks()\n```\n\nAfter making this change, save the file and run your hub again. The error should be resolved, and your hub should now establish a WebSocket connection with Feishu.", "metrics": { "length": 993, "commands": 5, "command_list": [ "Here's how you can do it:", "1. Open your `hermes_hub.py` file in a text editor.", "2. Locate the `start()` method.", "3. Add the following line of code after `await self._register_handlers()`:", "Here's what the updated `start()` method should look like:" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 5, "lesson_hit_rate": 0.833 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "hub feishu wsclient start never called (hub-feishu-wsclient-start-never-called)", "condition": "plain", "status": 200, "content": "The error \"hub-feishu wsclient start never called\" typically indicates that the Feishu Websocket Client is not being started. This can be due to various reasons such as the client not being installed, or the client not being configured correctly.\n\nTo fix this issue, you can try the following steps:\n\n1. **Check if the Feishu Websocket Client is installed:**\n\n Run the following command to check if the Feishu Websocket Client is installed:\n ```bash\npip show hub-feishu-wsclient\n```\n If the client is not installed, run the following command to install it:\n ```bash\npip install hub-feishu-wsclient\n```\n\n2. **Check the configuration file:**\n\n The Feishu Websocket Client uses a configuration file to store its settings. The default configuration file is `~/.feishu/config.json`. Check if the configuration file is present and if it contains the required settings.\n\n If the configuration file is not present, create a new one using the following command:\n ```bash\nhub-feishu config create\n```\n Then, edit the configuration file using the following command:\n ```bash\nhub-feishu config edit\n```\n\n", "metrics": { "length": 1110, "commands": 4, "command_list": [ "pip show hub-feishu-wsclient", "pip install hub-feishu-wsclient", "hub-feishu config create", "hub-feishu config edit" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Auto-Welcome Newcomers via issue_comment Event (issue-comment-newbie-welcome)", "condition": "with_lesson", "status": 200, "content": "To fix the error, you need to update the GitHub Actions workflow file (e.g., `.yml` file) to use the `github-script` action with the correct script and permissions.\n\nHere's the updated code:\n\n```yml\nname: Newbie Welcome\non:\n issue_comment:\n types: [created]\n\npermissions:\n issues: write\n pull-requests: read\n\njobs:\n welcome:\n if: |\n !github.event.issue.pull_request &&\n contains(github.event.issue.labels..name, 'good first issue') &&\n !contains(fromJSON('[\"MEMBER\", \"OWNER\", \"COLLABORATOR\"]'), github.event.comment.author_association)\n runs-on: ubuntu-latest\n steps:\n - name: Welcome Newcomer\n uses: actions/github-script@v7\n with:\n script: |\n const body = 'Welcome to MisakaNet!';\n\n You're commenting on a Good First Issue.\n\n 1. Read the CONTRIBUTING.md guide\n 2. Claim by commenting \\/claim\\ — 8h exclusive window\n 3. Implement with \\git commit -s\\\n 4. Submit a PR — CI audits automatically;\n\n await github", "metrics": { "length": 1045, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 2, "lesson_hits": 1, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Auto-Welcome Newcomers via issue_comment Event (issue-comment-newbie-welcome)", "condition": "plain", "status": 200, "content": "To fix the error \"Auto-Welcome Newcomers via issue_comment Event (issue-comment-newbie-welcome)\", you'll need to create a new event listener that listens for the `issue_comment` event and sends a welcome message to the new user. Here's a step-by-step guide:\n\n**Step 1: Create a new event listener**\n\nIn your repository's `.gitignore` file, add the following line to ignore the `issue_comment_newbie_welcome` event listener:\n```bash\nissue-comment-newbie-welcome\n```\n**Step 2: Create a new event listener file**\n\nRun the following command to create a new file for the event listener:\n```bash\nmkdir issue-comment-newbie-welcome\ntouch issue-comment-newbie-welcome.js\n```\n**Step 3: Add the event listener code**\n\nIn the `issue-comment-newbie-welcome.js` file, add the following code:\n```javascript\nconst { Octokit } = require('@octokit/octokit');\n\nconst octokit = new Octokit({\n baseUrl: 'https://api.github.com',\n accessToken: 'YOUR_GITHUB_TOKEN',\n});\n\nasync function welcomeNewcomer(comment) {\n const issue = await octokit.issues.getAll({ owner: 'YOUR_RE", "metrics": { "length": 1054, "commands": 3, "command_list": [ "issue-comment-newbie-welcome", "mkdir issue-comment-newbie-welcome", "touch issue-comment-newbie-welcome.js" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 1, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "同义词扩展陷阱:jieba.add_word() 改变全局分词行为导致回归 (jieba-synonym-expansion-pitfall)", "condition": "plain", "status": 200, "content": "The error you're encountering is due to the fact that `jieba.add_word()` modifies the global tokenizer behavior, which can lead to unexpected results. Here's a concrete, actionable fix:\n\n**Solution:**\n\nInstead of using `jieba.add_word()`, use `jieba.add_symbol()` to add custom symbols to your vocabulary.\n\n```python\nimport jieba\n\n# Create a new tokenizer\ntokenizer = jieba.Jieba()\n\n# Add custom symbols to the tokenizer\ntokenizer.add_symbol('custom_symbol')\n\n# Use the tokenizer to perform tokenization\ntext = \"This is a custom symbol test\"\ntokens = tokenizer.cut(text)\n\nprint(tokens)\n```\n\n**Explanation:**\n\n* We create a new tokenizer instance using `jieba.Jieba()`.\n* We add a custom symbol to the tokenizer using `tokenizer.add_symbol('custom_symbol')`.\n* We use the tokenizer to perform tokenization on a sample text.\n* The resulting tokens are printed to the console.\n\n**Note:** If you want to add multiple custom symbols, you can call `add_symbol()` multiple times.\n\n```python\ntokenizer.add_symbol('custom_symbol1')\ntokenizer.add_symbol('custom_symbol2')\n```\n\nBy using `add_symbol()` instead of `add_word", "metrics": { "length": 1119, "commands": 6, "command_list": [ "**Explanation:**", "* We create a new tokenizer instance using `jieba.Jieba()`.", "* We add a custom symbol to the tokenizer using `tokenizer.add_symbol('custom_symbol')`.", "* We use the tokenizer to perform tokenization on a sample text.", "* The resulting tokens are printed to the console." ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 1, "lesson_hit_rate": 0.167 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "同义词扩展陷阱:jieba.add_word() 改变全局分词行为导致回归 (jieba-synonym-expansion-pitfall)", "condition": "with_lesson", "status": 200, "content": "To fix the issue, you can create a separate JSON file to store the synonyms and use it to expand the queries. Here's how you can do it:\n\nFirst, create a new file called `synonyms.json` in the same directory as your Python script:\n\n```json\n{\n \"手机\": [\"电话\", \"移动设备\", \"智能手机\"],\n \"电脑\": [\"计算机\", \"PC\", \"笔记本\"]\n}\n```\n\nNext, modify your Python script to use the `synonyms.json` file:\n\n```python\nimport json\nfrom jieba import Jieba\n\n# Load synonyms from JSON file\nwith open('synonyms.json', 'r', encoding='utf-8') as f:\n synonyms = json.load(f)\n\n# Initialize Jieba\njieba = Jieba()\n\ndef expand_query_with_synonyms(query, synonyms):\n expanded = [query]\n for word, syns in synonyms.items():\n if word in query:\n expanded.extend(syns)\n return expanded\n\ndef main():\n query = input(\"Enter a query: \")\n expanded_query = expand_query_with_synonyms(query, synonyms)\n print(\"Expanded query:\", expanded_query)\n\nif __name__ == \"__main__\":\n main", "metrics": { "length": 962, "commands": 1, "command_list": [ "Next, modify your Python script to use the `synonyms.json` file:" ], "has_command_block": true, "actionable": true, "inline_code_count": 4, "lesson_hits": 5, "lesson_hit_rate": 0.833 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "JSON 解析失败Handling — 截断 / 格式Error (json-parse-failure-handling)", "condition": "with_lesson", "status": 200, "content": "To fix the `JSON 解析失败Handling — 截断 / 格式Error` issue, you can try the following steps:\n\n### Step 1: Update the `model_output` variable\n\nMake sure the `model_output` variable contains the complete and formatted JSON data. If the output is truncated, you can try to get the full output from the model or API.\n\n```bash\n# Get the full output from the model or API\nmodel_output=$(model_output)\n```\n\n### Step 2: Use the `safe_json_parse` function\n\nReplace the original code with the `safe_json_parse` function:\n\n```python\nimport json\nimport re\n\ndef safe_json_parse(text: str) -> dict | None:\n \"\"\"尝试多种策略解析 JSON\"\"\"\n \n try:\n return json.loads(text)\n except json.JSONDecodeError:\n pass\n \n m = re.search(r'(?:json)?\\s\\n?(.?)\\n?', text, re.DOTALL)\n if m:\n try:\n return json.loads(m.group(1))\n except json.JSONDecodeError:\n pass\n \n m = re.search(r'(\\{.\\})', text, re.DOTALL)\n if m:\n ", "metrics": { "length": 955, "commands": 1, "command_list": [ "model_output=$(model_output)" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 5, "lesson_hit_rate": 0.833 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "JSON 解析失败Handling — 截断 / 格式Error (json-parse-failure-handling)", "condition": "plain", "status": 200, "content": "The error message \"JSON 解析失败Handling — 截断 / 格式Error (json-parse-failure-handling)\" is a translation of \"JSON parsing failed - Handling: Cutting / Format Error\" in English. This error typically occurs when there's an issue with the JSON data being parsed, such as a missing closing bracket or a mismatched quote.\n\nHere's a concrete, actionable fix with exact commands:\n\n**Method 1: Using `jq` command**\n\nIf you're using a Linux or macOS system, you can use the `jq` command to parse and fix the JSON data.\n\n1. Install `jq` if you haven't already: `sudo apt-get install jq` (for Ubuntu-based systems) or `brew install jq` (for macOS).\n2. Use `jq` to parse the JSON data and fix the errors:\n\n```bash\njq '.' your_json_file.json\n```\n\nThis command will print the parsed JSON data with any errors fixed.\n\n**Method 2: Using `jsonlint` command**\n\nAlternatively, you can use the `jsonlint` command to validate and fix the JSON data.\n\n1. Install `jsonlint` if you haven't already: `sudo apt-get install jsonlint` (for Ubuntu-based systems) or `", "metrics": { "length": 1033, "commands": 1, "command_list": [ "jq '.' your_json_file.json" ], "has_command_block": true, "actionable": true, "inline_code_count": 12, "lesson_hits": 1, "lesson_hit_rate": 0.167 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Knowledge Base 4-Sigma Quality Audit Pipeline (kb-4sigma-quality-audit-pipeline)", "condition": "with_lesson", "status": 200, "content": "To implement the 4σ quality audit pipeline, we'll use Python with the following libraries:\n\n- `pandas` for data manipulation\n- `os` for file system operations\n- `datetime` for timestamping\n- `json` for storing reports\n\nHere's a step-by-step guide to fix the issue:\n\n**Step 1: Install required libraries**\n\n```bash\npip install pandas os datetime json\n```\n\n**Step 2: Create a directory for audit reports**\n\n```bash\nmkdir ~/audit_reports\n```\n\n**Step 3: Create a Python script (daily_audit.py) for the quality audit pipeline**\n\n```python\nimport os\nimport pandas as pd\nimport datetime\nimport json\n\n# Define constants\nAUDIT_DIR = \"~/audit_reports\"\nREPORT_NAME = \"audit_\"\nCSV_FILE = \"daily_audit.csv\"\n\n# Function to clean up non-document content\ndef clean_document(content):\n # Remove garbled text, empty chunks, and numeric-only chunks\n content = content.replace(\"\\n\", \" \")\n content = content.replace(\"\\t\", \" \")\n content = content.replace(\" \", \"\")\n return content\n\n# Function to deduplicate documents by filename and import time\ndef deduplicate_documents(df):\n # Group by filename", "metrics": { "length": 1092, "commands": 2, "command_list": [ "pip install pandas os datetime json", "mkdir ~/audit_reports" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 1, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Knowledge Base 4-Sigma Quality Audit Pipeline (kb-4sigma-quality-audit-pipeline)", "condition": "plain", "status": 200, "content": "To fix the error, we'll assume that the error is related to a missing or incorrect configuration file for the Knowledge Base 4-Sigma Quality Audit Pipeline. Here's a step-by-step guide with exact commands to resolve the issue:\n\n**Step 1: Check the Pipeline Configuration**\n\n1. Navigate to the pipeline directory: `cd /path/to/kb-4sigma-quality-audit-pipeline`\n2. Run the following command to check the pipeline configuration: `kubectl get deployments -n -l app=kb-4sigma-quality-audit-pipeline`\n\nReplace `` with the actual namespace where your pipeline is running.\n\n**Step 2: Check for Missing Configuration Files**\n\n1. Run the following command to check for missing configuration files: `kubectl get configmaps -n -l app=kb-4sigma-quality-audit-pipeline`\n\nReplace `` with the actual namespace where your pipeline is running.\n\nIf you find any missing configuration files, you can create them using the following commands:\n\n```bash\nkubectl create configmap kb-4sigma-quality-audit-pipeline-config --from-file=KB4SIGMA Quality Audit Pipeline Configuration=kb-4sigma-quality-audit-pipeline.yaml\nkubectl create configmap kb-", "metrics": { "length": 1166, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 5, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "knowledge graph ux patterns from high star projects (knowledge-graph-ux-patterns-from-high-star-projects)", "condition": "with_lesson", "status": 200, "content": "To fix the error, you need to make sure that your knowledge graph visualization is properly handling the balance between global overview and local details. Here are some concrete, actionable steps with exact commands to help you achieve this:\n\n**Step 1: Implement Progressive Disclosure**\n\nAdd the following code to your JavaScript file to implement progressive disclosure:\n\n```javascript\n// Define a function to get the neighbors of a node\nfunction getNHopNeighbors(nodeId, hops, edges) {\n const visited = new Set([nodeId]);\n let frontier = [nodeId];\n for (let i = 0; i < hops; i++) {\n const next = new Set();\n frontier.forEach(id => {\n edges.forEach(edge => {\n const sid = edge.source?.id || edge.source;\n const tid = edge.target?.id || edge.target;\n if (sid === id && !visited.has(tid)) next.add(tid);\n if (tid === id && !visited.has(sid)) next.add(sid);\n });\n });\n frontier = [...next];\n }\n return visited;\n}\n\n// Define a function to get the category of a node\nfunction getCategory(node) {\n // Implement your logic to get the category of a node\n // For example, you can", "metrics": { "length": 1130, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 5, "lesson_hit_rate": 0.833 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "knowledge graph ux patterns from high star projects (knowledge-graph-ux-patterns-from-high-star-projects)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely due to a missing `requirements.txt` file or a version mismatch in your `setup.py` file. Here's a step-by-step guide to fixing the issue:\n\n**Step 1: Create a `requirements.txt` file**\n\nOpen a terminal and navigate to your project directory. Run the following command to generate a `requirements.txt` file:\n```bash\npip freeze > requirements.txt\n```\nThis command will list all the packages installed in your Python environment, including their versions.\n\n**Step 2: Update `setup.py`**\n\nIf your `setup.py` file is not present, create a new one with the following content:\n```python\nfrom setuptools import setup\n\nsetup(\n name='knowledge-graph-ux-patterns-from-high-star-projects',\n version='0.0.1',\n packages=['knowledge_graph_ux_patterns'],\n install_requires=[\n 'numpy',\n 'pandas',\n 'scikit-learn',\n # Add other dependencies here\n ],\n)\n```\nReplace `numpy`, `pandas`, and `scikit-learn` with the actual dependencies required by your project.\n\n**Step 3: Install dependencies**\n\nRun the following command to install the dependencies listed in `requirements.txt`", "metrics": { "length": 1137, "commands": 1, "command_list": [ "pip freeze > requirements.txt" ], "has_command_block": true, "actionable": true, "inline_code_count": 13, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Tips for Debugging Kubernetes CrashLoopBackOff in a Container (kubernetes-crashloopbackoff-debugging)", "condition": "with_lesson", "status": 200, "content": "To debug a Kubernetes CrashLoopBackOff issue, you need to identify the root cause. Based on the provided lesson, the two common problems when starting a container are:\n\n1. OCI runtime create failed: References a binary or script that doesn't exist on the container (Exit Code 127)\n2. Container \"Completed\" or \"Error\": The code executing on the container failed to run a service and stay running (Exit Code 1)\n\nHere's a concrete, actionable fix with exact commands:\n\n### Step 1: Identify Docker Entrypoint and Cmd\n\nSince you lack the Dockerfile, pull and inspect the image locally:\n\n```bash\n# Pull the Elasticsearch image\ndocker pull docker.elastic.co/elasticsearch/elasticsearch:7.10.2\n\n# Inspect the image and extract the Entrypoint and Cmd\ndocker inspect docker.elastic.co/elasticsearch/elasticsearch:7.10.2 | jq '.[0].ContainerConfig.Entrypoint'\ndocker inspect docker.elastic.co/elasticsearch/elasticsearch:7.10.2 | jq '.[0].ContainerConfig.Cmd'\n```\n\n### Step 2: Override Container Entrypoint for Debugging\n\nUpdate the deployment to replace the container entrypoint with `tail -f /dev/null`", "metrics": { "length": 1093, "commands": 3, "command_list": [ "docker pull docker.elastic.co/elasticsearch/elasticsearch:7.10.2", "docker inspect docker.elastic.co/elasticsearch/elasticsearch:7.10.2 | jq '.[0].ContainerConfig.Entrypoint'", "docker inspect docker.elastic.co/elasticsearch/elasticsearch:7.10.2 | jq '.[0].ContainerConfig.Cmd'" ], "has_command_block": true, "actionable": true, "inline_code_count": 2, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Ubuntu WSL Python venv Missing pip — uv venv --seed Fixes Without sudo (lesson-07-uv-venv-seed-fix-no-pip)", "condition": "with_lesson", "status": 200, "content": "The issue you're facing is due to the stripped Python package on Ubuntu WSL, which doesn't include pip by default. To fix this, you can use the following steps:\n\n**Step 1: Install `python3-pip`**\n\nSince `python3-pip` is not installed, you can install it using the following command:\n\n```bash\nsudo apt install python3-pip\n```\n\n**Step 2: Verify the installation**\n\nAfter installation, verify that pip is installed correctly by running:\n\n```bash\npython3 -m pip --version\n```\n\nYou should see the version of pip installed.\n\n**Step 3: Create a new virtual environment**\n\nNow that pip is installed, you can create a new virtual environment using the following command:\n\n```bash\npython3 -m venv ~/.agent-reach-venv\n```\n\n**Step 4: Activate the virtual environment**\n\nTo activate the virtual environment, run:\n\n```bash\nsource ~/.agent-reach-venv/bin/activate\n```\n\nYou should see the virtual environment name printed in your terminal, indicating that it's active.\n\nThat's it! You should now be able to use pip within your virtual environment.\n\nHere are the exact commands you can use:\n\n```bash\n#", "metrics": { "length": 1084, "commands": 4, "command_list": [ "sudo apt install python3-pip", "python3 -m pip --version", "python3 -m venv ~/.agent-reach-venv", "source ~/.agent-reach-venv/bin/activate" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Tips for Debugging Kubernetes CrashLoopBackOff in a Container (kubernetes-crashloopbackoff-debugging)", "condition": "plain", "status": 200, "content": "The \"CrashLoopBackOff\" error in Kubernetes occurs when a pod is repeatedly restarted due to a container crashing. Here's a concrete, actionable fix to debug and resolve this issue.\n\n**Step 1: Get the pod details**\n\nUse the following command to get the pod details:\n```bash\nkubectl get pod -o yaml\n```\nReplace `` with the actual name of the pod.\n\n**Step 2: Check the container logs**\n\nUse the following command to get the container logs:\n```bash\nkubectl logs -c \n```\nReplace `` with the actual name of the pod and `` with the actual name of the container that's crashing.\n\n**Step 3: Check the container restart policy**\n\nUse the following command to check the container restart policy:\n```bash\nkubectl get pod -o yaml | grep restartPolicy\n```\nThis will show you the restart policy of the pod.\n\n**Step 4: Check the pod's status**\n\nUse the following command to check the pod's status:\n```bash\nkubectl get pod -o yaml\n```\nThis will show you the pod's status, including any error messages", "metrics": { "length": 1079, "commands": 4, "command_list": [ "kubectl get pod -o yaml", "kubectl logs -c ", "kubectl get pod -o yaml | grep restartPolicy", "kubectl get pod -o yaml" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 2, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Ubuntu WSL Python venv Missing pip — uv venv --seed Fixes Without sudo (lesson-07-uv-venv-seed-fix-no-pip)", "condition": "plain", "status": 200, "content": "The error you're encountering is due to the Python version in your WSL (Windows Subsystem for Linux) environment not having a `pip` package. Here's a step-by-step solution to fix the issue:\n\n**Method 1: Update and Install pip using `python` command**\n\n1. Open your WSL terminal.\n2. Update the package list: `sudo apt update`\n3. Install the `python3` package (if not already installed): `sudo apt install python3`\n4. Install `pip` using the `python3` command: `python3 -m ensurepip`\n5. Verify that `pip` has been installed successfully: `pip3 --version`\n\n**Method 2: Install `pip` using `python3 -m venv`**\n\n1. Create a new virtual environment using `python3 -m venv`:\n ```bash\npython3 -m venv myenv\n```\n Replace `myenv` with the name of your choice.\n2. Activate the virtual environment:\n ```bash\nsource myenv/bin/activate\n```\n (On Ubuntu-based WSL, use `source myenv/bin/activate` instead of `myenv\\Scripts\\activate`)\n3. Install `pip", "metrics": { "length": 941, "commands": 2, "command_list": [ "python3 -m venv myenv", "source myenv/bin/activate" ], "has_command_block": true, "actionable": true, "inline_code_count": 20, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "pip install HTTPS Timeout from WSL — Prepend HTTPS_PROXY=http://172.19.128.1:7890 (lesson-08-pip-https-proxy-clash)", "condition": "with_lesson", "status": 200, "content": "The issue you're facing is due to pip not automatically reading the HTTPS proxy settings, unlike curl. To fix this, you can manually specify the HTTPS proxy in the pip configuration file.\n\nHere are the steps:\n\n1. Open the `~/.pip/pip.conf` file in a text editor:\n ```bash\nnano ~/.pip/pip.conf\n```\n2. Add the following line to the end of the file:\n ```\n[global]\nhttps_proxy = http://172.19.128.1:7890\n```\n Replace `http://172.19.128.1:7890` with your actual proxy URL.\n\n3. Save and close the file.\n\n4. Update pip to read the new configuration:\n ```bash\npip install --upgrade pip\n```\n\n5. Verify that pip is now using the proxy by trying to install the package again:\n ```bash\npip install https://github.com/Panniantong/agent-reach/archive/main.zip\n```\n\nThis should resolve the timeout issue and allow pip to install the package successfully.", "metrics": { "length": 849, "commands": 5, "command_list": [ "nano ~/.pip/pip.conf", "[global]", "https_proxy = http://172.19.128.1:7890", "pip install --upgrade pip", "pip install https://github.com/Panniantong/agent-reach/archive/main.zip" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 3, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "pip install HTTPS Timeout from WSL — Prepend HTTPS_PROXY=http://172.19.128.1:7890 (lesson-08-pip-https-proxy-clash)", "condition": "plain", "status": 200, "content": "To resolve the HTTPS timeout issue when installing packages using pip with an HTTPS proxy, you can use the following command:\n\n```bash\npip install --proxy http://172.19.128.1:7890 package_name\n```\n\nHowever, if you're using a virtual environment, make sure to activate it before running the command. \n\nHere's an example with a virtual environment:\n\n```bash\n# Activate the virtual environment\nsource myenv/bin/activate\n\n# Install the package with the HTTPS proxy\npip install --proxy http://172.19.128.1:7890 package_name\n```\n\nIf you're using a Windows Subsystem for Linux (WSL), you might need to use the following command instead:\n\n```bash\n# Activate the virtual environment\nsource myenv/bin/activate\n\n# Install the package with the HTTPS proxy\npip install --proxy http://172.19.128.1:7890 package_name\n```\n\nMake sure to replace `myenv` with the name of your virtual environment and `package_name` with the name of the package you're trying to install.\n\nAlso, note that you should use `http://` instead of `https://` in the proxy URL, as HTTPS is not supported in WSL.\n\n", "metrics": { "length": 1069, "commands": 5, "command_list": [ "pip install --proxy http://172.19.128.1:7890 package_name", "source myenv/bin/activate", "pip install --proxy http://172.19.128.1:7890 package_name", "source myenv/bin/activate", "pip install --proxy http://172.19.128.1:7890 package_name" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 2, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "V2EX API /api/topics/show.json Unstable — Use r.jina.ai Instead (lesson-09-v2ex-api-show-endpoint-unstable)", "condition": "with_lesson", "status": 200, "content": "The error message is indicating that the `/api/topics/show.json` endpoint is unstable and should be replaced with `r.jina.ai`. However, it seems like you're trying to scrape V2EX topic details programmatically. Here's a concrete, actionable fix with exact commands to scrape topic details using `r.jina.ai`:\n\n**Step 1: Install required libraries**\n\n```bash\npip install jina\n```\n\n**Step 2: Create a new Python script**\n\nCreate a new Python file (e.g., `v2ex_scrape.py`) and add the following code:\n\n```python\nimport requests\nfrom jina import Client\n\n# Set API endpoint and credentials\nurl = \"https://r.jina.ai\"\nusername = \"your_username\"\npassword = \"your_password\"\n\n# Create a Jina client\nclient = Client()\n\n# Set the topic ID\ntopic_id = \"1224558\"\n\n# Get the session cookie\nsession = requests.Session()\nresponse = session.get(url, auth=(username, password))\nsession_cookie = response.cookies.get('JSESSIONID')\n\n# Set the headers\nheaders = {\n 'Cookie': f'JSESSIONID={session_cookie}',\n 'Accept': 'application/json'\n}\n\n# Get the topic details\n", "metrics": { "length": 1046, "commands": 1, "command_list": [ "pip install jina" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "GitHub Commit Signing — GPG 防止提交伪造 (lesson-11-github-commit-signing)", "condition": "with_lesson", "status": 200, "content": "To fix the GitHub Commit Signing issue, you need to set up GPG signing for your Git commits. Here's a step-by-step guide with exact commands:\n\n**Step 1: Generate a new GPG key pair**\n\nOpen a terminal and run the following command to generate a new GPG key pair:\n```bash\ngpg --full-generate-key\n```\nThis will create a new GPG key pair in the default location (`~/.gnupg/`).\n\n**Step 2: Get your GPG key ID**\n\nRun the following command to get your GPG key ID:\n```bash\ngpg --list-secret-keys --keyid-format=long\n```\nThis will display your GPG key ID, which should be in the format `ed25519/XXXXXXXXXXXXXXXX`.\n\n**Step 3: Export your GPG public key**\n\nRun the following command to export your GPG public key:\n```bash\ngpg --armor --export XXXXXXXXXXXXXXXX\n```\nReplace `XXXXXXXXXXXXXXXX` with your actual GPG public key ID.\n\n**Step 4: Add your GPG public key to GitHub**\n\nLog in to your GitHub account and go to **Settings** > **SSH and GPG keys**. Click **New SSH key", "metrics": { "length": 960, "commands": 3, "command_list": [ "gpg --full-generate-key", "gpg --list-secret-keys --keyid-format=long", "gpg --armor --export XXXXXXXXXXXXXXXX" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 5, "lesson_hit_rate": 0.833 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "V2EX API /api/topics/show.json Unstable — Use r.jina.ai Instead (lesson-09-v2ex-api-show-endpoint-unstable)", "condition": "plain", "status": 200, "content": "The error message is indicating that the `/api/topics/show.json` endpoint in the V2EX API is unstable and should be replaced with `r.jina.ai`. This is likely due to changes in the V2EX API.\n\nHere's a concrete and actionable fix:\n\n**Step 1: Update your code**\n\nReplace the line of code that makes the GET request to the `/api/topics/show.json` endpoint with the following:\n```python\nimport requests\n\nresponse = requests.get('https://r.jina.ai/api/topics/show.json')\n```\nOr, if you're using a library like `aiohttp`:\n```python\nimport aiohttp\n\nasync def get_topic():\n async with aiohttp.ClientSession() as session:\n async with session.get('https://r.jina.ai/api/topics/show.json') as response:\n return await response.json()\n```\n\n**Step 2: Update your API client (if applicable)**\n\nIf you're using a library like `requests` or `aiohttp` to interact with the V2EX API, you may need to update the API client to point to the new endpoint.\n\nFor example, with `requests`, you can update the `url` parameter in the `requests.get()` method:\n```python\n", "metrics": { "length": 1061, "commands": 4, "command_list": [ "Or, if you're using a library like `aiohttp`:", "**Step 2: Update your API client (if applicable)**", "If you're using a library like `requests` or `aiohttp` to interact with the V2EX API, you may need to update the API client to point to the new endpoint.", "For example, with `requests`, you can update the `url` parameter in the `requests.get()` method:" ], "has_command_block": true, "actionable": false, "inline_code_count": 12, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "GitHub Commit Signing — GPG 防止提交伪造 (lesson-11-github-commit-signing)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely due to a missing or invalid GPG key. To fix this, follow these steps:\n\n**Step 1: Generate a new GPG key**\n\nIf you haven't already, generate a new GPG key pair using the following command:\n\n```bash\ngpg --full-generate-key\n```\n\nFollow the prompts to create a new key pair. You'll be asked to choose a key type (e.g., RSA or elliptic curve). Choose one of the options, and then confirm your decision.\n\n**Step 2: Add the new GPG key to your GitHub settings**\n\nOnce you have your new GPG key pair, add it to your GitHub settings. To do this, follow these steps:\n\n1. Log in to your GitHub account and navigate to your profile page.\n2. Click on the \"Settings\" icon (gear icon) and select \"GitHub Settings\" from the dropdown menu.\n3. Scroll down to the \"Account\" section and click on \"SSH and GPG keys\".\n4. Click on the \"New SSH key\" button.\n5. Give your new key a name (e.g., \"My GPG Key\") and paste the contents of your public GPG key (you can find this in the", "metrics": { "length": 994, "commands": 1, "command_list": [ "gpg --full-generate-key" ], "has_command_block": true, "actionable": false, "inline_code_count": 1, "lesson_hits": 2, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "API 分页设计 — Cursor vs Offset vs Keyset (lesson-14-api-pagination-design)", "condition": "plain", "status": 200, "content": "I don't see any error in your prompt. However, I'll provide a general solution for API pagination design using cursor, offset, and keyset.\n\nLet's assume you're using Node.js and Express.js to create an API. We'll create a simple example of a user endpoint with pagination using cursor, offset, and keyset.\n\n**Database Setup**\n\nWe'll use a simple in-memory database to store our users. In a real-world scenario, you'd use a database like MongoDB or PostgreSQL.\n\n```javascript\n// users.js\nconst users = [\n { id: 1, name: 'John Doe' },\n { id: 2, name: 'Jane Doe' },\n { id: 3, name: 'Bob Smith' },\n { id: 4, name: 'Alice Johnson' },\n { id: 5, name: 'Mike Brown' },\n];\n\nmodule.exports = users;\n```\n\n**API Endpoint with Cursor**\n\nTo implement cursor-based pagination, we need to store the cursor (or token) in our database.\n\n```javascript\n// users.controller.js\nconst express = require('express');\nconst router = express.Router();\nconst users = require('./users');\n\nrouter.get('/users', async (req, res) =>", "metrics": { "length": 1005, "commands": 2, "command_list": [ "**API Endpoint with Cursor**", "To implement cursor-based pagination, we need to store the cursor (or token) in our database." ], "has_command_block": true, "actionable": true, "inline_code_count": 2, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "API 分页设计 — Cursor vs Offset vs Keyset (lesson-14-api-pagination-design)", "condition": "with_lesson", "status": 200, "content": "To fix the issue with the API pagination design, we need to use the Cursor approach. Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Update the database schema**\n\nAdd a new column `cursor_id` to the `posts` table:\n```sql\nALTER TABLE posts ADD COLUMN cursor_id VARCHAR(255) DEFAULT '';\n```\n**Step 2: Update the API endpoint**\n\nUpdate the API endpoint to accept a `cursor` parameter:\n```bash\nGET /api/posts?cursor=\n```\n**Step 3: Update the database query**\n\nUpdate the database query to use the `cursor_id` column:\n```sql\nSELECT FROM posts \nWHERE (created_at, id) < (%s, %s)\nORDER BY created_at DESC, id DESC\nLIMIT %s\n```\n**Step 4: Update the API function**\n\nUpdate the API function to use the `cursor_id` column:\n```python\ndef get_posts(cursor=None, limit=20):\n if cursor:\n query = \"\"\"\n SELECT FROM posts \n WHERE (created_at, id) < (%s, %s)\n ORDER BY created_at DESC, id DESC\n LIMIT %s\n \"\"\"\n results = db.execute(query, [", "metrics": { "length": 1008, "commands": 6, "command_list": [ "**Step 2: Update the API endpoint**", "Update the API endpoint to accept a `cursor` parameter:", "**Step 3: Update the database query**", "Update the database query to use the `cursor_id` column:", "**Step 4: Update the API function**" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Cloudflare Workflows — 持久化多步骤执行 (lesson-15-cloudflare-workflows-durable)", "condition": "with_lesson", "status": 200, "content": "The error you're encountering is likely due to the missing import statement for the `step` object in your Cloudflare Workflow code. Here's a concrete, actionable fix:\n\n**Step 1: Install required dependencies**\n\nRun the following command in your terminal:\n```bash\nnpm install @cloudflare/workflows\n```\nThis will install the `@cloudflare/workflows` package, which provides the `step` object and other necessary functionality for Cloudflare Workflows.\n\n**Step 2: Update your code**\n\nReplace the contents of your `run.js` file with the following code:\n```javascript\nconst { Step } = require('@cloudflare/workflows');\n\n// Define the persistent workflow\nexport default {\n async run(event, step) {\n // Step 1: Persistent execution (auto-retry, state persistence)\n const userData = await step.do(\"fetch-user\", async () => {\n return await fetch(`https://api.example.com/users/${event.userId}`);\n });\n\n // Step 2: Process data\n const processed = await step.do(\"process-data\", async () => {\n return await processData(userData);\n });\n\n // Step 3: Save result\n await step.do(\"save-result\", async () => {\n await saveToDatabase", "metrics": { "length": 1152, "commands": 1, "command_list": [ "npm install @cloudflare/workflows" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Cloudflare Workflows — 持久化多步骤执行 (lesson-15-cloudflare-workflows-durable)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely due to a missing or invalid `id` property in your Cloudflare Workflow. Here's a step-by-step solution to fix the issue:\n\n**Step 1: Check your Workflow configuration**\n\nOpen your Cloudflare Workflow in the Cloudflare dashboard. Make sure that you have a valid `id` property in the `workflow` object.\n\n```json\n{\n \"id\": \"your-workflow-id\",\n \"name\": \"your-workflow-name\",\n \"type\": \"durable\",\n \"steps\": [\n // your steps here\n ]\n}\n```\n\n**Step 2: Update your Workflow configuration**\n\nIf you don't have an `id` property, add it to your Workflow configuration. Here's an example:\n```json\n{\n \"id\": \"your-workflow-id\",\n \"name\": \"your-workflow-name\",\n \"type\": \"durable\",\n \"steps\": [\n {\n \"id\": \"step-1\",\n \"name\": \"step-1\",\n \"type\": \"http\",\n \"method\": \"GET\",\n \"url\": \"https://example.com\"\n },\n {\n \"id\": \"step-2\",\n \"name\": \"step-", "metrics": { "length": 911, "commands": 2, "command_list": [ "**Step 2: Update your Workflow configuration**", "If you don't have an `id` property, add it to your Workflow configuration. Here's an example:" ], "has_command_block": true, "actionable": false, "inline_code_count": 6, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "AWS ECS 高分辨率指标 — 更快的自动扩缩容 (lesson-16-aws-ecs-high-resolution-metrics)", "condition": "with_lesson", "status": 200, "content": "To fix the error, you need to update your ECS service to enable high-resolution metrics and configure Auto Scaling with a 10-second response time. Here are the exact commands to fix the issue:\n\n**Step 1: Enable high-resolution metrics**\n\n```bash\naws ecs update-service \\\n --cluster my-cluster \\\n --service my-service \\\n --enable-execute-command \\\n --network-configuration \"awsvpcConfiguration={...}\"\n```\n\nReplace `my-cluster` and `my-service` with your actual cluster and service names.\n\n**Step 2: Configure Auto Scaling with a 10-second response time**\n\n```bash\naws application-autoscaling put-scaling-policy \\\n --service-namespace ecs \\\n --scalable-dimension ecs:service:DesiredCount \\\n --resource-id service/my-cluster/my-service \\\n --policy-name high-res-scaling \\\n --policy-type TargetTrackingScaling \\\n --target-tracking-scaling-policy-configuration '{\n \"TargetValue\": 70.0,\n \"PredefinedMetricSpecification\": {\n \"PredefinedMetricType\": \"ECSServiceAverageCPUUtilization\"\n },\n \"ScaleInCooldown\": 60,\n \"ScaleOutCooldown\": 10\n }'\n```\n\n", "metrics": { "length": 1068, "commands": 19, "command_list": [ "aws ecs update-service \\", "--cluster my-cluster \\", "--service my-service \\", "--enable-execute-command \\", "--network-configuration \"awsvpcConfiguration={...}\"" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "AWS ECS 高分辨率指标 — 更快的自动扩缩容 (lesson-16-aws-ecs-high-resolution-metrics)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely due to the ECS task definition not being able to create high-resolution metrics. To resolve this issue, you need to update your ECS task definition to include the necessary metrics.\n\nHere's a step-by-step guide to fix the error:\n\n1. **Update your ECS task definition**:\n\n * First, update your ECS task definition to include the necessary metrics. You can do this by running the following command:\n\n ```bash\naws ecs update-task-definition --task-definition --family --container-definitions \n```\n\n Replace `` and `` with the actual names of your task definition and family, respectively.\n\n * For example, if your task definition is named `my-task-definition` and your family is named `my-family`, you would run the following command:\n\n ```bash\naws ecs update-task-definition --task-definition my-task-definition --family my-family --container-definitions '[{\"Name\": \"my-container\", \"Image\": \"my-image\", \"PortMappings\": [{\"ContainerPort\": 80}]}]'\n```\n\n2. **Enable high-resolution metrics**:\n\n * Next, enable high-resolution metrics for your", "metrics": { "length": 1210, "commands": 2, "command_list": [ "aws ecs update-task-definition --task-definition --family --container-definitions ", "aws ecs update-task-definition --task-definition my-task-definition --family my-family --container-definitions '[{\"Name\": \"my-container\", \"Image\": \"my-image\", \"PortMappings\": [{\"ContainerPort\": 80}]}]'" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "MCP — AI Agent 工具调用标准化协议 (lesson-17-segmentfault-mcp-standardization)", "condition": "plain", "status": 200, "content": "The error you're encountering is related to the MCP (Message Communication Protocol) standardization issue in your AI Agent tool. Here's a step-by-step guide to fix the issue:\n\n**Fixing MCP Standardization Issue**\n\n**Step 1: Install Required Packages**\n\nYou need to install the following packages to fix the MCP standardization issue:\n\n* `mcp-standardization`: This package provides the MCP standardization library.\n* `mcp-protocol`: This package provides the MCP protocol implementation.\n\nYou can install these packages using pip:\n\n```bash\npip install mcp-standardization mcp-protocol\n```\n\n**Step 2: Update MCP Configuration**\n\nYou need to update your MCP configuration file to use the standardization library. The configuration file is usually named `mcp_config.json`.\n\nOpen the `mcp_config.json` file in a text editor and update the following lines:\n\n```json\n{\n \"mcp_version\": \"1.0\",\n \"standardization\": {\n \"enabled\": true,\n \"library\": \"mcp-standardization\"\n }\n}\n```\n\n**Step 3: Restart Your AI Agent Tool**\n\nRestart your AI agent tool to apply the changes.\n\n**Step 4: Verify MCP Standardization**\n\nAfter restarting your", "metrics": { "length": 1149, "commands": 1, "command_list": [ "pip install mcp-standardization mcp-protocol" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 3, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "MCP — AI Agent 工具调用标准化协议 (lesson-17-segmentfault-mcp-standardization)", "condition": "with_lesson", "status": 200, "content": "The error message you're seeing is related to the MCP (MCP — AI Agent 工具调用标准化协议) protocol, which is designed to standardize the way AI agents interact with external tools. The issue seems to be with the way the MCP protocol is being used in your code.\n\nHere's a step-by-step guide to fixing the issue:\n\n**Step 1: Install the required libraries**\n\nYou'll need to install the `mcp` library, which provides the MCP protocol implementation. Run the following command:\n```bash\npip install mcp\n```\n**Step 2: Create a new MCP server**\n\nCreate a new file called `mcp_server.py` and add the following code:\n```python\nfrom mcp import Server, Tool\n\nserver = Server(\"my-tool\")\n\n@server.tool(\"query_database\")\nasync def query_database(sql: str) -> list:\n \"\"\"Execute a SQL query.\"\"\"\n # Your database logic here\n return []\n\n@server.tool(\"get_schema\")\nasync def get_schema(table: str) -> dict:\n \"\"\"Get table schema.\"\"\"\n # Your schema logic here\n return {}\n```\nThis code defines a new MCP server with two tools: `query_database` and `get_schema`. You'll need to", "metrics": { "length": 1062, "commands": 1, "command_list": [ "pip install mcp" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Redis → PostgreSQL 替换 — 缓存/PubSub/队列统一 (lesson-9-redis-postgresql-replacement)", "condition": "with_lesson", "status": 200, "content": "**解决方案**\n\n为了实现 Redis 的所有功能,包括缓存、PubSub 和 队列,我们将使用 PostgreSQL 的特性进行替换。下面是具体的命令:\n\n**缓存实现**\n\n```sql\n-- 创建非日志表(无 WAL,更快)\nCREATE UNLOGGED TABLE cache (\n key TEXT PRIMARY KEY,\n value JSONB,\n expires_at TIMESTAMPTZ\n);\n\n-- 写入缓存\nINSERT INTO cache (key, value, expires_at)\nVALUES ('user:123', '{\"name\":\"Alice\"}', NOW() + INTERVAL '1 hour')\nON CONFLICT (key) DO UPDATE SET value = EXCLUDED.value, expires_at = EXCLUDED.expires_at;\n\n-- 读取缓存\nSELECT value FROM cache WHERE key = 'user:123' AND expires_at NOW();\n\n-- 清理过期(pg_cron 定时执行)\nCREATE OR REPLACE FUNCTION clean_cache()\nRETURNS TRIGGER AS $$\nBEGIN\n IF NEW.expires_at < NOW() THEN\n DELETE FROM cache WHERE expires_at < NOW();\n END IF;\n RETURN NEW;\nEND;\n$$ LANGUAGE plpgsql;\n\nCREATE TRIGGER clean_cache_trigger\nBEFORE DELETE ON cache\nFOR EACH ROW\nEXECUTE", "metrics": { "length": 820, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 2, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Redis → PostgreSQL 替换 — 缓存/PubSub/队列统一 (lesson-9-redis-postgresql-replacement)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely due to the fact that the `pg_cron` extension is not installed in your PostgreSQL database. This extension is required for the Pub/Sub and queue features.\n\nHere's a step-by-step solution to fix the issue:\n\n**Step 1: Install the `pg_cron` extension**\n\nYou can install the `pg_cron` extension using the following command in your PostgreSQL shell:\n\n```sql\nCREATE EXTENSION IF NOT EXISTS pg_cron;\n```\n\n**Step 2: Create a cron table**\n\nTo use the Pub/Sub and queue features, you need to create a cron table. You can do this using the following command:\n\n```sql\nCREATE TABLE IF NOT EXISTS mycron (\n id SERIAL PRIMARY KEY,\n name VARCHAR(255) NOT NULL,\n command VARCHAR(255) NOT NULL,\n interval TIME,\n enabled BOOLEAN DEFAULT TRUE\n);\n```\n\n**Step 3: Add a cron job**\n\nTo add a cron job, you can use the following command:\n\n```sql\nINSERT INTO mycron (name, command, interval)\nVALUES ('my_job', 'SELECT * FROM my_table', '*/5 * * * *');\n```\n\nThis will create a cron job that runs every 5 minutes and selects", "metrics": { "length": 1050, "commands": 4, "command_list": [ "**Step 2: Create a cron table**", "To use the Pub/Sub and queue features, you need to create a cron table. You can do this using the following command:", "**Step 3: Add a cron job**", "To add a cron job, you can use the following command:" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 2, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Before — inspect raw first line (lesson-file-line-number-corruption)", "condition": "with_lesson", "status": 200, "content": "To fix the error, you can use the following command:\n\n```bash\nsed -i 's/^ [0-9]|//g' corrupted-file.ext\n```\n\nThis command uses `sed` to replace any leading spaces and digits (including pipes) at the start of each line with nothing, effectively removing them. The `g` flag at the end of the command ensures that all occurrences are replaced, not just the first one.\n\nHere's how you can verify the fix:\n\n1. Before: Inspect the raw first line of the corrupted file using `head -1 corrupted-file.ext | od -c | head -3`. This will show you the corrupted line.\n\n2. After: Confirm the first line is clean by simply inspecting it with `head -1 corrupted-file.ext`.\n\nTo prevent this issue from happening in the future, you should avoid using commands that prefix lines with line numbers when saving the file content, such as `cat -n`, `sed -n '...p'`, or `less -N`. Instead, use commands like `cat`, `less`, or `more` for viewing, and use a text editor or a programming language's built-in file handling mechanisms to save the file content.", "metrics": { "length": 1031, "commands": 1, "command_list": [ "sed -i 's/^ [0-9]|//g' corrupted-file.ext" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 3, "lesson_hit_rate": 0.75 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Lesson Management Standardization — Naming, Content Sanitization, and Automated (lesson-management-standardization)", "condition": "with_lesson", "status": 200, "content": "To address the issues mentioned in the problem, we'll perform the following steps:\n\n1. Generalize filenames and sanitize content.\n2. Update non-portable tags to standardize metadata.\n3. Implement automated submission standards.\n4. Remove plaintext secrets from documentation.\n\n**Phase 1: Bulk Cleanup**\n\nFirst, we'll rename files with project-specific prefixes and sanitize their content.\n\n1. Run the following script to rename files and sanitize content:\n```bash\npython scripts/generalize_lessons.py --pass 1\n```\nThis script will rename files with project-specific prefixes and remove hardcoded sensitive content.\n\n2. After the first pass, manually review the renamed files to ensure they are accurate and do not contain sensitive information.\n\n3. Run the following script to update Chinese filenames to English:\n```bash\npython scripts/generalize_lessons.py --pass 2\n```\nThis script will update the filenames to use English characters only.\n\n**Phase 2: Standardize Metadata**\n\nNext, we'll update non-portable tags to standardize metadata.\n\n1. Create a new file `metadata.yml` with the following content:\n```yml\nproject: misakanet\nnode: node-1\nseverity: info\n```\nThis file will serve as a template for standardized metadata", "metrics": { "length": 1223, "commands": 2, "command_list": [ "python scripts/generalize_lessons.py --pass 1", "python scripts/generalize_lessons.py --pass 2" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 1, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Before — inspect raw first line (lesson-file-line-number-corruption)", "condition": "plain", "status": 200, "content": "The error \"Before — inspect raw first line (lesson-file-line-number-corruption)\" typically occurs when there are issues with the line numbers in a file, which can be caused by various factors such as:\n\n- Unsaved changes to the file\n- Incorrect line numbers in the file\n- Issues with the file's encoding\n\nHere's a step-by-step guide to fix this error:\n\n**Method 1: Save and Reload the File**\n\n1. Save the file with any unsaved changes.\n2. Reload the file by clicking on \"Reload\" or pressing `Ctrl+R` (Windows/Linux) or `Cmd+R` (Mac).\n\n**Method 2: Check and Correct Line Numbers**\n\n1. Open the file in a text editor, such as Notepad (Windows) or TextEdit (Mac).\n2. Check the line numbers in the file and correct any errors.\n3. Save the file with the correct line numbers.\n\n**Method 3: Use a File Repair Tool**\n\n1. Download and install a file repair tool, such as:\n\t* Recuva (Windows)\n\t* Disk Utility (Mac)\n\t* File Repair (Windows, Mac, Linux)\n2. Run the file repair tool and select the file that contains the error.\n3", "metrics": { "length": 1015, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 2, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Lesson Management Standardization — Naming, Content Sanitization, and Automated (lesson-management-standardization)", "condition": "plain", "status": 200, "content": "I don't see any error provided. However, I'll provide a general solution for the Lesson Management Standardization issue. If you provide the actual error message, I can give you a more precise fix.\n\nAssuming the issue is related to the Lesson Management Standardization, here's a general solution:\n\n**Solution:**\n\n1. Make sure that the lesson management standardization is properly configured in your application.\n2. Check that the naming convention for lessons is consistent and follows the standardization guidelines.\n3. Ensure that the content sanitization is enabled and properly configured to prevent any security vulnerabilities.\n\n**Example Commands:**\n\nIf you're using a Linux-based system, here are some example commands to help you troubleshoot and fix the issue:\n\n```bash\n# Check the lesson management standardization configuration\nsudo grep -i \"lesson-management-standardization\" /etc/config.yaml\n\n# Verify the naming convention for lessons\nsudo grep -i \"lesson-name\" /etc/config.yaml\n\n# Check the content sanitization configuration\nsudo grep -i \"content-sanitization\" /etc/config.yaml\n```\n\nIf you're using a Windows system, you can use the following commands:\n\n```bash\n# Check the lesson management standardization configuration\nGet-Content -Path C:\\config.yaml", "metrics": { "length": 1273, "commands": 3, "command_list": [ "sudo grep -i \"lesson-management-standardization\" /etc/config.yaml", "sudo grep -i \"lesson-name\" /etc/config.yaml", "sudo grep -i \"content-sanitization\" /etc/config.yaml" ], "has_command_block": true, "actionable": true, "inline_code_count": 2, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Lesson Quality Requirements: failure-memory protocol Format (lesson-quality-requirements)", "condition": "with_lesson", "status": 200, "content": "The error message indicates that the verification script is expecting a specific output format, but the actual output does not match this format. Specifically, the verification script is expecting a line count for the number of lines in the `lesson-quality-requirements.md` file, but the actual output only contains a string.\n\nTo fix this issue, you can modify the verification script to extract the line count from the output. Here's an updated version of the verification script:\n\n```bash\n#!/bin/bash\n\n# Run the lesson quality check\ncheck_lesson_quality.py lessons/contrib/lesson-quality-requirements.md\n\n# Check the score\nscore=$(score_lessons.py lessons/contrib/lesson-quality-requirements.md)\n\n# Check if the lesson appears in search results\nif grep -q \"lesson-quality-requirements\" search_index.txt; then\n search_result=\"Lesson appears in search results\"\nelse\n search_result=\"Lesson does not appear in search results\"\nfi\n\n# Check the structure\nif [[ $(check_lesson_structure.py lessons/contrib/lesson-quality-requirements.md) =~ \"Problem\" && $(check_lesson_structure.py lessons/contrib/lesson-quality-requirements.md) =~ \"Root Cause\" && $(check_lesson_structure.py lessons/contrib/lesson-quality-requirements", "metrics": { "length": 1216, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 1, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Lesson Quality Requirements: failure-memory protocol Format (lesson-quality-requirements)", "condition": "plain", "status": 200, "content": "It seems like you're experiencing an issue with a YAML file, specifically the `lesson-quality-requirements` section. The error message \"failure-memory protocol Format\" is not a standard error message, but I'll assume it's related to a YAML validation error.\n\nTo fix this issue, you can try the following steps:\n\n1. Check the YAML file for any invalid characters or syntax errors:\n```bash\nyamllint lesson-quality-requirements.yaml\n```\nThis command will highlight any errors or warnings in the YAML file.\n\n2. If the above command doesn't find any issues, try to validate the YAML file using a YAML validator tool:\n```bash\nyaml validate lesson-quality-requirements.yaml\n```\nThis command will check the YAML file for any syntax errors and report them.\n\n3. If the above steps don't resolve the issue, try to recreate the `lesson-quality-requirements` section with a simple format:\n```yaml\nlesson-quality-requirements:\n - name: Test Requirement\n description: This is a test requirement.\n status: passed\n```\nThis should resolve the issue if the original YAML file had a more complex format.\n\nIf none of the above steps work, please provide the exact error message or the contents of the `lesson-quality-", "metrics": { "length": 1203, "commands": 2, "command_list": [ "yamllint lesson-quality-requirements.yaml", "yaml validate lesson-quality-requirements.yaml" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Lesson Provenance Tracking: author, PR, source, merge history (lesson-provenance-tracking)", "condition": "with_lesson", "status": 200, "content": "**Fix: Extend lesson schema with provenance fields and populate from git history**\n\n**Step 1: Update lesson schema**\n\nUpdate the `lesson` schema to include the provenance fields:\n```yaml\n---\n{\n \"title\": \"Lesson Provenance Tracking: author, PR, source, merge history\",\n \"domain\": \"devops\",\n \"tags\": [\"provenance\", \"metadata\", \"audit\", \"tracking\"],\n \"status\": \"published\",\n \"evidence_level\": \"E2\",\n \"source\": \"closed-pr-1031\",\n \"created\": \"2026-08-22\",\n \"provenance\": {\n \"author\": \"\",\n \"pr\": 0,\n \"merged_by\": \"\",\n \"edited_at\": \"\",\n \"edit_history\": []\n }\n}\n```\n**Step 2: Run the backfill script**\n\nRun the `backfill_provenance.py` script to populate the provenance fields from git history:\n```bash\npython scripts/backfill_provenance.py --lessons lessons\n```\nThis will populate the provenance fields with the corresponding values from the git history.\n\n**Step 3: Verify the results**\n\nVerify that the provenance fields are populated correctly:\n```", "metrics": { "length": 967, "commands": 5, "command_list": [ "**Step 2: Run the backfill script**", "Run the `backfill_provenance.py` script to populate the provenance fields from git history:", "This will populate the provenance fields with the corresponding values from the git history.", "**Step 3: Verify the results**", "Verify that the provenance fields are populated correctly:" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Lesson Provenance Tracking: author, PR, source, merge history (lesson-provenance-tracking)", "condition": "plain", "status": 200, "content": "The error you're experiencing is likely due to a missing index on the `source` column in your `lesson_provenance_tracking` table. Here's a concrete, actionable fix with exact commands:\n\n**Assumptions:**\n\n* You're using MySQL or PostgreSQL.\n* You have the necessary permissions to create indexes.\n\n**Fix:**\n\n1. **MySQL:**\n\n```sql\nCREATE INDEX idx_source ON lesson_provenance_tracking (source);\n```\n\n2. **PostgreSQL:**\n\n```sql\nCREATE INDEX idx_source ON lesson_provenance_tracking USING btree (source);\n```\n\n**Explanation:**\n\n* The `CREATE INDEX` command creates a new index on the specified column(s).\n* The `idx_source` name is arbitrary, but it's a good practice to use descriptive names for indexes.\n* The `ON lesson_provenance_tracking` clause specifies the table to create the index on.\n* The `(source)` clause specifies the column(s) to index.\n* In PostgreSQL, the `USING btree` clause specifies the indexing method, which is a B-tree index.\n\n**After creating the index:**\n\n* Run the following command to verify the index has been created:\n\n```sql\nSHOW INDEX FROM lesson_provenance_tracking;\n```\n\n", "metrics": { "length": 1102, "commands": 9, "command_list": [ "2. **PostgreSQL:**", "**Explanation:**", "* The `CREATE INDEX` command creates a new index on the specified column(s).", "* The `idx_source` name is arbitrary, but it's a good practice to use descriptive names for indexes.", "* The `ON lesson_provenance_tracking` clause specifies the table to create the index on." ], "has_command_block": true, "actionable": true, "inline_code_count": 12, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "MCP 协议 + Bedrock 实战 — Agent 外部工具调用标准化 (lesson-review-4-mcp-bedrock-integration)", "condition": "with_lesson", "status": 200, "content": "The error you're experiencing is likely due to the MCP Server not being properly configured or the Agent not being able to connect to it. Here's a step-by-step guide to fix the issue:\n\n**Step 1: Install the required dependencies**\n\nYou'll need to install the `mcp` and `boto3` libraries. Run the following commands:\n```bash\npip install mcp boto3\n```\n**Step 2: Define the MCP Server**\n\nCreate a new file called `mcp_server.py` and add the following code:\n```python\nfrom mcp import Server, Tool\nimport boto3\n\nserver = Server(\"my-tools\")\n\n@server.tool(\"read_s3_file\")\nasync def read_s3_file(bucket: str, key: str) -> str:\n \"\"\"Read a file from S3.\"\"\"\n s3 = boto3.client('s3')\n obj = s3.get_object(Bucket=bucket, Key=key)\n return obj['Body'].read().decode()\n\n@server.tool(\"query_dynamodb\")\nasync def query_dynamodb(table: str, key: str) -> dict:\n \"\"\"Query DynamoDB by partition key.\"\"\"\n dynamodb = boto3.resource('dynamodb')\n table = dynamodb.Table(table)\n", "metrics": { "length": 972, "commands": 1, "command_list": [ "pip install mcp boto3" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 2, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "EKS Kubernetes 版本回滚 — 安全升级集群 (lesson-review-5-eks-version-rollback)", "condition": "plain", "status": 200, "content": "The error you're encountering typically occurs when you're trying to roll back a version of your Kubernetes cluster in an Amazon EKS (Elastic Kubernetes Service) cluster. Here's a step-by-step guide to fix the issue:\n\n**Prerequisites:**\n\n* Make sure you have the AWS CLI installed and configured on your machine.\n* Ensure you have the necessary permissions to manage your EKS cluster.\n* Take a snapshot of your cluster before attempting to roll back.\n\n**Roll back to a previous version of your EKS cluster:**\n\n1. **List available versions:** Use the following command to list all available versions of your EKS cluster:\n\n```bash\naws eks describe-cluster --cluster-name --query 'cluster.versionHistoryList[]|{version, reason}'\n```\n\nReplace `` with your actual cluster name.\n\n2. **Choose the desired version:** Select the version you want to roll back to by looking at the `version` and `reason` columns in the output. For example, let's say you want to roll back to version `1.22.0`.\n\n3. **Update the cluster version:** Use the following command to update the cluster version:\n\n```bash\naws eks update-kubeconfig --name --", "metrics": { "length": 1164, "commands": 1, "command_list": [ "aws eks describe-cluster --cluster-name --query 'cluster.versionHistoryList[]|{version, reason}'" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 2, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Cloudflare Monetization Gateway — x402 API 支付协议 (lesson-review-6-cloudflare-x402-monetization)", "condition": "with_lesson", "status": 200, "content": "The error you're experiencing is due to the Cloudflare Monetization Gateway not being properly configured to accept payments from your AI Agent. To fix this, you'll need to follow these steps:\n\n1. Create a new file named `x402.json` in the root of your project with the following content:\n```json\n{\n \"name\": \"my-agent\",\n \"description\": \"My AI Agent\",\n \"inputSchema\": {},\n \"pricing\": {\n \"x402\": {\n \"amount\": \"0.01\",\n \"currency\": \"USDC\"\n }\n }\n}\n```\nThis file defines the pricing structure for your AI Agent using the x402 protocol.\n\n2. Run the following command to generate a payment proof:\n```bash\ncurl -X GET \\\n https://api.cloudflare.com/client/v1/x402/payments \\\n -H 'X-Auth-Token: YOUR_CLOUDFLARE_TOKEN' \\\n -H 'Content-Type: application/json' \\\n -d '{\"name\": \"my-agent\", \"description\": \"My AI Agent\", \"inputSchema\": {}, \"pricing\": {\"x402\": {\"amount\": \"0.01\", \"currency\": \"USDC\"}}}'\n```\nReplace `YOUR_CLOUDFL", "metrics": { "length": 935, "commands": 2, "command_list": [ "This file defines the pricing structure for your AI Agent using the x402 protocol.", "2. Run the following command to generate a payment proof:" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 2, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "MCP 协议 + Bedrock 实战 — Agent 外部工具调用标准化 (lesson-review-4-mcp-bedrock-integration)", "condition": "plain", "status": 200, "content": "I can guide you through the process of fixing the error, but I need more information about the error message you're encountering. The provided error message seems to be in Chinese, so I'll need you to translate it or provide more context.\n\nHowever, based on the topic \"MCP 协议 + Bedrock 实战 — Agent 外部工具调用标准化 (lesson-review-4-mcp-bedrock-integration)\", I'm assuming the error is related to integrating MCP (Microsoft Cloud Platform) with Bedrock, possibly involving an external tool.\n\nHere's a general approach to troubleshooting and fixing common errors related to MCP and Bedrock integration:\n\n1. Check the MCP and Bedrock documentation for any known issues or updates.\n2. Verify that all required dependencies and tools are installed and up-to-date.\n3. Review the code and configuration files for any syntax errors or inconsistencies.\n\nSince I don't have the exact error message, I'll provide a generic example of how to troubleshoot and fix a common issue:\n\n**Example:**\n\nLet's say the error message is:\n```\nError: MCP Agent not found\n```\nTo fix this issue, you can try the following steps:\n\n1. Check the MCP Agent installation:\n```bash\nmcp-agent --version\n```\n", "metrics": { "length": 1163, "commands": 2, "command_list": [ "Error: MCP Agent not found", "mcp-agent --version" ], "has_command_block": true, "actionable": true, "inline_code_count": 3, "lesson_hits": 2, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "EKS Kubernetes 版本回滚 — 安全升级集群 (lesson-review-5-eks-version-rollback)", "condition": "with_lesson", "status": 200, "content": "根据问题描述,EKS控制平面升级不可逆,这是开源K8s不支持的。为避免这种情况,AWS EKS支持控制平面版本回滚。以下是具体的修复步骤:\n\n1. **创建回滚点**(自动备份 etcd)\n ```bash\n aws eks update-cluster-config \\\n --name my-cluster \\\n --kubernetes-version 1.31\n ```\n\n2. **升级控制平面**\n ```bash\n aws eks update-cluster-version \\\n --name my-cluster \\\n --kubernetes-version 1.32\n ```\n\n3. **运行 smoke tests**\n ```bash\n kubectl --context=my-cluster get nodes\n ```\n\n4. **如果失败 → 回滚**\n ```bash\n aws eks rollback-cluster-version \\\n --name my-cluster \\\n --kubernetes-version 1.31\n ```\n\n5. **如果成功 → 升级节点组**\n ```bash\n for cluster in $(aws eks list-clusters --query 'clusters[]' --output text); do\n echo \"Upgrading $cluster...\"\n aws eks update-cluster-version --name \"$cluster", "metrics": { "length": 742, "commands": 10, "command_list": [ "aws eks update-cluster-config \\", "--name my-cluster \\", "--kubernetes-version 1.31", "aws eks update-cluster-version \\", "--name my-cluster \\" ], "has_command_block": true, "actionable": false, "inline_code_count": 8, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Cloudflare Monetization Gateway — x402 API 支付协议 (lesson-review-6-cloudflare-x402-monetization)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely due to a missing or incorrect configuration in your Cloudflare Monetization Gateway settings. To resolve this issue, follow these steps:\n\n**Step 1: Check your API key**\n\nMake sure you have the correct API key for your Cloudflare account. You can find it in the Cloudflare dashboard under \"Monetization\" > \"API keys\".\n\n**Step 2: Verify your x402 API settings**\n\nIn the Cloudflare dashboard, navigate to \"Monetization\" > \"Monetization Gateway\" > \"x402 API\". Ensure that:\n\n* The \"API endpoint\" is set to `https://api.cloudflare.com/client/v0/monetization/gateway/x402`\n* The \"API key\" is selected and the correct API key is entered\n* The \"PayPal\" or \"Stripe\" integration is enabled (depending on your payment gateway)\n* The \"Test mode\" is set to `false` (if you're deploying to production)\n\n**Step 3: Update your API settings (if necessary)**\n\nIf you've made changes to your API settings, you may need to update your code to reflect these changes. Check your API documentation for the latest information on x402 API settings.\n\n**Step 4:", "metrics": { "length": 1073, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 2, "lesson_hits": 2, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Network Domain Lesson Template (lesson-template-network)", "condition": "with_lesson", "status": 200, "content": "The error message \"Network Domain Lesson Template\" is not a specific error, but rather a title of a lesson template. However, based on the provided verified lesson, it seems that the issue is related to SSL certificate verification failure behind a corporate proxy.\n\nHere's a concrete, actionable fix with exact commands:\n\n**Problem:** Agent fails to connect to external APIs behind corporate proxy with SSL inspection.\n\n**Symptoms:**\n\n* SSL: CERTIFICATE_VERIFY_FAILED\n\n**Root Cause:** Corporate proxy performs SSL inspection (man-in-the-middle), replacing original certificates with its own. Python's certifi bundle doesn't include the corporate CA.\n\n**Solution:**\n\n### Step 1: Identify the issue\n\nRun the following diagnostic commands to identify the issue:\n\n```bash\ncurl -v https://example.com\nnslookup example.com\nopenssl s_client -connect example.com:443\n```\n\nThese commands will help you understand the issue and verify the expected behavior.\n\n### Step 2: Apply the fix\n\nTo resolve the issue, follow these steps:\n\n1. **Export corporate CA certificate:**\n\n ```bash\nsecurity find-certificate -a -p /Library/Keychains/System.keychain corporate-ca.pem\n```\n\n This command will export the corporate CA certificate from the System", "metrics": { "length": 1234, "commands": 4, "command_list": [ "curl -v https://example.com", "nslookup example.com", "openssl s_client -connect example.com:443", "security find-certificate -a -p /Library/Keychains/System.keychain corporate-ca.pem" ], "has_command_block": true, "actionable": true, "inline_code_count": 3, "lesson_hits": 4, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Cloudflare Workflows Saga Rollback — Durable Multi-Step Compensation (lesson-review-7-cloudflare-saga-rollbacks)", "condition": "with_lesson", "status": 200, "content": "To fix the Cloudflare Workflows Saga Rollback issue, you need to ensure that the compensating operations for each step are properly implemented. Here's an updated version of the code with the necessary fixes:\n\n```javascript\n// Cloudflare Workflows saga rollback example\nexport default {\n async run(event, step) {\n // Step 1: Debit with rollback\n const debitResult = await step.do(\"debit-account-a\", {\n // rollback: compensating action if this step succeeds but later steps fail\n rollback: async () => {\n await step.do(\"credit-account-a-reversal\", {\n amount: debitResult.amount,\n accountId: \"A\"\n });\n }\n }, async () => {\n try {\n await debitFromAccount(\"A\", 100);\n return debitResult;\n } catch (error) {\n // If debit fails, revert to a previous state\n await step.do(\"credit-account-a-reversal\", {\n amount: 0,\n accountId: \"A\"\n });\n throw error;\n }\n });\n\n // Step 2: Credit (may fail)\n const creditResult = await step.do(\"credit-account-b\", {\n rollback: async () => {\n // If", "metrics": { "length": 1123, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Network Domain Lesson Template (lesson-template-network)", "condition": "plain", "status": 200, "content": "The error \"Network Domain Lesson Template (lesson-template-network)\" is not a standard error message and seems to be related to a custom error or exception. However, I'll provide a general solution that might help resolve the issue.\n\nAssuming the error is related to a Django project, here are some steps you can try:\n\n1. Check your Django project's settings:\n\nOpen your `settings.py` file and look for any sections related to network domains or DNS settings. Make sure that the `ALLOWED_HOSTS` variable is properly configured.\n\n```python\nALLOWED_HOSTS = ['example.com', 'localhost', '127.0.0.1']\n```\n\n2. Check your virtual environment:\n\nMake sure your virtual environment is properly activated. If you're using a virtual environment, try activating it and then running your Django project.\n\n```bash\n# Activate the virtual environment\nsource myenv/bin/activate\n\n# Run your Django project\npython manage.py runserver\n```\n\n3. Check your DNS settings:\n\nIf you're using a custom domain, make sure that your DNS settings are correctly configured. You can check your DNS settings by contacting your DNS provider or hosting company.\n\n4. Clear cache and run migrations:\n\nClear your cache and run migrations to ensure that your", "metrics": { "length": 1217, "commands": 2, "command_list": [ "2. Check your virtual environment:", "Make sure your virtual environment is properly activated. If you're using a virtual environment, try activating it and then running your Django project." ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 2, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Cloudflare Workflows Saga Rollback — Durable Multi-Step Compensation (lesson-review-7-cloudflare-saga-rollbacks)", "condition": "plain", "status": 200, "content": "The error you're encountering is related to a Cloudflare Workflows Saga Rollback issue, specifically with Durable Multi-Step Compensation. Here's a step-by-step fix to resolve the problem:\n\n**Step 1: Delete the workflow**\n\n1. Log in to your Cloudflare account.\n2. Go to the Workflows tab.\n3. Find the workflow that's causing the error and click on the three dots next to it.\n4. Select \"Delete workflow\".\n\n**Step 2: Verify the deletion**\n\n1. After deleting the workflow, go back to the Workflows tab.\n2. Check if the deleted workflow is no longer listed.\n\n**Step 3: Create a new workflow**\n\n1. Click on the \"Create workflow\" button.\n2. Fill in the required information, such as the workflow name and description.\n3. Select \"Durable Multi-Step\" as the workflow type.\n\n**Step 4: Configure the workflow**\n\n1. In the workflow settings, make sure the \"Saga\" option is enabled.\n2. In the \"Saga\" section, ensure that the \"Rollback\" option is set to \"Enabled\".\n3. In the \"Compensation\" section, make sure that the \"Durable Multi-Step\" option is selected.\n\n", "metrics": { "length": 1047, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 3, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Maintainer Feedback Iteration — Address Blockers, Not Just Comments (maintainer-feedback-iteration)", "condition": "with_lesson", "status": 200, "content": "To address the \"Maintainer Feedback Iteration — Address Blockers, Not Just Comments\" issue, we'll create a script that parses the maintainer's feedback, extracts the blockers, and fixes them. Here's a concrete, actionable fix with exact commands:\n\n**Fixing Maintainer Feedback Iteration**\n\nFirst, install the required GitHub CLI tools:\n```bash\ngh install\n```\n**Script: `fix_maintainer_feedback.sh`**\n```bash\n#!/bin/bash\n\n# Set the PR number\nPR_NUMBER=123456\n\n# Set the GitHub token (optional, but recommended for security)\nGITHUB_TOKEN=\"your_github_token_here\"\n\n# Function to extract blockers from a comment\nextract_blockers() {\n blockers=()\n while IFS= read -r line; do\n if [[ $line =~ \"remove\" || $line =~ \"not acceptable\" || $line =~ \"can be merged as\" ]]; then\n blockers+=(\"$line\")\n fi\n done <<< \"$1\"\n echo \"${blockers[@]}\"\n}\n\n# Function to fix blockers\nfix_blockers() {\n blockers=($(extract_blockers \"$1\"))\n for blocker in \"${blockers[@]}\"; do\n echo \"Fixing blocker: $", "metrics": { "length": 993, "commands": 1, "command_list": [ "gh install" ], "has_command_block": true, "actionable": true, "inline_code_count": 3, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "MCP Context Mode — 98% Context Window Reduction for Claude Code (mcp-context-mode-98-reduction)", "condition": "plain", "status": 200, "content": "The error message you're experiencing, `MCP Context Mode — 98% Context Window Reduction for Claude Code (mcp-context-mode-98-reduction)`, typically indicates that the context window size is too small for the current buffer size. To fix this issue, you can try increasing the context window size. Here's a concrete, actionable fix with exact commands:\n\n**For Visual Studio Code:**\n\n1. Open the Command Palette in Visual Studio Code by pressing `Ctrl + Shift + P` (Windows/Linux) or `Cmd + Shift + P` (Mac).\n2. Type \"MCP Context Mode: Increase Context Window Size\" in the Command Palette and select the option.\n3. Alternatively, you can also use the following command in the Terminal:\n\n ```bash\ncode --extensions.path=/path/to/your/extension --mcp-context-mode 100\n```\n\n Replace `/path/to/your/extension` with the actual path to the extension that's causing the issue.\n\n**For IntelliJ IDEA:**\n\n1. Open the Settings (or Preferences) dialog in IntelliJ IDEA by pressing `Ctrl + Shift + Alt + S` (Windows/Linux) or `Cmd + Shift + Alt + S` (Mac).\n2. In the Settings dialog, navigate", "metrics": { "length": 1080, "commands": 1, "command_list": [ "code --extensions.path=/path/to/your/extension --mcp-context-mode 100" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 3, "lesson_hit_rate": 0.75 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Maintainer Feedback Iteration — Address Blockers, Not Just Comments (maintainer-feedback-iteration)", "condition": "plain", "status": 200, "content": "The error you're experiencing is likely due to a conflict between the `maintainer-feedback-iteration` rule and another rule in your `.gitignore` file. The `maintainer-feedback-iteration` rule suggests that you should ignore files with names that contain the word \"blocker\" but not \"comment\". \n\nTo fix this issue, you can add the following lines to your `.gitignore` file:\n\n```bash\n# Ignore files that contain \"blocker\" but not \"comment\"\n*.blocker\n*.blocker-\n```\n\nHowever, the most effective solution is to modify your `.gitignore` file to include the exact file name that is causing the conflict. The exact command to do this depends on your operating system and how you're managing your Git repository. Here are a few examples:\n\n**Using Git Bash on Linux or macOS:**\n\n```bash\necho \"# Ignore file containing 'blocker' but not 'comment'\" >> .gitignore\necho \"file_with_blocker_but_no_comment.txt\" >> .gitignore\n```\n\n**Using PowerShell on Windows:**\n\n```bash\n$ignoreFile = \"C:\\Path\\To\\Your\\Gitignore\"\n$ignoreContent = \"# Ignore file containing 'blocker' but not 'comment'\"\n$", "metrics": { "length": 1071, "commands": 4, "command_list": [ "*.blocker", "*.blocker-", "echo \"# Ignore file containing 'blocker' but not 'comment'\" >> .gitignore", "echo \"file_with_blocker_but_no_comment.txt\" >> .gitignore" ], "has_command_block": true, "actionable": false, "inline_code_count": 9, "lesson_hits": 2, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "MCP Endpoint 404: Zone Route Points to Worker Without MCP Implementation (mcp-endpoint-404-zone-route-misconfig)", "condition": "with_lesson", "status": 200, "content": "Here's a step-by-step guide to fixing the error:\n\n**Step 1: Update MCP endpoint routes**\n\nUse the following command to update the MCP endpoint routes:\n\n```bash\naws cloudformation update-stack --stack-name misakanet-register-proxy --template-body file://mcp-endpoint-404-zone-route-misconfig-updated.yaml\n```\n\n**Step 2: Deploy the updated worker**\n\nUse the following command to deploy the updated worker:\n\n```bash\naws cloudformation update-stack --stack-name misakanet-register-proxy --template-body file://updated-worker.yaml\n```\n\n**Step 3: Consolidate architecture**\n\nUpdate the misakanet-register-proxy worker to use the new MCP implementation:\n\n```bash\naws cloudformation update-stack --stack-name misakanet-register-proxy --template-body file://consolidated-worker.yaml\n```\n\n**Step 4: Verify MCP endpoint**\n\nTest the MCP endpoint using the following command:\n\n```bash\ncurl -X POST https://misakanet.org/mcp \\\n -H \"Content-Type: application/json\" \\\n -d '{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"initialize\"\n```\n\nIf you encounter any issues, ensure that the MCP endpoint routes have been updated correctly and the worker", "metrics": { "length": 1117, "commands": 6, "command_list": [ "aws cloudformation update-stack --stack-name misakanet-register-proxy --template-body file://mcp-endpoint-404-zone-route-misconfig-updated.yaml", "aws cloudformation update-stack --stack-name misakanet-register-proxy --template-body file://updated-worker.yaml", "aws cloudformation update-stack --stack-name misakanet-register-proxy --template-body file://consolidated-worker.yaml", "curl -X POST https://misakanet.org/mcp \\", "-H \"Content-Type: application/json\" \\" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 2, "lesson_hit_rate": 0.4 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "MCP Context Mode — 98% Context Window Reduction for Claude Code (mcp-context-mode-98-reduction)", "condition": "with_lesson", "status": 200, "content": "To fix the error, you need to implement a context mode architecture that compresses tool outputs. Here's a step-by-step guide to achieve this:\n\n**Step 1: Install required packages**\n\nRun the following command to install the required packages:\n```bash\nnpm install compress-archiver json-streamer\n```\n**Step 2: Create a context mode server**\n\nCreate a new file `context-mode-server.js` with the following code:\n```javascript\nconst express = require('express');\nconst { gzip, gunzip } = require('compress-archiver');\nconst { TransformStream } = require('stream');\nconst { Transform } = require('stream/Transform');\n\nconst app = express();\n\napp.use(express.json());\n\nconst compressionStrategies = {\n summarize: (data) => JSON.stringify({ summary: data.slice(0, 10) }),\n filter: (data) => JSON.stringify({ filtered: data.slice(0, 10) }),\n truncate: (data) => JSON.stringify({ truncated: data.slice(0, 10) }),\n structure: (data) => JSON.stringify({ structured: data.slice(0, 10) }),\n};\n\napp.post('/compress', (req, res) => {\n const { strategy } = req", "metrics": { "length": 1049, "commands": 1, "command_list": [ "npm install compress-archiver json-streamer" ], "has_command_block": true, "actionable": true, "inline_code_count": 3, "lesson_hits": 2, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "MCP Endpoint 404: Zone Route Points to Worker Without MCP Implementation (mcp-endpoint-404-zone-route-misconfig)", "condition": "plain", "status": 200, "content": "The error message \"MCP Endpoint 404: Zone Route Points to Worker Without MCP Implementation (mcp-endpoint-404-zone-route-misconfig)\" typically occurs when the Azure Kubernetes Service (AKS) cluster is not properly configured to handle zone-aware routing.\n\nTo fix this issue, you need to enable zone-aware routing on your AKS cluster. Here are the steps:\n\n**Step 1: Update the Azure CLI**\n\nFirst, make sure you have the latest version of the Azure CLI installed. You can check by running:\n\n```bash\naz --version\n```\n\nIf you're using an older version, update it by running:\n\n```bash\naz upgrade\n```\n\n**Step 2: Enable Zone-Aware Routing**\n\nRun the following command to enable zone-aware routing on your AKS cluster:\n\n```bash\naz aks update --resource-group --name --enable-zone-aware-routing true\n```\n\nReplace `` and `` with the actual names of your resource group and AKS cluster.\n\n**Step 3: Update the Network Policies**\n\nZone-aware routing requires network policies to be updated to allow communication between pods in different zones. You can update the network policies using the following command:\n\n```", "metrics": { "length": 1174, "commands": 3, "command_list": [ "az --version", "az upgrade", "az aks update --resource-group --name --enable-zone-aware-routing true" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 1, "lesson_hit_rate": 0.2 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "MCP Registry Readiness Requires QA Before Promotion (mcp-registry-readiness-requires-qa-before-promotion)", "condition": "plain", "status": 200, "content": "The error you're encountering is related to the Microsoft Compute Platform (MCP) registry readiness. Here's a step-by-step guide to resolve the issue:\n\n**Prerequisites:**\n\n1. Ensure you have the Azure CLI installed on your machine. You can install it by running the following command:\n\n```bash\naz login\n```\n\n2. Verify that you have the necessary permissions to perform registry-related operations.\n\n**Step 1: Update the Azure Resource Manager (ARM) template**\n\nThe error might be caused by an outdated ARM template. Update the template to the latest version. Run the following command:\n\n```bash\naz group template update --name --resource-group --template-version '2022-05-01'\n```\n\nReplace `` and `` with the actual names of your template and resource group.\n\n**Step 2: Update the registry settings**\n\nUpdate the registry settings to ensure they are set to 'Ready' before promotion. Run the following command:\n\n```bash\naz vm registry update --resource-group --name --settings \"readyBeforePromotion=true\"\n```\n\nReplace `` and `` with the actual names of", "metrics": { "length": 1198, "commands": 3, "command_list": [ "az login", "az group template update --name --resource-group --template-version '2022-05-01'", "az vm registry update --resource-group --name --settings \"readyBeforePromotion=true\"" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 3, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "MCP Registry Readiness Requires QA Before Promotion (mcp-registry-readiness-requires-qa-before-promotion)", "condition": "with_lesson", "status": 200, "content": "To fix the error \"MCP Registry Readiness Requires QA Before Promotion (mcp-registry-readiness-requires-qa-before-promotion)\", you need to follow the steps provided in the verified lesson. Here's a step-by-step guide:\n\n**Step 1: Define a registry readiness gate**\n\nBefore promoting a server, verify the following:\n\n* MCP smoke test passes\n* Windows/macOS/Linux instructions are clear\n* README uses real install commands only\n* Experimental tools are labeled experimental\n* Registry metadata has the right category and positioning\n\nYou can automate this process using a script or a tool like `mcp-registry-readiness-check`.\n\n**Step 2: Run chat-style QA**\n\nUse a matrix like the one provided in the lesson to test whether models actually use the MCP tool in realistic workflows. The matrix should have the following columns:\n\n| Query | Tool called? | Correct lesson? | Helpful answer? | No hallucination? |\n|---|---|---|---|---|\n| DCO failed on GitHub | | | | |\n| pip install times out | | | | |\n| secret scan blocked PR | | | | |\n| irrelevant negative query | | | | |\n\nYou can fill in the matrix with real data and scenarios to test the", "metrics": { "length": 1134, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 1, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "MCP intake: agents submit failures without GitHub account (mcp-intake-no-account-submission)", "condition": "plain", "status": 200, "content": "The error \"MCP intake: agents submit failures without GitHub account (mcp-intake-no-account-submission)\" typically occurs when an agent is submitting a failure report without a valid GitHub account associated with it.\n\nTo fix this issue, you'll need to update the agent's configuration to include a valid GitHub account. Here's a step-by-step guide to resolve the issue:\n\n**Prerequisites:**\n\n1. Ensure you have a GitHub account and have created a personal access token with the necessary permissions.\n2. Familiarize yourself with the agent's configuration file (usually `agent.yml` or `agent.json`).\n\n**Step 1: Update the agent configuration**\n\nOpen the agent configuration file in a text editor and locate the `github` section. If it doesn't exist, add it:\n\n```yml\n# agent.yml (example)\ngithub:\n token: \"your-personal-access-token\"\n username: \"your-github-username\"\n```\n\nReplace `\"your-personal-access-token\"`, `\"your-github-username\"`, and other placeholders with your actual GitHub credentials.\n\n**Step 2: Save the changes**\n\nSave the updated configuration file.\n\n**Step 3: Restart the agent**\n\nRestart the agent process to apply the changes:\n\n```bash\n", "metrics": { "length": 1157, "commands": 5, "command_list": [ "Replace `\"your-personal-access-token\"`, `\"your-github-username\"`, and other placeholders with your actual GitHub credentials.", "**Step 2: Save the changes**", "Save the updated configuration file.", "**Step 3: Restart the agent**", "Restart the agent process to apply the changes:" ], "has_command_block": true, "actionable": false, "inline_code_count": 6, "lesson_hits": 1, "lesson_hit_rate": 0.167 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "MCP intake: agents submit failures without GitHub account (mcp-intake-no-account-submission)", "condition": "with_lesson", "status": 200, "content": "To fix the error, you'll need to add the `mcp-intake` tool to your environment. Here's a step-by-step guide:\n\n**Step 1: Install the `mcp-intake` tool**\n\nYou can install the `mcp-intake` tool using pip:\n```bash\npip install mcp-intake\n```\n**Step 2: Add the `mcp-intake` tool to your environment**\n\nAdd the following line to your `~/.bashrc` or `~/.zshrc` file to make the `mcp-intake` tool available in your shell:\n```bash\nexport PATH=$PATH:$(pwd)/mcp-intake\n```\nReplace `(pwd)` with the actual path to the `mcp-intake` tool.\n\n**Step 3: Configure the `mcp-intake` tool**\n\nCreate a configuration file for the `mcp-intake` tool:\n```bash\nmkdir -p ~/.mcp-intake\n```\nEdit the configuration file with the following contents:\n```yml\n---\nsubmit:\n type: json\n fields:\n - name: description\n type: string\n required: true\n - name: failure\n type: object\n ", "metrics": { "length": 867, "commands": 3, "command_list": [ "pip install mcp-intake", "export PATH=$PATH:$(pwd)/mcp-intake", "mkdir -p ~/.mcp-intake" ], "has_command_block": true, "actionable": true, "inline_code_count": 17, "lesson_hits": 1, "lesson_hit_rate": 0.167 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "MCP Server 测试 — 直接调用 handler 跳过 stdio 传输 (mcp-server-direct-handler-testing)", "condition": "plain", "status": 200, "content": "The error message you're encountering, \"MCP Server 测试 — 直接调用 handler 跳过 stdio 传输 (mcp-server-direct-handler-testing)\", is not specific to a programming language, but rather a command-line interface (CLI) error related to the MCP Server.\n\nHere's a step-by-step guide to fix the issue:\n\n**Prerequisites:**\n\n* Make sure you have the latest version of MCP Server installed on your system.\n* Familiarize yourself with the MCP Server command-line interface (CLI).\n\n**Fix:**\n\n1. **Check the MCP Server version:**\n\n * Open a command prompt or terminal and navigate to the directory where MCP Server is installed.\n * Run the following command to check the current version of MCP Server: `mcp-server --version`\n\n * Take note of the version number. If you're using an older version, consider updating to the latest version.\n\n2. **Disable stdio transmission:**\n\n * Run the following command to disable stdio transmission for the MCP Server: `mcp-server --disable-stdio-transmission`\n\n * If you want to enable stdio transmission again, run the following command: `mcp-server --enable-stdio-trans", "metrics": { "length": 1113, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 2, "lesson_hits": 2, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "MCP Server 测试 — 直接调用 handler 跳过 stdio 传输 (mcp-server-direct-handler-testing)", "condition": "with_lesson", "status": 200, "content": "The error message \"MCP Server 测试 — 直接调用 handler 跳过 stdio 传输 (mcp-server-direct-handler-testing)\" indicates that the MCP Server is skipping the stdio transmission when directly calling the handler. This is a known issue in the MCP Server, and the solution is to directly call the JSON-RPC handler without starting a subprocess.\n\nHere's a concrete, actionable fix with exact commands:\n\n**Step 1: Update the MCP Server code**\n\nUpdate the `handle_request` function in the `scripts.mcp_server` module to return the result directly without writing to stdout:\n```python\n# scripts/mcp_server.py\n\ndef handle_request(request):\n # Your existing logic here\n return {\"result\": result}\n```\n**Step 2: Update the test code**\n\nUpdate the test code to use the `rpc` function directly without calling `handle_request` with `stdio=True`:\n```python\n# test_mcp_server.py\n\nfrom scripts.mcp_server import rpc\n\ndef test_search():\n resp = rpc(\"tools/call\", {\n \"name\": \"misakanet_search\",\n \"arguments\": {\"query\": \"test\"},\n })\n result = json.loads(resp[\"result\"][\"content\"][0][\"text\"])\n", "metrics": { "length": 1087, "commands": 2, "command_list": [ "**Step 2: Update the test code**", "Update the test code to use the `rpc` function directly without calling `handle_request` with `stdio=True`:" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Context Mode: Reducing Claude Code Context Consumption by 98% (mcp-server-that-reduces-claude-code-context-consumption-by-9)", "condition": "plain", "status": 200, "content": "The error you're encountering is related to the amount of Claude code context being consumed by the MCP server. This is typically a result of excessive logging or high system load. Here are some concrete, actionable steps to resolve this issue:\n\n**Step 1: Check the logging level**\n\nClaude code context is often consumed due to excessive logging. Check the logging level of the MCP server by running the following command:\n\n```bash\nmcp-server logs level\n```\n\nThis will display the current logging level. If it's set to DEBUG, try reducing it to INFO or WARNING.\n\n**Step 2: Increase the logging threshold**\n\nIf reducing the logging level doesn't solve the issue, you can increase the logging threshold to filter out unnecessary logs. Run the following command:\n\n```bash\nmcp-server logs level info\n```\n\nThis will set the logging level to INFO, which should reduce the amount of Claude code context consumed.\n\n**Step 3: Check for resource-intensive processes**\n\nHigh system load can also consume Claude code context. Check for resource-intensive processes running on the server:\n\n```bash\ntop -u $USER\n```\n\nLook for processes consuming excessive CPU or memory. You can also use `htop` or `sysdig` to monitor system activity.\n\n**", "metrics": { "length": 1224, "commands": 3, "command_list": [ "mcp-server logs level", "mcp-server logs level info", "top -u $USER" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 1, "lesson_hit_rate": 0.2 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Context Mode: Reducing Claude Code Context Consumption by 98% (mcp-server-that-reduces-claude-code-context-consumption-by-9)", "condition": "with_lesson", "status": 200, "content": "To fix the error, you need to implement the Context Mode solution provided. Here are the concrete, actionable steps with exact commands:\n\n**Step 1: Create a PreToolUse hook**\n\nThis hook will intercept tool outputs and process them in an isolated sandbox.\n\nCreate a new file `pre_tool_use.py` in the `mcp-server` directory:\n```python\nimport os\nimport subprocess\nimport json\n\ndef pre_tool_use(event):\n # Get the tool name and output\n tool_name = event['tool_name']\n output = event['output']\n\n # Process the output in an isolated sandbox\n process = subprocess.Popen(['python', '-c', f'import io; print(io.StringIO(output))'], stdout=subprocess.PIPE)\n stdout, _ = process.communicate()\n\n # Return the processed output\n return json.loads(stdout.decode('utf-8'))\n\nevent = {'tool_name': 'your_tool_name', 'output': 'your_tool_output'}\nresult = pre_tool_use(event)\nprint(result)\n```\nReplace `your_tool_name` and `your_tool_output` with the actual values.\n\n**Step 2: Register the PreToolUse hook**\n\nIn the `mcp-server` directory, create a new file `config.py`:\n", "metrics": { "length": 1076, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 7, "lesson_hits": 2, "lesson_hit_rate": 0.4 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "MCP tool ERROR convention — inconsistency between failure paths causes silent (mcp-tool-error-convention-inconsistency)", "condition": "with_lesson", "status": 200, "content": "To fix the error, you need to update the `_claude()` function in the `generate_commit_message` module to include the `ERROR:` prefix in the timeout return string. Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Update the `_claude()` function**\n\nOpen the `generate_commit_message.py` file and update the `_claude()` function as follows:\n```python\ndef _claude():\n # ... (rest of the function remains the same)\n\n except subprocess.TimeoutExpired:\n return \"ERROR: claude -p timed out after 20s\"\n```\n**Step 2: Run the fix**\n\nRun the following commands to verify the fix:\n```bash\ngit status --short | head -5\ngit log --oneline -3\n```\nThese commands will check if the fix has been applied correctly.\n\n**Expected Output:**\n\nThe output should be:\n```\n(status)\n(recent)\n```\nThis indicates that the fix has been successful.\n\n**Verification**\n\nTo further verify the fix, you can run the following command:\n```bash\nmcp-tool --version\n```\nThis will check if the `ERROR:` prefix has been added to the timeout return string.\n\nIf everything is correct, you should", "metrics": { "length": 1078, "commands": 8, "command_list": [ "**Step 2: Run the fix**", "Run the following commands to verify the fix:", "These commands will check if the fix has been applied correctly.", "**Expected Output:**", "The output should be:" ], "has_command_block": true, "actionable": true, "inline_code_count": 14, "lesson_hits": 5, "lesson_hit_rate": 0.833 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "mcporter OAuth Authorization Must Be Serial: Concurrent Auth Causes client_id/state (mcporter-oauth-must-be-serial)", "condition": "with_lesson", "status": 200, "content": "To fix the \"mcporter OAuth Authorization Must Be Serial\" error, follow these steps:\n\n**Step 1: Run mcporter auth commands one at a time**\n\nTo avoid concurrent auth processes, run each `mcporter auth` command individually, completing the entire authorization flow (browser authorization + callback + token save) before starting the next one.\n\n```bash\n# Run the first auth command\nmcporter auth --client-id --redirect-uri --scope --code-verifier \n\n# Run the second auth command\nmcporter auth --client-id --redirect-uri --scope --code-verifier \n```\n\n**Step 2: Delete corrupted vault entries and clean token cache directory (if necessary)**\n\nIf you've already run multiple auth commands concurrently, delete the corrupted vault entries and clean the token cache directory.\n\n```bash\n# Delete vault entries for affected servers\nrm ~/.mcporter/credentials.json\n\n# Clean token cache directory\nrm -rf state.txt code_verifier.txt tokens.json\n```\n\n**Step 3: Give each server independent tokenCacheDir**\n\nTo reduce shared file conflicts, add the `--token-cache-dir", "metrics": { "length": 1152, "commands": 4, "command_list": [ "mcporter auth --client-id --redirect-uri --scope --code-verifier ", "mcporter auth --client-id --redirect-uri --scope --code-verifier ", "rm ~/.mcporter/credentials.json", "rm -rf state.txt code_verifier.txt tokens.json" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 1, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "MCP tool ERROR convention — inconsistency between failure paths causes silent (mcp-tool-error-convention-inconsistency)", "condition": "plain", "status": 200, "content": "The error message \"MCP tool ERROR convention — inconsistency between failure paths causes silent (mcp-tool-error-convention-inconsistency)\" typically occurs when there's a mismatch in the error handling conventions used in different parts of the code. Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Identify the inconsistent error handling**\n\nTo identify the inconsistent error handling, you'll need to check the error handling conventions used in different parts of the code. You can do this by looking at the `try-catch` blocks and error handling code in your project.\n\n**Step 2: Update error handling conventions**\n\nTo fix the error, you'll need to update the error handling conventions to be consistent throughout the code. Here are some steps to follow:\n\n**Step 3: Update the `try-catch` block**\n\nOpen the `try-catch` block where the error is occurring and update the error handling to match the convention used elsewhere in the code. For example, if you're using `try-catch` blocks with `catch` clauses, update the `catch` clause to match the convention used elsewhere in the code.\n\n```bash\n# Before\ntry {\n // code that may throw an error\n} catch (Exception e) {\n //", "metrics": { "length": 1197, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 6, "lesson_hits": 3, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "mcporter OAuth Authorization Must Be Serial: Concurrent Auth Causes client_id/state (mcporter-oauth-must-be-serial)", "condition": "plain", "status": 200, "content": "The error \"OAuth Authorization Must Be Serial: Concurrent Auth Causes client_id/state (mcporter-oauth-must-be-serial)\" typically occurs when you're trying to authenticate with the mcporter OAuth API in a concurrent or parallel environment, such as a multi-threaded or multi-process application.\n\nHere's a concrete, actionable fix with exact commands to resolve this issue:\n\n**Step 1: Understand the issue**\n\nThe mcporter OAuth API requires that the client ID and state be sent in a serial, non-concurrent manner. This means that you should not try to authenticate with the API from multiple threads or processes simultaneously.\n\n**Step 2: Use a serial authentication mechanism**\n\nTo resolve this issue, you can use a serial authentication mechanism, such as using a lock or a semaphore to ensure that only one thread or process can authenticate with the API at a time.\n\nHere's an example using Python and the `threading` module:\n\n```python\nimport threading\n\nclass McporterOAuth:\n def __init__(self, client_id, client_secret, redirect_uri):\n self.client_id = client_id\n self.client_secret = client_secret\n self.redirect_uri = redirect_uri\n self.lock = threading.Lock()\n\n def authenticate(self):\n with self.lock:\n ", "metrics": { "length": 1263, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 1, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "MisakaNet --heal UX Gap — Suggested queue_lesson.py Command Uses Wrong Flag (misakanet-heal-ux-gap-queue-lesson-flag-mismatch)", "condition": "with_lesson", "status": 200, "content": "To fix the CLI flag mismatch issue, you need to update the suggested commands in `search_knowledge.py` to match the actual flags used in `queue_lesson.py`. Here are the corrected commands:\n\n1. Update the `-f` flag to `--file`:\n\n Original suggested command: `MisakaNet --heal UX Gap — Suggested queue_lesson.py Command Uses Wrong Flag -f tests/fixtures/openclaw/unmatched_.log`\n\n Corrected command: `MisakaNet --heal UX Gap — Suggested queue_lesson.py Command Uses Wrong Flag --file tests/fixtures/openclaw/unmatched_.log`\n\n2. Update the `-d` flag to `--domain`:\n\n Original suggested command: `MisakaNet --heal UX Gap — Suggested queue_lesson.py Command Uses Wrong Flag -d openclaw`\n\n Corrected command: `MisakaNet --heal UX Gap — Suggested queue_lesson.py Command Uses Wrong Flag --domain openclaw`\n\n3. Update the domain placeholder:\n\n Original suggested command: `MisakaNet --heal UX Gap — Suggested queue_lesson.py Command Uses Wrong Flag `\n\n Corrected command: `MisakaNet --heal UX", "metrics": { "length": 1026, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 11, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "MisakaNet --heal UX Gap — Suggested queue_lesson.py Command Uses Wrong Flag (misakanet-heal-ux-gap-queue-lesson-flag-mismatch)", "condition": "plain", "status": 200, "content": "The error message indicates that there is a mismatch between the flag used in the `MisakaNet` command and the flag used in the `queue_lesson.py` script.\n\nHere's a step-by-step fix:\n\n**Step 1: Check the flags used in the `MisakaNet` command**\n\nRun the following command to see the flags used in the `MisakaNet` command:\n```bash\nMisakaNet --help\n```\nThis will display the available flags for the `MisakaNet` command.\n\n**Step 2: Check the flags used in the `queue_lesson.py` script**\n\nOpen the `queue_lesson.py` script in a text editor or IDE. Look for the flags used in the script. You can use the following command to see the flags used in the script:\n```bash\npython queue_lesson.py --help\n```\nThis will display the available flags for the `queue_lesson.py` script.\n\n**Step 3: Identify the mismatch**\n\nCompare the flags used in the `MisakaNet` command and the `queue_lesson.py` script. Identify the flag that is used differently in each script.\n\n**Step 4: Correct the mismatch**\n\nOnce you have identified the mismatch, correct it by updating the", "metrics": { "length": 1044, "commands": 2, "command_list": [ "MisakaNet --help", "python queue_lesson.py --help" ], "has_command_block": true, "actionable": true, "inline_code_count": 13, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "模型输出截断 / JSON 解析失败Handling (model-output-fix)", "condition": "with_lesson", "status": 200, "content": "To fix the error \"模型输出截断 / JSON 解析失败Handling (model-output-fix)\", you can follow these steps:\n\n**Step 1: Increase the `max_tokens` limit**\n\nIn your code, increase the `max_tokens` limit to a higher value, such as 8192 or more. You can do this by adding the following line of code:\n```python\nmax_tokens=8192\n```\nAdd this line of code to your `client.messages.create()` function.\n\n**Step 2: Add a prompt to request complete JSON output**\n\nModify your prompt to request complete JSON output, like this:\n```python\nprompt=\"输出完整的 JSON,不要省略任何字段\"\n```\nAdd this line of code to your `client.messages.create()` function.\n\n**Step 3: Implement a function to detect truncated responses**\n\nCreate a function to detect truncated responses, like this:\n```python\ndef is_truncated(response_text: str) -> bool:\n \"\"\"检查是否被截断\"\"\"\n truncated_markers = [\n '...', 省略号结尾\n '...\"', 字符串未闭合\n '{...}', 对象被省略\n '\"', 字符串未闭合\n ]\n", "metrics": { "length": 971, "commands": 6, "command_list": [ "Add this line of code to your `client.messages.create()` function.", "**Step 2: Add a prompt to request complete JSON output**", "Modify your prompt to request complete JSON output, like this:", "Add this line of code to your `client.messages.create()` function.", "**Step 3: Implement a function to detect truncated responses**" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 3, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "模型输出截断 / JSON 解析失败Handling (model-output-fix)", "condition": "plain", "status": 200, "content": "The error \"模型输出截断 / JSON 解析失败\" (which translates to \"Model output truncation / JSON parsing failed\" in English) is often encountered when there's a problem with the model output or the JSON parsing process.\n\nHere's a concrete and actionable fix with exact commands:\n\n**Fix 1: Check the Model Output**\n\n1. Check the model's output to ensure it's not truncated or corrupted. You can do this by printing the model's output:\n```bash\npython -c \"import your_model; print(your_model.predict(input_data))\"\n```\nReplace `your_model` with the actual name of your model and `input_data` with the input data that generated the output.\n\n**Fix 2: Verify the JSON Parsing**\n\n1. Check the JSON parsing process to ensure it's working correctly. You can do this by printing the JSON output:\n```bash\npython -c \"import your_model; import json; print(json.dumps(your_model.predict(input_data)))\"\n```\nReplace `your_model` with the actual name of your model and `input_data` with the input data that generated the output.\n\n**Fix 3: Check for Encoding Issues**\n\n1. Check if there are any encoding issues with the model output or JSON parsing", "metrics": { "length": 1116, "commands": 2, "command_list": [ "python -c \"import your_model; print(your_model.predict(input_data))\"", "python -c \"import your_model; import json; print(json.dumps(your_model.predict(input_data)))\"" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Multi-Forum Scraping Architecture — API vs Playwright (multi-forum-scraping-architecture)", "condition": "with_lesson", "status": 200, "content": "The error you're experiencing seems to be related to the usage of Playwright in your code. Playwright is a browser automation library, and it requires a browser instance to be launched before you can use it. However, in your example, you're trying to import Playwright without specifying the browser type or launching the browser.\n\nHere's a concrete, actionable fix for your code:\n\n**Step 1: Install Playwright**\n\nYou need to install Playwright using npm or yarn. Run the following command in your terminal:\n\n```bash\nnpm install playwright\n```\n\nor\n\n```bash\nyarn add playwright\n```\n\n**Step 2: Import Playwright and specify the browser type**\n\nIn your JavaScript file, import Playwright and specify the browser type. Here's an example:\n\n```javascript\nconst { chromium } = require('playwright');\n\n(async () => {\n const browser = await chromium.launch();\n const context = await browser.newContext();\n const page = await context.newPage();\n\n // Your code here\n await page.goto('https://example.com');\n await page.waitForSelector('your-selector');\n await page.screenshot({ path: 'screenshot.png' });\n\n await browser.close();\n})();\n```\n\nReplace `'https://example.com'`", "metrics": { "length": 1169, "commands": 2, "command_list": [ "npm install playwright", "yarn add playwright" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 2, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Multi-Forum Scraping Architecture — API vs Playwright (multi-forum-scraping-architecture)", "condition": "plain", "status": 200, "content": "I don't see any error in your prompt. However, I'll provide a general solution for the multi-forum scraping architecture using API vs Playwright.\n\n**API Approach:**\n\nIf you're using APIs for scraping, ensure that you're respecting the terms of service of each forum. Here's a general approach:\n\n1. Inspect the API endpoint for each forum to understand the request parameters and response format.\n2. Use a programming language like Python or JavaScript to make HTTP requests to the API endpoints.\n3. Parse the JSON responses and extract the required data.\n\nHere's a simple example using Python and the `requests` library:\n\n```bash\npip install requests\n```\n\n```python\nimport requests\n\n# Define the API endpoints and parameters\nforums = {\n 'Reddit': {'url': 'https://www.reddit.com/r/{name}/.json', 'params': {'limit': 100}},\n 'Stack Overflow': {'url': 'https://api.stackexchange.com/2.3/questions?order=desc&sort=activity&site=stackoverflow', 'params': {'limit': 100}}\n}\n\n# Loop through each forum and extract data\nfor name, api in forums.items():\n response = requests.get(api['url'], params=api['params", "metrics": { "length": 1110, "commands": 1, "command_list": [ "pip install requests" ], "has_command_block": true, "actionable": true, "inline_code_count": 2, "lesson_hits": 1, "lesson_hit_rate": 0.167 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Fix Node.js ECONNRESET Connection Reset Error in n8n Webhook HTTP Requests (n8n-nodejs-econnreset-connection-reset-fix)", "condition": "with_lesson", "status": 200, "content": "Here's a step-by-step guide to fix the ECONNRESET connection reset error in n8n Webhook HTTP Requests:\n\n**Step 1: Increase Keep-Alive Socket Expiration**\n\nUpdate the `keepaliveTimeout` setting in the `n8n.json` file to a higher value.\n\n```bash\nsudo nano /usr/local/etc/n8n/n8n.json\n```\n\nAdd the following line to the file:\n\n```json\n\"keepaliveTimeout\": 300\n```\n\nThis sets the keep-alive socket expiration to 5 minutes.\n\n**Step 2: Configure Reverse Proxy & Firewall Timeouts**\n\nCheck the reverse proxy and firewall settings to ensure they are not dropping long-polling connections.\n\nFor Nginx:\n\n```bash\nsudo nano /etc/nginx/nginx.conf\n```\n\nAdd the following lines to the file:\n\n```nginx\nhttp {\n ...\n keepalive_timeout 300; # 5 minutes\n proxy_read_timeout 300; # 5 minutes\n ...\n}\n```\n\nFor Traefik:\n\n```bash\nsudo traefik configuration save\n```\n\nAdd the following lines to the `traefik.yml` file:\n\n```yml\nlog:\n level: DEBUG\n\nproviders:\n docker:\n", "metrics": { "length": 956, "commands": 8, "command_list": [ "sudo nano /usr/local/etc/n8n/n8n.json", "This sets the keep-alive socket expiration to 5 minutes.", "**Step 2: Configure Reverse Proxy & Firewall Timeouts**", "Check the reverse proxy and firewall settings to ensure they are not dropping long-polling connections.", "For Nginx:" ], "has_command_block": true, "actionable": true, "inline_code_count": 13, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Fix Node.js ECONNRESET Connection Reset Error in n8n Webhook HTTP Requests (n8n-nodejs-econnreset-connection-reset-fix)", "condition": "plain", "status": 200, "content": "The ECONNRESET error in Node.js is usually caused by a temporary network issue or a misconfigured connection. Here's a concrete, actionable fix for the n8n Webhook HTTP requests:\n\n**Step 1: Update n8n to the latest version**\n\nFirst, make sure you're running the latest version of n8n. You can update n8n using the following command:\n\n```bash\nn8n upgrade\n```\n\n**Step 2: Update the HTTP client**\n\nThe `econnreset` error can be caused by an outdated HTTP client. You can update the HTTP client using the following command:\n\n```bash\nnpm install --save @n8n/workflow-engine@latest @n8n/core@latest\n```\n\n**Step 3: Configure the HTTP client**\n\nCreate a new file named `http-client-config.js` in the `config` directory of your n8n installation (usually `~/.n8n/config/http-client-config.js`):\n\n```javascript\nmodule.exports = {\n maxRedirects: 5,\n maxRetries: 3,\n retryDelay: 500,\n timeout: 10000,\n};\n```\n\nThis configuration sets the maximum redirects, retries, and retry delay for the HTTP client", "metrics": { "length": 991, "commands": 2, "command_list": [ "n8n upgrade", "npm install --save @n8n/workflow-engine@latest @n8n/core@latest" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "npm install EACCES permission error on Linux and macOS (npm-eacces-permission-error-linux)", "condition": "with_lesson", "status": 200, "content": "To fix the EACCES permission error when installing packages globally with npm, follow these steps:\n\n**Step 1: Configure npm to use a user-owned global directory**\n\nOpen a terminal and run the following commands:\n\n```bash\n# Create a new directory for the global npm installation\nmkdir -p ~/.npm-global\n\n# Set the prefix for npm to use the new global directory\nnpm config set prefix ~/.npm-global\n\n# Add the new prefix to the PATH environment variable\nexport PATH=~/.npm-global/bin:$PATH\n```\n\n**Step 2: Add the PATH line to your shell configuration file**\n\nYou need to add the PATH line to your shell configuration file (e.g., `~/.bashrc`, `~/.zshrc`, or `~/.profile`) to make the changes persistent. Run one of the following commands to add the line:\n\n```bash\n# For Bash shell\necho \"export PATH=~/.npm/global/bin:\\$PATH\" >> ~/.bashrc\n\n# For Zsh shell\necho \"export PATH=~/.npm/global/bin:\\$PATH\" >> ~/.zshrc\n```\n\n**Step 3: Verify the new configuration**\n\nRun the following commands to verify the changes:\n\n```bash\n# Print the updated PATH variable", "metrics": { "length": 1045, "commands": 5, "command_list": [ "mkdir -p ~/.npm-global", "npm config set prefix ~/.npm-global", "export PATH=~/.npm-global/bin:$PATH", "echo \"export PATH=~/.npm/global/bin:\\$PATH\" >> ~/.bashrc", "echo \"export PATH=~/.npm/global/bin:\\$PATH\" >> ~/.zshrc" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Node.js missing require inside try/catch silently kills win32 code path (nodejs-missing-require-inside-try-catch)", "condition": "with_lesson", "status": 200, "content": "To fix the issue, you need to move the `require` statements outside the `try/catch` block. Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Move require statements to top level**\n\nOpen your JavaScript file and move the `require` statements for `os` and `path` to the top level, outside the `try/catch` block:\n\n```javascript\nconst os = require(\"node:os\");\nconst path = require(\"node:path\");\n\ntry {\n const tmpDir = os.tmpdir();\n const marker = path.join(tmpDir, \"marker.txt\");\n // spawn handler...\n} catch (_) {\n // Swallows ALL errors, including ReferenceError from missing require\n}\n```\n\n**Step 2: Verify the fix**\n\nAfter making the change, run your tests again to verify that the issue is resolved. You should no longer see the \"marker: not found\" error.\n\n**Additional suggestion**\n\nTo further improve the code, you can consider adding a `console.error` statement inside the `catch` block to log the error and provide more insight into what's happening:\n\n```javascript\ntry {\n const tmpDir = os.tmpdir();\n const marker = path.join(tmpDir, \"marker.txt\");\n ", "metrics": { "length": 1078, "commands": 4, "command_list": [ "**Step 2: Verify the fix**", "After making the change, run your tests again to verify that the issue is resolved. You should no longer see the \"marker: not found\" error.", "**Additional suggestion**", "To further improve the code, you can consider adding a `console.error` statement inside the `catch` block to log the error and provide more insight into what's happening:" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "npm install EACCES permission error on Linux and macOS (npm-eacces-permission-error-linux)", "condition": "plain", "status": 200, "content": "**Fixing EACCES Permission Error with npm on Linux and macOS**\n\nThe EACCES permission error occurs when npm is unable to access a file or directory due to insufficient permissions. Here's a step-by-step solution to resolve this issue:\n\n**Method 1: Change the ownership of the npm installation directory**\n\n1. **Find the npm installation directory**: Run the following command to find the path where npm is installed:\n ```bash\nnpm config get prefix\n```\n This will give you the path where npm is installed.\n\n2. **Change the ownership of the npm installation directory**:\n ```bash\nsudo chown -R $USER:$USER /path/to/npm/installation/directory\n```\n Replace `/path/to/npm/installation/directory` with the actual path returned by `npm config get prefix`.\n\n3. **Verify the ownership**:\n ```bash\nls -ld /path/to/npm/installation/directory\n```\n This should display the ownership of the directory as `rwxr-xr-x` (owner has read, write, and execute permissions, group has read and execute permissions, others have read and execute permissions).\n\n**Method 2: Use `sudo` with `npm install`**\n\n1. **Run", "metrics": { "length": 1100, "commands": 3, "command_list": [ "npm config get prefix", "sudo chown -R $USER:$USER /path/to/npm/installation/directory", "ls -ld /path/to/npm/installation/directory" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 2, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Node.js missing require inside try/catch silently kills win32 code path (nodejs-missing-require-inside-try-catch)", "condition": "plain", "status": 200, "content": "The error you're encountering is due to a known issue in Node.js where it silently kills the child process when it encounters a `require` statement inside a `try/catch` block. This can happen when running Windows-specific code inside a Node.js script.\n\nTo fix this issue, you can use the following approach:\n\n**Method 1: Using `process.on('exit')`**\n\nCreate a new file named `child_process.js` and add the following code:\n```javascript\nconst fs = require('fs');\nconst childProcess = require('child_process');\n\n// Run the Windows-specific code\nconst child = childProcess.spawn('your-win32-code-path.exe');\n\n// Catch the exit event\nprocess.on('exit', (code) => {\n if (code === 0) {\n console.log('Windows-specific code executed successfully');\n } else {\n console.log('Error executing Windows-specific code');\n }\n});\n```\nReplace `'your-win32-code-path.exe'` with the actual path to your Windows-specific code.\n\n**Method 2: Using `child_process.execFileSync`**\n\nCreate a new file named `child_process.js` and add the following code:\n```javascript\nconst fs = require('fs');\nconst childProcess = require('child_process');\n\n", "metrics": { "length": 1125, "commands": 3, "command_list": [ "Replace `'your-win32-code-path.exe'` with the actual path to your Windows-specific code.", "**Method 2: Using `child_process.execFileSync`**", "Create a new file named `child_process.js` and add the following code:" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 5, "lesson_hit_rate": 0.833 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "OpenAI 兼容 API 的通用调用格式 (openai-compatible-api-call)", "condition": "with_lesson", "status": 200, "content": "The error message you're encountering is related to the OpenAI compatible API call format. To fix this, you need to modify your API call to match the format of the service you're using.\n\nAssuming you're using the Ollama service, here's the corrected code:\n\n```bash\npython\nimport requests\nimport json\n\nurl = \"http://localhost:11434/v1/chat/completions\"\nheaders = {\"Content-Type\": \"application/json\"}\n\npayload = {\n \"model_id\": \"qwen2.5:7b\",\n \"messages\": [\n {\"role\": \"system\", \"content\": \"你是专业助手\"},\n {\"role\": \"user\", \"content\": \"你好\"}\n ],\n \"temperature\": 0.7,\n \"max_tokens\": 1024,\n \"stream\": False\n}\n\nresp = requests.post(url, headers=headers, json=payload)\ndata = resp.json()\nprint(data[\"choices\"][0][\"message\"][\"content\"])\n```\n\nHere's a brief explanation of the changes:\n\n- `model` is replaced with `model_id` as per the Ollama service's API documentation.\n- The `model` parameter should be set to the ID of the model you want to use,", "metrics": { "length": 964, "commands": 18, "command_list": [ "python", "import requests", "import json", "url = \"http://localhost:11434/v1/chat/completions\"", "headers = {\"Content-Type\": \"application/json\"}" ], "has_command_block": true, "actionable": true, "inline_code_count": 4, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "OpenAI 兼容 API 的通用调用格式 (openai-compatible-api-call)", "condition": "plain", "status": 200, "content": "The error message you're encountering is due to the OpenAI API requiring a specific format for API calls. Here's how to fix it:\n\n**Error Message:**\n\n```\nOpenAI 兼容 API 的通用调用格式 (openai-compatible-api-call)\n```\n\n**Fix:**\n\nThe error message indicates that the API call is not in the correct format. To fix this, you'll need to modify your API call to use the OpenAI compatible API format.\n\n**API Call Format:**\n\nThe OpenAI API expects the following format for API calls:\n\n```bash\ncurl -X POST \\\n https://api.openai.com/v1/models/{model_id}/predictions \\\n -H 'Content-Type: application/json' \\\n -d '{\"input_text\": \"Your input text here\"}'\n```\n\nReplace `{model_id}` with the actual ID of the OpenAI model you're using.\n\n**Example:**\n\nLet's say you're using the `text-api` model. You can make a prediction like this:\n\n```bash\ncurl -X POST \\\n https://api.openai.com/v1/models/text-api/predictions \\\n -H 'Content-Type: application/json' \\\n -d '{\"input_text\": \"Your text here\"}'\n``", "metrics": { "length": 977, "commands": 5, "command_list": [ "OpenAI 兼容 API 的通用调用格式 (openai-compatible-api-call)", "curl -X POST \\", "https://api.openai.com/v1/models/{model_id}/predictions \\", "-H 'Content-Type: application/json' \\", "-d '{\"input_text\": \"Your input text here\"}'" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "OPENCLAW_ERROR_HANDLER — Standard protocol for CLI fatal error external hooks (openclaw-fatal-error-hook-protocol)", "condition": "with_lesson", "status": 200, "content": "To address the issues with `OPENCLAW_ERROR_HANDLER`, you can create a custom handler that follows a secure protocol. Here's an example of how to implement it:\n\n**Create a custom handler**\n\nCreate a new file named `openclaw-fatal-error-handler.js` with the following content:\n```javascript\nconst fs = require('fs');\nconst path = require('path');\nconst { spawn } = require('child_process');\nconst { stdin, stdout, stderr } = require('process');\n\nconst handler = async (error, stdout, stderr) => {\n // Create a secure log file\n const logFilePath = '/var/log/openclaw-errors.log';\n fs.writeFileSync(logFilePath, `Error: ${error.message}\\n`);\n\n // Send the error message to a secure webhook\n const webhookUrl = 'https://your-webhook-url.com/openclaw-error';\n const headers = { 'Content-Type': 'application/json' };\n const body = JSON.stringify({ error: error.message });\n const options = { method: 'POST', headers, body };\n const response = await fetch(webhookUrl, options);\n if (!response.ok) {\n console.error(`Failed to send error to webhook: ${response.status}`);\n }\n\n ", "metrics": { "length": 1081, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 4, "lesson_hits": 3, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "openclaw gateway dynamic module missing (openclaw-gateway-dynamic-module-missing)", "condition": "with_lesson", "status": 200, "content": "To fix the error \"openclaw gateway dynamic module missing (openclaw-gateway-dynamic-module-missing)\", you need to restart the OpenClaw Gateway service and update the credentials file.\n\nHere are the steps:\n\n1. Restart the OpenClaw Gateway service:\n```bash\nsystemctl --user restart openclaw-gateway\n```\nThis will restart the service and regenerate the dynamic modules.\n\n2. Update the credentials file:\n```json\n{\n \"version\": 1,\n \"allowFrom\": [\n \"ou_3dc2416c9a7a4c297a19d87fd8edbccc\",\n \"oc_51cd445c9162f2d622f1a984e8bc3f4f\"\n ]\n}\n```\nYou can add the group ID to the `allowFrom` list in the `~/.openclaw/credentials/feishu-default-allowFrom.json` file.\n\n3. Restart the OpenClaw Gateway service again:\n```bash\nsystemctl --user restart openclaw-gateway\n```\nThis will apply the changes to the credentials file and restart the service.\n\nTo verify the fix, you can check the following:\n\n* Run the following command to check", "metrics": { "length": 921, "commands": 3, "command_list": [ "systemctl --user restart openclaw-gateway", "You can add the group ID to the `allowFrom` list in the `~/.openclaw/credentials/feishu-default-allowFrom.json` file.", "3. Restart the OpenClaw Gateway service again:" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 2, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "OPENCLAW_ERROR_HANDLER — Standard protocol for CLI fatal error external hooks (openclaw-fatal-error-hook-protocol)", "condition": "plain", "status": 200, "content": "The error you're encountering is related to the OpenCLAW framework, which is used for testing and validating OpenCL kernels. The error `OPENCLAW_ERROR_HANDLER` is typically raised when there's an issue with the fatal error handler.\n\nTo fix this error, you'll need to create or modify the fatal error handler function. Here's a step-by-step guide to create a custom fatal error handler:\n\n**Step 1: Create a new file for the fatal error handler**\n\nCreate a new file named `fatal_error_handler.claw` in the OpenCLAW installation directory (usually `~/.openclaw/fatal_error_handler.claw` or `C:\\Users\\YourUsername\\.openclaw\\fatal_error_handler.claw`).\n\n**Step 2: Define the fatal error handler function**\n\nIn the `fatal_error_handler.claw` file, define a function that takes two arguments: `error_code` and `error_message`. This function will be called when an error occurs.\n\nHere's an example implementation:\n```claw\nvoid fatal_error_handler(int error_code, const char* error_message) {\n printf(\"FATAL ERROR: %d - %s\\n\", error_code, error_message);\n // Add additional error handling or logging as needed\n", "metrics": { "length": 1107, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 7, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "openclaw prefer cli and policy over direct edit (openclaw-prefer-cli-and-policy-over-direct-edit)", "condition": "with_lesson", "status": 200, "content": "To fix the error `openclaw prefer cli and policy over direct edit (openclaw-prefer-cli-and-policy-over-direct-edit)`, you can follow these steps:\n\n**Step 1: Remove direct file editing from your configuration**\n\nOpen your `~/.openclaw/config.yaml` file in a text editor and remove any direct file editing lines, such as:\n\n```yaml\nmodel:\n default: gpt-4o-mini\n # TEMP HACK - remove after 2026-07-20, tracked in ISSUE-4321\n```\n\n**Step 2: Use the official CLI to configure your model**\n\nUse the following commands to configure your model using the official CLI:\n\n```bash\nopenclaw config set model.default gpt-4o\nopenclaw config set gateway.timeout 30\n```\n\n**Step 3: Verify your configuration**\n\nUse the following command to verify that your configuration has been set correctly:\n\n```bash\nopenclaw config get model.default\n```\n\nThis should output `gpt-4o`.\n\n**Step 4: Remove temporary hack comments**\n\nIf you have any temporary hack comments in your configuration file, remove them now. For example:\n\n```yaml\nTEMP HACK - remove after 2026-", "metrics": { "length": 1036, "commands": 7, "command_list": [ "**Step 2: Use the official CLI to configure your model**", "Use the following commands to configure your model using the official CLI:", "**Step 3: Verify your configuration**", "Use the following command to verify that your configuration has been set correctly:", "This should output `gpt-4o`." ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "openclaw gateway dynamic module missing (openclaw-gateway-dynamic-module-missing)", "condition": "plain", "status": 200, "content": "The error \"openclaw gateway dynamic module missing\" typically occurs when the OpenCLAW gateway dynamic module is not properly installed or configured. Here's a step-by-step guide to resolve this issue:\n\n**Prerequisites:**\n\n* OpenCLAW installed on your system\n* Familiarity with Linux command-line interface (CLI)\n\n**Fix:**\n\n1. **Update OpenCLAW package:**\n ```bash\nsudo apt update\nsudo apt upgrade openclaw\n```\n This command updates the OpenCLAW package to the latest version, which may include the necessary dynamic module.\n\n2. **Reinstall OpenCLAW gateway dynamic module:**\n ```bash\nsudo apt install --reinstall openclaw-gateway-dynamic-module\n```\n This command reinstalls the OpenCLAW gateway dynamic module, which may resolve the missing issue.\n\n3. **Check for dependencies:**\n ```bash\nsudo apt install -f\n```\n This command checks for any missing dependencies and installs them.\n\n4. **Verify OpenCLAW installation:**\n ```bash\nopenclaw --version\n```\n This command checks the version of OpenCLAW installed on your system.\n\n5. **Restart OpenCLAW service (if necessary):**\n", "metrics": { "length": 1089, "commands": 5, "command_list": [ "sudo apt update", "sudo apt upgrade openclaw", "sudo apt install --reinstall openclaw-gateway-dynamic-module", "sudo apt install -f", "openclaw --version" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 2, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "OpenClaw 重装教训 — 删除前先停服务清残留 (openclaw-reinstall-lesson)", "condition": "with_lesson", "status": 200, "content": "Here's a concrete, actionable fix for the OpenClaw reinstall lesson:\n\n**Step 1: Stop and remove existing services**\n\n```bash\n# Stop the existing service\nsystemctl --user stop openclaw-gateway.service\n\n# Remove any remaining OpenClaw processes\npkill -f openclaw || true\n```\n\n**Step 2: Check for remaining processes**\n\n```bash\n# Check for any remaining OpenClaw processes\nps aux | grep openclaw\n# Expected output: Nothing\n\n# Check for any remaining OpenClaw connections\nss -tlnp | grep -E '18790|3456'\n# Expected output: Nothing\n```\n\n**Step 3: Uninstall global package**\n\n```bash\n# Uninstall the global OpenClaw package\nnpm uninstall -g openclaw\n```\n\n**Step 4: Clean up remaining directories**\n\n```bash\n# Remove any remaining OpenClaw directories\nrm -rf ~/.npm-global/lib/node_modules/openclaw\nrm -rf ~/.config/openclaw\n```\n\n**Step 5: Reinstall OpenClaw**\n\n```bash\n# Reinstall OpenClaw with the global package manager\nnpm install -g openclaw --prefix ~/.npm-global", "metrics": { "length": 962, "commands": 7, "command_list": [ "systemctl --user stop openclaw-gateway.service", "pkill -f openclaw || true", "ps aux | grep openclaw", "ss -tlnp | grep -E '18790|3456'", "npm uninstall -g openclaw" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "OpenClaw 重装教训 — 删除前先停服务清残留 (openclaw-reinstall-lesson)", "condition": "plain", "status": 200, "content": "The error \"OpenClaw 重装教训 — 删除前先停服务清残留 (openclaw-reinstall-lesson)\" typically occurs when OpenClaw is unable to remove residual services before reinstalling. Here's a step-by-step guide to resolve this issue:\n\n**Step 1: Stop OpenClaw services**\n\n1. Open the Command Prompt as an administrator:\n - Windows: Press the Windows key + X and select Command Prompt (Admin).\n - macOS: Open Terminal.\n\n2. Stop OpenClaw services:\n ```bash\nsudo service openclaw stop\n```\n\n**Step 2: Remove OpenClaw configuration files**\n\n1. Open the Terminal.\n2. Navigate to the OpenClaw configuration directory:\n ```bash\ncd /usr/local/openclaw/etc\n```\n (Adjust the path according to your OpenClaw installation location.)\n\n3. Remove the configuration files:\n ```bash\nsudo rm -rf *\n```\n\n**Step 3: Remove OpenClaw database files**\n\n1. Navigate to the OpenClaw database directory:\n ```bash\ncd /usr/local/openclaw/var\n```\n (Adjust the path according to your OpenClaw installation location.)\n\n2. Remove the database files", "metrics": { "length": 1003, "commands": 4, "command_list": [ "sudo service openclaw stop", "cd /usr/local/openclaw/etc", "sudo rm -rf *", "cd /usr/local/openclaw/var" ], "has_command_block": true, "actionable": false, "inline_code_count": 7, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "openclaw prefer cli and policy over direct edit (openclaw-prefer-cli-and-policy-over-direct-edit)", "condition": "plain", "status": 200, "content": "The error you're encountering is related to the OpenCLAW configuration. The error message indicates that OpenCLAW is set to prefer CLI and policy over direct edit. To resolve this issue, you'll need to modify the OpenCLAW configuration to allow direct edit.\n\nHere's a step-by-step guide to fix the issue:\n\n**For Windows users:**\n\n1. Open the Command Prompt as an administrator.\n2. Navigate to the OpenCLAW installation directory using the following command:\n ```bash\ncd C:\\Program Files\\OpenCLAW\n```\n Replace `C:\\Program Files\\OpenCLAW` with the actual path to the OpenCLAW installation directory on your system.\n\n3. Run the following command to edit the OpenCLAW configuration file:\n ```bash\nnotepad C:\\Program Files\\OpenCLAW\\config.xml\n```\n This will open the `config.xml` file in Notepad.\n\n4. Locate the following line in the `config.xml` file:\n ```xml\n\n```\n If this line exists, delete it. If it doesn't exist, add it with the following content:\n ```xml\n<", "metrics": { "length": 1054, "commands": 3, "command_list": [ "cd C:\\Program Files\\OpenCLAW", "notepad C:\\Program Files\\OpenCLAW\\config.xml", "If this line exists, delete it. If it doesn't exist, add it with the following content:" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 2, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Permission Denied / WSL NTFS 跨文件系统PermissionFix (permission-denied-fix)", "condition": "plain", "status": 200, "content": "The \"Permission Denied\" error in WSL (Windows Subsystem for Linux) when trying to access an NTFS file system is often caused by the lack of permission to read or write files on the NTFS partition. Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Enable WSL File System Access**\n\n1. Open a PowerShell or Command Prompt window on your Windows 10 or Windows 11 machine.\n2. Run the following command to enable WSL file system access:\n ```powershell\nwsl --set-default-version 2\n```\n or\n ```bash\nwsl --set-default-version 2\n```\n This will enable WSL 2, which supports file system access.\n\n**Step 2: Update the WSL File System**\n\n1. Run the following command to update the WSL file system:\n ```powershell\nwsl --update\n```\n or\n ```bash\nwsl --update\n```\n This will update the WSL file system to support file system access.\n\n**Step 3: Mount the NTFS Partition**\n\n1. Identify the NTFS partition you want to access. You can do this by running the following command:\n ```powershell\nw", "metrics": { "length": 1005, "commands": 8, "command_list": [ "or", "This will enable WSL 2, which supports file system access.", "**Step 2: Update the WSL File System**", "1. Run the following command to update the WSL file system:", "or" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 1, "lesson_hit_rate": 0.167 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Permission Denied / WSL NTFS 跨文件系统PermissionFix (permission-denied-fix)", "condition": "with_lesson", "status": 200, "content": "解决 WSL NTFS 跨文件系统 Permission Denied 错误的步骤如下:\n\n**步骤 1: 在 WSL 内部执行 permission_denied_fix 命令**\n\n```bash\nsudo cat /etc/wsl.conf << 'EOF'\n[automount]\nenabled = true\noptions = \"metadata,umask=22\"\nEOF\n```\n\n**步骤 2: 重启 WSL**\n\n```bash\nwsl --shutdown\n```\n\n**步骤 3: 改变所有权**\n\n```bash\nsudo chown -R $(id -u):$(id -g) ~/.hermes/\n```\n\n或者,增加所有用户的写入权限:\n\n```bash\nchmod -R u+w ~/.hermes/\n```\n\n如果是单个文件,则可以使用:\n\n```bash\nchmod u+w ~/.hermes/some_file\n```\n\n**步骤 4: 检查当前用户权限**\n\n```bash\nid\nls -la ~/.hermes/\nstat ~/.hermes/some_file\n```\n\n**步骤 5: 验证 fix 命令**\n\n```bash\nsudo cat /etc/wsl.conf << 'EOF'\necho \"Verification passed:", "metrics": { "length": 599, "commands": 12, "command_list": [ "sudo cat /etc/wsl.conf << 'EOF'", "[automount]", "enabled = true", "options = \"metadata,umask=22\"", "EOF" ], "has_command_block": true, "actionable": false, "inline_code_count": 12, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "pip install Network Timeout / SSL ErrorFix (pip-install-timeout-ssl)", "condition": "plain", "status": 200, "content": "The error you're experiencing is likely due to the fact that `pip-install-timeout-ssl` is not a valid package. \n\nInstead, you can use `pip install --upgrade pip` and then `pip install requests` and `pip install urllib3` to install the required packages.\n\nHere are the exact commands:\n\n```bash\n# Update pip\npython -m pip install --upgrade pip\n\n# Install requests and urllib3\npython -m pip install requests\npython -m pip install urllib3\n```\n\nIf you still encounter issues with SSL certificates, you can try the following:\n\n```bash\n# Install the certifi package\npython -m pip install certifi\n\n# Install the ca-certificate package\npython -m pip install ca-certificate\n```\n\nAfter installing these packages, try running your original command:\n\n```bash\npip install Network Timeout / SSL ErrorFix\n```\n\nIf you're still experiencing issues, it's possible that the package you're trying to install doesn't exist or is not compatible with your Python version.", "metrics": { "length": 947, "commands": 6, "command_list": [ "python -m pip install --upgrade pip", "python -m pip install requests", "python -m pip install urllib3", "python -m pip install certifi", "python -m pip install ca-certificate" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "pip install Network Timeout / SSL ErrorFix (pip-install-timeout-ssl)", "condition": "with_lesson", "status": 200, "content": "Here's a concrete, actionable fix for the pip install error:\n\n**Step 1: Update pip and install the latest version of certifi**\n\nOpen a terminal or command prompt and run the following commands:\n\n```bash\npython -m pip install --upgrade pip\npython -m pip install certifi\n```\n\n**Step 2: Set the global index URL to a fast and reliable mirror**\n\nSet the global index URL to a fast and reliable mirror, such as the one provided by Tsinghua University:\n\n```bash\npip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple\n```\n\n**Step 3: Verify the current configuration**\n\nRun the following command to verify the current configuration:\n\n```bash\npip config list\n```\n\nThis should output something like:\n\n```\nglobal.index-url='https://pypi.tuna.tsinghua.edu.cn/simple'\n```\n\n**Step 4: Install the package**\n\nNow you can install the package using pip:\n\n```bash\npip install \n```\n\nReplace `` with the name of the package you want to install.\n\nIf you encounter any issues during installation, you can try specifying a temporary index URL and increasing the timeout:\n\n```bash\npip install --default", "metrics": { "length": 1123, "commands": 6, "command_list": [ "python -m pip install --upgrade pip", "python -m pip install certifi", "pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple", "pip config list", "global.index-url='https://pypi.tuna.tsinghua.edu.cn/simple'" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 4, "lesson_hit_rate": 0.8 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Playwright 在受限容器/sandbox 启动 snap chromium:用 chrome-headless-shell + LD_LIBRARY_PATH 绕开 snap-confine (playwright-snap-chromium-libnss3-sandbox-launch)", "condition": "with_lesson", "status": 200, "content": "为了解决这个问题,我们需要使用 Playwright 缓存里的 `chrome-headless-shell`二进制,指定 `executablePath`,并注入 `LD_LIBRARY_PATH`。下面是具体的命令和步骤:\n\n1. 通过 Playwright 缓存里的 `chrome-headless-shell`二进制找到路径:\n ```javascript\nconst fs = require('node:fs');\nconst path = require('node:path');\n\nconst cacheRoot = path.join(\n process.env.HOME || '/root',\n '.cache/ms-playwright'\n);\nconst dirs = fs.readdirSync(cacheRoot)\n .filter(d => d.startsWith('chromium_headless_shell-'));\nconst shellPath = path.join(\n cacheRoot,\n dirs[0],\n 'chrome-linux/headless_shell'\n);\n```\n2. 使用 `executablePath` 指定 `chrome-headless-shell`二进制的路径:\n ```javascript\nconst browser = await playwright.chromium.launch({\n executablePath: shellPath,\n headless: true,\n args: [\n '--no-sandbox',\n '--disable-setuid-sandbox',\n '--disable-dev-shm-usage',\n '--disable-features=libnss3',\n '--disable-", "metrics": { "length": 846, "commands": 1, "command_list": [ "2. 使用 `executablePath` 指定 `chrome-headless-shell`二进制的路径:" ], "has_command_block": true, "actionable": false, "inline_code_count": 8, "lesson_hits": 5, "lesson_hit_rate": 0.833 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "PR Genius issue evaluator: batch review intake issues (pr-genius-issue-evaluator-for-intake)", "condition": "with_lesson", "status": 200, "content": "To resolve the PR Genius issue evaluator: batch review intake issues, you can follow these steps:\n\n1. First, update your GitHub repository to use the latest version of PR Genius. You can do this by running the following command in your terminal:\n\n ```bash\nprgenius update --repo Ikalus1988/MisakaNet\n```\n\n2. Next, evaluate all intake issues in batch mode using the following command:\n\n ```bash\nprgenius issue-batch --repo Ikalus1988/MisakaNet --label intake --limit 20\n```\n\n This command will evaluate the intake issues in batches of 20, providing you with a score (0-100), tier (low_risk / medium_risk / high_risk), quality_grade (A-F), is_spam, is_crawler_friendly, signals (positive/negative), and checklist (actionable items) for each issue.\n\n3. After running the `prgenius issue-batch` command, you can verify that the output is correct by checking the lessons file. Run the following command in your terminal:\n\n ```bash\ngrep -i mcp lessons/contrib/mcp-.md 2/dev/null | head -3\necho MCP verified\n``", "metrics": { "length": 1011, "commands": 2, "command_list": [ "prgenius update --repo Ikalus1988/MisakaNet", "prgenius issue-batch --repo Ikalus1988/MisakaNet --label intake --limit 20" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Playwright 在受限容器/sandbox 启动 snap chromium:用 chrome-headless-shell + LD_LIBRARY_PATH 绕开 snap-confine (playwright-snap-chromium-libnss3-sandbox-launch)", "condition": "plain", "status": 200, "content": "The error you're encountering is due to a limitation in the Playwright snap package for Chromium. To resolve this issue, you can try the following steps:\n\n**Method 1: Using `--no-sandbox` flag**\n\nYou can try running Playwright with the `--no-sandbox` flag, which will disable the sandboxing feature:\n\n```bash\nplaywright --no-sandbox launch --headless --chromium\n```\n\n**Method 2: Setting `LD_LIBRARY_PATH` environment variable**\n\nYou can also try setting the `LD_LIBRARY_PATH` environment variable to bypass the `snap-confine` issue:\n\n```bash\nexport LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu/libnss3.so\nplaywright launch --headless --chromium\n```\n\n**Method 3: Using `--disable-sandbox` flag (for Chromium 96 and later)**\n\nIf you're using Chromium 96 or later, you can try using the `--disable-sandbox` flag:\n\n```bash\nplaywright --disable-sandbox launch --headless --chromium\n```\n\n**Method 4: Using `--no-sandbox` and `--disable-extensions` flags (for Chromium 96 and later)**\n\n", "metrics": { "length": 993, "commands": 4, "command_list": [ "playwright --no-sandbox launch --headless --chromium", "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu/libnss3.so", "playwright launch --headless --chromium", "playwright --disable-sandbox launch --headless --chromium" ], "has_command_block": true, "actionable": true, "inline_code_count": 14, "lesson_hits": 2, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Python GBK Encoding Error — Windows/WSL 跨平台 (python-gbk-encoding-error)", "condition": "with_lesson", "status": 200, "content": "Here are the steps to fix the Python GBK Encoding Error in WSL:\n\n### Step 1: Specify encoding when reading and writing files\n\nUpdate your Python script to specify the encoding when reading and writing files:\n```python\n# Read file with UTF-8 encoding\nwith open(\"file.txt\", \"r\", encoding=\"utf-8\") as f:\n content = f.read()\n\n# Write file with UTF-8 encoding\nwith open(\"file.txt\", \"w\", encoding=\"utf-8\") as f:\n f.write(content)\n```\n### Step 2: Set environment variables (recommended for permanent solution)\n\nAdd the following lines to your `~/.bashrc` file to set the environment variables permanently:\n```bash\nexport PYTHONIOENCODING=utf-8\nexport LANG=C.UTF-8\n```\nThen, run the following command to apply the changes:\n```bash\nsource ~/.bashrc\n```\n### Step 3: Update system locale (optional)\n\nIf you want to update the system locale, run the following command:\n```bash\nsudo locale-gen zh_CN.UTF-8\n```\nThis will update the locale to Chinese (Simplified) using the UTF-8 encoding.\n\n### Step 4: Verify the changes\n\n", "metrics": { "length": 1014, "commands": 3, "command_list": [ "Add the following lines to your `~/.bashrc` file to set the environment variables permanently:", "Then, run the following command to apply the changes:", "If you want to update the system locale, run the following command:" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "PR Genius issue evaluator: batch review intake issues (pr-genius-issue-evaluator-for-intake)", "condition": "plain", "status": 200, "content": "I can guide you through the process of fixing the PR Genius issue evaluator. \n\nThe error you're experiencing is likely due to missing dependencies or incorrect configuration. Here's a step-by-step solution:\n\n**Step 1: Update the dependencies**\n\nRun the following command to update the dependencies:\n\n```bash\npip install --upgrade -r requirements.txt\n```\n\n**Step 2: Install the required packages**\n\nIf the above command doesn't resolve the issue, you might need to install additional packages. You can try the following:\n\n```bash\npip install pandas\npip install numpy\npip install scikit-learn\n```\n\n**Step 3: Check the configuration**\n\nPR Genius issue evaluator uses a configuration file named `pr_genius_config.py`. Make sure this file is in the correct location and contains the necessary settings.\n\n```python\n# pr_genius_config.py\n# Define your configuration here\nPR_GENIUS_API_KEY = 'YOUR_API_KEY'\nPR_GENIUS_BASE_URL = 'https://api.pr-genius.com'\n```\n\nReplace `'YOUR_API_KEY'` with your actual PR Genius API key.\n\n**Step 4: Check the environment variables**\n\nPR Genius issue evaluator also uses environment variables. Make sure the following variables are set:\n\n```bash\n", "metrics": { "length": 1171, "commands": 7, "command_list": [ "pip install --upgrade -r requirements.txt", "pip install pandas", "pip install numpy", "pip install scikit-learn", "Replace `'YOUR_API_KEY'` with your actual PR Genius API key." ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 1, "lesson_hit_rate": 0.167 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Python GBK Encoding Error — Windows/WSL 跨平台 (python-gbk-encoding-error)", "condition": "plain", "status": 200, "content": "The GBK encoding error in Python typically occurs when you're trying to read or write files using the GBK encoding on a system that doesn't support it. Here's a concrete, actionable fix:\n\n**Method 1: Install the `gbk` encoding package**\n\nYou can install the `gbk` encoding package using pip, which is Python's package manager. Open a terminal or command prompt and run the following command:\n\n```bash\nsudo apt-get update\nsudo apt-get install python3-gbk\n```\n\n**Method 2: Use the `chardet` library to detect the encoding**\n\nIf the above method doesn't work, you can try using the `chardet` library to detect the encoding of your files. First, install the `chardet` library using pip:\n\n```bash\npip3 install chardet\n```\n\nThen, use the following code to detect the encoding of a file:\n\n```python\nimport chardet\n\nwith open('your_file.txt', 'rb') as f:\n result = chardet.detect(f.read())\n print(result)\n```\n\nReplace `'your_file.txt'` with the path to your file.\n\n**Method 3: Use the `codecs` module to specify the encoding", "metrics": { "length": 1022, "commands": 3, "command_list": [ "sudo apt-get update", "sudo apt-get install python3-gbk", "pip3 install chardet" ], "has_command_block": true, "actionable": true, "inline_code_count": 12, "lesson_hits": 2, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Python 沙箱/受限环境 — PATH 和 sys.path 隔离 (python-sandbox-path-isolation)", "condition": "with_lesson", "status": 200, "content": "为了解决 Python 沙箱/受限环境 — PATH 和 sys.path 隔离问题,我们需要遵循以下步骤:\n\n1. 确认是否在正确的 venv 中\n2. 强制指定解释器(在 shell 中)\n3. 在沙箱中临时添加路径\n4. 检查 PATH(子进程会继承)\n5. 验证 import 来源\n\n下面是具体的命令和示例:\n\n**步骤 1: 确认是否在正确的 venv 中**\n\n```bash\n# 切换到正确的 venv\ncd /path/to/your/venv\n\n# 确认是否在正确的 venv 中\npython3 --version\npython3 -c 'import sys; print(sys.version)'\n```\n\n**步骤 2: 强制指定解释器(在 shell 中)**\n\n```bash\n# 指定解释器\n/path/to/venv/bin/python script.py\n```\n\n**步骤 3: 在沙箱中临时添加路径**\n\n```python\n# 在 Python 中临时添加路径\nimport sys\nimport os\n\nsys.path.insert(0, \"/path", "metrics": { "length": 502, "commands": 4, "command_list": [ "cd /path/to/your/venv", "python3 --version", "python3 -c 'import sys; print(sys.version)'", "/path/to/venv/bin/python script.py" ], "has_command_block": true, "actionable": false, "inline_code_count": 4, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Python 代码修改不生效 — stale .pyc Cache (python-pycache-stale)", "condition": "plain", "status": 200, "content": "The error you're encountering is due to a stale `.pyc` cache file. Here's a step-by-step solution to resolve this issue:\n\n**Method 1: Delete the stale `.pyc` cache manually**\n\n1. Locate the directory where your Python scripts are located. This is usually `C:\\Users\\YourUsername\\AppData\\Local\\Python\\Python3.x\\site-packages` (Windows) or `~/.local/lib/pythonX.X/site-packages/` (Linux/Mac).\n2. Open a command prompt or terminal.\n3. Navigate to the directory where you found in step 1 using the `cd` command. For example:\n - Windows: `cd C:\\Users\\YourUsername\\AppData\\Local\\Python\\Python3.x\\site-packages`\n - Linux/Mac: `cd ~/.local/lib/pythonX.X/site-packages/`\n4. Delete all the `.pyc` files in the directory using the `rm` command. For example:\n - Windows: `rm *.pyc`\n - Linux/Mac: `rm *.pyc`\n\n**Method 2: Use pip to delete the stale cache**\n\n1. Open a command prompt or terminal.\n2. Navigate to the directory where your Python scripts are located.\n3", "metrics": { "length": 959, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 10, "lesson_hits": 2, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Python 代码修改不生效 — stale .pyc Cache (python-pycache-stale)", "condition": "with_lesson", "status": 200, "content": "以下是具体的步骤来解决这个问题:\n\n**步骤 1:删除当前项目下所有 __pycache__ 目录**\n\n```bash\nfind . -type d -name __pycache__ -exec rm -rf {} +\n```\n\n**步骤 2: 同时删除散落的 .pyc 文件**\n\n```bash\nfind . -name \".pyc\" -delete\n```\n\n**步骤 3:针对单个模块清理**\n\n```bash\nrm -rf path/to/module/__pycache__\n```\n\n**步骤 4: 使用环境变量禁止 Python 写入字节码缓存**\n\n```bash\nexport PYTHONDONTWRITEBYTECODE=1\npython your_script.py\n```\n\n**步骤 5: 强制 Python 重新编译所有模块**\n\n```bash\npython -m compileall .\n```\n\n**步骤 6: 查看某个模块实际加载的是源码还是缓存**\n\n```bash\npython -c \"import your_module; import inspect; print(inspect.getfile(your_module))\"\n```\n\n**快速验证改动是否生效**\n\n在脚本顶部临时添加:\n\n", "metrics": { "length": 575, "commands": 7, "command_list": [ "find . -type d -name __pycache__ -exec rm -rf {} +", "find . -name \".pyc\" -delete", "rm -rf path/to/module/__pycache__", "export PYTHONDONTWRITEBYTECODE=1", "python your_script.py" ], "has_command_block": true, "actionable": false, "inline_code_count": 11, "lesson_hits": 5, "lesson_hit_rate": 0.833 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Fix Python Smtplib SSL Certificate Verify Failed Error When Sending Emails (python-smtplib-ssl-certificate-verify-failed-fix)", "condition": "with_lesson", "status": 200, "content": "Fix Python Smtplib SSL Certificate Verify Failed Error When Sending Emails\n\n**Решение:**\n\nЧтобы решить проблему SSL Certificate Verify Failed при отправке электронных писем через SMTP-сервер Gmail, вы можете использовать следующее решение:\n\n### 1. Добавление локальных корневых сертификатов (CA Certificates)\n\nЕсли вы используете чистый Python на Windows или macOS, вы можете добавить локальные корневые сертификаты (CA Certificates) к Python.\n\n**Для Windows:**\n\n1. Скачайте и установите OpenSSL:\n ```bash\nwinget install --exact-match python\n```\n2. Добавьте локальные корневые сертификаты (CA Certificates) к Python:\n ```bash\npython -m ssl.match_hostname -k\n```\n\n**Для macOS/Linux:**\n\n1. Установите OpenSSL:\n ```bash\nsudo apt-get install openssl\n```\n2. Добавьте локальные корневые сертификаты (CA Certificates) к Python:\n ```bash\nsudo python -m ssl.match_hostname -k\n```\n\n### 2. Использование ssl.create_default_context() с параметром verify=False\n\nЕсли", "metrics": { "length": 961, "commands": 4, "command_list": [ "winget install --exact-match python", "python -m ssl.match_hostname -k", "sudo apt-get install openssl", "sudo python -m ssl.match_hostname -k" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Python 沙箱/受限环境 — PATH 和 sys.path 隔离 (python-sandbox-path-isolation)", "condition": "plain", "status": 200, "content": "The error you're encountering is related to Python's sandboxing and path isolation. This issue can be resolved by modifying the `sys.path` and `PATH` environment variables in your Python environment.\n\nHere's a step-by-step solution:\n\n**For Linux and macOS:**\n\n1. Create a new file named `~/.pythonprofile` (for Linux and macOS) or `~/.python` (for macOS) with the following content:\n\n```python\nimport sys\nsys.path.insert(0, '/path/to/your/project')\n```\n\nReplace `/path/to/your/project` with the actual path to your project.\n\n2. Run the following command to apply the changes:\n\n```bash\npython -m site --user-site ~/.pythonprofile\n```\n\nor\n\n```bash\npython -m site --user-site ~/.python\n```\n\n**For Windows:**\n\n1. Create a new file named `C:\\Users\\YourUsername\\.python` (replace `YourUsername` with your actual username) with the following content:\n\n```python\nimport sys\nsys.path.insert(0, 'C:\\\\path\\\\to\\\\your\\\\project')\n```\n\nReplace `C:\\path\\to\\your\\project` with the actual path to your project.\n\n2. Run the", "metrics": { "length": 1004, "commands": 5, "command_list": [ "Replace `/path/to/your/project` with the actual path to your project.", "2. Run the following command to apply the changes:", "or", "**For Windows:**", "1. Create a new file named `C:\\Users\\YourUsername\\.python` (replace `YourUsername` with your actual username) with the following content:" ], "has_command_block": true, "actionable": true, "inline_code_count": 15, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Python venv 中 tiktoken 安装后仍报 ModuleNotFoundError (python-venv-tiktoken-module-not-found)", "condition": "with_lesson", "status": 200, "content": "解决 Python venv 中 tiktoken 安装后仍报 ModuleNotFoundError 的问题:\n\n1. first,确保pip可用:\n ```bash\n python -m ensurepip\n ```\n\n2. 重新安装setuptools:\n ```bash\n pip install setuptools\n ```\n\n3. 重新安装tiktoken:\n ```bash\n pip install tiktoken\n ```\n\n4. 如果问题 persists,尝试重建venv:\n ```bash\n python -m venv venv --include-pip\n pip install tiktoken\n ```\n\n5. 验证tiktoken的安装:\n ```bash\n python -c \"import tiktoken; enc = tiktoken.get_encoding('cl100k_base'); print(enc.encode('hello'))\"\n ```\n\n6. 在Windows + WSL2混合环境中,建议使用python -m ensurepip初始化venv,以避免这种情况。", "metrics": { "length": 574, "commands": 6, "command_list": [ "python -m ensurepip", "pip install setuptools", "pip install tiktoken", "python -m venv venv --include-pip", "pip install tiktoken" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 5, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Fix Python Smtplib SSL Certificate Verify Failed Error When Sending Emails (python-smtplib-ssl-certificate-verify-failed-fix)", "condition": "plain", "status": 200, "content": "**Fixing Python Smtplib SSL Certificate Verify Failed Error**\n\nThe \"SSL Certificate Verify Failed\" error occurs when the Python `smtplib` library is unable to verify the SSL certificate of the SMTP server you're trying to connect to. This can be due to various reasons such as:\n\n* The SMTP server's SSL certificate is not trusted by the system.\n* The system's clock is not synchronized with the SMTP server's clock.\n* The system's SSL/TLS configuration is not properly set up.\n\nHere's a concrete, actionable fix with exact commands:\n\n**Method 1: Update the system's SSL/TLS configuration**\n\nThis method updates the system's SSL/TLS configuration to trust the SMTP server's certificate.\n\n```bash\n# Update the system's SSL/TLS configuration\nsudo apt-get update && sudo apt-get install ca-certificates\n```\n\n**Method 2: Add the SMTP server's certificate to the system's trusted certificates**\n\nThis method adds the SMTP server's certificate to the system's trusted certificates.\n\n```bash\n# Get the SMTP server's certificate\ncurl -s -o /etc/ssl/certs/smtp_server.crt https://smtp.example.com/certificates.crt\n\n# Add the certificate to the system's trusted certificates\nsudo update-ca", "metrics": { "length": 1178, "commands": 1, "command_list": [ "sudo apt-get update && sudo apt-get install ca-certificates" ], "has_command_block": true, "actionable": true, "inline_code_count": 3, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Python venv 中 tiktoken 安装后仍报 ModuleNotFoundError (python-venv-tiktoken-module-not-found)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely due to a version incompatibility between the `python-venv` package and the `tiktoken` library. Here's a step-by-step solution to resolve the issue:\n\n**Step 1: Update your Python version**\n\nBefore proceeding, ensure you're using the latest version of Python. You can check your current Python version by running:\n```bash\npython --version\n```\nIf you're using an older version, consider updating to the latest version using your package manager or by downloading the latest version from the official Python website.\n\n**Step 2: Install `python-venv` and `pytorch`**\n\nMake sure you have `python-venv` and `pytorch` installed. If not, you can install them using pip:\n```bash\npip install --upgrade python-venv\npip install torch torchvision\n```\n**Step 3: Install `transformers` and `tokall`**\n\nThe `tiktoken` library is part of the `transformers` package. To install `transformers` and its dependencies, run:\n```bash\npip install transformers\n```\nHowever, the `transformers` package has a dependency on `tokall`, which is not available on PyPI.", "metrics": { "length": 1075, "commands": 4, "command_list": [ "python --version", "pip install --upgrade python-venv", "pip install torch torchvision", "pip install transformers" ], "has_command_block": true, "actionable": true, "inline_code_count": 18, "lesson_hits": 5, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Python venv 激活失败或路径不匹配 (python-venv-troubleshoot)", "condition": "plain", "status": 200, "content": "The error \"激活失败或路径不匹配\" which translates to \"activation failed or path not matched\" in English, is a common issue when trying to activate a Python virtual environment (venv) in Windows.\n\nHere's a step-by-step solution:\n\n**Method 1: Reinstall Python**\n\n1. Uninstall Python from your system (if you haven't already).\n2. Download the latest version of Python from the official Python website: https://www.python.org/downloads/\n3. Run the installer and follow the prompts to install Python.\n4. Once installed, open a new Command Prompt or PowerShell as an administrator.\n5. Navigate to the directory where you installed Python (e.g., `C:\\Python39`).\n6. Run the following command to activate the venv:\n ```bash\npython -m venv --upgrade\n```\n7. Activate the venv:\n ```bash\n.\\Scripts\\activate\n```\n (on Windows)\n\n**Method 2: Fix the PATH Environment Variable**\n\n1. Open the System Properties window:\n - Right-click on \"Computer\" or \"This PC\" and select \"Properties\".\n - Click on \"Advanced system settings\" on the left side.\n - Click on \"Environment Variables\".\n", "metrics": { "length": 1063, "commands": 2, "command_list": [ "python -m venv --upgrade", ".\\Scripts\\activate" ], "has_command_block": true, "actionable": true, "inline_code_count": 4, "lesson_hits": 2, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Python venv 激活失败或路径不匹配 (python-venv-troubleshoot)", "condition": "with_lesson", "status": 200, "content": "Here's a step-by-step guide to fixing the \"Python venv 激活失败或路径不匹配\" error:\n\n**Step 1: Determine your shell type**\n\nRun the following command to determine your shell type:\n```bash\necho $SHELL\n```\nThis will output `bash` or `zsh`.\n\n**Step 2: Verify the `venv` directory**\n\nRun the following command to verify the `venv` directory:\n```bash\nwhich python\npython -c \"import sys; print(sys.prefix)\"\n```\nIf the output is not `venv`, run `source venv/bin/activate` or `source .venv/bin/activate` to activate the `venv` directory.\n\n**Step 3: Remove the `venv` directory (if it exists)**\n\nIf you created multiple `venv` directories, remove the existing one:\n```bash\nrm -rf venv\n```\n**Step 4: Re-create the `venv` directory**\n\nRe-create the `venv` directory:\n```bash\npython3 -m venv venv\n```\n**Step 5: Activate the `venv` directory**\n\nActivate the `venv` directory:\n```bash\nsource v", "metrics": { "length": 869, "commands": 5, "command_list": [ "echo $SHELL", "which python", "python -c \"import sys; print(sys.prefix)\"", "rm -rf venv", "python3 -m venv venv" ], "has_command_block": true, "actionable": true, "inline_code_count": 22, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "RAG Alarm Code Retrieval Needs Mandatory Keyword Recall (rag-alarm-code-mandatory-recall)", "condition": "with_lesson", "status": 200, "content": "To fix the RAG Alarm Code Retrieval Needs Mandatory Keyword Recall error, you'll need to modify the `retrieve()` function in `rag_core.py`. Here's a step-by-step guide:\n\n**Step 1: Identify the problematic code**\n\nOpen the `rag_core.py` file and search for the `retrieve()` function. Look for the lines that handle the alarm code pattern and robot model matching.\n\n**Step 2: Modify the `retrieve()` function**\n\nAdd the following code to the `retrieve()` function to implement keyword mandatory recall:\n```python\ndef retrieve(self, query, context):\n # ... (existing code)\n \n # Alarm code pattern: when /[A-Z]+-\\d+/ matches, forcibly recall documents whose titles/tags contain that code\n alarm_code_pattern = r\"[A-Z]+-\\d+\"\n if re.search(alarm_code_pattern, query):\n # Recall documents whose titles/tags contain the alarm code\n alarm_code = query[query.index(alarm_code_pattern) + len(alarm_code_pattern):]\n self._recall_documents(context, alarm_code, force=True)\n \n # Robot model matching: match model names as strings and merge them into the retrieval results\n robot_model_pattern = r\"M-\\d+|", "metrics": { "length": 1134, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 6, "lesson_hits": 3, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "RAG Alarm Code Retrieval Needs Mandatory Keyword Recall (rag-alarm-code-mandatory-recall)", "condition": "plain", "status": 200, "content": "The error you're encountering is a known issue with the RAG (Risk and Alert Group) system. Here's a step-by-step guide to resolve the issue:\n\n**Prerequisites:**\n\n1. Ensure you have administrative privileges on the system.\n2. Familiarize yourself with the RAG system configuration and settings.\n\n**Fix:**\n\n1. **Check the RAG system configuration:**\n - Log in to the RAG system as an administrator.\n - Navigate to the \"System Settings\" or \"Configuration\" section.\n - Look for the \"Alarm Code Retrieval\" or \"RAG Alarm Code Retrieval\" setting.\n - Verify that the \"Mandatory Keyword Recall\" option is enabled.\n\n2. **Verify the keyword list:**\n - If the \"Mandatory Keyword Recall\" option is enabled, check if the keyword list is complete and up-to-date.\n - Ensure that all required keywords are included in the list.\n\n3. **Update the keyword list:**\n - If the keyword list is incomplete or outdated, update it by adding or removing keywords as necessary.\n - Save the changes to the keyword list.\n\n4. **Disable the \"Mandatory Keyword Recall\" option (if applicable):**\n - If the issue persists,", "metrics": { "length": 1104, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "RAG 知识库品牌污染Detection与治理 (rag-brand-contamination-detection-and-fix)", "condition": "with_lesson", "status": 200, "content": "以下是解决 RAG 知识库品牌污染的具体操作:\n\n**步骤 1: 全量元数据打标**\n\n```bash\n# 确保 ChromaDB 的数据库连接\npython\nimport chromadb\nfrom chromadb import collection\n\n# 连接到 ChromaDB\ndb = chromadb.connect('your_database_name')\n\n# 获取 chunk IDs 和 元数据\nids = db.collection('your_collection_name').chunk_ids()\nmetadatas = db.collection('your_collection_name').chunk_metadata()\n\n# 分批打标\nbatch_size = 100\nfor i in range(0, len(ids), batch_size):\n chunk_ids = ids[i:i+batch_size]\n chunk_metadatas = metadatas[i:i+batch_size]\n \n # 打标\n for doc_id, meta in zip(chunk_ids, chunk_metadatas):\n fn = meta.get(\"filename\", \"\")\n if kuka_pat.search(fn): brand = \"kuka\"\n elif abb_pat.search(fn): brand = \"abb\"\n elif fanuc_pat.search(fn): brand = \"fanuc\"\n else: brand = \"unknown\"\n collection.update(ids=[doc_id], metadatas=[", "metrics": { "length": 855, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 0, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "RAG 知识库品牌污染Detection与治理 (rag-brand-contamination-detection-and-fix)", "condition": "plain", "status": 200, "content": "The error message \"RAG 知识库品牌污染Detection与治理\" is not a standard error message and seems to be a Chinese error message. However, I'll assume that it's related to a Rust or Go programming language issue.\n\nSince I don't have more information about the error, I'll provide a general solution for a common error in Rust and Go programming languages.\n\n**Rust Error Fix:**\n\nIf you're experiencing issues with a Rust project, here's a general fix:\n\n1. Update the Rust version:\n ```bash\nrustup update\n```\n2. Clean the project:\n ```bash\ncargo clean\n```\n3. Rebuild the project:\n ```bash\ncargo build\n```\n4. Check for dependencies:\n ```bash\ncargo check\n```\n\n**Go Error Fix:**\n\nIf you're experiencing issues with a Go project, here's a general fix:\n\n1. Update the Go version:\n ```bash\ngo get golang.org/x/tools/cmd/goimports\ngo mod tidy\ngo mod clean\ngo mod vendor\ngo get golang.org/x/tools/cmd/goimports\n```\n Or \n ```bash\ngo mod tidy\ngo mod clean\ngo mod vendor\ngo get golang", "metrics": { "length": 972, "commands": 9, "command_list": [ "rustup update", "cargo clean", "cargo build", "cargo check", "go get golang.org/x/tools/cmd/goimports" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 1, "lesson_hit_rate": 0.167 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "RAG Chinese Encoding with PyMuPDF (rag-chinese-encoding-pymupdf)", "condition": "plain", "status": 200, "content": "The error you're encountering is due to PyMuPDF not supporting the RAG Chinese encoding. Here's a concrete, actionable fix with exact commands:\n\n**Method 1: Install a custom encoding**\n\nYou can install a custom encoding using pip:\n\n```bash\npip install pymupdf[rag-chinese-encoding]\n```\n\n**Method 2: Use a different library**\n\nIf the above method doesn't work, you can try using a different library that supports RAG Chinese encoding. One alternative is `pdfquery`:\n\n```bash\npip install pdfquery\n```\n\nThen, you can use the following code to extract text from a PDF file with RAG Chinese encoding:\n\n```python\nimport pdfquery\n\nwith open('example.pdf', 'rb') as f:\n pdf = pdfquery.PDFQuery(f)\n text = pdf.text()\n print(text)\n```\n\n**Method 3: Convert the PDF to a different encoding**\n\nIf the above methods don't work, you can try converting the PDF to a different encoding. You can use the following code to convert the PDF to UTF-8:\n\n```python\nimport fitz\n\ndoc = fitz.open('example.pdf')\nfor page in doc:\n page.text = page.text.decode('utf-", "metrics": { "length": 1049, "commands": 4, "command_list": [ "pip install pymupdf[rag-chinese-encoding]", "pip install pdfquery", "**Method 3: Convert the PDF to a different encoding**", "If the above methods don't work, you can try converting the PDF to a different encoding. You can use the following code to convert the PDF to UTF-8:" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 1, "lesson_hit_rate": 0.2 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "RAG Chinese Encoding with PyMuPDF (rag-chinese-encoding-pymupdf)", "condition": "with_lesson", "status": 200, "content": "To fix the issue with pymupdf4llm extracting PDFs with Chinese special characters being truncated due to the default encoding, you can explicitly specify the encoding to UTF-8 in the extract() call.\n\nHere's the corrected Python code:\n\n```python\nimport pymupdf4llm\n\n# Load the PDF document\ndoc = pymupdf4llm.load(\"path_to_your_pdf_file.pdf\")\n\n# Extract the text from the PDF document with UTF-8 encoding\ntext = pymupdf4llm.extract(doc, encoding=\"utf-8\")\n\n# Print the extracted text\nprint(text)\n```\n\nReplace `\"path_to_your_pdf_file.pdf\"` with the actual path to the PDF file you want to extract text from.\n\nIf you're using a Python script to automate this process, make sure to add the encoding specification in the extract() call.\n\nExample:\n\n```python\nimport pymupdf4llm\n\n# Load the PDF document\ndoc = pymupdf4llm.load(\"path_to_your_pdf_file.pdf\")\n\n# Extract the text from the PDF document with UTF-8 encoding\ntext = pymupdf4llm.extract(doc, encoding=\"utf-8\")\n\n# Save the extracted text to a file\nwith open(\"", "metrics": { "length": 1007, "commands": 3, "command_list": [ "Replace `\"path_to_your_pdf_file.pdf\"` with the actual path to the PDF file you want to extract text from.", "If you're using a Python script to automate this process, make sure to add the encoding specification in the extract() call.", "Example:" ], "has_command_block": true, "actionable": false, "inline_code_count": 3, "lesson_hits": 4, "lesson_hit_rate": 0.8 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "RAG Chunk Parameters 800 Characters and 100 Overlap (rag-chunk-params-800-100)", "condition": "with_lesson", "status": 200, "content": "To fix the error, you need to adjust the chunking strategy in your RAG configuration. Here's a step-by-step guide with exact commands:\n\n1. **Update the RAG configuration**:\n\n First, update the RAG configuration to use the new chunking parameters.\n\n ```python\nfrom rag import RAG\nfrom rag.utils import RecursiveCharacterTextSplitter\n\n# Initialize RAG with the updated configuration\nrag = RAG(\n config={\n \"chunking\": {\n \"chunk_size\": 800, # About 800 characters per chunk\n \"chunk_overlap\": 100, # 100-character overlap between chunks\n \"length_function\": len,\n \"separators\": [\"\\n\\n\", \"\\n\", \"。\", \"!\", \"?\", \" \", \"\"]\n },\n # Other configurations...\n }\n)\n```\n\n2. **Verify the configuration**:\n\n To verify that the configuration has been updated correctly, you can check the ingestion log.\n\n ```bash\n# Get the ingestion log\ningestion_log = rag.ingestion_log\n\n# Check if the chunking parameters have been updated\nprint(ingestion_log.get(\"chunking\"))\n```\n\n The output should match the new chunking", "metrics": { "length": 1069, "commands": 2, "command_list": [ "2. **Verify the configuration**:", "To verify that the configuration has been updated correctly, you can check the ingestion log." ], "has_command_block": true, "actionable": true, "inline_code_count": 3, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "RAG Chunk Parameters 800 Characters and 100 Overlap (rag-chunk-params-800-100)", "condition": "plain", "status": 200, "content": "The error you're encountering is related to the size of your RAG (Rapid Autocomplete Grammar) chunk parameters. The error message indicates that the chunk parameters are too large (800 characters) and the overlap is too high (100).\n\nTo fix this issue, you can try the following steps:\n\n**Step 1: Reduce the chunk size**\n\nYou can reduce the chunk size by changing the value in the `rag-chunk-size` configuration option. Here's an example command:\n\n```bash\ndotnet build -c Release --configuration Release --arg \"rag-chunk-size=600\"\n```\n\nIn this command, we're changing the chunk size to 600 characters.\n\n**Step 2: Reduce the overlap**\n\nYou can also reduce the overlap by changing the value in the `rag-chunk-overlap` configuration option. Here's an example command:\n\n```bash\ndotnet build -c Release --configuration Release --arg \"rag-chunk-overlap=50\"\n```\n\nIn this command, we're changing the overlap to 50 characters.\n\n**Step 3: Rebuild the project**\n\nAfter making these changes, you'll need to rebuild your project to apply the new configuration options. You can do this using the following command:\n\n```bash\ndotnet build", "metrics": { "length": 1121, "commands": 2, "command_list": [ "dotnet build -c Release --configuration Release --arg \"rag-chunk-size=600\"", "dotnet build -c Release --configuration Release --arg \"rag-chunk-overlap=50\"" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 3, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Cross-encoder reranker kills RAG latency on CPU-only machines (rag-cross-encoder-cpu-bottleneck)", "condition": "with_lesson", "status": 200, "content": "To fix the \"Cross-encoder reranker kills RAG latency on CPU-only machines\" error, you can try the following concrete, actionable steps:\n\n**Step 1: Disable Cross-encoder Reranking**\n\nYou can disable cross-encoder reranking by adding the following configuration to your model configuration file (e.g., `config.json` or `model_config.py`):\n\n```json\n{\n \"model\": {\n \"name\": \"bge-reranker-v2-m3\",\n \"config\": {\n \"disable_cross_encoder_reranking\": true\n }\n }\n}\n```\n\nor\n\n```python\nimport json\n\nmodel_config = {\n \"model\": {\n \"name\": \"bge-reranker-v2-m3\",\n \"config\": {\n \"disable_cross_encoder_reranking\": True\n }\n }\n}\n\nwith open('config.json', 'w') as f:\n json.dump(model_config, f, indent=4)\n```\n\n**Step 2: Update the Model Configuration File**\n\nAfter making the change, update the model configuration file to include the new configuration.\n\n**Step 3: Re-run Your Model**\n\nRe-run your model with the updated configuration to see if it improves performance.\n\nNote:", "metrics": { "length": 1010, "commands": 1, "command_list": [ "or" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 2, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Cross-encoder reranker kills RAG latency on CPU-only machines (rag-cross-encoder-cpu-bottleneck)", "condition": "plain", "status": 200, "content": "The error you're encountering is related to the performance of the Cross-Encoder Reranker model on CPU-only machines. This issue is known as the \"rag-cross-encoder-cpu-bottleneck.\" Here's a concrete, actionable fix with exact commands:\n\n**Fix 1: Increase the number of CPU cores**\n\nThe Cross-Encoder Reranker model relies heavily on the number of CPU cores available. Increasing the number of cores can significantly improve performance. You can do this by:\n\n* Adding more CPU cores to your machine (if possible)\n* Using a cloud service with more CPU cores (e.g., AWS EC2, Google Cloud Compute Engine)\n\nAlternatively, you can use a distributed computing framework like [Dask](https://dask.org/) to utilize multiple CPU cores.\n\n**Fix 2: Use a GPU-accelerated model**\n\nThe Cross-Encoder Reranker model can be accelerated using a GPU. You can do this by:\n\n* Installing a GPU-accelerated deep learning framework like [TensorFlow](https://www.tensorflow.org/), [PyTorch](https://pytorch.org/), or [Hugging Face Transformers](https://huggingface.co/models)\n* Migrating your model to a", "metrics": { "length": 1086, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "RAG 检索六层静默退化:BM25 失败 + 截断 + 分数混合导致有效 chunk 被丢弃 (rag-retrieval-six-layer-silent-degradation)", "condition": "with_lesson", "status": 200, "content": "为了解决 RAG 检索六层静默退化:BM25 失败 + 截断 + 分数混合导致有效 chunk 被丢弃(rag-retrieval-six-layer-silent-degradation)的问题,我们需要进行以下修复:\n\n**步骤 1:验证 BM25 索引完整性**\n\n```bash\npython3 scripts/misakanet_cli.py doctor\n```\n\n**步骤 2:添加 warmup 重试逻辑**\n\n```bash\n# 在 misakanet_cli.py 中添加 warmup 重试逻辑\nif __name__ == \"__main__\":\n # ... existing code ...\n if not query_result:\n # 等待 5s 重试\n time.sleep(5)\n if not query_result:\n # 重试失败后回退到 BM25-only\n query_result = run_bm25_query(query)\n # ... existing code ...\n```\n\n**步骤 3:修复 $contains tokenization**\n\n```bash\n# 在 misakanet_cli.py 中添加统一查询预处理\ndef preprocess_query(query):\n # 分词\n tokens = tokenizer.tokenize(query)\n # 匹配\n matched_tokens = [token", "metrics": { "length": 713, "commands": 6, "command_list": [ "python3 scripts/misakanet_cli.py doctor", "if __name__ == \"__main__\":", "if not query_result:", "time.sleep(5)", "if not query_result:" ], "has_command_block": true, "actionable": false, "inline_code_count": 4, "lesson_hits": 3, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "RAG 检索六层静默退化:BM25 失败 + 截断 + 分数混合导致有效 chunk 被丢弃 (rag-retrieval-six-layer-silent-degradation)", "condition": "plain", "status": 200, "content": "The error message you're encountering suggests that the RAG (Ranking Algorithm Group) is experiencing issues with six-layer silent degradation, specifically with BM25 (Berk-Székely-Moody 25), truncation, and score mixing. This can lead to the loss of effective chunks. To fix this issue, you can try the following steps:\n\n**Step 1: Update the RAG model**\n\nRun the following command to update the RAG model to the latest version:\n```bash\npip install --upgrade ragg\n```\n**Step 2: Update the BM25 algorithm**\n\nUpdate the BM25 algorithm to the latest version:\n```bash\npip install --upgrade scibert\n```\n**Step 3: Increase the maximum chunk size**\n\nIncrease the maximum chunk size to prevent the loss of effective chunks. You can do this by setting the `max_chunk_size` parameter in the RAG configuration file:\n```python\n# rag_config.py\n\nRAG_CONFIG = {\n # ...\n 'max_chunk_size': 1024, # Increase the maximum chunk size\n # ...\n}\n```\n**Step 4: Disable score mixing**\n\nDisable score mixing by setting the `score_mixing` parameter to `False` in the R", "metrics": { "length": 1050, "commands": 2, "command_list": [ "pip install --upgrade ragg", "pip install --upgrade scibert" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "RAG Three-Channel LLM Disaster Recovery (rag-three-channel-llm-disaster-recovery)", "condition": "with_lesson", "status": 200, "content": "To implement three-channel automatic disaster recovery for the RAG knowledge base, you'll need to modify the Gradio application configuration and add error handling mechanisms. Here's a step-by-step guide to achieve this:\n\n**Step 1: Verify the current configuration**\n\nRun the following commands to inspect the current configuration:\n```bash\ngrep -i 'bm25\\|chunk\\|embed' lessons/contrib/rag-.md 2/dev/null | head -3\necho Search verified\n```\nThis should output the expected verification message.\n\n**Step 2: Update the Gradio application configuration**\n\nModify the `rag_three_channel_llm_disaster_recovery.py` file to include the three-channel configuration:\n```python\nimport gradio as gr\nfrom gradio import Text, Button, Image, Video, Audio\nfrom gradio import Component, ComponentGrid, MultiComponent\nfrom gradio.components import TextInput, Switch\nfrom gradio.components import ImageUpload, VideoUpload\nfrom gradio.components import AudioUpload\nfrom gradio.components import ComponentGrid\nfrom gradio.components import MultiComponent\nimport requests\nimport time\n\n# Define the three-channel configuration\nchannel_config = [\n {\n \"name\": \"Internal Model - Flash\",\n \"url\": \"http://", "metrics": { "length": 1195, "commands": 2, "command_list": [ "grep -i 'bm25\\|chunk\\|embed' lessons/contrib/rag-.md 2/dev/null | head -3", "echo Search verified" ], "has_command_block": true, "actionable": false, "inline_code_count": 3, "lesson_hits": 4, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "正则陷阱 — 源码中转义引号导致非贪婪匹配提前终止 (regex-escaped-quotes-source-parsing)", "condition": "with_lesson", "status": 200, "content": "To fix the error, you can use the following command:\n\n```bash\necho \"Verification passed: [^\\\\]|\\.\"\n```\n\nThis command uses a character class to match any character except backslash (`[^\\\\]`) or escape sequence (`\\\\.`).", "metrics": { "length": 217, "commands": 1, "command_list": [ "echo \"Verification passed: [^\\\\]|\\.\"" ], "has_command_block": true, "actionable": true, "inline_code_count": 3, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "RAG Three-Channel LLM Disaster Recovery (rag-three-channel-llm-disaster-recovery)", "condition": "plain", "status": 200, "content": "I'm happy to help you with the error. However, I don't see any error message in your question. Could you please provide the exact error message you're encountering?\n\nThat being said, if you're experiencing issues with a Hugging Face model, such as the \"RAG Three-Channel LLM Disaster Recovery\" model, here are some general troubleshooting steps you can try:\n\n1. Check the model's documentation: Make sure you're using the model correctly and that you've checked the documentation for any specific requirements or usage guidelines.\n2. Verify your Python environment: Ensure that your Python environment is up-to-date and that you have the required libraries installed. You can try updating your environment by running `pip install --upgrade transformers`.\n3. Try a different version of the model: If you're using a specific version of the model, try updating to the latest version by running `pip install transformers --upgrade`.\n\nIf you're still experiencing issues, please provide the exact error message you're encountering, and I'll do my best to provide a concrete, actionable fix.\n\nHere is an example of how you might use the RAG model:\n```python\nfrom transformers import AutoModelForCausalLM, AutoTokenizer\n\n# Load the model and tokenizer\nmodel_name = \"", "metrics": { "length": 1259, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 2, "lesson_hits": 4, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "rdt-cli — Reddit in Your Terminal (Reverse-Engineered API) (rdt-cli-reddit-terminal)", "condition": "plain", "status": 200, "content": "It looks like the rdt-cli is not compatible with the latest versions of Python. Here's a step-by-step guide to fix the issue:\n\n**Step 1: Update pip**\n\nOpen your terminal and update pip to the latest version:\n\n```bash\npython -m pip install --upgrade pip\n```\n\n**Step 2: Install rdt-cli**\n\nNow, install rdt-cli using pip:\n\n```bash\npython -m pip install rdt-cli\n```\n\n**Step 3: Install required packages**\n\nrdt-cli requires some additional packages to be installed. You can install them using the following command:\n\n```bash\npython -m pip install -r rdt-cli/requirements.txt\n```\n\n**Step 4: Verify installation**\n\nAfter installing the packages, verify that rdt-cli is working correctly by running:\n\n```bash\nrdt-cli\n```\n\nIf you still encounter issues, make sure that you have the latest version of Python installed.\n\nNote: If you're using a virtual environment, ensure that you activate it before running the above commands.", "metrics": { "length": 917, "commands": 4, "command_list": [ "python -m pip install --upgrade pip", "python -m pip install rdt-cli", "python -m pip install -r rdt-cli/requirements.txt", "rdt-cli" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 3, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "rdt-cli — Reddit in Your Terminal (Reverse-Engineered API) (rdt-cli-reddit-terminal)", "condition": "with_lesson", "status": 200, "content": "To fix the error and verify that `rdt-cli` is installed correctly, follow these steps:\n\n1. **Install `rdt-cli` using pipx**: Run the following command in your terminal:\n ```bash\npipx install rdt-cli\n```\n\n2. **Verify the installation**: Run the following command to verify that `rdt-cli` is installed correctly:\n ```bash\nrdt --version\n```\n\n This should display the version number of `rdt-cli`, which is `v0.4.1` in your case.\n\n3. **Login to `rdt-cli`**: Run the following command to login to `rdt-cli`:\n ```bash\nrdt login\n```\n\n This will extract your browser cookies and authenticate you with the Reddit reverse-engineered API.\n\n4. **Verify successful login**: Run the following command to verify that you are logged in successfully:\n ```bash\nrdt status --json\n```\n\n This should display a JSON response indicating that you are authenticated and have a valid cookie count.\n\n5. **Verify with a verification command**: Run the following command to verify that `rdt-cli` is working correctly:\n ```bash\npipx install rdt-cli\necho \"", "metrics": { "length": 1040, "commands": 4, "command_list": [ "pipx install rdt-cli", "rdt --version", "rdt login", "rdt status --json" ], "has_command_block": true, "actionable": true, "inline_code_count": 16, "lesson_hits": 3, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "正则陷阱 — 源码中转义引号导致非贪婪匹配提前终止 (regex-escaped-quotes-source-parsing)", "condition": "plain", "status": 200, "content": "The error you're encountering is due to the fact that the regular expression engine is treating the double quotes in your regex pattern as literal characters instead of escaped quotes. This is because the regex engine is interpreting the double quotes as the start of a quoted string, rather than as an escaped character.\n\nHere's a concrete, actionable fix with exact commands:\n\n**Using Python**\n\nYou can use raw strings in Python to avoid this issue. Raw strings are strings that start with `r` and do not interpret backslashes (`\\`) as escape characters.\n\n```python\nimport re\n\n# Define your regex pattern\npattern = r\"(\\w+) \\\"(.*?)\\\"\"\n\n# Use the raw string to define your regex pattern\nregex_pattern = r\"(\\w+) \\\"(.*?)\\\"\"\n\n# Compile the regex pattern\nregex = re.compile(regex_pattern)\n\n# Test the regex pattern\nmatch = regex.match(\"John \\\"Doe\\\"\")\nif match:\n print(\"Match found:\", match.groups())\nelse:\n print(\"No match found\")\n```\n\n**Using Bash**\n\nIn Bash, you can use single quotes (`'`) to define a raw string.\n\n```bash\n# Define your regex pattern\npattern='(\\w+) „(.*?)“'\n\n# Use the regex pattern to search", "metrics": { "length": 1114, "commands": 2, "command_list": [ "**Using Bash**", "In Bash, you can use single quotes (`'`) to define a raw string." ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 1, "lesson_hit_rate": 0.167 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "正则表达式 debugging — 贪婪匹配造成的意外结果 (regex-greedy-matching)", "condition": "with_lesson", "status": 200, "content": "To fix the error, you need to modify the regular expression to make it non-greedy. You can do this by appending a question mark (`?`) after the `.*` or `.+` part of the pattern.\n\nHere's the corrected code:\n\n```python\nimport re\n\ntext = \"
内容1
内容2
\"\n\n# Non-greedy pattern: matches the closest
\nprint(re.findall(r\"\", text))\n# Output: ['内容1', '内容2']\n```\n\nIn this corrected pattern, `.*?` is used instead of `.*` to make the match non-greedy. This will cause the pattern to match the closest `
` instead of the farthest one.\n\nAlternatively, you can use the `re.DOTALL` flag to make the `.` match any character, including a newline, and then use a non-greedy pattern:\n\n```python\nimport re\n\ntext = \"
内容1
内容2
\"\n\n# Non-greedy pattern: matches the closest \nprint(re.findall(r\"
(.*?)
\", text, re.DOTALL))\n# Output: ['内容", "metrics": { "length": 886, "commands": 2, "command_list": [ "In this corrected pattern, `.*?` is used instead of `.*` to make the match non-greedy. This will cause the pattern to match the closest `` instead of the farthest one.", "Alternatively, you can use the `re.DOTALL` flag to make the `.` match any character, including a newline, and then use a non-greedy pattern:" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "正则表达式 debugging — 贪婪匹配造成的意外结果 (regex-greedy-matching)", "condition": "plain", "status": 200, "content": "The \"贪婪匹配造成的意外结果\" error, also known as \"regex-greedy-matching\" error, occurs when a regular expression engine is unable to determine the correct match due to greedy matching.\n\nHere's a concrete, actionable fix with exact commands:\n\n**For Python**\n\n1. Open your Python script or file in a text editor.\n2. Look for the line of code where the error is occurring.\n3. Check if there's a `+` symbol (`+`) after the `*` symbol (`*`) in the regular expression.\n4. If there is, replace the `+` symbol with a `?` symbol (`?`) to make the match non-greedy.\n\nExample:\n\n```python\nimport re\n\n# Before\ntext = \"Hello world123\"\nmatch = re.search(r\"world\\d+\", text)\n\n# After\nmatch = re.search(r\"world\\d?\", text)\n```\n\n**For Java**\n\n1. Open your Java file in an IDE like Eclipse or IntelliJ IDEA.\n2. Look for the line of code where the error is occurring.\n3. Check if there's a `+` symbol (`+`) after the `*` symbol (`*`) in", "metrics": { "length": 911, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 12, "lesson_hits": 5, "lesson_hit_rate": 0.833 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Remote search rate limiting: 5 free/day, then registration (remote-search-rate-limiting)", "condition": "with_lesson", "status": 200, "content": "To fix the rate limiting issue, you'll need to modify your Cloudflare Worker to implement the rate limiting rules. Here's a step-by-step guide:\n\n**1. Create a new Cloudflare Worker**\n\nIn the Cloudflare dashboard, go to Workers > Create worker. Choose \"Cloudflare KV\" as the storage engine and give your worker a name (e.g., \"rate-limited-search\").\n\n**2. Add the rate limiting logic**\n\nIn your Cloudflare Worker code, add the following logic to implement the rate limiting rules:\n```javascript\nconst key = `rate:${ip}:${date}`;\nconst count = await env.MISAKANET_KV.get(key, \"number\") || 0;\n\nif (count >= 5) {\n return {\n error: \"Rate limit exceeded. Register for unlimited.\",\n hint: \"Register to get unlimited access: misakanet_register\",\n };\n}\n\nawait env.MISAKANET_KV.put(key, count + 1, { expirationTtl: 86400 });\n```\nThis code checks if the rate limit has been exceeded (i.e., if the count is 5 or more). If it has, it returns an error response with a hint to register for unlimited access. If not, it", "metrics": { "length": 1010, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 2, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Remote search rate limiting: 5 free/day, then registration (remote-search-rate-limiting)", "condition": "plain", "status": 200, "content": "The error message you're seeing is related to a rate limiting issue with your Elasticsearch cluster. To fix this, you'll need to increase the `remote_search_rate_limit` parameter in your Elasticsearch configuration.\n\nHere are the steps to increase the `remote_search_rate_limit` parameter:\n\n**Method 1: Update the Elasticsearch configuration file**\n\nIf you're using Elasticsearch 7.x, you can update the `remote_search_rate_limit` parameter in the `elasticsearch.yml` file.\n\n1. Open the `elasticsearch.yml` file in a text editor.\n2. Locate the `remote_search_rate_limit` parameter and update its value to a higher number, e.g., `10000`.\n3. Save the changes to the file.\n\nExample:\n```yaml\nremote_search_rate_limit: 10000\n```\n**Method 2: Update the Elasticsearch configuration using the `xpack` API**\n\nIf you're using Elasticsearch 7.x, you can also update the `remote_search_rate_limit` parameter using the `xpack` API.\n\n1. Open a terminal or command prompt.\n2. Use the following command to update the `remote_search_rate_limit` parameter:\n```bash\ncurl -X PUT 'http://localhost:9200/_xpack/security/_settings?pretty", "metrics": { "length": 1114, "commands": 4, "command_list": [ "**Method 2: Update the Elasticsearch configuration using the `xpack` API**", "If you're using Elasticsearch 7.x, you can also update the `remote_search_rate_limit` parameter using the `xpack` API.", "1. Open a terminal or command prompt.", "2. Use the following command to update the `remote_search_rate_limit` parameter:" ], "has_command_block": true, "actionable": true, "inline_code_count": 13, "lesson_hits": 3, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Repository Traffic Is Not Lesson Use (repository-traffic-is-not-lesson-use)", "condition": "with_lesson", "status": 200, "content": "To fix the \"Repository Traffic Is Not Lesson Use\" error, follow these steps:\n\n**Step 1: Instrument the lesson-consumption path**\n\nAdd a new event to your GitHub repository's `events` file in the `.github/events` directory:\n```yml\n# .github/events\n{\n \"lesson-consumption\": {\n \"type\": \"lesson_consumed\",\n \"properties\": {\n \"lesson_id\": {\n \"type\": \"string\"\n },\n \"user_id\": {\n \"type\": \"string\"\n }\n }\n }\n}\n```\nThis will track when a user consumes a lesson.\n\n**Step 2: Route high-traffic pages into lessons**\n\nAdd direct links to related lessons from the following pages:\n\n* README first screen: `https://example.com/lesson/lesson-name`\n* Issue templates: `https://example.com/lesson/lesson-name`\n* PR templates: `https://example.com/lesson/lesson-name`\n* Welcome comments: `https://example.com/lesson/lesson-name`\n* Thank-you comments: `https://example.com/lesson/lesson-name`\n\nExample:\n```markdown\n# README\nBefore retrying a failing DCO, pip, token, or CI issue, search", "metrics": { "length": 1009, "commands": 9, "command_list": [ "This will track when a user consumes a lesson.", "**Step 2: Route high-traffic pages into lessons**", "Add direct links to related lessons from the following pages:", "* README first screen: `https://example.com/lesson/lesson-name`", "* Issue templates: `https://example.com/lesson/lesson-name`" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 2, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Repository Traffic Is Not Lesson Use (repository-traffic-is-not-lesson-use)", "condition": "plain", "status": 200, "content": "To fix the \"Repository Traffic Is Not Lesson Use\" error, you'll need to update your repository's settings to use the correct configuration. Here's a step-by-step guide:\n\n**Prerequisites:**\n\n* You have a GitHub repository set up.\n* You have the necessary permissions to edit repository settings.\n\n**Fix:**\n\n1. Log in to your GitHub account and navigate to your repository.\n2. Click on the \"Settings\" icon (looks like a gear) in the top-right corner of the page.\n3. In the left sidebar, click on \"Repository settings\".\n4. Scroll down to the \"Traffic\" section.\n5. Click on \"Traffic is not a lesson use\" and then select \"Use this repository as a lesson use\".\n6. Click on \"Update\" to save your changes.\n\nAlternatively, you can also use the GitHub web interface to update your repository settings:\n\n1. Log in to your GitHub account and navigate to your repository.\n2. Click on the \"Settings\" icon (looks like a gear) in the top-right corner of the page.\n3. In the left sidebar, click on \"Repository settings\".\n4. Scroll down to the \"Traffic\" section.\n5. Click on the \"Traffic is not a lesson use\" link.\n", "metrics": { "length": 1097, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 2, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "When Lessons Are Too Heavy, Use Rescue Cards (rescue-cards-for-non-github-users)", "condition": "with_lesson", "status": 200, "content": "To fix the error, you need to introduce rescue cards for non-GitHub users. Here's a step-by-step guide to implement rescue cards:\n\n**Step 1: Create Rescue Card Template**\n\nCreate a new Markdown file (e.g., `rescue-cards.md`) with the following content:\n\n```markdown\n# Rescue Card Template\n\n## Problem Title\n\nTry these 3 steps first\n\n1. [Insert step 1 command]\n2. [Insert step 2 command]\n3. [Insert step 3 command]\n\nStill broken? Send these:\n\n* Screenshot\n* File type/link/error text\n* Operating system/app version\n\n## Maintainer Notes\n\n* Likely root cause:\n* Reusable fix:\n* Should become lesson? Yes/No\n```\n\n**Step 2: Add Rescue Cards**\n\nCreate individual rescue card files (e.g., `archive-open-failure.md`, `pdf-read-failure.md`, etc.) with the following content:\n\n```markdown\n# Archive Open Failure\n\n## Problem Title\n\nTry these 3 steps first\n\n1. Try opening the archive file again.\n2. Check if the archive file is corrupted.\n3. Try opening the file with a different viewer.\n\nStill broken? Send these:\n\n* Screenshot\n* File", "metrics": { "length": 1024, "commands": 2, "command_list": [ "**Step 2: Add Rescue Cards**", "Create individual rescue card files (e.g., `archive-open-failure.md`, `pdf-read-failure.md`, etc.) with the following content:" ], "has_command_block": true, "actionable": true, "inline_code_count": 4, "lesson_hits": 3, "lesson_hit_rate": 0.75 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "When Lessons Are Too Heavy, Use Rescue Cards (rescue-cards-for-non-github-users)", "condition": "plain", "status": 200, "content": "The error you're experiencing is likely due to the `rescue-cards` package not being able to find a GitHub token to authenticate its API requests. To fix this, you'll need to create a GitHub personal access token and install the `rescue-cards` package with the token.\n\nHere are the steps to follow:\n\n**Step 1: Create a GitHub personal access token**\n\n1. Log in to your GitHub account.\n2. Click on your profile picture in the top right corner, then click on \"Settings\".\n3. Scroll down to the \"Developer settings\" section and click on \"Personal access tokens\".\n4. Click on \"Generate new token\".\n5. Choose the scope that suits your needs (e.g., \"repo\", \"read:org\", etc.).\n6. Give the token a name and description, then click on \"Generate token\".\n7. Copy the token.\n\n**Step 2: Install the `rescue-cards` package with the token**\n\nIf you're using npm or yarn:\n\n```bash\nnpm config set github-token \n```\n\nor\n\n```bash\nyarn config set github-token \n```\n\nThen, install the `rescue-cards` package:\n\n```bash\nnpm", "metrics": { "length": 1032, "commands": 2, "command_list": [ "npm config set github-token ", "yarn config set github-token " ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 3, "lesson_hit_rate": 0.75 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "SAG-Lite Data Quality: Clean Search Results (sag-lite-data-quality-cleaning)", "condition": "with_lesson", "status": 200, "content": "Here's a concrete, actionable fix for the `extract_description` function:\n\n```python\nimport re\n\ndef extract_description(text: str, max_len: int = 200) -> str:\n \"\"\"Extract a short description from the lesson body.\"\"\"\n # Remove frontmatter (both ---{json}--- and ---\\nyaml\\n--- formats)\n m = re.match(r\"^---\\s*(?:\\{.*?\\})?\\s*---\", text, re.DOTALL)\n if m:\n text = text[m.end():]\n\n # Also remove any remaining frontmatter-like patterns\n text = re.sub(r'^\\s*\\{.*?\\}\\s*$', '', text, flags=re.MULTILINE)\n\n # Find first non-heading, non-empty, non-metadata line\n for line in text.split(\"\\n\"):\n line = line.strip()\n if not line:\n continue\n if line.startswith(\"#\") or line.startswith(\"##\") or line.startswith(\"###\"):\n continue\n if line.startswith(\"{\") and line.endswith(\"}\"):\n continue\n if line.startswith(\"---\"):\n continue\n description = line\n break\n else:\n # If no non-empty, non-metadata line is found, return the", "metrics": { "length": 1040, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 1, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Scrapling — Web Scraping Library with Anti-Detection (scrapling-installation-and-usage)", "condition": "with_lesson", "status": 200, "content": "Here's a step-by-step guide to fix the Scraping error:\n\n**Step 1: Install Scraping**\n\n1. Create a new virtual environment using `python3 -m venv scrapling-env`\n2. Activate the virtual environment using `source scrapling-env/bin/activate` (on Linux/Mac) or `scrapling-env\\Scripts\\activate` (on Windows)\n3. Install Scraping with all dependencies using `pip install \"scrapling[all]\"`\n\n**Step 2: Verify Installation**\n\n1. Run `python` to open the Python interpreter\n2. Import Scraping and create a Fetcher instance: `from scrapling import Fetcher; fetcher = Fetcher()`\n3. Test the installation by running a simple GET request: `page = fetcher.get(\"https://example.com\", timeout=15); print(page.status); print(page.css(\"title::text\").get())`\n\n**Troubleshooting**\n\nIf you encounter issues, try the following:\n\n1. Check your `User-Agent` header by running `fetcher.get(\"https://example.com\", headless=True, user_agent=\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (", "metrics": { "length": 974, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 8, "lesson_hits": 4, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Scrapling — Web Scraping Library with Anti-Detection (scrapling-installation-and-usage)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely due to Scraping being a prohibited library in your environment. Here's a step-by-step guide to install and use Scraping safely:\n\n**Prerequisites:**\n\n1. Install Python 3.8 or higher.\n2. Install a virtual environment (e.g., `venv` or `conda`) to isolate your project dependencies.\n\n**Step 1: Install Scraping**\n\nSince Scraping is not available on PyPI, we'll use the `scrapy` library as a replacement. You can install it using pip:\n\n```bash\npip install scrapy\n```\n\n**Step 2: Install Anti-Detection Tools**\n\nTo avoid detection, you can use tools like `scrapy-splash` or `scrapy-requests-headers`. Here, we'll use `scrapy-splash`:\n\n```bash\npip install scrapy-splash\n```\n\n**Step 3: Configure Scraping**\n\nCreate a new file named `settings.py` in your project directory:\n\n```python\n# settings.py\n\nimport scrapy\n\n# Scrapy settings for your project\nBOT_NAME = 'your_project_name'\n\nSPIDER_MODULES = ['your_project_name.spiders']\nNEWSPIDER_MODULE = 'your_project_name.spiders'\n\n# Splash settings\n", "metrics": { "length": 1025, "commands": 2, "command_list": [ "pip install scrapy", "pip install scrapy-splash" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 2, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "SAG-Lite Data Quality: Clean Search Results (sag-lite-data-quality-cleaning)", "condition": "plain", "status": 200, "content": "The SAG-Lite Data Quality: Clean Search Results error typically occurs when there are duplicate or irrelevant results in your search. Here's a step-by-step fix using Elasticsearch and Kibana:\n\n**Prerequisites:**\n\n1. Make sure you have Elasticsearch and Kibana installed.\n2. You have the necessary permissions to access and modify your Elasticsearch indices.\n\n**Fix:**\n\n**Step 1: Identify the affected index**\n\nRun the following command to find the index that's causing the error:\n```bash\ncurl -XGET 'http://localhost:9200/_search?search_type=query_then_fetch&size=0' | jq '.aggs.search_type'\n```\nThis will show you the search type used in your search query. If it's set to `query_then_fetch`, you'll need to clean up the results.\n\n**Step 2: Clean up the index**\n\nRun the following command to clean up the index:\n```bash\ncurl -XPOST 'http://localhost:9200/_msearch' -H 'Content-Type: application/json' -d '\n{\n \"index\": {\n \"index\": \"your_index_name\"\n },\n \"query\": {\n \"match_all\": {}\n },\n \"size\": 0", "metrics": { "length": 1006, "commands": 1, "command_list": [ "curl -XGET 'http://localhost:9200/_search?search_type=query_then_fetch&size=0' | jq '.aggs.search_type'" ], "has_command_block": true, "actionable": true, "inline_code_count": 3, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "搜索评估陷阱:评估函数先检查标题再检查内容导致 rank 偏差 (search-evaluation-rank-tracking-bias)", "condition": "with_lesson", "status": 200, "content": "To fix the `search-evaluation-rank-tracking-bias` issue, you can modify the evaluation function to track both title and content matches simultaneously. Here's an example of how you can do this using Python:\n\n```python\ndef evaluate_rank(results, expected_title, expected_content):\n best_rank = float('inf')\n title_match = False\n content_match = False\n \n for i, result in enumerate(results):\n if 'title' in result and expected_title in result['title']:\n title_match = True\n if 'content' in result and expected_content in result['content']:\n content_match = True\n \n # Simultaneously track, take the best match\n if title_match or content_match:\n best_rank = min(best_rank, i + 1)\n \n return best_rank if best_rank != float('inf') else None\n```\n\nHowever, this approach is not very efficient because it checks every result for both title and content matches. A more efficient approach is to use a single loop that checks for both title and content matches simultaneously:\n\n```python\ndef evaluate_rank(results, expected_title, expected_content):\n best_rank = float('inf')\n for i, result in enumerate(results):\n title_match = expected_title", "metrics": { "length": 1233, "commands": 1, "command_list": [ "However, this approach is not very efficient because it checks every result for both title and content matches. A more efficient approach is to use a single loop that checks for both title and content matches simultaneously:" ], "has_command_block": true, "actionable": true, "inline_code_count": 3, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "搜索评估陷阱:评估函数先检查标题再检查内容导致 rank 偏差 (search-evaluation-rank-tracking-bias)", "condition": "plain", "status": 200, "content": "The \"search-evaluation-rank-tracking-bias\" error occurs when the evaluation function is checking the title before the content, which can lead to biased rankings. Here's a concrete and actionable fix:\n\n**Solution:**\n\n1. **Update your evaluation function**: Modify your evaluation function to prioritize the content over the title. You can do this by changing the order of the checks or by adding a weight to the content score.\n\n ```python\ndef evaluate_document(title, content, ranking):\n # Prioritize content over title\n content_score = calculate_content_score(content)\n title_score = calculate_title_score(title)\n \n # Calculate overall score\n overall_score = content_score * 0.7 + title_score * 0.3\n \n # Update ranking\n ranking.update({title: overall_score})\n```\n\n2. **Use a more robust evaluation metric**: Instead of using a simple score, consider using a more robust evaluation metric that takes into account both the title and content. For example, you can use the cosine similarity between the title and content.\n\n ```python\nimport numpy as np\n\ndef evaluate_document(title, content, ranking):\n # Calculate cosine similarity between title and content\n title_vector = np.array(title.split())\n ", "metrics": { "length": 1239, "commands": 1, "command_list": [ "2. **Use a more robust evaluation metric**: Instead of using a simple score, consider using a more robust evaluation metric that takes into account both the title and content. For example, you can use the cosine similarity between the title and content." ], "has_command_block": true, "actionable": true, "inline_code_count": 2, "lesson_hits": 1, "lesson_hit_rate": 0.167 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Search Quota Exhaustion Causes False Zero Results (search-quota-exhaustion-false-zero)", "condition": "with_lesson", "status": 200, "content": "To fix the \"Search Quota Exhaustion Causes False Zero Results\" error, you can follow these steps:\n\n**Immediate Fix**\n\n1. Reset the quota by deleting the existing file:\n```bash\nrm misakanet/.quota.json\n```\nThis will immediately reset the search quota to its default value, allowing you to run multiple searches without any issues.\n\n**Contributing a Lesson to Restore Quota**\n\nIf you want to contribute a lesson to restore the quota, you can use the following command:\n```bash\npython3 scripts/queue_lesson.py -t \"title\" -d domain \"content\"\n```\nReplace `\"title\"`, `\"domain\"`, and `\"content\"` with the actual values for your lesson.\n\n**Prevention**\n\nTo prevent the issue in the future, you can follow these best practices:\n\n1. **Check quota before running multiple queries**:\n```bash\ncat misakanet/.quota.json\n```\nThis will show you the current quota value. If it's low, you can reset the quota or wait until it's replenished.\n\n2. **Run searches with sufficient gaps between them**:\nTry to space out your searches by at least 5 minutes to allow the quota to replenish.\n\n3. **Reset quota between test batches", "metrics": { "length": 1103, "commands": 3, "command_list": [ "rm misakanet/.quota.json", "python3 scripts/queue_lesson.py -t \"title\" -d domain \"content\"", "cat misakanet/.quota.json" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 4, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Search Quota Exhaustion Causes False Zero Results (search-quota-exhaustion-false-zero)", "condition": "plain", "status": 200, "content": "The \"Search Quota Exhaustion Causes False Zero Results\" error typically occurs when you're using the Elasticsearch query DSL and your search query is causing the index to be exhausted, resulting in zero results being returned. Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Check the Index Size and Data Volume**\n\nBefore attempting to fix the issue, it's essential to understand the size of your index and the volume of data it contains. You can use the following commands to get an estimate of the index size and data volume:\n\n```bash\n# Get the index size in bytes\ncurl -XGET 'http://localhost:9200/_cat/indices/_all?pretty&size=1' | grep 'size_in_bytes' | awk '{print $2}'\n\n# Get the number of documents in the index\ncurl -XGET 'http://localhost:9200/_cat/indices/_all?pretty&size=1' | grep 'doc_count' | awk '{print $2}'\n```\n\n**Step 2: Check for Query Exhaustion**\n\nTo check if query exhaustion is the cause of the issue, you can use the `_explain` parameter in Elasticsearch. This parameter provides detailed information about the query execution plan, including the number", "metrics": { "length": 1096, "commands": 2, "command_list": [ "curl -XGET 'http://localhost:9200/_cat/indices/_all?pretty&size=1' | grep 'size_in_bytes' | awk '{print $2}'", "curl -XGET 'http://localhost:9200/_cat/indices/_all?pretty&size=1' | grep 'doc_count' | awk '{print $2}'" ], "has_command_block": true, "actionable": true, "inline_code_count": 2, "lesson_hits": 2, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Search SSOT: Fixing Data Source Pollution in Static-Deployed Sites (search-ssot-data-source-pollution-fix)", "condition": "with_lesson", "status": 200, "content": "Here is a concrete, actionable fix with exact commands to resolve the issue:\n\n**Step 1: Create a new branch and update the data source**\n\nCreate a new branch to work on the changes:\n```bash\ngit checkout -b fix-data-source-pollution\n```\nUpdate the data source by copying `data/lessons.json` to `docs/data/lessons.json`:\n```bash\ncp data/lessons.json docs/data/\n```\n**Step 2: Update the `getLessonsUrl` function**\n\nUpdate the `getLessonsUrl` function to return the new data source URL:\n```javascript\n// Before (polluted)\nfunction getLessonsUrl() {\n return \"/api/lessons\"; // Worker fetches from stale branch\n}\n\n// After (clean)\nfunction getLessonsUrl() {\n return \"/data/lessons.json\"; // Static, same as main branch\n}\n```\n**Step 3: Update the CI workflow**\n\nUpdate the CI workflow to copy `data/lessons.json` to `docs/data/` on each run:\n```yml\n# .github/workflows/ci.yml\n\nname: CI\n\non:\n push:\n branches:\n - main\n\njobs:\n build:\n runs-on", "metrics": { "length": 950, "commands": 4, "command_list": [ "git checkout -b fix-data-source-pollution", "cp data/lessons.json docs/data/", "**Step 3: Update the CI workflow**", "Update the CI workflow to copy `data/lessons.json` to `docs/data/` on each run:" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Search Smart Fallback — Turning Zero Results into Discovery (search-smart-fallback-implementation)", "condition": "with_lesson", "status": 200, "content": "Here's a concrete, actionable fix for the Search Smart Fallback issue:\n\n**Step 1: Install required packages**\n\n```bash\npip install nltk\npip install spacy\npython -m spacy download en_core_web_sm\n```\n\n**Step 2: Create a new file for smart fallback implementation**\n\nCreate a new file named `smart_fallback.py` in the same directory as your original search implementation.\n\n**Step 3: Implement closest matches by keyword overlap**\n\nIn `smart_fallback.py`, add the following code:\n\n```python\nimport re\nfrom nltk.corpus import stopwords\nfrom nltk.tokenize import word_tokenize\nfrom collections import Counter\nimport spacy\n\nnlp = spacy.load(\"en_core_web_sm\")\n\ndef _find_closest_matches(query, docs, top_n=3):\n query_words = set(re.findall(r'\\w+', query.lower()))\n scored = []\n for doc in docs:\n doc_words = set(re.findall(r'\\w+', (doc.title + \" \" + doc.content[:500]).lower()))\n overlap = len(query_words & doc_words)\n if overlap > 0:\n scored.append((overlap / len(query_words), doc))\n return sorted(scored, key=lambda x: -x[0", "metrics": { "length": 1064, "commands": 3, "command_list": [ "pip install nltk", "pip install spacy", "python -m spacy download en_core_web_sm" ], "has_command_block": true, "actionable": true, "inline_code_count": 4, "lesson_hits": 3, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Search Smart Fallback — Turning Zero Results into Discovery (search-smart-fallback-implementation)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely related to the Elasticsearch query DSL (Domain Specific Language) implementation for the \"search-smart-fallback\" feature. The \"search-smart-fallback\" feature is used to turn zero results into discovery results.\n\nHere's a concrete, actionable fix with exact commands:\n\n**Step 1: Update the Elasticsearch query DSL**\n\nYou'll need to update the query DSL to include the `smart_fallback` parameter. Here's an example of how to do this:\n\n```json\n{\n \"query\": {\n \"match_all\": {\n \"smart_fallback\": true\n }\n }\n}\n```\n\n**Step 2: Update the Elasticsearch index mapping**\n\nYou'll also need to update the index mapping to include the `smart_fallback` parameter. Here's an example of how to do this:\n\n```json\n{\n \"properties\": {\n \"smart_fallback\": {\n \"type\": \"boolean\",\n \"default\": true\n }\n }\n}\n```\n\n**Step 3: Re-index your data**\n\nOnce you've updated your index mapping, you'll need to re-index your data to include the `smart_fallback` parameter. Here's an example of how to do this using the Elasticsearch REST API:\n\n", "metrics": { "length": 1075, "commands": 2, "command_list": [ "**Step 2: Update the Elasticsearch index mapping**", "You'll also need to update the index mapping to include the `smart_fallback` parameter. Here's an example of how to do this:" ], "has_command_block": true, "actionable": false, "inline_code_count": 6, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Search SSOT: Fixing Data Source Pollution in Static-Deployed Sites (search-ssot-data-source-pollution-fix)", "condition": "plain", "status": 200, "content": "The error \"Search SSOT: Fixing Data Source Pollution in Static-Deployed Sites\" is typically related to a security vulnerability in SharePoint. Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Update SharePoint**\n\nUpdate SharePoint to the latest version.\n\nOpen a PowerShell console as an administrator and run the following command:\n```\nInstall-Package Microsoft.SharePoint.PowerShell -Version 16.0.0.8023\n```\n**Step 2: Update SharePoint Configuration**\n\nUpdate the SharePoint configuration to prevent data source pollution.\n\nOpen a PowerShell console as an administrator and run the following command:\n```\nSet-SPSite -Identity https://your-sharepoint-site.com -WebApplication \"SharePoint Web Application\"\n```\nReplace \"https://your-sharepoint-site.com\" with the URL of your SharePoint site.\n\nThen, run the following command:\n```\nSet-SPWebConfig -Identity \"SharePoint Web Application\" -Bitfield 0x80000000\n```\n**Step 3: Update SharePoint Web Configuration**\n\nUpdate the SharePoint web configuration to prevent data source pollution.\n\nOpen a PowerShell console as an administrator and run the following command:\n```\nSet-SPWebConfig -Identity \"SharePoint Web Application\" -Bitfield ", "metrics": { "length": 1195, "commands": 3, "command_list": [ "Install-Package Microsoft.SharePoint.PowerShell -Version 16.0.0.8023", "Set-SPSite -Identity https://your-sharepoint-site.com -WebApplication \"SharePoint Web Application\"", "Set-SPWebConfig -Identity \"SharePoint Web Application\" -Bitfield 0x80000000" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Forum Accessibility Testing — Systematic Reachability Check (session-lesson-2-forum-accessibility-testing)", "condition": "with_lesson", "status": 200, "content": "To fix the issue, we need to modify the script to handle different types of inaccessible forums. Here's an updated version of the script:\n\n```bash\n#!/bin/bash\n\n# Define the list of forums to test\nforums=(\"news.ycombinator.com\" \"dev.to\" \"lobste.rs\" \"juejin.cn\" \"reddit.com\")\n\n# Level 1: HTTP 状态码\nfor site in \"${forums[@]}\"; do\n code=$(curl -sL --max-time 5 -o /dev/null -w \"%{http_code}\" \"https://$site/\" -H \"User-Agent: Mozilla/5.0\")\n echo \"$site: $code\"\ndone\n\n# Level 2: API 可用性\nfor site in \"${forums[@]}\"; do\n if curl -sL --max-time 8 \"https://hn.algolia.com/api/v1/search?query=test&hitsPerPage=1\" | head -100; then\n echo \"$site: API 可达\"\n else\n echo \"$site: API 可达\"\n fi\ndone\n\n# Level 3: Playwright 渲染\nfor site in \"${forums[@]}\"; do\n if curl -s", "metrics": { "length": 758, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 0, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Forum Accessibility Testing — Systematic Reachability Check (session-lesson-2-forum-accessibility-testing)", "condition": "plain", "status": 200, "content": "I don't see any code provided in your question. However, I'll provide a general solution for the error you're likely experiencing.\n\nThe error you're referring to is likely related to the WAVE Web Accessibility Evaluation Tool, which is a browser extension used for web accessibility testing. Here's a step-by-step guide to fix the error:\n\n**Error:** \"The WAVE Web Accessibility Evaluation Tool has encountered an error.\"\n\n**Fix:**\n\n1. **Check the WAVE Web Accessibility Evaluation Tool's settings:**\n Open the WAVE Web Accessibility Evaluation Tool in your browser. Go to the settings by clicking on the gear icon or the three dots (⋮) next to the \"Start Evaluation\" button.\n\n2. **Clear the cache and cookies:**\n In the settings, click on the \"Clear Cache and Cookies\" option.\n\n3. **Disable any extensions that might be causing the issue:**\n If you have any browser extensions installed, try disabling them one by one to see if the error persists.\n\n4. **Check for any conflicts with other browser extensions:**\n If you have multiple browser extensions installed, try disabling all of them except for the WAVE Web Accessibility Evaluation Tool.\n\n5. **Update the WAVE Web Accessibility Evaluation Tool:**\n", "metrics": { "length": 1211, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 1, "lesson_hit_rate": 0.167 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Lobsters JSON API — Structured Tech Forum Scraping (session-lesson-3-lobsters-json-api)", "condition": "with_lesson", "status": 200, "content": "To fix the error, you need to add a search endpoint to the Lobsters API. Unfortunately, the Lobsters API does not provide a built-in search endpoint. However, you can use a workaround by making a GET request to the `/search.json` endpoint with the `q` parameter set to your desired search query.\n\nHere's an example of how you can modify your Python code to add a search endpoint:\n\n```bash\n# Install the required libraries\npip install requests\n\n# Define the search endpoint URL\nsearch_url = \"https://lobste.rs/search.json\"\n\n# Define the search query\nsearch_query = \"agent\"\n\n# Define the keywords\nkeywords = [\"agent\", \"mcp\", \"claude\", \"memory\", \"devops\", \"automation\", \n \"docker\", \"kubernetes\", \"ci\", \"security\", \"rust\", \"python\"]\n\n# Make a GET request to the search endpoint\nreq = requests.get(search_url, params={\"q\": search_query, \"sort\": \"score\", \"page\": 1})\n\n# Check if the request was successful\nif req.status_code == 200:\n # Parse the JSON response\n data = req.json()\n\n # Extract the relevant posts\n relevant = []\n for post in", "metrics": { "length": 1057, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 2, "lesson_hits": 1, "lesson_hit_rate": 0.167 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Lobsters JSON API — Structured Tech Forum Scraping (session-lesson-3-lobsters-json-api)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely due to the fact that the Lobsters JSON API is not designed to handle the requests you're sending. The API has specific endpoint URLs and parameters that must be followed exactly.\n\nTo scrape the Lobsters JSON API, you can use the `requests` library in Python to send a GET request to the API endpoint. However, you need to make sure you're sending the correct parameters.\n\nHere's an example of how you can fix the error:\n\n```bash\n# Install the required libraries\npip install requests\n\n# Use the following Python code to scrape the Lobsters JSON API\nimport requests\nimport json\n\n# Set the API endpoint URL\nurl = \"https://www.lobsters.com/api/v1/posts.json\"\n\n# Set the parameters\nparams = {\n \"limit\": 10, # Limit the number of posts returned\n \"sort\": \"desc\", # Sort the posts in descending order\n \"offset\": 0 # Offset the posts to start from the beginning\n}\n\n# Send a GET request to the API endpoint\nresponse = requests.get(url, params=params)\n\n# Check if the request was successful\nif response.status_code == 200:\n # Parse the JSON response\n data = response", "metrics": { "length": 1113, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 1, "lesson_hits": 2, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Playwright Forum Selectors — WoltLab/IPS/Common Patterns (session-lesson-4-playwright-forum-selectors)", "condition": "plain", "status": 200, "content": "The error you're experiencing is likely due to the fact that the forum selector pattern used in the Playwright course is not a standard CSS selector and might be specific to the WoltLab/IPS platform.\n\nHere's a concrete, actionable fix:\n\n**Method 1: Using the `has-text` selector**\n\nYou can try using the `has-text` selector to target the forum selector pattern. Here's an example command:\n\n```bash\nplaywright inspect --target main --selector \"div.has-text\" --filter-by-class\n```\n\nThis command will inspect the `div` elements with the `has-text` class, which might contain the forum selector pattern.\n\n**Method 2: Inspecting the HTML structure**\n\nYou can try inspecting the HTML structure of the forum selector pattern to identify the specific class or ID used to target it. Here's an example command:\n\n```bash\nplaywright inspect --target main --filter-by-class\n```\n\nThis command will display the HTML structure of the page, which you can then use to identify the class or ID used to target the forum selector pattern.\n\n**Method 3: Using a custom selector**\n\nIf the above methods don't work, you can try creating a custom selector to target the forum selector pattern. Here's an", "metrics": { "length": 1177, "commands": 2, "command_list": [ "playwright inspect --target main --selector \"div.has-text\" --filter-by-class", "playwright inspect --target main --filter-by-class" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Playwright Forum Selectors — WoltLab/IPS/Common Patterns (session-lesson-4-playwright-forum-selectors)", "condition": "with_lesson", "status": 200, "content": "To fix the issue with the Playwright forum selectors, you need to update the selectors to match the specific HTML structure of each forum. Here's an updated code snippet with concrete, actionable fixes for each forum:\n\n**WoltLab (robot-forum.com)**\n\n```javascript\n// 帖子列表\nconst threads = await page.evaluate(() => {\n const results = [];\n document.querySelectorAll('.wbbThread').forEach((item) => {\n const titleEl = item.querySelector('.columnSubject h3 a');\n const stats = item.querySelectorAll('.columnStats .statsDataList');\n const replies = stats[0] ? parseInt(stats[0].querySelector('dd').textContent) : 0;\n const views = stats[1] ? parseInt(stats[1].querySelector('dd').textContent) : 0;\n const resolved = item.dataset.isDone === '1'; // 关键:data-is-done 属性\n const dateEl = item.querySelector('woltlab-core-date-time');\n \n if (titleEl) {\n results.push({\n href: titleEl.href,\n replies, views, resolved,\n date: dateEl ? dateEl.getAttribute('date') : ''\n });\n }\n });\n return results;\n});\n``", "metrics": { "length": 1054, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 1, "lesson_hits": 5, "lesson_hit_rate": 0.833 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Shell Debugging — set -x 与常见Pitfalls (shell-script-debugging)", "condition": "with_lesson", "status": 200, "content": "The error you're encountering is due to the fact that the `set -x` option only prints the commands that are executed, but it doesn't show the variables that are being used. This can make it difficult to diagnose issues.\n\nHere's a concrete, actionable fix with exact commands:\n\n**Step 1: Add `set -x` to your shell script**\n\nAdd the following line to the top of your shell script:\n```bash\nset -x\n```\nThis will print the commands that are executed, which can help you diagnose issues.\n\n**Step 2: Use double quotes around variable expansions**\n\nIn your script, you're using the `for` loop to iterate over the files, but you're not using double quotes around the variable expansion:\n```bash\nfor f in $FILES; do\n echo \"处理: $f\"\ndone\n```\nTo fix this, add double quotes around the variable expansion:\n```bash\nfor f in \"$FILES\"; do\n echo \"处理: $f\"\ndone\n```\nThis will prevent the files with spaces from being split.\n\n**Step 3: Use `mapfile` instead of `ls`**\n\nIn your script, you're using `ls` to get the files, but you're", "metrics": { "length": 1017, "commands": 7, "command_list": [ "set -x", "for f in $FILES; do", "echo \"处理: $f\"", "done", "for f in \"$FILES\"; do" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 1, "lesson_hit_rate": 0.167 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "shared json needs atomic write (shared-json-needs-atomic-write)", "condition": "with_lesson", "status": 200, "content": "To fix the \"shared json needs atomic write\" error, you can use the following approach:\n\n1. Create a temporary file for the JSON data.\n2. Write the JSON data to the temporary file.\n3. Use `os.rename` to atomically rename the temporary file to the original file path.\n\nHere's an example of how you can implement this in Python:\n\n```python\nimport os\nimport json\n\ndef write_json_atomic(path, data):\n \"\"\"\n Write JSON data to a file in an atomic way.\n\n Args:\n path (str): The path to the file.\n data (dict): The JSON data to write.\n\n Returns:\n None\n \"\"\"\n # Create a temporary file for the JSON data\n with tempfile.NamedTemporaryFile('w', delete=False, dir=os.path.dirname(path)) as f:\n # Write the JSON data to the temporary file\n json.dump(data, f)\n # Get the name of the temporary file\n tmp = f.name\n\n # Use os.rename to atomically rename the temporary file to the original file path\n os.rename(tmp, path)\n```\n\nTo test this function, you can use the following command:\n\n```bash\necho \"Lesson: shared json needs atomic write\"", "metrics": { "length": 1095, "commands": 1, "command_list": [ "To test this function, you can use the following command:" ], "has_command_block": true, "actionable": true, "inline_code_count": 3, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "shared json needs atomic write (shared-json-needs-atomic-write)", "condition": "plain", "status": 200, "content": "The error \"shared json needs atomic write\" is typically raised when two or more processes are trying to write to the same shared JSON file at the same time. This can happen in distributed systems or when multiple processes are accessing the same data source.\n\nTo fix this issue, you can use a locking mechanism to ensure that only one process can write to the shared JSON file at a time. Here's an example of how you can use `flock` command on Linux systems to achieve this:\n\n**Step 1: Install the required package**\n\n```bash\nsudo apt-get install flock\n```\n\n**Step 2: Wrap your JSON write operation with a lock**\n\nAssuming you're using Python, here's an example code snippet that wraps your JSON write operation with a lock:\n```python\nimport json\nimport os\nimport time\n\ndef write_json_to_file(filename, data):\n lock_file = filename + \".lock\"\n with open(lock_file, \"w\") as lock_file:\n os.flock(lock_file, os.F LOCK_EX | os.F LOCK_NB)\n try:\n with open(filename, \"w\") as json_file:\n json.dump(data, json_file)\n finally:\n os.flock(lock_file, os.F LOCK_UN)\n os", "metrics": { "length": 1130, "commands": 1, "command_list": [ "sudo apt-get install flock" ], "has_command_block": true, "actionable": true, "inline_code_count": 3, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Shell Debugging — set -x 与常见Pitfalls (shell-script-debugging)", "condition": "plain", "status": 200, "content": "The error you're encountering is related to the use of `set -x` in shell scripting, which can lead to unexpected behavior if not used correctly. Here's a concrete, actionable fix with exact commands:\n\n**Problem:**\n\nWhen you use `set -x`, it enables tracing of the commands executed by the shell. However, if you're using `set -x` inside a function or a conditional block, the tracing only happens when the condition is true. This can lead to unexpected behavior, as the tracing may not capture the commands executed when the condition is false.\n\n**Fix:**\n\nTo fix this issue, you can use the following approach:\n\n```bash\n#!/bin/bash\n\n# Enable tracing for the entire script\nset -x\n\n# Define a function that will be executed with tracing\nmy_function() {\n # Use tracing inside the function\n echo \"Inside my_function\"\n}\n\n# Call the function with tracing\nmy_function\n```\n\nIn this example, the `set -x` command is used outside the function definition to enable tracing for the entire script. Inside the function, the `set -x` command is used again to enable tracing for the function itself.\n\nAlternatively, you can use `set -x` only when needed, by", "metrics": { "length": 1143, "commands": 5, "command_list": [ "set -x", "my_function() {", "echo \"Inside my_function\"", "}", "my_function" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 1, "lesson_hit_rate": 0.167 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "SSH host key verification failed when connecting to a remote server (ssh-host-key-verification-failed)", "condition": "with_lesson", "status": 200, "content": "Here's a concrete, actionable fix for the SSH host key verification failed error:\n\n**Step 1: Remove the old host key (for changed keys)**\n\nIf the remote server was previously connected to but has been reinstalled or reconfigured, you can remove the old host key using the following command:\n\n```bash\nssh-keygen -R hostname.example.com\n```\n\nReplace `hostname.example.com` with the actual server hostname or IP address.\n\n**Step 2: Edit ~/.ssh/known_hosts manually (for unknown hosts)**\n\nIf the server is not in `known_hosts` at all, or if StrictHostKeyChecking is set to `yes`, you can edit the file manually to delete the offending line. Here's how:\n\n```bash\nnano ~/.ssh/known_hosts\n```\n\nNavigate to the line that corresponds to the server you're trying to connect to, and delete it. Save and close the file.\n\n**Step 3: Connect again**\n\nAfter removing or editing the old host key, connect to the remote server again using the following command:\n\n```bash\nssh user@hostname.example.com\n```\n\nSSH will prompt you to accept the new host key. Verify the key fingerprint with the server administrator to ensure it's legitimate.\n\n**Example Use Case", "metrics": { "length": 1139, "commands": 3, "command_list": [ "ssh-keygen -R hostname.example.com", "nano ~/.ssh/known_hosts", "ssh user@hostname.example.com" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "SSH host key verification failed when connecting to a remote server (ssh-host-key-verification-failed)", "condition": "plain", "status": 200, "content": "The SSH host key verification failed error typically occurs when the SSH client and server have different host keys. Here's a step-by-step fix to resolve this issue:\n\n**Method 1: Add the Host Key to the Client**\n\nThis method involves adding the host key to the client's known hosts file. This method is not recommended as it can make your system vulnerable to man-in-the-middle attacks.\n\n```bash\n# Connect to the remote server using SSH\nssh -o \"StrictHostKeyChecking=no\" user@remote-server\n\n# Add the host key to the known hosts file\nssh-keyscan -t rsa -H remote-server > known_hosts\n```\n\n**Method 2: Ignore Host Key Verification**\n\nThis method involves ignoring host key verification for the remote server. This method is not recommended as it can make your system vulnerable to man-in-the-middle attacks.\n\n```bash\n# Connect to the remote server using SSH\nssh -o \"StrictHostKeyChecking=no\" user@remote-server\n```\n\n**Method 3: Add the Host Key Manually**\n\nThis method involves adding the host key manually to the client's known hosts file.\n\n```bash\n# Connect to the remote server using SSH\nssh -o \"StrictHostKeyChecking=no\" user@remote", "metrics": { "length": 1135, "commands": 3, "command_list": [ "ssh -o \"StrictHostKeyChecking=no\" user@remote-server", "ssh-keyscan -t rsa -H remote-server > known_hosts", "ssh -o \"StrictHostKeyChecking=no\" user@remote-server" ], "has_command_block": true, "actionable": false, "inline_code_count": 4, "lesson_hits": 3, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Superteam Earn API returns Insufficient credits on submission create (superteam-earn-api-insufficient-credits)", "condition": "plain", "status": 200, "content": "The error \"Insufficient credits\" typically indicates that the API has exceeded its usage limits or has insufficient credits to process your request. Here's a concrete, actionable fix with exact commands to help you resolve the issue:\n\n**Method 1: Check and Adjust API Credits**\n\n1. Check the API usage credits: Run the following command to check the current API credits:\n ```bash\nsuperteam-earn-api credits\n```\n This will display the current credit balance and usage limits.\n\n2. Adjust the API credits (if necessary): If you've exceeded the usage limits or need more credits, you can adjust them using the following command:\n ```bash\nsuperteam-earn-api adjust-credits \n```\n Replace `` with the desired credit limit.\n\n**Method 2: Check and Optimize API Request**\n\n1. Review the API request: Check the API request to ensure you're not exceeding the usage limits. Review the request body, parameters, and headers to identify any unnecessary or excessive data.\n\n2. Optimize the API request: Refine the API request to reduce its size and complexity. You can do this by:\n * Removing unnecessary parameters or data.\n * Using more efficient data formats", "metrics": { "length": 1193, "commands": 2, "command_list": [ "superteam-earn-api credits", "superteam-earn-api adjust-credits " ], "has_command_block": true, "actionable": true, "inline_code_count": 4, "lesson_hits": 2, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Superteam Earn API returns Insufficient credits on submission create (superteam-earn-api-insufficient-credits)", "condition": "with_lesson", "status": 200, "content": "To fix the Insufficient credits error, you need to follow the canonical host after redirect discovery. Here's a concrete, actionable fix with exact commands:\n\n1. Prefer the canonical host after redirect discovery:\n\n```bash\nFollow redirects\ncurl -sS -L -X POST 'https://superteam.fun/api/submission/create' \\\n -H \"Content-Type: application/json\" \\\n -H \"Cookie: $COOKIE\" \\\n -d '{\"listingId\":\"...\",\"link\":\"...\",\"tweet\":\"...\",\"otherInfo\":\"...\"}'\n```\n\nHowever, you mentioned that you are getting a 403 error earlier, which means the server is not allowing your request. \n\nTo troubleshoot this issue, you can try the following:\n\n```bash\n# Get the headers from the previous 403 response\nresponse=$(curl -s -X GET 'https://superteam.fun/api/submission/create')\n\n# Extract the Location header which indicates the redirect URL\nredirect_url=$(echo \"$response\" | grep Location | awk '{print $2}')\n\n# Follow the redirect\nresponse=$(curl -s -L -X POST \"$redirect_url\" \\\n -H \"Content-Type: application/json\" \\\n -H \"Cookie: $COOKIE\" \\\n -", "metrics": { "length": 1027, "commands": 5, "command_list": [ "Follow redirects", "curl -sS -L -X POST 'https://superteam.fun/api/submission/create' \\", "-H \"Content-Type: application/json\" \\", "-H \"Cookie: $COOKIE\" \\", "-d '{\"listingId\":\"...\",\"link\":\"...\",\"tweet\":\"...\",\"otherInfo\":\"...\"}'" ], "has_command_block": true, "actionable": true, "inline_code_count": 2, "lesson_hits": 5, "lesson_hit_rate": 0.833 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "TaskBounty payout POST succeeds but solver_readiness still fails (taskbounty-payout-api-ok-readiness-still-fail)", "condition": "with_lesson", "status": 200, "content": "To fix the issue, you need to update the `solver_readiness` checks to ignore the payout POST success for already-awarded tasks. Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Update the `solver_readiness` checks**\n\nIn your code, modify the `solver_readiness` function to ignore the payout POST success for already-awarded tasks. You can do this by adding a condition to check if the task is already awarded before checking the payout method.\n\nHere's an example code snippet in Python:\n```python\ndef solver_readiness(task):\n # Check if the task is already awarded\n if task.status == 'awarded':\n return True # Ignore payout POST success for already-awarded tasks\n\n # Check if there's a payout method on file\n if not task.payout_method:\n return False # No payout method, cannot send payments\n\n # Check if the payout method is valid\n if task.payout_method['type'] != 'solana_usdc':\n return False # Invalid payout method\n\n # Check if the Solana address is valid\n if not task.payout_method['address']:\n return False # Invalid Solana address\n\n return True", "metrics": { "length": 1126, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 3, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "TaskBounty payout POST succeeds but solver_readiness still fails (taskbounty-payout-api-ok-readiness-still-fail)", "condition": "plain", "status": 200, "content": "The error \"taskbounty-payout-api-ok-readiness-still-fail\" typically indicates that the TaskBounty payout API has been successfully updated, but the solver readiness has not been updated accordingly.\n\nHere's a step-by-step fix:\n\n**Step 1: Update the TaskBounty Payout API**\n\nRun the following command to update the TaskBounty payout API:\n\n```bash\nkubectl patch taskbounty/payout-api -p '{\"spec\":{\"solverReadiness\":true}}'\n```\n\nThis command updates the `solverReadiness` field to `true` in the `payout-api` TaskBounty resource.\n\n**Step 2: Wait for the TaskBounty Payout API to be updated**\n\nRun the following command to wait for the TaskBounty payout API to be updated:\n\n```bash\nkubectl get taskbounty/payout-api -o jsonpath='{.status.updated}'\n```\n\nThis command prints the timestamp of when the TaskBounty payout API was last updated.\n\n**Step 3: Check the solver readiness**\n\nRun the following command to check the solver readiness:\n\n```bash\nkubectl get taskbounty/payout-api -o jsonpath='{.spec.solverReadiness}'\n```\n\nThis command prints the current solver readiness status.\n\nIf", "metrics": { "length": 1078, "commands": 3, "command_list": [ "kubectl patch taskbounty/payout-api -p '{\"spec\":{\"solverReadiness\":true}}'", "kubectl get taskbounty/payout-api -o jsonpath='{.status.updated}'", "kubectl get taskbounty/payout-api -o jsonpath='{.spec.solverReadiness}'" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "TypeScript solution-style tsconfig — tsc --noEmit checks nothing silently (typescript-solution-tsconfig-silent-nocheck)", "condition": "with_lesson", "status": 200, "content": "To fix the TypeScript error, you need to delete the unused import from `lucide-react`, use the correct typecheck command targeting the app project, and add a deliberate-breakage test to CI. Here are the concrete, actionable steps:\n\n**Step 1: Delete the unused import**\n\nRemove the line `import { Map } from 'lucide-react';` from your code.\n\n**Step 2: Use the correct typecheck command**\n\nUpdate your `tsconfig.app.json` file to use the correct typecheck command:\n```json\n{\n \"compilerOptions\": {\n // ...\n \"outDir\": \"build\",\n \"module\": \"commonjs\",\n \"noImplicitAny\": true,\n \"strict\": true,\n \"sourceMap\": true,\n \"esModuleInterop\": true,\n \"allowSyntheticDefaultImports\": true,\n \"target\": \"esnext\",\n \"moduleResolution\": \"node\",\n \"resolveJsonModule\": true,\n \"noFallthroughCasesInSwitch\": true,\n \"module\": \"commonjs\",\n \"noImplicitThis\": true\n }\n}\n```\nThen, run the following command to typecheck your app project:\n```bash\nnpx tsc -p tsconfig.app", "metrics": { "length": 981, "commands": 1, "command_list": [ "Then, run the following command to typecheck your app project:" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 2, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "TypeScript solution-style tsconfig — tsc --noEmit checks nothing silently (typescript-solution-tsconfig-silent-nocheck)", "condition": "plain", "status": 200, "content": "The error you're experiencing is due to a configuration issue in your `tsconfig.json` file. The `--noEmit` flag tells TypeScript to compile your code without emitting any output files. However, when you run `tsc` with this flag, it checks your code silently and reports any errors or warnings.\n\nTo fix this issue, you need to add the `noEmit` option to your `compilerOptions` in your `tsconfig.json` file. Here's how you can do it:\n\n1. Open your `tsconfig.json` file in a text editor.\n2. Add the following line to the `compilerOptions` section:\n\n```json\n\"noEmit\": true,\n```\n\nSo your `tsconfig.json` file should look something like this:\n\n```json\n{\n \"compilerOptions\": {\n \"outDir\": \"dist\",\n \"sourceMap\": true,\n \"noImplicitAny\": true,\n \"moduleResolution\": \"node\",\n \"esModuleInterop\": true,\n \"allowSyntheticDefaultImports\": true,\n \"noCheckJs\": true,\n \"noEmit\": true\n },\n \"include\": [\"src/**/*\"]\n}\n```\n\n3. Save your `tsconfig.json`", "metrics": { "length": 954, "commands": 1, "command_list": [ "So your `tsconfig.json` file should look something like this:" ], "has_command_block": true, "actionable": true, "inline_code_count": 13, "lesson_hits": 2, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "USDC: base units vs human amounts — агент платит 1000x или думает, что 1000 (usdc-base-units-vs-human-amounts-agent-marketplaces-ru)", "condition": "with_lesson", "status": 200, "content": "**Fixing the Issue: USDC Base Units vs Human Amounts**\n\nTo resolve the issue, we need to address the following problems:\n\n1. Convert `paymentAmount` from base units to human (USDC) amounts.\n2. Handle the difference in decimal places between USDC and other cryptocurrencies (18 decimals vs 6 decimals).\n3. Update the code to correctly handle `balanceBaseUnits` and `balanceUsdc`.\n\n**Step 1: Convert `paymentAmount` to Human (USDC) Amounts**\n\nWe need to modify the code to convert `paymentAmount` from base units to human (USDC) amounts. We can do this by dividing the `paymentAmount` by the number of base units in 1 USDC (1,000,000).\n\n```python\n# Replace this line\npayment_amount = 1000\n\n# With this line\npayment_amount = payment_amount / 10**6 # Convert base units to human (USDC) amounts\n```\n\n**Step 2: Handle Decimal Place Difference**\n\nSince USDC has 6 decimals, we need to handle the difference in decimal places when converting between base units and human (USDC) amounts. We can do this by rounding the `paymentAmount", "metrics": { "length": 1028, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 8, "lesson_hits": 2, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "USDC: base units vs human amounts — агент платит 1000x или думает, что 1000 (usdc-base-units-vs-human-amounts-agent-marketplaces-ru)", "condition": "plain", "status": 200, "content": "The error message you're seeing is related to a specific marketplace issue with USDC. Here's a step-by-step fix:\n\n**Method 1: Update the marketplace configuration**\n\n1. Open the terminal and navigate to the marketplace directory.\n2. Run the following command to update the marketplace configuration:\n```bash\nnpm run config:marketplace:usdc\n```\nThis command updates the marketplace configuration to reflect the correct USDC base units.\n\n**Method 2: Update the agent configuration**\n\n1. Open the terminal and navigate to the agent directory.\n2. Run the following command to update the agent configuration:\n```bash\nnpm run config:agent:usdc\n```\nThis command updates the agent configuration to reflect the correct USDC base units.\n\n**Method 3: Update the marketplace settings**\n\n1. Open the terminal and navigate to the marketplace directory.\n2. Run the following command to update the marketplace settings:\n```bash\nnpm run config:marketplace:settings:usdc\n```\nThis command updates the marketplace settings to reflect the correct USDC base units.\n\nAfter running any of these commands, restart the marketplace and agent services. You can do this by running the following commands:\n```bash\nnpm start\n```\nThis should resolve the issue and", "metrics": { "length": 1231, "commands": 4, "command_list": [ "npm run config:marketplace:usdc", "npm run config:agent:usdc", "npm run config:marketplace:settings:usdc", "npm start" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 1, "lesson_hit_rate": 0.167 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "USDC пришёл в Ethereum mainnet, а нужен Base — и 0 ETH на газ (usdc-ethereum-instead-of-base-zero-eth-gas)", "condition": "plain", "status": 200, "content": "The error message you're encountering suggests that the USDC token has been deployed on the Ethereum mainnet, but the contract is expecting the Base token, which is not present. Additionally, there is an issue with the gas price, as it's set to 0.\n\nTo fix this issue, you'll need to deploy the Base token on the Ethereum mainnet and update the USDC contract to use the Base token instead of the Ethereum token. Here are the steps to follow:\n\n**Step 1: Deploy the Base token**\n\nYou'll need to deploy a new contract for the Base token. You can use a tool like Truffle or OpenZeppelin to deploy a contract.\n\nAssuming you're using Truffle, run the following command:\n```bash\ntruffle migrate --network mainnet\n```\nThis will deploy a new contract for the Base token on the Ethereum mainnet.\n\n**Step 2: Update the USDC contract**\n\nYou'll need to update the USDC contract to use the Base token instead of the Ethereum token. You can do this by updating the `token` variable in the contract's ABI.\n\nAssuming you have the USDC contract's ABI, you can update it using the following command:\n```bash\ntruffle update-usdc-contract", "metrics": { "length": 1116, "commands": 1, "command_list": [ "truffle migrate --network mainnet" ], "has_command_block": true, "actionable": true, "inline_code_count": 3, "lesson_hits": 1, "lesson_hit_rate": 0.167 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Version Management Across Multiple Files (version-management-multiple-files)", "condition": "plain", "status": 200, "content": "The error \"Version Management Across Multiple Files (version-management-multiple-files)\" typically occurs when you're trying to manage the version of a file using Git, but the file has been modified by multiple people.\n\nHere's a step-by-step fix to resolve this issue:\n\n**Step 1: Check the commit history**\n```bash\ngit log\n```\nThis command will display the commit history of your repository. Look for any commits that include the file you're trying to manage.\n\n**Step 2: Identify the conflicting changes**\n```bash\ngit diff --stat\n```\nThis command will show you the differences between the current version of the file and the previous versions. Look for any changes that were made by multiple people.\n\n**Step 3: Use `git merge` to resolve conflicts**\n```bash\ngit merge \n```\nReplace `` with the name of the branch that contains the conflicting changes. This will merge the changes from that branch into your current branch.\n\n**Step 4: Resolve conflicts manually**\nIf the merge was successful, you may need to manually resolve any conflicts that were detected. Look for any files that have been modified by multiple people and resolve the conflicts by choosing the version that you want to keep.\n\n**Step ", "metrics": { "length": 1227, "commands": 3, "command_list": [ "git log", "git diff --stat", "git merge " ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 1, "lesson_hit_rate": 0.167 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "USDC пришёл в Ethereum mainnet, а нужен Base — и 0 ETH на газ (usdc-ethereum-instead-of-base-zero-eth-gas)", "condition": "with_lesson", "status": 200, "content": "Чтобы решить эту проблему, нам нужно найти USDC на Ethereum mainnet и USDC на Base. Затем мы можем использовать эти балансы для преобразования USDC на Base.\n\nСначала, мы можем использовать `cast` команду для определения баланса USDC на Ethereum mainnet и Base:\n\n```bash\n# ETH balance (mainnet)\neth_getBalance --rpc-url https://ethereum.publicnode.com\n\n# USDC mainnet (balanceOf)\ncast call 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 \"balanceOf(address)(uint256)\" --rpc-url https://ethereum.publicnode.com\n\n# USDC Base\ncast call 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 \"balanceOf(address)(uint256)\" --rpc-url https://ethereum.publicnode.com\n```\n\nЗатем мы можем использовать эти балансы для преобразования USDC на Base:\n\n```bash\n# Преобразование USDC на Base\nUSDC_MAINNET_BALANCE", "metrics": { "length": 818, "commands": 3, "command_list": [ "eth_getBalance --rpc-url https://ethereum.publicnode.com", "cast call 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 \"balanceOf(address)(uint256)\" --rpc-url https://ethereum.publicnode.com", "cast call 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 \"balanceOf(address)(uint256)\" --rpc-url https://ethereum.publicnode.com" ], "has_command_block": true, "actionable": false, "inline_code_count": 3, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Version Management Across Multiple Files (version-management-multiple-files)", "condition": "with_lesson", "status": 200, "content": "To fix the issue of having a single source of truth for version numbers across multiple files, we can use a combination of tools and techniques. Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Update `pyproject.toml`**\n\nOpen your `pyproject.toml` file in a text editor and update the `version` field to the desired version number:\n```toml\n[tool.poetry.version]\nversion = \"X.Y.Z\"\n```\nReplace `X.Y.Z` with the desired version number.\n\n**Step 2: Update `CHANGELOG.md`**\n\nOpen your `CHANGELOG.md` file in a text editor and update the version number at the top of the file:\n```markdown\nVX.Y.Z — YYYY-MM-DD\n\nHighlights\n- Feature 1\n- Feature 2\n\nFixes\n- Fix 1\n- Fix 2\n```\nReplace `VX.Y.Z` with the version number from `pyproject.toml`.\n\n**Step 3: Update `README.md`**\n\nOpen your `README.md` file in a text editor and update the version number in the image source URL:\n```markdown\n/node_modules/'],\n collectCoverageFrom: ['**/*.{js,jsx,ts,tsx}'],\n coverageReporters: ['json', 'text', 'lcov', 'clover'],\n coverageThreshold: {\n global", "metrics": { "length": 1012, "commands": 1, "command_list": [ "npm install vitest@latest" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "wcferry wechat version lock (wcferry-wechat-version-lock)", "condition": "with_lesson", "status": 200, "content": "To fix the WCFerry WeChat version lock error, you need to downgrade your WeChat version to the one that WCFerry supports. Here are the steps to follow:\n\n**Step 1: Close WeChat and uninstall the current version**\n\nOpen PowerShell as an administrator and run the following commands:\n\n```powershell\nStop-Service WeChat\nGet-Service WeChat | Stop-Service\nGet-Service WeChat | Set-Service -StartupType Disabled\n```\n\nThen, uninstall the current version of WeChat:\n\n```powershell\nAdd-WindowsFeature WeChat-2015\nGet-WindowsFeature WeChat-2015 | Uninstall-WindowsFeature\n```\n\n**Step 2: Download and install the supported version**\n\nDownload the WeChatSetup-3.9.12.51.exe file from the official WeChat website:\n\n```powershell\n$downloadUrl = \"https://github.com/WeChat-Group/wcferry/releases/download/v39.5.0/WeChatSetup-3.9.12.51.exe\"\nInvoke-WebRequest -Uri $downloadUrl -OutFile WeChatSetup-3.9.12.51.exe\n```\n\nRun the installer and disable automatic updates:\n\n```powershell\n& We", "metrics": { "length": 968, "commands": 4, "command_list": [ "Then, uninstall the current version of WeChat:", "**Step 2: Download and install the supported version**", "Download the WeChatSetup-3.9.12.51.exe file from the official WeChat website:", "Run the installer and disable automatic updates:" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 1, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "wcferry wechat version lock (wcferry-wechat-version-lock)", "condition": "plain", "status": 200, "content": "The error `wcferry wechat version lock (wcferry-wechat-version-lock)` is related to a version conflict issue in WeChat Mini Program development using WCFerry.\n\nHere's a step-by-step fix:\n\n**Step 1: Update WeChat Mini Program SDK**\n\nUpdate the WeChat Mini Program SDK to the latest version:\n```bash\nnpm install wechat-sdk@latest\n```\n**Step 2: Update WCFerry**\n\nUpdate WCFerry to the latest version:\n```bash\nnpm install wcferry@latest\n```\n**Step 3: Run WCFerry with the `--force` flag**\n\nRun WCFerry with the `--force` flag to force the update:\n```bash\nwcferry --force\n```\n**Step 4: Check for version conflicts**\n\nAfter running WCFerry, check for version conflicts by running:\n```bash\nwcferry check\n```\nIf there are any conflicts, you'll see an error message indicating the conflicting versions.\n\n**Step 5: Resolve version conflicts (if necessary)**\n\nIf there are version conflicts, you may need to resolve them by updating the conflicting dependencies or using the `--ignore` flag to ignore the conflicts:\n```bash\nwcf", "metrics": { "length": 1016, "commands": 4, "command_list": [ "npm install wechat-sdk@latest", "npm install wcferry@latest", "wcferry --force", "wcferry check" ], "has_command_block": true, "actionable": true, "inline_code_count": 12, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Webhook duplicate delivery defeated by an over-broad dedupe key (webhook-duplicate-delivery-dedupe-scope)", "condition": "with_lesson", "status": 200, "content": "To fix the error, you'll need to modify your code to include a namespaced marker in the webhook-written references and restrict the duplicate matcher to entries that carry this marker. Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Give webhook-written references a namespaced marker**\n\nIn your code, add a prefix to the `PaymentIntent` reference when writing it to the ledger in the webhook path:\n```python\n# webhook path\npayment_intent_id = 'pi_1234567890abcdef'\nwebhook_payment_intent_id = f'stripe_pi:{payment_intent_id}'\n# Write to ledger\nledger_ref = f'pi_{webhook_payment_intent_id}'\n```\n\n**Step 2: Restrict the duplicate matcher to entries that carry the marker**\n\nIn your code, modify the duplicate matcher to only consider entries that carry the namespaced marker:\n```python\n# duplicate matcher\ndef is_duplicate(ledger_ref, webhook_ref):\n # Check if the ledger_ref contains the namespaced marker\n if not webhook_ref.startswith('stripe_pi:'):\n return False\n # Compare the ledger_ref and webhook_ref\n # ...\n```\n\n**Step 3: Unit-test both paths**\n\nCreate unit tests to verify that the changes work", "metrics": { "length": 1141, "commands": 2, "command_list": [ "**Step 2: Restrict the duplicate matcher to entries that carry the marker**", "In your code, modify the duplicate matcher to only consider entries that carry the namespaced marker:" ], "has_command_block": true, "actionable": true, "inline_code_count": 4, "lesson_hits": 1, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Webhook duplicate delivery defeated by an over-broad dedupe key (webhook-duplicate-delivery-dedupe-scope)", "condition": "plain", "status": 200, "content": "The error message \"Webhook duplicate delivery defeated by an over-broad dedupe key (webhook-duplicate-delivery-dedupe-scope)\" typically occurs when the dedupe scope for a webhook is too broad, causing the webhook to be duplicated.\n\nTo fix this issue, you need to narrow down the dedupe scope for the webhook. Here's a step-by-step guide to help you resolve the issue:\n\n**Step 1: Check the current dedupe scope**\n\nRun the following command to check the current dedupe scope for the webhook:\n```bash\nn8n webhooks list\n```\nThis will list all webhooks in your N8n instance, including their dedupe scopes.\n\n**Step 2: Identify the webhook with the issue**\n\nLook for the webhook that's causing the issue and take note of its ID and name.\n\n**Step 3: Update the dedupe scope**\n\nRun the following command to update the dedupe scope for the webhook:\n```bash\nn8n webhooks update --dedupe-scope \n```\nReplace `` with the ID of the webhook you identified in Step 2, and `` with a narrower", "metrics": { "length": 1034, "commands": 2, "command_list": [ "n8n webhooks list", "n8n webhooks update --dedupe-scope " ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "webMCP — Chrome's Experimental Protocol for AI Agents (webmcp-chrome-ai-agent-protocol)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely due to the experimental webMCP protocol not being supported by your version of Chrome. To fix this issue, you can try the following steps:\n\n1. Update Chrome to the latest version:\n\n You can update Chrome by following these steps:\n\n - Open a terminal or command prompt.\n - Type the following command to check for updates: `google-chrome --version`\n - If an update is available, type the following command to update Chrome: `google-chrome --version` (or `google-chrome-stable` for stable version)\n\n Alternatively, you can also update Chrome using the Google Chrome website.\n\n2. Disable experimental features:\n\n If updating Chrome doesn't work, you can try disabling experimental features. To do this, follow these steps:\n\n - Open Chrome and type `chrome://flags/` in the address bar.\n - Look for the \"WebMCP\" flag and click on the dropdown menu next to it.\n - Select \"Disabled\" from the dropdown menu.\n - Click on the \"Relaunch\" button at the bottom of the page.\n\n3. Check if the issue is related to a specific extension:\n\n If disabling experimental features doesn't work, it's possible that the issue is", "metrics": { "length": 1164, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 4, "lesson_hits": 2, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "webMCP — Chrome's Experimental Protocol for AI Agents (webmcp-chrome-ai-agent-protocol)", "condition": "with_lesson", "status": 200, "content": "Based on the provided information, it appears that the issue is related to the experimental Chrome protocol \"webMCP\" for AI agents. To fix this issue, you'll need to update your code to use the webMCP protocol instead of the standard HTML/CSS presentation.\n\nHere's a concrete, actionable fix with exact commands:\n\n**Step 1: Update your code to use the webMCP protocol**\n\nYou'll need to modify your code to use the webMCP endpoint instead of the standard HTML/CSS presentation. You can do this by adding a new endpoint to your code and using the `webMCP` protocol to retrieve the structured data.\n\nFor example, if you're using JavaScript, you can use the following code:\n```javascript\nconst webMCPEndpoint = 'https://example.com/webmcp';\nfetch(`${webMCPEndpoint}/structured-data`)\n .then(response => response.json())\n .then(data => console.log(data));\n```\n**Step 2: Update your Chrome settings**\n\nTo use the webMCP protocol, you'll need to enable it in your Chrome settings. You can do this by following these steps:\n\n1. Open Chrome and go to `chrome://settings/`\n2. Scroll down to the \"Experimental features\"", "metrics": { "length": 1110, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 4, "lesson_hits": 3, "lesson_hit_rate": 0.75 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "wechat pubacct fetch separate search from retrieval (wechat-pubacct-fetch-separate-search-from-retrieval)", "condition": "plain", "status": 200, "content": "The error \"wechat-pubacct-fetch-separate-search-from-retrieval\" is likely related to WeChat's API usage policies. Here's a concrete, actionable fix:\n\n**Step 1: Update your WeChat API credentials**\n\nYou need to update your WeChat API credentials to use the `wechat-pubacct-fetch-separate-search-from-retrieval` endpoint. To do this:\n\n1. Go to the WeChat Developer Center () and log in with your account.\n2. Click on \"My Account\" (, and then click on \"API Credentials\" ().\n3. Click on \"Edit\" next to \"API Secret\" and update the \"API Secret\" with a new value.\n4. Click \"Save\" to save the changes.\n\n**Step 2: Update your code**\n\nYou need to update your code to use the `wechat-pubacct-fetch-separate-search-from-retrieval` endpoint. Here's an example in Python using the `requests` library:\n\n```python\nimport requests\n\naccess_token = \"your_access_token\"\naccount_id = \"your_account_id\"\n\nurl = f\"https://api.weixin.qq.com/pubacct/fetch?access_token={access_token}&account_id={account_id", "metrics": { "length": 1019, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 3, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "wechat pubacct fetch separate search from retrieval (wechat-pubacct-fetch-separate-search-from-retrieval)", "condition": "with_lesson", "status": 200, "content": "To fix the error \"wechat-pubacct-fetch-separate-search-from-retrieval\", you can follow these steps:\n\n**Step 1: Update the `fetch_article` function to separate search and retrieval phases**\n\n```python\nimport requests\nfrom bs4 import BeautifulSoup\nimport time\nimport random\n\ndef search_phase(query):\n try:\n url = \"https://sogou.com/web?\"\n params = {\n \"id\": \"web\",\n \"query\": query,\n \"pos\": \"1\"\n }\n headers = {\n \"User-Agent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3\"\n }\n response = requests.get(url, params=params, headers=headers)\n return response.json()[\"result\"][\"list\"]\n except requests.exceptions.RateLimitError:\n log(\"搜索阶段限流,稍后重试\")\n raise\n\ndef retrieval_phase(url):\n try:\n headers = {\n \"User-Agent\": \"Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.", "metrics": { "length": 986, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 1, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "wecom robot long connect no ngrok (wecom-robot-long-connect-no-ngrok)", "condition": "with_lesson", "status": 200, "content": "To fix the error `wecom robot long connect no ngrok`, you need to use the long connection mode instead of the traditional HTTP callback mode. Here are the steps to follow:\n\n1. **Update your WeCom Bot code**: Replace the traditional HTTP callback code with the long connection code. You can find an example in the verified lesson you provided.\n\n2. **Create a WebSocket connection**: Use a library like `websocket-client` to establish a WebSocket connection from your WeCom Bot server to the WeChat server. This connection will be used for long connection mode.\n\n3. **Send messages**: Use the WebSocket connection to send messages to the WeChat server. This is the key step in long connection mode.\n\nHere's an example code in Python using the `websocket-client` library:\n```python\nimport asyncio\nimport websockets\n\n# WeChat server URL\nwechat_server_url = \"wss://api.weixin.qq.com\"\n\n# WeCom Bot token\nwecom_bot_token = \"YOUR_WECOM_BOT_TOKEN\"\n\n# WebSocket connection\nasync def connect():\n async with websockets.connect(wechat_server_url) as websocket:\n # Send a message to the WeChat server\n message = {\"msgtype\": \"text\", \"content\": \"Hello", "metrics": { "length": 1152, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 3, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Welcome bot should show MCP intake path for agents (welcome-bot-mcp-intake-path)", "condition": "plain", "status": 200, "content": "To fix the error and display the MCP intake path for agents, you can use the following command:\n\n```bash\nbot say MCP intake path for agents\n```\n\nIf you want to make it a default welcome message, you can add it to the bot's configuration file.\n\nHere's an example of how to add it to the `config.yml` file (assuming you're using the Rasa Open Source bot):\n\n```yml\nintents:\n - name: welcome-bot-mcp-intake-path\n text: MCP intake path for agents\n\nwelcome_message:\n - text: MCP intake path for agents\n```\n\nThen, restart the bot server:\n\n```bash\nrasa run --enable-api --port 5005\n```\n\nAfter making these changes, the bot should display the MCP intake path for agents when it starts.", "metrics": { "length": 681, "commands": 2, "command_list": [ "bot say MCP intake path for agents", "Then, restart the bot server:" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 2, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Welcome bot should show MCP intake path for agents (welcome-bot-mcp-intake-path)", "condition": "with_lesson", "status": 200, "content": "To fix the welcome bot message to show the MCP intake path for agents, you can add a new section to the `.github/workflows/pr-welcome.yml` file. Here are the steps:\n\n1. Open the `.github/workflows/pr-welcome.yml` file in a text editor.\n2. Add the following code to the file:\n```yaml\nconst body = [\n \" Welcome to MisakaNet!\",\n \"\",\n \" For Agents & Crawlers\",\n \"\",\n \"Found a missing lesson? Submit via MCP (no account needed):\",\n \"bash\",\n \"curl -sS https://misakanet.org/mcp \\\\\",\n \" -H 'Content-Type: application/json' \\\\\",\n \" -H 'MCP-Protocol-Version: 2025-06-18' \\\\\",\n \" -d '{\\\"jsonrpc\\\":\\\"2.0\\\",\\\"id\\\":1,\\\"method\\\":\\\"tools/call\\\",\\\"params\\\":{\\\"name\\\":\\\"misakanet_submit_intake\\\",\\\"arguments\\\":{\\\"problem\\\":\\\"YOUR PROBLEM\\\",\\\"source\\\":\\\"your-agent\\\"}}}'\",\n \"\",\n \"(refs)\",\n \"MCP verified\",\n];\n```\n3. Save the changes to the file.\n4. Commit the changes with a meaningful commit message, e.g.,", "metrics": { "length": 905, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 3, "lesson_hits": 5, "lesson_hit_rate": 0.833 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "wecom robot long connect no ngrok (wecom-robot-long-connect-no-ngrok)", "condition": "plain", "status": 200, "content": "The error \"wecom-robot-long-connect-no-ngrok\" is a known issue with WeCom robots, where they are unable to connect to WeChat due to a specific configuration issue.\n\nHere's a step-by-step solution to fix this issue:\n\n**Prerequisites:**\n\n1. Make sure you have a WeChat account and a WeCom robot account.\n2. Ensure that your WeCom robot is connected to the internet.\n\n**Step 1: Check WeCom Robot Settings**\n\n1. Log in to your WeCom robot account and go to the \"Robot Settings\" page.\n2. Click on \"Robot Information\" and check if the \"Access Token\" is valid and not expired.\n\n**Step 2: Update WeCom Robot Configuration**\n\n1. Go to the WeCom robot settings page and click on \"Robot Configuration\".\n2. Scroll down to the \"Robot Connection\" section.\n3. Click on \"Edit\" next to \"Robot Connection\".\n4. In the \"Robot Connection\" section, check if the \"Proxy\" field is empty.\n5. If it's not empty, delete the existing proxy configuration.\n6. Click \"Save\" to save the changes.\n\n**Step 3: Check NGROK Configuration**\n\n1. If you're using NGRO", "metrics": { "length": 1027, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 0, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Windows CI: splitCommand backslash stripping, UnicodeEncodeError, and detached (windows-ci-splitcommand-backslash-unicode-detached)", "condition": "with_lesson", "status": 200, "content": "To fix the issues you're experiencing in your Windows CI session, you'll need to make the following changes:\n\n### Fix 1: Restore the `isWindows` guard in `splitCommand`\n\nFirst, you need to restore the `isWindows` guard that prevents backslash stripping in your `splitCommand` function. You can do this by adding the following code:\n\n```diff\n- if not isWindows:\n+ if not isWindows:\n```\n\nThen, you need to add the `isWindows` guard to your `splitCommand` function:\n\n```python\ndef splitCommand(command):\n if not isWindows:\n return command\n return command.replace('\\\\', '\\\\\\\\')\n```\n\n### Fix 2: Specify the encoding for the Python subprocess\n\nTo fix the `UnicodeEncodeError` issue, you need to specify the encoding for the Python subprocess. You can do this by adding the following code:\n\n```python\nimport subprocess\n\n# Specify the encoding for the subprocess\nsubprocess.run(command, shell=True, encoding='utf-8', errors='ignore')\n```\n\nOr, you can use the `text` parameter when calling `subprocess.run`:\n\n```python\nsubprocess.run(command, shell=True, text=True, errors='ignore')\n```\n\n", "metrics": { "length": 1092, "commands": 3, "command_list": [ "Then, you need to add the `isWindows` guard to your `splitCommand` function:", "To fix the `UnicodeEncodeError` issue, you need to specify the encoding for the Python subprocess. You can do this by adding the following code:", "Or, you can use the `text` parameter when calling `subprocess.run`:" ], "has_command_block": true, "actionable": true, "inline_code_count": 16, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Windows CI: splitCommand backslash stripping, UnicodeEncodeError, and detached (windows-ci-splitcommand-backslash-unicode-detached)", "condition": "plain", "status": 200, "content": "The error you're encountering is due to the way Windows handles path separators and Unicode encoding. Here's a concrete, actionable fix to resolve the issue:\n\n**Solution:**\n\n1. Update your `settings.json` file to include the following configuration:\n```json\n{\n \"version\": 2,\n \"paths\": {\n \"windows\": [\"$(SystemRoot)/System32\", \"$(SystemRoot)/SysWOW64\"]\n }\n}\n```\nThis tells Visual Studio Code to use the 32-bit and 64-bit system directories for path resolution.\n\n2. In your `tasks.json` file, add the following configuration:\n```json\n{\n \"version\": \"2.0.0\",\n \"tasks\": [\n {\n \"label\": \"build\",\n \"type\": \"shell\",\n \"command\": \"bash\",\n \"args\": [\n \"-c\",\n \"echo \\\"Building...\\\" && your_command_here\"\n ],\n \"group\": {\n \"kind\": \"build\",\n \"isDefault\": true\n },\n \"problemMatcher\": [],\n \"presentation\": {\n \"focus\": false,\n \"panel\": \"shared\",\n \"reveal\": \"silent\",\n \"showReuseMessage\": false,\n \"clear", "metrics": { "length": 1145, "commands": 2, "command_list": [ "This tells Visual Studio Code to use the 32-bit and 64-bit system directories for path resolution.", "2. In your `tasks.json` file, add the following configuration:" ], "has_command_block": true, "actionable": true, "inline_code_count": 4, "lesson_hits": 3, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "deepseek tui write file sandbox worktree git path (worktree-git-path-deepseek-tui)", "condition": "with_lesson", "status": 200, "content": "根据给出的问题和解决方案,以下是解决错误的具体命令:\n\n1. 使用 `code_execution` 替代 `write_file` 做文件写入:\n\n```bash\ncode_execution python -c \"import os; f = open('path/to/file.txt', 'w'); f.write('Hello World'); f.close()\"\n```\n\n2. 绕过 `worktree`,直接对 `main` 分支做 `git add/commit/push`:\n\n```bash\n# 对 main 分支进行 add\ngit -C main add .\n\n# 对 main 分支进行 commit\ngit -C main commit -m \"Commit message\"\n\n# 对 main 分支进行 push\ngit -C main push origin main\n```\n\n3. git push 使用显式认证:\n\n```bash\ngit push -u origin main --force-with-lease\n```\n\n注意:-u选项用于设置远程分支的默认分支。\n\n请确保您有正确的GitHub个人访问 token(PAT)和分支名称。\n\n此解决方案假设您正在使用WSL(Windows Subsystem for Linux)和Hydra worktree管理。", "metrics": { "length": 609, "commands": 5, "command_list": [ "code_execution python -c \"import os; f = open('path/to/file.txt', 'w'); f.write('Hello World'); f.close()\"", "git -C main add .", "git -C main commit -m \"Commit message\"", "git -C main push origin main", "git push -u origin main --force-with-lease" ], "has_command_block": true, "actionable": false, "inline_code_count": 10, "lesson_hits": 2, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "wsl pip gbk hub poller crash (wsl-pip-gbk-hub-poller-crash)", "condition": "with_lesson", "status": 200, "content": "To fix the error, you need to specify the encoding when reading the config.yaml file and when opening files in the hub_poller.py script. Here are the steps:\n\n1. Update the Python script to explicitly specify the encoding when reading the config.yaml file:\n\n ```python\npython\nimport yaml\n\nwith open(config_path, encoding=\"utf-8\") as f:\n return yaml.safe_load(f)\n```\n\n Replace `config_path` with the actual path to your config.yaml file.\n\n2. Update the hub_poller.py script to add the encoding parameter to all open() calls:\n\n ```python\npython\nimport os\n\n# ...\n\nwith open(file_path, encoding=\"utf-8\") as f:\n contents = f.read()\n\n# ...\n```\n\n Replace `file_path` with the actual path to the file you are trying to read.\n\n3. Update your PowerShell terminal to use UTF-8 encoding:\n\n ```bash\nwsl --set-locale LANG=C.UTF-8\n```\n\n This will set the locale to C.UTF-8, which uses UTF-8 encoding.\n\n4. Verify the changes:\n\n ```bash\necho \"Lesson: wsl pip gbk hub poller crash\"\nwc -l lessons", "metrics": { "length": 1007, "commands": 6, "command_list": [ "Replace `config_path` with the actual path to your config.yaml file.", "2. Update the hub_poller.py script to add the encoding parameter to all open() calls:", "Replace `file_path` with the actual path to the file you are trying to read.", "3. Update your PowerShell terminal to use UTF-8 encoding:", "This will set the locale to C.UTF-8, which uses UTF-8 encoding." ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 3, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "deepseek tui write file sandbox worktree git path (worktree-git-path-deepseek-tui)", "condition": "plain", "status": 200, "content": "The error you're encountering suggests that there's an issue with the `deepseek` command in the context of a Git worktree. Here's a step-by-step guide to resolve the issue:\n\n**Step 1: Update Git and DeepSeek**\n\nFirst, make sure you're running the latest version of Git and DeepSeek. You can update them using the following commands:\n\n```bash\ngit update-worktree --prune\ngit fetch --all\ngit pull --all\n```\n\n**Step 2: Check if the issue is related to the worktree**\n\nIf the issue persists, try removing the worktree and recreate it:\n\n```bash\ngit worktree remove \n```\n\nReplace `` with the actual name of your worktree.\n\n**Step 3: Check if the issue is related to the .git directory**\n\nSometimes, issues with the `.git` directory can cause problems with DeepSeek. Try the following command to clean up the `.git` directory:\n\n```bash\nrm -rf .git/.gitmodules\n```\n\nThis command will remove the `.gitmodules` file, which is used to manage Git submodules.\n\n**Step 4: Try the `deepseek` command again**\n\nAfter completing the above steps", "metrics": { "length": 1056, "commands": 5, "command_list": [ "git update-worktree --prune", "git fetch --all", "git pull --all", "git worktree remove ", "rm -rf .git/.gitmodules" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "wsl pip gbk hub poller crash (wsl-pip-gbk-hub-poller-crash)", "condition": "plain", "status": 200, "content": "The error message you're seeing suggests that the `wsl-pip-gbk-hub-poller` is crashing. Here's a step-by-step guide to fix the issue:\n\n**Step 1: Update the WSL Distribution**\n\nFirst, update the WSL distribution to the latest version:\n\n```bash\nwsl --update\n```\n\n**Step 2: Update pip**\n\nNext, update pip to the latest version:\n\n```bash\npython -m pip install --upgrade pip\n```\n\n**Step 3: Update the `wsl-pip-gbk-hub-poller`**\n\nThen, update the `wsl-pip-gbk-hub-poller` package:\n\n```bash\nwsl --install --update\n```\n\nThis command will update the `wsl-pip-gbk-hub-poller` package to the latest version.\n\n**Step 4: Restart the `wsl-pip-gbk-hub-poller` service**\n\nAfter updating the package, restart the `wsl-pip-gbk-hub-poller` service:\n\n```bash\nwsl --set-stdin-wsl-polling --enable\n```\n\nThis command will enable the `wsl-pip-gbk-hub-poller` service to run in the", "metrics": { "length": 856, "commands": 4, "command_list": [ "wsl --update", "python -m pip install --upgrade pip", "wsl --install --update", "wsl --set-stdin-wsl-polling --enable" ], "has_command_block": true, "actionable": true, "inline_code_count": 14, "lesson_hits": 1, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "wsl proxy huggingface external (wsl-proxy-huggingface-external)", "condition": "with_lesson", "status": 200, "content": "To fix the error, you need to configure WSL2 to use your Windows proxy settings. Here's a step-by-step guide:\n\n**Step 1: Add the proxy configuration to `~/.bashrc`**\n\nOpen the `~/.bashrc` file in a text editor:\n```bash\nnano ~/.bashrc\n```\nAdd the following lines at the end of the file:\n```bash\nexport http_proxy=http://127.0.0.1:7890\nexport https_proxy=http://127.0.0.1:7890\nexport no_proxy=localhost,127.0.0.1,.local\n```\nReplace `7890` with the actual port number of your proxy server (e.g., `8080` for Clash).\n\n**Step 2: Reload the `bashrc` configuration**\n\nReload the `bashrc` configuration to apply the changes:\n```bash\nsource ~/.bashrc\n```\n**Step 3: Verify the proxy configuration**\n\nTest the proxy configuration by running the following command:\n```bash\nexport http_proxy=http://127.0.0.1:7890\necho \"Verification passed: fix command exited 0\"\n```\nThis should print \"Verification passed: fix command exited 0\"", "metrics": { "length": 914, "commands": 7, "command_list": [ "nano ~/.bashrc", "export http_proxy=http://127.0.0.1:7890", "export https_proxy=http://127.0.0.1:7890", "export no_proxy=localhost,127.0.0.1,.local", "source ~/.bashrc" ], "has_command_block": true, "actionable": true, "inline_code_count": 13, "lesson_hits": 4, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "wsl proxy huggingface external (wsl-proxy-huggingface-external)", "condition": "plain", "status": 200, "content": "The error message you're encountering is likely due to a missing configuration file or an incorrect proxy setting in your WSL (Windows Subsystem for Linux) installation.\n\nHere's a step-by-step guide to fix the issue:\n\n**Step 1: Update WSL Proxy Configuration**\n\nRun the following command to update the WSL proxy configuration:\n\n```bash\nwsl --set-proxy huggingface-external https://huggingface.co\n```\n\nThis command updates the proxy setting for the `huggingface-external` WSL distribution.\n\n**Step 2: Create a `~/.bashrc` file (if it doesn't exist)**\n\nCreate a new file named `~/.bashrc` if it doesn't already exist. This file will contain the proxy settings for your WSL distributions.\n\n```bash\nmkdir -p ~/.bashrc\n```\n\n**Step 3: Add the following lines to `~/.bashrc`**\n\nAdd the following lines to the `~/.bashrc` file:\n\n```bash\nexport http_proxy='http://huggingface-proxy:3128'\nexport https_proxy='http://huggingface-proxy:3128'\n```\n\nThese lines set the HTTP and HTTPS proxy settings to use the `huggingface-proxy` server", "metrics": { "length": 1022, "commands": 4, "command_list": [ "wsl --set-proxy huggingface-external https://huggingface.co", "mkdir -p ~/.bashrc", "export http_proxy='http://huggingface-proxy:3128'", "export https_proxy='http://huggingface-proxy:3128'" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 4, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "WSL 代理Setup — 通过 Windows 梯子Access外网 (wsl-proxy-setup)", "condition": "with_lesson", "status": 200, "content": "To fix the WSL proxy setup error, you can follow these steps:\n\n**Step 1: Set up the proxy**\n\nOpen a new terminal in WSL and run the following commands to set up the proxy:\n\n```bash\nexport http_proxy=http://$(hostname).local:7890\nexport https_proxy=http://$(hostname).local:7890\nexport HTTP_PROXY=$http_proxy\nexport HTTPS_PROXY=$https_proxy\n```\n\n**Step 2: Add the proxy to `~/.bashrc`**\n\nAdd the following lines to `~/.bashrc` to make the proxy settings persistent across sessions:\n\n```bash\necho '\nexport http_proxy=http://$(hostname).local:7890\nexport https_proxy=http://$(hostname).local:7890\nexport NO_PROXY=localhost,127.0.0.1,.local\n' >> ~/.bashrc\n```\n\n**Step 3: Configure Git**\n\nSince WSL Git doesn't inherit environment variables, you need to configure Git separately:\n\n```bash\ngit config --global http.proxy http://$(hostname).local:7890\ngit config --global https.proxy http://$(hostname).local:7890\n```\n\n**Step 4: Verify the proxy setup**\n\nRun the following command to verify", "metrics": { "length": 983, "commands": 11, "command_list": [ "export http_proxy=http://$(hostname).local:7890", "export https_proxy=http://$(hostname).local:7890", "export HTTP_PROXY=$http_proxy", "export HTTPS_PROXY=$https_proxy", "echo '" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "WSL 代理Setup — 通过 Windows 梯子Access外网 (wsl-proxy-setup)", "condition": "plain", "status": 200, "content": "The error message you're seeing is related to WSL (Windows Subsystem for Linux) proxy setup. Here's a step-by-step guide to fix the issue:\n\n**Step 1: Update WSL and install the latest version of the wsl-proxy-setup package**\n\nOpen a new terminal and run the following commands:\n```bash\nsudo apt update\nsudo apt upgrade -y\nsudo apt install -y wsl-proxy-setup\n```\n**Step 2: Configure the proxy settings**\n\nOnce the package is installed, you'll need to configure the proxy settings. You can do this by running the following command:\n```bash\nwsl-proxy-setup --configure\n```\nThis will prompt you to enter your proxy settings. You can enter the following values:\n\n* HTTP Proxy: `http://your-proxy-server:your-port`\n* HTTPS Proxy: `https://your-proxy-server:your-port`\n\nReplace `your-proxy-server` and `your-port` with your actual proxy server and port.\n\n**Step 3: Restart WSL**\n\nAfter configuring the proxy settings, you'll need to restart WSL to apply the changes. Run the following command:\n```bash\nsudo systemctl restart wsl\n```\n**Step 4: Verify the proxy setup**\n\nOnce WSL", "metrics": { "length": 1070, "commands": 5, "command_list": [ "sudo apt update", "sudo apt upgrade -y", "sudo apt install -y wsl-proxy-setup", "wsl-proxy-setup --configure", "sudo systemctl restart wsl" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 1, "lesson_hit_rate": 0.167 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "WSL 终端编辑Setup危险 — TTy粘贴吞下划线 (wsl-terminal-underscore-corruption)", "condition": "with_lesson", "status": 200, "content": "Here's a concrete, actionable fix for the WSL terminal editing setup danger:\n\n**方案 A:终端设置**\n\n1. 打开 Windows Terminal。\n2. 选择设置(设置 → 交互)。\n3. 关闭“将文本格式设置为 HTML”。\n\n**方案 B:配置编辑安全**\n\n1. 打开 terminal。\n2. 使用 Python 读取和写入 `.env` 文件:\n```bash\npython\nimport json\n\n# 读取 .env 文件\nwith open('/home//.hermes/.env') as f:\n content = f.read()\n\n# 处理内容\nnew_content = content.replace('\\n', '\\n\\n') # 替换行符\n\n# 写入 .env 文件\nwith open('/home//.hermes/.env', 'w') as f:\n f.write(new_content)\n```\n**注意事项**\n\n* 必须使用 Python 读取和写入 `.env` 文件,而不是使用 `echo`、`cat` 或 `heredoc`。\n* `.env` 文件中使用 `\\n` 替换行符,而不是 `\\r\\n`。\n* 如果需要修改 `.env` 文件中的值,请使用 `replace", "metrics": { "length": 626, "commands": 7, "command_list": [ "python", "import json", "with open('/home//.hermes/.env') as f:", "content = f.read()", "new_content = content.replace('\\n', '\\n\\n') # 替换行符" ], "has_command_block": true, "actionable": false, "inline_code_count": 10, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "WSL 终端编辑Setup危险 — TTy粘贴吞下划线 (wsl-terminal-underscore-corruption)", "condition": "plain", "status": 200, "content": "The \"WSL 终端编辑Setup危险 — TTy粘贴吞下划线\" error, also known as \"wsl-terminal-underscore-corruption\", is a known issue in Windows Subsystem for Linux (WSL). It's caused by a corrupted state of the terminal's configuration file.\n\nHere's a step-by-step fix to resolve the issue:\n\n1. **Open a new WSL terminal**: Open a new terminal window by searching for \"Windows Terminal\" in the Start menu, or by running `wsl` in the Command Prompt.\n\n2. **Run the following command to clean the configuration file**: This command will delete the corrupted configuration file and reset the terminal settings.\n ```bash\n sudo rm -rf /etc/wsl.conf.d/*\n ```\n\n3. **Update the configuration file**: After deleting the corrupted file, update the configuration file to enable the \"TTy\" paste mode.\n ```bash\n sudo nano /etc/wsl.conf\n ```\n Add the following line to the end of the file:\n ```\n [General]\n enable-pty = 1\n ```\n Then, save and exit the editor.\n\n4. **Restart the WSL terminal**: Restart the WSL terminal", "metrics": { "length": 1004, "commands": 4, "command_list": [ "sudo rm -rf /etc/wsl.conf.d/*", "sudo nano /etc/wsl.conf", "[General]", "enable-pty = 1" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 1, "lesson_hit_rate": 0.167 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "wxauto 必须在 Windows Python 下安装,不能走 WSL pip (wxauto-windows-python-not-wsl)", "condition": "plain", "status": 200, "content": "The error message indicates that you're trying to install wxAuto, a GUI automation tool, but it requires a specific setup for Windows Python installations. To fix this issue, you'll need to install wxAuto using a Python environment that's compatible with Windows.\n\nHere's a step-by-step solution:\n\n**Method 1: Install wxAuto using conda (recommended)**\n\n1. Install Miniconda or Anaconda (if you haven't already) from the official website: https://docs.anaconda.com/anaconda/install/\n2. Open a new terminal or command prompt and create a new conda environment for your project:\n```bash\nconda create --name wxauto-env python=3.9\n```\n Replace `python=3.9` with the Python version you want to use.\n\n3. Activate the new environment:\n```bash\nconda activate wxauto-env\n```\n4. Install wxAuto using pip:\n```bash\npip install wxauto\n```\n\n**Method 2: Install wxAuto using pip and virtualenv (alternative)**\n\n1. Install virtualenv using pip:\n```bash\npip install virtualenv\n```\n2. Create a new virtual environment for your project:\n```bash\nvirtualenv wxauto-env\n```\n3", "metrics": { "length": 1053, "commands": 5, "command_list": [ "conda create --name wxauto-env python=3.9", "conda activate wxauto-env", "pip install wxauto", "pip install virtualenv", "virtualenv wxauto-env" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "wxauto 必须在 Windows Python 下安装,不能走 WSL pip (wxauto-windows-python-not-wsl)", "condition": "with_lesson", "status": 200, "content": "Here's a step-by-step guide to fix the error:\n\n**Step 1: Close the WSL Terminal**\n\nIf you are currently in the WSL terminal, close it by pressing `Ctrl + D` or `Ctrl + Z`.\n\n**Step 2: Open Windows PowerShell or Command Prompt**\n\nOpen Windows PowerShell or Command Prompt by searching for it in the Start menu.\n\n**Step 3: Install wxauto using pip**\n\nIn Windows PowerShell or Command Prompt, run the following command to install wxauto using pip:\n```powershell\npip install wxauto requests\n```\nThis command will install wxauto and its dependencies, including requests.\n\n**Step 4: Verify the Installation**\n\nAfter installation, verify that wxauto has been installed correctly by running the following command:\n```powershell\npython -c 'import sys; print(sys.version)'\n```\nThis command will print the Python version, which should be Python 3.x.\n\n**Step 5: Verify wxauto Installation**\n\nTo verify that wxauto has been installed correctly, run the following command:\n```powershell\npython -c 'import wx; print(wx.__version__)'\n```\nThis command will print the version of wxauto, which should be a version number.\n\nThat's it! You should now", "metrics": { "length": 1128, "commands": 6, "command_list": [ "This command will install wxauto and its dependencies, including requests.", "**Step 4: Verify the Installation**", "After installation, verify that wxauto has been installed correctly by running the following command:", "This command will print the Python version, which should be Python 3.x.", "**Step 5: Verify wxauto Installation**" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Zero-Bounty Agent Competition Flywheel: Issue Design for Crawler Attraction (zero-bounty-agent-competition-flywheel)", "condition": "with_lesson", "status": 200, "content": "To fix the issue, you can create a new file in the root of your repository with the following content:\n\n```markdown\n# Issue Template (Machine-Readable)\n\nagent competition — zero-bounty\n\nNo monetary bounty. Merge earns credit.\n\nTask\n\nFix exactly one file: path/to/file.md\n\nAcceptance Criteria\n\n- [ ] Only the target file changed\n- [ ] No generated files unless explicitly requested\n- [ ] Validation passes:\n PYTHONIOENCODING=utf-8 python scripts/validate_lessons.py path/to/file.md\n\n\nPR Rules\n\nComment /claim before working. 8h claim window. Multiple PRs allowed. Smallest passing diff wins.\n\n\nLabel Strategy\n\n| Label | Purpose |\n|---|---|\n| zero-bounty | Signals no monetary reward, credit-only |\n| agent-friendly | Machine-readable AC, clear file path |\n| has-test | Includes validation command |\n| one-file | Single file scope |\n| no-credentials | No Cloudflare/GH token needed |\n| status:competition | Appears in competition\n```\n\nThen, add the following labels to your repository:\n\n```bash\n# Add labels\ngit tag -a zero-bounty-agent-competition-flywheel -m \"Initial fix for Zero-Bounty Agent Competition Flywheel", "metrics": { "length": 1115, "commands": 1, "command_list": [ "Then, add the following labels to your repository:" ], "has_command_block": true, "actionable": true, "inline_code_count": 2, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Zero-Bounty Agent Competition Flywheel: Issue Design for Crawler Attraction (zero-bounty-agent-competition-flywheel)", "condition": "plain", "status": 200, "content": "I'll guide you through a potential fix for the \"Zero-Bounty Agent Competition Flywheel: Issue Design for Crawler Attraction\" error. \n\nThis error typically occurs when the Crawler Attraction section of the Zero-Bounty Agent Competition Flywheel is not properly configured, causing the flywheel to fail. Here's a step-by-step fix:\n\n**Step 1: Check the Crawler Attraction settings**\n\n1. Open the Google Ads console and navigate to the campaign where the issue is occurring.\n2. Click on the campaign name and select the \"Crawler Attraction\" tab.\n3. Verify that the \"Crawler Attraction\" settings are enabled and that the \"Crawl delay\" is set to a reasonable value (e.g., 24 hours).\n\n**Step 2: Review the Crawler Attraction design**\n\n1. Click on the \"Crawler Attraction\" settings and then click on the \"Design\" tab.\n2. Review the design for the Crawler Attraction section. Ensure that:\n\t* The design is visually appealing and consistent with the rest of the campaign.\n\t* The text and images are clear and concise.\n\t* The design is optimized for mobile devices.\n\n**Step 3: Update the Crawler Attraction design**\n\n", "metrics": { "length": 1106, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Java version mismatch causing UnsupportedClassVersionError in builds (자바-버전-불일치-빌드-오류)", "condition": "with_lesson", "status": 200, "content": "To fix the `UnsupportedClassVersionError` caused by a Java version mismatch, follow these steps:\n\n**Step 1: Verify JAVA_HOME and runtime Java**\n\nOpen a terminal and run the following commands to check the JAVA_HOME and runtime Java versions:\n\n```bash\necho $JAVA_HOME\njava -version\njavac -version\n```\n\nThis will show you the path to the JDK installation (`JAVA_HOME`) and the versions of Java and javac installed on your system.\n\n**Step 2: Set the Maven compiler settings in pom.xml**\n\nOpen your `pom.xml` file in a text editor and verify that the `maven.compiler.source` and `maven.compiler.target` settings match your runtime JVM version.\n\nFor example, if your runtime JVM version is 17, update the `pom.xml` file as follows:\n\n```xml\n\n 17\n 17\n\n```\n\n**Step 3: Update the Java compiler options**\n\nIf you're using Gradle, update the `java` options in your `build.gradle` file to match the runtime JVM version:\n\n```groovy\njavaOptions = ['--source', '", "metrics": { "length": 1072, "commands": 5, "command_list": [ "echo $JAVA_HOME", "java -version", "javac -version", "**Step 3: Update the Java compiler options**", "If you're using Gradle, update the `java` options in your `build.gradle` file to match the runtime JVM version:" ], "has_command_block": true, "actionable": true, "inline_code_count": 12, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Java version mismatch causing UnsupportedClassVersionError in builds (자바-버전-불일치-빌드-오류)", "condition": "plain", "status": 200, "content": "The Java version mismatch error occurs when the Java version used to compile your code is different from the Java version used to run your code. This can cause issues with class compatibility and lead to errors like `UnsupportedClassVersionError`.\n\nHere's a step-by-step guide to fix the Java version mismatch error:\n\n**Step 1: Check the Java versions**\n\nOpen a terminal or command prompt and run the following commands to check the Java versions installed on your system:\n\n```bash\n# For macOS (using Homebrew)\njava -version\n\n# For Linux\njava -version\n\n# For Windows\njava -version\n```\n\n**Step 2: Verify the Java version used in your build process**\n\nCheck your `pom.xml` file (if you're using Maven) or your `build.gradle` file (if you're using Gradle) to see which Java version is being used for compilation:\n\n```xml\n\n\n \n \n org.apache.maven.plugins\n maven-compiler-plugin\n 3.8.1\n \n 1.8\n 1", "metrics": { "length": 1124, "commands": 3, "command_list": [ "java -version", "java -version", "java -version" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Cronjob One-Shot Race Condition - Duplicate Execution (cronjob-one-shot-race-condition-duplicate-execution)", "condition": "with_lesson", "status": 200, "content": "To fix the cron job one-shot race condition, you need to add a lock to prevent multiple gateway threads from executing the job at the same time. Here's a step-by-step guide with exact commands:\n\n**Step 1: Install the required package**\n\nYou'll need to install the `threading` package, which is part of the Python standard library. However, if you're using a virtual environment, make sure it's installed.\n\n```bash\n# If you're using a virtual environment\npip install --upgrade threading\n```\n\n**Step 2: Modify the scheduler.py file**\n\nAdd a lock to the `scheduler.py` file to prevent multiple gateway threads from executing the job at the same time. Here's the modified code:\n\n```python\nimport threading\nimport time\n\nclass Scheduler:\n def __init__(self):\n self._tick_thread_lock = threading.Lock()\n\n def tick(self):\n with self._tick_thread_lock:\n # Your existing code here\n pass\n\n def mark_job_run(self, job_id):\n with self._tick_thread_lock:\n # Your existing code here\n pass\n```\n\n**Step 3: Remove cron-tick.sh from crontab**\n\nRemove the cron job that triggers the `cron-t", "metrics": { "length": 1144, "commands": 1, "command_list": [ "pip install --upgrade threading" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Cronjob One-Shot Race Condition - Duplicate Execution (cronjob-one-shot-race-condition-duplicate-execution)", "condition": "plain", "status": 200, "content": "The Cronjob One-Shot Race Condition - Duplicate Execution error occurs when a cron job is executed multiple times in a short period of time, potentially leading to duplicate or unexpected behavior. Here's a concrete, actionable fix with exact commands:\n\n**Fix:**\n\n1. **Check the cron table**: Verify that the cron job is not set to run too frequently. You can do this by running the following command:\n ```bash\ncrontab -l\n```\n Look for the cron job that's causing the issue and note its minute, hour, day, month, and day of the week.\n\n2. **Set the cron job to run at a specific time**: If the cron job is set to run at a specific time, you can try setting it to run at a specific minute to prevent duplicates. For example:\n ```bash\ncrontab -e\n```\n Add the following line to the end of the file:\n ```\n0 0 * * * your_command_here\n```\n Replace `your_command_here` with the actual command you want to run.\n\n3. **Add a delay**: If you need the cron job to run at a specific time but don't want it to run too frequently, you can add a delay using", "metrics": { "length": 1052, "commands": 3, "command_list": [ "crontab -l", "crontab -e", "0 0 * * * your_command_here" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "DCO Auto-Fix Workflow — /fix-dco Command Design & Implementation (dco-auto-fix-workflow)", "condition": "with_lesson", "status": 200, "content": "以下是解决DCO Auto-Fix Workflow — /fix-dco Command Design & Implementation (dco-auto-fix-workflow)错误的具体步骤和命令:\n\n**步骤 1:检查并修复 DCO 检查**\n\n使用以下命令检查 DCO 检查是否通过:\n```bash\npre-commit run --all-checks\n```\n如果 DCO 检查失败,使用以下命令修复 DCO 检查:\n```bash\ngit rebase --signoff\npre-commit run --all-checks\n```\n**步骤 2:创建独立仓库**\n\n使用以下命令创建独立仓库:\n```bash\ngit clone https://github.com/your-username/your-repo.git\ncd your-repo\ngit remote add origin https://github.com/your-username/your-repo.git\ngit push -u origin --all --delete\ngit push -u origin --tags\n```\n**步骤 3:提取核心资产**\n\n使用以下命令提取核心资产:\n```bash\ngit ls-files .pre-commit-hooks.yaml setup.cfg setup.py check_dco.py tests/ | xargs git add\ngit commit -m \"提取核心资产\"\n``", "metrics": { "length": 677, "commands": 8, "command_list": [ "pre-commit run --all-checks", "git rebase --signoff", "pre-commit run --all-checks", "git clone https://github.com/your-username/your-repo.git", "cd your-repo" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "DCO Auto-Fix Workflow — /fix-dco Command Design & Implementation (dco-auto-fix-workflow)", "condition": "plain", "status": 200, "content": "The error message you're seeing is likely due to a DCO (Data Center Operations) issue that's causing the workflow to fail. Here's a step-by-step fix to resolve the issue using the `/fix-dco` command:\n\n**Step 1: Check the DCO status**\n\n Run the following command to check the current DCO status:\n```bash\ndco status\n```\nThis will display the current DCO status, including any errors or warnings.\n\n**Step 2: Run the `/fix-dco` command**\n\n Run the following command to attempt to fix the DCO issue:\n```bash\ndco auto-fix /fix-dco\n```\nThis command will scan your system for any DCO-related issues and attempt to fix them.\n\n**Step 3: Verify the fix**\n\n Run the following command to verify that the fix was successful:\n```bash\ndco status\n```\nThis should display a success message indicating that the DCO issue has been resolved.\n\n**Step 4: Check for any remaining errors**\n\n Run the following command to check for any remaining errors:\n```bash\ndco error\n```\nThis will display a list of any remaining errors that were not resolved by the `/fix-dco` command.\n\n**Step 5", "metrics": { "length": 1058, "commands": 4, "command_list": [ "dco status", "dco auto-fix /fix-dco", "dco status", "dco error" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FReeLLMAPI Session Context Mixing - Cross-Thread Delivery (freellmapi-session-context-mixing-cross-thread-delivery)", "condition": "plain", "status": 200, "content": "The error you're encountering is related to the FreeLLM API session context mixing issue, which can cause problems when using the FreeLLM API across multiple threads. To fix this issue, you can try the following steps:\n\n**Step 1: Disable Cross-Thread Delivery**\n\nYou can disable cross-thread delivery by setting the `FREELLM_API DisableCrossThreadDelivery` environment variable to `1`. Here's how you can do it:\n\n```bash\nexport FREELLM_API DisableCrossThreadDelivery=1\n```\n\n**Step 2: Update FreeLLM API Version**\n\nMake sure you're using the latest version of the FreeLLM API. You can update to the latest version using the following command:\n\n```bash\npip install --upgrade free_llm\n```\n\n**Step 3: Use a Thread-Safe Session**\n\nTo avoid the issue altogether, you can create a new session for each thread. Here's an example of how you can do it in Python:\n\n```python\nimport threading\n\ndef get_session():\n # Create a new session\n session = free_llm.Session()\n return session\n\ndef process_text(session, text):\n # Process the text using the session\n response = session.process(text)\n # Do something with", "metrics": { "length": 1115, "commands": 2, "command_list": [ "export FREELLM_API DisableCrossThreadDelivery=1", "pip install --upgrade free_llm" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Hermes State Database Lock Issues - Cleanup Protocol (hermes-state-database-lock-issues-cleanup-protocol)", "condition": "with_lesson", "status": 200, "content": "To fix the Hermes State Database Lock Issues, follow these steps:\n\n**Step 1: Restart the Hermes Gateway Service**\n\n```bash\n# On Ubuntu/Debian-based systems\nsudo systemctl restart hermes-gateway.service\n\n# On Red Hat/CentOS-based systems\nsudo systemctl restart hermes-gateway\n\n# On macOS (using Homebrew)\nbrew services restart hermes-gateway\n```\n\n**Step 2: Run PRAGMA wal_checkpoint(TRUNCATE)**\n\n```bash\n# Open a new terminal window (or use `nohup` to run in the background)\n# On Ubuntu/Debian-based systems\nsudo -u $USER sqlite3 /path/to/state.db \"PRAGMA wal_checkpoint(TRUNCATE)\"\n\n# On Red Hat/CentOS-based systems\nsudo sqlite3 /path/to/state.db \"PRAGMA wal_checkpoint(TRUNCATE)\"\n\n# On macOS (using Homebrew)\nsudo -u $USER /usr/local/bin/sqlite3 /path/to/state.db \"PRAGMA wal_checkpoint(TRUNCATE)\"\n```\n\nReplace `/path/to/state.db` with the actual path to your `state.db` file.\n\n**Step 3: Cleanup Corrupted Files**\n\n```bash\n# Delete corrupted backups\nfind /path/to/state.db -", "metrics": { "length": 975, "commands": 6, "command_list": [ "sudo systemctl restart hermes-gateway.service", "sudo systemctl restart hermes-gateway", "brew services restart hermes-gateway", "sudo -u $USER sqlite3 /path/to/state.db \"PRAGMA wal_checkpoint(TRUNCATE)\"", "sudo sqlite3 /path/to/state.db \"PRAGMA wal_checkpoint(TRUNCATE)\"" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FReeLLMAPI Session Context Mixing - Cross-Thread Delivery (freellmapi-session-context-mixing-cross-thread-delivery)", "condition": "with_lesson", "status": 200, "content": "To fix the `FREELLMAPI Session Context Mixing - Cross-Thread Delivery` error, you'll need to distribute threads across `freellmapi` instances with stable models and reduce retries by pre-validating provider health before session start. Here's a step-by-step guide with exact commands:\n\n**Step 1: Update `freellmapi` configuration**\n\nOpen the `freellmapi` configuration file (usually `freellmapi.yaml` or `freellmapi.json`) and update the `threads` section to distribute threads across multiple instances:\n```yaml\nthreads:\n - model: deepseek-v4-flash-free\n port: 3001\n - model: deepseek-v4-flash-free\n port: 3002\n - model: deepseek-v4-flash-free\n port: 3003\n```\nReplace `3001`, `3002`, and `3003` with the available ports on your system.\n\n**Step 2: Pre-validate provider health**\n\nCreate a script (e.g., `validate_provider_health.py`) to pre-validate the health of each `freellmapi` instance before starting a session:\n```python\nimport requests\n\ndef validate_provider_health(port):\n url =", "metrics": { "length": 1002, "commands": 3, "command_list": [ "Replace `3001`, `3002`, and `3003` with the available ports on your system.", "**Step 2: Pre-validate provider health**", "Create a script (e.g., `validate_provider_health.py`) to pre-validate the health of each `freellmapi` instance before starting a session:" ], "has_command_block": true, "actionable": false, "inline_code_count": 13, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Hermes State Database Lock Issues - Cleanup Protocol (hermes-state-database-lock-issues-cleanup-protocol)", "condition": "plain", "status": 200, "content": "The error you're encountering, \"Hermes State Database Lock Issues - Cleanup Protocol,\" typically occurs when the Hermes state database is locked, preventing the application from functioning correctly. Here's a step-by-step guide to resolve the issue:\n\n**Prerequisites:**\n\n1. Make sure you have the latest version of the Hermes framework installed.\n2. Ensure that you have the necessary permissions to run the commands.\n\n**Step 1: Check for locked transactions**\n\nRun the following command to check for any locked transactions:\n\n```bash\nhermesctl get transactions --status=locked\n```\n\nThis command will list all transactions that are currently locked.\n\n**Step 2: Release locked transactions**\n\nRun the following command to release the locked transactions:\n\n```bash\nhermesctl release-transaction \n```\n\nReplace `` with the actual ID of the locked transaction. You can obtain the transaction ID from the previous command.\n\n**Step 3: Check for pending transactions**\n\nRun the following command to check for any pending transactions:\n\n```bash\nhermesctl get transactions --status=pending\n```\n\nThis command will list all transactions that are currently pending.\n\n**Step 4: Cancel pending transactions**\n\nRun the following command to cancel the pending transactions:\n\n```bash\n", "metrics": { "length": 1299, "commands": 3, "command_list": [ "hermesctl get transactions --status=locked", "hermesctl release-transaction ", "hermesctl get transactions --status=pending" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "PR Cleanup SOP — Stale/Duplicate/Resolved PR Disposition (pr-cleanup-sop)", "condition": "with_lesson", "status": 200, "content": "Here's a concrete, actionable fix with exact commands to address the PR Cleanup SOP issue:\n\n**Step 1: Automate Stale PR Cleanup**\n\nCreate a GitHub Actions workflow file (e.g., `.github/workflows/pr-cleanup.yml`) with the following content:\n```yaml\nname: PR Cleanup\n\non:\n schedule:\n - cron: 0 0 * * *\n\njobs:\n cleanup:\n runs-on: ubuntu-latest\n steps:\n - name: Checkout code\n uses: actions/checkout@v2\n - name: Run PR cleanup script\n run: |\n curl -X GET \\\n https://api.github.com/repos/$GITHUB_REPOSITORY/pulls \\\n -H 'Authorization: Bearer $GITHUB_TOKEN' \\\n -H 'Content-Type: application/json' \\\n | jq '.[] | select(.state == \"open\") | .id' \\\n | xargs -I {} curl -X DELETE \\\n https://api.github.com/repos/$GITHUB_REPOSITORY/pulls/${{}}\n```\nThis workflow will run daily at midnight and automatically close stale PRs (i.e., PRs that haven't been updated in 21 days).\n\n**Step 2: Automate Duplicate", "metrics": { "length": 1003, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 2, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "PR Cleanup SOP — Stale/Duplicate/Resolved PR Disposition (pr-cleanup-sop)", "condition": "plain", "status": 200, "content": "The error message you're encountering is likely due to a stale or duplicate pull request (PR) in your GitHub repository. Here's a step-by-step guide to fix this issue using the Git command-line interface:\n\n**Step 1: Remove stale PRs**\n\nTo remove stale PRs, you can use the `git push` command with the `--delete` option. This will delete all stale PRs from the remote repository.\n\n```bash\ngit push --delete origin \n```\n\nReplace `` with the name of the branch where the stale PRs are located.\n\n**Step 2: Remove duplicate PRs**\n\nTo remove duplicate PRs, you can use the `git merge` command with the `--no-ff` option. This will create a new merge commit that combines the duplicate PRs into a single commit.\n\n```bash\ngit merge --no-ff \n```\n\nReplace `` with the name of the branch where the duplicate PRs are located.\n\n**Step 3: Resolve PR dispositions**\n\nTo resolve PR dispositions, you can use the `git push` command with the `--force` option. This will force-push the updated branch to the remote repository, which will update the", "metrics": { "length": 1080, "commands": 2, "command_list": [ "git push --delete origin ", "git merge --no-ff " ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "PR Welcome Not Triggering — author_association NONE vs FIRST_TIMER Trap (pull-request-welcome-trigger-trap)", "condition": "plain", "status": 200, "content": "The error you're experiencing is due to a conflict between the `author_association` setting and the `first-timer` trigger in a GitHub repository. Here's a step-by-step solution to resolve the issue:\n\n**Step 1: Check the `author_association` setting**\n\nRun the following command to check the current `author_association` setting:\n```bash\ngit config --get author_association\n```\nIf the output is `NONE`, update it to `FIRST_TIMER`:\n```bash\ngit config author_association FIRST_TIMER\n```\n\n**Step 2: Delete the existing pull request welcome trigger**\n\nRun the following command to delete the existing pull request welcome trigger:\n```bash\ngit config --delete pull-request.welcome.trigger\n```\n\n**Step 3: Create a new pull request welcome trigger**\n\nRun the following command to create a new pull request welcome trigger with the `author_association` setting:\n```bash\ngit config --add pull-request.welcome.trigger 'if (author_association == \"FIRST_TIMER\") then true else false'\n```\n\n**Verify the changes**\n\nRun the following command to verify the changes:\n```bash\ngit config --list\n```\nThis should display the updated `author_association` setting and the new", "metrics": { "length": 1151, "commands": 5, "command_list": [ "git config --get author_association", "git config author_association FIRST_TIMER", "git config --delete pull-request.welcome.trigger", "git config --add pull-request.welcome.trigger 'if (author_association == \"FIRST_TIMER\") then true else false'", "git config --list" ], "has_command_block": true, "actionable": true, "inline_code_count": 16, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "एजेंट त्रुटि हैंडलिंग — पुनर्प्रयास और फॉलबैक पैटर्न (agent-error-handling-hi)", "condition": "with_lesson", "status": 200, "content": "The error you're experiencing is due to the AI agent failing to handle errors properly. To fix this, we need to implement a three-tiered error handling mechanism that includes retries and fallbacks.\n\nHere's a concrete, actionable fix with exact commands:\n\n**Step 1: Install the required libraries**\n\nOpen your terminal and run the following command to install the required libraries:\n```bash\npip install asyncio\n```\n**Step 2: Create a new Python file**\n\nCreate a new Python file called `resilient_calls.py` and add the following code:\n```python\nimport asyncio\nfrom typing import Optional\n\nasync def resilient_call(func, args, max_retries=3, fallback=None):\n \"\"\"Punish and fallback call with retries.\"\"\"\n last_error = None\n \n for attempt in range(max_retries):\n try:\n return await func(args)\n except Exception as e:\n last_error = e\n if attempt < max_retries - 1:\n # Exponential backoff\n wait_time = 2 ** attempt\n await asyncio.sleep(wait_time)\n \n # All attempts failed - use fallback\n if fallback:\n return await fallback(args)\n \n raise last_error\n\n# Example usage:\nasync def example_function", "metrics": { "length": 1216, "commands": 1, "command_list": [ "pip install asyncio" ], "has_command_block": true, "actionable": true, "inline_code_count": 3, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "PR Welcome Not Triggering — author_association NONE vs FIRST_TIMER Trap (pull-request-welcome-trigger-trap)", "condition": "with_lesson", "status": 200, "content": "以下是解决 PR Welcome Not Triggering — author_association NONE vs FIRST_TIMER Trap 的具体步骤:\n\n**步骤 1:创建一个测试仓库**\n\n```bash\ngit clone https://github.com/username/repository.git\ncd repository\ngit init\n```\n\n**步骤 2:创建 pr-welcome.yml**\n\n```yaml\nname: Pull Request Welcome\non:\n pull_request:\n types: [opened]\n events: [opened]\n branches:\n - main\njobs:\n welcome:\n runs-on: ubuntu-latest\n steps:\n - name: Checkout code\n uses: actions/checkout@v3\n - name: Run welcome script\n run: |\n echo \"Welcome to our repository!\"\n echo \"Please review the changes and leave a comment.\"\n```\n\n**步骤 3:在 pr-welcome.yml 中添加 fix**\n\n```yaml\nif: contains(fromJSON('[\"FIRST_TIMER\", \"FIRST_TIME_CONTRIBUTOR\", \"NONE\"]'),\n github.event.pull_request.author_association)\n\njobs:\n welcome:\n runs-on: ubuntu-latest\n steps:\n - name: Checkout code\n uses: actions/checkout@v3\n ", "metrics": { "length": 915, "commands": 4, "command_list": [ "git clone https://github.com/username/repository.git", "cd repository", "git init", "**步骤 3:在 pr-welcome.yml 中添加 fix**" ], "has_command_block": true, "actionable": true, "inline_code_count": 4, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "एजेंट त्रुटि हैंडलिंग — पुनर्प्रयास और फॉलबैक पैटर्न (agent-error-handling-hi)", "condition": "plain", "status": 200, "content": "The error message you're encountering is related to an agent error handling issue, specifically with the retry and fallback pattern. Here's a step-by-step solution to resolve the issue:\n\n**Error Message Analysis:**\n\nThe error message suggests that there's an issue with the agent's error handling mechanism, which is preventing it from recovering from errors and implementing the retry and fallback pattern.\n\n**Solution:**\n\nTo fix the issue, you can try the following steps:\n\n1. **Check the Agent Configuration:**\n - Open your agent configuration file (e.g., `agent.json` or `agent.yaml`) in a text editor.\n - Look for the `error_handling` section and verify that the `retry` and `fallback` settings are properly configured.\n\n2. **Update the Error Handling Configuration:**\n - If the `retry` and `fallback` settings are not configured, add them to the `error_handling` section.\n - For example, if you're using the `agent.json` file, update it as follows:\n ```json\n{\n \"error_handling\": {\n \"retry\": {\n \"max_retries\": 3,\n \"retry_delay\": 500\n },\n \"fallback\": {\n \"strategy\": \"default\",\n \"", "metrics": { "length": 1125, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 9, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Agent 手动Update步骤(update Timeout Handling) (agent-manual-update-timeout)", "condition": "with_lesson", "status": 200, "content": "To fix the error \"Agent 手动Update步骤(update Timeout Handling) (agent-manual-update-timeout)\", you need to follow these steps:\n\n1. Check the current version of the Agent:\n```bash\n/-latest.tar.gz\n```\n\n3. Manually install the Agent:\n```bash\ntar -xzf -latest.tar.gz\ncp /usr/local/bin/\n```\n\n4. Clean up old cache:\n```bash\nrm -rf ~/./cache/\n```\n\n5. Verify the installation:\n```bash\n`, ``, and `-latest.tar.gz` with the actual values for your Agent version.\n\nHere is the complete command sequence:\n\n```bash\n# Check current version\n/-latest.tar.gz", "tar -xzf -latest.tar.gz", "cp /usr/local/bin/", "rm -rf ~/./cache/" ], "has_command_block": true, "actionable": true, "inline_code_count": 12, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Agent Memory Extractor Timing — Eager vs Lazy with Implementation (agent-memory-extractor-timing)", "condition": "plain", "status": 200, "content": "To fix the \"Agent Memory Extractor Timing — Eager vs Lazy with Implementation\" error, you can try the following steps:\n\n**Step 1: Check the Agent Implementation**\n\n Ensure that the agent implementation is correct and does not contain any memory leaks or inefficient memory usage. You can use the `agent` command to check the agent implementation:\n```bash\nagent --help\n```\nThis will display the available commands and options for the agent.\n\n**Step 2: Verify the Agent Configuration**\n\n Check the agent configuration file (usually `agent.conf` or `agent.properties`) to ensure that it is correctly configured. Verify that the agent is set to extract memory at the correct intervals and that the memory extraction is not too aggressive.\n\n**Step 3: Use the `--verbose` Option**\n\n Run the agent with the `--verbose` option to increase the logging level and gather more information about the memory extraction process:\n```bash\nagent --verbose --help\n```\nThis will display more detailed logs and help you identify the source of the issue.\n\n**Step 4: Check for Memory Leaks**\n\n Use tools like `valgrind` or ` AddressSanitizer` to detect memory leaks in your application:\n```bash\nvalgrind --tool=memcheck", "metrics": { "length": 1196, "commands": 2, "command_list": [ "agent --help", "agent --verbose --help" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Agent Memory Extractor Timing — Eager vs Lazy with Implementation (agent-memory-extractor-timing)", "condition": "with_lesson", "status": 200, "content": "The error message you're seeing is related to the `should_extract` function not having a return statement. Here's a fixed version of your code with a return statement added:\n\n```python\nimport re\n\nHIGH_DENSITY_PATTERNS = [\n r\"(?i)(prefer|like|always|never|remember that|my .+ is)\",\n r\"(?i)(fix|solve|workaround|the issue was|root cause)\",\n r\"(?i)(decision|chose|picked|going with|locked in)\",\n]\n\nLOW_DENSITY_PATTERNS = [\n r\"(?i)^(hi|hello|thanks|ok|sure|got it|yes|no)\\s[.!?]?$\",\n r\"(?i)^(lol|haha|nice|cool|great)\\s[.!?]?$\",\n]\n\ndef should_extract(message: str) -> bool:\n for pattern in HIGH_DENSITY_PATTERNS:\n if re.search(pattern, message):\n return True # Added return statement here\n for pattern in LOW_DENSITY_PATTERNS:\n if re.search(pattern, message):\n return True # Added return statement here\n return False # Return False if no pattern is found\n\n", "metrics": { "length": 915, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 1, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Agent 手动Update步骤(update Timeout Handling) (agent-manual-update-timeout)", "condition": "plain", "status": 200, "content": "The error you're encountering is related to the \"Agent 手动Update步骤(update Timeout Handling)\" issue, which is typically a problem with the update timeout handling in an agent. Here's a step-by-step guide to help you resolve this issue:\n\n**Step 1: Check the agent logs**\n\nTo diagnose the issue, check the agent logs for any errors or warnings related to the update timeout handling. You can do this by running the following command:\n\n```\nagent logs\n```\n\nThis will display a list of recent log entries. Look for any errors or warnings that mention \"update timeout\" or \"Agent 手动Update步骤\".\n\n**Step 2: Check the agent configuration**\n\nVerify that the agent configuration is set up correctly. Check the `agent.conf` file (or the equivalent configuration file for your agent) to ensure that the `update_timeout` setting is set to a reasonable value. You can use the following command to check the configuration:\n\n```\nagent config update_timeout\n```\n\nIf the value is not set, you can set it using the following command:\n\n```\nagent config update_timeout \n```\n\nReplace `` with the desired timeout value in seconds.\n\n**Step 3: Adjust the update timeout**\n\nIf", "metrics": { "length": 1159, "commands": 3, "command_list": [ "agent logs", "agent config update_timeout", "agent config update_timeout " ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Agent Memory Three-Index Architecture on Elasticsearch (agent-memory-three-index-architecture)", "condition": "with_lesson", "status": 200, "content": "To address the Agent Memory Three-Index Architecture issue, you need to implement three separate indices in Elasticsearch, each for episodic events, semantic facts, and procedural playbooks. Here's a step-by-step guide:\n\n**Step 1: Create three separate indices in Elasticsearch**\n\n```bash\n# Create an index for episodic events\necho \"Creating index for episodic events\"\necho | elasticsearch -E \"put /episodic_events\"\n\n# Create an index for semantic facts\necho \"Creating index for semantic facts\"\necho | elasticsearch -E \"put /semantic_facts\"\n\n# Create an index for procedural playbooks\necho \"Creating index for procedural playbooks\"\necho | elasticsearch -E \"put /procedural_playbooks\"\n```\n\n**Step 2: Configure the mapping for each index**\n\nCreate a mapping for each index to define the fields and their types:\n\n```json\n# Episodic events mapping\necho \"Episodic events mapping\"\necho |\ncurl -XPOST 'http://localhost:9200/episodic_events/_mapping' -H 'Content-Type: application/json' -d '\n{\n \"properties\": {\n \"id\": {\"type\": \"keyword\"},\n \"text\": {\"type\": \"text", "metrics": { "length": 1061, "commands": 6, "command_list": [ "echo \"Creating index for episodic events\"", "echo | elasticsearch -E \"put /episodic_events\"", "echo \"Creating index for semantic facts\"", "echo | elasticsearch -E \"put /semantic_facts\"", "echo \"Creating index for procedural playbooks\"" ], "has_command_block": true, "actionable": false, "inline_code_count": 2, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Agent Memory Three-Index Architecture on Elasticsearch (agent-memory-three-index-architecture)", "condition": "plain", "status": 200, "content": "The \"Agent Memory Three-Index Architecture\" error typically occurs when the Elasticsearch agent is unable to store data in its memory index. This error can be fixed by adjusting the configuration of the Elasticsearch agent. Here's a step-by-step guide to resolve the issue:\n\n**Step 1: Check the Elasticsearch Agent Configuration**\n\n1. Open the Elasticsearch agent configuration file in a text editor. The location of this file varies depending on the operating system and Elasticsearch agent version. For example:\n - On Linux: `sudo nano /etc/elasticsearch-agent.yml` or `sudo nano /usr/local/etc/elasticsearch-agent.yml`\n - On Windows: `type %ProgramFiles%\\Elasticsearch\\elasticsearch-agent.yml` (assuming you installed Elasticsearch in the default location)\n\n2. Look for the `memory_index` section and verify that the `enabled` property is set to `true`. If it's set to `false`, update it to `true`.\n\n**Step 2: Adjust the Number of Indices**\n\n1. In the same configuration file, find the `indices` section.\n2. Update the `num_indices` property to a higher value. For example:\n ```yml\nindices:\n num_indices: 10\n```\n This will increase the number of", "metrics": { "length": 1157, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 11, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Agent State Database Lock Issues — Cleanup Protocol (agent-state-database-lock-cleanup)", "condition": "with_lesson", "status": 200, "content": "To fix the \"Agent State Database Lock Issues — Cleanup Protocol\" error, follow these steps:\n\n**Step 1: Identify lock files**\n\nBefore running any commands, you need to identify the lock files associated with your agent. You can do this by checking the `.agent` directory in your home directory.\n\n```bash\nls -la ~/.agent/\n```\n\nThis command will list all the files and directories within the `.agent` directory.\n\n**Step 2: Remove lock artifacts**\n\nTo remove the lock artifacts, follow these steps:\n\n1. Stop the agent first:\n```bash\n\n```\n Replace `` with the actual name of your agent service (e.g., `consul` or `etcd`).\n\n2. **Delete the agent state database lock file:**\n ```bash\nsudo rm /var/lib//state.db-wal\n```\n Replace `` with the actual name of your agent service (e.g., `consul` or `etcd`).\n\n3. **Remove the agent state database lock file:**\n ```bash\nsudo rm /var/lib//state.db-shm\n```\n Replace `` with the actual name of your agent service (e.g., `consul` or `etcd`).\n\n4. **Restart the agent service:**\n ```bash\nsudo systemctl restart \n```\n Replace `` with the actual name of your agent service", "metrics": { "length": 1014, "commands": 4, "command_list": [ "sudo systemctl stop ", "sudo rm /var/lib//state.db-wal", "sudo rm /var/lib//state.db-shm", "sudo systemctl restart " ], "has_command_block": true, "actionable": true, "inline_code_count": 17, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "AI Agent Project Outreach Guide (ai-agent-project-outreach-guide)", "condition": "plain", "status": 200, "content": "I'd be happy to help you troubleshoot the issue. However, I don't see any error message provided. Can you please provide the exact error message you're seeing, and I'll do my best to give you a concrete and actionable fix with exact commands?", "metrics": { "length": 242, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "AI Agent Project Outreach Guide (ai-agent-project-outreach-guide)", "condition": "with_lesson", "status": 200, "content": "根据问题描述,似乎是由于GitHub API token的读取问题。问题出在读取token文件中时。下面提供一个解决方案:\n\n**解决方案**\n\n1. **查找token文件路径**\n\n * 通过下面命令找到token文件的路径:\n\n ```bash\ncat /home/.git-credentials\n```\n\n 或者:\n\n ```bash\nls /home/.git-credentials\n```\n\n 该文件路径将显示在输出中。\n\n2. **解决token文件路径问题**\n\n * 如果token文件路径不正确,请将token文件路径改为正确的路径。\n\n ```bash\nTOKEN_FILE=/home/your_username/.git-credentials\n```\n\n 请将`your_username`替换为实际的用户名。\n\n3. **修复读取token文件的代码**\n\n * 由于token文件可能包含多个token,下面提供一个修复代码:\n\n ```python\nimport urllib.request, json, base64\n\nTOKEN_FILE = '/home/.git-credentials'\n\n# 读取token文件\nwith open(TOKEN_FILE) as f:\n lines = f.readlines()\n\n# 读取第一个token\ntoken = lines", "metrics": { "length": 652, "commands": 3, "command_list": [ "cat /home/.git-credentials", "ls /home/.git-credentials", "TOKEN_FILE=/home/your_username/.git-credentials" ], "has_command_block": true, "actionable": false, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "aily feishu mcp pull only (aily-feishu-mcp-pull-only)", "condition": "with_lesson", "status": 200, "content": "The error message indicates that the `aily-feishu-mcp-pull-only` job is failing because the `aily` platform only supports being called by an external MCP server, but not being called by another server.\n\nTo fix this issue, you need to modify the `aily-feishu-mcp-pull-only` job to use a \"轮询拉取模式\" (polling mode) instead of expecting to be pushed to by the Hub. Here's a concrete, actionable fix:\n\n**Step 1: Update the `aily-feishu-mcp-pull-only` job to use polling mode**\n\nRun the following command to update the job:\n```bash\ncurl -X PATCH \\\n https://your-ailymcp-instance.com/jobs/aily-feishu-mcp-pull-only \\\n -H 'Content-Type: application/json' \\\n -d '{\"mode\": \"polling\"}'\n```\nReplace `your-ailymcp-instance.com` with your actual Aily MCP instance URL.\n\n**Step 2: Verify the job configuration**\n\nRun the following command to verify the job configuration:\n```bash\ncurl -X GET \\\n https://your-ailymcp-instance.com/jobs/aily-feishu-mcp-pull", "metrics": { "length": 941, "commands": 4, "command_list": [ "curl -X PATCH \\", "https://your-ailymcp-instance.com/jobs/aily-feishu-mcp-pull-only \\", "-H 'Content-Type: application/json' \\", "-d '{\"mode\": \"polling\"}'" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Bounty Contributors Are Not Always Users (bounty-contributors-are-not-always-users)", "condition": "plain", "status": 200, "content": "The error \"Bounty Contributors Are Not Always Users\" is typically raised by GitHub when there are contributors in a repository who are not also users of the repository. This can happen when a contributor has a GitHub account, but it's not linked to the repository.\n\nTo fix this issue, you can try the following steps:\n\n1. **Check if the contributor has a GitHub account:** Run the following command in your terminal:\n```\ngithub contributors --filter=contributors --filter=not-users --repo /\n```\nReplace `` and `` with the actual owner and name of your repository.\n\n2. **Link the contributor's GitHub account to the repository:** Run the following command in your terminal:\n```\ngithub link --filter=contributors --filter=not-users --repo /\n```\nAgain, replace `` and `` with the actual owner and name of your repository.\n\n3. **Verify the link:** Run the following command in your terminal:\n```\ngithub link --filter=contributors --filter=not-users --repo /\n```\nThis should display the linked GitHub account for the contributors.\n\nIf you're still facing issues, you can try the", "metrics": { "length": 1248, "commands": 3, "command_list": [ "github contributors --filter=contributors --filter=not-users --repo /", "github link --filter=contributors --filter=not-users --repo /", "github link --filter=contributors --filter=not-users --repo /" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Bounty Contributors Are Not Always Users (bounty-contributors-are-not-always-users)", "condition": "with_lesson", "status": 200, "content": "The error \"Bounty Contributors Are Not Always Users\" indicates that the contributors who submitted pull requests for bounty tasks may not be users of the product, knowledge base, or community. This is because the contributors may have only worked on the task without engaging with the product or knowledge base.\n\nHere are some steps you can take to fix this issue:\n\n1. **Track separate metrics**: As suggested in the solution, track separate metrics to measure the usefulness of the contributors. These metrics include:\n - `PR merged`: This metric tracks when a pull request is merged.\n - `Repeat contributor`: This metric tracks if the contributor is coming back for more work.\n - `Lesson cited in PR`: This metric tracks if the contributor has cited a lesson or documentation in their pull request.\n - `Feedback issue`: This metric tracks if the contributor has engaged with the knowledge base.\n - `Helpful vote`: This metric tracks if the contributor has provided a helpful vote.\n\n2. **Ask for signal, not more work**: After a pull request is merged, ask for a simple signal, such as a yes/no answer to a question like \"Did any lesson, doc, or search result help while working on this PR?\" This shows that you value the contributor's feedback and", "metrics": { "length": 1259, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 5, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "aily feishu mcp pull only (aily-feishu-mcp-pull-only)", "condition": "plain", "status": 200, "content": "The error you're experiencing is likely due to a conflict between two Kubernetes deployments or a similar issue. To resolve this, you can try the following steps:\n\n1. **Check the current deployment status**: Run the following command to check the current deployment status:\n\n```bash\nkubectl get deployments -o wide\n```\n\n2. **Check the pod status**: Run the following command to check the pod status:\n\n```bash\nkubectl get pods -o wide\n```\n\n3. **Delete the pods**: If the pods are stuck in a pending state, you can try deleting them and letting Kubernetes recreate them:\n\n```bash\nkubectl delete pods -l aily-feishu-mcp-pull-only=true\n```\n\n4. **Update the deployment**: Run the following command to update the deployment:\n\n```bash\nkubectl rollout restart deployment aily-feishu-mcp-pull-only\n```\n\n5. **Verify the deployment status**: Run the following command to verify the deployment status:\n\n```bash\nkubectl get deployments -o wide\n```\n\nIf the issue persists, you can try to roll back to a previous version of the deployment:\n\n```bash\nkubectl rollout undo deployment aily-feishu-mcp-pull-only\n```\n\nPlease note that these commands are for a", "metrics": { "length": 1138, "commands": 6, "command_list": [ "kubectl get deployments -o wide", "kubectl get pods -o wide", "kubectl delete pods -l aily-feishu-mcp-pull-only=true", "kubectl rollout restart deployment aily-feishu-mcp-pull-only", "kubectl get deployments -o wide" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "browser-harness — AI 直连 Chrome 的 CDP 浏览器Automation (browser-harness-cdp-browser-automation)", "condition": "with_lesson", "status": 200, "content": "根据给出的错误信息和解决方案,问题可能出在 `browser-harness` 的版本中,没有 `browser-harness-cdp-browser-automation` 类。正确的解决方案是使用 `browser-harness` CLI。\n\n以下是具体的解决方案和命令:\n\n1. 安装 `browser-harness`:\n ```bash\ngit clone https://github.com/browser-use/browser-harness ~/Developer/browser-harness\ncd ~/Developer/browser-harness\nuv venv .venv && source .venv/bin/activate\nuv pip install -e .\n```\n2. 连接 Chrome:\n - 如果使用 OpenClaw 自带的 Chromium:\n ```bash\nBU_CDP_URL=http://127.0.0.1:18800\n```\n - 如果使用 Windows Chrome:\n ```bash\nBU_CDP_URL=http://127.0.0.1:9222\n```\n3. 运行 `browser-harness` CLI:\n ```bash\nbrowser-harness --target https://www.example.com\n```\n 这将启动一个 Chrome 浏览器,访问给定的 URL。\n\n如果您需要使用 `browser-harness-cdp-browser-automation` 类,可能需要", "metrics": { "length": 734, "commands": 7, "command_list": [ "git clone https://github.com/browser-use/browser-harness ~/Developer/browser-harness", "cd ~/Developer/browser-harness", "uv venv .venv && source .venv/bin/activate", "uv pip install -e .", "BU_CDP_URL=http://127.0.0.1:18800" ], "has_command_block": true, "actionable": true, "inline_code_count": 13, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "CDN edge cache serves stale responses for minutes after deploy (cdn-edge-cache-stale-after-deploy)", "condition": "plain", "status": 200, "content": "The error \"CDN edge cache serves stale responses for minutes after deploy\" indicates that the Content Delivery Network (CDN) is still serving cached versions of your website or application, even after a deployment. This can be frustrating because it means that users are seeing outdated content instead of the latest version.\n\nTo fix this issue, you'll need to invalidate the cache on the CDN. Here's a step-by-step guide to help you do that:\n\n**Method 1: Using the CDN's Cache Invalidation Tool (if available)**\n\n1. Check if your CDN provider offers a cache invalidation tool. Some popular CDNs like Cloudflare, MaxCDN, and KeyCDN have built-in tools for this purpose.\n2. Log in to your CDN account and navigate to the cache invalidation tool (usually found under \"Settings\" or \"Cache\" section).\n3. Enter the URL(s) of the resources you want to invalidate (e.g., your website's homepage, or specific JavaScript or CSS files).\n4. Click \"Invalid\" or \"Clear Cache\" to invalidate the cache.\n\n**Method 2: Using the `Cache-Control` Header (for custom CDNs)**\n\nIf your CDN doesn't have a built-in cache invalidation tool, you can try", "metrics": { "length": 1127, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 1, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "browser-harness — AI 直连 Chrome 的 CDP 浏览器Automation (browser-harness-cdp-browser-automation)", "condition": "plain", "status": 200, "content": "The error you're encountering is due to the fact that the `browser-harness` package requires the `chrome-remote-protocol` and `@types/chromedriver` packages to be installed.\n\nHere are the steps to fix this error:\n\n**Step 1: Install the required packages**\n\nRun the following command in your terminal:\n```bash\nnpm install chrome-remote-protocol @types/chromedriver\n```\n**Step 2: Update your `package.json` file**\n\nMake sure you have the following lines in your `package.json` file:\n```json\n\"dependencies\": {\n \"browser-harness\": \"^2.4.0\",\n \"chrome-remote-protocol\": \"^1.4.1\",\n \"@types/chromedriver\": \"^94.0.0\"\n},\n```\n**Step 3: Run your script**\n\nAfter updating your `package.json` file, you can run your script again using the following command:\n```bash\nnpm run script-name\n```\nReplace `script-name` with the actual name of your script.\n\nIf you're using a `yarn` package manager, you can run the following command:\n```bash\nyarn install chrome-remote-protocol @types/chromedriver\nyarn add", "metrics": { "length": 988, "commands": 5, "command_list": [ "npm install chrome-remote-protocol @types/chromedriver", "**Step 3: Run your script**", "After updating your `package.json` file, you can run your script again using the following command:", "Replace `script-name` with the actual name of your script.", "If you're using a `yarn` package manager, you can run the following command:" ], "has_command_block": true, "actionable": true, "inline_code_count": 14, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "CDN edge cache serves stale responses for minutes after deploy (cdn-edge-cache-stale-after-deploy)", "condition": "with_lesson", "status": 200, "content": "Here's a concrete, actionable fix to resolve the issue:\n\n**Fix 1: Add a random query parameter to force a cache miss**\n\nIn your application code, add a random query parameter to the URL. This will force the CDN edge cache to miss and retrieve the latest version of your response.\n\nFor example, if you're using Node.js and Express.js, you can modify your code as follows:\n\n```javascript\nconst express = require('express');\nconst app = express();\n\n// Add a random query parameter\nconst random = Math.floor(Math.random() * 1000000);\napp.get('/your-endpoint', (req, res) => {\n // Your endpoint logic here\n res.send('Hello World!');\n res.query.random = random; // Set the random query parameter\n});\n```\n\n**Fix 2: Disable browser/edge caching during verification**\n\nTo disable browser/edge caching, you can use the `Cache-Control` and `Pragma` headers in your response. Set `Cache-Control` to `no-cache` and `Pragma` to `no-cache`. Here's an example using Node.js and Express.js:\n\n```javascript\nconst express = require('express');\nconst app = express();\n\napp.get('/your-endpoint', (req, res)", "metrics": { "length": 1088, "commands": 2, "command_list": [ "**Fix 2: Disable browser/edge caching during verification**", "To disable browser/edge caching, you can use the `Cache-Control` and `Pragma` headers in your response. Set `Cache-Control` to `no-cache` and `Pragma` to `no-cache`. Here's an example using Node.js and Express.js:" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "CI key rotation silently breaking scheduled automation without a code change (ci-key-rotation-silent-failure)", "condition": "with_lesson", "status": 200, "content": "Here's a concrete, actionable fix for the CI key rotation silently breaking scheduled automation without a code change:\n\n**Step 1: Verify where the automation reads the secret from**\n\nOpen a terminal and run the following command to verify where the automation reads the secret from:\n\n```bash\ngrep -rn \"ghp_|gho_|github_pat_\" .env ci/ 2/dev/null\n```\n\nThis command will search for the strings \"ghp_\", \"gho_\", or \"github_pat_\" in the `.env` file and its subdirectories.\n\n**Step 2: Rotate the secret in one place**\n\nOnce you've identified where the automation reads the secret from, update the secret in that location with the new value. For example, if the automation reads the secret from a `.env` file, update the file with the new value:\n\n```bash\necho \"GITHUB_TOKEN=your_new_token\" > .env\n```\n\n**Step 3: Add a cheap health check at automation start**\n\nTo ensure that the automation fails loudly if it still holds the stale credentials, add a cheap health check at the start of the automation. For example, in a Python script, you can add the following code:\n\n```python\nimport os\n\ndef check_credentials():\n ", "metrics": { "length": 1109, "commands": 2, "command_list": [ "grep -rn \"ghp_|gho_|github_pat_\" .env ci/ 2/dev/null", "echo \"GITHUB_TOKEN=your_new_token\" > .env" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "CI key rotation silently breaking scheduled automation without a code change (ci-key-rotation-silent-failure)", "condition": "plain", "status": 200, "content": "The error \"CI key rotation silently breaking scheduled automation without a code change\" occurs when the CI/CD pipeline is unable to rotate the encryption key used for storing sensitive data, such as database credentials or API keys, without making any changes to the code.\n\nHere's a concrete, actionable fix with exact commands:\n\n**Assumptions:**\n\n* You're using a Git-based CI/CD pipeline (e.g., Jenkins, GitLab CI/CD, CircleCI).\n* You have a CI/CD pipeline configured to rotate encryption keys on a regular schedule (e.g., daily, weekly).\n* The pipeline is using a tool like `aws-iam-auth-to-aws` or `aws-iam-auth-to-aws-cli` to rotate the encryption key.\n\n**Step 1: Verify the pipeline configuration**\n\nCheck your pipeline configuration to ensure that the key rotation is properly set up. Look for the following:\n\n* A script or job that runs the key rotation command.\n* The correct key ID and region specified in the command.\n* The correct IAM role or credentials used for the key rotation.\n\n**Step 2: Update the pipeline configuration to handle silent failures**\n\nUpdate your pipeline configuration to handle silent failures during key rotation. You can do this by:\n\n* Adding a retry", "metrics": { "length": 1188, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 2, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Cubic AI and PR Genius Comparison (cubic-ai-vs-pr-genius)", "condition": "with_lesson", "status": 200, "content": "The error you're encountering is likely due to the fact that PR Genius v1.4.1 does not support the webhook feature that Cubic AI uses to automatically trigger reviews. To fix this, you'll need to upgrade to PR Genius v1.5.0, which supports webhooks.\n\nHere are the steps to apply:\n\n1. Upgrade to PR Genius v1.5.0:\n\nYou can upgrade to the latest version of PR Genius by running the following command:\n```bash\npip install --upgrade prgenius-core\n```\n2. Add the webhook feature:\n\nOnce you've upgraded to v1.5.0, you can add the webhook feature to your GitHub Actions workflow by modifying the `on` section to include the `pull_request` event:\n```yaml\non:\n pull_request:\n types: [opened, synchronize]\njobs:\n coach:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - run: pip install prgenius-core\n - run: python3 -m prgenius coach \"$TITLE\" --repo \"$REPO\" --body \"$BODY\"\n - name: Add webhook\n uses: prgenius/prgenius-webhook@", "metrics": { "length": 970, "commands": 1, "command_list": [ "pip install --upgrade prgenius-core" ], "has_command_block": true, "actionable": true, "inline_code_count": 4, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Cubic AI and PR Genius Comparison (cubic-ai-vs-pr-genius)", "condition": "plain", "status": 200, "content": "I'd be happy to help you troubleshoot the issue. However, I need more information about the error you're encountering. Please provide the exact error message you're seeing.\n\nIf you're still unsure about the error, I can provide a general solution for common issues that might occur when comparing Cubic AI and PR Genius.\n\nAssuming you're using a command-line interface like the terminal or command prompt, here are some general steps you can try:\n\n1. Check if the necessary packages are installed:\n ```bash\npip install scikit-learn\npip install pandas\npip install numpy\npip install scipy\n```\n\n2. Check if the datasets are downloaded:\n ```bash\npython\nfrom cubic_ai import CubicAI\nfrom pr_genius import PRGenius\n```\n\n3. Compare the two models:\n ```bash\nfrom cubic_ai import CubicAI\nfrom pr_genius import PRGenius\n\ncubic_ai = CubicAI()\npr_genius = PRGenius()\n\n# Get the scores\ncubic_ai_score = cubic_ai.get_score()\npr_genius_score = pr_genius.get_score()\n\n# Print the scores\nprint(\"Cubic AI Score:\", cubic_ai_score)\nprint(\"PR Genius Score:\", pr_genius_score)\n\n", "metrics": { "length": 1062, "commands": 7, "command_list": [ "pip install scikit-learn", "pip install pandas", "pip install numpy", "pip install scipy", "python" ], "has_command_block": true, "actionable": true, "inline_code_count": 4, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Data Quality Fix: Always Keep Three Layers (DB + ETL + Query) (data-quality-three-layer-fix-pattern)", "condition": "plain", "status": 200, "content": "The error message you're encountering suggests that your data quality fix pattern is missing a layer. Here's a concrete, actionable fix with exact commands.\n\nLet's assume you're working with a database (e.g., MySQL), an ETL (Extract, Transform, Load) tool (e.g., Apache NiFi), and a query tool (e.g., SQL).\n\n**Current Setup:**\n\n1. Database (DB): MySQL\n2. ETL Tool: Apache NiFi\n3. Query Tool: SQL\n\n**Fix: Add a Query Layer**\n\n**Step 1: Create a new query layer in your ETL tool (Apache NiFi)**\n\n```bash\n# Create a new query processor in NiFi\nnifi addQueryProcessor -name \"Data Quality Fix\" -query \"SELECT * FROM your_table_name\"\n```\n\n**Step 2: Configure the query processor to fetch data from the database**\n\n```bash\n# Configure the query processor to fetch data from the database\nnifi addDatabaseConnection -name \"MySQL Connection\" -host \"your_host\" -port \"your_port\" -username \"your_username\" -password \"your_password\"\nnifi addQueryProcessor -name \"Data Quality Fix\" -query \"SELECT * FROM your_table_name", "metrics": { "length": 1005, "commands": 1, "command_list": [ "nifi addQueryProcessor -name \"Data Quality Fix\" -query \"SELECT * FROM your_table_name\"" ], "has_command_block": true, "actionable": true, "inline_code_count": 2, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Data Quality Fix: Always Keep Three Layers (DB + ETL + Query) (data-quality-three-layer-fix-pattern)", "condition": "with_lesson", "status": 200, "content": "To fix the error, you need to apply the fixes at three layers: ETL, DB, and Query. Here are the concrete, actionable fixes with exact commands:\n\n**Fix 1: ETL (Prevent Recurrence)**\n\nYou've already written the Python function `normalize_robot_name` in the `common.py` file. Add this function to the ETL script to normalize the robot names before inserting them into the database.\n\n```python\n# common.py\nROBOT_NAME_PREFIXES = [\n ('TGO_FEN_处理后数据', 'TGO'),\n ('FEN&TGO', 'TGO'),\n ('TGO&FEN', 'TGO'),\n ('TGO FEN', 'TGO'),\n ('FE_处理后数据', 'FE'),\n ('UB&FE', 'FE'),\n ('FE66', 'FE'),\n]\n\ndef normalize_robot_name(name):\n for prefix, replacement in ROBOT_NAME_PREFIXES:\n if name.startswith(prefix):\n return replacement + name[len(prefix):]\n return name\n```\n\n**Fix 2: DB (Add Unique Constraint)**\n\nAdd a unique constraint on the `robot_name` column to prevent duplicate names.\n\n```sql\nCREATE TABLE robots (\n id", "metrics": { "length": 943, "commands": 2, "command_list": [ "**Fix 2: DB (Add Unique Constraint)**", "Add a unique constraint on the `robot_name` column to prevent duplicate names." ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Debugging memory leaks in Ruby (debugging-memory-leaks-in-ruby)", "condition": "with_lesson", "status": 200, "content": "To debug memory leaks in Ruby, you can follow these steps:\n\n### Step 1: Graph Memory Over Time\n\nFirst, you need to monitor the RSS (Resident Set Size) of your Ruby processes over time. Here's how you can do it using Graphite and Grafana:\n\n1. Install Graphite and Grafana on your server:\n\n ```bash\nsudo apt-get update\nsudo apt-get install graphite\nsudo apt-get install grafana-server\n```\n\n2. Configure Graphite to collect data from your Ruby processes:\n\n You'll need to add a graphite carbon daemon to your unicorn or sidekiq configuration file. For example, in your unicorn configuration file (`config/unicorn.rb`):\n\n ```ruby\nmodule Unicorn\n plugin :rackup\n plugin :preload_app\n plugin :static_file_cache\n\n rackup_options = {\n \"Ruby on Rails\" => \"config.ru\",\n \"Rails 4.2\" => \"config/rails.rb\",\n \"Rails 5.0\" => \"config/rails.rb\",\n # Add your configuration file here\n }\n\n # ...\n\n before_fork do\n # ...\n # Add graphite configuration here\n graphite_config = {\n 'graphite.host'", "metrics": { "length": 1011, "commands": 3, "command_list": [ "sudo apt-get update", "sudo apt-get install graphite", "sudo apt-get install grafana-server" ], "has_command_block": true, "actionable": true, "inline_code_count": 3, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Debugging memory leaks in Ruby (debugging-memory-leaks-in-ruby)", "condition": "plain", "status": 200, "content": "To debug memory leaks in Ruby, you can use the following steps:\n\n1. **Use `gem install byebug`**: This will install the `byebug` gem, which provides a Ruby debugger.\n\n2. **Run your Ruby script with `byebug`**: Use the following command to run your Ruby script with `byebug`:\n\n ```bash\nbyebug your_script.rb\n```\n\n3. **Add a breakpoint**: In `byebug`, you can add a breakpoint by typing `b line_number` and pressing Enter. Replace `line_number` with the number of the line you want to break on.\n\n4. **Step through your code**: With a breakpoint set, you can step through your code by typing `next` and pressing Enter. This will execute the next line of code.\n\n5. **Inspect memory usage**: To inspect memory usage, you can type `p $mem_stats` and press Enter. This will display the current memory usage.\n\n6. **Check for circular references**: If you're experiencing a memory leak, it's possible that there are circular references in your code. To check for circular references, you can type `p $GC.object_id` and press Enter. This will display the object ID of the current object. If", "metrics": { "length": 1083, "commands": 1, "command_list": [ "byebug your_script.rb" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Banking-style escrow fee estimate has a per-provider rounding disparity (escrow-fee-rounding-per-provider)", "condition": "with_lesson", "status": 200, "content": "Here's a concrete, actionable fix with exact commands:\n\n**Fix:**\n\n1. Update the `banking-style escrow fee estimate` calculation to use integer arithmetic (cents/wei/sats) instead of binary floating-point math.\n\n```python\n# Before\nfee_estimate = amount * rate\n\n# After\nfee_estimate = int(amount * rate * 100) # Convert to cents\n```\n\n2. Choose a single rounding mode (e.g., round-half-up) and apply it consistently throughout the calculation.\n\n```python\n# Before\nfee_estimate = int(amount * rate * 100)\n\n# After\nfee_estimate = round(int(amount * rate * 100) / 100) # Round-half-up\n```\n\n3. Sum the fee estimates in integer units, rounding once at the end.\n\n```python\n# Before\ntotal_fee_estimate = fee_estimate + other_fee_estimates\n\n# After\ntotal_fee_estimate = sum([round(int(fee_estimate) / 100) for fee_estimate in other_fee_estimates])\n```\n\n4. Add a \"recompute and compare to stored\" invariant check in tests.\n\n```python\ndef test_recompute_and_compare_to_stored():\n # Simulate data\n amount = 10.0", "metrics": { "length": 1005, "commands": 3, "command_list": [ "2. Choose a single rounding mode (e.g., round-half-up) and apply it consistently throughout the calculation.", "3. Sum the fee estimates in integer units, rounding once at the end.", "4. Add a \"recompute and compare to stored\" invariant check in tests." ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Banking-style escrow fee estimate has a per-provider rounding disparity (escrow-fee-rounding-per-provider)", "condition": "plain", "status": 200, "content": "To fix the banking-style escrow fee estimate per-provider rounding disparity, you can use the `round` function in Python to round the fee to the nearest cent. Here's a concrete, actionable fix with exact commands:\n\n```python\n# Assuming the escrow_fee_rounding_per_provider is a variable\n# containing the per-provider rounding disparity\n\n# Round the escrow fee to the nearest cent\nrounded_fee = round(escrow_fee, 2)\n\n# Apply the rounding disparity to the rounded fee\nrounded_fee_with_disparity = rounded_fee + (escrow_fee_rounding_per_provider / 100)\n\n# Print the final rounded fee with disparity\nprint(rounded_fee_with_disparity)\n```\n\nThis code will round the escrow fee to the nearest cent and then apply the per-provider rounding disparity to the rounded fee. The `/ 100` is used to convert the percentage to a decimal.\n\nFor example, if the `escrow_fee` is 100.00 and the `escrow_fee_rounding_per_provider` is 5, the `rounded_fee_with_disparity` will be:\n\n```python\nrounded_fee = round(100.00, 2) # 100.00\nrounded_fee_with_disparity = 100.00 +", "metrics": { "length": 1046, "commands": 2, "command_list": [ "This code will round the escrow fee to the nearest cent and then apply the per-provider rounding disparity to the rounded fee. The `/ 100` is used to convert the percentage to a decimal.", "For example, if the `escrow_fee` is 100.00 and the `escrow_fee_rounding_per_provider` is 5, the `rounded_fee_with_disparity` will be:" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC Robot Alarm Code Reference Table (fanuc-alarm-code-reference)", "condition": "plain", "status": 200, "content": "I can't provide a fix without knowing the exact error message you're receiving. The FANUC Robot Alarm Code Reference Table is a comprehensive resource for troubleshooting FANUC robot issues, but without more information, it's difficult to pinpoint the exact issue.\n\nCould you please provide the following details:\n\n1. The exact error message you're receiving.\n2. The FANUC robot model and version you're using.\n3. A description of the situation or action that led to the error.\n\nOnce I have this information, I can provide a more concrete and actionable fix with exact commands.", "metrics": { "length": 578, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC Robot Alarm Code Reference Table (fanuc-alarm-code-reference)", "condition": "with_lesson", "status": 200, "content": "I can provide a concrete, actionable fix for the FANUC robot alarm code reference table. However, please note that the specific commands may vary depending on the FANUC robot model and firmware version.\n\n**Fix 1: MOTN-023 - 动作锁定 (Motion Lock)**\n\nTo resolve the MOTN-023 error, follow these steps:\n\n1. Check the motion group configuration to ensure it is correct.\n2. Verify that the condition for motion lock is not met.\n3. Run the following command to check the motion group configuration:\n```\nMOTN-023> MOTN-023\n```\nThis will display the motion group configuration. If the configuration is incorrect, update it using the `MOTN-023` command.\n\n**Fix 2: PROG-004 - 程序不存在 (Program Not Found)**\n\nTo resolve the PROG-004 error, follow these steps:\n\n1. Verify that the program name is correct.\n2. Check if the program is loaded using the `PROG-004` command:\n```\nPROG-004> PROG-004\n```\nThis will display the program list. If the program is not loaded, load it using the `LOAD` command.\n\n**Fix 3:", "metrics": { "length": 988, "commands": 2, "command_list": [ "MOTN-023> MOTN-023", "PROG-004> PROG-004" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC Alarm Severity Levels — Handling and Color Codes (fanuc-alarm-severity-guide)", "condition": "with_lesson", "status": 200, "content": "Based on the provided information, it seems like you're experiencing an alarm on your FANUC robot, and you're not sure what it means or how to handle it. Here are some steps you can follow to address the issue:\n\n**Step 1: Check the Alarm Severity Table**\n\nRefer to the Alarm Severity Table provided in the lesson to determine the severity level of the alarm you're experiencing. This will help you understand the implications of each level and decide on the best course of action.\n\n**Step 2: Verify the Alarm Severity**\n\nUse the following commands to verify the alarm severity:\n\n- `ALARM SEVERITY` (for FANUC C-series) or `ALARM SEVERITY (for FANUC M-series)\n- This command will display the current alarm severity level.\n\n**Step 3: Check the Alarm Description**\n\nUse the following commands to check the alarm description:\n\n- `ALARM DESCRIPTION` (for FANUC C-series) or `ALARM DESCRIPTION (for FANUC M-series)\n- This command will display a brief description of the alarm.\n\n**Step 4: Take Action Based on Severity Level**\n\nBased on the alarm severity level and description, take the following actions:\n\n* For WARN, PAUSE, STOP, or", "metrics": { "length": 1128, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 3, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC Alarm Severity Levels — Handling and Color Codes (fanuc-alarm-severity-guide)", "condition": "plain", "status": 200, "content": "The FANUC alarm severity levels are a set of predefined error codes used in FANUC CNC machines to indicate the severity of an alarm. Here's a concrete, actionable fix for some common errors:\n\n**Error 01: Machine Start Failure**\n\n* Cause: The machine cannot start due to a configuration error or a problem with the control system.\n* Fix:\n```bash\n# Restart the FANUC control system\nfncnc restart\n\n# Check the configuration file for errors\nfncnc checkconf\n```\n\n**Error 02: Tool Break**\n\n* Cause: A tool has broken or is damaged, preventing it from being used.\n* Fix:\n```bash\n# Check the tool condition and replace it if necessary\nfncnc toolcheck\n\n# Remove the broken tool\nfncnc removetool \n\n# Replace the broken tool\nfncnc addtool \n```\n\n**Error 03: Error in Program Execution**\n\n* Cause: An error occurred while executing a program.\n* Fix:\n```bash\n# Check the program for errors\nfncnc checkprog \n\n# Debug the program using the FANUC debugger\nfncnc debug \n```\n\n**Error ", "metrics": { "length": 1023, "commands": 7, "command_list": [ "fncnc restart", "fncnc checkconf", "fncnc toolcheck", "fncnc removetool ", "fncnc addtool " ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC Auto Abort on Fault — Restart $SHELL_WRK Program (fanuc-auto-abort-on-fault-restart)", "condition": "with_lesson", "status": 200, "content": "To fix the FANUC Auto Abort on Fault — Restart $SHELL_WRK Program error, you'll need to modify the error severity of the \"TP Enabled in AUTO Mode\" fault and possibly add a background logic program to automatically abort and restart the main program. Here are the exact commands for each option:\n\n**Option 1: Modify Error Severity**\n\n1. Open the FANUC configuration menu:\n ```bash\nMENU → SYSTEM → CONFIG → Error Table\n```\n\n2. Change the severity of \"TP Enabled in AUTO Mode\" (Syst-045) from Pause to Abort:\n ```\nSyst-045 (TP Enabled in AUTO Mode) - Severity: Abort\n```\n\n**Option 2: Add Background Logic Program**\n\n1. Create a new background logic program:\n ```bash\n/PROG BG_ABORT\n```\n\n2. Add the following code to the program:\n ```bash\n-- Background logic program:\nIF (DI[abort_signal] OR $SHELL_WRK.$PROGRAM_STATE < 1) THEN\n ABORT\n -- Wait for abort to complete\n WAIT $SHELL_WRK.$PROGRAM_STATE = 0\n -- Restart main program\n RUN $SHELL_WRK.$CUST_NAME", "metrics": { "length": 962, "commands": 3, "command_list": [ "MENU → SYSTEM → CONFIG → Error Table", "Syst-045 (TP Enabled in AUTO Mode) - Severity: Abort", "/PROG BG_ABORT" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC Auto Abort on Fault — Restart $SHELL_WRK Program (fanuc-auto-abort-on-fault-restart)", "condition": "plain", "status": 200, "content": "The error message you're encountering is a common issue on FANUC CNC machines. Here's a step-by-step fix:\n\n**Method 1: Using the FANUC Machine Monitor**\n\n1. Open the FANUC Machine Monitor (FMM) on your CNC machine.\n2. Navigate to the \"Status\" or \"Error\" tab.\n3. Look for the error message \"FANUC Auto Abort on Fault — Restart $SHELL_WRK Program\".\n4. Click on the \"Abort\" or \"Stop\" button to abort the current program.\n5. Click on the \"Restart\" button to restart the machine.\n6. Select the \"$SHELL_WRK\" program from the list of available programs.\n7. Click \"OK\" to confirm the restart.\n\n**Method 2: Using the FANUC Configuration File (CF) Editor**\n\n1. Open the FANUC CF Editor on your computer.\n2. Load the CF file corresponding to your CNC machine.\n3. Navigate to the \"Programs\" or \"Startup\" section of the CF file.\n4. Look for the \"$SHELL_WRK\" program and check if it has any errors or warnings.\n5. If the program has errors, fix them and re-save the CF file.\n", "metrics": { "length": 961, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC Robot Backup and Restore — Full, Mirror, Auto, and File Restore (fanuc-backup-restore-guide)", "condition": "with_lesson", "status": 200, "content": "Based on the provided information, here's a step-by-step guide to resolve the issue:\n\n**Step 1: Check the Backup Type**\n\n1. Open the FANUC robot controller's menu by pressing the \"Menu\" button.\n2. Navigate to \"File\" and select \"Backup\".\n3. Check the backup type. If it's set to \"Image Backup\" or \"All of above\", proceed to the next step. If it's set to \"Auto Backup\", ensure that the backup is enabled and configured correctly.\n\n**Step 2: Verify Backup Configuration**\n\n1. If the backup type is set to \"All of above\" or \"Image Backup\", check the backup configuration.\n2. Ensure that the \"Period\" is set to the desired frequency (e.g., daily, weekly, or monthly).\n3. Check the \"Time\" to ensure it's set to the desired backup time.\n4. Verify the \"Type\" is set to \"Full\" or \"Incremental\" depending on the required backup type.\n5. Ensure the \"Storage\" is set to the desired location (e.g., USB, CF card, or network).\n\n**Step 3: Restore the Backup**\n\n1. If the backup type is set to \"Full Backup\", navigate to", "metrics": { "length": 1004, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC Robot Backup and Restore — Full, Mirror, Auto, and File Restore (fanuc-backup-restore-guide)", "condition": "plain", "status": 200, "content": "The error you're experiencing is likely due to a missing or corrupted configuration file. Here's a step-by-step guide to fix the issue using the FANUC Robot Backup and Restore tool:\n\n**Step 1: Stop the Backup Service**\n\n1. Open a terminal and navigate to the directory where the FANUC Robot Backup and Restore tool is installed. You can find the tool in the `/usr/local/fanuc/` directory on most Linux systems.\n\n```bash\ncd /usr/local/fanuc/\n```\n\n2. Stop the backup service using the following command:\n\n```bash\nsudo service fanuc-backup stop\n```\n\n**Step 2: Check for Corrupted Configuration Files**\n\n1. Run the following command to check for corrupted configuration files:\n\n```bash\nsudo find /usr/local/fanuc -type f -name \"*conf\" -exec grep -q \"error\" \\;\n```\n\nThis command searches for configuration files in the `/usr/local/fanuc/` directory and checks if any of them contain the word \"error\".\n\n**Step 3: Restore Configuration Files**\n\n1. If the previous command returns any errors, you'll need to restore the configuration files. You can do this using the following command:\n\n```bash\nsudo cp", "metrics": { "length": 1094, "commands": 3, "command_list": [ "cd /usr/local/fanuc/", "sudo service fanuc-backup stop", "sudo find /usr/local/fanuc -type f -name \"*conf\" -exec grep -q \"error\" \\;" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC Robot TCP/IP Socket Communication Protocol and MAPPDK Setup (fanuc-communication-protocol-socket)", "condition": "plain", "status": 200, "content": "The FANUC robot TCP/IP socket communication protocol and MAPPDK setup error typically occurs when there is a mismatch between the FANUC robot's IP address, port number, and the settings in the MAPPDK (Machine Access Programming Package Development Kit). Here's a step-by-step guide to fix this issue:\n\n**Step 1: Check the FANUC Robot's IP Address and Port Number**\n\n1. Connect to the FANUC robot using a terminal or a console.\n2. Type `SETIP` and press Enter. This will display the current IP address of the FANUC robot.\n3. Take note of the IP address and port number (usually 102).\n\n**Step 2: Configure the MAPPDK Settings**\n\n1. Open the MAPPDK setup file (usually `mappdk.ini` or `mappdk.cfg`) in a text editor.\n2. Add the following lines at the end of the file:\n\n```\n[FANUC]\nIPAddress = \nPortNumber = 102\n```\n\nReplace `` with the actual IP address of the FANUC robot.\n\n3. Save the changes to the MAPPDK setup file.\n\n", "metrics": { "length": 981, "commands": 3, "command_list": [ "[FANUC]", "IPAddress = ", "PortNumber = 102" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC Robot TCP/IP Socket Communication Protocol and MAPPDK Setup (fanuc-communication-protocol-socket)", "condition": "with_lesson", "status": 200, "content": "To fix the error and establish TCP/IP socket communication between an external PC (Python/C++/other) and a FANUC robot controller using the FANUC-communication-protocol-socket, follow these steps:\n\n**Step 1: Ensure Compatibility and Install MAPPDK**\n\n1. Log in to the FANUC robot controller and navigate to **MENU** > **NEXT** > **STATUS** > **Version ID** > **ORDER FI**.\n2. Verify that the following options are included in the list:\n\t* R632 — KAREL\n\t* R648 — User Socket Messaging\n3. If not, add them and serialize the installation.\n4. In the ROBOGUIDE environment, edit the robot options and add R632 and R648.\n5. Serialize the installation.\n\n**Step 2: Configure Network Connection**\n\n1. Navigate to **MENU** > **SETUP** > **Host Comm** > **TCP/IP**.\n2. Configure the following settings for the robot:\n\t* Robot IP: `192.168.234.2` (or the same network segment)\n\t* Subnet Mask: `255.255.255.0`\n\t* DHCP Enable: `False`\n\t* Host Name: The", "metrics": { "length": 938, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 3, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC DCS Safety System — Configuration and Stop Modes (fanuc-dcs-safety-configuration)", "condition": "plain", "status": 200, "content": "I can guide you through the process of fixing the FANUC DCS Safety System error. However, I need more information about the specific error you are encountering. Please provide me with the exact error message or the steps you have taken so far to troubleshoot the issue.\n\nThat being said, here are some general steps you can take to fix common issues with the FANUC DCS Safety System:\n\n**Error: \"Invalid configuration\" or \"Configuration not found\"**\n\n1. Check the configuration file: The configuration file is usually located in the `/etc/fanuc-dcs-safety` directory. Make sure the file exists and is not corrupted.\n2. Update the configuration file: Run the following command to update the configuration file: `sudo cp /etc/fanuc-dcs-safety/default.conf /etc/fanuc-dcs-safety/config.conf`\n3. Restart the DCS Safety System: Run the following command to restart the DCS Safety System: `sudo service fanuc-dcs-safety restart`\n\n**Error: \"Stop mode not enabled\"**\n\n1. Check the stop mode settings: Run the following command to check the stop mode settings: `sudo cat /etc/fanuc-dcs-safety/stop-mode.conf`\n2. Enable", "metrics": { "length": 1108, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 4, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC DCS Safety System — Configuration and Stop Modes (fanuc-dcs-safety-configuration)", "condition": "with_lesson", "status": 200, "content": "To resolve the FANUC DCS Safety System configuration and stop modes issue, we need to verify that the DCS is properly configured according to the provided solution and function table. Here's a step-by-step guide to fix the issue:\n\n**Step 1: Verify the DCS Configuration**\n\n1. Connect to the FANUC DCS using the provided IP address and login credentials.\n2. Check the DCS version and confirm it matches the recommended version.\n3. Review the DCS configuration to ensure that the default emergency stop password (1111) is not changed.\n\n**Step 2: Configure Stop Modes**\n\n1. Go to the \"Stop Modes\" menu and select \"Stop Mode Configuration.\"\n2. Set the \"Stop Mode\" to \"Manual\" and save the changes.\n3. Configure the \"Emergency Stop\" settings:\n * Set the \"Emergency Stop\" mode to \"Cat 4\" (PL e / SIL 3).\n * Set the \"Emergency Stop\" delay to \"10 ms\" (default value).\n * Save the changes.\n\n**Step 3: Configure Safety I/O Connection**\n\n1. Go to the \"Safety I/O Connection\" menu and select \"Safety I/O Configuration", "metrics": { "length": 1027, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC DO Not Found in Program — Check Reference Position (fanuc-do-not-found-in-program-reference-position)", "condition": "with_lesson", "status": 200, "content": "To fix the \"FANUC DO Not Found in Program\" error, you need to check the following sources:\n\n1. Reference Positions\n2. Background Logic (BG Logic)\n3. Space Functions\n4. Manual Macros\n\nHere are the steps with exact commands:\n\n1. Check Reference Positions:\n\n * Open the FANUC robot control panel.\n * Go to `MENU` > `SETUP` > `Reference Position`.\n * Verify that the DO you're looking for is assigned to a reference position.\n\n2. Check Background Logic:\n\n * Go to `MENU` > `SETUP` > `BG Logic`.\n * Look for DO assignments in the BG Logic programs that run continuously.\n\n3. Check Space Functions:\n\n * Go to `MENU` > `SETUP` > `Space`.\n * Verify that the DO you're looking for is activated based on robot position within defined volumes.\n\n4. Search All Sources:\n\n * Open a terminal and run the following command to search for DO assignments in all program types:\n\n ```bash\ngrep -i \"DO[66]\" lessons/contrib/fanuc-.md 2/dev/null | wc -l\n", "metrics": { "length": 981, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 9, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC DO Not Found in Program — Check Reference Position (fanuc-do-not-found-in-program-reference-position)", "condition": "plain", "status": 200, "content": "The error \"FANUC DO Not Found in Program — Check Reference Position\" typically occurs when the FANUC CNC machine is unable to find the reference position specified in the program. Here's a step-by-step fix:\n\n**Prerequisites:**\n\n1. Ensure you have a valid FANUC CNC machine and a compatible program.\n2. Verify that the program is correctly loaded into the machine.\n3. Check that the reference position is correctly defined in the program.\n\n**Fix:**\n\n1. **Check the reference position definition:**\n - Open the FANUC program in a text editor or a FANUC-specific programming software (e.g., FANUC's own FANUC-NC Program Editor or a third-party tool like G-code Editor).\n - Look for the reference position definition, which is usually specified using the `G21` or `G90` command followed by the `G54` or `G55` command.\n - Ensure that the reference position is correctly defined and matches the actual position of the tool on the machine.\n\n2. **Verify the reference position:**\n - Check the machine's coordinate system and reference positions.\n - Ensure that the reference position specified in the program matches the actual position of the tool on the", "metrics": { "length": 1157, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 4, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC Robot EtherNet/IP Connection with OMRON PLC (fanuc-eip-omron-plc-connection)", "condition": "with_lesson", "status": 200, "content": "根据提供的教程和错误信息,下面是一些具体的步骤来解决 FANUC Robot EtherNet/IP Connection with OMRON PLC(fanuc-eip-omron-plc-connection)错误:\n\n**步骤 1:检查 FANUC 机器人固件版本**\n\n使用 FANUC 机器人控制软件(如 FANUC CNC Software)检查机器人固件版本是否支持 EtherNet/IP 协议。\n\n```bash\n# 使用 FANUC CNC Software 检查机器人固件版本\nfncnc -version\n```\n\n**步骤 2:检查 OMRON PLC 主站功能**\n\n使用 OMRON PLC 编程软件(如 CX-Integrator)检查 PLC 主站功能是否支持 EtherNet/IP 主站功能。\n\n```bash\n# 使用 CX-Integrator 检查 PLC 主站功能\ncx-integrator -version\n```\n\n**步骤 3:设置 FANUC 机器人以太网参数**\n\n在 FANUC 机器人控制软件中,设置以太网参数:\n\n```bash\n# 设置以太网参数\nfncnc -setup -host-comm -", "metrics": { "length": 533, "commands": 2, "command_list": [ "fncnc -version", "cx-integrator -version" ], "has_command_block": true, "actionable": false, "inline_code_count": 4, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC Robot EtherNet/IP Connection with OMRON PLC (fanuc-eip-omron-plc-connection)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely due to a configuration issue with the FANUC robot's EtherNet/IP connection to the OMRON PLC. Here's a step-by-step guide to help you resolve the issue:\n\n**Prerequisites:**\n\n1. Ensure that the FANUC robot and OMRON PLC are properly connected and powered on.\n2. Verify that the EtherNet/IP communication protocol is enabled on both the FANUC robot and OMRON PLC.\n\n**Fix:**\n\n1. **Check FANUC Robot Configuration:**\n\n Open the FANUC robot's programming software (e.g., FANUC Robotics Factory Talk HMI/DCS) and navigate to the \"EtherNet/IP\" tab.\n\n 1.1. Ensure that the \"EtherNet/IP\" module is enabled and configured correctly.\n 1.2. Check the \"IP Address\" and \"Port Number\" settings to ensure they match the OMRON PLC's IP address and port number.\n\n2. **Check OMRON PLC Configuration:**\n\n Open the OMRON PLC's programming software (e.g., OMRON PC-based) and navigate to the \"Communication\" or \"EtherNet/IP\" tab.\n\n 2.1. Ensure that", "metrics": { "length": 975, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC Handling Robot Unexpected Auto Mode Dropout Diagnosis (fanuc-handling-robot-auto-drop-diagnosis)", "condition": "plain", "status": 200, "content": "The FANUC Handling Robot Unexpected Auto Mode Dropout Diagnosis error is a common issue. Here's a step-by-step guide to resolve the issue:\n\n**Prerequisites:**\n\n* Ensure you have a FANUC M-1000iA or M-2000iA robot controller.\n* Familiarize yourself with the robot's settings and configuration.\n\n**Step 1: Check the Robot's Status**\n\nOpen the FANUC Robot Studio software and connect to the robot. Check the robot's status by clicking on \"Robot\" > \"Status\" in the menu.\n\n**Step 2: Check the Auto Mode Settings**\n\nIn the Robot Studio software, navigate to \"Robot\" > \"Auto Mode\" > \"Auto Mode Settings\". Check if the \"Auto Mode\" is enabled and if it's set to the correct mode (e.g., \"Auto\" or \"Manual\").\n\n**Step 3: Check the Safety Settings**\n\nIn the Robot Studio software, navigate to \"Robot\" > \"Safety\" > \"Safety Settings\". Ensure that the \"Safety\" mode is enabled and that the \"Safety Enable\" switch is set to \"ON\".\n\n**Step 4: Check the Safety Light**\n\nCheck the safety light on the robot to ensure it's not indicating an error.", "metrics": { "length": 1025, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC Handling Robot Unexpected Auto Mode Dropout Diagnosis (fanuc-handling-robot-auto-drop-diagnosis)", "condition": "with_lesson", "status": 200, "content": "以下是解决 FANUC 搬运机器人掉自动模式诊断 的具体步骤:\n\n**解决方案一:清洁与检查**\n\n1. 拆卸快换耦合器,检查所有电气触点:\n```bash\nsudo udevadm trigger --action=remove --subsystem=usb\n```\n2. 用酒精清洁触点表面氧化层和油污:\n```bash\nsudo rm -rf /sys/bus/usb/drivers/fanuc/trigger\nsudo echo \"0\" > /sys/bus/usb/drivers/fanuc/trigger\nsudo rm -rf /sys/bus/usb/drivers/fanuc/trigger\nsudo echo \"1\" > /sys/bus/usb/drivers/fanuc/trigger\n```\n3. 检查触点弹簧压力是否足够:\n```bash\nsudo cat /sys/bus/usb/drivers/fanuc/pin0\n```\n4. 验证耦合器机械对位精度:\n```bash\nsudo cat /sys/bus/usb/drivers/fanuc/position\n```\n\n**解决方案二:信号监控定位**\n\n1. 编写一个监控程序,实", "metrics": { "length": 539, "commands": 7, "command_list": [ "sudo udevadm trigger --action=remove --subsystem=usb", "sudo rm -rf /sys/bus/usb/drivers/fanuc/trigger", "sudo echo \"0\" > /sys/bus/usb/drivers/fanuc/trigger", "sudo rm -rf /sys/bus/usb/drivers/fanuc/trigger", "sudo echo \"1\" > /sys/bus/usb/drivers/fanuc/trigger" ], "has_command_block": true, "actionable": false, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "KAREL Core Utility Modules: errors, system, Strings API Reference (fanuc-karel-core-utility-modules)", "condition": "with_lesson", "status": 200, "content": "Based on the provided documentation, it appears that the errors are related to the lack of error handling, string manipulation, and system type definitions in the KAREL language. To fix these errors, you can follow these steps:\n\n1. Create a new file named `errors.klt` in the `errors` directory of your KAREL project.\n\n2. Add the following error codes to the `errors.klt` file:\n```karel\n// 类别 | 典型错误码\n// 数组\nARR_LEN_MISMATCH, INVALID_INDEX\n// 变量\nVAR_UNINIT\n// 文件\nFILE_NOT_OPEN\n// 程序\nTPE_PROGRAM_DOES_NOT_EXIST\n// 队列\nQUEUE_IS_EMPTY\n// 位置\nPOS_TYPE_MISMATCH\n// 运动\nSEARCH_MOTION_FAILED\n```\n3. Create a new file named `system.klt` in the `system` directory of your KAREL project.\n\n4. Add the following functions to the `system.klt` file:\n```karel\n// 时间日期\nkarel\nsystem__date() : STRING\n -- 返回 'DD-MMM-YYYY'\n return (\"DD-MMM-\" + system__day() + \"-YYYY\")\n\nsystem__", "metrics": { "length": 857, "commands": 2, "command_list": [ "3. Create a new file named `system.klt` in the `system` directory of your KAREL project.", "4. Add the following functions to the `system.klt` file:" ], "has_command_block": true, "actionable": false, "inline_code_count": 8, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "KAREL Core Utility Modules: errors, system, Strings API Reference (fanuc-karel-core-utility-modules)", "condition": "plain", "status": 200, "content": "The error message you're seeing suggests that you're trying to use a module from the `fanuc-karel-core-utility-modules` library, which is not compatible with your current environment.\n\nHere's a step-by-step solution to resolve this issue:\n\n**Method 1: Update your dependencies**\n\nIf you're using Maven or Gradle, you can try updating your dependencies to the latest version of the `fanuc-karel-core-utility-modules` library.\n\n**Maven:**\n\n1. Open your `pom.xml` file in your IDE or text editor.\n2. Add the following dependency to your `pom.xml` file:\n```xml\n\n fanuc\n karel-core-utility-modules\n 1.0.0\n\n```\nReplace `1.0.0` with the latest version available on Maven Central.\n\n3. Save your `pom.xml` file and run `mvn clean install` in your terminal.\n\n**Gradle:**\n\n1. Open your `build.gradle` file in your IDE or text editor.\n2. Add the following dependency to your `build.gradle` file:\n```groovy\ndependencies {\n implementation 'fan", "metrics": { "length": 1029, "commands": 5, "command_list": [ "Replace `1.0.0` with the latest version available on Maven Central.", "3. Save your `pom.xml` file and run `mvn clean install` in your terminal.", "**Gradle:**", "1. Open your `build.gradle` file in your IDE or text editor.", "2. Add the following dependency to your `build.gradle` file:" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Geometry and Kinematics Layer — Shapes, Pose, Sensors for Robot Programming (fanuc-karel-geometry-kinematics-layer)", "condition": "with_lesson", "status": 200, "content": "The error you're encountering is due to the missing implementation of geometric operations in the FANUC KAREL standard library. To fix this issue, you need to implement the missing functions and data types.\n\nHere's a concrete, actionable fix with exact commands:\n\n**Step 1: Implement the missing data types**\n\nCreate a new module `shapes` and add the following data types:\n```karel\nt_POINT { x, y, z: REAL; }\nt_VECTOR { x, y, z: REAL; }\nt_NORMAL { x, y, z: REAL; }\n\nt_PLANE { normal: t_NORMAL; d: REAL; origin: t_POINT; }\nt_SEGMENT { r0, r1: t_POINT; }\nt_BOX { verts[5], vects[3], normals[3]; centroid: t_POINT; }\nt_CYLINDER { origin: t_POINT, radius, height: REAL; }\n```\n**Step 2: Implement the missing functions**\n\nAdd the following functions to the `shapes` module:\n```karel\n-- Construct a plane from two points\nshapes__create_plane_from_points(p1, p2, p3) : t_PLANE =\n let normal = t_NORMAL(2 * (p2.x", "metrics": { "length": 905, "commands": 2, "command_list": [ "**Step 2: Implement the missing functions**", "Add the following functions to the `shapes` module:" ], "has_command_block": true, "actionable": true, "inline_code_count": 4, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Geometry and Kinematics Layer — Shapes, Pose, Sensors for Robot Programming (fanuc-karel-geometry-kinematics-layer)", "condition": "plain", "status": 200, "content": "I don't see any code provided for the error. However, I can provide a general fix for common errors that might occur in the Geometry and Kinematics Layer.\n\nAssuming the error is related to a missing or incorrect import statement, a missing or incorrect class definition, or a syntax error, here are some concrete, actionable fixes with exact commands:\n\n**Fix 1: Missing Import Statement**\n\nIf the error is related to a missing import statement, add the following command at the top of your code:\n```python\nfrom fanuc_karel.geometry import *\nfrom fanuc_karel.kinematics import *\nfrom fanuc_karel.sensors import *\n```\nReplace `fanuc_karel` with the actual package name if it's different.\n\n**Fix 2: Missing or Incorrect Class Definition**\n\nIf the error is related to a missing or incorrect class definition, ensure that the class definition is correct and complete. For example:\n```python\nclass MyRobot:\n def __init__(self):\n self.pose = Pose()\n self.sensors = Sensors()\n\n def move_forward(self):\n self.pose.move_forward(10)\n```\nReplace `MyRobot` with the actual class name and `Pose` and `Sensors` with the actual class names.\n\n**", "metrics": { "length": 1155, "commands": 3, "command_list": [ "Replace `fanuc_karel` with the actual package name if it's different.", "**Fix 2: Missing or Incorrect Class Definition**", "If the error is related to a missing or incorrect class definition, ensure that the class definition is correct and complete. For example:" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC KAREL HTTP API — WebControl Robot Motion and Monitoring (fanuc-karel-http-api-webcontrol)", "condition": "with_lesson", "status": 200, "content": "Based on the provided information, the error is likely due to the fact that the API endpoint `/KAREL/webcontrol` is expecting specific parameter formats and return values, but these are not being met.\n\nHere's a concrete, actionable fix with exact commands to resolve the issue:\n\n1. **Verify the FANUC control controller's KAREL webserver version**: First, check the version of the FANUC control controller's KAREL webserver by sending a GET request to `http://:8080/KAREL/version`.\n\n```bash\ncurl http://:8080/KAREL/version\n```\n\n2. **Check the API endpoint documentation**: Review the API endpoint documentation to ensure that you are using the correct parameter formats and return values.\n\n```bash\ncurl http://:8080/KAREL/webcontrol?str_mtn_mod=3&str_coord1=100&str_coord2=200&str_coord3=300&str_coord4=0&str_coord5=0&str_coord6=0\n```\n\n3. **Format the JSON response**: The API endpoint `/KAREL/webmonitor` returns a JSON response. Verify that the JSON response is in the correct format by", "metrics": { "length": 1033, "commands": 2, "command_list": [ "curl http://:8080/KAREL/version", "curl http://:8080/KAREL/webcontrol?str_mtn_mod=3&str_coord1=100&str_coord2=200&str_coord3=300&str_coord4=0&str_coord5=0&str_coord6=0" ], "has_command_block": true, "actionable": false, "inline_code_count": 6, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "IK/FK and Quaternion Math Guide for FANUC KAREL Robot Programming (fanuc-karel-ik-fk-quaternion-guide)", "condition": "with_lesson", "status": 200, "content": "Based on the provided guide, here are the concrete and actionable fixes for the given errors:\n\n**Error 1: IK/FK and Quaternion Math Guide for FANUC KAREL Robot Programming**\n\n### Fix 1: IK/FK求解\n\n```karel\nkarel\nVAR\n target : XYZWPR\n jpos : JOINTPOS\n\nBEGIN\n -- 步骤1:设置正确的坐标系\n pose__set_userframe(1, 1) -- 激活用户坐标系1,组1\n pose__set_toolframe(1, 1) -- 激活工具坐标系1,组1\n\n -- 步骤2:读取目标位置\n target = pose__get_posreg_xyz(10, 1) -- 从PR[10]读取\n\n -- 步骤3:IK求解\n jpos = pose__solveIK(target, 1)\n\n -- 步骤4:必须检查成功标志\n IF NOT pose__get_ok THEN\n karelError(INVALID_INDEX, 'IK failed', ER_ABORT)\n ENDIF\n\n -- 步", "metrics": { "length": 658, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC KAREL HTTP API — WebControl Robot Motion and Monitoring (fanuc-karel-http-api-webcontrol)", "condition": "plain", "status": 200, "content": "I'm happy to help you with the FANUC KAREL HTTP API error. However, I need more information about the error you're encountering. Could you please provide the exact error message you're seeing?\n\nThat being said, here are some general steps you can try to resolve the issue:\n\n1. **Check the API documentation**: Make sure you're using the correct API endpoint, parameters, and headers.\n2. **Verify the API key**: Ensure that you're passing the correct API key in the request headers.\n3. **Check the robot's status**: Verify that the robot is properly connected and online before making API requests.\n\nAssuming you've checked the above and still encounter issues, here's a concrete, actionable fix with exact commands:\n\n**Step 1: Update the API configuration**\n\n1. Open the `fanuc-karel-http-api-webcontrol` configuration file (usually `config.json` or `config.yaml`) in a text editor.\n2. Update the `api_key` field with your actual API key.\n3. Update the `robot_ip` field with the IP address of your robot.\n\nExample configuration:\n```json\n{\n \"api_key\": \"YOUR_API_KEY_HERE\",\n \"robot_ip\": \"192.168.1.100", "metrics": { "length": 1101, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 5, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "IK/FK and Quaternion Math Guide for FANUC KAREL Robot Programming (fanuc-karel-ik-fk-quaternion-guide)", "condition": "plain", "status": 200, "content": "I can guide you through a common issue with IK/FK and Quaternion math in FANUC KAREL robot programming. The issue is likely related to the IK/FK solver or quaternion calculations not being performed correctly.\n\n**Issue:** IK/FK solver or quaternion calculations not being performed correctly.\n\n**Symptoms:**\n\n* IK/FK solver returns incorrect joint angles or poses.\n* Quaternion calculations result in NaN (Not a Number) or infinity values.\n\n**Fix:**\n\n1. **Verify IK/FK Solver Settings:**\n\n * Check the IK/FK solver settings in the robot program. Ensure that the correct solver type is selected (e.g., FK, IK, or Hybrid).\n * Verify that the solver parameters, such as the joint limits and constraints, are correctly set.\n * Run a diagnostic test to validate the IK/FK solver settings.\n\n ```c\n// Set IK/FK solver type\nIKSolverType = FK;\n\n// Set joint limits and constraints\nJointLimit1 = 0.0;\nJointLimit2 = 180.0;\nJointLimit3 = 90.0;\n\n// Run IK/FK solver\nIKResult = IKSolver(IKSolverType, JointLimit1, JointLimit2, Joint", "metrics": { "length": 1037, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC KAREL: INTP-316 调用TP程序触发动作锁定 (fanuc-karel-intp-316-call-error-motion-lock)", "condition": "with_lesson", "status": 200, "content": "To fix the error `FANUC KAREL: INTP-316 调用TP程序触发动作锁定`, you can follow these steps:\n\n1. **Check the syntax of the CALL command**:\n\n Open a KAREL terminal and execute the following command:\n ```bash\nkarel\nCALL 'PROGRAM.TP' -- 正确:单引号 + .TP 扩展名\n```\n If you get an error message, make sure to enclose the program name with single quotes and add the `.TP` extension.\n\n Example:\n ```bash\nCALL 'TEST.TP'\n```\n If you're still getting the error, try calling the program without the single quotes:\n ```bash\nCALL TEST.TP\n```\n\n2. **Enable the $KAREL_ENB system variable**:\n\n Open a KAREL terminal and execute the following command:\n ```bash\nkarel\n$KAREL_ENB = 1\n```\n This enables the KAREL runtime.\n\n3. **Check the TP program's permissions**:\n\n Open a KAREL terminal and execute the following command:\n ```bash\nkarel\nCALL 'PROGRAM.TP'\n```\n", "metrics": { "length": 852, "commands": 8, "command_list": [ "karel", "CALL 'PROGRAM.TP' -- 正确:单引号 + .TP 扩展名", "CALL 'TEST.TP'", "CALL TEST.TP", "karel" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC KAREL: INTP-316 调用TP程序触发动作锁定 (fanuc-karel-intp-316-call-error-motion-lock)", "condition": "plain", "status": 200, "content": "The error you're experiencing is likely due to a conflict between the TP (Tool Path) program and the action lock in FANUC KAREL programming. Here's a step-by-step solution:\n\n1. **Stop the machining operation**: Immediately stop the machining operation by pressing the stop button or sending a stop command to the machine.\n\n2. **Unlock the action lock**: Send the following command to unlock the action lock:\n```\nM00\n```\nThis will release the action lock, allowing you to modify the TP program.\n\n3. **Edit the TP program**: Use a text editor to edit the TP program. The location of the TP program file may vary depending on your system configuration.\n\n For FANUC KAREL, the TP program file is usually located in the `C:\\Program Files\\FANUC\\KAREL\\TP` directory (or similar, depending on your installation path).\n\n4. **Check for conflicts**: Review the TP program for any conflicts with the action lock. Look for any lines of code that might be causing the conflict.\n\n5. **Modify the TP program**: If you find a conflict, modify the TP program to avoid it. For example, if the conflict is caused by a line of code that tries to execute an", "metrics": { "length": 1137, "commands": 1, "command_list": [ "M00" ], "has_command_block": true, "actionable": true, "inline_code_count": 2, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Ka-Boost: 8-Layer KAREL Module Architecture and Build System (fanuc-karel-ka-boost-architecture)", "condition": "with_lesson", "status": 200, "content": "根据 Ka-Boost 的 8 层模块架构和工具链,以下是解决 Ka-Boost 错误的具体步骤:\n\n**步骤 1:安装必要的工具**\n\n```bash\n# 安装 rossum 包管理器\nsudo apt-get install -y rossum\n\n# 安装 ktransw 转译器/预处理器\nsudo apt-get install -y ktransw\n\n# 安装 ninja 构建系统\nsudo apt-get install -y ninja-build\n\n# 安装 kpush 部署工具\nsudo apt-get install -y kpush\n```\n\n**步骤 2:配置 rossum 包管理器**\n\n在你的 Ka-Boost 项目的根目录下创建 `package.json`文件:\n```json\n{\n \"name\": \"my-ka-boost-project\",\n \"version\": \"1.0.0\",\n \"dependencies\": {\n \"ktransw\": \"^1.0.0\",\n \"ninja\": \"^1.9.0\",\n \"kpush\": \"^1.0.0\"\n }\n}\n```\n\n**步骤 3:生成 build.ninja 文件**\n\n```bash\n# 运", "metrics": { "length": 556, "commands": 5, "command_list": [ "sudo apt-get install -y rossum", "sudo apt-get install -y ktransw", "sudo apt-get install -y ninja-build", "sudo apt-get install -y kpush", "**步骤 3:生成 build.ninja 文件**" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Ka-Boost: 8-Layer KAREL Module Architecture and Build System (fanuc-karel-ka-boost-architecture)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely due to a missing or incorrect dependency in your `build.gradle` file. The Ka-Boost architecture requires the `karel-ka-boost-architecture` module to be included in your build configuration.\n\nHere's a step-by-step fix:\n\n**Step 1: Check your `build.gradle` file**\n\nOpen your `build.gradle` file and look for the `dependencies` section. It should contain a block like this:\n```groovy\ndependencies {\n // Your dependencies here\n}\n```\n**Step 2: Add the Ka-Boost dependency**\n\nAdd the following line to the `dependencies` block:\n```groovy\ndependencies {\n implementation 'fanuc-karel-ka-boost-architecture:ka-boost:8-layer'\n}\n```\nThis will include the Ka-Boost architecture module in your build configuration.\n\n**Step 3: Update the Ka-Boost version**\n\nIf you're using an older version of Ka-Boost, you may need to update it to the latest version. You can do this by adding the following line to the `build.gradle` file:\n```groovy\nrepositories {\n mavenCentral()\n}\n\ndependencies {\n implementation 'fanuc-karel-ka-boost-architecture:ka", "metrics": { "length": 1076, "commands": 5, "command_list": [ "**Step 2: Add the Ka-Boost dependency**", "Add the following line to the `dependencies` block:", "This will include the Ka-Boost architecture module in your build configuration.", "**Step 3: Update the Ka-Boost version**", "If you're using an older version of Ka-Boost, you may need to update it to the latest version. You can do this by adding the following line to the `build.gradle` file:" ], "has_command_block": true, "actionable": false, "inline_code_count": 11, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "KAREL Pose Library API Reference — IK/FK, Quaternion, Matrix Transforms (fanuc-karel-kl-pose-api-reference)", "condition": "with_lesson", "status": 200, "content": "To fix the error, you need to implement the missing functionality in the Karel library. Here are the concrete, actionable fixes:\n\n**1. IK/FK求解**\n\n```karel\n-- 逆运动学:笛卡尔→关节角\njoint_pose = pose__solveIK(cart_pose, grp_no)\n\n-- 正运动学:关节角→笛卡尔\ncart_pose = pose__solveFK(joint_pose, grp_no)\n\n-- 必须检查成功标志\nIF NOT pose__get_ok THEN\n // handle error\nELSE\n // continue with cart_pose\nENDIF\n```\n\n```karel\n--底层调用FANUC的CALC_JPOS_DATA和CALC_KINE_DATA\nfunction calc_jpos_data(pose) {\n // implementation using CALC_JPOS_DATA and CALC_KINE_DATA\n}\n\nfunction calc_kine_data(pose) {\n // implementation using CALC_JPOS_DATA and CALC_KINE_DATA\n}\n```\n\n**2. 四元数运算(避免万向锁)**\n\n```karel\n-- 欧拉角→四元数\nq = quaternion__pose_to_quat(pose)\n\n-- 四元数乘法(旋转组合)\nq", "metrics": { "length": 719, "commands": 1, "command_list": [ "**2. 四元数运算(避免万向锁)**" ], "has_command_block": true, "actionable": false, "inline_code_count": 3, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "KAREL Pose Library API Reference — IK/FK, Quaternion, Matrix Transforms (fanuc-karel-kl-pose-api-reference)", "condition": "plain", "status": 200, "content": "I don't see any error message in your question. However, I'll provide a general guide on how to troubleshoot and fix common issues with the Karel Pose Library API.\n\nThe Karel Pose Library API is a C++ library used for computer vision and robotics tasks. If you're experiencing an error, it's likely related to one of the following:\n\n1. **Missing dependencies**: Make sure you have all the required dependencies installed, including the Karel Pose Library API.\n2. **Incorrect usage**: Double-check that you're using the API correctly, following the documentation and examples provided.\n3. **Outdated library**: Ensure that you're using the latest version of the Karel Pose Library API.\n\nTo fix the issue, follow these steps:\n\n### Step 1: Update dependencies\n\nIf you're using a package manager like `apt` or `brew`, update your dependencies to the latest version.\n\n```bash\n# Update dependencies (Ubuntu/Debian)\nsudo apt update\nsudo apt upgrade\n\n# Update dependencies (macOS with Homebrew)\nbrew upgrade\n```\n\n### Step 2: Rebuild the Karel Pose Library API\n\nIf you're using a package manager, try rebuilding the Karel Pose Library API.\n\n```bash\n# Rebuild dependencies (Ubuntu/De", "metrics": { "length": 1176, "commands": 3, "command_list": [ "sudo apt update", "sudo apt upgrade", "brew upgrade" ], "has_command_block": true, "actionable": true, "inline_code_count": 4, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Unit Testing FANUC KAREL Programs with KUnit Framework (fanuc-karel-unit-testing-kunit)", "condition": "with_lesson", "status": 200, "content": "要解决 FANUC KAREL 语言的单元测试问题,需要按照以下步骤进行:\n\n**步骤 1:安装 KUnit**\n\n1. 下载 KUnit 的发布包:https://github.com/fanuc-karel/kunit/releases\n2. 将 `kunit.pc` 和 `vendor/strings.pc` 复制到机器人控制器\n3. 将 `kunit.h.kl` 复制到项目的支持目录或与测试文件同目录\n4. 在测试文件中添加 `%INCLUDE kunit.h`\n5. 翻译并部署 KAREL 语言程序到控制器\n\n**步骤 2:编写测试用例**\n\n1. 在 KAREL 语言中创建一个测试文件(例如 `test_add_int.kl`)\n2. 在测试文件中添加以下代码:\n```karel\nPROGRAM test_add_int\n%NOLOCKGROUP -- 浏览器运行 KAREL 必须\n%INCLUDE kunit.h\n\n-- 被测函数\nROUTINE add_int(l : INTEGER; r : INTEGER) : INTEGER\nBEGIN\n RETURN(l + r)\nEND add_int\n\n-- 测试用例:每个返回", "metrics": { "length": 537, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 5, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "UV-to-XYZWPR Pipeline — From 2D Slice Geometry to Robot Motion (fanuc-karel-uv-to-xyzwpr-pipeline)", "condition": "with_lesson", "status": 200, "content": "The error you're encountering is likely due to a missing or incorrect import statement in your Python code. Based on the provided information, it seems that the `karel` module is not properly imported.\n\nHere's a step-by-step fix:\n\n1. Open your Python script and locate the line where you're using the `karel` module.\n\n2. Check if the `karel` module is imported correctly. If it's not, add the following line at the top of your script:\n ```python\nimport karel\n```\n\n3. If you're using a specific class or function from the `karel` module, make sure to import it correctly. For example, if you're using the `new` class, you should import it like this:\n ```python\nfrom karel import new\n```\n\n4. If you're still encountering issues, ensure that the `karel` module is installed and available in your Python environment. You can check the installation by running the following command:\n ```bash\npip show karel\n```\n\n5. If the `karel` module is not installed, you can install it using pip:\n ```bash\npip install karel\n```\n\nAfter making these changes, your Python script should be", "metrics": { "length": 1076, "commands": 3, "command_list": [ "3. If you're using a specific class or function from the `karel` module, make sure to import it correctly. For example, if you're using the `new` class, you should import it like this:", "4. If you're still encountering issues, ensure that the `karel` module is installed and available in your Python environment. You can check the installation by running the following command:", "5. If the `karel` module is not installed, you can install it using pip:" ], "has_command_block": true, "actionable": true, "inline_code_count": 14, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Unit Testing FANUC KAREL Programs with KUnit Framework (fanuc-karel-unit-testing-kunit)", "condition": "plain", "status": 200, "content": "To fix the error when unit testing FANUC KAREL programs with the KUnit framework, you need to install the KUnit framework and its dependencies. Here's a step-by-step guide with exact commands for a Linux system:\n\n**Step 1: Install KUnit and its dependencies**\n\n```bash\nsudo dnf install -y kunit\nsudo dnf install -y klibc\nsudo dnf install -y klibc-utils\n```\n\n**Step 2: Install the FANUC KAREL compiler**\n\nYou'll need to install the FANUC KAREL compiler, which is not a standard package. You can download it from the FANUC website or build it from source.\n\n**Download the FANUC KAREL compiler**\n\n```bash\nwget https://www.fanuc.co.jp/en/products/software/programmer/fk-karelsdk-2.3.0.tar.gz\ntar -xvf fk-karelsdk-2.3.0.tar.gz\n```\n\n**Build the FANUC KAREL compiler**\n\n```bash\ncd fk-karelsdk-2.3.0\n./configure\nmake\n```\n\n**Step 3: Compile your FANUC KAREL program", "metrics": { "length": 856, "commands": 8, "command_list": [ "sudo dnf install -y kunit", "sudo dnf install -y klibc", "sudo dnf install -y klibc-utils", "wget https://www.fanuc.co.jp/en/products/software/programmer/fk-karelsdk-2.3.0.tar.gz", "tar -xvf fk-karelsdk-2.3.0.tar.gz" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "UV-to-XYZWPR Pipeline — From 2D Slice Geometry to Robot Motion (fanuc-karel-uv-to-xyzwpr-pipeline)", "condition": "plain", "status": 200, "content": "I'm happy to help you troubleshoot the issue, but I need more information about the error message. Please provide the exact error message you're seeing.\n\nHowever, based on the error message you provided, it seems like the issue might be related to the fanuc-karel-uv-to-xyzwpr-pipeline library.\n\nHere are some general steps you can take to troubleshoot the issue:\n\n1. Check the library documentation: Make sure you're using the latest version of the library and that you're following the installation instructions correctly.\n2. Check for dependencies: The library might require additional dependencies to be installed. Check the library documentation to see if there are any specific dependencies required.\n3. Check the input data: Make sure the input data is in the correct format and that it's properly validated.\n\nIf you're still having trouble, please provide the exact error message you're seeing, and I'll do my best to help you troubleshoot the issue.\n\nThat being said, here are some general steps you can take to fix the issue:\n\n**Step 1: Update the library**\n\nTry updating the library to the latest version using pip:\n```bash\npip install --upgrade fanuc-karel-uv-to-xyzwpr-pipeline\n```\n**Step ", "metrics": { "length": 1202, "commands": 1, "command_list": [ "pip install --upgrade fanuc-karel-uv-to-xyzwpr-pipeline" ], "has_command_block": true, "actionable": true, "inline_code_count": 1, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC KL: 1086 是代码行号而非错误码 (fanuc-kl-1086-is-line-number-not-error-code)", "condition": "plain", "status": 200, "content": "The error message indicates that the code `1086` is a line number, not an error code. To fix this, you need to replace the line number with the actual error code.\n\nHere's an example of how you can do this using a text editor:\n\n1. Open the file in which the line number is present.\n2. Locate the line number `1086` and replace it with the actual error code.\n\nIf you're using an IDE (Integrated Development Environment), you can also use the following steps:\n\n**For Visual Studio Code (VS Code):**\n\n1. Open the file in VS Code.\n2. Press `Ctrl + Shift + F` to find and replace the line number.\n3. In the Find dialog box, enter `1086` in the \"Find what\" field and leave the \"Replace with\" field blank.\n4. Click \"Find All\" and then click \"Replace All\" to replace all occurrences of the line number.\n\n**For IntelliJ IDEA:**\n\n1. Open the file in IntelliJ IDEA.\n2. Press `Ctrl + Shift + F` to find and replace the line number.\n3. In the Find dialog box, enter `1086` in the \"Find what\" field and leave the \"Replace with\" field blank", "metrics": { "length": 1024, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 6, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC KL: 1086 是代码行号而非错误码 (fanuc-kl-1086-is-line-number-not-error-code)", "condition": "with_lesson", "status": 200, "content": "To fix the issue, you need to identify the line number in the KTRANS output and remove the incorrect assumption that it's an error code. Here's a step-by-step solution:\n\n1. Find the line number in the KTRANS output:\n```bash\ngrep -i \"1086\" lessons/contrib/fanuc-.md | wc -l\n```\nThis command searches for the line number 1086 in the FANUC documentation and counts the number of occurrences.\n\n2. Verify the line number is in the KTRANS output:\n```bash\ngrep -i \"1086\" lessons/contrib/fanuc-kl-1086-is-line-number-not-error-code.md\n```\nThis command searches for the specific file that contains the correct information about the line number 1086.\n\n3. Remove the incorrect assumption that 1086 is an error code:\n```bash\necho \"1086 is a line number, not an error code\" > lessons/contrib/fanuc-.md\n```\nThis command updates the FANUC documentation to reflect the correct information.\n\n4. Verify the change:\n```bash\ngrep -i \"1086\" lessons/contrib/fanuc-.md\n```\nThis command searches for the updated information in the F", "metrics": { "length": 1008, "commands": 4, "command_list": [ "grep -i \"1086\" lessons/contrib/fanuc-.md | wc -l", "grep -i \"1086\" lessons/contrib/fanuc-kl-1086-is-line-number-not-error-code.md", "echo \"1086 is a line number, not an error code\" > lessons/contrib/fanuc-.md", "grep -i \"1086\" lessons/contrib/fanuc-.md" ], "has_command_block": true, "actionable": false, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC KL: BYTES_AHEAD 是 Karel 内置 Procedure (fanuc-kl-bytes-ahead-is-builtin-procedure)", "condition": "with_lesson", "status": 200, "content": "**解决 FANUC KL BYTES_AHEAD 是 Karel 内置 Procedure 错误的具体步骤**\n\n1. **复制并粘贴 BYTES_AHEAD 调用代码**\n\n ```karel\nkarel\n-- 示例1:轮询等待缓冲区有数据再读取,避免阻塞\nROUTINE wait_for_data(comm_file : FILE)\nVAR\n byte_count : INTEGER\nBEGIN\n REPEAT\n byte_count = BYTES_AHEAD(comm_file)\n -- 若缓冲区为空则短暂等待,避免 CPU 空转\n IF byte_count = 0 THEN\n DELAY 10\n ENDIF\n UNTIL byte_count 0\nEND wait_for_data\n```\n\n ```karel\nkarel\n-- 示例2:在 MM_RCV_NTFY.kl 中判断是否有完整消息帧可读\nVAR\n pending : INTEGER\n msg_buf : STRING[128]\n status : INTEGER\nBEGIN\n pending = BYTES_AHEAD(notify_file)\n IF pending = MIN_MSG_LEN THEN\n READ notify_file(msg_buf::status)\n -- 处理消息...\n END", "metrics": { "length": 641, "commands": 0, "command_list": [], "has_command_block": true, "actionable": false, "inline_code_count": 2, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC KL: BYTES_AHEAD 是 Karel 内置 Procedure (fanuc-kl-bytes-ahead-is-builtin-procedure)", "condition": "plain", "status": 200, "content": "The error message `FANUC KL: BYTES_AHEAD 是 Karel 内置 Procedure (fanuc-kl-bytes-ahead-is-builtin-procedure)` suggests that the `BYTES_AHEAD` procedure is not a built-in procedure in the FANUC KL programming language.\n\nTo fix this issue, you need to define the `BYTES_AHEAD` procedure yourself. Here's a simple example of how you can define it:\n\n```c\n// Define the BYTES_AHEAD procedure\nPROCEDURE BYTES_AHEAD(X, Y, N)\n VAR\n i: INT;\n BEGIN\n // Loop through the specified number of bytes\n FOR i := 1 TO N DO\n // Your code here to process each byte\n // For example, you can print the byte\n WRITE(X + Y + i);\n END;\n END;\n```\n\nHowever, if you want to use the `BYTES_AHEAD` procedure for reading bytes from a file or memory, you can use the following code:\n\n```c\n// Define the BYTES_AHEAD procedure\nPROCEDURE BYTES_AHEAD(X, Y, N)\n VAR\n buffer: ARRAY[1..N] OF BYTE;\n i: INT;\n BEGIN\n ", "metrics": { "length": 913, "commands": 1, "command_list": [ "However, if you want to use the `BYTES_AHEAD` procedure for reading bytes from a file or memory, you can use the following code:" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC KL: ERR_ABORT vs ERR_PAUSE 行为差异 (fanuc-kl-err-abort-vs-err-pause)", "condition": "plain", "status": 200, "content": "The error you're encountering is related to a behavior difference between FANUC KL's ERR_ABORT and ERR_PAUSE commands. The error message indicates that there's a difference in the behavior of these two commands.\n\nTo resolve this issue, you need to understand the differences in the behavior of these two commands and adjust your code accordingly.\n\nERR_ABORT and ERR_PAUSE are both used to stop the program, but they behave differently:\n\n- ERR_ABORT stops the program immediately and resets all variables to their initial values.\n- ERR_PAUSE stops the program temporarily and allows you to resume execution at the point where the pause occurred.\n\nHere's an example of how you can modify your code to fix the issue:\n\n**Before:**\n```c\nERR_PAUSE\n; Your code here\nERR_ABORT\n```\n**After:**\n```c\n; Your code here\nERR_PAUSE\n; Store the current position and variables\nG90 G21\n; Your code here\nERR_ABORT\n; Restore the original values\nG90 G20\n```\nIn this modified code, we're storing the current position and variables before pausing the program. When we resume execution, we restore the original values.\n\nAlternatively, you can use the `ERRABORT` command with the `ABORT` option to stop", "metrics": { "length": 1176, "commands": 1, "command_list": [ "**After:**" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC KL: ERR_ABORT vs ERR_PAUSE 行为差异 (fanuc-kl-err-abort-vs-err-pause)", "condition": "with_lesson", "status": 200, "content": "To fix the error FANUC KL: ERR_ABORT vs ERR_PAUSE 行为差异, you need to change the way you handle IPC timeouts in your FANUC KAREL program. Here's an example of how you can modify the `handle_ipc_timeout` routine to use `ERR_PAUSE` instead of `ERR_ABORT`:\n\n```karel\nROUTINE handle_ipc_timeout\nVAR\n status : INTEGER\nBEGIN\n -- 记录错误日志\n WRITE TPERROR ('IPC timeout, pausing current task only', CR)\n \n -- 仅暂停当前任务,保留程序号和上下文\n status = ERR_PAUSE\n \n -- 等待固定时间后重试(退避策略)\n DELAY 2000 -- 等待 2 秒\n \n -- 尝试重新建立 IPC 连接\n CALL reconnect_ipc(status)\n \n IF status < 0 THEN\n -- 多次重试失败后才考虑上报,但仍不使用 ERR_ABORT\n WRITE TPERROR ('IPC reconnect failed, notify operator', CR)\n ENDIF\nEND handle_ipc_timeout\n```\n\nIn this modified version, we use `ERR_PAUSE` to pause the current task, instead of", "metrics": { "length": 781, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 5, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC KL: mm_module_h.kl 禁止 ROUTINE 声明 (fanuc-kl-mm-module-h-no-routine)", "condition": "with_lesson", "status": 200, "content": "解决FANUC KL: mm_module_h.kl 禁止 ROUTINE 声明(fanuc-kl-mm-module-h-no-routine)错误的步骤如下:\n\n1. **删除头文件中 ROUTINE 声明**:在 `mm_module_h.kl` 中删除所有 ROUTINE 声明,例如:\n\n ```kl\nkl\n-- ❌ 错误:头文件中不得出现 ROUTINE 声明\nROUTINE Check_Status(status_code : INTEGER) : BOOLEAN FROM MM_MODULE\nROUTINE Reset_Module FROM MM_MODULE\n```\n\n 变为:\n\n ```kl\nkl\n-- ✅ 正确:头文件只保留 TYPE / VAR / CONST\nTYPE\n MM_STATUS_T = STRUCTURE\n code : INTEGER\n message : STRING[64]\n active : BOOLEAN\n ENDSTRUCTURE\n\nVAR\n mm_status IN CMOS FROM MM_MODULE_H : MM_STATUS_T\n mm_err_cnt IN CMOS FROM MM_MODULE_H : INTEGER\n\nCONST\n MM_MAX_RETRY = 3\n MM_TIMEOUT = 5000\n```\n\n2. **在主程序中保留 ROUTINE 定义**:在 `MM_MODULE.kl`", "metrics": { "length": 675, "commands": 1, "command_list": [ "变为:" ], "has_command_block": true, "actionable": false, "inline_code_count": 5, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC KL: mm_module_h.kl 禁止 ROUTINE 声明 (fanuc-kl-mm-module-h-no-routine)", "condition": "plain", "status": 200, "content": "The error message \"FANUC KL: mm_module_h.kl 禁止 ROUTINE 声明 (fanuc-kl-mm-module-h-no-routine)\" is indicating that there is a prohibited routine declared in the mm_module_h.kl file of the FANUC KL programming language.\n\nTo fix this issue, you need to remove the prohibited routine from the mm_module_h.kl file. Here are the steps to follow:\n\n**Step 1: Open the mm_module_h.kl file in the FANUC KL editor**\n\nYou can open the mm_module_h.kl file using the FANUC KL editor. The location of the editor may vary depending on your system configuration and the version of the FANUC KL software you are using.\n\n**Step 2: Locate and remove the prohibited routine**\n\nIn the mm_module_h.kl file, navigate to the line that contains the prohibited routine. This line should start with the keyword \"ROUTINE\".\n\nRemove the entire line that contains the prohibited routine. The line should be deleted completely, without leaving any residual code.\n\n**Step 3: Save the mm_module_h.kl file**\n\nAfter removing the prohibited routine, save the mm_module_h.kl file to update the changes.\n\n**Step 4: Compile", "metrics": { "length": 1080, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC Payload Estimation — Auto and Manual Load Configuration (fanuc-payload-estimation)", "condition": "plain", "status": 200, "content": "The error you're encountering, `FANUC Payload Estimation — Auto and Manual Load Configuration`, typically occurs when there's an issue with the payload estimation process in FANUC robots. Here's a step-by-step guide to resolve this issue:\n\n**Before you start:**\n\n1. Ensure you have the latest software updates installed on your FANUC robot.\n2. Verify that the robot's configuration files are up-to-date.\n\n**Step 1: Clear the robot's configuration files**\n\n1. Log in to the robot's control panel using a PC or laptop connected to the robot's Ethernet port.\n2. Open the FANUC robot's configuration software (e.g., FANUC's Control Panel or FANUC's RobotStudio).\n3. Navigate to the \"Configuration\" or \"Settings\" menu and select \"Clear Configuration.\"\n4. Confirm that you want to clear the configuration files.\n\n**Step 2: Update the robot's software**\n\n1. Go to the FANUC website and download the latest software update for your robot model.\n2. Follow the instructions provided in the update package to install the new software.\n\n**Step 3: Recalculate the payload**\n\n1. Log in to the robot's control panel using a PC or laptop connected to", "metrics": { "length": 1134, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 1, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC Profinet 32-bit Real Value Transfer Without KAREL (fanuc-profinet-32bit-real-value-transfer)", "condition": "with_lesson", "status": 200, "content": "To fix the FANUC Profinet 32-bit Real Value Transfer Without KAREL error, you need to modify the code that sends and receives 32-bit real values via Profinet. Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Modify the send code (Robot → PLC)**\n\n```bash\n# Modify the send code to pack two 16-bit words into a 32-bit real value\nfanuc\nR[1:real] = 123.456\nR[2:scaled] = ROUND(R[1] 1000)\nR[3:low] = MOD(R[2], 65536)\nR[4:high] = (R[2] - R[3]) / 65536\nGO[1] = R[3]\nGO[2] = R[4]\n```\n\n**Step 2: Modify the receive code (PLC → Robot)**\n\n```bash\n# Modify the receive code to unpack two 16-bit words into a 32-bit real value\nfanuc\nR[3:low] = GI[1]\nR[4:high] = GI[2]\nR[2:scaled] = (R[4]", "metrics": { "length": 692, "commands": 7, "command_list": [ "fanuc", "R[1:real] = 123.456", "R[2:scaled] = ROUND(R[1] 1000)", "R[3:low] = MOD(R[2], 65536)", "R[4:high] = (R[2] - R[3]) / 65536" ], "has_command_block": true, "actionable": true, "inline_code_count": 2, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC Payload Estimation — Auto and Manual Load Configuration (fanuc-payload-estimation)", "condition": "with_lesson", "status": 200, "content": "To fix the FANUC payload estimation error, you need to estimate or manually configure the payload parameters correctly. Here's a step-by-step guide with exact commands:\n\n**Auto Estimation Method:**\n\n1. Install the end effector on the robot.\n2. Navigate to the payload estimation function in the FANUC controller:\n ```\n MENU → Setup → Frames → Payload → Setup Payload Estimation\n ```\n3. Select the estimation method (typically 4-point or 6-point):\n ```\n PAYLOAD ESTIMATION METHOD → 4-POINT or 6-POINT\n ```\n4. Execute the payload estimation:\n ```\n PAYLOAD ESTIMATION → Execute\n ```\n5. Save the results:\n ```\n PAYLOAD ESTIMATION → Save Results\n ```\n\n**Manual Configuration Method:**\n\n1. Navigate to the payload configuration function in the FANUC controller:\n ```\n MENU → Setup → Frames → Payload → Select Payload Number\n ```\n2. Enter the payload parameters:\n ```\n PAYLOAD[1:WeldGun] = Mass (kg) ; Center of gravity (X, Y, Z in mm) ; Inertia (Ix, Iy, Iz in kg·m²)\n ```\n Example:\n", "metrics": { "length": 1002, "commands": 6, "command_list": [ "MENU → Setup → Frames → Payload → Setup Payload Estimation", "PAYLOAD ESTIMATION METHOD → 4-POINT or 6-POINT", "PAYLOAD ESTIMATION → Execute", "PAYLOAD ESTIMATION → Save Results", "MENU → Setup → Frames → Payload → Select Payload Number" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC Profinet 32-bit Real Value Transfer Without KAREL (fanuc-profinet-32bit-real-value-transfer)", "condition": "plain", "status": 200, "content": "The error \"FANUC Profinet 32-bit Real Value Transfer Without KAREL\" typically occurs when the FANUC Profinet device is not configured to use KAREL (Kernel Address Register Extension for Linux) or the kernel does not support KAREL.\n\nTo fix this issue, you'll need to update your kernel to a version that supports KAREL. Here's a step-by-step guide:\n\n**Method 1: Update your kernel using the package manager**\n\n1. Check if you're using a Linux distribution that supports KAREL. If not, consider upgrading to a supported distribution.\n2. Update your package manager to the latest version:\n - For Ubuntu/Debian: `sudo apt-get update && sudo apt-get upgrade`\n - For Red Hat/CentOS: `sudo yum update`\n - For Fedora: `sudo dnf update`\n\n3. Install the kernel update package:\n - For Ubuntu/Debian: `sudo apt-get install linux-headers-$(uname -r)`\n - For Red Hat/CentOS: `sudo yum install kernel-headers`\n - For Fedora: `sudo dnf install kernel-headers`\n\n4. Reboot your system: `sudo reboot`\n\n**Method 2", "metrics": { "length": 1005, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC Robot PROFINET IO Configuration with PFN-CT Software (fanuc-profinet-io-software-config)", "condition": "with_lesson", "status": 200, "content": "根据问题描述,错误可能是由于PFN-CT软件无法正确识别FANUC机器人GSD文件,导致配置过程失败。以下是具体的解决方法和命令:\n\n**步骤1:检查PFN-CT软件版本**\n\n1. 打开PFN-CT软件,进入主界面。\n2. 在顶部菜单中选择“帮助”>“关于PFN-CT”。\n3. 检查软件版本,确保版本为V1.0.14或更高。\n\n**步骤2:检查FANUC机器人GSD文件**\n\n1. 将FANUC机器人GSD文件复制到PFN-CT软件的GSD文件夹(通常位于PFN-CT安装目录下的“GSD”文件夹)。\n2. 在PFN-CT主界面中,选择“设备”>“新设备”。\n3. 选择“FANUC”作为设备类型,输入机器人ID和其他相关信息。\n4. 检查设备信息,确保GSD文件被正确加载。\n\n**步骤3:配置IO模块**\n\n1. 在PFN-CT主界", "metrics": { "length": 371, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC PROFINET Communication with Siemens S7-1200 and External Startup (fanuc-profinet-s7-1200-external-startup)", "condition": "with_lesson", "status": 200, "content": "Based on the provided information, here's a step-by-step guide to fix the FANUC PROFINET communication with Siemens S7-1200 and external startup issue:\n\n**Hardware Preparation and Network Configuration**\n\n1. Install the PROFINET adapter card on the FANUC robot (e.g., A05B-2600 series PCI card).\n2. Configure the FANUC side PROFINET parameters:\n\t* Open the FANUC menu and navigate to `SETUP` > `Profinet`.\n\t* Set the IP address and device name to match the S7-1200's settings.\n\t* Ensure both devices are on the same network segment.\n\n**TIA Portal Configuration**\n\n1. Import the FANUC GSD file (download from the FANUC website for the correct version) into TIA Portal:\n\t* Open TIA Portal and create a new project.\n\t* Go to `Project` > `Import` > `GSD File`.\n\t* Select the FANUC GSD file and follow the import process.\n2. Add the FANUC device as a PROFINET device in the project:\n\t* In the TIA Portal project window, right-click on the `Devices` folder and select `Add", "metrics": { "length": 966, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 6, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC PROFINET Communication with Siemens S7-1200 and External Startup (fanuc-profinet-s7-1200-external-startup)", "condition": "plain", "status": 200, "content": "The error you're encountering is related to the FANUC PROFINET communication with a Siemens S7-1200 controller. Here's a step-by-step solution to resolve the issue:\n\n**Step 1: Check the PROFINET Configuration**\n\n1. Log in to the S7-1200 controller and navigate to the PROFINET configuration menu.\n2. Select \"PROFINET\" and then \"Device Settings\" (or \"Device Configuration\").\n3. Check if the PROFINET communication is enabled and if the device is correctly configured.\n\n**Step 2: Configure the External Startup**\n\n1. Go to the \"Start/Stop\" menu and select \"Start/Stop\" (or \"Start/Stop Device\").\n2. Select \"External Startup\" (or \"External Start\") and configure the following settings:\n\t* Set the \"External Start\" flag to \"Enabled\".\n\t* Set the \"External Start Time\" to the desired time (e.g., 08:00).\n\t* Set the \"External Start Date\" to the desired date (e.g., 2024-02-01).\n3. Save the changes.\n\n**Step 3: Configure the FANUC PROFINET Configuration**\n\n1. Log in to the FANUC", "metrics": { "length": 970, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC Robot Program Inspection Methodology — Systematic Check Guide (fanuc-program-inspection-methodology)", "condition": "with_lesson", "status": 200, "content": "To fix the error, we'll need to identify the specific problem and provide a concrete, actionable fix with exact commands. Since the provided text is a guide, I'll assume a typical FANUC robot program inspection methodology and provide a general fix.\n\n**Assumptions:**\n\n* The robot program is written in FANUC's G-code format.\n* The program contains a signal mapping error, safety violation, or logic bug.\n* The inspection categories are being used to identify the issue.\n\n**Fix:**\n\nLet's assume the issue is with Signal Check (All Robots) and Collision Zone FINE Point Check. We'll focus on fixing the signal mapping error and collision zone safety violation.\n\n**Signal Check (All Robots):**\n\n1. Verify signal number matches configuration standard:\n\n ```gcode\n; Check signal number matches configuration standard\n; Signal ranges:\n; DIDO-PLC: 1-512 (PLC communication)\n; DIDO-Connection: 513-2648 (ISV vision, etc.)\n; DIDO-Tool: 2649-4096 (end effector tools)\n\n; Check signal number\nIF (SI1 == 100) THEN\n MSG(\"Signal 1 is out of range", "metrics": { "length": 1065, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC Robot PROFINET IO Configuration with PFN-CT Software (fanuc-profinet-io-software-config)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely due to the PFN-CT software not being able to find the PROFINET IO configuration file. Here's a step-by-step guide to fix this issue:\n\n**Step 1: Check if the PROFINET IO configuration file exists**\n\n1. Open a command prompt or terminal window as an administrator.\n2. Navigate to the directory where you installed the PFN-CT software (usually `C:\\Program Files\\FANUC\\PFN-CT` or `C:\\Program Files (x86)\\FANUC\\PFN-CT`).\n3. Run the following command to check if the configuration file exists:\n```bash\ndir /s /b \"PROFINET_IO.config\"\n```\nIf the file is not found, proceed to the next step.\n\n**Step 2: Create the PROFINET IO configuration file**\n\n1. Create a new file named `PROFINET_IO.config` in the same directory where you installed the PFN-CT software.\n2. Open the file in a text editor (such as Notepad or Notepad++).\n3. Add the following configuration settings to the file:\n```xml\n\n{{ document.name }}\n```\n\nIn this example, the `url` field is used directly in the `href` attribute, without manual construction.\n\nBy following these steps, you can ensure that the correct URL is used to access the Feishu document, and avoid", "metrics": { "length": 1103, "commands": 8, "command_list": [ "import requests", "response = requests.get('https://open.feishu.cn/document/api/v1/document/your-document-id')", "if response.status_code == 200:", "document_data = response.json()", "url = document_data['url']" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "cc connect feishu display optimization (feishu-display-optimization-cc-connect)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely due to a missing or incorrect dependency in your `pom.xml` file for the Feishu Connect library.\n\nTo fix this issue, you need to add the following dependency to your `pom.xml` file:\n\n```xml\n\n com.alibaba\n feishu-connect\n 1.0.0\n\n```\n\nHere's how you can add it:\n\n1. Open your `pom.xml` file in an editor.\n2. Add the following XML code inside the `` section:\n\n```xml\n\n \n \n com.alibaba\n feishu-connect\n 1.0.0\n \n\n```\n\n3. Save the changes to your `pom.xml` file.\n\nAfter making these changes, you should be able to resolve the error and successfully compile your project.\n\nPlease note that the version number may vary depending on the actual version of the library you're using. Make sure to check the library's documentation or the Maven repository", "metrics": { "length": 1078, "commands": 3, "command_list": [ "Here's how you can add it:", "1. Open your `pom.xml` file in an editor.", "2. Add the following XML code inside the `` section:" ], "has_command_block": true, "actionable": false, "inline_code_count": 8, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "cc connect feishu display optimization (feishu-display-optimization-cc-connect)", "condition": "with_lesson", "status": 200, "content": "To fix the error `cc connect feishu display optimization (feishu-display-optimization-cc-connect)`, follow these steps:\n\n**Step 1: Stop the running cc-connect instance**\n\n```bash\ncc-connect stop --force\n```\n\n**Step 2: Create a new configuration file for cc-connect**\n\n```bash\nmkdir -p ~/.cc-connect\ntouch ~/.cc-connect/config.toml\n```\n\n**Step 3: Add the display settings to the configuration file**\n\n```toml\n[display]\nmode = \"quiet\"\nthinking_messages = false\nthinking_max_len = 0\ntool_max_len = 0\ntool_messages = false\nshow_context_indicator = false\nreply_footer = false\n```\n\n**Step 4: Restart the cc-connect instance**\n\n```bash\ncc-connect start\n```\n\n**Step 5: Verify the changes**\n\n```bash\ncc-connect logs --force\n```\n\nThis will display the logs, and you should see no tool call messages or context indicators.\n\n**Step 6: Test the changes**\n\n```bash\ncc connect\n```\n\nSend a message in the Feishu chat, and verify that there are no tool call messages or context indicators.\n\nIf everything is set up correctly, you should", "metrics": { "length": 1019, "commands": 7, "command_list": [ "cc-connect stop --force", "mkdir -p ~/.cc-connect", "touch ~/.cc-connect/config.toml", "**Step 4: Restart the cc-connect instance**", "**Step 5: Verify the changes**" ], "has_command_block": true, "actionable": true, "inline_code_count": 12, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "feishu doc url use api return (feishu-doc-url-use-api-return)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely due to a missing or incorrect API key in the Feishu SDK. Here's a step-by-step solution to fix the issue:\n\n**Prerequisites:**\n\n1. Install the Feishu SDK using npm or yarn:\n\n```bash\nnpm install feishu-sdk\n# or\nyarn add feishu-sdk\n```\n\n2. Create a Feishu app and obtain an app ID and app secret.\n\n**Fixing the error:**\n\n1. Import the Feishu SDK and initialize it with your app ID and app secret:\n\n```javascript\nconst Feishu = require('feishu-sdk');\n\nconst appId = 'your_app_id';\nconst appSecret = 'your_app_secret';\n\nFeishu.init({\n appId,\n appSecret,\n});\n```\n\n2. Replace `'your_app_id'` and `'your_app_secret'` with your actual Feishu app ID and app secret.\n\n3. Use the `Feishu` object to create a doc URL using the `docUrlUseApi` method:\n\n```javascript\nFeishu.docUrlUseApi({\n docId: 'your_doc_id',\n docType: 'your_doc_type',\n content: 'your_doc_content',\n ", "metrics": { "length": 900, "commands": 4, "command_list": [ "npm install feishu-sdk", "yarn add feishu-sdk", "2. Replace `'your_app_id'` and `'your_app_secret'` with your actual Feishu app ID and app secret.", "3. Use the `Feishu` object to create a doc URL using the `docUrlUseApi` method:" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "DeepSeek TUI — Feishu MCP Server Setup & Permission Boundaries (feishu-mcp-server-deepseek-tui-setup)", "condition": "with_lesson", "status": 200, "content": "Here's a step-by-step guide to fixing the error:\n\n**Step 1: Create a new file `mcp.json` in the root directory of your project**\n\nCreate a new file named `mcp.json` in the root directory of your project. This file will contain the configuration for the MCP server.\n\n```json\n{\n \"servers\": {\n \"feishu\": {\n \"command\": \".venv/bin/python3\",\n \"args\": [\"server.py\"],\n \"env\": {\n \"FEISHU_APP_ID\": \"cli_xxxxx\",\n \"FEISHU_APP_SECRET\": \"xxxxxxxx\"\n }\n }\n }\n}\n```\n\n**Step 2: Update the `server.py` file to read environment variables from `mcp.json`**\n\nUpdate the `server.py` file to read the environment variables from `mcp.json`. Add the following lines at the top of the file:\n\n```python\nimport json\nimport os\n\nwith open('mcp.json') as f:\n mcp_config = json.load(f)\n\nif 'FEISHU_APP_ID' not in os.environ:\n print(\"Error: FEISHU_APP_ID environment variable is not set\")\n exit(1)\n\nif 'FEISHU_APP", "metrics": { "length": 930, "commands": 2, "command_list": [ "**Step 2: Update the `server.py` file to read environment variables from `mcp.json`**", "Update the `server.py` file to read the environment variables from `mcp.json`. Add the following lines at the top of the file:" ], "has_command_block": true, "actionable": false, "inline_code_count": 8, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "DeepSeek TUI — Feishu MCP Server Setup & Permission Boundaries (feishu-mcp-server-deepseek-tui-setup)", "condition": "plain", "status": 200, "content": "The error you're encountering suggests that there's an issue with the setup or permissions of the Feishu MCP Server with DeepSeek TUI. To resolve this, you'll need to make sure that the `feishu-mcp-server-deepseek-tui-setup` command is executed with the correct permissions and environment variables. Here's a step-by-step fix:\n\n**Step 1: Update the Feishu MCP Server**\n\nBefore fixing the permission issue, ensure that the Feishu MCP Server is updated to the latest version. Run the following command:\n\n```bash\ndocker-compose up -d --build\n```\n\n**Step 2: Create a new directory for the DeepSeek TUI**\n\nCreate a new directory for the DeepSeek TUI and navigate into it:\n\n```bash\nmkdir deepseek-tui\ncd deepseek-tui\n```\n\n**Step 3: Copy the DeepSeek TUI configuration files**\n\nCopy the configuration files from the Feishu MCP Server's configuration directory to the new directory:\n\n```bash\ncp -r /path/to/feishu-mcp-server-deepseek-tui-setup/config/* .\n```\n\nReplace `/path/to/feishu-mcp-server-deepseek-tui-setup/config/` with the", "metrics": { "length": 1025, "commands": 4, "command_list": [ "docker-compose up -d --build", "mkdir deepseek-tui", "cd deepseek-tui", "cp -r /path/to/feishu-mcp-server-deepseek-tui-setup/config/* ." ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "feishu upload file type opus (feishu-upload-file-type-opus)", "condition": "with_lesson", "status": 200, "content": "To fix the error, you need to correct the field name in the `data` dictionary from `file_length` to `file_type`. Here's how you can do it:\n\nFirst, create a new file named `feishu-upload-file-type-opus.py` and add the following code:\n\n```python\nimport io\n\ndef upload_file(file_name, file_type):\n # Define the data dictionary with the correct field name\n data = {'file_type': file_type, 'file_name': file_name}\n \n # Create a bytes buffer for the file data\n files = {'file': (file_name, io.BytesIO(), 'audio/ogg')}\n \n # Return the data and files\n return data, files\n\n# Example usage\nfile_name = 'voice.ogg'\nfile_type = 'opus'\ndata, files = upload_file(file_name, file_type)\n\n# Print the data and files\nprint(data)\nprint(files)\n```\n\nNext, run the following commands in your terminal to verify the fix:\n\n```bash\npython feishu-upload-file-type-opus.py\n\ngrep -i feishu lessons/contrib/feishu-.md 2/dev/null | wc -l\necho Feishu verified\n```\n\nIf everything", "metrics": { "length": 971, "commands": 1, "command_list": [ "Next, run the following commands in your terminal to verify the fix:" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "feishu upload file type opus (feishu-upload-file-type-opus)", "condition": "plain", "status": 200, "content": "The error you're encountering is related to Feishu's API restrictions on file types. By default, Feishu's API does not support uploading Opus files (.opus). \n\nHere's a concrete, actionable fix:\n\n**Solution 1: Convert Opus to WAV**\n\nYou can convert the Opus file to WAV using an online converter or a command-line tool like `ffmpeg`.\n\n**Using FFmpeg (on Linux/macOS):**\n\n```bash\nffmpeg -i input.opus output.wav\n```\n\n**Using FFmpeg (on Windows):**\n\nYou can use the `ffmpeg` executable from the official website.\n\n1. Download the latest version of `ffmpeg` for Windows from the official website.\n2. Extract the downloaded zip file to a folder of your choice (e.g., `C:\\ffmpeg\\bin`).\n3. Open a command prompt and navigate to the folder where `ffmpeg` is located.\n4. Run the following command to convert the Opus file to WAV:\n\n```bash\nffmpeg -i input.opus output.wav\n```\n\n**Solution 2: Use a different file type**\n\nIf you cannot convert the Opus file to WAV, you can try using a different file type that Feishu's API supports. For example, you", "metrics": { "length": 1038, "commands": 2, "command_list": [ "ffmpeg -i input.opus output.wav", "ffmpeg -i input.opus output.wav" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "feishu webhook url env config (feishu-webhook-url-env-config)", "condition": "with_lesson", "status": 200, "content": "Here's a step-by-step guide to fix the error:\n\n**Step 1: Rotate app_secret (飞书开放平台后台操作)**\n\n* Log in to your Feishu developer dashboard and navigate to the \"App Secret\" page.\n* Click on \"Rotate\" to generate a new app secret.\n* Copy the new app secret and save it securely.\n\n**Step 2: Remove config.yaml from git index**\n\n* Run the following command to remove config.yaml from the git index:\n\n ```bash\ngit rm --cached config.yaml\n```\n\n**Step 3: Update config.yaml to use environment variables**\n\n* Open the config.yaml file and replace the app_secret with a placeholder that uses an environment variable. For example:\n\n ```yml\nfeishu-webhook-url: https://open.feishu.cn/open-apis/hook\napp_id: ${FEISHU_APP_ID}\napp_secret: ${FEISHU_APP_SECRET}\n```\n\n**Step 4: Add config.yaml to .gitignore**\n\n* Open the .gitignore file and add the following line:\n\n ```\nconfig.yaml\n```\n\n**Step 5: Store the new app_secret in ~/.bashrc**\n\n* Run the following command", "metrics": { "length": 968, "commands": 3, "command_list": [ "git rm --cached config.yaml", "**Step 4: Add config.yaml to .gitignore**", "* Open the .gitignore file and add the following line:" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "feishu webhook url env config (feishu-webhook-url-env-config)", "condition": "plain", "status": 200, "content": "The error message indicates that the `feishu-webhook-url-env-config` configuration is not set. This configuration is used to store the Webhook URL of Feishu in an environment variable.\n\nHere's a concrete, actionable fix with exact commands:\n\n**Step 1: Install the required package**\n\nIf you haven't installed the `dotenv` package yet, run the following command:\n```bash\nnpm install dotenv\n```\n**Step 2: Create a `.env` file**\n\nCreate a new file named `.env` in the root of your project directory. This file will store the environment variables, including the Feishu Webhook URL.\n\n**Step 3: Configure the Feishu Webhook URL in the `.env` file**\n\nAdd the following line to the `.env` file:\n```makefile\nFEISHU_WEBHOOK_URL=https://openfeishu.cn/api/v1/webhook\n```\nReplace `https://openfeishu.cn/api/v1/webhook` with your actual Feishu Webhook URL.\n\n**Step 4: Update the `feishu-webhook-url-env-config` configuration**\n\nRun the following command to update the `feishu-webhook-url-env-config` configuration:\n```bash\nnpm run", "metrics": { "length": 1017, "commands": 4, "command_list": [ "npm install dotenv", "Replace `https://openfeishu.cn/api/v1/webhook` with your actual Feishu Webhook URL.", "**Step 4: Update the `feishu-webhook-url-env-config` configuration**", "Run the following command to update the `feishu-webhook-url-env-config` configuration:" ], "has_command_block": true, "actionable": true, "inline_code_count": 13, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Feishu WebSocket 404 Error - HTTP Webhook Required (feishu-websocket-404-error-http-webhook-required)", "condition": "with_lesson", "status": 200, "content": "解决 Feishu WebSocket 404 Error - HTTP Webhook Required 的方法是使用 HTTP Webhook 回调模式来接收消息。下面是一个具体的示例:\n\n**步骤 1:搭建可公网访问的 HTTP 服务**\n\n我们将使用 Flask 来创建一个 HTTP 服务。\n```bash\npip install flask\n```\n**步骤 2:创建 Flask 应用**\n\n```python\nfrom flask import Flask, request, jsonify\nimport hashlib\nimport hmac\n\napp = Flask(__name__)\n\nFEISHU_VERIFICATION_TOKEN = \"your_verification_token\"\nFEISHU_ENCRYPT_KEY = \"your_encrypt_key\"\n```\n**步骤 3:处理飞书 URL 验证请求**\n\n```python\n@app.route(\"/webhook/feishu\", methods=[\"POST\"])\ndef feishu_webhook():\n data = request.json\n\n # 处理飞书 URL 验证请求(首次配置时)\n if data.get(\"type\") == \"url_verification\":\n challenge = data.get(\"challenge\")\n return jsonify({\"challenge\": challenge})\n```\n**步骤 4:处理消息事件**\n\n```python\n # 处理消息事件\n event = data", "metrics": { "length": 758, "commands": 3, "command_list": [ "pip install flask", "**步骤 3:处理飞书 URL 验证请求**", "**步骤 4:处理消息事件**" ], "has_command_block": true, "actionable": false, "inline_code_count": 6, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Feishu WebSocket 404 Error - HTTP Webhook Required (feishu-websocket-404-error-http-webhook-required)", "condition": "plain", "status": 200, "content": "The error you're encountering is due to Feishu's WebSocket API requiring an HTTP webhook for authentication. To resolve this issue, you need to set up an HTTP webhook in Feishu's dashboard.\n\nHere are the steps to follow:\n\n1. **Log in to the Feishu dashboard**: Go to the Feishu website ([https://open.feishu.cn/](https://open.feishu.cn/)) and log in with your account credentials.\n\n2. **Create a new webhook**: Navigate to the \"App\" tab, then click on \"Webhooks\" and click the \"+\" button to create a new webhook.\n\n3. **Configure the webhook settings**: In the \"Webhook Settings\" section, you'll need to provide the following details:\n\n * **App ID**: Enter your Feishu App ID.\n * **App Secret**: Enter your Feishu App Secret.\n * **Webhook URL**: Enter the URL where the Feishu WebSocket events will be sent. This can be a local development server, a cloud function, or any other endpoint that can receive HTTP requests.\n * **Event Types**: Select the event types you want to receive from Feishu. Common event types include `", "metrics": { "length": 1046, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Feishu WikiBatch Download:文件类型Handling策略 (feishu-wiki-batch-download)", "condition": "plain", "status": 200, "content": "The error \"Feishu WikiBatch Download:文件类型Handling策略\" typically indicates that the file type handling strategy is not properly configured for the Feishu WikiBatch Download plugin.\n\nTo fix this issue, you'll need to update the `feishu-wiki-batch-download` plugin to the latest version. Here are the steps:\n\n1. Open your terminal and navigate to your project directory.\n2. Run the following command to update the plugin:\n```bash\nnpm install feishu-wiki-batch-download@latest\n```\nor if you are using yarn:\n```bash\nyarn add feishu-wiki-batch-download@latest\n```\n3. After updating the plugin, restart your Node.js application or server.\n4. If the issue persists, try to check the Feishu WikiBatch Download documentation for any updates or changes to the configuration options.\n\nIf none of these steps work, you may need to provide more details about your project setup, such as the version of Node.js and npm you're using, and any other plugins or configurations that might be relevant to the issue.\n\nHere's an example of how to configure the file type handling strategy in the `feishu-wiki-batch-download` plugin:\n\n```javascript\n", "metrics": { "length": 1124, "commands": 2, "command_list": [ "npm install feishu-wiki-batch-download@latest", "yarn add feishu-wiki-batch-download@latest" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Feishu WikiBatch Download:文件类型Handling策略 (feishu-wiki-batch-download)", "condition": "with_lesson", "status": 200, "content": "Based on the provided information, here's a concrete, actionable fix for the Feishu WikiBatch Download error:\n\n**Step 1: Install required Python libraries**\n\nTo handle file types and merge single-character lines, you need to install the `python` library. Run the following command:\n\n```bash\npip install python\n```\n\n**Step 2: Create a Python script for handling single-character lines**\n\nCreate a new file named `merge_single_chars.py` with the following content:\n\n```python\ndef merge_single_chars(line):\n if len(line) == 1:\n buffer = line\n else:\n if buffer:\n result.append(buffer)\n buffer = \"\"\n result.append(line)\n\n return result\n\nwith open('output.txt', 'r') as f:\n lines = f.readlines()\n\nresult = []\nfor line in lines:\n line = line.strip()\n merged_line = merge_single_chars(line)\n result.extend(merged_line)\n\nwith open('output.txt', 'w') as f:\n f.writelines(result)\n```\n\nThis script reads a file named `output.txt`, merges single-character lines, and writes the result back to the same file.\n\n**Step 3: Create a Python script for handling PDF files**\n\nTo handle PDF", "metrics": { "length": 1135, "commands": 1, "command_list": [ "pip install python" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "ffmpeg audio libopus not ogg (ffmpeg-audio-libopus-not-ogg)", "condition": "with_lesson", "status": 200, "content": "To fix the error \"ffmpeg audio libopus not ogg\" where the output OGG file is 0 bytes, you need to specify the correct audio codec and parameters. Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Delete the existing output file (if it exists)**\n\n```bash\nos.remove output.ogg\n```\n\n**Step 2: Run the following command to convert the audio file to OGG using libopus codec**\n\n```bash\nffmpeg -i input.wav -ar 24000 -ac 1 -c:a libopus output.ogg\n```\n\nHere's a breakdown of the command:\n\n* `-i input.wav`: specifies the input audio file\n* `-ar 24000`: sets the audio sampling rate to 24 kHz\n* `-ac 1`: sets the number of audio channels to 1 (mono)\n* `-c:a libopus`: specifies the audio codec as libopus\n* `output.ogg`: specifies the output file name\n\n**Note:**\n\n* Make sure to replace `input.wav` and `output.ogg` with your actual file names.\n* If you want to convert multiple files, you can use a loop or pipe the input files to `ffmpeg`.\n\nExample with multiple files:\n```bash", "metrics": { "length": 986, "commands": 2, "command_list": [ "os.remove output.ogg", "ffmpeg -i input.wav -ar 24000 -ac 1 -c:a libopus output.ogg" ], "has_command_block": true, "actionable": true, "inline_code_count": 12, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "ffmpeg audio libopus not ogg (ffmpeg-audio-libopus-not-ogg)", "condition": "plain", "status": 200, "content": "The error you're encountering, `ffmpeg-audio-libopus-not-ogg`, typically occurs when you're trying to use the Libopus audio codec with FFmpeg, but FFmpeg is not configured to include the OGG container format. Here's a step-by-step solution to fix this issue:\n\n**Step 1: Install FFmpeg with OGG support**\n\nIf you haven't installed FFmpeg yet, you can download the latest version from the official website: https://ffmpeg.org/download.html\n\nFor most Linux distributions, you can install FFmpeg using your package manager. Here are the commands for popular distributions:\n\n* Ubuntu/Debian: `sudo apt-get update && sudo apt-get install ffmpeg`\n* Red Hat/Fedora: `sudo dnf install ffmpeg`\n* Arch Linux: `sudo pacman -S ffmpeg`\n\n**Step 2: Verify OGG support**\n\nTo ensure that FFmpeg is configured to include OGG support, run the following command:\n\n```bash\nffmpeg -version\n```\n\nLook for the line that says \"libopus\" and \"libogg\" in the output. If you don't see them, you might need to reconfigure FFmpeg.\n\n**Step 3: Reconfigure FFmpeg (if necessary)**\n\nIf you", "metrics": { "length": 1059, "commands": 1, "command_list": [ "ffmpeg -version" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "firewall port open not public (firewall-port-open-not-public)", "condition": "with_lesson", "status": 200, "content": "To resolve the error \"firewall port open not public\" when opening port 10086 for WCFerry, you need to understand the difference between a firewall rule and internal network traversal (also known as \"port forwarding\" or \"nat-ping\").\n\nHere are the steps to fix the issue:\n\n**Step 1: Open a command prompt or terminal**\n\nOpen a command prompt or terminal on your Windows machine.\n\n**Step 2: Open the Windows Defender Firewall with Advanced Security console**\n\nType the following command and press Enter:\n```\nnetsh advfirewall firewall\n```\nThis will open the Windows Defender Firewall with Advanced Security console.\n\n**Step 3: Check the current firewall rule**\n\nType the following command and press Enter:\n```\nnetsh advfirewall firewall show rule name=\"WCFerry\" dir=in action=allow protocol=TCP localport=10086\n```\nThis will display the current firewall rule for port 10086. If you don't see any rule, proceed to the next step.\n\n**Step 4: Create a new firewall rule**\n\nType the following command and press Enter:\n```\nnetsh advfirewall firewall add rule name=\"WCFerry\" dir=in action=allow protocol=TCP localport=10086\n", "metrics": { "length": 1114, "commands": 2, "command_list": [ "netsh advfirewall firewall", "netsh advfirewall firewall show rule name=\"WCFerry\" dir=in action=allow protocol=TCP localport=10086" ], "has_command_block": true, "actionable": false, "inline_code_count": 4, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Fiverr PerimeterX captcha blocks headless seller gig creation (fiverr-perimeterx-blocks-seller-automation)", "condition": "plain", "status": 200, "content": "The error message you're encountering is likely due to a recent change in PerimeterX's CAPTCHA policy that requires a visible browser to verify captchas. Here's a concrete, actionable fix to automate seller gig creation on Fiverr while avoiding the CAPTCHA:\n\n**Step 1: Install the required libraries**\n\nYou'll need to install the `selenium` and `pyperclip` libraries to automate browser interactions and handle CAPTCHAs.\n\n```bash\npip install selenium pyperclip\n```\n\n**Step 2: Set up your browser**\n\nWe'll use a headless browser (Chrome) to automate the process. You can install the ChromeDriver using the following command:\n\n```bash\nwget https://chromedriver.storage.googleapis.com/104.0.5117.44/chromedriver_linux64.zip\nunzip chromedriver_linux64.zip\nmv chromedriver /usr/local/bin/chromedriver\n```\n\n**Step 3: Create a Python script**\n\nCreate a new Python file (e.g., `fiverr_seller_automation.py`) and add the following code:\n\n```python\nfrom selenium import webdriver\nfrom selenium.webdriver.chrome.service import Service\nfrom webdriver_manager.chrome import ChromeDriverManager\nfrom selenium.webdriver.common.by import By\nfrom", "metrics": { "length": 1129, "commands": 4, "command_list": [ "pip install selenium pyperclip", "wget https://chromedriver.storage.googleapis.com/104.0.5117.44/chromedriver_linux64.zip", "unzip chromedriver_linux64.zip", "mv chromedriver /usr/local/bin/chromedriver" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "firewall port open not public (firewall-port-open-not-public)", "condition": "plain", "status": 200, "content": "The error \"firewall port open not public\" typically occurs when a port is open on your firewall, but the firewall doesn't allow incoming connections from the public internet. Here's a step-by-step solution:\n\n**Assumptions:**\n\n* You're using a Linux-based system (e.g., Ubuntu, Debian, CentOS).\n* You have root access to the system.\n\n**Fix:**\n\n1. **Check the firewall rules:**\n Open a terminal and run the following command to check the current firewall rules:\n\n ```bash\nsudo ufw status\n```\n\n If you're using `iptables`, run:\n\n ```bash\nsudo iptables -n --list\n```\n\n This will show you the current firewall rules.\n\n2. **Allow incoming traffic on the specific port:**\n To allow incoming traffic on a specific port, you can use one of the following methods:\n\n **Method 1: Using `ufw` (if available)**\n ```bash\nsudo ufw allow \n```\n\n Replace `` with the port number you want to allow (e.g., `22` for SSH).\n\n **Method 2: Using `iptables`**\n ```bash\nsudo iptables -A INPUT -p tcp", "metrics": { "length": 1005, "commands": 3, "command_list": [ "sudo ufw status", "sudo iptables -n --list", "sudo ufw allow " ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Game MCP: GAME OVER Restart Flow (game-mcp-game-over-restart-flow)", "condition": "with_lesson", "status": 200, "content": "To fix the error \"Game MCP: GAME OVER Restart Flow\", you need to follow the correct sequence of commands as outlined in the verified lesson. Here's a concrete, actionable fix with exact commands:\n\n1. Verify the game state is GAME OVER:\n\n ```bash\n\n```\n\n2. Initialize a new game session:\n\n ```bash\n\n```\n\n3. Wait for confirmation and check the initial state:\n\n ```bash\n\n```\n\n4. Proceed with new game commands:\n\n ```bash\n\n```\n\n5. Verify the new game state:\n\n ```bash\n\n```\n\nHere's the complete command sequence:\n\n```bash\n\n\n\n\n\n```\n\nBy following this sequence, you can ensure that the game state is correctly initialized and that the game can be restarted without errors.\n\nTo verify that the MCP is working correctly, you can check the MCP documentation or the game's official resources to confirm the correct sequence of commands. Additionally, you can use tools like `grep` to search for MCP commands in the documentation or other resources.\n\nFor example, you can use the following `", "metrics": { "length": 1136, "commands": 10, "command_list": [ "", "", "", "", "" ], "has_command_block": true, "actionable": true, "inline_code_count": 13, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Fiverr PerimeterX captcha blocks headless seller gig creation (fiverr-perimeterx-blocks-seller-automation)", "condition": "with_lesson", "status": 200, "content": "To fix the issue of Fiverr PerimeterX captcha blocks headless seller gig creation, you can follow these steps:\n\n1. **Do not loop on manage_gigs/create in headless**: Modify your script to skip this step when using a headless browser.\n\n```python\n# Before\nawait page.goto('https://www.fiverr.com/manage_gigs/create')\n\n# After\nif not page.url().endswith('/manage_gigs/create'):\n await page.goto('https://www.fiverr.com/manage_gigs')\n```\n\n2. **Use a human-attended browser (same profile) to pass the challenge once**: Create a separate browser instance with the same profile as the headless browser.\n\n```python\n# Before\nbrowser = await playwright.chromium.launch(headless=True)\npage = await browser.newPage()\n\n# After\nheadless_browser = await playwright.chromium.launch(headless=True)\npage = await headless_browser.newPage()\n\nhuman_browser = await playwright.chromium.launch(headless=False)\nhuman_page = await human_browser.newPage()\n```\n\n3. **Keep gig copy offline (title, tags, packages, FAQ)**: Store the gig copy in a file or database before attempting to create the gig.\n\n```python\n# Before\ng", "metrics": { "length": 1096, "commands": 2, "command_list": [ "2. **Use a human-attended browser (same profile) to pass the challenge once**: Create a separate browser instance with the same profile as the headless browser.", "3. **Keep gig copy offline (title, tags, packages, FAQ)**: Store the gig copy in a file or database before attempting to create the gig." ], "has_command_block": true, "actionable": true, "inline_code_count": 4, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Game MCP: GAME OVER Restart Flow (game-mcp-game-over-restart-flow)", "condition": "plain", "status": 200, "content": "To fix the error \"Game MCP: GAME OVER Restart Flow (game-mcp-game-over-restart-flow)\", I'll assume you're using Minecraft. Here's a step-by-step guide to resolve the issue:\n\n**Method 1: Using the Minecraft Launcher (Recommended)**\n\n1. Open the Minecraft launcher on your computer.\n2. Click on the \"View\" button next to the game you're playing.\n3. Click on \"Properties\".\n4. In the \"Properties\" window, click on the \"Edit\" button next to \"Launch Options\".\n5. Add the following command to the \"Launch Options\" field:\n\n```\n--game-mcp game-mcp-game-over-restart-flow\n```\n\n Replace `game-mcp-game-over-restart-flow` with the actual game ID you're experiencing issues with.\n\n6. Click \"OK\" to save the changes.\n7. Close the \"Properties\" window and click \"Play\" to launch the game.\n\n**Method 2: Using the Command Line (Alternative)**\n\n1. Open the Command Prompt or Terminal on your computer.\n2. Navigate to the directory where you installed Minecraft.\n3. Type the following command to launch the game with the custom game ID:\n\n```\njava -Xmx1024M -X", "metrics": { "length": 1039, "commands": 1, "command_list": [ "--game-mcp game-mcp-game-over-restart-flow" ], "has_command_block": true, "actionable": false, "inline_code_count": 3, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "game mcp rare relic freeze (game-mcp-rare-relic-freeze)", "condition": "with_lesson", "status": 200, "content": "To fix the error, you can follow these steps:\n\n1. **Avoid selecting rare relics**: Since the game client freezes when selecting rare relics, it's best to stick to common/standard relic options.\n\n2. **Manually send confirmation**: After selecting a rare relic, you can manually send the confirmation command using the `mcp` command. Here's an example:\n\n ```bash\nmcp \n```\n\n Replace `` with the ID of your game, and `` with the confirmation command:\n\n ```bash\nmcp confirm\n```\n\n This will send the confirmation message and allow the game to proceed.\n\nHere's the complete solution in a single command:\n\n```bash\nmcp confirm\n```\n\nIf you want to verify that the MCP is working correctly, you can use the following command:\n\n```bash\ngrep -i mcp lessons/contrib/mcp-.md 2/dev/null | head -3\necho MCP verified\n```\n\nThis command searches for the MCP verification in the specified file and prints the expected output.", "metrics": { "length": 969, "commands": 5, "command_list": [ "mcp ", "mcp confirm", "mcp confirm", "grep -i mcp lessons/contrib/mcp-.md 2/dev/null | head -3", "echo MCP verified" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "game mcp rare relic freeze (game-mcp-rare-relic-freeze)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely due to a Minecraft Forge mod conflict. Here's a step-by-step guide to resolve the issue:\n\n**Step 1: Update Minecraft Forge**\n\n1. Open your Minecraft launcher and select the game you're experiencing the issue with.\n2. Click on the \"Open Mods Folder\" button.\n3. Navigate to the `.minecraft/mods` folder (on Windows) or `~/.minecraft/mods` (on macOS/Linux).\n4. Delete the entire `.minecraft/mods` folder (including any existing files).\n5. Restart your Minecraft launcher.\n6. Install the latest version of Minecraft Forge from the official website.\n\n**Step 2: Update your mods**\n\n1. Open the Minecraft Forge mod manager (usually available in the Forge directory, e.g., `C:\\Users\\YourUsername\\.minecraft\\mods\\forge-1.18.2-32.1.6.2426.1\\bin\\modman.exe`).\n2. Select the `game-mcp-rare-relic-freeze` mod and click the \"Update\" button.\n3. Repeat this process for any other mods that may be causing conflicts.\n\n**Step 3: Disable mods**\n\n1. Open the Minecraft Forge mod manager (as described in", "metrics": { "length": 1023, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 5, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "GFW TLS SNI Block Pattern — Why Tool-Layer Solutions Fail (gfw-tls-sni-block-pattern)", "condition": "with_lesson", "status": 200, "content": "The issue you're facing is due to the GFW (Great Firewall of China) performing TLS SNI (Server Name Indication) sniffing, which blocks connections to certain domains. To bypass this block, you can use a tool that can bypass the network layer block. One such tool is `burp_suite`, which is a proxy-based tool that can intercept and manipulate HTTP requests.\n\nHere's a concrete, actionable fix with exact commands:\n\n**Step 1: Install Burp Suite**\n\nYou can download Burp Suite from the official website: https://portswigger.net/burp\n\n**Step 2: Configure Burp Suite**\n\n1. Launch Burp Suite and select \"Proxy\" as the tool.\n2. In the \"Proxy Settings\" section, select \"Manual\" as the protocol.\n3. In the \"Manual\" section, select \"HTTP\" as the protocol.\n4. In the \"HTTP\" section, select \"SNI bypass\" as the option.\n\n**Step 3: Use Burp Suite to scrape the domain**\n\n1. Launch Burp Suite and select the domain you want to scrape.\n2. In the \"Proxy\" section, select the domain you want to scrape.\n3. In the \"Request\" section, select the", "metrics": { "length": 1024, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 1, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "GFW TLS SNI Block Pattern — Why Tool-Layer Solutions Fail (gfw-tls-sni-block-pattern)", "condition": "plain", "status": 200, "content": "The GFW TLS SNI Block Pattern error typically occurs when your application tries to connect to a server that has a blocked SNI (Server Name Indication) record. This is a common issue when trying to connect to a server that uses SSL/TLS encryption.\n\nTo fix this issue, you can try the following steps:\n\n**Step 1: Update your SSL/TLS certificate**\n\nIf you're using a self-signed certificate or a certificate that's not trusted by the GFW (Great Firewall of China), you may need to update it to a trusted one.\n\n**Step 2: Use a VPN or proxy server**\n\nYou can try using a VPN or proxy server that bypasses the GFW's block. Here are some examples:\n\n* **TunnelBear VPN**: You can download the TunnelBear VPN app and create an account. Then, you can connect to their VPN server to bypass the GFW.\n* **ExpressVPN**: You can download the ExpressVPN app and create an account. Then, you can connect to their VPN server to bypass the GFW.\n* **Proxifier**: You can download the Proxifier software and configure it to use a proxy server that bypasses the GFW.\n\n**Step 3: Update your application's", "metrics": { "length": 1088, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Git Credentials 和 Node ID Setup (git-credentials-and-node-id-setup)", "condition": "with_lesson", "status": 200, "content": "解决 Git Credentials 和 Node ID Setup 错误的步骤如下:\n\n**步骤 1: 使用 gh CLI 认证**\n\n如果你使用的是 GitHub CLI,则可以使用 `github auth login` 命令进行凭证配置。\n\n```bash\n# 登录GitHub\ngithub auth login\n\n# 检查凭证是否正确\ngit config --list | grep -E \"user.(name|email)|credential\"\n```\n\n**步骤 2: 手动配置 credential helper**\n\n如果你不使用 GitHub CLI,则可以手动配置 credential helper。\n\n```bash\n# 保存凭证\ngit config --global credential.helper store\n\n# 设置用户名和Email\ngit config --global user.name \"Your Name\"\ngit config --global user.email \"your.email@example.com\"\n\n# 检查凭证是否正确\ngit config --list | grep -E \"user.(name|email)|credential\"\n```\n\n**步骤 3: 使用 PAT**\n\n如果你需要使用 PAT(Personal Access Token),则可以使用以下步骤:\n\n```bash\n# 设置 PAT\nPAT=\"your-PAT\"\n\n# 设置远程仓库 URL\ngit remote set-url origin https://:<", "metrics": { "length": 723, "commands": 6, "command_list": [ "github auth login", "git config --list | grep -E \"user.(name|email)|credential\"", "git config --global credential.helper store", "git config --global user.name \"Your Name\"", "git config --global user.email \"your.email@example.com\"" ], "has_command_block": true, "actionable": false, "inline_code_count": 5, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Git Credentials 和 Node ID Setup (git-credentials-and-node-id-setup)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely due to Git not being able to authenticate your credentials. To fix this, you'll need to set up your Git credentials and Node ID. Here are the steps:\n\n**Step 1: Set up Git Credentials**\n\n1. Open a terminal or command prompt.\n2. Run the following command to set up your Git credentials:\n ```bash\ngit config --global credential.helper store\n```\n This will store your credentials in a file on your local machine.\n\n3. Run the following command to test your credentials:\n ```bash\ngit config --global credential.helper store --get-token\n```\n This will prompt you to enter your username and password. Enter your credentials, and the command should succeed.\n\n**Step 2: Set up Node ID**\n\n1. Run the following command to set up your Node ID:\n ```bash\ngit config --global user.name \"Your Name\"\ngit config --global user.email \"your_email@example.com\"\n```\n Replace \"Your Name\" with your actual name and \"your_email@example.com\" with your actual email address.\n\n2. Run the following command to test your Node ID:\n ```bash\ngit config --global user.name\ngit config --global user.email\n```\n", "metrics": { "length": 1126, "commands": 6, "command_list": [ "git config --global credential.helper store", "git config --global credential.helper store --get-token", "git config --global user.name \"Your Name\"", "git config --global user.email \"your_email@example.com\"", "git config --global user.name" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Git Push 的正确方式 — 在受限 Agent 环境中推送代码 (git-push-without-shell-agent)", "condition": "with_lesson", "status": 200, "content": "解决 Git Push 在受限 Agent 环境中的错误:\n\n**方法一:YOLO task + gh CLI(推荐,已验证通过)**\n\n1. 在项目目录执行以下命令:\n ```bash\ntask_create(\n prompt=\"在项目目录执行... gh repo sync --branch main --force\",\n mode=\"yolo\",\n allow_shell=True,\n auto_approve=True,\n trust_mode=True, # 关键:跳过 shell 审批\n)\n```\n2. 或者使用以下命令:\n ```bash\ntask_create(\n prompt=\"在项目目录执行... git remote set-url origin https://--@github.com//.git\",\n mode=\"yolo\",\n allow_shell=True,\n auto_approve=True,\n trust_mode=True, # 关键:跳过 shell 审批\n)\n```\n 然后执行以下命令:\n ```bash\ngit push origin main\n```\n\n**方法二:YOLO task(无 trust_mode,慢但最终成功)**\n\n1. 确认工作目录中有多个仓库时,操作前必须验证:\n ```bash\ngit remote -v # 确认 remote", "metrics": { "length": 678, "commands": 15, "command_list": [ "task_create(", "prompt=\"在项目目录执行... gh repo sync --branch main --force\",", "mode=\"yolo\",", "allow_shell=True,", "auto_approve=True," ], "has_command_block": true, "actionable": false, "inline_code_count": 6, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Git Push 的正确方式 — 在受限 Agent 环境中推送代码 (git-push-without-shell-agent)", "condition": "plain", "status": 200, "content": "The error message \"git-push-without-shell-agent\" typically occurs when you're trying to push code to a Git repository using a Git client without a shell agent. Here's a concrete, actionable fix with exact commands:\n\n**Solution: Use `git push --mirror` or `git push --set-upstream`**\n\nYou can use one of the following commands to push your code without a shell agent:\n\n1. **Use `git push --mirror`**:\n\n```bash\ngit push --mirror origin \n```\n\nReplace `` with the name of the branch you want to push to.\n\n2. **Use `git push --set-upstream`**:\n\n```bash\ngit push -u origin \n```\n\nReplace `` with the name of the branch you want to push to.\n\n**What's happening behind the scenes?**\n\nWhen you use `git push --mirror` or `git push --set-upstream`, Git will:\n\n* Push all local branches to the remote repository\n* Set up the upstream tracking information for the specified branch\n\n**Why is this solution helpful?**\n\nThis solution is helpful when you're working in a restricted environment where shell access is limited or not allowed. By using `git", "metrics": { "length": 1092, "commands": 2, "command_list": [ "git push --mirror origin ", "git push -u origin " ], "has_command_block": true, "actionable": true, "inline_code_count": 12, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "git worktree commit lost after pushing from the wrong directory (git-worktree-dangling-commit-recovery)", "condition": "with_lesson", "status": 200, "content": "To fix the issue of a lost commit after pushing from the wrong directory, follow these steps:\n\n**Step 1: Identify the commit**\n\nUse `git fsck --lost-found` to list dangling commits:\n```bash\ngit fsck --lost-found\n```\nThis will show you a list of dangling objects, including commits. Look for a commit with a date or message that matches the work you were doing.\n\n**Step 2: Verify the commit**\n\nUse `git reflog --all` to show every HEAD movement, including detached-HEAD history:\n```bash\ngit reflog --all\n```\nThis will show you the commit history, including any detached HEADs.\n\n**Step 3: Re-attach the branch**\n\nUse `git branch ` to re-attach a branch to the recovered commit:\n```bash\ngit branch \n```\nReplace `` with the name of the branch you want to re-attach, and `` with the SHA of the recovered commit.\n\n**Step 4: Push from the correct worktree**\n\nPush from the correct worktree (or folder) to update the remote branch:\n```bash\ngit push origin \n", "metrics": { "length": 1025, "commands": 3, "command_list": [ "git fsck --lost-found", "git reflog --all", "git branch " ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "git worktree commit lost after pushing from the wrong directory (git-worktree-dangling-commit-recovery)", "condition": "plain", "status": 200, "content": "The \"git worktree commit lost after pushing from the wrong directory\" error typically occurs when you've pushed a commit from a specific worktree directory to the main branch, but the commit has become dangling because the worktree was not properly cleaned up.\n\nHere's a step-by-step solution to recover the lost commit:\n\n**Step 1: Identify the commit hash and the worktree directory**\n\n1. Run the following command to find the commit hash:\n```bash\ngit log -p --oneline --all --follow\n```\nThis command will show you a list of all commits, including the commit hash, in the current directory.\n\n2. Once you have the commit hash, you can use it to identify the worktree directory where the commit was created.\n\n**Step 2: Create a new branch from the main branch**\n\n1. Create a new branch from the main branch to work on the lost commit:\n```bash\ngit checkout -b lost-commit-branch main\n```\nThis will create a new branch called `lost-commit-branch` that is based on the `main` branch.\n\n**Step 3: Checkout the lost commit**\n\n1. Checkout the lost commit using its hash:\n```bash\ngit checkout \n```\nReplace `" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "GitHub API PR Submission Pitfalls (github-api-pr-submission-pitfalls)", "condition": "with_lesson", "status": 200, "content": "根据给出的问题和解决方案,以下是一份完整的解决方案:\n\n1. **Sync fork**:\n\n ```bash\ngh api repos/FORK/REPO/merge-upstream -X POST -f branch=main\n```\n\n2. **创建分支**:\n\n ```bash\nSHA=$(gh api repos/UPSTREAM/REPO/git/refs/heads/main --jq '.object.sha')\ngh api repos/FORK/REPO/git/refs -f ref=\"refs/heads/fix/xxx\" -f sha=\"$SHA\"\n```\n\n3. **获取文件 SHA、修改文件、PUT**:\n\n ```bash\nFILE_SHA=$(gh api \"repos/FORK/REPO/contents/PATH?ref=BRANCH\" --jq '.sha')\nENCODED=$(base64 -i file.py | tr -d '\\n')\n```\n\n4. **修改文件**:\n\n ```bash\necho -e \"\\n @pytest.mark.anyio\" > new.py\n```\n\n5. **检查 diff 干净度**:\n\n ```bash\ngh api \"repos/UPSTREAM/REPO/compare/main...FORK:BRANCH\" \\\n --jq '{ahead_by,", "metrics": { "length": 652, "commands": 6, "command_list": [ "gh api repos/FORK/REPO/merge-upstream -X POST -f branch=main", "SHA=$(gh api repos/UPSTREAM/REPO/git/refs/heads/main --jq '.object.sha')", "gh api repos/FORK/REPO/git/refs -f ref=\"refs/heads/fix/xxx\" -f sha=\"$SHA\"", "FILE_SHA=$(gh api \"repos/FORK/REPO/contents/PATH?ref=BRANCH\" --jq '.sha')", "ENCODED=$(base64 -i file.py | tr -d '\\n')" ], "has_command_block": true, "actionable": false, "inline_code_count": 8, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "GitHub API PR Submission Pitfalls (github-api-pr-submission-pitfalls)", "condition": "plain", "status": 200, "content": "The error you're experiencing is likely due to a missing or invalid personal access token in your GitHub API request. Here's a step-by-step guide to fix the issue:\n\n**Step 1: Create a new personal access token**\n\nOpen your GitHub profile page and navigate to your settings. Click on \"Developer settings\" and then click on \"Personal access tokens.\"\n\nClick on \"Generate new token\" and fill in the required information:\n\n* Token name: `github-api-pr-submission-pitfalls`\n* Token description: `API token for GitHub API PR submission`\n* Select `repo` scope\n* Select `read:org` scope\n* Select `write:org` scope\n* Select `delete:org` scope\n\nClick on \"Generate token.\"\n\n**Step 2: Store the personal access token securely**\n\nYou can store the token securely in an environment variable or a secrets manager like GitHub Secrets or Hashicorp Vault.\n\n**Step 3: Update your code with the personal access token**\n\nReplace the `PERSONAL_ACCESS_TOKEN` variable in your code with the actual token value.\n\nFor example, if you're using Python, you can update your code as follows:\n```python\nimport os\n\nPERSONAL_ACCESS_TOKEN = os.environ['PERSONAL_ACCESS_TOKEN']\n\n", "metrics": { "length": 1143, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "GitHub contents API edit fails with 422 without the file sha (github-contents-api-sha-required)", "condition": "plain", "status": 200, "content": "The error you're encountering, \"github-contents-api-sha-required\", is caused by the GitHub Contents API requiring a file SHA in the request body when editing a file. Here's a concrete, actionable fix with exact commands to resolve the issue:\n\n**Step 1: Update your `github-contents-api` credentials**\n\nIf you're using a personal access token, ensure it has the `repo` scope. If you're using a GitHub token, you can use the `repo` and `delete_repo` scopes.\n\n```bash\n# Update your GitHub token credentials\ngit config --global user.name \"Your Name\"\ngit config --global user.email \"your_email@example.com\"\n\n# If you're using a personal access token, add the following configuration\ngit config --global http.proxy \"https://your_token:your_token@example.com\"\n```\n\n**Step 2: Use the `--content` option with `git push`**\n\nTo update a file in the GitHub repository, use the `--content` option with `git push`. This will overwrite the existing file.\n\n```bash\n# Update a file in the repository\ngit push origin --content \n```\n\nReplace `` with the name of", "metrics": { "length": 1095, "commands": 4, "command_list": [ "git config --global user.name \"Your Name\"", "git config --global user.email \"your_email@example.com\"", "git config --global http.proxy \"https://your_token:your_token@example.com\"", "git push origin --content " ], "has_command_block": true, "actionable": true, "inline_code_count": 12, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "GitHub contents API edit fails with 422 without the file sha (github-contents-api-sha-required)", "condition": "with_lesson", "status": 200, "content": "To fix the error, you need to include the file SHA in the PUT request when updating an existing file. Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Create a function to fetch the current SHA**\n\nCreate a new file named `fetch_sha.py` with the following code:\n```python\nimport requests\n\ndef fetch_sha(owner, repo, path, ref=None):\n url = f\"https://api.github.com/repos/{owner}/{repo}/contents/{path}\"\n if ref:\n url += f\"?ref={ref}\"\n\n response = requests.get(url)\n response.raise_for_status()\n\n data = response.json()\n sha = data[\"content\"].split(\"base64\")[1].decode(\"base64\")\n return sha\n```\n**Step 2: Update the main script to use the `fetch_sha` function**\n\nUpdate your main script to use the `fetch_sha` function to fetch the current SHA before updating the file. Here's an example:\n```python\nimport requests\n\ndef update(path, content):\n owner = \"your-username\"\n repo = \"your-repo-name\"\n branch = \"main\" # or any other branch you want to use\n\n # Fetch the current SHA\n sha", "metrics": { "length": 1037, "commands": 2, "command_list": [ "**Step 2: Update the main script to use the `fetch_sha` function**", "Update your main script to use the `fetch_sha` function to fetch the current SHA before updating the file. Here's an example:" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "GitHub rate limiting hitting unauthenticated searches during automation (github-rate-limit-auth)", "condition": "with_lesson", "status": 200, "content": "To fix the GitHub rate limiting issue, you need to authenticate every API call by sending an authorization header with your token. Here's a concrete, actionable fix:\n\n**Step 1: Store your token securely**\n\nFirst, store your GitHub token securely using environment variables. This way, you won't have to hardcode it in your script or logs.\n\n```bash\n# Set the GitHub token as an environment variable\nexport GITHUB_TOKEN=\"your_github_token_here\"\n```\n\n**Step 2: Authenticate every API call**\n\nNow, modify your script to include an authorization header with the token on every request.\n\n```bash\n# Example using curl\ncurl -X GET \\\n https://api.github.com/search/issues \\\n -H 'Authorization: Bearer ${GITHUB_TOKEN}' \\\n -H 'Content-Type: application/json'\n```\n\nOr, if you're using Python:\n\n```python\nimport requests\n\ntoken = \"your_github_token_here\"\nheaders = {\n 'Authorization': f'Bearer {token}',\n 'Content-Type': 'application/json'\n}\n\nresponse = requests.get('https://api.github.com/search/issues', headers=headers)\n```\n\n**Step 3: Tune search call frequency**\n\nTo avoid hitting the rate limit, reduce the frequency of", "metrics": { "length": 1121, "commands": 5, "command_list": [ "export GITHUB_TOKEN=\"your_github_token_here\"", "curl -X GET \\", "https://api.github.com/search/issues \\", "-H 'Authorization: Bearer ${GITHUB_TOKEN}' \\", "-H 'Content-Type: application/json'" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Go dependency vuln bump blocked by wrong-architecture toolchain download (go-toolchain-vuln-bump-wrong-arch)", "condition": "plain", "status": 200, "content": "The error you're encountering is due to a mismatch between the architecture of your system and the architecture of the Go toolchain. Here's a step-by-step solution to resolve this issue:\n\n**Step 1: Identify the architecture of your system**\n\nTo identify the architecture of your system, run the following command:\n```bash\nuname -m\n```\nThis will output the architecture of your system, which should be one of the following:\n- `x86_64` (64-bit)\n- `amd64` (64-bit)\n- `arm64` (64-bit)\n- `arm` (32-bit)\n\n**Step 2: Update your `go.mod` file**\n\nTo fix the issue, you need to update your `go.mod` file to specify the correct architecture for your system. Run the following command:\n```bash\ngo mod tidy\n```\nThis will update your `go.mod` file with the correct architecture.\n\n**Step 3: Update the `go.mod` file manually**\n\nIf the above command doesn't update the `go.mod` file correctly, you can update it manually. Open your `go.mod` file in a text editor and update the `go.mod` file to specify the correct architecture. The format for specifying the architecture", "metrics": { "length": 1055, "commands": 2, "command_list": [ "uname -m", "go mod tidy" ], "has_command_block": true, "actionable": true, "inline_code_count": 14, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "GitHub rate limiting hitting unauthenticated searches during automation (github-rate-limit-auth)", "condition": "plain", "status": 200, "content": "The GitHub rate limiting error you're experiencing is due to the rate limit being triggered by unauthenticated searches during your automation process. To resolve this issue, you can use the `--no-auth-token` flag when making API requests to GitHub. Here's how you can do it:\n\n**Using `curl`**\n\n1. Open your terminal and navigate to the directory where your script is located.\n2. Run the following command to make a search request without authentication:\n```bash\ncurl -X GET \\\n https://api.github.com/search/repositories \\\n --user YOUR_GITHUB_USERNAME \\\n --no-auth-token \\\n -H 'Accept: application/vnd.github.v3+json'\n```\nReplace `YOUR_GITHUB_USERNAME` with your actual GitHub username.\n\n**Using `jq`**\n\nIf you're using `jq` to parse JSON responses, you can use the following command:\n```bash\ncurl -X GET \\\n https://api.github.com/search/repositories \\\n --user YOUR_GITHUB_USERNAME \\\n --no-auth-token \\\n -H 'Accept: application/vnd.github.v3+json' | jq '.data'\n```\nAgain, replace `YOUR_GITHUB_USERNAME` with your actual GitHub username.\n\n**Using `GitHub API Client Library`**\n\nIf", "metrics": { "length": 1087, "commands": 10, "command_list": [ "curl -X GET \\", "https://api.github.com/search/repositories \\", "--user YOUR_GITHUB_USERNAME \\", "--no-auth-token \\", "-H 'Accept: application/vnd.github.v3+json'" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "gpt sovits hubert 16khz (gpt-sovits-hubert-16khz)", "condition": "plain", "status": 200, "content": "The error message you're encountering suggests that there's a conflict between your current system settings and the settings you're trying to apply. Here's a step-by-step guide to resolve the issue:\n\n**Step 1: Check your current settings**\n\n1. Open your terminal and run the following command to check your current system settings:\n```bash\ncat /etc/default/grub\n```\nThis will display the current GRUB settings.\n\n**Step 2: Update the GRUB configuration**\n\n1. Run the following command to update the GRUB configuration:\n```bash\nsudo update-grub\n```\nThis will regenerate the GRUB configuration file based on your current system settings.\n\n**Step 3: Reboot your system**\n\n1. Reboot your system to apply the changes:\n```bash\nsudo reboot\n```\n**Step 4: Check if the issue persists**\n\n1. After rebooting, try running the command again:\n```bash\ngpt sovits hubert 16khz\n```\nIf the issue persists, you may need to investigate further to determine the cause of the conflict.\n\n**Alternative Solution:**\n\nIf the above steps don't resolve the issue, you can try the following alternative solution:\n\n1. Edit the GRUB configuration file directly:\n", "metrics": { "length": 1130, "commands": 4, "command_list": [ "cat /etc/default/grub", "sudo update-grub", "sudo reboot", "gpt sovits hubert 16khz" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Go dependency vuln bump blocked by wrong-architecture toolchain download (go-toolchain-vuln-bump-wrong-arch)", "condition": "with_lesson", "status": 200, "content": "To fix the error, you'll need to download the correct Go toolchain for your host architecture and add it to the PATH. Here are the exact steps:\n\n**Step 1: Confirm the host architecture**\n\nRun the following command to confirm the host architecture:\n```bash\nuname -m\n```\nThis should output `x86_64` or `amd64`, indicating that your host is an x86_64 machine.\n\n**Step 2: Download the matching tarball**\n\nDownload the matching Go toolchain tarball for your host architecture. For example, if your host is an x86_64 machine, you can download the following tarball:\n```bash\ngo1.24.5.darwin-amd64.tar.gz\n```\nYou can download this tarball from the official Go website.\n\n**Step 3: Extract and prepend to PATH**\n\nExtract the downloaded tarball to a temporary directory (`/tmp/gotool` in this example) and prepend the `go/bin` directory to the PATH:\n```bash\ntar -C /tmp/gotool -xzf go1.24.5.darwin-amd64.tar.gz\nexport PATH=/tmp/gotool/go/bin:$PATH\n```\n**Step 4:", "metrics": { "length": 950, "commands": 4, "command_list": [ "uname -m", "go1.24.5.darwin-amd64.tar.gz", "tar -C /tmp/gotool -xzf go1.24.5.darwin-amd64.tar.gz", "export PATH=/tmp/gotool/go/bin:$PATH" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "gpt sovits hubert 16khz (gpt-sovits-hubert-16khz)", "condition": "with_lesson", "status": 200, "content": "To fix the error, you need to modify your code to match the correct API flow and signature. Here's the corrected code:\n\n```bash\n# Import necessary libraries\nimport inf\n\n# Create a module instance\ncnhubert_mod = inf.cnhubert(\"gpt-sovits-hubert-16khz\")\n\n# Get a single CNHubert model instance\nhmodel = cnhubert_mod.get_model()\n\n# Load a 16kHz audio file using librosa\nimport librosa\nwav, sr = librosa.load(\"path_to_your_audio_file.wav\", sr=16000)\n\n# Get the content features using the model and audio tensor\nfeat = cnhubert_mod.get_content(hmodel, wav_tensor=wav)\n\n# Print the lesson information\necho \"Lesson: gpt sovits hubert 16khz\"\nwc -l lessons/contrib/gpt-sovits-hubert-16khz.md\n```\n\nNote that I've made the following changes:\n\n1. Created a module instance `cnhubert_mod` using the correct module name.\n2. Retrieved a single CNHubert model instance `hmodel` from the module instance.\n3. Loaded a 16kHz audio file using librosa, specifying", "metrics": { "length": 941, "commands": 8, "command_list": [ "import inf", "cnhubert_mod = inf.cnhubert(\"gpt-sovits-hubert-16khz\")", "hmodel = cnhubert_mod.get_model()", "import librosa", "wav, sr = librosa.load(\"path_to_your_audio_file.wav\", sr=16000)" ], "has_command_block": true, "actionable": false, "inline_code_count": 3, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "gpt sovits name2text arpabet (gpt-sovits-name2text-arpabet)", "condition": "with_lesson", "status": 200, "content": "To fix the error, you need to correct the formatting of the `name2text.txt` file. Here are the steps:\n\n1. Open the `name2text.txt` file in a text editor.\n2. Check each line and make sure the second column (after the tab character `\\t`) only contains ARPABET phonemes, separated by spaces. If there are any Chinese characters, remove them and replace them with the corresponding ARPABET phonemes.\n3. Save the corrected file.\n\nAlternatively, you can use the following command to correct the file:\n\n```bash\nawk -F'\\t' '{if ($2 ~ /^[a-zA-Z0-9 ]$/) {print $0; else {print $0 \" \" gsub(\"[^a-zA-Z0-9 ]\", \"\", $2)}}}' lessons/contrib/gpt-sovits-name2text-arpabet.txt > corrected_name2text.txt\n```\n\nThis command uses `awk` to iterate over each line in the file, and checks if the second column (`$2`) contains only letters, numbers, or spaces. If it does, the line is printed as is. If not, the Chinese characters are removed using `gsub`, and the line is printed with the corrected phon", "metrics": { "length": 976, "commands": 1, "command_list": [ "awk -F'\\t' '{if ($2 ~ /^[a-zA-Z0-9 ]$/) {print $0; else {print $0 \" \" gsub(\"[^a-zA-Z0-9 ]\", \"\", $2)}}}' lessons/contrib/gpt-sovits-name2text-arpabet.txt > corrected_name2text.txt" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "gpt sovits name2text arpabet (gpt-sovits-name2text-arpabet)", "condition": "plain", "status": 200, "content": "The error message you're seeing is likely due to a typo in the package name. Here's a step-by-step guide to fix it:\n\n**Fixing the Error:**\n\n1. **Update the package list**: Run the following command to ensure you have the latest package list:\n ```bash\nsudo apt update\n```\n2. **Install the package**: Try installing the package again using the corrected name:\n ```bash\nsudo apt install gpt-sovits-name2text-arpabet\n```\n If the package is not found, you can try searching for it using:\n ```bash\nsudo apt search gpt-sovits-name2text-arpabet\n```\n This command will display a list of packages that match the search query.\n\n3. **Check the package status**: If the package is not found, you can try checking the package status:\n ```bash\nsudo apt show gpt-sovits-name2text-arpabet\n```\n This command will display information about the package, including its status.\n\n4. **Install the package using pip**: If the package is not available in the official repository, you can try installing it using pip:\n ```bash\npip install gpt-sovits-name2text", "metrics": { "length": 1049, "commands": 4, "command_list": [ "sudo apt update", "sudo apt install gpt-sovits-name2text-arpabet", "sudo apt search gpt-sovits-name2text-arpabet", "sudo apt show gpt-sovits-name2text-arpabet" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "gpt sovits ref free bug (gpt-sovits-ref-free-bug)", "condition": "with_lesson", "status": 200, "content": "To fix the bug, we can modify the condition judgment in the `inference_webui.py` file. Here's a concrete and actionable fix with exact commands:\n\n**Step 1: Backup the original file**\n\n```bash\ncp inference_webui.py lessons/contrib/gpt-sovits-ref-free-bug.md\n```\n\n**Step 2: Edit the `inference_webui.py` file**\n\n```bash\nnano lessons/contrib/gpt-sovits-ref-free-bug.md\n```\n\n**Step 3: Modify the condition judgment**\n\nReplace the lines `if prompt_text is None or len(prompt_text) == 0:` with the following code:\n\n```python\nif prompt_text is None or len(prompt_text) == 0 and 'ref_free' not in locals():\n ref_free = True\n```\n\nThis modification ensures that `ref_free` is only set to `True` when `prompt_text` is empty and `ref_free` is not already defined.\n\n**Step 4: Save the changes**\n\nPress `Ctrl+X`, then `Y`, and finally `Enter` to save the changes.\n\n**Step 5: Verify the fix**\n\nRun the following command to verify that the fix has been applied:\n\n```bash\necho", "metrics": { "length": 962, "commands": 7, "command_list": [ "cp inference_webui.py lessons/contrib/gpt-sovits-ref-free-bug.md", "nano lessons/contrib/gpt-sovits-ref-free-bug.md", "This modification ensures that `ref_free` is only set to `True` when `prompt_text` is empty and `ref_free` is not already defined.", "**Step 4: Save the changes**", "Press `Ctrl+X`, then `Y`, and finally `Enter` to save the changes." ], "has_command_block": true, "actionable": true, "inline_code_count": 16, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "ccswitch-hermes-switch 踩坑Notes (hermes-model-switch-ccswitch)", "condition": "with_lesson", "status": 200, "content": "Based on the provided information, it seems like the issue is related to the configuration files and proxy channels used by Claude Code (cc) and Hermes Agent. Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Update configuration files**\n\nFirst, let's update the configuration files for both cc and Hermes Agent:\n\n1. Update the `~/.claude/settings.json` file (WSL side):\n```bash\necho \"{\n \\\"model\\\": \\\"InternalModel-2.5-pro\\\",\n \\\"provider\\\": \\\"internal\\\",\n \\\"base_url\\\": \\\"https://internalgateway.com\\\"}\" > ~/.claude/settings.json\n```\n2. Update the `` file (other side):\n```bash\necho \"{\n \\\"model\\\": \\\"InternalModel-2.5-pro\\\",\n \\\"provider\\\": \\\"internal\\\",\n \\\"base_url\\\": \\\"https://internalgateway.com\\\"}\" > \n```\nReplace `` with the actual path to the configuration file on the other side.\n\n**Step 2: Restart the proxy**\n\nNext, let's restart the proxy to apply the changes:\n```bash\n~/anthropic-openai-proxy.py --restart\n```\n**Step 3:", "metrics": { "length": 982, "commands": 9, "command_list": [ "echo \"{", "\\\"model\\\": \\\"InternalModel-2.5-pro\\\",", "\\\"provider\\\": \\\"internal\\\",", "\\\"base_url\\\": \\\"https://internalgateway.com\\\"}\" > ~/.claude/settings.json", "echo \"{" ], "has_command_block": true, "actionable": false, "inline_code_count": 8, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "gpt sovits ref free bug (gpt-sovits-ref-free-bug)", "condition": "plain", "status": 200, "content": "The error you're encountering, `gpt sovits ref free bug`, is likely related to an issue with the `gpt-sovits-ref-free` package. Here's a step-by-step guide to help you resolve the issue:\n\n**Fixing the gpt-sovits-ref-free bug**\n\n1. **Update the package list**:\n ```bash\nsudo apt update\n```\n This command updates the package list to ensure you have the latest information about available packages.\n\n2. **Upgrade all packages**:\n ```bash\nsudo apt full-upgrade\n```\n This command upgrades all installed packages, including `gpt-sovits-ref-free`, to the latest version.\n\n3. **Check if the package is available**:\n ```bash\nsudo apt install -f\n```\n This command checks if the package is available and if there are any missing dependencies.\n\n4. **Remove and reinstall the package**:\n ```bash\nsudo apt remove gpt-sovits-ref-free\nsudo apt install gpt-sovits-ref-free\n```\n This command removes the package and then reinstalls it to ensure that any issues are resolved.\n\n5. **Verify the package installation**:\n ```bash\ndpkg -", "metrics": { "length": 1031, "commands": 5, "command_list": [ "sudo apt update", "sudo apt full-upgrade", "sudo apt install -f", "sudo apt remove gpt-sovits-ref-free", "sudo apt install gpt-sovits-ref-free" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "ccswitch-hermes-switch 踩坑Notes (hermes-model-switch-ccswitch)", "condition": "plain", "status": 200, "content": "The error \"ccswitch-hermes-switch 踩坑Notes (hermes-model-switch-ccswitch)\" is not a standard error message and seems to be a mix of Chinese characters and a generic error message.\n\nHowever, I can provide you with a general solution to troubleshoot and fix common issues related to the Hermes model switch and Ccswitch.\n\nHere are the steps to troubleshoot and fix the issue:\n\n1. **Check the Hermes model switch documentation**: Ensure that you have the latest documentation for your Hermes model switch. You can check the official website of the manufacturer or search for online tutorials and guides.\n2. **Update the Hermes firmware**: Outdated firmware can cause issues with the switch. Check the manufacturer's website for firmware updates and follow their instructions to update the firmware.\n3. **Reset the Hermes model switch**: Sometimes, a simple reset can resolve the issue. Check the manufacturer's documentation for instructions on how to reset the switch.\n4. **Check the Ccswitch configuration**: Ensure that the Ccswitch configuration is correct and that all settings are properly configured.\n\nTo troubleshoot the issue, you can try the following commands:\n\n**For Linux:**\n\n```bash\n# Check the Hermes firmware version\nsudo apt-get install hermes-firmware", "metrics": { "length": 1265, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "JavaScript 执行链断裂:一个未捕获 TypeError 如何让整个页面静默失效 (js-dead-code-chain-break)", "condition": "plain", "status": 200, "content": "The error you're experiencing is due to a \"dead code chain break\" in JavaScript, which occurs when the JavaScript execution chain is interrupted by an unhandled error. Here's a concrete, actionable fix to help you resolve the issue:\n\n**Step 1: Enable JavaScript Console Logging**\n\nTo identify the source of the error, you need to enable JavaScript console logging on your website. You can do this by adding the following meta tag to your HTML file:\n\n```html\n\n\n\n```\n\n**Step 2: Add Error Handling to Your JavaScript Code**\n\nTo catch and handle errors, you need to add an error listener to your JavaScript code. You can do this by adding the following code to your JavaScript file:\n\n```javascript\nwindow.addEventListener('error', function(event) {\n console.error('Error occurred:', event);\n // Your custom error handling code here\n});\n```\n\n**Step 3: Use a JavaScript Error Handling Library**\n\nTo simplify error handling, you can use a JavaScript error handling library like `error-handler`.", "metrics": { "length": 1190, "commands": 2, "command_list": [ "**Step 2: Add Error Handling to Your JavaScript Code**", "To catch and handle errors, you need to add an error listener to your JavaScript code. You can do this by adding the following code to your JavaScript file:" ], "has_command_block": true, "actionable": true, "inline_code_count": 4, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "JavaScript 执行链断裂:一个未捕获 TypeError 如何让整个页面静默失效 (js-dead-code-chain-break)", "condition": "with_lesson", "status": 200, "content": "**修复JavaScript 执行链断裂:一个未捕获 TypeError**\n\n为了修复这个问题,我们需要遵循以下步骤:\n\n### 步骤 1:优先使用可选链操作符\n\n使用可选链操作符 (`?.`) 来防御性地访问可能为 null/undefined 的属性。\n\n```javascript\ndocument.getElementById('btn')?.addEventListener('click', handler);\n```\n\n### 步骤 2:将事件绑定放在 try/catch 中或包裹在 DOMContentLoaded 回调内\n\n将事件绑定放在 try/catch 中或包裹在 DOMContentLoaded 回调内,确保各自独立。\n\n```javascript\ndocument.addEventListener('DOMContentLoaded', function() {\n try {\n document.getElementById('btn')?.addEventListener('click', handler);\n } catch (error) {\n console.error(error);\n }\n});\n```\n\n### 步骤 3:全局错误监听\n\n全局错误监听可以让开发者知道出了问题。\n\n```javascript\nwindow.addEventListener('error', function(error) {\n console.error(error);\n});\n```\n\n### 步骤 4:删除或注释掉不再使用的 DOM 引用代码\n\n删除", "metrics": { "length": 708, "commands": 2, "command_list": [ "将事件绑定放在 try/catch 中或包裹在 DOMContentLoaded 回调内,确保各自独立。", "全局错误监听可以让开发者知道出了问题。" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Git Push to Fork Repo: ''Permission Denied to Other User'' — Wrong PAT Selected (lesson-06-git-push-credential-helper-403)", "condition": "plain", "status": 200, "content": "The error you're encountering is due to using the wrong Personal Access Token (PAT) when pushing to a fork repository on GitHub. Here's a step-by-step fix:\n\n**Step 1: Identify the correct PAT**\n\n* Go to your GitHub account settings.\n* Click on \"Developer settings\" (or \"Developer options\" in older versions).\n* Click on \"Personal access tokens\".\n* Find the PAT you used to authenticate with the wrong repository.\n* Note down the PAT ID and secret.\n\n**Step 2: Create a new PAT for the fork repository**\n\n* Go back to the Personal access tokens page.\n* Click on \"Generate new token\".\n* In the \"Token name\" field, enter a name like \"fork-repo-pat\".\n* In the \"Select scopes\" dropdown, select \"repo\".\n* In the \"Expire token\" field, select a time frame that suits your needs (e.g., \"Never\").\n* Click on \"Generate token\".\n\n**Step 3: Update your Git credentials**\n\n* Open a terminal or command prompt.\n* Run the following command to update your Git credentials with the new PAT:\n```bash\ngit config --global user.password \"your-new-pat-id:your-new-pat-secret\"\n```\nReplace `your", "metrics": { "length": 1068, "commands": 1, "command_list": [ "git config --global user.password \"your-new-pat-id:your-new-pat-secret\"" ], "has_command_block": true, "actionable": true, "inline_code_count": 2, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Git Push to Fork Repo: ''Permission Denied to Other User'' — Wrong PAT Selected (lesson-06-git-push-credential-helper-403)", "condition": "with_lesson", "status": 200, "content": "The error you're encountering occurs because Git is using the wrong Personal Access Token (PAT) from `~/.git-credentials` when pushing to a fork repository. Here's a step-by-step solution to resolve this issue:\n\n**Step 1: Identify the correct PAT**\n\nYou need to identify the correct PAT for the repository you're trying to push to. You can do this by checking the repository's settings on GitHub. Look for the \"Repository settings\" link on the left side menu and then click on \"Permissions.\" Find the \"Write\" permission for the correct account (the owner of the repository).\n\n**Step 2: Remove the incorrect PAT from `~/.git-credentials`**\n\nOpen `~/.git-credentials` in a text editor and remove the line that corresponds to the incorrect PAT. You can use a tool like `vim` or `nano` to edit the file.\n\n```bash\nvim ~/.git-credentials\n```\n\nRemove the line that starts with the incorrect PAT (e.g., `ikalus:@github.com`).\n\n**Step 3: Update `~/.git-credentials` with the correct PAT**\n\nAdd a new line to `~/.git-credentials` with the correct PAT for the repository you're trying to push to", "metrics": { "length": 1084, "commands": 1, "command_list": [ "vim ~/.git-credentials" ], "has_command_block": true, "actionable": false, "inline_code_count": 9, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Agent-Reach v1.5.0 doctor Baseline: 4/15 Channels Available Without Login (lesson-10-agent-reach-doctor-baseline)", "condition": "with_lesson", "status": 200, "content": "The error message indicates that the `yt-dlp` package is installed but not configured to use the Node.js runtime. To fix this, you need to configure `yt-dlp` to use Node.js. Here are the steps:\n\n1. Create a new directory for `yt-dlp` configuration if it doesn't exist:\n```bash\nmkdir -p ~/.config/yt-dlp\n```\n2. Check if the `yt-dlp` configuration file exists. If it doesn't, create it:\n```bash\ntouch ~/.config/yt-dlp/config\n```\n3. Open the `yt-dlp` configuration file in a text editor and add the following line to the end of the file:\n```bash\n--js-runtimes node\n```\nThis line tells `yt-dlp` to use Node.js as the JavaScript runtime.\n\n4. Save the changes to the `yt-dlp` configuration file.\n\nAfter completing these steps, you should see the following output when running `agent-reach doctor`:\n```\nAgent Reach 状态\n========================================\n图例:✅ 可用 [!] 已装但需配置/登录 [X] 未安装\n\n✅ 装好即用:\n ✅ GitHub 仓库", "metrics": { "length": 906, "commands": 3, "command_list": [ "mkdir -p ~/.config/yt-dlp", "touch ~/.config/yt-dlp/config", "--js-runtimes node" ], "has_command_block": true, "actionable": true, "inline_code_count": 13, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Agent-Reach v1.5.0 doctor Baseline: 4/15 Channels Available Without Login (lesson-10-agent-reach-doctor-baseline)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely due to a missing or incorrect configuration in your Agent-Reach environment. Here's a step-by-step guide to resolve the issue:\n\n**Fix 1: Update Agent-Reach Configuration**\n\n1. Open a terminal or command prompt.\n2. Navigate to the Agent-Reach configuration directory (usually `~/.agent-reach` or `C:\\Users\\\\.agent-reach`).\n3. Run the following command to update the configuration:\n ```bash\nagent-reach config update\n```\n This command will apply any available updates to the configuration.\n\n**Fix 2: Set Channel Availability**\n\n1. Open a terminal or command prompt.\n2. Run the following command to set the channel availability:\n ```bash\nagent-reach config set channel_availability 15\n```\n This command will set the available channels to 15, which should resolve the error.\n\n**Fix 3: Run the Doctor Baseline Command**\n\n1. Open a terminal or command prompt.\n2. Run the following command to re-run the doctor baseline:\n ```bash\nagent-reach doctor baseline\n```\n This command will re-run the doctor baseline and update the configuration.\n\n**Verify the Fix**\n\n1. After running", "metrics": { "length": 1134, "commands": 3, "command_list": [ "agent-reach config update", "agent-reach config set channel_availability 15", "agent-reach doctor baseline" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "AWS Lambda MicroVMs — 隔离沙箱与 Firecracker (lesson-13-aws-lambda-microvms)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely due to a missing or outdated Firecracker package. Firecracker is a virtualization platform used by AWS Lambda MicroVMs. Here's a step-by-step guide to resolve the issue:\n\n**Fix:**\n\n1. **Update your AWS CLI**: Ensure your AWS CLI is up-to-date. Run the following command:\n\n```bash\naws --version\n```\n\nIf you're using an older version, update it using:\n\n```bash\naws upgrade\n```\n\n2. **Update your package list**: Run the following command to update your package list:\n\n```bash\nsudo apt update\n```\n\nThis command will update the package list for your system.\n\n3. **Install the Firecracker package**: Install the Firecracker package using the following command:\n\n```bash\nsudo apt-get install firecracker\n```\n\nIf you're using a newer version of Ubuntu (20.04 or later), use the following command instead:\n\n```bash\nsudo apt-get install firecracker-system\n```\n\n4. **Verify Firecracker installation**: Run the following command to verify that Firecracker is installed correctly:\n\n```bash\nfirecracker --version\n```\n\nYou should see the version number of Firecracker printed in the", "metrics": { "length": 1107, "commands": 6, "command_list": [ "aws --version", "aws upgrade", "sudo apt update", "sudo apt-get install firecracker", "sudo apt-get install firecracker-system" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "AWS Lambda MicroVMs — 隔离沙箱与 Firecracker (lesson-13-aws-lambda-microvms)", "condition": "with_lesson", "status": 200, "content": "The error message you're experiencing is likely due to the fact that the `MicroVM` feature is not enabled by default for AWS Lambda functions. To fix this, you need to enable `MicroVM` for your function.\n\nHere are the steps to enable `MicroVM` for your Lambda function:\n\n1. Open the AWS Management Console and navigate to the Lambda dashboard.\n2. Select the function that you want to enable `MicroVM` for.\n3. Click on the \"Configuration\" tab.\n4. Scroll down to the \"Advanced\" section.\n5. Click on the \"Edit\" button next to \"Execution role\".\n6. In the \"Execution role\" section, click on the \"Add inline policy\" button.\n7. In the \"Add inline policy\" dialog box, enter the following policy JSON:\n```json\n{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Effect\": \"Allow\",\n \"Action\": \"firecracker:CreateMicroVM\",\n \"Resource\": \"*\"\n }\n ]\n}\n```\n8. Click on the \"Review changes\" button.\n9. Click on the \"Save changes\" button.\n\nAlternatively, you can also enable `MicroVM` using the AWS CLI", "metrics": { "length": 1004, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 6, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "gRPC vs OpenAPI vs REST — API 协议选择指南 (lesson-19-grpc-openapi-rest-comparison)", "condition": "with_lesson", "status": 200, "content": "The error you're experiencing seems to be related to the documentation provided in the lesson. Here are some concrete, actionable fixes with exact commands to troubleshoot and resolve the issue:\n\n1. **Check the HTTP version**: Ensure that the HTTP version used in the `GET` request is correct. You can check the HTTP version by running the following command:\n\n```bash\ncurl -v http://example.com/api/users/123\n```\n\nIf the HTTP version is not HTTP/1.1, update the `Accept` header to use the correct version.\n\n2. **Verify the gRPC-Web library**: If you're using gRPC with the gRPC-Web library, ensure that it's properly installed and configured. You can check the installation by running the following command:\n\n```bash\npip install --upgrade grpcio grpcio-tools\n```\n\nIf you're using a virtual environment, activate it before running the command.\n\n3. **Check the protobuf syntax**: Ensure that the protobuf syntax is correct. You can check the syntax by running the following command:\n\n```bash\nprotoc --version\n```\n\nIf the syntax is not correct, update the protobuf syntax to match the example provided in the lesson.\n\n4. **Verify the OpenAPI schema**: Ensure that the Open", "metrics": { "length": 1169, "commands": 3, "command_list": [ "curl -v http://example.com/api/users/123", "pip install --upgrade grpcio grpcio-tools", "protoc --version" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "gRPC vs OpenAPI vs REST — API 协议选择指南 (lesson-19-grpc-openapi-rest-comparison)", "condition": "plain", "status": 200, "content": "The error you're experiencing is likely due to a missing import or a syntax error in your gRPC code. However, since you're comparing gRPC, OpenAPI, and REST APIs, I'll provide a general solution for setting up a gRPC service with OpenAPI support.\n\n**Step 1: Install the required dependencies**\n\nYou'll need to install the following dependencies:\n\n* `protoc` for compiling the gRPC protocol buffer definitions\n* `protoc-gen-grpc` for generating the gRPC stub code\n* `protoc-gen-openapiv2` for generating OpenAPI definitions\n* `grpc` for running the gRPC service\n\nRun the following commands:\n\n```bash\n# Install protoc\nsudo apt-get update && sudo apt-get install -y libprotoc-dev libprotobuf-dev\n\n# Install protoc-gen-grpc and protoc-gen-openapiv2\ngo get -u github.com/golang/protobuf/protoc-gen-go\ngo get -u github.com/golang/protobuf/protoc-gen-go-grpc\ngo get -u github.com/golang/protobuf/protoc-gen-openapiv2\ngo get -u google.golang.org/grpc/cmd/protoc-gen-grpc\n\n# Install grpc\ngo get", "metrics": { "length": 985, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 4, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "API 设计原则 — 无抽象、一致性、幂等性 (lesson-20-api-design-principles)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely due to a missing or incorrect import statement for the `@Api` annotation in your Spring Boot application. Here's a concrete, actionable fix with exact commands:\n\n**Error:**\n\n`java: cannot find symbol`\n\n**Fix:**\n\n1. Open your `pom.xml` file (if you're using Maven) or your `build.gradle` file (if you're using Gradle).\n2. Add the following dependency to your project:\n\nMaven:\n```xml\n\n io.springfox\n springfox-boot-starter\n\n```\n\nGradle:\n```groovy\ndependencies {\n implementation 'io.springfox:springfox-boot-starter:3.0.0'\n}\n```\n\n3. Wait for the dependency to be downloaded and updated in your project.\n4. If you're still encountering issues, ensure that your Spring Boot application is properly configured to include the `@Api` annotation.\n\n**Example:**\n\nSuppose you have a controller class with the following code:\n```java\nimport io.swagger.v3.oas.annotations.Operation;\nimport io.swagger.v3.oas.annotations.media.Content;\nimport io.swagger.v3.oas.annotations.media.Schema", "metrics": { "length": 1089, "commands": 5, "command_list": [ "Gradle:", "3. Wait for the dependency to be downloaded and updated in your project.", "4. If you're still encountering issues, ensure that your Spring Boot application is properly configured to include the `@Api` annotation.", "**Example:**", "Suppose you have a controller class with the following code:" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "DevOps Platform Engineering — Golden Paths to Reduce Cognitive Load (lesson-review-3-devops-platform-engineering)", "condition": "with_lesson", "status": 200, "content": "To reduce cognitive load and implement a Platform Engineering with Golden Paths approach, we'll create an Internal Developer Platform (IDP) and set up a pre-configured template for CI/CD, monitoring, and logging. Here's a step-by-step guide:\n\n**Step 1: Create a new GitHub repository for your IDP**\n\nCreate a new repository on GitHub and name it after your organization or project.\n\n```bash\nmkdir my-idp\ncd my-idp\ngit init\ngit add .\ngit commit -m \"Initial commit for my IDP\"\n```\n\n**Step 2: Install the required tools and actions**\n\nInstall the required tools and actions using the following commands:\n\n```bash\n# Install Docker\nsudo apt update\nsudo apt install docker.io -y\n\n# Install Git\nsudo apt update\nsudo apt install git -y\n\n# Install GitHub Actions\nsudo apt update\nsudo apt install git -y\n```\n\n**Step 3: Create a new workflow file for the Golden Path**\n\nCreate a new file named `.github/workflows/golden-path.yml` in your IDP repository with the following content:\n\n```yaml\nname: Golden Path CI/CD\non: [push, pull_request]\n\njobs:\n build:\n runs-on", "metrics": { "length": 1055, "commands": 11, "command_list": [ "mkdir my-idp", "cd my-idp", "git init", "git add .", "git commit -m \"Initial commit for my IDP\"" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "API 设计原则 — 无抽象、一致性、幂等性 (lesson-20-api-design-principles)", "condition": "with_lesson", "status": 200, "content": "根据问题描述,API 设计不一致导致开发者困惑。因此,我们需要根据给出的解决方案,进行具体的改进。\n\n以下是具体的改进步骤:\n\n1. **无抽象(No Abstractions)**\n\n首先,我们需要将 POST /api/v1/actions 改为 POST /api/v1/users,直接创建用户。\n\n```bash\n# 移动文件\nmv api/v1/actions/api/v1/actions.py api/v1/users/\n\n# 更新代码\ntouch api/v1/users/users.py\n```\n\n2. **一致性**\n\n所有资源使用相同模式:\n\n- GET /api/v1/{resource} -> 列表\n- POST /api/v1/{resource} -> 创建\n- GET /api/v1/{resource}/{id} -> 获取\n- PATCH /api/v1/{resource}/{id} -> 更新\n- DELETE /api/v1/{resource}/{id} -> 删除\n\n```bash\n# 重写 API routes\ntouch api/routes.py\n```\n\n```python\nfrom flask import Flask, request, jsonify\nfrom flask_restful import Api, Resource\n\napp = Flask(__name__)\napi = Api(app)\n\nclass User(Resource):\n def get(self, id):\n", "metrics": { "length": 687, "commands": 3, "command_list": [ "mv api/v1/actions/api/v1/actions.py api/v1/users/", "touch api/v1/users/users.py", "touch api/routes.py" ], "has_command_block": true, "actionable": false, "inline_code_count": 3, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "DevOps Platform Engineering — Golden Paths to Reduce Cognitive Load (lesson-review-3-devops-platform-engineering)", "condition": "plain", "status": 200, "content": "I don't see any error message provided. However, I can guide you through a common issue that might be related to the topic of DevOps Platform Engineering.\n\nLet's assume the issue is related to a deployment or a configuration problem. Here's a step-by-step guide to troubleshoot and fix a common issue:\n\n**Issue:** Deployment failed due to a configuration mismatch.\n\n**Symptoms:** The deployment fails with an error message indicating a configuration mismatch between the source code and the target environment.\n\n**Actionable Fix:**\n\n1. **Check the Git repository**: Ensure that the Git repository is up-to-date and that the latest changes are being pulled.\n\n ```bash\n git pull origin main\n ```\n\n2. **Verify the configuration files**: Check the configuration files (e.g., `docker-compose.yml`, `kubernetes.yaml`) for any typos or incorrect settings.\n\n ```bash\n cat docker-compose.yml\n cat kubernetes.yaml\n ```\n\n3. **Check the Docker images**: Verify that the Docker images are up-to-date and correctly tagged.\n\n ```bash\n docker images\n docker tag /\n ```\n\n4. **Check the Kubernetes manifests**: Verify that the Kubernetes manifests are correctly", "metrics": { "length": 1200, "commands": 5, "command_list": [ "git pull origin main", "cat docker-compose.yml", "cat kubernetes.yaml", "docker images", "docker tag /" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Cloudflare AI Traffic Options — Content Monetization for the Agentic Internet (lesson-review-8-cloudflare-ai-traffic-options)", "condition": "with_lesson", "status": 200, "content": "Based on the provided lesson, the issue seems to be related to the payment for the crawls via the x402 protocol. Here's a step-by-step fix with exact commands:\n\n**Step 1: Verify the API Token**\n\nBefore proceeding, ensure that you have a valid API token. You can generate a new token in the Cloudflare dashboard:\n\n1. Log in to your Cloudflare account.\n2. Go to the \"Account\" tab and click on \"API Tokens\".\n3. Click on \"Generate\" to create a new token.\n4. Copy the token and store it securely.\n\n**Step 2: Block AI Bots**\n\nTo block AI bots, you can use the following command:\n\n```bash\ncurl -X POST \"https://api.cloudflare.com/client/v4/zones/{zone_id}/ai-crawl\" \\\n -H \"Authorization: Bearer {token}\" \\\n -d '{\n \"action\": \"block_ai_bots\"\n }'\n```\n\nReplace `{zone_id}` with your actual Cloudflare zone ID and `{token}` with the API token you generated earlier.\n\n**Step 3: Enable Pay-Per-Crawl**\n\nTo enable pay-per-crawl, you need to configure the `pay_per_crawl` action in", "metrics": { "length": 971, "commands": 5, "command_list": [ "curl -X POST \"https://api.cloudflare.com/client/v4/zones/{zone_id}/ai-crawl\" \\", "-H \"Authorization: Bearer {token}\" \\", "-d '{", "\"action\": \"block_ai_bots\"", "}'" ], "has_command_block": true, "actionable": true, "inline_code_count": 4, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "lessons md fix heading block type (lessons-md-fix-heading-block-type)", "condition": "with_lesson", "status": 200, "content": "To fix the error \"lessons md fix heading block type\", you need to update the heading blocks to use the correct block type. Here are the steps:\n\n1. Open the `lessons-md-fix-heading-block-type.md` file in your text editor.\n2. Search for the following lines:\n```\n---\ntype: 4\n---\n```\n```\n---\ntype: 5\n---\n```\n```\n---\ntype: 6\n---\n```\n3. Replace each line with the correct block type, for example:\n```\n---\ntype: 4\nheading1: 'Heading 1'\n---\n```\n```\n---\ntype: 5\nheading2: 'Heading 2'\n---\n```\n```\n---\ntype: 6\nheading3: 'Heading 3'\n---\n```\n4. Save the changes to the file.\n\nYou can also use the following command to update the file:\n```\nsed -i 's/type: 4/type: 4 heading1: \"Heading 1\"/g' lessons/contrib/lessons-md-fix-heading-block-type.md\nsed -i 's/type: 5/type: 5 heading2: \"Heading 2\"/g' lessons/contrib/lessons-md-fix-heading-block-type.md\nsed", "metrics": { "length": 837, "commands": 21, "command_list": [ "---", "type: 4", "---", "---", "type: 5" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "lessons md fix heading block type (lessons-md-fix-heading-block-type)", "condition": "plain", "status": 200, "content": "The error message \"lessons md fix heading block type (lessons-md-fix-heading-block-type)\" typically indicates that there is a heading block type mismatch in your Markdown file.\n\nTo fix this, you can use the following commands in your terminal:\n\n1. Open your Markdown file in a text editor.\n2. Use the following command to fix the heading block type:\n```\ngit rm -f --cached .\ngit add .\ngit commit -m \"Fix heading block type\"\n```\nOr, if you are using a code editor with Git integration, you can simply click on the \"Fix\" button next to the error message.\n\nAlternatively, you can also use the following command to fix the heading block type automatically:\n```\nyarn fix:lessons-md-fix-heading-block-type\n```\nor\n```\nnpm run lessons-md-fix-heading-block-type\n```\nThis command will fix the heading block type for you.\n\nNote: Make sure you have the `lessons-md-fix-heading-block-type` script installed in your project by running `yarn add lessons-md-fix-heading-block-type` or `npm install lessons-md-fix-heading-block-type`", "metrics": { "length": 1016, "commands": 5, "command_list": [ "git rm -f --cached .", "git add .", "git commit -m \"Fix heading block type\"", "yarn fix:lessons-md-fix-heading-block-type", "npm run lessons-md-fix-heading-block-type" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Cloudflare AI Traffic Options — Content Monetization for the Agentic Internet (lesson-review-8-cloudflare-ai-traffic-options)", "condition": "plain", "status": 200, "content": "I don't see any error message provided. However, I'll provide a general solution for the Cloudflare AI Traffic Options error. If you provide the exact error message, I can give you a more specific solution.\n\nThat being said, the Cloudflare AI Traffic Options error is often related to the Cloudflare AI Traffic Options not being enabled or the incorrect configuration. Here are some steps you can take to troubleshoot and fix the issue:\n\n1. Check if Cloudflare AI Traffic Options is enabled:\n\n Log in to your Cloudflare account and go to the \"AI\" tab. Make sure that Cloudflare AI Traffic Options is enabled.\n\n2. Check your content monetization settings:\n\n Go to the \"Content Monetization\" tab and ensure that your content monetization settings are correct. You should have the \"Allow AI traffic\" option enabled.\n\n3. Check your Cloudflare dashboard for any errors:\n\n Go to the \"Dashboard\" tab and check for any errors or warnings related to Cloudflare AI Traffic Options.\n\n4. Try disabling and re-enabling Cloudflare AI Traffic Options:\n\n Go to the \"AI\" tab and disable Cloudflare AI Traffic Options. Wait for a few minutes and then re-enable it.\n\n5. Check for any updates to the Cloudflare dashboard", "metrics": { "length": 1208, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "macOS Homebrew Python: pip install Blocked by PEP 668 externally-managed-environment (macos-homebrew-python-pip-install-blocked-by-pep-668-externa)", "condition": "with_lesson", "status": 200, "content": "To resolve the issue of pip being blocked by PEP 668 on macOS with Homebrew Python, you can follow these steps:\n\n**Step 1: Verify the marker file**\n\nRun the following command to check if the EXTERNALLY-MANAGED marker file exists:\n```bash\npython3 -c \"import sysconfig; print(sysconfig.get_paths()['stdlib'])\"\n```\nThis should print the path to the `stdlib` directory. Look for the `externally-managed-environment` file in that directory.\n\n**Step 2: Install Python packages using a virtual environment**\n\nCreate a new virtual environment and activate it:\n```bash\npython3 -m venv .venv\nsource .venv/bin/activate\n```\nThen, install the package using pip:\n```bash\npip install pyyaml\n```\nThis will install the package in the virtual environment, which is not system-wide and should not be affected by the EXTERNALLY-MANAGED marker file.\n\n**Step 3: Install system-wide packages using Homebrew**\n\nIf you need to install system-wide packages, you can use Homebrew to install them. Run the following command to install the package:\n```bash\nbrew install pyyaml\n```\nThis will install the package system-wide", "metrics": { "length": 1093, "commands": 5, "command_list": [ "python3 -c \"import sysconfig; print(sysconfig.get_paths()['stdlib'])\"", "python3 -m venv .venv", "source .venv/bin/activate", "pip install pyyaml", "brew install pyyaml" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "macOS Homebrew Python: pip install Blocked by PEP 668 externally-managed-environment (macos-homebrew-python-pip-install-blocked-by-pep-668-externa)", "condition": "plain", "status": 200, "content": "The error you're encountering is due to a change in pip's behavior, which was introduced in PEP 668. This change blocks installations from environments that are not managed by pip itself. Here's a concrete, actionable fix:\n\n**Step 1: Uninstall Homebrew's Python**\n\n```bash\nbrew uninstall python\n```\n\n**Step 2: Reinstall Homebrew's Python**\n\n```bash\nbrew install python\n```\n\n**Step 3: Install pip using Homebrew's Python**\n\n```bash\npython -m ensurepip\n```\n\nThis command will install pip using Homebrew's Python.\n\n**Step 4: Verify pip installation**\n\n```bash\npip --version\n```\n\nThis command should print the version of pip installed by Homebrew.\n\n**Step 5: Install packages**\n\n```bash\npip install \n```\n\nReplace `` with the name of the package you want to install.\n\nAlternatively, if you want to avoid reinstalling pip, you can try to resolve the issue by running the following commands:\n\n```bash\nbrew link python --force\npip install --upgrade pip\n```\n\nHowever, the first method is generally recommended as it ensures that pip is installed correctly and is compatible with Homebrew's Python.", "metrics": { "length": 1116, "commands": 7, "command_list": [ "brew uninstall python", "brew install python", "python -m ensurepip", "pip --version", "pip install " ], "has_command_block": true, "actionable": true, "inline_code_count": 12, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Паттерны тестирования MCP серверов — прямой вызов обработчика (mcp-server-testing-patterns-ru)", "condition": "plain", "status": 200, "content": "Unfortunately, I don't see any code provided, but I can guide you on how to approach this error.\n\nThe error \"Паттерны тестирования MCP.SERVERов — прямой вызов обработчика\" translates to \"Testing patterns for MCP Servers - direct call to handler\" in Russian.\n\nThis error typically occurs when there's a direct call to a handler in a test, which can lead to unexpected behavior.\n\nHere's a concrete, actionable fix with exact commands:\n\n1. **Check your test code**: Review your test code to identify any direct calls to handlers. Look for methods that call other methods directly without any intermediate steps.\n\n2. **Use dependency injection**: If you're using a framework that supports dependency injection, use it to provide the dependencies to your handlers. This will make your code more testable and reduce the likelihood of direct calls.\n\n3. **Use mock objects**: If you can't avoid direct calls, use mock objects to isolate the dependencies and make your tests more reliable.\n\n4. **Use a testing framework**: Consider using a testing framework that provides built-in support for mocking and dependency injection, such as Mockito or Moq.\n\nHere's an example of how you can use Mockito to mock a dependency:\n\nLet's say you have a handler that depends", "metrics": { "length": 1252, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Паттерны тестирования MCP серверов — прямой вызов обработчика (mcp-server-testing-patterns-ru)", "condition": "with_lesson", "status": 200, "content": "Here's a concrete, actionable fix with exact commands to resolve the error.\n\n**Step 1: Create a new file for the rpc function**\n\nCreate a new file named `rpc.py` and add the following code:\n\n```python\nfrom scripts.mcp_server import handle_request\n\ndef rpc(method: str, params: dict = None) -> dict:\n \"\"\"Отправить JSON-RPC запрос обработчику напрямую.\"\"\"\n return handle_request({\n \"jsonrpc\": \"2.0\",\n \"id\": 1,\n \"method\": method,\n \"params\": params or {}\n })\n```\n\n**Step 2: Import the rpc function in your test file**\n\nOpen your test file (e.g., `test_mcp_server.py`) and import the `rpc` function:\n\n```python\nfrom rpc import rpc\n```\n\n**Step 3: Write a test for the rpc function**\n\nAdd the following test code to your test file:\n\n```python\nimport unittest\nimport json\n\nclass TestMCPServer(unittest.TestCase):\n def test_rpc(self):\n result = rpc(\"tools/call\", {\n \"name\": \"misakanet.search\",\n \"arguments\": {\"query\": \"database locked\", \"limit\": 3}\n ", "metrics": { "length": 1016, "commands": 4, "command_list": [ "**Step 2: Import the rpc function in your test file**", "Open your test file (e.g., `test_mcp_server.py`) and import the `rpc` function:", "**Step 3: Write a test for the rpc function**", "Add the following test code to your test file:" ], "has_command_block": true, "actionable": false, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "mergeable_state blocked does not mean failing CI (mergeable-state-blocked-not-red-ci)", "condition": "with_lesson", "status": 200, "content": "To fix the error and understand why your pull request is blocked, follow these steps:\n\n1. Check the mergeable_state: \n - Run the command `curl -X GET 'https://api.github.com/repos/{owner}/{repo}/pulls/{pull_number}/mergeable'` to get the mergeable_state.\n\n2. Check the check-runs:\n - Run the command `curl -X GET 'https://api.github.com/repos/{owner}/{repo}/commits/{commit_hash}/check-runs'` to get the check-runs for the specific commit hash.\n\n3. Enumerate all checks:\n - Run the command `curl -X GET 'https://api.github.com/repos/{owner}/{repo}/commits/{commit_hash}/check-runs'` and look for the \"status\" field to see if any checks have failed.\n\n4. Fix the check-runs:\n - If a check has failed, fix the issue and re-run the check.\n\nHere's an example of how you can use these commands in a shell script:\n\n```bash\n#!/bin/bash\n\n# Replace with your owner and repository name\nOWNER=\"your-owner\"\nREPO=\"your-repo\"\n\n# Replace with the pull request number\nPULL_NUMBER=123", "metrics": { "length": 974, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 3, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "mergeable_state blocked does not mean failing CI (mergeable-state-blocked-not-red-ci)", "condition": "plain", "status": 200, "content": "The error you're encountering, \"mergeable_state blocked does not mean failing CI (mergeable-state-blocked-not-red-ci),\" typically occurs when you're trying to merge a branch into the main branch (usually `main` or `master`) in a Git repository, but the merge is blocked due to a specific configuration setting in your Git configuration.\n\nTo resolve this issue, you can try the following steps:\n\n1. Check your Git configuration:\n\n Run the following command in your terminal to check your Git configuration:\n\n ```bash\ngit config --list\n```\n\n Look for the following lines in your configuration:\n\n ```\nmerge.mergemanagement\nmerge.rebase\n```\n\n If you find any lines that start with `merge.mergemanagement` or `merge.rebase`, you'll need to adjust them.\n\n2. Update your Git configuration:\n\n To unblock the merge, you can try the following commands:\n\n ```bash\ngit config --unset merge.mergemanagement\ngit config --unset merge.rebase\n```\n\n If you want to keep these settings, you can modify them to suit your needs.\n\n3. Try to merge the branch again:\n\n Once you've updated your Git configuration, try to merge the branch again:\n\n ", "metrics": { "length": 1141, "commands": 5, "command_list": [ "git config --list", "merge.mergemanagement", "merge.rebase", "git config --unset merge.mergemanagement", "git config --unset merge.rebase" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "MisakaNet --heal Engine Bootstrap Workflow (misakanet-heal-engine-bootstrap-workflow)", "condition": "with_lesson", "status": 200, "content": "To fix the issue of the lack of documentation for the 5-step bootstrap workflow in MisakaNet's search_knowledge.py, we can create a new lesson that explains the full workflow. Here's a step-by-step guide to create this lesson:\n\n**Create a new lesson**\n\nCreate a new file `search_knowledge.md` in the `docs` directory of your MisakaNet repository. This file will serve as the new lesson explaining the bootstrap workflow.\n\n**Write the lesson**\n\nAdd the following content to the `search_knowledge.md` file:\n\n---\n\n**MisakaNet --heal Engine Bootstrap Workflow**\n\nThis is the end-to-end error triage pipeline that turns a CLI fatal error into a search against the swarm's shared lesson corpus. The workflow consists of 5 steps:\n\n### Step 1: Signature Extraction\n\n* **Purpose:** Extract all error signatures from the traceback, error message, and exit code.\n* **Process:**\n * `traceback →` extract the traceback lines.\n * `error signature →` extract the error signature from the traceback lines.\n * `exit code →` extract the exit code from the error message.\n * `last N lines →` extract the last N lines of the error", "metrics": { "length": 1134, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "MisakaNet --heal Engine Bootstrap Workflow (misakanet-heal-engine-bootstrap-workflow)", "condition": "plain", "status": 200, "content": "The error message you're seeing is likely due to a missing or incorrect `--heal` flag in your `MisakaNet` command.\n\nTo fix this, you need to specify the `--heal` flag along with the engine and workflow you want to use. Here's a concrete, actionable fix:\n\n1. Open your terminal and navigate to the directory where you're running the `MisakaNet` command.\n2. Check if you have the `MisakaNet` command installed and up-to-date. You can do this by running the following command:\n ```bash\nmiskanet --version\n```\n If you don't have the `MisakaNet` command installed, you can install it using your package manager or by downloading the binary from the official website.\n\n3. If you have the `MisakaNet` command installed, try running the following command to fix the error:\n ```bash\nmiskanet --heal Engine Bootstrap Workflow\n```\n If this command still doesn't work, you might need to specify the engine and workflow separately:\n ```bash\nmiskanet --heal Engine --workflow Bootstrap Workflow\n```\n Replace `Engine` and `Bootstrap Workflow` with the actual engine and workflow", "metrics": { "length": 1075, "commands": 3, "command_list": [ "miskanet --version", "miskanet --heal Engine Bootstrap Workflow", "miskanet --heal Engine --workflow Bootstrap Workflow" ], "has_command_block": true, "actionable": true, "inline_code_count": 14, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "misakanet refactor v2 review (misakanet-refactor-v2-review)", "condition": "with_lesson", "status": 200, "content": "Based on the provided lesson, it appears that the misakanet-refactor-v2-review.md file is not being updated correctly. Here's a concrete, actionable fix with exact commands to update the file:\n\n```bash\necho \"Lesson: misakanet refactor v2 review\n (line count)\" > lessons/contrib/misakanet-refactor-v2-review.md\n```\n\nHowever, this will create a new file instead of updating the existing one. To update the existing file, you can use the following command:\n\n```bash\necho \"Lesson: misakanet refactor v2 review\n (line count)\" >> lessons/contrib/misakanet-refactor-v2-review.md\n```\n\nThis will append the new content to the end of the existing file.\n\nIf you want to update the line count, you can use the following command:\n\n```bash\nwc -l lessons/contrib/misakanet-refactor-v2-review.md > lessons/contrib/misakanet-refactor-v2-review.md\n```\n\nHowever, this will overwrite the existing file. To append the new line count to the end of the existing file, you can use the following command:\n\n```bash\nwc -l lessons/contrib/misakanet-refactor-v2-review.md", "metrics": { "length": 1042, "commands": 5, "command_list": [ "echo \"Lesson: misakanet refactor v2 review", "(line count)\" > lessons/contrib/misakanet-refactor-v2-review.md", "echo \"Lesson: misakanet refactor v2 review", "(line count)\" >> lessons/contrib/misakanet-refactor-v2-review.md", "wc -l lessons/contrib/misakanet-refactor-v2-review.md > lessons/contrib/misakanet-refactor-v2-review.md" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "misakanet refactor v2 review (misakanet-refactor-v2-review)", "condition": "plain", "status": 200, "content": "The error message suggests that there's a problem with the `misakanet-refactor-v2-review` repository. Without more context, it's difficult to provide a precise solution. However, I can offer some general steps to troubleshoot and potentially fix the issue.\n\nHere are some possible causes and solutions:\n\n1. **Incorrect repository URL**:\n\n If the repository URL is incorrect, it can cause the review to fail.\n\n Solution:\n\n Check the repository URL in your `git config` settings or the `review` configuration file. Make sure it's correct.\n\n ```bash\ngit config --get remote.origin.url\n```\n\n If the URL is incorrect, update it using:\n\n ```bash\ngit remote set-url origin \n```\n\n2. **Incorrect branch or commit hash**:\n\n If the branch or commit hash is incorrect, it can cause the review to fail.\n\n Solution:\n\n Check the branch and commit hash in your `review` configuration file or the `git config` settings.\n\n ```bash\ngit config --get branch.review\n```\n\n ```bash\ngit config --get remote.origin.refspecs\n```\n\n If the branch or commit hash is incorrect, update it using:\n\n ```bash\ngit checkout <", "metrics": { "length": 1127, "commands": 4, "command_list": [ "git config --get remote.origin.url", "git remote set-url origin ", "git config --get branch.review", "git config --get remote.origin.refspecs" ], "has_command_block": true, "actionable": true, "inline_code_count": 13, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "多模型Switch脚本模式 — 双 Agent 模型管理 (model-switch-script-pattern)", "condition": "with_lesson", "status": 200, "content": "The error message you're encountering suggests that there's an issue with model-switching scripts for two agents, A and B. To resolve this, you'll need to create separate scripts for each agent and configure them to manage their respective models, proxies, and configurations.\n\nHere's a step-by-step guide to fixing the issue:\n\n**Step 1: Create a new script for Agent A**\n\nCreate a new file named `switch-agent-a.sh` in the desired location (e.g., `~/switch-agent-a`):\n\n```bash\n#!/bin/bash\n\n# Update Agent A's configuration file\necho \"Updating Agent A's configuration file...\"\nsed -i 's/model-x/model-y/g' ~/agent-a/config.yaml\n\n# Sync configuration to cross-platform paths\necho \"Syncing configuration to cross-platform paths...\"\ncp ~/agent-a/config.yaml ~/agent-b/config.yaml\n\n# Restart local proxy with new upstream\necho \"Restarting local proxy with new upstream...\"\nsystemctl restart proxy-server\n```\n\nMake the script executable:\n\n```bash\nchmod +x ~/switch-agent-a.sh\n```\n\n**Step 2: Create a new script for Agent B**\n\nCreate a new file named `switch-agent-b.sh` in the desired location (e.g., `~/switch-agent", "metrics": { "length": 1111, "commands": 7, "command_list": [ "echo \"Updating Agent A's configuration file...\"", "sed -i 's/model-x/model-y/g' ~/agent-a/config.yaml", "echo \"Syncing configuration to cross-platform paths...\"", "cp ~/agent-a/config.yaml ~/agent-b/config.yaml", "echo \"Restarting local proxy with new upstream...\"" ], "has_command_block": true, "actionable": false, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "多模型Switch脚本模式 — 双 Agent 模型管理 (model-switch-script-pattern)", "condition": "plain", "status": 200, "content": "The error message \"多模型Switch脚本模式 — 双 Agent 模型管理 (model-switch-script-pattern)\" is a translation of the error message \"Multi-model Switch Script Pattern - Dual Agent Model Management\" in English.\n\nThis error typically occurs when you're trying to use a multi-model script pattern with dual agents in a specific context, such as in a machine learning or data science pipeline. To fix this error, you'll need to adjust your script or configuration to ensure that it's compatible with the dual agent model management.\n\nHere's a concrete, actionable fix with exact commands:\n\n**Assuming you're using TensorFlow and Keras**\n\n1. Check your script for the following lines:\n ```python\nfrom tensorflow.keras.layers import Input, Dense\nfrom tensorflow.keras.models import Model\n```\n If you see these lines, replace them with the following code:\n ```python\nfrom tensorflow.keras.layers import Input, Dense\nfrom tensorflow.keras.models import Model, Sequential\n```\n This change will ensure that your script uses the Sequential API, which is compatible with dual agent model management.\n\n2. Check your model architecture for the following lines:\n ```python\nmodel.add(Dense(64, activation='relu'))\nmodel.add(Dense(32, activation='relu'))\nmodel", "metrics": { "length": 1238, "commands": 3, "command_list": [ "If you see these lines, replace them with the following code:", "This change will ensure that your script uses the Sequential API, which is compatible with dual agent model management.", "2. Check your model architecture for the following lines:" ], "has_command_block": true, "actionable": true, "inline_code_count": 4, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "npm install failing on one host but not another (native build arch mismatch) (npm-native-build-arch-mismatch)", "condition": "with_lesson", "status": 200, "content": "To fix the \"native build arch mismatch\" error, follow these steps:\n\n**Step 1: Pin the Node version in CI**\n\nUpdate your `package.json` file with the following configuration:\n\n```json\n{\n \"engines\": {\n \"node\": \">=14.17.0\"\n }\n}\n```\n\n**Step 2: Add native build prerequisites as a CI step**\n\nCreate a new file named `.github/workflows/install.yml` in the root of your repository with the following content:\n\n```yaml\nname: Install\n\non:\n push:\n branches:\n - main\n\njobs:\n install:\n runs-on: ubuntu-latest\n steps:\n - name: Setup Node.js\n uses: actions/setup-node@v2\n with:\n node-version: '14.17.0'\n\n - name: Install dependencies\n run: npm ci\n```\n\n**Step 3: Set the prebuild registry explicitly**\n\nRun the following command in your CI workflow:\n\n```bash\nnpm_config_build_from_source=false npm ci\n```\n\nYou can add this command as a step before the `npm ci` step in your `.github/workflows/install.yml` file:\n\n```yaml\n - name: Set prebuild", "metrics": { "length": 993, "commands": 5, "command_list": [ "**Step 2: Add native build prerequisites as a CI step**", "Create a new file named `.github/workflows/install.yml` in the root of your repository with the following content:", "**Step 3: Set the prebuild registry explicitly**", "Run the following command in your CI workflow:", "You can add this command as a step before the `npm ci` step in your `.github/workflows/install.yml` file:" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Playwright Chromium launch fails on WSL2 with missing libnss3 / libnspr4 (openclaw-playwright-wsl-libnss3-libnspr4-snap-chromium)", "condition": "with_lesson", "status": 200, "content": "To fix the issue, you need to install the `libnss3` and `libnspr4` packages on your WSL2 Ubuntu 24.04 image. Here are the steps:\n\n**Method 1: Using `apt` with `sudo`**\n\n1. Open a terminal in your WSL2 Ubuntu 24.04 image.\n2. Run the following command to install the `libnss3` and `libnspr4` packages using `apt` with `sudo`:\n```bash\nsudo apt update\nsudo apt install -y libnss3 libnspr4\n```\n3. Once the installation is complete, you can try running your Playwright script again.\n\n**Method 2: Using `apt` without `sudo` (for Ubuntu 24.04 minimal images)**\n\n1. Open a terminal in your WSL2 Ubuntu 24.04 image.\n2. Run the following command to install the `libnss3` and `libnspr4` packages using `apt` without `sudo`:\n```bash\napt update\napt install -y libnss3 libnspr4\n```\n3. Note that this method may not work for all Ubuntu 24.04 minimal", "metrics": { "length": 833, "commands": 4, "command_list": [ "sudo apt update", "sudo apt install -y libnss3 libnspr4", "apt update", "apt install -y libnss3 libnspr4" ], "has_command_block": true, "actionable": true, "inline_code_count": 16, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Opire Bounty 实战经验 — 认领、收款与信任分级 (opire-bounty-hunting)", "condition": "plain", "status": 200, "content": "I'm happy to help you with the error, but I don't see any error message provided. The text you provided seems to be a title of a tutorial or a topic, but it doesn't contain any error message.\n\nCould you please provide the actual error message you're encountering? This will allow me to provide a more accurate and actionable fix.\n\nOnce you provide the error message, I'll do my best to assist you in resolving the issue.", "metrics": { "length": 420, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "npm install failing on one host but not another (native build arch mismatch) (npm-native-build-arch-mismatch)", "condition": "plain", "status": 200, "content": "The \"native build arch mismatch\" error occurs when the architecture of the operating system (OS) and the architecture of the package being installed do not match. Here's a concrete, actionable fix with exact commands to resolve this issue:\n\n**Step 1: Check the OS architecture**\n\nRun the following command to check the architecture of your OS:\n```bash\nlscpu\n```\nor\n```bash\nuname -m\n```\nThis will display the architecture of your OS.\n\n**Step 2: Check the package architecture**\n\nRun the following command to check the architecture of the package being installed:\n```bash\nnpm ls \n```\nReplace `` with the actual name of the package you're trying to install.\n\nThis will display the architecture of the package.\n\n**Step 3: Install the package with the correct architecture**\n\nIf the package architecture does not match the OS architecture, you'll need to install the package with the correct architecture. Here are the steps:\n\n**For x86_64 (64-bit) OS**\n\n* If your OS is x86_64, you can install the package with the x86_64 architecture using the following command:\n```bash\nnpm install --arch=x86_64\n``", "metrics": { "length": 1139, "commands": 3, "command_list": [ "lscpu", "uname -m", "npm ls " ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Playwright Chromium launch fails on WSL2 with missing libnss3 / libnspr4 (openclaw-playwright-wsl-libnss3-libnspr4-snap-chromium)", "condition": "plain", "status": 200, "content": "The error you're experiencing is due to missing dependencies required by Playwright Chromium on WSL2. Here's a step-by-step guide to resolve the issue:\n\n**Step 1: Install the necessary dependencies**\n\nYou'll need to install `libnss3` and `libnspr4` packages using the following command:\n\n```bash\nsudo apt-get update\nsudo apt-get install -y libnss3 libnspr4\n```\n\n**Step 2: Install the chromium browser**\n\nYou'll also need to install the Chromium browser, which is required by Playwright Chromium. You can install it using the following command:\n\n```bash\nsudo apt-get install -y chromium-browser\n```\n\n**Step 3: Install the Playwright Chromium browser**\n\nNow, you need to install the Playwright Chromium browser. You can do this by running the following command:\n\n```bash\nsudo snap install playwright --classic\n```\n\nThis command will install Playwright Chromium using the `snap` package manager.\n\n**Step 4: Verify the installation**\n\nAfter installing the dependencies and Playwright Chromium, you can verify that everything is working correctly by running the following command:\n\n```bash\nplaywright launch --headless --no-sandbox --default-browser-chromium\n```\n\n", "metrics": { "length": 1159, "commands": 5, "command_list": [ "sudo apt-get update", "sudo apt-get install -y libnss3 libnspr4", "sudo apt-get install -y chromium-browser", "sudo snap install playwright --classic", "playwright launch --headless --no-sandbox --default-browser-chromium" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "حل مشكلة استنفاد تجميع اتصالات قاعدة البيانات PostgreSQL في بيئات الإنتاج (postgresql-connection-pool-exhaustion-ar)", "condition": "with_lesson", "status": 200, "content": "To fix the issue of PostgreSQL connection pool exhaustion in production environments, you need to address two main causes:\n\n1. **Connection Leaks**: Ensure that all database connections are properly closed and released back to the pool after use.\n2. **Pool Limits**: Set a reasonable maximum number of connections allowed in the pool.\n\nHere's a concrete, actionable fix with exact commands:\n\n### Step 1: Modify Database Connection Code to Ensure Connection Closure\n\nUpdate your database connection code to close connections properly using a `finally` block:\n\n```javascript\nconst { Pool } = require('pg');\n\nconst pool = new Pool({\n host: 'your_host',\n user: 'your_user',\n password: 'your_password',\n database: 'your_database',\n});\n\n// Example usage with a try-catch block\nasync function executeQuery(queryString) {\n try {\n const result = await pool.query(queryString);\n return result.rows;\n } catch (error) {\n console.error('Error:', error);\n } finally {\n // Close the connection to release it back to the pool\n await pool.end();\n }\n}\n\n// Call the function\nexecuteQuery('SELECT * FROM your_table');\n```\n\n### Step 2: Set a Reasonable Maximum Number", "metrics": { "length": 1171, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 2, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Opire Bounty 实战经验 — 认领、收款与信任分级 (opire-bounty-hunting)", "condition": "with_lesson", "status": 200, "content": "The issue lies in the fact that the `jq` command is not handling the case where the API response is empty. When there are no tasks available, the `length` function will return 0, but the `jq` command is expecting a non-zero value.\n\nTo fix this, you can modify the `jq` command to check if the length is greater than or equal to 0, and only then print \"Verification passed\". Here's the updated command:\n\n```bash\ncurl -s \"https://api.opire.dev/rewards?page=1&limit=5\" | jq 'length > 0' && echo \"Verification passed: Opire API reachable, rewards listed\"\n```\n\nThis command will check if the length of the JSON array is greater than 0, and only if it is, will it print \"Verification passed\".\n\nAlternatively, you can use the following command, which will print \"Verification passed\" regardless of the length of the JSON array:\n\n```bash\ncurl -s \"https://api.opire.dev/rewards?page=1&limit=5\" | jq 'length' && echo \"Verification passed: Opire API reachable, rewards listed\"\n```\n\nHowever, this command will print the length of the JSON array, which might not", "metrics": { "length": 1049, "commands": 2, "command_list": [ "curl -s \"https://api.opire.dev/rewards?page=1&limit=5\" | jq 'length > 0' && echo \"Verification passed: Opire API reachable, rewards listed\"", "curl -s \"https://api.opire.dev/rewards?page=1&limit=5\" | jq 'length' && echo \"Verification passed: Opire API reachable, rewards listed\"" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "External PR Strategy via pr-genius (pr-strategy)", "condition": "with_lesson", "status": 200, "content": "It seems like the issue is with the `wc -l` command not being able to count the lines in the `lessons/contrib/pr-strategy.md` file. This could be due to various reasons such as the file being empty, or the file not being in the correct location.\n\nHere's a concrete, actionable fix with exact commands:\n\n1. Check if the file exists and is not empty:\n ```bash\nls lessons/contrib/pr-strategy.md\n```\n If the file does not exist or is empty, create it.\n\n2. If the file exists but is empty, create it with a placeholder message:\n ```bash\ntouch lessons/contrib/pr-strategy.md\necho \"Lesson: External PR Strategy via pr-genius\" > lessons/contrib/pr-strategy.md\n```\n\n3. If the file exists but is not empty, try running the `wc -l` command again:\n ```bash\nwc -l lessons/contrib/pr-strategy.md\n```\n\nHowever, if the file is not empty and still not being counted, there might be an issue with the permissions or the file's ownership.\n\nHere is a more robust solution that checks the file's existence and permissions before running `wc -l`:\n```bash\nif", "metrics": { "length": 1043, "commands": 4, "command_list": [ "ls lessons/contrib/pr-strategy.md", "touch lessons/contrib/pr-strategy.md", "echo \"Lesson: External PR Strategy via pr-genius\" > lessons/contrib/pr-strategy.md", "wc -l lessons/contrib/pr-strategy.md" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "حل مشكلة استنفاد تجميع اتصالات قاعدة البيانات PostgreSQL في بيئات الإنتاج (postgresql-connection-pool-exhaustion-ar)", "condition": "plain", "status": 200, "content": "The error you're experiencing, `postgresql-connection-pool-exhaustion-ar`, occurs when the connection pool in PostgreSQL is exhausted, meaning that all available connections are being used up. This can happen due to a variety of reasons such as a high volume of concurrent connections, inefficient query optimization, or inadequate connection pool settings.\n\nHere's a concrete, actionable fix with exact commands to resolve this issue:\n\n### 1. Increase the Connection Pool Size\n\nIncrease the connection pool size to ensure there are enough connections available for your application to use.\n\n```sql\nALTER SYSTEM SET shared_buffers TO 1024MB;\nALTER SYSTEM SET effective_cache_size TO 512MB;\nALTER SYSTEM SET work_mem TO 16MB;\nALTER SYSTEM SET maintenance_work_mem TO 64MB;\nALTER SYSTEM SET max_connections TO 1000;\n```\n\n### 2. Adjust the Idle Connection Timeout\n\nAdjust the idle connection timeout to ensure connections are released back to the pool when not in use.\n\n```sql\nALTER SYSTEM SET idle_in_transaction_session_timeout TO 300; # 5 minutes\nALTER SYSTEM SET idle_in_transaction_session_timeout_max TO 300; # 5 minutes\nALTER SYSTEM SET idle_in_transaction_session_timeout_min TO 10; # 10 seconds\n```\n\n", "metrics": { "length": 1209, "commands": 1, "command_list": [ "Adjust the idle connection timeout to ensure connections are released back to the pool when not in use." ], "has_command_block": true, "actionable": true, "inline_code_count": 4, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "External PR Strategy via pr-genius (pr-strategy)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely due to a missing or incorrect configuration in your `pr-genius.yml` file. Here's a step-by-step guide to fix the issue:\n\n**Step 1: Update your `pr-genius.yml` file**\n\nOpen your `pr-genius.yml` file in a text editor and update the `strategy` section to include the `name` and `url` properties:\n```yml\npr-genius:\n strategy:\n name: pr-strategy\n url: https://github.com/pr-genius/pr-genius\n```\n**Step 2: Add the `token` property (optional)**\n\nIf you're using GitHub Personal Access Tokens, you need to add the `token` property to authenticate with the `pr-genius` API:\n```yml\npr-genius:\n strategy:\n name: pr-strategy\n url: https://github.com/pr-genius/pr-genius\n token: YOUR_GITHUB_TOKEN_HERE\n```\nReplace `YOUR_GITHUB_TOKEN_HERE` with your actual GitHub Personal Access Token.\n\n**Step 3: Save and restart your workflow**\n\nSave the updated `pr-genius.yml` file and restart your GitHub Actions workflow. You can do this by clicking the \"", "metrics": { "length": 988, "commands": 2, "command_list": [ "**Step 2: Add the `token` property (optional)**", "If you're using GitHub Personal Access Tokens, you need to add the `token` property to authenticate with the `pr-genius` API:" ], "has_command_block": true, "actionable": false, "inline_code_count": 14, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "The Private Agent Memory Fallacy — Why Portable Memory Wallets Fail (private-agent-memory-fallacy)", "condition": "plain", "status": 200, "content": "The Private Agent Memory Fallacy is a common issue in cryptography and programming, where a private key is stored in memory and then used to sign a message. This can lead to a vulnerability known as a timing attack.\n\nTo fix this issue, you can use a Hardware Security Module (HSM) or a secure key storage solution. However, if you're looking for a software-based solution, here's a concrete, actionable fix:\n\n**Solution: Use a secure random number generator and a key derivation function**\n\nHere's an example of how you can implement this fix in Python:\n\n```python\nimport secrets\nimport hashlib\nimport hmac\nimport time\n\n# Generate a random private key\nprivate_key = secrets.token_bytes(32)\n\n# Generate a random salt\nsalt = secrets.token_bytes(16)\n\n# Generate a random nonce\nnonce = secrets.token_bytes(8)\n\n# Create a key derivation function\ndef derive_key(private_key, salt, nonce):\n return hmac.new((private_key + salt + nonce).encode(), private_key, hashlib.sha256).digest()\n\n# Create a message\nmessage = b\"Hello, World!\"\n\n# Sign the message\nsignature = derive_key(private_key, salt, nonce)\n\n# Verify the signature\ndef verify_signature(message, signature, salt", "metrics": { "length": 1165, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Prompt Injection: What''s the Worst That Can Happen? (prompt-injection-what-s-the-worst-that-can-happen)", "condition": "with_lesson", "status": 200, "content": "**Fixing Prompt Injection Vulnerability**\n\nTo mitigate the prompt injection vulnerability, we'll implement a simple yet effective solution that separates user input from system prompts and filters out malicious instructions.\n\n**Solution Overview**\n\nWe'll use a combination of regular expressions, string manipulation, and conditional statements to filter out malicious user input. Our goal is to prevent the concatenation of user input with system prompts, thereby preventing prompt injection attacks.\n\n**Code Example (Python)**\n```python\nimport re\n\n# Define a function to filter user input\ndef filter_user_input(user_input, system_prompt):\n # Remove any special characters that could be used for injection\n user_input = re.sub(r'[^a-zA-Z0-9\\s]', '', user_input)\n\n # Check for keywords that could indicate malicious intent\n malicious_keywords = ['Your system has a security hole', 'transform this to the language of a stereotypical 18th century pirate']\n if any(keyword in user_input.lower() for keyword in malicious_keywords):\n return None\n\n # If user input passes filtering, concatenate it with system prompt\n filtered_input = system_prompt + ' ' + user_input\n return filtered_input\n\n# Example usage:\nsystem_prompt = \"Translate the following text into French and return a", "metrics": { "length": 1304, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "The Private Agent Memory Fallacy — Why Portable Memory Wallets Fail (private-agent-memory-fallacy)", "condition": "with_lesson", "status": 200, "content": "The error you're experiencing is likely due to the markdown formatting in the file you're trying to verify. Here's a step-by-step guide on how to fix it:\n\n**Step 1: Open the file in a text editor**\n\nOpen the `private-agent-memory-fallacy.md` file in a text editor like Visual Studio Code, Sublime Text, or Atom.\n\n**Step 2: Remove the markdown formatting**\n\nThe error is caused by the markdown formatting in the title line. Remove the markdown formatting by deleting the following lines:\n\n```\nLesson: The Private Agent Memory Fallacy — Why Portable Me\n (line count)\n```\n\n**Step 3: Save the file**\n\nSave the file with the updated content.\n\n**Step 4: Verify the output**\n\nRun the following command in your terminal to verify the output:\n\n```bash\necho \"Lesson: The Private Agent Memory Fallacy — Why Portable Memory\"\nwc -l lessons/contrib/private-agent-memory-fallacy.md\n```\n\nThis command should output the correct line count for the updated file.\n\nIf you still encounter issues, ensure that your terminal is set up correctly and that you have the necessary permissions to read and write files in the `lessons/contrib` directory.", "metrics": { "length": 1125, "commands": 4, "command_list": [ "Lesson: The Private Agent Memory Fallacy — Why Portable Me", "(line count)", "echo \"Lesson: The Private Agent Memory Fallacy — Why Portable Memory\"", "wc -l lessons/contrib/private-agent-memory-fallacy.md" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "工艺卡步序提取:辅助动作不算独立步序,按工艺动作分界 (process-card-sequence-extraction-rules)", "condition": "with_lesson", "status": 200, "content": "Based on the error message and the provided verified lesson, it seems that the issue is related to the extraction of process card sequence from a Time Chart. The error message indicates that auxiliary actions are not being treated as independent steps, but rather are being included in the previous step's time.\n\nTo fix this issue, you can try the following steps:\n\n1. Review your Time Chart and identify the auxiliary actions that are not being treated as independent steps.\n2. Modify your Time Chart to include these auxiliary actions as separate steps.\n3. Use the \"辅助动作归入下一个工艺动作的步序\" rule to group the auxiliary actions with the previous step's action.\n\nHere is an example of how you can modify your Time Chart using the `fanuc` command-line tool:\n\n```bash\n# Define the Time Chart\ntime_chart=\"1s ┐ 2s ┐ 3s ┐ 4s ┐ 5s ┐ 6s ┐ 7s ┐\"\n\n# Use the \"辅助动作归入下一个工艺动作的步序\" rule\ntime_chart=$(echo \"$time_chart\" | sed -e 's/ ┐/ 1s/ 2s/ ", "metrics": { "length": 922, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 1, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Prompt Injection: What''s the Worst That Can Happen? (prompt-injection-what-s-the-worst-that-can-happen)", "condition": "plain", "status": 200, "content": "The error you're encountering is a result of a prompt injection vulnerability in your program. Prompt injection attacks occur when an attacker injects malicious input into a program's input prompt, potentially leading to code execution or other security breaches.\n\nTo fix this issue, you'll need to validate and sanitize all user input, especially those that are intended to be used as prompts. Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Update your package.json file**\n\nOpen your project's `package.json` file and update the `scripts` section to include a script that validates and sanitizes user input:\n```json\n\"scripts\": {\n \"start\": \"node index.js\",\n \"validate-input\": \"node validate-input.js\"\n}\n```\n**Step 2: Create a validate-input.js file**\n\nCreate a new file named `validate-input.js` in the root of your project:\n```javascript\nconst readline = require('readline');\n\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout\n});\n\nrl.question('What is the user input? ', (input) => {\n const sanitizedInput = sanitizeInput(input);\n console.log(`Sanitized input: ${sanitizedInput}`);\n rl.close();\n});\n\nfunction sanitize", "metrics": { "length": 1180, "commands": 2, "command_list": [ "**Step 2: Create a validate-input.js file**", "Create a new file named `validate-input.js` in the root of your project:" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "RAG Brand Filter Three Pitfalls (rag-brand-filter-three-pitfalls)", "condition": "plain", "status": 200, "content": "I'd be happy to help you resolve the issue. However, I don't see any error message or code provided. Could you please provide more context or details about the error you're experiencing, such as:\n\n* The programming language you're using\n* The relevant code snippet that's causing the error\n* Any error messages you're seeing\n\nOnce I have this information, I'll do my best to provide a concrete and actionable fix with exact commands.", "metrics": { "length": 433, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "工艺卡步序提取:辅助动作不算独立步序,按工艺动作分界 (process-card-sequence-extraction-rules)", "condition": "plain", "status": 200, "content": "To fix the error, you can use the following commands to update the process card sequence extraction rules:\n\n**Note:** These commands are for the Alfresco process modeler. Please adjust them according to your specific version or tool.\n\n**Update process card sequence extraction rules:**\n\n1. Open the Alfresco process modeler and navigate to the process definition that contains the process card.\n2. Click on the \"Process\" tab in the top navigation bar.\n3. Click on the \"Process Card\" button in the right-hand Actions panel.\n4. In the Process Card editor, click on the \"Sequence\" tab.\n5. In the Sequence tab, click on the \"Extraction Rules\" button.\n6. In the Extraction Rules panel, click on the \"Add Rule\" button.\n7. Select the \"Process Card\" rule and click \"OK\".\n8. In the Process Card rule, select the \"Include auxiliary actions\" option and click \"OK\".\n9. Repeat steps 6-8 for each process card that needs to be updated.\n\nAlternatively, you can also use the Alfresco REST API to update the process card sequence extraction rules. Here's an example command:\n\n**Update process card sequence extraction rules using Alfresco REST API:**\n\n```bash\ncurl -X", "metrics": { "length": 1150, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "RAG Brand Filter Three Pitfalls (rag-brand-filter-three-pitfalls)", "condition": "with_lesson", "status": 200, "content": "Here are concrete, actionable fixes for each of the three pitfalls:\n\n**Pitfall 1: Conditionally Triggered Brand Filtering**\n\nTo fix this pitfall, we need to always enable brand filtering and exclude non-target-brand documents directly at the retrieval layer.\n\nAssuming you're using a search engine like Elasticsearch, here's how you can modify your mapping to always enable brand filtering:\n\n```python\n# mapping.py\n{\n \"properties\": {\n \"title\": {\"type\": \"text\"},\n \"description\": {\"type\": \"text\"},\n \"content\": {\"type\": \"text\"},\n \"filename\": {\"type\": \"text\"}\n },\n \"mappings\": {\n \"properties\": {\n \"filename\": {\n \"type\": \"text\",\n \"analyzer\": {\n \"brand_filter_analyzer\": {\n \"type\": \"custom\",\n \"tokenizer\": \"standard\",\n \"filter\": [\"lowercase\", \"ngram\", \"brand_filter\"]\n }\n },\n \"filter\": [\"brand_filter\"]\n }\n }\n }\n}\n```\n\nIn the above code, we've added a custom analyzer called `brand_filter_analyzer` that includes a `brand_filter` filter. This filter will be applied to the `filename", "metrics": { "length": 1219, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 4, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "RAG Build Strategy Batch (rag-build-strategy-batch)", "condition": "with_lesson", "status": 200, "content": "To fix the error, we need to process the embeddings in batches that fit within the available VRAM/WSL memory. Here's a concrete, actionable fix:\n\n**Step 1: Verify the RAG config and ingestion log**\n\nRun the following command to verify the RAG config and ingestion log:\n```bash\ngrep -i 'bm25\\|chunk\\|embed' lessons/contrib/rag-.md 2/dev/null | head -3\necho Search verified\n```\nThis command checks if the RAG config and ingestion log contain any relevant information.\n\n**Step 2: Check the cache status**\n\nRun the following command to check the cache status:\n```bash\ngrep -i 'cache' lessons/contrib/rag-.md 2/dev/null | head -3\necho Cache status verified\n```\nThis command checks if the cache status is relevant to the issue.\n\n**Step 3: Update the RAG build strategy batch**\n\nUpdate the RAG build strategy batch to process embeddings in batches that fit within the available VRAM/WSL memory. You can do this by adding the following configuration to your `rag-build-strategy-batch` YAML file:\n```yml\nbatch_size: 1000\n```\nThis sets the batch", "metrics": { "length": 1035, "commands": 4, "command_list": [ "grep -i 'bm25\\|chunk\\|embed' lessons/contrib/rag-.md 2/dev/null | head -3", "echo Search verified", "grep -i 'cache' lessons/contrib/rag-.md 2/dev/null | head -3", "echo Cache status verified" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "RAG Knowledge Base Quality Flywheel Self Loop (rag-kb-quality-flywheel-self-loop)", "condition": "plain", "status": 200, "content": "I'm not able to provide a fix for the error you mentioned as it's not a standard programming error. The error message \"RAG Knowledge Base Quality Flywheel Self Loop\" appears to be a custom error message, possibly related to a specific application or system.\n\nHowever, I can suggest some steps to troubleshoot and potentially resolve the issue:\n\n1. Check the application documentation: Look for the official documentation of the application or system that is causing the error. This should provide information on how to resolve the issue.\n2. Check for updates: Make sure that the application or system is up-to-date, as updates often include bug fixes and patches that can resolve issues like this.\n3. Check for configuration issues: Ensure that the application or system is configured correctly. This may involve checking settings, options, or parameters that are related to the error.\n4. Check for dependencies: If the application or system relies on other components or libraries, ensure that these dependencies are installed and up-to-date.\n\nIf you can provide more context or information about the error, such as the application or system that is causing the error, I may be able to provide a more specific solution.", "metrics": { "length": 1220, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "RAG Build Strategy Batch (rag-build-strategy-batch)", "condition": "plain", "status": 200, "content": "It seems like you're experiencing an issue with the RAG Build Strategy Batch command. Unfortunately, without more information about the specific error message you're receiving, it's difficult to provide a precise solution.\n\nHowever, I can offer some general troubleshooting steps and potential fixes for common issues related to the RAG Build Strategy Batch command:\n\n1. **Check the command syntax**: Ensure that the command is spelled correctly and that all parameters are in the correct order.\n\n2. **Verify the input parameters**: Double-check that the input parameters are valid and correctly formatted.\n\n3. **Check the output**: Verify that the output is as expected.\n\nHere's a basic example of how to run the RAG Build Strategy Batch command using PowerShell:\n\n```powershell\nrag-build-strategy-batch -command \"your_command_here\" -parameters @{\"param1\"=\"value1\",\"param2\"=\"value2\"}\n```\n\nReplace `\"your_command_here\"` with the actual command you want to execute, and `\"value1\"` and `\"value2\"` with the actual values you want to pass as parameters.\n\nIf you're still experiencing issues, please provide more details about the error message you're receiving, and I'll do my best to help you troubleshoot the problem.", "metrics": { "length": 1215, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 4, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "RAG Knowledge Base Quality Flywheel Self Loop (rag-kb-quality-flywheel-self-loop)", "condition": "with_lesson", "status": 200, "content": "To implement the fix, we need to create a synonyms.json file and update the rag_core.py file. Here's a step-by-step guide:\n\n**Step 1: Create synonyms.json file**\n\nCreate a new file called `synonyms.json` in the root directory of your project. This file will contain 32 groups of vertical-domain synonyms.\n\nHere's an example of what the file might look like:\n```json\n{\n \"alarms\": [\"alarm1\", \"alarm2\", \"alarm3\"],\n \"servo\": [\"servo1\", \"servo2\", \"servo3\"],\n \"zero calibration\": [\"zero1\", \"zero2\", \"zero3\"],\n \"encoder\": [\"encoder1\", \"encoder2\", \"encoder3\"],\n // Add more groups as needed\n}\n```\n**Step 2: Update rag_core.py**\n\nUpdate the `rag_core.py` file to import the `synonyms.json` file and use it for synonym expansion.\n\nAdd the following lines at the top of the file:\n```python\nimport json\nimport os\nimport sys\nimport time\n\n# Load synonyms from JSON file\ndef _load_synonyms():\n synonyms_file = 'synonyms.json'\n if not os.path.exists(syn", "metrics": { "length": 958, "commands": 3, "command_list": [ "**Step 2: Update rag_core.py**", "Update the `rag_core.py` file to import the `synonyms.json` file and use it for synonym expansion.", "Add the following lines at the top of the file:" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "开源项目 README Optimization — 7 个常见Pitfalls与Fix Checklist (readme-seven-traps-fix-checklist)", "condition": "with_lesson", "status": 200, "content": "根据提供的信息,修复 MisakaNet README 的 7 个问题的解决方案如下:\n\n1. 信息架构反人类\n\n * 问题:README 顶部放的是 FOR AI AGENTS 提示框 → Demo → CLI参考 → 然后才出现 \"What is MisakaNet?\"。\n * 修复:将\"What is MisakaNet?\"置顶,紧接标题和 badges。一句话说清项目本质。Demo 和 CLI 放在后面。\n\n ```markdown\n# What is MisakaNet?\n\nA decentralized swarm-knowledge network for AI agents...\n\n# Try it out\n## Demo\n[Demo Link](Demo Link)\n## CLI\n[CLI Reference](CLI Reference)\n```\n\n2. \"Zero-Dep\" 宣称不精确\n\n * 问题:项目声称 zero-dep,但 --semantic 参数依赖 sentence-transformers(~2GB 模型)。被用户发现后可信度直接打折。\n * 修复:明确区分 Core 和 Advanced 依赖。在 README 中加入清晰的依赖说明:\n\n ```markdown\n# Dependencies — core vs advanced:\n## Core search is zero-dep — pure Python", "metrics": { "length": 669, "commands": 3, "command_list": [ "2. \"Zero-Dep\" 宣称不精确", "* 问题:项目声称 zero-dep,但 --semantic 参数依赖 sentence-transformers(~2GB 模型)。被用户发现后可信度直接打折。", "* 修复:明确区分 Core 和 Advanced 依赖。在 README 中加入清晰的依赖说明:" ], "has_command_block": true, "actionable": false, "inline_code_count": 2, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "开源项目 README Optimization — 7 个常见Pitfalls与Fix Checklist (readme-seven-traps-fix-checklist)", "condition": "plain", "status": 200, "content": "The error you're referring to is likely related to the \"Optimization — 7 个常见Pitfalls与Fix Checklist\" section in the README file of an open-source project. The checklist lists common pitfalls and their fixes. Here's a concrete, actionable fix with exact commands for each point:\n\n**1. Use a consistent naming convention for files and directories**\n\n* Fix: Replace inconsistent naming conventions with a consistent one, such as using underscores instead of spaces or camelCase.\n\n ```bash\n# Before\nmy_file.txt\nMyFile.txt\nMY_FILE.TXT\n\n# After\nmy_file.txt\nmy_file.txt\nmy_file.txt\n```\n\n**2. Use a consistent formatting style for code blocks**\n\n* Fix: Use a consistent formatting style, such as using four spaces for indentation or the `prettier` tool.\n\n ```bash\n# Before\nif (true) {\n console.log('Hello World');\n}\n\n# After\nif (true) {\n console.log('Hello World');\n}\n```\n\n ```bash\n# Install prettier\nnpm install prettier --save-dev\n\n# Configure prettier\nnpx prettier --write src/\n\n# Format code with prettier\nnpx prettier --print-pre", "metrics": { "length": 1042, "commands": 12, "command_list": [ "my_file.txt", "MyFile.txt", "MY_FILE.TXT", "my_file.txt", "my_file.txt" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "注册链路设计 — Worker 只创建 Issue,其余交给 Workflow (registration-chain-worker-fallback)", "condition": "plain", "status": 200, "content": "The error message you're seeing suggests that the worker is only creating issues, but it's not passing them to the workflow as expected. This can be a common issue in workflow management systems, especially when there are complex business logic involved.\n\nHere's a concrete, actionable fix with exact commands to resolve the issue:\n\n**Step 1: Check the workflow definition**\n\nEnsure that the workflow definition is correctly defined to accept issues from the worker. Check the workflow's `input` and `output` properties to ensure they match the expected input and output types.\n\n**Step 2: Update the worker code**\n\nUpdate the worker code to pass the created issues to the workflow. You can do this by adding a `postCreateIssue` method to the worker that sends the issue to the workflow.\n\n```javascript\n// registration-chain-worker-fallback.js\nconst { createWorker } = require('amqplib');\n\nasync function postCreateIssue(issue) {\n const connection = await createWorker('amqplib://localhost:5672', 'registration-chain-worker-fallback');\n const channel = await connection.createChannel();\n const queue = await channel.assertQueue('registration-chain-workflow', { durable: true });\n await channel.sendToQueue(queue.queue, Buffer.from(JSON.stringify({ type:", "metrics": { "length": 1256, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 3, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "注册链路设计 — Worker 只创建 Issue,其余交给 Workflow (registration-chain-worker-fallback)", "condition": "with_lesson", "status": 200, "content": "根据给出的解决方案,以下是具体的修复步骤:\n\n**1. Worker代码改动**\n\n在 Worker 代码中,移除对 `counter.json` 的读写操作:\n\n```bash\n// worker.js\nconst express = require('express');\nconst app = express();\n\napp.post('/register', async (req, res) => {\n const issue = await createIssue(req.body);\n const issueUrl = `https://github.com/${issue.user}/issues/${issue.number}`;\n res.json({ issueUrl, issueNumber: issue.number });\n});\n\nasync function createIssue(body) {\n const response = await fetch('https://api.github.com/issues', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${process.env.GITHUB_TOKEN}`,\n },\n body: JSON.stringify(body),\n });\n const issue = await response.json();\n return issue;\n}\n```\n\n**2. register.yml 文件改动**\n\n在 `register.yml` 文件中,添加 `trigger` 条件,覆盖 `join` 和 `register` 前缀:\n\n```yaml\ntrigger:\n - github.event.issue.title\n contains:\n - join\n - register\n", "metrics": { "length": 913, "commands": 20, "command_list": [ "// worker.js", "const express = require('express');", "const app = express();", "app.post('/register', async (req, res) => {", "const issue = await createIssue(req.body);" ], "has_command_block": true, "actionable": false, "inline_code_count": 9, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Schemas coupled across repos break CI until the counterpart PR merges (schema-coupled-cross-repo-ci)", "condition": "with_lesson", "status": 200, "content": "Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Identify the validator repository and its branch**\n\nRun the following command to identify the validator repository and its branch:\n```bash\ngit remote -v\n```\nThis will show you the remote repository URL and its branch. Look for the branch that contains the validator.\n\n**Step 2: Open the two PRs as a pair and note the coupling**\n\nOpen the two PRs (data repository and validator repository) and add a comment to both PRs indicating that they are schema-coupled and need to be merged together:\n```bash\ngit pull origin main\ngit config user.name \"Your Name\"\ngit config user.email \"your@email.com\"\n\n# In data repository PR\ngit add .git/COMMIT_EDITMSG\ngit commit -m \"Merge schema-coupled PR\"\ngit note -c \"schema-coupled: merge data PR with validator PR\"\n\n# In validator repository PR\ngit add .git/COMMIT_EDITMSG\ngit commit -m \"Merge schema-coupled PR\"\ngit note -c \"schema-coupled: merge data PR with validator PR\"\n```\n**Step 3: Merge the validator repository PR first, then rebase the data repository", "metrics": { "length": 1060, "commands": 10, "command_list": [ "git remote -v", "git pull origin main", "git config user.name \"Your Name\"", "git config user.email \"your@email.com\"", "git add .git/COMMIT_EDITMSG" ], "has_command_block": true, "actionable": true, "inline_code_count": 3, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Content Quality Scoring System — Automated Lesson Evaluation (session-lesson-1-content-quality-scoring)", "condition": "with_lesson", "status": 200, "content": "The main issue with your code is that you're trying to access the `title` and `created` fields of the JSON metadata, but you're not correctly parsing the JSON. Here's a fixed version of your code:\n\n```python\nimport json\nimport re\n\ndef score_lesson(filepath: str) -> dict:\n with open(filepath) as f:\n content = f.read()\n \n score = 0\n breakdown = {}\n \n # Metadata (20)\n meta_score = 0\n json_match = re.search(r'\\{[^}]\"title\":\\s*\"[^}]\\}', content)\n if json_match:\n try:\n meta = json.loads(json_match.group().replace('\"title\":', '').replace('\"', '').replace('}', ''))\n meta_score += 4\n if len(meta.get(\"tags\", [])) == 3: meta_score += 3\n if meta.get(\"source\"): meta_score += 2\n if re.match(r'\\d{4}-\\d{2}-\\d{2}', meta.get(\"created\", \"\")): meta_score += 2\n except: \n pass\n breakdown[\"metadata\"] = min(meta_score, 20)\n score +=", "metrics": { "length": 940, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 2, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Schemas coupled across repos break CI until the counterpart PR merges (schema-coupled-cross-repo-ci)", "condition": "plain", "status": 200, "content": "The error \"schema-coupled-cross-repo-ci\" typically occurs when there are schema changes in one repository that affect another repository, causing the CI build to fail until the counterpart PR is merged. Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Update dependencies in both repositories**\n\nIn both repositories, run the following command to update their dependencies:\n```bash\ngit pull origin main\n```\nThis will fetch the latest changes from the remote repository.\n\n**Step 2: Run `npm install` or `yarn install`**\n\nIn both repositories, run the following command to install the updated dependencies:\n```bash\nnpm install\n# or\nyarn install\n```\n**Step 3: Run `npm run build` or `yarn build`**\n\nIn both repositories, run the following command to build the project:\n```bash\nnpm run build\n# or\nyarn build\n```\n**Step 4: Run `npm test` or `yarn test`**\n\nIn both repositories, run the following command to run the tests:\n```bash\nnpm test\n# or\nyarn test\n```\n**Step 5: Verify the CI build passes**\n\nAfter running the above commands, verify that the CI build", "metrics": { "length": 1068, "commands": 7, "command_list": [ "git pull origin main", "npm install", "yarn install", "npm run build", "yarn build" ], "has_command_block": true, "actionable": true, "inline_code_count": 13, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Content Quality Scoring System — Automated Lesson Evaluation (session-lesson-1-content-quality-scoring)", "condition": "plain", "status": 200, "content": "I don't see any error code or information about the specific error you're experiencing. However, I'll provide a general troubleshooting approach for a Content Quality Scoring System issue.\n\nAssuming the error is related to the Automated Lesson Evaluation (ALE) system, here are some steps to help you troubleshoot and fix the issue:\n\n**Step 1: Check the ALE System Status**\n\n1. Log in to the ALE system as an administrator or a designated user.\n2. Check the system status by looking for a \"Status\" or \"System Status\" section.\n3. If the system is down or experiencing issues, contact the system administrator or IT support for assistance.\n\n**Step 2: Verify the Lesson and Content**\n\n1. Review the lesson plan and content to ensure that it aligns with the ALE system's requirements.\n2. Check the content for any errors, inaccuracies, or missing information.\n3. If necessary, update the content to meet the ALE system's requirements.\n\n**Step 3: Check for Technical Issues**\n\n1. Ensure that your browser is up-to-date and compatible with the ALE system.\n2. Clear your browser cache and cookies to resolve any potential issues.\n3. Check your internet connection to ensure it's stable and working", "metrics": { "length": 1190, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "slugify path traversal deep coverage (slugify-path-traversal-deep-coverage)", "condition": "with_lesson", "status": 200, "content": "To fix the `slugify-path-traversal-deep-coverage` error, we need to add explicit test cases for the new task acceptance criteria. Here's a step-by-step guide to fixing the issue:\n\n**Step 1: Update the test suite**\n\nCreate a new test file `test_slugify_path_traversal.py` with the following content:\n```python\nimport pytest\nfrom slugify import slugify\n\n@pytest.mark.parametrize(\"input_str, expected\", [\n # ../ and ..\\ path traversal characters\n (\"../etc/passwd\", \"etc-passwd\"),\n (\"\\\\\\\\etc\\\\passwd\", \"etc-passwd\"),\n (\"..\\\\etc\\\\passwd\", \"etc-passwd\"),\n # Null bytes (\\x00) and control characters\n (\"\\x00\", \"\"),\n (\"\\x7F\", \"\"),\n # Trailing dots and spaces (Windows silently strips these, causing filename collisions)\n (\"foo .bar\", \"foo-bar\"),\n (\"foo .bar .baz\", \"foo-bar\"),\n # All 14 Windows reserved names (AUX, LPT1-LPT9, mixed case)\n (\"AUX\", \"aux\"),\n (\"LPT1\", \"lpt1\"),\n (\"LPT2\", \"l", "metrics": { "length": 921, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 2, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "slugify path traversal deep coverage (slugify-path-traversal-deep-coverage)", "condition": "plain", "status": 200, "content": "The error \"slugify path traversal deep coverage (slugify-path-traversal-deep-coverage)\" typically occurs when there's a potential path traversal vulnerability in the slugify function. This can happen when the function is not properly sanitized, allowing an attacker to inject arbitrary directory paths.\n\nHere's a concrete, actionable fix using the `slugify` library and `path` module:\n\n**Step 1: Install required packages**\n\nRun the following command in your terminal:\n\n```bash\nnpm install slugify path\n```\n\n**Step 2: Update your slugify function**\n\nHere's an updated version of the slugify function that uses the `path` module to sanitize the input:\n\n```javascript\nconst slugify = require('slugify');\nconst path = require('path');\n\nconst sanitizePath = (path) => {\n return path.normalize(path).replace(/\\/+/g, '/').replace(/\\/\\./g, '.');\n};\n\nconst slugifyPath = (path) => {\n return slugify(sanitizePath(path), {\n replacement: '-',\n remove: /[^a-zA-Z0-9-]/g,\n });\n};\n\nmodule.exports = slugifyPath;\n```\n\n**Step 3: Use the updated slugify function**\n\nIn your code", "metrics": { "length": 1070, "commands": 1, "command_list": [ "npm install slugify path" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "slugify windows path sanitation (slugify-windows-path-sanitation)", "condition": "plain", "status": 200, "content": "The error \"slugify-windows-path-sanitation\" typically occurs when you're trying to slugify a Windows path that contains special characters, such as backslashes (\\) or colons (:). To fix this issue, you can use the `slugify` function from the `slugify` library, which includes a custom sanitizer for Windows paths.\n\nHere's an example of how to fix the error:\n\n**Install required libraries:**\n```bash\nnpm install slugify\n```\n\n**Use the `slugify` function with the `sanitize` option set to `true` for Windows paths:**\n```javascript\nconst slugify = require('slugify');\n\nconst windowsPath = 'C:\\\\Users\\\\username\\\\Documents\\\\example.txt';\nconst sanitizedSlug = slugify(windowsPath, { sanitize: true });\n\nconsole.log(sanitizedSlug); // Output: \"c-users-username-documents-example.txt\"\n```\n\nAlternatively, you can use the `path` module to normalize the Windows path before slugifying it:\n```javascript\nconst path = require('path');\nconst slugify = require('slugify');\n\nconst windowsPath = 'C:\\\\Users\\\\username\\\\Documents\\\\example.txt';\nconst normalizedPath = path.normalize(windowsPath);\nconst sanitizedSlug = slug", "metrics": { "length": 1106, "commands": 2, "command_list": [ "npm install slugify", "Alternatively, you can use the `path` module to normalize the Windows path before slugifying it:" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Squash-rebase rewrites the patch base and breaks force-push expectations (squash-rebase-force-push-lease)", "condition": "with_lesson", "status": 200, "content": "To fix the issue, you'll need to squash the rebase, verify the diff, and then force-push with a specific option to avoid rewriting the base commit. Here are the steps:\n\n1. **Capture the current remote head**:\n\n ```bash\ngit rev-parse origin/\n```\n\n This will give you the SHA of the current remote branch.\n\n2. **Squash the rebase**:\n\n ```bash\ngit rebase -i HEAD~n\n```\n\n Replace `n` with the number of commits you want to squash. For example, if you want to squash the last 3 commits, use `git rebase -i HEAD~3`.\n\n In the interactive rebase menu, change `pick` to `s` for each commit you want to squash, and then save and close the file.\n\n3. **Verify the diff**:\n\n ```bash\ngit diff origin/main..HEAD\n```\n\n This will show you the intended net change. If the output is not as expected, you may need to make adjustments to the squash rebase.\n\n4. **Force-push with --force-with-lease**:\n\n ```bash\ngit push origin --force-with", "metrics": { "length": 968, "commands": 3, "command_list": [ "git rev-parse origin/", "git rebase -i HEAD~n", "git diff origin/main..HEAD" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "slugify windows path sanitation (slugify-windows-path-sanitation)", "condition": "with_lesson", "status": 200, "content": "To fix the slugify logic in `scripts/new_lesson.py`, you can use the following code:\n\n```python\nimport unicodedata\nimport re\n\ndef slugify_windows_path_sanitation(title):\n \"\"\"\n Sanitizes a Windows path title for slugification.\n \"\"\"\n # Normalize Unicode characters\n normalized_title = unicodedata.normalize('NFKD', title)\n \n # Replace slashes with hyphens\n title = normalized_title.replace('/', '-').replace('\\\\', '-')\n \n # Normalize Windows reserved names\n reserved_names = ['CON', 'PRN', 'AUX', 'NUL']\n for name in reserved_names:\n title = title.replace(name, '')\n \n # Remove leading and trailing whitespace\n title = title.strip()\n \n # Remove non-alphanumeric characters (except hyphens)\n title = re.sub(r'[^a-zA-Z0-9-]', '', title)\n \n # Collapse multiple hyphens\n title = re.sub(r'-+', '-', title)\n \n # Remove leading and trailing hyphens\n title = title.strip('-')\n \n # Remove empty strings\n if not title:\n title = 'default-slug'\n \n return title\n\n# Example", "metrics": { "length": 1058, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 1, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Squash-rebase rewrites the patch base and breaks force-push expectations (squash-rebase-force-push-lease)", "condition": "plain", "status": 200, "content": "The error you're encountering is due to the fact that Squash-rebase rewrites the patch base, which can break force-push expectations. To fix this issue, you can use the following steps:\n\n**Step 1: Force-push without squashing the rebase**\n\n```bash\ngit push origin --force-with-lease\n```\n\nThis command will force-push your changes to the remote repository without squashing the rebase. This should resolve the issue without rewriting the patch base.\n\n**Step 2: Force-push with squashing the rebase**\n\nIf you want to squash the rebase before force-pushing, you can use the following command:\n\n```bash\ngit rebase -i \n```\n\nThen, squash the rebase by editing the `rebase-apply` line to `pick`. After squashing the rebase, you can force-push:\n\n```bash\ngit push origin --force-with-lease\n```\n\n**Note:** Be cautious when squashing the rebase, as this can rewrite the patch base and break force-push expectations.\n\n**Alternative Solution:**\n\nIf you're using Git version 2.27 or later, you can use the `--squash` option with `git push", "metrics": { "length": 1065, "commands": 3, "command_list": [ "git push origin --force-with-lease", "git rebase -i ", "git push origin --force-with-lease" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "static page github api 403 rate limit (static-page-github-api-403-rate-limit)", "condition": "with_lesson", "status": 200, "content": "为了解决静态页面GitHub API 403率限问题,我们需要在您的GitHub Pages项目中添加一个后端代理来缓解率限问题。\n\n步骤1:创建一个Node.js服务\n\n首先,我们需要创建一个Node.js服务来代理GitHub API。我们将使用`express`框架来创建服务。\n\n```bash\nnpm init -y\nnpm install express\n```\n\n创建一个新文件(例如`server.js`)并添加以下代码:\n\n```javascript\nconst express = require('express');\nconst app = express();\n\nconst githubApiUrl = 'https://api.github.com';\nconst proxyUrl = 'https://cors-anywhere.herokuapp.com/'; // 为了解决 CORS 问题,我们使用一个 CORS 代理\n\napp.use(express.json());\n\nconst fetchWithTimeout = async (url, timeoutMs = 8000) => {\n const ctrl = new AbortController();\n const timer = setTimeout(() => ctrl.abort(), timeoutMs);\n try {\n const r = await fetch(url, { signal: ctrl.signal });\n clearTimeout(timer);\n if (!r.ok) throw new Error(r.status);\n return r.json();\n } catch (e) {\n clearTimeout(timer);\n throw e;\n }\n};\n\nconst apiCall", "metrics": { "length": 842, "commands": 2, "command_list": [ "npm init -y", "npm install express" ], "has_command_block": true, "actionable": true, "inline_code_count": 4, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "static page github api 403 rate limit (static-page-github-api-403-rate-limit)", "condition": "plain", "status": 200, "content": "The 403 rate limit error on the GitHub API is usually caused by exceeding the daily rate limit for your GitHub account. Here's a step-by-step guide to help you resolve this issue:\n\n**Step 1: Check your rate limit**\n\n Run the following command to check your rate limit:\n```bash\ncurl -X GET https://api.github.com/rate_limit\n```\nThis will display your current rate limit, which is divided into three categories:\n\n* `remaining`: The number of requests you can make before hitting the limit.\n* `limit`: The total number of requests you can make within the 60-minute window.\n* `reset`: The time when the limit will reset.\n\n**Step 2: Reduce your requests**\n\nTo avoid hitting the rate limit, you can reduce the number of requests you make to the GitHub API. Here are a few ways to do this:\n\n* **Batch your requests**: Instead of making multiple requests in quick succession, batch them together to spread out the requests over time.\n* **Use pagination**: If you're making requests to a large dataset, use pagination to limit the number of requests you make at once.\n* **Cache your requests**: If you're making the same requests repeatedly, consider caching the results", "metrics": { "length": 1173, "commands": 1, "command_list": [ "curl -X GET https://api.github.com/rate_limit" ], "has_command_block": true, "actionable": true, "inline_code_count": 4, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "static page width consistency (static-page-width-consistency)", "condition": "with_lesson", "status": 200, "content": "To fix the static page width consistency error, we'll make the following changes:\n\n1. Remove the `max-width` property from the search bar, content cards, and form elements, and set them to inherit the container's width.\n2. Remove the `max-width` property from the content cards and form elements, as they should automatically take up the full width of the container.\n3. Update the container's width to 100% to ensure all content areas are aligned.\n\nHere are the exact commands to make these changes:\n\n**Step 1: Update the search bar**\n\n```bash\necho \"Updating search bar styles\" >> lessons/static-page-width-consistency.md\n\n# Update the search bar styles in your CSS file\n.search-bar {\n padding: 0 20px; /* keep the existing padding */\n width: 100%; /* inherit the container's width */\n}\n```\n\n**Step 2: Update the content cards**\n\n```bash\necho \"Updating content card styles\" >> lessons/static-page-width-consistency.md\n\n# Update the content card styles in your CSS file\n.content-card {\n width: 100%; /* automatically take up the full width of the container */\n max-width: none; /* remove the max-width property */\n min-width", "metrics": { "length": 1128, "commands": 5, "command_list": [ "echo \"Updating search bar styles\" >> lessons/static-page-width-consistency.md", ".search-bar {", "padding: 0 20px; /* keep the existing padding */", "width: 100%; /* inherit the container's width */", "}" ], "has_command_block": true, "actionable": true, "inline_code_count": 4, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "static page width consistency (static-page-width-consistency)", "condition": "plain", "status": 200, "content": "The \"static-page-width-consistency\" error typically occurs when the width of a static page (usually a layout or template) is not consistent across different devices or screen sizes.\n\nTo fix this issue, you can use a CSS media query to define different widths for your static page based on the device's screen size. Here's an example of how you can fix this issue using CSS:\n\n**Method 1: Using a CSS Reset**\n\nYou can use a CSS reset file (e.g., Normalize.css or Reset.css) to reset the default box-sizing property and set the width of your static page. If you're using a CSS framework like Bootstrap, you can use their built-in CSS classes to achieve this.\n\nFor example, if you're using Bootstrap 5, you can add the following code to your HTML:\n```html\n\n
\n \n
\n```\nThis will set the width of the container to 80% of the parent element's width, with a margin of 4 units on both sides.\n\n**Method 2: Using a CSS Media Query**\n\n", "metrics": { "length": 1104, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 1, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Supabase capacity constraints caused project operation failures (supabase-capacity-constraints-project-operations)", "condition": "with_lesson", "status": 200, "content": "To resolve the \"Supabase capacity constraints\" issue, follow these steps:\n\n**Step 1: Check your current capacity settings**\n\nRun the following command to check your current capacity settings:\n```bash\nsupabase project info --project-id \n```\nReplace `` with your actual project ID.\n\nLook for the \"Capacity\" section in the output. If your project is running low on capacity, you'll see a message indicating the available capacity.\n\n**Step 2: Increase your project's capacity**\n\nTo increase your project's capacity, run the following command:\n```bash\nsupabase project update --project-id --capacity \n```\nReplace `` with your actual project ID and `` with the desired new capacity (e.g., 1000).\n\nFor example:\n```bash\nsupabase project update --project-id my-project --capacity 1000\n```\n**Step 3: Wait for the changes to take effect**\n\nAfter updating your project's capacity, wait for the changes to take effect. This may take a few minutes.\n\n**Step 4: Verify that the issue is resolved**\n\nTry to create a new project, resize an existing project, or perform other operations that were previously", "metrics": { "length": 1165, "commands": 3, "command_list": [ "supabase project info --project-id ", "supabase project update --project-id --capacity ", "supabase project update --project-id my-project --capacity 1000" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Supabase capacity constraints caused project operation failures (supabase-capacity-constraints-project-operations)", "condition": "plain", "status": 200, "content": "The \"Supabase capacity constraints caused project operation failures\" error typically occurs when you exceed the capacity limits set for your Supabase project. Here's a step-by-step guide to help you resolve this issue:\n\n**Step 1: Check your current usage**\n\nRun the following command in your terminal to check your current usage:\n```bash\nsupabase db info --format json\n```\nThis will display your current usage statistics, including the number of queries, rows, and storage used.\n\n**Step 2: Identify the resource that's exceeding the limit**\n\nBased on the output of the previous command, identify the resource (e.g., queries, rows, or storage) that's exceeding the limit.\n\n**Step 3: Reduce your usage**\n\nTo reduce your usage, you can try the following:\n\n* Optimize your queries: Review your SQL queries and optimize them to reduce the number of rows being retrieved or updated.\n* Limit the number of rows: If you're retrieving a large number of rows, consider limiting the number of rows returned using pagination or filtering.\n* Reduce storage usage: If you're storing large amounts of data, consider reducing the size of your data or using a more efficient storage solution.\n\n**Step 4: Update your configuration (if necessary)**\n\nIf", "metrics": { "length": 1234, "commands": 1, "command_list": [ "supabase db info --format json" ], "has_command_block": true, "actionable": true, "inline_code_count": 1, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Swarm PR Battle Playbook — Shipping env-var error hooks through AI-reviewed (swarm-pr-battle-playbook)", "condition": "with_lesson", "status": 200, "content": "The error message indicates that there's an issue with shipping error handler environment variables (env-vars) through AI-reviewed upstreams. To fix this, you'll need to make some changes to your CI/CD pipeline and ensure that the error handler is properly configured and reviewed.\n\nHere's a step-by-step guide to help you fix the issue:\n\n**Step 1: Enable GitHub Actions in Forked Repos**\n\nIf your forked repository has GitHub Actions disabled by default, you'll need to enable them manually via the web UI.\n\n1. Go to your forked repository on GitHub.\n2. Click on the \"Settings\" icon (gear icon) in the top-right corner.\n3. Scroll down to the \"Actions\" section.\n4. Click on \"Edit\" next to \"GitHub Actions\".\n5. Toggle the switch to enable GitHub Actions.\n\n**Step 2: Update the `error-handler` Env Var**\n\nUpdate the `error-handler` environment variable to include the necessary information for the AI review process.\n\n1. Create a new file named `.github/workflows/error-handler.yml` in the root of your repository with the following content:\n```yaml\nname: Error Handler\n\non:\n push:\n branches:\n - main\n\njobs:\n error-handler:\n runs", "metrics": { "length": 1140, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 3, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Swarm PR Battle Playbook — Shipping env-var error hooks through AI-reviewed (swarm-pr-battle-playbook)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely due to a missing environment variable in your Docker container or Kubernetes pod. To fix this issue, you'll need to create or update an environment variable in your `docker-compose.yml` or Kubernetes configuration file.\n\nHere's a step-by-step guide to help you resolve the issue:\n\n**For Docker Compose (docker-compose.yml):**\n\n1. Open your `docker-compose.yml` file in a text editor.\n2. Locate the `environment` section, which should contain the environment variables for your application.\n3. Add or update the environment variable that's missing. For example, if the error message mentions `shipping`, you might need to add the following line:\n\n```yml\nenvironment:\n - SHIPPING=true\n```\n\nReplace `true` with the actual value you want to set for the `shipping` environment variable.\n\n4. Save the changes to your `docker-compose.yml` file.\n\n**For Kubernetes (deployment.yaml or pod.yaml):**\n\n1. Open your Kubernetes configuration file in a text editor.\n2. Locate the `spec.containers[0].env` section, which should contain the environment variables for your application.\n3. Add or update the environment variable that's missing. For example, if the error message mentions `shipping", "metrics": { "length": 1219, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 10, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Testimonio: MisakaNet me ayudo a resolver ModuleNotFoundError (testimonio-misakanet)", "condition": "with_lesson", "status": 200, "content": "To fix the `ModuleNotFoundError` caused by missing `cv2` module, follow these steps:\n\n**Step 1: Install OpenCV using pip**\n\nOpen a terminal or command prompt and run the following command:\n\n```bash\npip install opencv-python\n```\n\n**Step 2: Verify the installation**\n\nAfter installation, you can verify that OpenCV is installed correctly by running the following command:\n\n```bash\npython -c \"import cv2; print(cv2.__version__)\"\n```\n\nThis command will print the version of OpenCV installed on your system.\n\n**Step 3: Update the test case on MisakaNet**\n\nTo update the test case on MisakaNet, you can follow these steps:\n\n1. Open the test case file `testimonio-misakanet.md` in a text editor.\n2. Replace the existing search query with the updated query:\n\n```bash\npython search_knowledge.py 'ModuleNotFoundError: No module named '\n```\n\nwith:\n\n```bash\npython search_knowledge.py 'ModuleNotFoundError: No module named cv2'\n```\n\n3. Save the changes to the file.\n\n**Step 4: Verify the test case on MisakaNet**\n\nAfter updating the test case, you can verify that it's working correctly", "metrics": { "length": 1074, "commands": 4, "command_list": [ "pip install opencv-python", "python -c \"import cv2; print(cv2.__version__)\"", "python search_knowledge.py 'ModuleNotFoundError: No module named '", "python search_knowledge.py 'ModuleNotFoundError: No module named cv2'" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Testimonio: MisakaNet me ayudo a resolver ModuleNotFoundError (testimonio-misakanet)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely due to a missing or incompatible package. Here's a step-by-step guide to resolve the `ModuleNotFoundError`:\n\n**Step 1: Update pip**\n\nBefore installing any packages, ensure that `pip` is up-to-date. Run the following command in your terminal:\n\n```bash\npython -m pip install --upgrade pip\n```\n\n**Step 2: Install the required package**\n\nThe error mentions `MisakaNet`, which is a Python library. You'll need to install it using pip. Run the following command:\n\n```bash\npip install MisakaNet\n```\n\nIf the package is not available on PyPI (Python Package Index), you may need to install it from another source. You can try installing it from GitHub or the original repository.\n\n**Step 3: Verify the installation**\n\nAfter installing the package, verify that it's working correctly by running a simple script:\n\n```python\nfrom misakanet import MisakaNet\n\nmisaka = MisakaNet()\nprint(misaka)\n```\n\nIf you encounter any issues during this step, you may need to reinstall the package or check the documentation for any specific requirements.\n\n**Step 4: Update your project**\n\nIf you're working on a project that uses `", "metrics": { "length": 1144, "commands": 2, "command_list": [ "python -m pip install --upgrade pip", "pip install MisakaNet" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "React Native uygulamasında Orbot (Tor) ile gizlilik akışı (tor-orbot-privacy-in-react-native-tr)", "condition": "with_lesson", "status": 200, "content": "Here's a concrete, actionable fix with exact commands to implement Tor usage in a React Native application:\n\n**Step 1: Install required dependencies**\n\nRun the following command in your terminal:\n```bash\nnpm install @react-native-async-storage/async-storage\n```\n**Step 2: Create a new file for Orbot control**\n\nCreate a new file named `OrbotController.js` in your project's root directory:\n```bash\nmkdir src\ntouch src/OrbotController.js\n```\nAdd the following code to `OrbotController.js`:\n```javascript\nimport { Linking, Platform } from 'react-native';\n\nconst ORBOT_URI = 'orbot://';\n\nasync function isOrbotInstalled() {\n if (Platform.OS !== 'android') return false;\n try { return await Linking.canOpenURL(ORBOT_URI); } catch { return false; }\n}\n\nexport { isOrbotInstalled };\n```\n**Step 3: Create a new file for user preference storage**\n\nCreate a new file named `PrivacyPreferences.js` in your project's root directory:\n```bash\nmkdir src\ntouch src/PrivacyPreferences.js\n```\nAdd the following code to `PrivacyPreferences.js`:\n```javascript\nimport AsyncStorage from '@react", "metrics": { "length": 1074, "commands": 6, "command_list": [ "npm install @react-native-async-storage/async-storage", "mkdir src", "touch src/OrbotController.js", "**Step 3: Create a new file for user preference storage**", "Create a new file named `PrivacyPreferences.js` in your project's root directory:" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "React Native uygulamasında Orbot (Tor) ile gizlilik akışı (tor-orbot-privacy-in-react-native-tr)", "condition": "plain", "status": 200, "content": "To fix the error \"tor-orbot-privacy-in-react-native-tr\" in a React Native application, you need to install the `react-native-tor` package and configure it properly.\n\nHere's a step-by-step guide to fix the issue:\n\n**Step 1: Install the required packages**\n\nOpen your terminal and navigate to your React Native project directory. Run the following command to install the required packages:\n\n```bash\nnpm install react-native-tor\nnpm install react-native-tor-bridge\n```\n\n**Step 2: Link the packages**\n\nAfter installation, link the packages using the following command:\n\n```bash\nnpx react-native link react-native-tor\nnpx react-native link react-native-tor-bridge\n```\n\n**Step 3: Configure Orbot**\n\nOrbot requires a configuration file to function properly. Create a new file named `orbot.json` in the root of your project with the following content:\n\n```json\n{\n \"orbot\": {\n \"port\": 443,\n \"address\": \"127.0.0.1\"\n }\n}\n```\n\nThis configuration sets the Orbot port to 443 and the address to localhost.\n\n**Step 4: Import the Tor module**\n\nIn your React Native component", "metrics": { "length": 1065, "commands": 4, "command_list": [ "npm install react-native-tor", "npm install react-native-tor-bridge", "npx react-native link react-native-tor", "npx react-native link react-native-tor-bridge" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "tts chinese encoding powershell (tts-chinese-encoding-powershell)", "condition": "with_lesson", "status": 200, "content": "To fix the issue, you need to ensure that the text is read from a UTF-8 encoded file, and then pass it to the mmx CLI. Here's a concrete, actionable fix with exact commands:\n\n```powershell\n# Create a new .txt file with the Chinese text\n\"早安愚者\" | Out-File -FilePath \"input.txt\" -Encoding UTF8\n\n# Read the text from the UTF-8 encoded file\n$text = [System.IO.File]::ReadAllText(\"input.txt\", [System.Text.Encoding]::UTF8)\n\n# Pass the text to the mmx CLI\nnode mmx.mjs speech synthesize --text \"$text\" --voice Japanese_CalmLady --out \"out.mp3\"\n\n# Verify that the command completed successfully\nif (Get-Command mmx.mjs -ErrorAction SilentlyContinue) {\n $result = & \"mmx.mjs\" speech synthesize --text \"$text\" --voice Japanese_CalmLady --out \"out.mp3\"\n if ($result.ExitCode -eq 0) {\n Write-Host \"Verification passed: fix command exited 0\"\n } else {\n Write-Host \"Verification failed: fix command exited $result.ExitCode\"\n", "metrics": { "length": 933, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "tts chinese encoding powershell (tts-chinese-encoding-powershell)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely due to the fact that the `tts-chinese-encoding-powershell` module doesn't support Chinese text encoding by default. Here's a step-by-step solution to resolve the issue:\n\n**Step 1: Install the required module**\n\nYou need to install the `tts-chinese-encoding-powershell` module from the PowerShell Gallery. Run the following command:\n\n```powershell\nInstall-Module -Name tts-chinese-encoding-powershell\n```\n\n**Step 2: Import the module**\n\nAfter installing the module, import it into your PowerShell session:\n\n```powershell\nImport-Module tts-chinese-encoding-powershell\n```\n\n**Step 3: Set the encoding**\n\nTo set the Chinese encoding, use the `Set-TTSChineseEncoding` function:\n\n```powershell\nSet-TTSChineseEncoding -Encoding GBK\n```\n\nAlternatively, you can set the encoding using the `tts-chinese-encoding` parameter when creating a text-to-speech object:\n\n```powershell\n$voice = New-TTSChineseVoice -Language \"zh-CN\"\n$voice | Set-TTSChineseEncoding -Encoding GBK\n```\n\n**Example Use Case:**\n\nHere's an example of how", "metrics": { "length": 1052, "commands": 5, "command_list": [ "**Step 2: Import the module**", "After installing the module, import it into your PowerShell session:", "**Step 3: Set the encoding**", "To set the Chinese encoding, use the `Set-TTSChineseEncoding` function:", "Alternatively, you can set the encoding using the `tts-chinese-encoding` parameter when creating a text-to-speech object:" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Vertical KB Question Bank Strategy — FANUC Robot KB Case Study (vertical-kb-question-bank-strategy)", "condition": "with_lesson", "status": 200, "content": "The error you're encountering is likely due to the fact that the `word/comments.xml` file is not being properly parsed by the `ET.parse()` function. This could be caused by the XML file not being in the correct format or by there being issues with the `zipfile` and `ET` libraries.\n\nHere's a concrete, actionable fix with exact commands:\n\n1. **Check the XML file format:**\n\n * Make sure the `word/comments.xml` file is in the correct format. You can use an XML editor like Notepad++ or Visual Studio Code to inspect the file.\n2. **Update the `zipfile` library:**\n\n * If you're using Python 3.x, make sure you have the latest version of the `zipfile` library installed. You can update it using pip:\n\n ```bash\npip install --upgrade zipfile\n```\n3. **Update the `ET` library:**\n\n * If you're using Python 3.x, make sure you have the latest version of the `ET` library installed. You can update it using pip:\n\n ```bash\npip install --upgrade xml.etree.ElementTree\n```\n4. **Modify the Python script:**\n\n *", "metrics": { "length": 1034, "commands": 2, "command_list": [ "pip install --upgrade zipfile", "pip install --upgrade xml.etree.ElementTree" ], "has_command_block": true, "actionable": true, "inline_code_count": 12, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Two Evidence Loops for Failure Lessons (two-evidence-loops-for-failure-lessons)", "condition": "with_lesson", "status": 200, "content": "To fix the Two Evidence Loops for Failure Lessons issue, you can follow these steps:\n\n**Step 1: Add source evidence when a lesson is ingested**\n\nUpdate your YAML configuration to include source evidence when a lesson is ingested. This will ensure that you track both public and private evidence.\n\n```yaml\nevidence:\n level: \"pre_ingest_reused\"\n source_type: \"maintainer_reuse\"\n verified_by: \"maintainer\"\n public_quote_allowed: false\n```\n\n**Step 2: Keep public usefulness metrics separate**\n\nCreate a new YAML configuration to keep public usefulness metrics separate from source evidence.\n\n```yaml\npublic_usefulness:\n level: \"post_public_feedback\"\n source_type: \"public\"\n verified_by: \"public\"\n public_quote_allowed: true\n```\n\n**Step 3: Update your lesson ingestion process**\n\nUpdate your lesson ingestion process to track both source evidence and public usefulness metrics separately.\n\n```bash\n# Ingest a new lesson\n# ...\n\n# Add source evidence\necho \"maintainer_reuse\" > evidence.json\n\n# Add public usefulness metrics\necho \"public\" > public_usefulness.json\necho \"helpful_vote\" > public_usefulness.json\n# ...\n\n# Verify the lesson", "metrics": { "length": 1135, "commands": 4, "command_list": [ "**Step 2: Keep public usefulness metrics separate**", "Create a new YAML configuration to keep public usefulness metrics separate from source evidence.", "**Step 3: Update your lesson ingestion process**", "Update your lesson ingestion process to track both source evidence and public usefulness metrics separately." ], "has_command_block": true, "actionable": false, "inline_code_count": 4, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Two Evidence Loops for Failure Lessons (two-evidence-loops-for-failure-lessons)", "condition": "plain", "status": 200, "content": "To fix the \"Two Evidence Loops for Failure Lessons\" error, we'll need to identify and correct the duplicate evidence loops in your code. Here's a step-by-step guide with exact commands to help you resolve the issue.\n\nAssuming you're using Python, here's an example code snippet with duplicate evidence loops:\n\n```python\n# Evidence Loop 1\ndef evidence_loop_1():\n # Code for evidence loop 1\n pass\n\n# Evidence Loop 2\ndef evidence_loop_2():\n # Code for evidence loop 2 (Duplicate of evidence loop 1)\n pass\n\n# Failure Lesson\ndef failure_lesson():\n evidence_loop_1()\n evidence_loop_2()\n```\n\nTo fix the error, you can remove the duplicate evidence loop and use the original one:\n\n```python\n# Evidence Loop 1\ndef evidence_loop_1():\n # Code for evidence loop 1\n pass\n\n# Failure Lesson\ndef failure_lesson():\n evidence_loop_1()\n```\n\nAlternatively, if you need to use both evidence loops in the failure lesson, you can refactor the code to avoid duplication:\n\n```python\n# Evidence Loop 1\ndef evidence_loop_1():\n # Code for evidence loop 1\n ", "metrics": { "length": 1060, "commands": 2, "command_list": [ "To fix the error, you can remove the duplicate evidence loop and use the original one:", "Alternatively, if you need to use both evidence loops in the failure lesson, you can refactor the code to avoid duplication:" ], "has_command_block": true, "actionable": true, "inline_code_count": 4, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Vertical KB Question Bank Strategy — FANUC Robot KB Case Study (vertical-kb-question-bank-strategy)", "condition": "plain", "status": 200, "content": "I don't see any code or error message provided. However, I can provide a general solution for a common error that might be related to this topic.\n\nThe error \"Vertical KB Question Bank Strategy\" is likely a message from a FANUC robot, indicating that there is an issue with the vertical keyboarding strategy.\n\nHere's a potential fix:\n\n**Check the robot's configuration and settings**\n\n1. Open the FANUC robot's configuration software (e.g., FANUC PC-based system).\n2. Go to the \"System Settings\" or \"Configuration\" section.\n3. Check if the \"Vertical KB Question Bank Strategy\" is enabled or disabled.\n4. If it's disabled, enable it and save the changes.\n\n**Check the robot's keyboard settings**\n\n1. Go to the \"Keyboard Settings\" or \"Input Device Settings\" section.\n2. Ensure that the keyboard settings are correct and configured for vertical keyboarding.\n3. Check if the keyboard's \"Vertical KB\" or \"Vertical Mode\" is enabled.\n\n**Check the robot's program and code**\n\n1. Check the robot's program or code for any errors or inconsistencies related to the vertical keyboarding strategy.\n2. Ensure that the program is using the correct keyboard settings and configuration.\n\nIf none of", "metrics": { "length": 1180, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "WSL NTFS SQLite UPDATE 100x slower than ext4 (wsl-ntfs-sqlite-update-100x-slower)", "condition": "plain", "status": 200, "content": "The issue you're experiencing is due to the NTFS file system being slower than ext4 for SQLite updates. Here's a step-by-step guide to fix this issue:\n\n**Step 1: Enable NTFS File System Support**\n\nYou need to enable NTFS file system support in WSL. Run the following command:\n\n```bash\nwsl --set-filesystem ntfs\n```\n\n**Step 2: Update SQLite**\n\nUpdate SQLite to the latest version:\n\n```bash\nsudo apt update\nsudo apt install sqlite3\n```\n\n**Step 3: Create a new SQLite database**\n\nCreate a new SQLite database file in a directory you have write access to:\n\n```bash\nsqlite3 example.db\n```\n\n**Step 4: Create a table and insert data**\n\nCreate a table and insert some data:\n\n```sql\nCREATE TABLE test (id INTEGER PRIMARY KEY, value TEXT);\nINSERT INTO test (value) VALUES ('Hello, World!');\n```\n\n**Step 5: Run the benchmark test**\n\nRun the benchmark test to verify that the update is working correctly:\n\n```bash\nsqlite3 example.db \"UPDATE test SET value = 'Hello, Universe!' WHERE id = 1\"\n```\n\nIf the update is working correctly, you should see the value of the", "metrics": { "length": 1051, "commands": 6, "command_list": [ "wsl --set-filesystem ntfs", "sudo apt update", "sudo apt install sqlite3", "sqlite3 example.db", "**Step 5: Run the benchmark test**" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "WSL NTFS SQLite UPDATE 100x slower than ext4 (wsl-ntfs-sqlite-update-100x-slower)", "condition": "with_lesson", "status": 200, "content": "To fix the issue of WSL NTFS SQLite UPDATE being 100x slower than ext4, you can follow these steps:\n\n**Step 1: Copy the database to a Linux-native filesystem (ext4)**\n\n```bash\n# Copy the database to /tmp\ncp /mnt/d/project/data.db /tmp/data.db\n```\n\n**Step 2: Run UPDATE on the local copy (using ext4)**\n\n```bash\n# Run the UPDATE command using ext4\npython3 -c \"\nimport sqlite3\nconn = sqlite3.connect('/tmp/data.db')\nconn.execute('UPDATE table SET col = ... WHERE ...')\nconn.commit()\nconn.close()\n\"\n```\n\n**Step 3: Copy back to NTFS**\n\n```bash\n# Copy the updated database back to /mnt/d\ncp /tmp/data.db /mnt/d/project/data.db\n```\n\n**Verification**\n\n```bash\n# Verify that the database has been updated successfully\ncp /mnt/d/project/data.db /tmp/data.db\necho \"Verification passed: fix command executed\"\n```\n\nBy following these steps, you can ensure that your SQLite UPDATE operations are performed on a Linux-native filesystem (ext4), which should significantly improve performance compared to using WSL NTFS.", "metrics": { "length": 1004, "commands": 11, "command_list": [ "cp /mnt/d/project/data.db /tmp/data.db", "python3 -c \"", "import sqlite3", "conn = sqlite3.connect('/tmp/data.db')", "conn.execute('UPDATE table SET col = ... WHERE ...')" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "IM 机器人反馈收集与 JSONL 队列审核模式 (wxauto-im-feedback-collection-jsonl-queue)", "condition": "plain", "status": 200, "content": "To fix the error, we need to identify the specific issue. However, without more context or information about the error message, I'll provide a general solution for a common issue related to JSONL files in Apache Airflow.\n\nAssuming the error is related to parsing a JSONL file, you can try the following steps:\n\n1. **Check the JSONL file format**: Ensure that the JSONL file is correctly formatted, with each line containing a JSON object separated by a newline character (`\\n`).\n\n2. **Verify the file path**: Double-check that the file path is correct and the file exists in the specified location.\n\n3. **Check the Airflow connection**: Ensure that the Airflow connection to the JSONL file is correct. You can check this by looking at the Airflow UI or by running the following command in your terminal:\n```bash\nairflow db upgrade\nairflow connections list\n```\n4. **Update the Airflow DAG**: If the issue persists, try updating the Airflow DAG that is using the JSONL file. You can do this by running the following command:\n```bash\nairflow db upgrade\nairflow dags update\n```\n5. **Try parsing the JSONL file manually**: If the issue is still", "metrics": { "length": 1139, "commands": 4, "command_list": [ "airflow db upgrade", "airflow connections list", "airflow db upgrade", "airflow dags update" ], "has_command_block": true, "actionable": true, "inline_code_count": 4, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "IM 机器人反馈收集与 JSONL 队列审核模式 (wxauto-im-feedback-collection-jsonl-queue)", "condition": "with_lesson", "status": 200, "content": "To fix the error, we need to make the following changes:\n\n1. **Modify the feedback key words**: Currently, the code checks for positive and negative feedback keywords separately. However, it does not exclude normal query words that might trigger the negative feedback. For example, the word \"错了\" (which means \"wrong\" in Chinese) might be used in a normal query like \"哪里错了\" (meaning \"where is the problem?\"). To fix this, we need to modify the feedback key words to exclude normal query words.\n\n2. **Implement session-level context tracking**: The code does not track the conversation context between user queries. To fix this, we need to maintain a dictionary `_last_question[sender]` to record each user's previous question.\n\n3. **Modify the JSONL file writing**: The code writes feedback to the `badcase_pending.jsonl` file, but it does not handle the case where the file is not writable.\n\nHere's the updated code:\n\n```python\nimport json\nimport os\n\n# Define the feedback key words\nFB_GOOD = {\"好评\", \"👍\", \"good\", \"好用\", \"准确\", \"正确\", \"赞\"}\nFB_BAD = {\"差评\", \"", "metrics": { "length": 1056, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 2, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Auto-Merge CI Pipeline — DCO, Quality Score, Shadow Branch, Dynamic Deps, Auto-Merge (auto-merge-ci-pipeline)", "condition": "with_lesson", "status": 200, "content": "**Dynamic Dependency Discovery**\n\nTo implement Dynamic Dependency Discovery, you need to find the `requirements.txt` file in the PR and extract the dependencies. You can use the following steps:\n\n1. **Find the `requirements.txt` file**:\n\n You can use the `gh` command to find the `requirements.txt` file in the PR. You can use the following command:\n\n ```bash\nrequirements_file=$(gh api repos/owner/repo/pulls/$PR/files --paginate --jq '.[] | select(.filename == \"requirements.txt\") | .download_url')\n```\n\n This command will find the `requirements.txt` file in the PR and store its download URL in the `requirements_file` variable.\n\n2. **Download the `requirements.txt` file**:\n\n You can use the `curl` command to download the `requirements.txt` file:\n\n ```bash\ncurl -s -o requirements.txt $requirements_file\n```\n\n This command will download the `requirements.txt` file from the download URL stored in the `requirements_file` variable.\n\n3. **Extract the dependencies**:\n\n You can use the `pip freeze` command to extract the dependencies from the `requirements.txt` file:\n\n ```bash\npip freeze > dependencies.txt\n``", "metrics": { "length": 1129, "commands": 2, "command_list": [ "requirements_file=$(gh api repos/owner/repo/pulls/$PR/files --paginate --jq '.[] | select(.filename == \"requirements.txt\") | .download_url')", "curl -s -o requirements.txt $requirements_file" ], "has_command_block": true, "actionable": true, "inline_code_count": 18, "lesson_hits": 2, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Auto-Merge CI Pipeline — DCO, Quality Score, Shadow Branch, Dynamic Deps, Auto-Merge (auto-merge-ci-pipeline)", "condition": "plain", "status": 200, "content": "The error \"Auto-Merge CI Pipeline — DCO, Quality Score, Shadow Branch, Dynamic Deps, Auto-Merge\" typically occurs when the Auto-Merge CI pipeline fails to complete due to a missing or incorrect configuration. Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Check the pipeline configuration**\n\nRun the following command to check the pipeline configuration:\n```bash\ngit config --get remote.origin.url\n```\nThis will display the URL of the remote repository.\n\n**Step 2: Check the pipeline settings**\n\nRun the following command to check the pipeline settings:\n```bash\ngit config --get remote.origin.pushurl\n```\nThis will display the URL where the pipeline will push the code.\n\n**Step 3: Update the pipeline configuration**\n\nIf the pipeline configuration is incorrect, update it by running the following command:\n```bash\ngit config remote.origin.url \n```\nReplace `` with the correct URL of the remote repository.\n\n**Step 4: Check the DCO (Developer Certificate of Origin)**\n\nRun the following command to check if the DCO is signed:\n```bash\ngit config --get user.signingkey\n```\nIf the DCO is not signed, you", "metrics": { "length": 1150, "commands": 4, "command_list": [ "git config --get remote.origin.url", "git config --get remote.origin.pushurl", "git config remote.origin.url ", "git config --get user.signingkey" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 5, "lesson_hit_rate": 0.833 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "GitHub Actions Script Injection — Use env Variables Instead of Inline Interpolation (github-actions-code-injection)", "condition": "with_lesson", "status": 200, "content": "**Fixing GitHub Actions Script Injection Vulnerability**\n\n**Step 1: Identify Vulnerable Workflow**\n\nOpen your GitHub Actions workflow file (e.g., `.yml` or `.yaml`) and look for `run:` scripts that directly use user-controlled variables like `${{ github.event.issue.body }}` or `${{ github.event.pull_request.title }}`.\n\n**Step 2: Refactor Vulnerable Workflow**\n\nFor each vulnerable `run:` script, follow these steps:\n\n1. **Extract user-controlled variable**: Identify the user-controlled variable used in the `run:` script and extract it into an `env:` section.\n2. **Assign variable value**: Assign the extracted variable a value from the user-controlled variable using the `${{ }}` syntax (e.g., `ISSUE_BODY: ${{ github.event.issue.body }}`).\n3. **Replace variable in run script**: Replace the original variable with the new environment variable in the `run:` script (e.g., `echo \"$ISSUE_BODY\"` instead of `echo \"${{ github.event.issue.body }}\"`).\n\n**Example Refactoring**\n\nBefore (vulnerable):\n```yaml\n- run: |\n TITLE=\"${{ github.event.issue.title }}\"\n if echo \"$TITLE\" | grep -qi \"bug\"; then echo \"", "metrics": { "length": 1108, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 13, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "AI Agent Contributor Engagement — Lightweight Retention Strategy (contributor-engagement-retention)", "condition": "plain", "status": 200, "content": "I'm not aware of any specific error message associated with the \"AI Agent Contributor Engagement — Lightweight Retention Strategy (contributor-engagement-retention)\". However, I can guide you through a general process to troubleshoot and potentially fix the issue.\n\nSince I don't have the exact error message, let's assume it's related to a Python project, as it seems to be a contributor engagement strategy. Here are some general steps to troubleshoot and potentially fix the issue:\n\n**Step 1: Check the project structure and dependencies**\n\n* Run `pip freeze` to check the installed packages and their versions.\n* Run `python -c \"import contributor_engagement_retention\"` to check if the module is imported correctly.\n\n**Step 2: Check the code for errors**\n\n* Run `flake8 contributor-engagement-retention` to check for syntax and style errors.\n* Run `pylint contributor-engagement-retention` to check for more in-depth errors.\n\n**Step 3: Check the dependencies**\n\n* Run `pip show contributor-engagement-retention` to check the package details.\n* Run `pip install -r requirements.txt` to ensure all dependencies are installed.\n\n**Step 4: Try to reproduce the error**\n\n* Run the code with a debugger, such", "metrics": { "length": 1206, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 6, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "AI Agent Contributor Engagement — Lightweight Retention Strategy (contributor-engagement-retention)", "condition": "with_lesson", "status": 200, "content": "To implement the suggested fixes, you'll need to have a GitHub repository and a basic understanding of GitHub Actions. Here's a step-by-step guide:\n\n**1. Automated thank-you comment**\n\nYou can use GitHub Actions to automate the thank-you comment. Create a new file in your repository's `.github/workflows` directory called `thank-you-comment.yml`. Add the following code:\n\n```yaml\nname: Thank You Comment\n\non:\n pull_request:\n types: [closed]\n\njobs:\n thank-you-comment:\n runs-on: ubuntu-latest\n steps:\n - name: Thank You Comment\n uses: actions/github-script@v6\n with:\n github-token: ${{ secrets.GITHUB_TOKEN }}\n script: |\n const gh = new GitHub();\n gh.authenticate({\n type: 'token',\n token: github.token\n });\n const pr = gh.pulls.get({ owner: context.repo.owner, repo: context.repo.repo, number: context.result.data.pull_request.number });\n const contributor = pr.user.login;\n const prComment = `Solid addition — the Lock gating and persistent connection pattern makes the telemetry pipeline genuinely robust under concurrent access.`; // Change this to a different comment each time\n gh.issues.create", "metrics": { "length": 1251, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 3, "lesson_hits": 5, "lesson_hit_rate": 0.833 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "GitHub Actions Script Injection — Use env Variables Instead of Inline Interpolation (github-actions-code-injection)", "condition": "plain", "status": 200, "content": "**Fixing GitHub Actions Script Injection Vulnerability**\n\nThe GitHub Actions Script Injection vulnerability occurs when secrets or sensitive information are exposed in the workflow file. To fix this, you should use environment variables instead of inline interpolation.\n\n**Step 1: Create a new GitHub Actions secrets**\n\n1. Go to your repository settings on GitHub.\n2. Click on \"Actions\" in the left-hand menu.\n3. Scroll down to the \"Secrets\" section.\n4. Click on \"New secret\".\n5. Add a name for your secret (e.g., `API_KEY`) and its value.\n6. Click on \"Add secret\".\n\n**Step 2: Use environment variables in your GitHub Actions workflow**\n\nReplace the inline interpolation with the environment variable.\n\n**Before (inline interpolation):**\n```yaml\nname: My Workflow\n\non:\n push:\n branches: [ main ]\n\njobs:\n build:\n runs-on: ubuntu-latest\n steps:\n - name: Checkout code\n uses: actions/checkout@v2\n - name: Run script\n run: |\n echo \"API_KEY=${GITHUB_TOKEN}\" >> token.txt\n cat token.txt\n```\n\n**After (using environment variables):**\n```yaml\nname: My Workflow\n\n", "metrics": { "length": 1107, "commands": 1, "command_list": [ "**After (using environment variables):**" ], "has_command_block": true, "actionable": true, "inline_code_count": 3, "lesson_hits": 1, "lesson_hit_rate": 0.167 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Search-first roadmap loop for agent knowledge projects (search-first-roadmap-loop)", "condition": "with_lesson", "status": 200, "content": "To fix the \"Search-first roadmap loop for agent knowledge projects\" issue, follow these steps:\n\n**Step 1: Separate Messages for Different Audiences**\n\nCreate separate files or sections for the two audiences:\n\n* `README.md` for maintainers and contributors\n* `HOME.md` or `INDEX.md` for agent and tool users\n\n**Step 2: Use a Layered Message**\n\nIn `README.md`, focus on providing direction and high-level information for maintainers and contributors:\n\n```markdown\n# Agent Knowledge Project\n\n## Direction\n\n* Issues: [list of issues](https://example.com/issues)\n* Acceptance Criteria: [list of acceptance criteria](https://example.com/acceptance-criteria)\n* Release Metrics: [release metrics](https://example.com/release-metrics)\n* Roadmap: [project roadmap](https://example.com/roadmap)\n```\n\nIn `HOME.md` or `INDEX.md`, focus on providing a low-friction path for agent and tool users:\n\n```markdown\n# Get Started with Agent Knowledge Project\n\n## Clone and Search\n\n1. Clone the repository: `git clone https://example.com/agent-knowledge-project.git`\n2. Search for lessons: `python -m search_first local-search`\n3. Re", "metrics": { "length": 1111, "commands": 1, "command_list": [ "In `HOME.md` or `INDEX.md`, focus on providing a low-friction path for agent and tool users:" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Accidental __pycache__ artifacts committed to a data repository (accidental-pycache-commit)", "condition": "with_lesson", "status": 200, "content": "Here's a step-by-step guide to fix the accidental __pycache__ artifacts committed to a data repository:\n\n**Step 1: Remove the staged artifacts and __pycache__ directories from the disk**\n\n```bash\ngit rm --cached -r __pycache__ 2>/dev/null || true\ngit rm -r --cached '.pyc' 2>/dev/null || true\nrm -rf __pycache__\n```\n\n**Step 2: Create a .gitignore file to prevent recurrence**\n\n```bash\necho \"__pycache__/\" >> .gitignore\necho \".pyc\" >> .gitignore\n```\n\n**Step 3: Re-stage only the intended files and commit the changes**\n\n```bash\ngit add references/offers/sdks.csv\ngit commit -m \"fix: remove committed pycache artifacts\"\n```\n\n**Step 4: Verify the diff contains only intended changes**\n\n```bash\ngit status --short | grep -v __pycache__ | head -5\ncat .gitignore 2>/dev/null | grep -c __pycache__ || echo 0\n```\n\nThis should give you a clean diff with no __pycache__ artifacts. The first command checks the status of the repository", "metrics": { "length": 924, "commands": 9, "command_list": [ "git rm --cached -r __pycache__ 2>/dev/null || true", "git rm -r --cached '.pyc' 2>/dev/null || true", "rm -rf __pycache__", "echo \"__pycache__/\" >> .gitignore", "echo \".pyc\" >> .gitignore" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Accidental __pycache__ artifacts committed to a data repository (accidental-pycache-commit)", "condition": "plain", "status": 200, "content": "The `__pycache__` directory is a cache directory that stores compiled Python bytecode for the current Python version. It's not necessary to include this directory in your version control system.\n\nHere's a step-by-step fix to remove the `__pycache__` directory from your Git repository:\n\n1. **Delete the `__pycache__` directory** from your local repository:\n\n```bash\nrm -rf __pycache__\n```\n\n2. **Remove the `__pycache__` directory from your Git index** (stage the removal):\n\n```bash\ngit rm -r --cached __pycache__\n```\n\n3. **Commit the changes** to reflect the removal of the `__pycache__` directory:\n\n```bash\ngit commit -m \"Remove accidental __pycache__ commit\"\n```\n\n4. **Push the changes** to your remote repository:\n\n```bash\ngit push origin \n```\n\nReplace `` with the actual name of the branch you're working on.\n\nBy following these steps, you should be able to remove the `__pycache__` directory from your Git repository and avoid any potential issues related to accidental commits.", "metrics": { "length": 1009, "commands": 4, "command_list": [ "rm -rf __pycache__", "git rm -r --cached __pycache__", "git commit -m \"Remove accidental __pycache__ commit\"", "git push origin " ], "has_command_block": true, "actionable": false, "inline_code_count": 14, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Search-first roadmap loop for agent knowledge projects (search-first-roadmap-loop)", "condition": "plain", "status": 200, "content": "The \"search-first-roadmap-loop\" error typically occurs when there's a circular dependency in the knowledge graph of your agent. This can happen when you have a project that references another project which in turn references the first project. To fix this issue, you can try the following steps:\n\n### 1. Check your knowledge graph\n\nRun the following command to view the knowledge graph:\n```bash\ndialogflow agent export --project-id --output-path \n```\nThis command will export the knowledge graph to a JSON file. You can then use a tool like `jq` to inspect the graph.\n\n### 2. Identify the circular dependency\n\nLook for projects that reference each other. You can use the following command to find the projects that reference a given project:\n```bash\ndialogflow agent get-project-versions --project-id --project-version --output-path \n```\nThis command will export the project versions to a JSON file. You can then use `jq` to find the projects that reference a given project.\n\n### 3. Break the circular dependency\n\nTo break the circular dependency, you can try the following:\n\n* Remove the reference to the other project from the project that's", "metrics": { "length": 1215, "commands": 2, "command_list": [ "dialogflow agent export --project-id --output-path ", "dialogflow agent get-project-versions --project-id --project-version --output-path " ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Agent-first node registration via MCP (agent-first-node-registration-via-mcp)", "condition": "plain", "status": 200, "content": "**Agent-First Node Registration via MCP**\n\nTo fix the issue with agent-first node registration via MCP, you'll need to ensure that the MCP (Multicast Protocol) is properly configured and the node registration process is enabled. Here are the concrete, actionable steps to resolve the issue:\n\n### Step 1: Verify MCP Configuration\n\n1. Check the MCP configuration file (`/etc/mcollective/mcollective.conf` on Linux) for the following settings:\n\t* `server` is set to the IP address or hostname of the MCP server.\n\t* `port` is set to the correct port number (default is 6161).\n\t* `mcast_addr` is set to the correct multicast IP address (default is `225.1.1.1`).\n\t* `mcast_port` is set to the correct multicast port number (default is 6161).\n2. Ensure that the MCP server is running and listening on the correct port.\n\n### Step 2: Verify Node Registration Configuration\n\n1. Check the node registration configuration file (`/etc/mcollective/client.conf` on Linux) for the following settings:\n\t* `server` is set to the IP address or hostname of the MCP server.\n\t* `port` is set to", "metrics": { "length": 1072, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 9, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Agent-first node registration via MCP (agent-first-node-registration-via-mcp)", "condition": "with_lesson", "status": 200, "content": "**Fix: Agent-First Node Registration via MCP**\n\nTo fix the agent-first node registration issue, you need to add the `misakanet_register` MCP tool. Here are the exact steps:\n\n### 1. Install Required Tools\n\nFirst, install the required tools using the following commands:\n\n```bash\npip3 install python-dotenv\n```\n\n### 2. Create a New MCP Tool\n\nCreate a new file `mcp/misakanet_register.py` with the following content:\n\n```python\nimport json\nimport os\nimport time\nimport uuid\nimport hashlib\n\nfrom misakacore import config\nfrom misakacore import mcp\n\n# Set the token expiration time in seconds\nTOKEN_EXPIRATION = 3600 # 1 hour\n\ndef register_node(agent_type):\n # Generate a unique node ID\n node_id = str(uuid.uuid4())\n\n # Generate a token using the node ID and a secret key\n secret_key = config.get(\"MISAKA_SECRET_KEY\")\n token = hashlib.sha256((node_id + secret_key).encode()).hexdigest()\n\n # Store the token in the key-value store for validation\n mcp.set(f\"token:{node_id}\", token)\n\n # Return the node", "metrics": { "length": 1020, "commands": 1, "command_list": [ "pip3 install python-dotenv" ], "has_command_block": true, "actionable": true, "inline_code_count": 4, "lesson_hits": 3, "lesson_hit_rate": 0.75 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Agent-Reach — Multi-Platform Internet Access for AI Agents (agent-reach-multi-platform-scraper)", "condition": "with_lesson", "status": 200, "content": "Based on the provided solution, here's a concrete, actionable fix to install Agent-Reach and configure it for Reddit and Twitter:\n\n**Step 1: Create a virtual environment and install Agent-Reach**\n\n```bash\n# Create a virtual environment\npython3 -m venv ~/.agent-reach-venv\n# Activate the virtual environment\nsource ~/.agent-reach-venv/bin/activate\n# Install Agent-Reach\npip install https://github.com/Panniantong/agent-reach/archive/main.zip\n```\n\n**Step 2: Install required tools for Reddit and Twitter**\n\n```bash\n# Install rdt-cli for Reddit\npip install rdt-cli\n# Install twitter-cli for Twitter\npip install twurl\n```\n\n**Step 3: Configure Agent-Reach for Reddit and Twitter**\n\n```bash\n# Install Agent-Reach with Reddit and Twitter channels\nagent-reach install --channels reddit,twitter\n```\n\n**Step 4: Configure proxy for Reddit (optional)**\n\n```bash\n# Install Agent-Reach with Reddit channel and proxy\nagent-reach install --channels reddit --proxy http://proxy:port\n```\n\n**Step 5: Check Agent-Reach status**\n\n```bash\n# Check Agent-Reach status", "metrics": { "length": 1043, "commands": 7, "command_list": [ "python3 -m venv ~/.agent-reach-venv", "source ~/.agent-reach-venv/bin/activate", "pip install https://github.com/Panniantong/agent-reach/archive/main.zip", "pip install rdt-cli", "pip install twurl" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 3, "lesson_hit_rate": 0.6 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Agent-Reach — Multi-Platform Internet Access for AI Agents (agent-reach-multi-platform-scraper)", "condition": "plain", "status": 200, "content": "However, I need more information about the error you're experiencing. The \"Agent-Reach\" project seems to be a Python-based multi-platform scraper for AI agents. \n\nTo assist you better, please provide the exact error message you're encountering. If not, I'll provide a general solution for common issues that might occur.\n\nAssuming you're experiencing a common issue such as a missing module or an incorrect installation, here are some general steps to troubleshoot and fix the issue:\n\n**Step 1: Check the Python Environment**\n\nMake sure you have the correct version of Python and pip installed. You can check this by running the following commands in your terminal:\n\n```bash\npython --version\npip --version\n```\n\n**Step 2: Install Required Modules**\n\nIf you're using a virtual environment, activate it first:\n\n```bash\n# For Linux/Mac\nsource /path/to/your/virtualenv/bin/activate\n\n# For Windows\n.\\path\\to\\your\\virtualenv\\Scripts\\activate\n```\n\nThen, install the required modules using pip:\n\n```bash\npip install -r requirements.txt\n```\n\n**Step 3: Update or Install Specific Modules**\n\nIf you encounter an issue with a specific module, you can update or install it", "metrics": { "length": 1158, "commands": 5, "command_list": [ "python --version", "pip --version", "source /path/to/your/virtualenv/bin/activate", ".\\path\\to\\your\\virtualenv\\Scripts\\activate", "pip install -r requirements.txt" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 3, "lesson_hit_rate": 0.6 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Agent Web Access Toolchain — 7 Libraries for Reliable Forum Scraping (agent-web-access-toolchain-selection)", "condition": "with_lesson", "status": 200, "content": "To fix the issue with AI agents hitting inconsistent results due to forum software detecting automated access via TLS fingerprint analysis, you can use the following libraries:\n\n**Tier 1: HTTP with browser TLS impersonation (lightweight, try first)**\n\n1. Install `curl_cffi` using pip:\n```bash\npip install curl_cffi\n```\n2. Replace the default `requests` library with `curl_cffi` in your Python script:\n```python\nfrom curl_cffi import requests\nr = requests.get(\"https://forum.example.com/\", impersonate=\"chrome\", timeout=15)\nprint(r.status_code, len(r.text))\n```\n**Tier 2:**\n\nIf `curl_cffi` doesn't work, you can try using `scrapling`:\n\n1. Install `scrapling` using pip:\n```bash\npip install scrapling\n```\n2. Use the `Fetcher` class from `scrapling` to make a GET request:\n```python\nfrom scrapling import Fetcher\nfetcher = Fetcher(auto_match=False)\npage = fetcher.get(\"https://forum.example.com/\", timeout=15)\nprint(page.status, len(page.body))\n```\nNote: In `scrapling`, use `.body` instead", "metrics": { "length": 988, "commands": 5, "command_list": [ "pip install curl_cffi", "**Tier 2:**", "If `curl_cffi` doesn't work, you can try using `scrapling`:", "1. Install `scrapling` using pip:", "2. Use the `Fetcher` class from `scrapling` to make a GET request:" ], "has_command_block": true, "actionable": true, "inline_code_count": 17, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Aider CLI --api-key parameter leaks API key to history files (aider-api-key-leak)", "condition": "with_lesson", "status": 200, "content": "**Fixing the Aider CLI API Key Leak Vulnerability**\n\nTo fix the Aider CLI API key leak vulnerability, we'll use a combination of environment variables and command-line argument masking. Here are the steps:\n\n### 1. Set the API Key as an Environment Variable\n\nInstead of passing the API key as a command-line argument, we'll set it as an environment variable. This way, the key won't be exposed in shell history files or the Aider chat history file.\n\n**On Linux/Mac:**\n\n```bash\nexport AIDER_API_KEY=sk-ant-api03-XXXXXXXXXXXXXXXXXXXX\n```\n\n**On Windows (Command Prompt):**\n\n```cmd\nset AIDER_API_KEY=sk-ant-api03-XXXXXXXXXXXXXXXXXXXX\n```\n\n**On Windows (PowerShell):**\n\n```powershell\n$env:AIDER_API_KEY = \"sk-ant-api03-XXXXXXXXXXXXXXXXXXXX\"\n```\n\n### 2. Update the Aider CLI Command\n\nNow that we've set the API key as an environment variable, we can update the Aider CLI command to use it.\n\n```bash\naider --model claude-3-5-sonnet\n```\n\nNote that we've removed the `--api-key` argument, as", "metrics": { "length": 981, "commands": 3, "command_list": [ "export AIDER_API_KEY=sk-ant-api03-XXXXXXXXXXXXXXXXXXXX", "**On Windows (PowerShell):**", "Now that we've set the API key as an environment variable, we can update the Aider CLI command to use it." ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 5, "lesson_hit_rate": 0.833 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Aider via LiteLLM rejects standard Anthropic model names (aider-litellm-model-name-rejection)", "condition": "with_lesson", "status": 200, "content": "To fix the error \"Aider via LiteLLM rejects standard Anthropic model names (aider-litellm-model-name-rejection)\", you need to use the full model path with the provider prefix when calling the `aider` command. Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Replace the standard model name with the full model path**\n\nReplace the standard model name `claude-sonnet-4-6` with the full model path `anthropic/claude-sonnet-4-6`.\n\n**Step 2: Update the `aider` command**\n\nUpdate the `aider` command to use the full model path with the provider prefix:\n```bash\naider --api-key \"anthropic=$KEY\" --model anthropic/claude-sonnet-4-6\n```\n**Verification**\n\nRun the updated `aider` command and verify that it completes without error:\n```bash\naider --api-key \"anthropic=$KEY\" --model anthropic/claude-sonnet-4-6\necho \"Verification passed: fix command exited 0\"\n```\n**Expected Output**\n\nThe command should complete without error, and the expected output should be:\n```\nVerification", "metrics": { "length": 984, "commands": 3, "command_list": [ "aider --api-key \"anthropic=$KEY\" --model anthropic/claude-sonnet-4-6", "aider --api-key \"anthropic=$KEY\" --model anthropic/claude-sonnet-4-6", "echo \"Verification passed: fix command exited 0\"" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 2, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Agent Web Access Toolchain — 7 Libraries for Reliable Forum Scraping (agent-web-access-toolchain-selection)", "condition": "plain", "status": 200, "content": "However, I need more information about the error you're encountering. The \"Agent Web Access Toolchain\" is a general term and doesn't provide enough context for a specific solution. \n\nThat being said, if you're experiencing issues with the toolchain, here are some general steps you can take to troubleshoot and potentially fix the problem:\n\n**Step 1: Check the documentation**\n\n1. Visit the official documentation for the Agent Web Access Toolchain.\n2. Review the installation and setup instructions.\n3. Look for any known issues or troubleshooting guides.\n\n**Step 2: Verify dependencies**\n\n1. Check the toolchain's documentation for required dependencies (e.g., libraries, frameworks).\n2. Ensure you have the correct versions installed.\n3. Update or install dependencies as needed.\n\n**Step 3: Check library versions**\n\n1. If you're using a Python-based toolchain, run `pip list` to check the installed library versions.\n2. Compare the versions with the recommended or required versions in the documentation.\n3. Update or install the correct library versions.\n\n**Step 4: Run the toolchain with debug flags**\n\n1. Run the toolchain with debug flags enabled (e.g., `python -m toolchain --debug`).\n2. This will", "metrics": { "length": 1206, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 2, "lesson_hits": 5, "lesson_hit_rate": 0.833 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Aider CLI --api-key parameter leaks API key to history files (aider-api-key-leak)", "condition": "plain", "status": 200, "content": "**Fixing the Aider CLI API Key Leak Issue**\n\nThe `aider-api-key-leak` error occurs because the `--api-key` parameter is not properly masked in the Aider CLI, causing the API key to be stored in history files. To fix this issue, you can use the `stty` command to mask the input.\n\n**Step 1: Run the following command to mask the input**\n\n```bash\nstty -echo\n```\n\nThis command will disable the echoing of input characters, effectively masking the API key.\n\n**Step 2: Enter the `--api-key` parameter**\n\n```bash\nAider CLI --api-key\n```\n\nEnter your API key when prompted.\n\n**Step 3: Run the following command to re-enable echoing**\n\n```bash\nstty echo\n```\n\nThis command will re-enable the echoing of input characters, restoring the normal behavior.\n\n**Alternative Solution**\n\nIf you prefer not to use the `stty` command, you can also use the `read -s` command to mask the input. Here's how:\n\n```bash\nread -s -p \"Enter API key: \" api_key\nAider CLI --api-key $api_key\n```\n\nThis will mask the input and store", "metrics": { "length": 997, "commands": 5, "command_list": [ "stty -echo", "Aider CLI --api-key", "stty echo", "read -s -p \"Enter API key: \" api_key", "Aider CLI --api-key $api_key" ], "has_command_block": true, "actionable": true, "inline_code_count": 13, "lesson_hits": 1, "lesson_hit_rate": 0.167 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Aider via LiteLLM rejects standard Anthropic model names (aider-litellm-model-name-rejection)", "condition": "plain", "status": 200, "content": "The \"aider-litellm-model-name-rejection\" error occurs when the Aider via LiteLLM model name does not match the expected format. The expected format is \"aider-litellm-model-name--\".\n\nTo fix this error, you need to update the model name to match the expected format. Here are the concrete, actionable steps:\n\n**Step 1: Get the model ID and model hash**\n\nYou can get the model ID and model hash from the LiteLLM model repository or from the model's metadata. For example, if you are using the Anthropic model \"text-davinci-003\", you can get the model ID and model hash as follows:\n\n```bash\ncurl -s https://api.lit-llm.com/models | jq '.[] | {id, hash}'\n```\n\nThis will output the model ID and model hash in JSON format.\n\n**Step 2: Update the model name**\n\nUpdate the model name to match the expected format: \"aider-litellm-model-name--\". For example, if the model ID is \"text-davinci-003\" and the model hash is \"abc123\", the updated model name", "metrics": { "length": 983, "commands": 1, "command_list": [ "curl -s https://api.lit-llm.com/models | jq '.[] | {id, hash}'" ], "has_command_block": true, "actionable": false, "inline_code_count": 1, "lesson_hits": 2, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Aider --show-repo-map crashes on Windows with UnicodeEncodeError (aider-windows-unicode-error)", "condition": "with_lesson", "status": 200, "content": "To fix the UnicodeEncodeError on Windows when running `aider --show-repo-map`, follow these steps:\n\n**Method 1: Using Bash**\n\n1. Open your terminal or command prompt.\n2. Type the following command to set the encoding to UTF-8:\n```bash\nset PYTHONIOENCODING=utf-8\n```\n3. Now, run the `aider` command:\n```bash\naider --show-repo-map\n```\nThis should fix the UnicodeEncodeError issue.\n\n**Method 2: Using PowerShell**\n\n1. Open PowerShell.\n2. Type the following command to set the encoding to UTF-8:\n```powershell\n$env:PYTHONIOENCODING = \"utf-8\"\n```\n3. Now, run the `aider` command:\n```powershell\naider --show-repo-map\n```\nThis should fix the UnicodeEncodeError issue.\n\n**Verification**\n\nTo verify that the fix works, you can add a command to print a success message:\n```bash\nset PYTHONIOENCODING=utf-8\necho \"Verification passed: fix command exited 0\"\n```\nThis should print \"Verification passed: fix command exited 0\" if the `aider` command completes without", "metrics": { "length": 950, "commands": 6, "command_list": [ "set PYTHONIOENCODING=utf-8", "aider --show-repo-map", "3. Now, run the `aider` command:", "This should fix the UnicodeEncodeError issue.", "**Verification**" ], "has_command_block": true, "actionable": true, "inline_code_count": 13, "lesson_hits": 5, "lesson_hit_rate": 0.833 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Aider --show-repo-map crashes on Windows with UnicodeEncodeError (aider-windows-unicode-error)", "condition": "plain", "status": 200, "content": "To fix the UnicodeEncodeError in Aider on Windows, you need to update the encoding settings in the Aider configuration file. Here's a step-by-step guide:\n\n**Step 1: Update the Aider configuration file**\n\nOpen a terminal or command prompt and navigate to the Aider configuration directory. The default location is `~/.aider/` on Linux and macOS, but on Windows, it's usually `C:\\Users\\\\.aider\\`. If you can't find the directory, you can try running `aider --config-dir` to print the path.\n\nEdit the `aider.yml` file in the configuration directory using a text editor like Notepad++ or Visual Studio Code.\n\n**Step 2: Update the encoding settings**\n\nAdd the following lines to the `aider.yml` file:\n```yml\nencoding:\n default: utf-8\n console: utf-8\n```\nThis sets the default encoding to UTF-8, which is a widely supported encoding that can handle most Unicode characters.\n\n**Step 3: Save the changes**\n\nSave the `aider.yml` file. If you're using a text editor, make sure to save the file with the correct encoding (UTF-8).\n\n**Step", "metrics": { "length": 1038, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 7, "lesson_hits": 3, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Internal Gateway — Incompatible with Anthropic Format, Requires OpenAI Proxy (anthropic-proxy-internal-gateway)", "condition": "with_lesson", "status": 200, "content": "To fix the issue, you need to run a format conversion proxy on your local machine. Here are the exact steps:\n\n**Step 1: Install the required dependencies**\n\nYou will need to install the `node` and `npm` (Node Package Manager) if you haven't already. You can download the latest version from the official website: https://nodejs.org/en/download/\n\n**Step 2: Clone the Anthropic Proxy repository**\n\nOpen your terminal and run the following command:\n```bash\ngit clone https://github.com/anthropic/anthropic-proxy.git\n```\nThis will clone the Anthropic Proxy repository to a directory named `anthropic-proxy` in your current working directory.\n\n**Step 3: Install dependencies and run the proxy**\n\nNavigate to the cloned repository directory:\n```bash\ncd anthropic-proxy\n```\nInstall the required dependencies:\n```bash\nnpm install\n```\nStart the proxy:\n```bash\nnpm start\n```\nThis will start the proxy on `localhost:8765`. You can verify this by opening a web browser and navigating to `http://localhost:8765`. You should see a message indicating that the proxy is running.\n\n**Step 4: Configure your application to use the proxy**\n\nIn your application,", "metrics": { "length": 1141, "commands": 4, "command_list": [ "git clone https://github.com/anthropic/anthropic-proxy.git", "cd anthropic-proxy", "npm install", "npm start" ], "has_command_block": true, "actionable": true, "inline_code_count": 12, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "An Unlikely Database Migration: From JSON Files to etcd (an-unlikely-database-migration)", "condition": "with_lesson", "status": 200, "content": "**Fixing the Unlikely Database Migration: From JSON Files to etcd**\n\n**Step 1: Install etcd**\n\nBefore you start, you need to install etcd. You can install it using the following command:\n\n```bash\n# Install etcd on Ubuntu/Debian\nsudo apt-get update\nsudo apt-get install etcd\n\n# Install etcd on CentOS/RHEL\nsudo yum install etcd\n\n# Install etcd on macOS (using Homebrew)\nbrew install etcd\n```\n\n**Step 2: Create a new etcd cluster**\n\nCreate a new etcd cluster with the following command:\n\n```bash\n# Start a new etcd cluster\netcd --listen-peer-urls http://localhost:2380 --listen-client-urls http://localhost:2379,http://localhost:4001 --advertise-client-urls http://localhost:2379 --discovery \"\" --data-dir /var/lib/etcd\n```\n\n**Step 3: Update the Go data model**\n\nUpdate the Go data model to use etcd as the persistence layer. You can use the following code as an example:\n\n```go\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"time\"\n\n\t\"github.com/coreos/etcd", "metrics": { "length": 944, "commands": 5, "command_list": [ "sudo apt-get update", "sudo apt-get install etcd", "sudo yum install etcd", "brew install etcd", "etcd --listen-peer-urls http://localhost:2380 --listen-client-urls http://localhost:2379,http://localhost:4001 --advertise-client-urls http://localhost:2379 --discovery \"\" --data-dir /var/lib/etcd" ], "has_command_block": true, "actionable": true, "inline_code_count": 4, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "An Unlikely Database Migration: From JSON Files to etcd (an-unlikely-database-migration)", "condition": "plain", "status": 200, "content": "**An Unlikely Database Migration: From JSON Files to etcd**\n\nIn this scenario, we're migrating from storing data in JSON files to using etcd, a distributed key-value store. This migration will involve writing data from JSON files to etcd.\n\n### Step 1: Install etcd\n\nFirst, we need to install etcd on our system. We'll use the official etcd Docker image for this example.\n\n```bash\n# Pull the etcd Docker image\ndocker pull etcd:latest\n\n# Run etcd in a container\ndocker run -d --name etcd \\\n -p 2379:2379 -p 2380:2380 \\\n --volume=/etcd-data:/etcd-data \\\n etcd:latest --data-dir=/etcd-data\n```\n\n### Step 2: Install the etcd Client Library\n\nNext, we need to install the etcd client library for our programming language of choice. For this example, we'll use Go.\n\n```bash\n# Install the etcd Go client library\ngo get github.com/coreos/etcd/cmd/etcd\ngo get github.com/coreos/etcd/clientv3\n```\n\n### Step 3: Write a Script to Migrate", "metrics": { "length": 926, "commands": 7, "command_list": [ "docker pull etcd:latest", "docker run -d --name etcd \\", "-p 2379:2379 -p 2380:2380 \\", "--volume=/etcd-data:/etcd-data \\", "etcd:latest --data-dir=/etcd-data" ], "has_command_block": true, "actionable": true, "inline_code_count": 3, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Internal Gateway — Incompatible with Anthropic Format, Requires OpenAI Proxy (anthropic-proxy-internal-gateway)", "condition": "plain", "status": 200, "content": "To resolve the \"Internal Gateway — Incompatible with Anthropic Format, Requires OpenAI Proxy (anthropic-proxy-internal-gateway)\" error, you need to use the OpenAI proxy. Here are the steps to fix this issue:\n\n**Step 1: Install the OpenAI proxy library**\n\nYou can install the OpenAI proxy library using pip:\n```bash\npip install openai-proxy\n```\n**Step 2: Set up the OpenAI proxy**\n\nYou can set up the OpenAI proxy by creating a configuration file. Create a new file named `.openai-proxy.json` in your home directory (or any other directory of your choice) with the following content:\n```json\n{\n \"proxy_url\": \"https://api.openai.com/v1/proxy\"\n}\n```\nThis configuration file tells the OpenAI proxy to use the OpenAI API as the proxy.\n\n**Step 3: Set the environment variable**\n\nSet the `OPENAI_PROXY_CONFIG` environment variable to the path of the configuration file you created in Step 2:\n```bash\nexport OPENAI_PROXY_CONFIG=~/.openai-proxy.json\n```\n**Step 4: Use the OpenAI proxy**\n\nWhen making requests to the Anthropic API, use the OpenAI proxy by setting", "metrics": { "length": 1054, "commands": 4, "command_list": [ "pip install openai-proxy", "This configuration file tells the OpenAI proxy to use the OpenAI API as the proxy.", "**Step 3: Set the environment variable**", "Set the `OPENAI_PROXY_CONFIG` environment variable to the path of the configuration file you created in Step 2:" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "api gateway anthropic incompatibility (api-gateway-anthropic-incompatibility)", "condition": "plain", "status": 200, "content": "The \"api-gateway-anthropic-incompatibility\" error typically occurs when there's an incompatibility between the Anthos API Gateway and the underlying Anthos Service Mesh (ASM) configuration. Here's a step-by-step guide to troubleshoot and fix the issue:\n\n**Prerequisites:**\n\n1. Ensure you have Anthos Service Mesh (ASM) installed and running in your cluster.\n2. Verify that the Anthos API Gateway is installed and configured correctly.\n\n**Troubleshooting steps:**\n\n1. **Check the ASM configuration:** Run the following command to check the ASM configuration:\n```bash\ngcloud anthos config mesh describe --cluster \n```\nReplace `` with the name of your cluster.\n\nThis command will display the ASM configuration, including the API Gateway settings. Check for any discrepancies or errors in the configuration.\n\n2. **Verify the API Gateway configuration:** Run the following command to check the API Gateway configuration:\n```bash\ngcloud api-gateway gateways describe --location --gateway \n```\nReplace `` with the location of your API Gateway and `` with the ID of your API Gateway.\n\nThis command will display the API Gateway configuration.", "metrics": { "length": 1206, "commands": 2, "command_list": [ "gcloud anthos config mesh describe --cluster ", "gcloud api-gateway gateways describe --location --gateway " ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "api gateway anthropic incompatibility (api-gateway-anthropic-incompatibility)", "condition": "with_lesson", "status": 200, "content": "To fix the `api gateway anthropic incompatibility` error, follow these steps:\n\n### Step 1: Identify the issue\n\nThe error occurs when using the Anthropic provider with the internal-gateway.local API, which returns a 400 error. This is because the internal-gateway.local API endpoint only accepts OpenAI format requests, not the native Anthropic format.\n\n### Step 2: Update the provider configuration in `config.yaml`\n\nEdit the `config.yaml` file to change the provider configuration to use the OpenAI compatible format:\n\n```bash\n# Replace the existing provider configuration\nsed -i 's/provider: anthropic/provider: openai/g' config.yaml\nsed -i 's/api_base: https:\\/\\/api.internal-gateway.local\\/v1\\/messages/api_base: https:\\/\\/api.internal-gateway.local\\/v1\\/chat\\/completions/g' config.yaml\n```\n\n### Step 3: Verify the changes\n\nRun the following command to verify the changes:\n\n```bash\necho \"Lesson: api gateway anthropic incompatibility\"\nwc -l lessons/contrib/api-gateway-anthropic-incompatibility.md\n```\n\n### Alternative solution: Configure a proxy transformation layer in Hermes Gateway\n\nIf you cannot update the `config.yaml", "metrics": { "length": 1129, "commands": 4, "command_list": [ "sed -i 's/provider: anthropic/provider: openai/g' config.yaml", "sed -i 's/api_base: https:\\/\\/api.internal-gateway.local\\/v1\\/messages/api_base: https:\\/\\/api.internal-gateway.local\\/v1\\/chat\\/completions/g' config.yaml", "echo \"Lesson: api gateway anthropic incompatibility\"", "wc -l lessons/contrib/api-gateway-anthropic-incompatibility.md" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 3, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "api rate limit handling best practices (api-rate-limit-handling-best-practices)", "condition": "plain", "status": 200, "content": "**API Rate Limit Handling Best Practices**\n\nWhen dealing with API rate limits, it's essential to handle them properly to avoid errors and improve the user experience. Here are some best practices and a concrete, actionable fix:\n\n**Best Practices:**\n\n1. **Implement exponential backoff**: When the API rate limit is exceeded, implement an exponential backoff strategy to retry the request after a certain interval.\n2. **Use a caching layer**: Use a caching layer to store the API responses and reduce the number of requests to the API.\n3. **Handle rate limit errors**: Handle rate limit errors explicitly and provide a clear error message to the user.\n4. **Monitor API rate limits**: Monitor the API rate limits and adjust the application's behavior accordingly.\n\n**Concrete, Actionable Fix:**\n\nLet's assume you're using Python and the `requests` library to make API requests. You can implement the following code to handle API rate limits:\n```python\nimport requests\nimport time\nimport logging\n\n# Set up logging\nlogging.basicConfig(level=logging.INFO)\n\n# Set the API endpoint and rate limit\nAPI_ENDPOINT = \"https://api.example.com/endpoint\"\nRATE_LIMIT = 100 # requests per minute\n\ndef make_request(url, params=None):\n # Initialize the retry", "metrics": { "length": 1243, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 1, "lesson_hits": 3, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "api rate limit handling best practices (api-rate-limit-handling-best-practices)", "condition": "with_lesson", "status": 200, "content": "To implement the solution, we will follow these steps:\n\n**Step 1: Pilot Testing**\n\nFirst, we need to test the API limit threshold using a small batch of requests. We will use the `pilot_test` function provided in the solution.\n\n```python\nimport time\nimport requests\n\ndef pilot_test(api_url, headers, sample_size=100, rate_per_second=5):\n \"\"\"用小批量测试API限流阈值\"\"\"\n success = 0\n rate_limited = 0\n interval = 1.0 / rate_per_second\n\n for i in range(sample_size):\n resp = requests.get(api_url, headers=headers)\n if resp.status_code == 200:\n success += 1\n elif resp.status_code == 429:\n rate_limited += 1\n print(f\"触发限流于第 {i+1} 次请求,当前速率: {rate_per_second} req/s\")\n break\n time.sleep(interval)\n\n print(f\"成功: {success}, 限流: {rate_limited}\")\n\n# Replace api_url and headers with your actual API URL and headers\napi_url = \"https://example.com/api/endpoint\"\nheaders = {\"Authorization\":", "metrics": { "length": 957, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 1, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "API 请求限流 (Rate Limit) 处理方案 (api-rate-limit-handling)", "condition": "with_lesson", "status": 200, "content": "To fix the error and implement the rate limit handling scheme, you can follow these steps:\n\n**Step 1: Install the required library**\n\nYou need to install the `requests` library if you haven't already. You can do this by running the following command in your terminal:\n\n```bash\npip install requests\n```\n\n**Step 2: Implement the rate limit handling function**\n\nCreate a new file called `api_handler.py` and add the following code:\n\n```python\nimport time\nimport requests\n\ndef api_call_with_retry(url, headers, max_retries=5):\n for i in range(max_retries):\n resp = requests.get(url, headers=headers)\n \n if resp.status_code == 200:\n return resp.json()\n \n if resp.status_code == 429:\n wait = int(resp.headers.get(\"Retry-After\", 2 * i))\n print(f\"限流,等待 {wait} 秒后重试...\")\n time.sleep(wait)\n continue\n \n # 其他错误不重试\n resp.raise_for_status()\n \n raise Exception(f\"超过最大重试次数: {url}\")\n\ndef check_rate_limit(url, headers):\n resp = requests.get(url, headers=headers)\n data = resp.json", "metrics": { "length": 1090, "commands": 1, "command_list": [ "pip install requests" ], "has_command_block": true, "actionable": true, "inline_code_count": 4, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Moorcheh API Auth Header Bug (auth-header-bug)", "condition": "with_lesson", "status": 200, "content": "**Fixing the Moorcheh API Auth Header Bug**\n\nTo fix the Moorcheh API Auth Header Bug, follow these steps:\n\n### Step 1: Verify the API Documentation\n\nBefore making any changes, verify the API documentation to ensure you understand the expected format for the authentication header.\n\n### Step 2: Update the Auth Header\n\nUpdate the auth header to include the proper `Bearer` prefix. In Python, this can be done as follows:\n```python\nimport requests\n\n# Replace 'your_token' with the actual token\ntoken = 'your_token'\n\nheaders = {\n \"Authorization\": f\"Bearer {token}\",\n \"Content-Type\": \"application/json\"\n}\n```\n### Step 3: Add Validation for Missing Tokens\n\nAdd validation to ensure the token exists before sending requests. You can do this by checking if the `token` variable is not empty:\n```python\nif not token:\n print(\"Error: Token is missing\")\n # Handle the error or raise an exception\nelse:\n headers = {\n \"Authorization\": f\"Bearer {token}\",\n \"Content-Type\": \"application/json\"\n }\n # Send the request with the updated headers\n```\n### Step 4: Add Error Handling for Missing Tokens\n\nAdd error", "metrics": { "length": 1124, "commands": 1, "command_list": [ "Add validation to ensure the token exists before sending requests. You can do this by checking if the `token` variable is not empty:" ], "has_command_block": true, "actionable": false, "inline_code_count": 5, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Python asyncio CancelledError Silently Swallows Resources in Long-Running Services (asyncio-cancellederror-swallows-resources)", "condition": "with_lesson", "status": 200, "content": "**Fixing Resource Leaks in Long-Running Asyncio Services**\n\n### Problem Description\n\nWhen an asyncio task is cancelled, the `CancelledError` is raised inside the coroutine. If the coroutine doesn't properly handle cleanup in a `finally` block or the exception handler catches and ignores `CancelledError`, resources held by the task (file handles, connections, locks) are never released.\n\n### Solution\n\nUse `task.add_done_callback()` to check for `CancelledError` and clean up resources explicitly before the task is garbage collected.\n\n### Code Fix\n\n```python\nimport asyncio\n\nasync def fetch_data():\n \"\"\"Fetch data from a connection\"\"\"\n conn = await create_connection()\n try:\n return await conn.read()\n finally:\n # Cleanup on any exit\n await conn.close()\n\nasync def safe_task_wrapper(coro):\n \"\"\"Wrap a coroutine with cleanup on cancellation\"\"\"\n task = asyncio.create_task(coro)\n \n def cleanup_callback(task):\n \"\"\"Cleanup resources when the task is cancelled\"\"\"\n if task.cancelled():\n print(f\"Task {task.get_name()} was cancelled, cleaning up\")\n # Additional cleanup here\n # Close any file handles, release locks, etc.\n # For example:\n # await task.result()", "metrics": { "length": 1271, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 5, "lesson_hits": 5, "lesson_hit_rate": 0.833 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Python asyncio CancelledError Silently Swallows Resources in Long-Running Services (asyncio-cancellederror-swallows-resources)", "condition": "plain", "status": 200, "content": "**Fixing the `asyncio.CancelledError` Silently Swallows Resources in Long-Running Services Issue**\n\nThe issue arises when an `asyncio` task is cancelled, but the task does not properly handle the cancellation. This can lead to the task silently swallowing resources, causing unexpected behavior and potential memory leaks.\n\n**Step 1: Set `asyncio.CancelledError` to be a runtime error**\n\nTo ensure that `asyncio.CancelledError` is properly handled and does not silently swallow resources, we can set it to be a runtime error. This will force tasks to properly handle cancellation.\n\n```bash\npip install asyncio\n```\n\n**Step 2: Update your `asyncio` code to handle `asyncio.CancelledError`**\n\nIn your `asyncio` code, wrap the task with a `try-except` block to catch and handle `asyncio.CancelledError`.\n\n```python\nimport asyncio\n\nasync def long_running_task():\n try:\n # Your long-running task code here\n await asyncio.sleep(10)\n except asyncio.CancelledError:\n # Handle cancellation here\n print(\"Task cancelled\")\n finally:\n # Release any resources here\n print(\"Releasing resources\")\n\nasync def main():\n task", "metrics": { "length": 1158, "commands": 1, "command_list": [ "pip install asyncio" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "API 请求限流 (Rate Limit) 处理方案 (api-rate-limit-handling)", "condition": "plain", "status": 200, "content": "**API 请求限流 (Rate Limit) 处理方案**\n\n当 API 请求达到限流阈值时,会触发限流处理方案。以下是一个可行的解决方案:\n\n**步骤 1:安装限流库**\n\n首先,我们需要安装限流库。这里我们使用 `ratelimit` 库。\n\n```bash\npip install ratelimit\n```\n\n**步骤 2:配置限流**\n\n创建一个配置文件(例如 `config.py`)来存储限流配置。\n\n```python\n# config.py\nRATE_LIMIT = {\n 'max_requests': 100, # 最大请求数\n 'per': 60, # 时间窗口(秒)\n 'key': 'ip' # 限流关键字(IP 地址)\n}\n```\n\n**步骤 3:实现限流逻辑**\n\n创建一个限流类(例如 `rate_limiter.py`) 来实现限流逻辑。\n\n```python\n# rate_limiter.py\nfrom ratelimit import limits, RateLimitException\n\nclass RateLimiter:\n def __init__(self, config):\n self.config = config\n\n def limit(self, request", "metrics": { "length": 588, "commands": 3, "command_list": [ "pip install ratelimit", "**步骤 3:实现限流逻辑**", "创建一个限流类(例如 `rate_limiter.py`) 来实现限流逻辑。" ], "has_command_block": true, "actionable": false, "inline_code_count": 7, "lesson_hits": 3, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Moorcheh API Auth Header Bug (auth-header-bug)", "condition": "plain", "status": 200, "content": "The Moorcheh API Auth Header Bug (auth-header-bug) is a common issue in Flutter applications that use the `http` package for API calls. This bug occurs when the `Authorization` header is not properly set, causing the API to reject the request.\n\nHere's a concrete, actionable fix:\n\n**Step 1: Install the required packages**\n\nRun the following command in your terminal:\n```bash\nflutter pub add http\n```\nThis will add the `http` package to your project.\n\n**Step 2: Import the `http` package**\n\nIn your Dart file, add the following import statement:\n```dart\nimport 'package:http/http.dart' as http;\n```\n**Step 3: Set the `Authorization` header**\n\nWhen making an API call using the `http` package, set the `Authorization` header using the `headers` property:\n```dart\nFuture fetchUserData() async {\n final response = await http.get(\n Uri.parse('https://api.example.com/user'),\n headers: {\n 'Authorization': 'Bearer YOUR_API_TOKEN',\n },\n );\n\n if (response.statusCode == 200) {\n // Handle the response data\n } else {\n // Handle the error\n }\n}\n``", "metrics": { "length": 1068, "commands": 3, "command_list": [ "flutter pub add http", "**Step 3: Set the `Authorization` header**", "When making an API call using the `http` package, set the `Authorization` header using the `headers` property:" ], "has_command_block": true, "actionable": true, "inline_code_count": 13, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Benchmark Honesty — Distinguishing Simulated vs Real Results (benchmark-honesty-simulated-vs-real)", "condition": "plain", "status": 200, "content": "The \"Benchmark Honesty — Distinguishing Simulated vs Real Results\" error is likely related to the `benchmark-honesty-simulated-vs-real` benchmark in the `benchmark` crate. This benchmark is designed to test the honesty of benchmarking by comparing the results of a benchmark run with a simulated workload to the results of a benchmark run with a real workload.\n\nTo fix this error, you can try the following steps:\n\n1. **Update the `benchmark` crate**: Make sure you're using the latest version of the `benchmark` crate by running the following command in your terminal:\n ```bash\ncargo update\n```\n This command will update your `Cargo.toml` file to the latest version of the `benchmark` crate.\n\n2. **Check the `benchmark-honesty-simulated-vs-real` benchmark**: If you're still experiencing issues, try running the benchmark individually to see if it's the specific benchmark causing the issue. You can do this by running the following command:\n ```bash\ncargo bench --bench benchmark-honesty-simulated-vs-real\n```\n This will run the `benchmark-honesty-simulated-vs-real` benchmark and provide more detailed output about what's causing the issue.\n\n3. **", "metrics": { "length": 1158, "commands": 2, "command_list": [ "cargo update", "cargo bench --bench benchmark-honesty-simulated-vs-real" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Benchmark Honesty — Distinguishing Simulated vs Real Results (benchmark-honesty-simulated-vs-real)", "condition": "with_lesson", "status": 200, "content": "**Fixing the Benchmark Honesty Issue**\n\nTo fix the benchmark honesty issue, you need to follow these steps:\n\n### Step 1: Clearly Label What's Real vs Simulated\n\nIn your `benchmark.json` file, add the following information:\n\n```json\n{\n \"kind\": \"search_retrieval_probe\",\n \"simulated_execution\": true,\n \"note\": \"task_b_pass and ci_pr_compliance are simulated\"\n}\n```\n\nThis clearly indicates that the execution is simulated.\n\n### Step 2: Use Honest Framing\n\nWhen presenting your results, use honest framing. Instead of saying:\n\n* ❌ \"Benchmark shows +31% improvement with lessons\"\n* Use: ✅ \"Search retrieval probe shows lessons can be found for 5/5 scenarios\"\n\nThis reframes the result to focus on what was actually measured, rather than making a claim about the overall improvement.\n\n### Step 3: Separate Concerns\n\nCreate a table to separate the concerns:\n\n| Component | Real | Simulated |\n|-----------|------|-----------|\n| Lesson search | ✅ | — |\n| Task execution | ❌ | Hardcoded |\n| Result verification | ❌ | Hardcoded |\n\nThis table helps to identify what is real and what is simulated.\n\n###", "metrics": { "length": 1092, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 2, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "BGE Embedding Fallback Crash (bge-embedding-fallback-crash)", "condition": "plain", "status": 200, "content": "The BGE Embedding Fallback Crash is a known issue in the Blender Game Engine (BGE). Here's a concrete, actionable fix:\n\n**Method 1: Disable Embedding Fallback**\n\n1. Open your Blender project.\n2. Press `Ctrl + Shift + E` to open the Blender Game Engine editor.\n3. In the Game Logic section, click on the \"Logic\" tab.\n4. In the \"Logic\" tab, click on the \"Properties\" button.\n5. In the \"Properties\" window, scroll down to the \"Game Settings\" section.\n6. Uncheck the box next to \"Embedding Fallback\".\n\n**Method 2: Update Blender**\n\nIf Method 1 doesn't work, you may need to update Blender to the latest version. Here's how:\n\n1. Open Blender and click on the \"Help\" menu.\n2. Select \"Check for Updates\" from the drop-down menu.\n3. If an update is available, click on the \"Download and Install\" button.\n4. Follow the installation instructions to update Blender.\n\n**Method 3: Remove the \"Embedding Fallback\" script**\n\nIf you've created a custom script that uses the \"Embedding Fallback\" feature, you may need to remove it", "metrics": { "length": 1013, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 1, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "BGE Embedding Fallback Crash (bge-embedding-fallback-crash)", "condition": "with_lesson", "status": 200, "content": "**Fixing BGE Embedding Fallback Crash**\n\n**Step 1: Remove hard-coded absolute path and use environment variable**\n\nUpdate `skill_indexer.py` to use the `EMBEDDING_MODEL_PATH` environment variable:\n\n```python\nimport os\n\ndef _init_embedding_model():\n try:\n # Try to load the model from the environment variable\n model_path = os.environ.get('EMBEDDING_MODEL_PATH')\n if model_path:\n model = AutoModel.from_pretrained(model_path)\n else:\n # If the environment variable is not set, auto-download the model\n model = AutoModel.from_pretrained('bge-m3')\n except Exception as e:\n # Wrap loading failures in try/except and degrade to no-embedding mode\n print(f\"Error loading embedding model: {e}\")\n return None\n\n return model\n```\n\n**Step 2: Set the `EMBEDDING_MODEL_PATH` environment variable**\n\nSet the `EMBEDDING_MODEL_PATH` environment variable to the path where you want to store the BGE-m3 model cache:\n\n```bash\nexport EMBEDDING_MODEL_PATH=~/.cache/huggingface/bge-m3\n```\n\n**Step 3:", "metrics": { "length": 1066, "commands": 2, "command_list": [ "**Step 2: Set the `EMBEDDING_MODEL_PATH` environment variable**", "Set the `EMBEDDING_MODEL_PATH` environment variable to the path where you want to store the BGE-m3 model cache:" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 1, "lesson_hit_rate": 0.25 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "中文 BM25 搜索:滑动窗口子串加分与唯一候选加分 (bm25-chinese-sliding-window-tuning)", "condition": "with_lesson", "status": 200, "content": "To implement the fix, you need to modify your BM25 search function to include the sliding window boost and unique candidate boost. Here's a step-by-step guide:\n\n**Step 1: Modify the BM25 search function**\n\n```python\nimport math\n\ndef bm25_search(query, doc, k1=1.2, b=0.75, N=1000000, avgdl=1000):\n \"\"\"\n BM25 search function\n \"\"\"\n # Calculate BM25 score\n score = 0\n for token in query.split():\n tf = doc.count(token)\n idf = math.log((N - doc_freq[token] + 0.5) / (doc_freq[token] + 0.5))\n score += tf * idf / (tf + k1 * (1 - b + b * doc_len / avgdl))\n \n # Apply sliding window boost\n score += sliding_window_boost(query, doc)\n \n # Apply unique candidate boost\n score *= unique_candidate_boost(doc_freq, doc_freq[token])\n \n return score\n\ndef sliding_window_boost(query, doc, window_min=4, window_max=6, threshold=10):\n \"\"\"\n Sliding window boost function\n \"\"\"\n", "metrics": { "length": 929, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 0, "lesson_hits": 5, "lesson_hit_rate": 0.833 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "中文 BM25 搜索:滑动窗口子串加分与唯一候选加分 (bm25-chinese-sliding-window-tuning)", "condition": "plain", "status": 200, "content": "The error \"中文 BM25 搜索:滑动窗口子串加分与唯一候选加分 (bm25-chinese-sliding-window-tuning)\" is a Chinese error message that translates to \"Chinese BM25 search: sliding window substring scoring and unique candidate scoring\". This issue is likely related to the BM25 search algorithm used in your search engine.\n\nTo fix this issue, you can try the following steps:\n\n1. **Update your search engine's BM25 implementation**: Check if your search engine's BM25 implementation is up-to-date. You can try updating to the latest version of the BM25 algorithm or switching to a different implementation.\n\n2. **Check for compatibility issues**: Ensure that your search engine is compatible with the BM25 algorithm and the Chinese language. You can try using a different language model or adjusting the BM25 parameters.\n\n3. **Adjust BM25 parameters**: Try adjusting the BM25 parameters, such as the k1 and b values, to see if it resolves the issue.\n\n4. **Use a different search algorithm**: If the issue persists, consider using a different search algorithm, such as TF-IDF or BM25 with a different language model.\n\nHere are some concrete commands to help you fix the issue:\n\n**Step 1:", "metrics": { "length": 1157, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 1, "lesson_hit_rate": 0.167 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "BM25 + Vector Hybrid Search: configurable blending weights (bm25-vector-hybrid-search-weights)", "condition": "plain", "status": 200, "content": "To fix the error 'BM25 + Vector Hybrid Search: configurable blending weights (bm25-vector-hybrid-search-weights)', you need to update the Elasticsearch configuration to include the 'bm25-vector-hybrid-search-weights' parameter.\n\nHere are the exact commands to update the Elasticsearch configuration:\n\n**Method 1: Update Elasticsearch Configuration using Elasticsearch UI**\n\n1. Go to your Elasticsearch UI (e.g., `http://localhost:9200/_cluster/settings`).\n2. Click on the \"Update settings\" button.\n3. In the \"Update settings\" dialog box, add the following configuration:\n```json\n{\n \"index.search.slowlog.threshold.query.warn\": \"1s\",\n \"index.search.slowlog.threshold.query.info\": \"1s\",\n \"index.search.slowlog.threshold.query.debug\": \"1s\",\n \"index.search.slowlog.threshold.query.trace\": \"1s\",\n \"index.search.slowlog.threshold.fetch.warn\": \"1s\",\n \"index.search.slowlog.threshold.fetch.info\": \"1s\",\n \"index.search.slowlog.threshold.fetch.debug\": \"1s\",\n \"index.search.slowlog.threshold.fetch.trace\": \"1s\",\n \"index.search.slowlog.threshold.query\": \"1", "metrics": { "length": 1053, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 1, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "BM25 + Vector Hybrid Search: configurable blending weights (bm25-vector-hybrid-search-weights)", "condition": "with_lesson", "status": 200, "content": "**Configuring BM25 + Vector Hybrid Search**\n\nTo fix the issue, you need to configure the BM25 + vector hybrid search by setting the blending weights in your `config.yaml` file or environment variables.\n\n**Step 1: Update your `config.yaml` file**\n\nAdd the following configuration to your `config.yaml` file:\n```yaml\nsearch:\n hybrid:\n enabled: true\n bm25_weight: 0.5 # weight for BM25 score (0.0 - 1.0)\n vector_weight: 0.5 # weight for vector score (0.0 - 1.0)\n blend_method: rrf # options: rrf | linear\n```\nThis configuration sets the blending weights to 50/50 (BM25: 0.5, Vector: 0.5) with RRF blending.\n\n**Step 2: Update your environment variables (optional)**\n\nIf you prefer to set the blending weights as environment variables, you can use the following commands:\n```bash\nexport BM25_WEIGHT=0.5\nexport VECTOR_WEIGHT=0.5\nexport BLEND_METHOD=rrf\n```\n**Step 3: Restart your application**\n\nAfter updating your `config.yaml", "metrics": { "length": 937, "commands": 3, "command_list": [ "This configuration sets the blending weights to 50/50 (BM25: 0.5, Vector: 0.5) with RRF blending.", "**Step 2: Update your environment variables (optional)**", "If you prefer to set the blending weights as environment variables, you can use the following commands:" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "CSP blocks JavaScript injection in browser automation of authenticated pages (browser-automation-csp-bypass)", "condition": "with_lesson", "status": 200, "content": "**Fixing CSP Blocks JavaScript Injection in Browser Automation**\n\nTo bypass CSP blocks in browser automation, you can use the following methods:\n\n### Method 1: Add 'unsafe-eval' to script-src\n\nThis method allows the browser to execute JavaScript code injected via `eval()` or `Function()`.\n\n```bash\n# Using Puppeteer\nawait page.setExtraHTTPHeaders({\n 'Content-Security-Policy': 'script-src \\'self\\' \\'unsafe-eval\\''\n});\n\n# Using Playwright\nawait page.setExtraHTTPHeaders({\n 'Content-Security-Policy': 'script-src \\'self\\' \\'unsafe-eval\\''\n});\n```\n\n### Method 2: Add 'unsafe-inline' to script-src\n\nThis method allows the browser to execute inline scripts injected via `page.evaluate()` or `Runtime.evaluate()`.\n\n```bash\n# Using Puppeteer\nawait page.setExtraHTTPHeaders({\n 'Content-Security-Policy': 'script-src \\'self\\' \\'unsafe-inline\\''\n});\n\n# Using Playwright\nawait page.setExtraHTTPHeaders({\n 'Content-Security-Policy': 'script-src \\'self\\' \\'unsafe-inline\\''\n});\n```\n\n### Method 3: Use a Nonce or Hash\n\nIf you have a nonce or hash available,", "metrics": { "length": 1049, "commands": 12, "command_list": [ "await page.setExtraHTTPHeaders({", "'Content-Security-Policy': 'script-src \\'self\\' \\'unsafe-eval\\''", "});", "await page.setExtraHTTPHeaders({", "'Content-Security-Policy': 'script-src \\'self\\' \\'unsafe-eval\\''" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 2, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "CSP blocks JavaScript injection in browser automation of authenticated pages (browser-automation-csp-bypass)", "condition": "plain", "status": 200, "content": "The error \"CSP blocks JavaScript injection in browser automation of authenticated pages (browser-automation-csp-bypass)\" is typically encountered when using browser automation tools like Selenium or Puppeteer to interact with web pages that enforce Content Security Policy (CSP) restrictions.\n\nHere's a concrete, actionable fix for using Selenium with ChromeDriver:\n\n**Step 1: Update your Selenium version**\n\nYou'll need to update Selenium to the latest version that supports the `--disable-web-security` flag. You can do this by running:\n\n```bash\npip install --upgrade selenium\n```\n\n**Step 2: Update ChromeDriver**\n\nYou'll need to update ChromeDriver to the latest version that supports the `--disable-web-security` flag. You can do this by running:\n\n```bash\nwget https://chromedriver.storage.googleapis.com/96.0.4664.45/chromedriver_linux64.zip\nunzip chromedriver_linux64.zip\nmv chromedriver /usr/local/bin/chromedriver\nchmod +x /usr/local/bin/chromedriver\n```\n\n**Step 3: Use the `--disable-web-security` flag**\n\nYou can use the `--disable-web-security` flag when launching the ChromeDriver instance:\n\n```python\nfrom selenium import webdriver\nfrom selenium.webdriver", "metrics": { "length": 1168, "commands": 5, "command_list": [ "pip install --upgrade selenium", "wget https://chromedriver.storage.googleapis.com/96.0.4664.45/chromedriver_linux64.zip", "unzip chromedriver_linux64.zip", "mv chromedriver /usr/local/bin/chromedriver", "chmod +x /usr/local/bin/chromedriver" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 1, "lesson_hit_rate": 0.167 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Chroma 建库无 Checkpoint — 进程一死全部丢失 (chroma-rebuild-no-checkpoint-cn)", "condition": "with_lesson", "status": 200, "content": "**Fix the Chroma database build issue**\n\n**Step 1: Modify the `build_edoc_chroma.py` script**\n\nOpen the `build_edoc_chroma.py` script in your favorite text editor and replace the `embed_and_build` function with the following code:\n```python\nimport os\n\ndef embed_and_build(chunks, model, collection, batch_size=5000):\n for i in range(0, len(chunks), batch_size):\n batch = chunks[i:i+batch_size]\n embeddings = model.encode([c[\"text\"] for c in batch])\n collection.add(\n ids=[c[\"id\"] for c in batch],\n embeddings=embeddings.tolist(),\n documents=[c[\"text\"] for c in batch]\n )\n print(f\"[Checkpoint] Written {i+batch_size}/{len(chunks)}\")\n # Save the current state to a file\n with open(\"checkpoint.txt\", \"w\") as f:\n f.write(str(i))\n```\n**Step 2: Save the modified script**\n\nSave the modified script with the same name (`build_edoc_chroma.py`) in the same location (`~/.hermes/scripts`).\n\n**Step 3: Run the script in the background**\n\nOpen", "metrics": { "length": 1027, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 6, "lesson_hits": 5, "lesson_hit_rate": 0.833 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Chrome Relay 浏览器Automation — CDP over WebSocket 控制无头浏览器 (chrome-relay-browser-automation)", "condition": "with_lesson", "status": 200, "content": "Based on the provided information, it seems like you are trying to use Chrome Relay to automate browser operations in a WSL2 or Linux environment. However, you are facing an error. To fix this issue, follow the steps below:\n\n**Step 1: Install Chromium Browser**\n\nFirst, you need to install Chromium browser in your WSL2 or Linux environment. You can do this by running the following command:\n\n```bash\nsudo apt update\nsudo apt install chromium-browser\n```\n\n**Step 2: Start Chromium Browser with Debugging Port**\n\nNext, start the Chromium browser with the debugging port enabled. You can do this by running the following command:\n\n```bash\nchromium-browser --remote-debugging-port=9222 --no-sandbox --headless --user-data-dir=/tmp/chrome-dev-profile\n```\n\n**Step 3: Install OpenClaw**\n\nNow, you need to install OpenClaw, which is the Chrome Relay tool. You can do this by running the following command:\n\n```bash\nnpm install -g openclaw\n```\n\n**Step 4: Configure Claw Relay**\n\nCreate a configuration file for Claw Relay by running the following command:\n\n```bash\ncat ~/.claw-relay/config.yaml << 'EOF'\nserver", "metrics": { "length": 1103, "commands": 4, "command_list": [ "sudo apt update", "sudo apt install chromium-browser", "chromium-browser --remote-debugging-port=9222 --no-sandbox --headless --user-data-dir=/tmp/chrome-dev-profile", "npm install -g openclaw" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 5, "lesson_hit_rate": 0.833 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Chroma 建库无 Checkpoint — 进程一死全部丢失 (chroma-rebuild-no-checkpoint-cn)", "condition": "plain", "status": 200, "content": "The error message you're encountering is related to Chroma, a distributed database management system. The specific error you're seeing is:\n\n`Chroma 建库无 Checkpoint — 进程一死全部丢失 (chroma-rebuild-no-checkpoint-cn)`\n\nTo fix this issue, you'll need to rebuild the database with checkpoint enabled. Here are the exact commands to follow:\n\n**Step 1: Stop Chroma services**\n\nFirst, stop all Chroma services to prevent any further data loss:\n```bash\nchroma stop\n```\n**Step 2: Remove the existing database**\n\nNext, remove the existing database to start from a clean slate:\n```bash\nchroma remove\n```\n**Step 3: Rebuild the database with checkpoint enabled**\n\nNow, rebuild the database with checkpoint enabled:\n```bash\nchroma rebuild --checkpoint\n```\nThis will create a new database with checkpoint enabled, which should prevent data loss in case of a process failure.\n\n**Step 4: Restart Chroma services**\n\nFinally, restart all Chroma services to begin using the new database:\n```bash\nchroma start\n```\nAfter following these steps, your Chroma database should be rebuilt with checkpoint enabled, and you should no longer encounter the `", "metrics": { "length": 1119, "commands": 4, "command_list": [ "chroma stop", "chroma remove", "chroma rebuild --checkpoint", "chroma start" ], "has_command_block": true, "actionable": false, "inline_code_count": 9, "lesson_hits": 1, "lesson_hit_rate": 0.167 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Chrome Relay 浏览器Automation — CDP over WebSocket 控制无头浏览器 (chrome-relay-browser-automation)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely due to the Chrome Relay Browser Automation not being able to connect to the Chrome browser using the CDP over WebSocket. Here are some concrete, actionable fixes you can try:\n\n### 1. Update Chrome Browser\n\nMake sure your Chrome browser is up-to-date. You can update Chrome by running the following command:\n\n```bash\n# Update Chrome browser\nsudo apt-get update\nsudo apt-get install -y google-chrome-stable\n```\n\n### 2. Enable CDP over WebSocket\n\nBy default, CDP over WebSocket is not enabled in Chrome. You can enable it by adding the following flags to the Chrome browser launch command:\n\n```bash\n# Enable CDP over WebSocket\ngoogle-chrome --remote-debugging-port=9222 --disable-gpu --disable-blink-features=AutomationControlled\n```\n\n### 3. Update Chrome Relay Browser Automation\n\nMake sure your Chrome Relay Browser Automation is up-to-date. You can update it by running the following command:\n\n```bash\n# Update Chrome Relay Browser Automation\npip install --upgrade chrome-relay-browser-automation\n```\n\n### 4. Restart Chrome Relay Browser Automation\n\nAfter updating Chrome Relay Browser Automation, restart it by running the following command:\n\n```bash\n", "metrics": { "length": 1192, "commands": 4, "command_list": [ "sudo apt-get update", "sudo apt-get install -y google-chrome-stable", "google-chrome --remote-debugging-port=9222 --disable-gpu --disable-blink-features=AutomationControlled", "pip install --upgrade chrome-relay-browser-automation" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "GitHub Actions CI for AI Agent PRs — DCO decoupling & PYTHONPATH fix (ci-dco-decouple-pythonpath-fork-pr)", "condition": "with_lesson", "status": 200, "content": "Here's a concrete, actionable fix with exact commands to resolve the GitHub Actions CI error:\n\n**Step 1: Update `pr-checks.yml` to use `PYTHONPATH` instead of `pip install -e .`**\n\n1. Open the `pr-checks.yml` file in your repository.\n2. Replace the following lines:\n```yaml\n- name: 📦 Install Dependencies\n run: |\n pip install -r requirements.txt 2/dev/null || true\n pip install pytest pytest-cov\n```\nwith:\n```yaml\n- name: 📦 Install Dependencies\n run: |\n pip install -r requirements.txt 2/dev/null || true\n pip install pytest pytest-cov\n echo \"PYTHONPATH=$(pwd):$PYTHONPATH\" >> $GITHUB_ENV\n```\nThis will add the repository root directory to the `PYTHONPATH` environment variable.\n\n**Step 2: Decouple DCO from testing execution**\n\n1. Open the `pr-checks.yml` file in your repository.\n2. Remove the `if: steps.dco.outputs.dco_passed == 'true'` condition from all testing steps.\n\n**Step 3: Update coverage threshold for small PRs**\n\n1. Open the `pr", "metrics": { "length": 961, "commands": 1, "command_list": [ "with:" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 2, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "GitHub Actions CI for AI Agent PRs — DCO decoupling & PYTHONPATH fix (ci-dco-decouple-pythonpath-fork-pr)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely due to the GitHub Actions CI workflow not properly setting up the `PYTHONPATH` environment variable. Here's a concrete, actionable fix:\n\n**Step 1: Update your workflow file (`ci-dco-decouple-pythonpath-fork-pr.yml`)**\n\nOpen the `ci-dco-decouple-pythonpath-fork-pr.yml` file in your repository and update the `jobs` section to include the following lines:\n```yaml\njobs:\n ...\n python:\n ...\n env:\n PYTHONPATH: ${{ github.workspace }}/src\n```\nThis sets the `PYTHONPATH` environment variable to the `src` directory in your repository.\n\n**Step 2: Update your `setup.py` file**\n\nOpen the `setup.py` file in your repository and update the `install_requires` list to include the `dco` package:\n```python\nfrom setuptools import setup, find_packages\n\nsetup(\n ...\n install_requires=[\n 'dco>=2.0.0',\n ...\n ],\n ...\n)\n```\nThis ensures that the `dco` package is installed as a dependency.\n\n**Step 3: Run the GitHub Actions workflow**\n\nSave your changes to the `ci-dco-decouple", "metrics": { "length": 1039, "commands": 3, "command_list": [ "This sets the `PYTHONPATH` environment variable to the `src` directory in your repository.", "**Step 2: Update your `setup.py` file**", "Open the `setup.py` file in your repository and update the `install_requires` list to include the `dco` package:" ], "has_command_block": true, "actionable": true, "inline_code_count": 15, "lesson_hits": 2, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "CI security checks: action pinning, permissions, README, code style (ci-security-advisory-checks)", "condition": "with_lesson", "status": 200, "content": "**Fixing CI Security Checks: Action Pinning, Permissions, README, Code Style**\n\nTo fix the CI security checks, follow these steps:\n\n### Step 1: Add Security Advisory Checks to Audit Workflow\n\nCreate a new file `.github/workflows/security-checks.yml` with the following content:\n\n```yml\nname: Security Advisory Checks\n\non:\n pull_request:\n branches:\n - main\n\njobs:\n security-checks:\n runs-on: ubuntu-latest\n steps:\n - name: Security Advisory Checks\n run: |\n # Check workflow action pinning (SHA vs version tag)\n for wf in .github/workflows/*.yml; do\n UNPINNED=$(grep -E 'uses: [a-zA-Z0-9_-]+/[a-zA-Z0-9_-]+@v[0-9]' \"$wf\" | grep -v '@[a-f0-9]{40}' || true)\n if [ -n \"$UNPINNED\" ]; then\n echo \"::warning file=$wf::Unpinned actions: $UNPINNED\"\n fi\n done\n\n # Check overly broad permissions\n for wf in .github/workflows/*.yml; do", "metrics": { "length": 941, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 1, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "CI security checks: action pinning, permissions, README, code style (ci-security-advisory-checks)", "condition": "plain", "status": 200, "content": "The error message \"CI security checks: action pinning, permissions, README, code style\" typically indicates that your GitHub Actions workflow is failing due to security-related issues. Here's a step-by-step guide to fix these issues:\n\n**1. Action Pinning**\n\nGitHub Actions workflows can use any version of actions, but it's recommended to pin the version to ensure reproducibility. To fix this, update your workflow file (e.g., `.github/workflows/main.yml`) to pin the action versions. For example:\n\n```yml\nname: CI\n\non:\n push:\n branches:\n - main\n\njobs:\n build:\n runs-on: ubuntu-latest\n steps:\n - name: Checkout code\n uses: actions/checkout@v2\n\n - name: Setup Node\n uses: actions/setup-node@v2\n with:\n node-version: '14'\n```\n\nIn this example, we're pinning `actions/checkout@v2` and `actions/setup-node@v2`.\n\n**2. Permissions**\n\nGitHub Actions workflows require specific permissions to execute certain actions. To fix this, update your workflow file to request the necessary permissions. For example:\n\n```yml\nname: CI\n\non:\n ", "metrics": { "length": 1080, "commands": 3, "command_list": [ "In this example, we're pinning `actions/checkout@v2` and `actions/setup-node@v2`.", "**2. Permissions**", "GitHub Actions workflows require specific permissions to execute certain actions. To fix this, update your workflow file to request the necessary permissions. For example:" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 2, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "CI 测试陷阱 — 模块级副作用导致 import 失败 (ci-lambda-module-level-side-effects)", "condition": "with_lesson", "status": 200, "content": "**Fix: Avoid Importing Lambda Module and Use Source Code Analysis Instead**\n\nTo fix the issue, follow these steps:\n\n**Step 1: Modify the test code to read the source code directly**\n\nReplace the `_import_lambda_module` function with a new function that reads the source code of the Lambda module directly:\n```python\nimport re\nimport os\nimport sys\n\ndef _extract_default(source: str) -> str:\n match = re.search(\n r'''os\\.environ\\.get\\(\\s[\"']EXCLUDE_CHARACTERS[\"']\\s,\\s(['\"])((?:[^\\\\]|\\\\.)?)\\1''',\n source,\n )\n return match.group(2)\n\ndef test_lambda_module():\n source_dir = Path(\"lambda\")\n source_file = source_dir / \"index.py\"\n source = source_file.read_text()\n assert \"/@\" in _extract_default(source)\n```\n**Step 2: Remove the `importlib` import**\n\nRemove the `importlib` import from the test code:\n```python\n# Remove this line\n# import importlib\n```\n**Step 3: Verify the fix**\n\nRun the test code using the following command:\n```bash\npython3 -m unittest test_lambda_module", "metrics": { "length": 1005, "commands": 4, "command_list": [ "**Step 2: Remove the `importlib` import**", "Remove the `importlib` import from the test code:", "**Step 3: Verify the fix**", "Run the test code using the following command:" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "CI 测试陷阱 — 模块级副作用导致 import 失败 (ci-lambda-module-level-side-effects)", "condition": "plain", "status": 200, "content": "This error typically occurs in AWS Lambda functions when there are module-level side effects in the code. This can happen when a module is being imported within the function, but the import operation itself has side effects, such as making HTTP requests or writing to the file system.\n\nHere's a concrete, actionable fix for this issue:\n\n### Step 1: Identify the problematic import\n\nTo fix the issue, you need to identify which import is causing the problem. You can do this by reviewing your code and checking if there are any imports that make HTTP requests or write to the file system.\n\n### Step 2: Move the import outside the handler\n\nOnce you've identified the problematic import, move it outside the handler function. This will ensure that the import operation is executed only once, when the function is initialized, rather than on every invocation.\n\nHere's an example of how you might refactor your code to fix the issue:\n\n```javascript\n// Before refactoring\nexports.handler = async (event) => {\n const axios = require('axios');\n const response = await axios.get('https://example.com/api/data');\n // ...\n};\n\n// After refactoring\nconst axios = require('axios');\n\nexports.handler = async (event) => {\n const response = await axios.get('", "metrics": { "length": 1245, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Claude Code can debug low-level cryptography — ML-DSA signature verification (claude-code-debugging-ml-dsa-cryptography)", "condition": "with_lesson", "status": 200, "content": "To fix the bug in the ML-DSA signature verification, you need to refactor the `w1Encode` function to accept pre-computed high bits. Here's the step-by-step fix:\n\n**Step 1: Update the `w1Encode` function**\n\nReplace the original `w1Encode` function with the refactored version that takes pre-computed high bits as input:\n\n```go\nfunc w1Encode(w1 []poly, highBits []poly) []poly {\n // implementation remains the same\n // ...\n}\n```\n\n**Step 2: Update the `Verify` function**\n\nModify the `Verify` function to pass the pre-computed high bits to `w1Encode`:\n\n```go\nfunc Verify(w1 []poly, w2 []poly, highBits []poly) bool {\n // ...\n w1 = w1Encode(w1, highBits)\n // ...\n}\n```\n\n**Step 3: Update the `Sign` function (if necessary)**\n\nIf the `Sign` function uses the refactored `w1Encode` function, update it to pass the pre-computed high bits:\n\n```go\nfunc Sign(w []poly) []poly {\n // ...\n highBits := highBits(w)\n", "metrics": { "length": 921, "commands": 4, "command_list": [ "**Step 2: Update the `Verify` function**", "Modify the `Verify` function to pass the pre-computed high bits to `w1Encode`:", "**Step 3: Update the `Sign` function (if necessary)**", "If the `Sign` function uses the refactored `w1Encode` function, update it to pass the pre-computed high bits:" ], "has_command_block": true, "actionable": true, "inline_code_count": 13, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Claude Code can debug low-level cryptography — ML-DSA signature verification (claude-code-debugging-ml-dsa-cryptography)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely due to an issue with the `pycryptodome` library, which is required for ML-DSA signature verification. Here are the steps to fix the issue:\n\n**Step 1: Install the required libraries**\n\nRun the following command in your terminal to install the required libraries:\n```bash\npip install pycryptodome\n```\nIf you're using a virtual environment, make sure to activate it before installing the libraries.\n\n**Step 2: Update the `pycryptodome` library**\n\nIf you're using an older version of `pycryptodome`, you might need to update it. Run the following command to update the library:\n```bash\npip install --upgrade pycryptodome\n```\n**Step 3: Verify the ML-DSA signature**\n\nAfter installing and updating the libraries, you should be able to verify the ML-DSA signature using the `claude-code-debugging-ml-dsa-cryptography` code. Make sure to import the required libraries and use the correct functions to verify the signature.\n\nHere's an example code snippet to get you started:\n```python\nfrom cryptography.hazmat.primitives import serialization\nfrom cryptography.hazmat.primitives.asymmetric import ec\nfrom cryptography", "metrics": { "length": 1148, "commands": 2, "command_list": [ "pip install pycryptodome", "pip install --upgrade pycryptodome" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 1, "lesson_hit_rate": 0.167 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Cloudflare Email Worker 邮件注册踩坑Notes — message.raw、MIME 与 SPF (cloudflare-email-worker-registration-trap)", "condition": "with_lesson", "status": 200, "content": "Here are the concrete, actionable fixes with exact commands:\n\n**坑1:message.text 不存在**\n\nFix:\n```javascript\nlet rawText = '';\nconst reader = message.raw.getReader();\nconst decoder = new TextDecoder();\nwhile (true) {\n const { done, value } = await reader.read();\n if (done) break;\n rawText += decoder.decode(value, { stream: true });\n}\n```\nHowever, you can also use the `TextDecoder` API to decode the `message.raw` stream in one line:\n```javascript\nconst decoder = new TextDecoder();\nconst rawText = await message.raw.text();\n```\n\n**坑2:Node.js crypto 模块不可用**\n\nFix:\n```javascript\nconst crypto = self.crypto;\nconst array = new Uint8Array(16);\ncrypto.getRandomValues(array);\nconst token = Array.from(array, b => b.toString(16).padStart(2, '0')).join('');\n```\nHere, we're using the `self.crypto` API to access the Web Crypto API, which is compatible with Cloudflare Workers.\n\n**坑3:回复邮件被 QQ/163/ Foxmail 拒收**\n\nFix:\nInstead of sending a verification email, you can simply send", "metrics": { "length": 971, "commands": 3, "command_list": [ "However, you can also use the `TextDecoder` API to decode the `message.raw` stream in one line:", "**坑2:Node.js crypto 模块不可用**", "Fix:" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 2, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Cloudflare Worker Programmatic Deploy: Three Pitfalls — Sandbox Egress, 32KB (cloudflare-worker-deploy-three-pitfalls)", "condition": "with_lesson", "status": 200, "content": "**Fixing the Cloudflare Worker Programmatic Deploy Pitfalls**\n\n**Problem 1: Sandbox Egress**\n\nThe Cloudflare execute sandbox has an outbound domain whitelist, blocking external code sources like GitHub raw/API. To fix this, we'll use the Cloudflare KV (Key-Value) namespace to store our code.\n\n**Step 1: Create a KV namespace**\n\n```bash\nwrangler kv namespace create my-worker-code\n```\n\n**Step 2: Base64 encode and chunk code**\n\n```bash\n# Split the code into chunks (each ≤24KB)\nchunk_size=24000\ncode=$(cat my-worker.js)\nchunks=()\nfor ((i=0; i<${#code}; i+=${chunk_size})); do\n chunks+=(\"${code:i:${chunk_size}}\")\ndone\n\n# Base64 encode each chunk\nfor chunk in \"${chunks[@]}\"; do\n encoded_chunk=$(echo -n \"$chunk\" | base64)\n # Store each chunk in the KV namespace\n wrangler kv put my-worker-code chunk-$(( ${#chunks[@]} - ${#chunks[@]} + i + 1 )) \"$encoded_chunk\"\ndone\n```\n\n**Problem 2: Argument list too long**\n\nThe `execve", "metrics": { "length": 926, "commands": 11, "command_list": [ "wrangler kv namespace create my-worker-code", "chunk_size=24000", "code=$(cat my-worker.js)", "chunks=()", "for ((i=0; i<${#code}; i+=${chunk_size})); do" ], "has_command_block": true, "actionable": true, "inline_code_count": 4, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Cloudflare Worker Programmatic Deploy: Three Pitfalls — Sandbox Egress, 32KB (cloudflare-worker-deploy-three-pitfalls)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely due to the three pitfalls mentioned in the article:\n\n1. **Sandbox Egress**: Cloudflare Workers run in a sandboxed environment, which can prevent them from making requests to external services. To fix this, you need to add the `https://example.com` URL to the `access-control-allow-origin` header in your `wrangler.toml` file.\n\n2. **32KB (Maximum allowed code size)**: Cloudflare Workers have a maximum allowed code size of 32KB. To fix this, you need to reduce the size of your code or use a more efficient compression algorithm.\n\n3. **Missing `wrangler publish` command**: To deploy your Cloudflare Worker, you need to use the `wrangler publish` command. Here's how to do it:\n\n### Step 1: Create a new `wrangler.toml` file\n\nCreate a new file named `wrangler.toml` in the root of your project. This file contains configuration settings for the `wrangler` command.\n\n```toml\n# wrangler.toml\n\nname = \"my-worker\"\naccount_id = \"your-account-id\"\nzone_id = \"your-zone-id\"\nworkers_sdk = \"esm\"\n\n[[", "metrics": { "length": 1031, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 8, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Cloudflare Email Worker 邮件注册踩坑Notes — message.raw、MIME 与 SPF (cloudflare-email-worker-registration-trap)", "condition": "plain", "status": 200, "content": "Based on the error \"Cloudflare Email Worker 邮件注册踩坑Notes — message.raw、MIME 与 SPF\", it seems like you are experiencing issues with email registration in Cloudflare Email Worker due to SPF (Sender Policy Framework) and MIME (Multipurpose Internet Mail Extensions) related issues.\n\nHere are some concrete, actionable fixes you can try:\n\n**Fix 1: Use `message.headers` instead of `message.raw`**\n\nIn Cloudflare Email Worker, you can access the email headers using `message.headers` instead of `message.raw`. This is because `message.raw` returns the entire email content, including headers and body, which can cause issues with SPF validation.\n\n```javascript\n// Before\nconst fromHeader = message.raw.match(/From: (.*)/)[1];\n\n// After\nconst fromHeader = message.headers.get('From');\n```\n\n**Fix 2: Handle MIME multipart emails**\n\nIf the email is a MIME multipart email, you need to handle the different parts of the email separately. You can use the `message.headers.get('Content-Type')` to check if the email is a MIME multipart email.\n\n```javascript\n// Check if email is MIME multipart\nconst contentType = message.headers.get('Content-Type');\nif (contentType.includes", "metrics": { "length": 1163, "commands": 2, "command_list": [ "**Fix 2: Handle MIME multipart emails**", "If the email is a MIME multipart email, you need to handle the different parts of the email separately. You can use the `message.headers.get('Content-Type')` to check if the email is a MIME multipart email." ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 2, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Dismiss CodeQL False Positive Alerts (codeql-alert-dismissal-false-positive)", "condition": "plain", "status": 200, "content": "The \"Dismiss CodeQL False Positive Alerts\" error is a GitHub Alert that appears when the CodeQL analysis detects a false positive alert in your repository. Here's a concrete, actionable fix to dismiss the alert:\n\n**Step 1: Identify the False Positive Alert**\n\nFirst, you need to identify the specific false positive alert that you want to dismiss. You can do this by:\n\n* Going to your GitHub repository\n* Clicking on the \"Security\" tab\n* Selecting \"Code security & analysis\" from the left-hand menu\n* Clicking on the \"CodeQL alerts\" tab\n* Searching for the alert with the ID \"codeql-alert-dismissal-false-positive\"\n\n**Step 2: Create a `.github/workflows/dismiss-codeql-false-positive.yml` file**\n\nTo dismiss the false positive alert, you need to create a GitHub Actions workflow file that will create a CodeQL dismissal for the alert. Create a new file called `.github/workflows/dismiss-codeql-false-positive.yml` in the root of your repository with the following contents:\n\n```yml\nname: Dismiss CodeQL False Positive Alert\n\non:\n workflow_dispatch:\n\njobs:\n dismiss-codeql-false-positive:\n runs-on: ubuntu-latest\n steps", "metrics": { "length": 1126, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 2, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Dismiss CodeQL False Positive Alerts (codeql-alert-dismissal-false-positive)", "condition": "with_lesson", "status": 200, "content": "**Dismiss CodeQL False Positive Alerts**\n\n**Step 1: List Open Alerts**\n\nTo get the list of open alerts, use the following command:\n```bash\ncurl -s -X GET \\\n -H \"Authorization: token $TOKEN\" \\\n -H \"Accept: application/vnd.github.v3+json\" \\\n https://api.github.com/repos/Ikalus1988/MisakaNet/code-scanning/alerts\n```\nReplace `$TOKEN` with your GitHub token.\n\n**Step 2: Identify the Alert to Dismiss**\n\nFrom the list of open alerts, identify the alert ID (e.g., 37) and the file path (e.g., `secrets.py`) associated with the false positive.\n\n**Step 3: Dismiss the Alert**\n\nUse the following command to dismiss the alert:\n```bash\ncurl -s -X PATCH \\\n -H \"Authorization: token $TOKEN\" \\\n -H \"Accept: application/vnd.github.v3+json\" \\\n https://api.github.com/repos/Ikalus1988/MisakaNet/code-scanning/alerts/37 \\\n -d '{\n \"state\": \"dismissed\",\n \"dismissed_reason\": \"false positive\",\n \"dismissed_comment\":", "metrics": { "length": 911, "commands": 4, "command_list": [ "curl -s -X GET \\", "-H \"Authorization: token $TOKEN\" \\", "-H \"Accept: application/vnd.github.v3+json\" \\", "https://api.github.com/repos/Ikalus1988/MisakaNet/code-scanning/alerts" ], "has_command_block": true, "actionable": true, "inline_code_count": 4, "lesson_hits": 1, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Cross-Repo Contribution Strategy — Finding and Contributing to New Repos (cross-repo-contribution-strategy)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely due to the `cross-repo-contribution-strategy` repository not being properly set up or maintained. However, without more context or information about the specific error message you're receiving, it's difficult to provide a precise solution.\n\nThat being said, I can offer a general approach to troubleshoot and potentially fix the issue.\n\n**Step 1: Clone the repository**\n\nFirst, clone the `cross-repo-contribution-strategy` repository using the following command:\n\n```bash\ngit clone https://github.com/octocat/cross-repo-contribution-strategy.git\n```\n\n**Step 2: Checkout the main branch**\n\nNavigate into the cloned repository and checkout the main branch:\n\n```bash\ncd cross-repo-contribution-strategy\ngit checkout main\n```\n\n**Step 3: Fetch the latest changes**\n\nFetch the latest changes from the remote repository:\n\n```bash\ngit fetch --all\n```\n\n**Step 4: Update the repository**\n\nUpdate the local repository to match the remote repository:\n\n```bash\ngit pull origin main\n```\n\n**Step 5: Verify the repository**\n\nVerify that the repository is in a healthy state by checking for any conflicts or issues:\n\n```bash\ngit status\ngit log\n", "metrics": { "length": 1167, "commands": 5, "command_list": [ "git clone https://github.com/octocat/cross-repo-contribution-strategy.git", "cd cross-repo-contribution-strategy", "git checkout main", "git fetch --all", "git pull origin main" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 1, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Cross-Repo Contribution Strategy — Finding and Contributing to New Repos (cross-repo-contribution-strategy)", "condition": "with_lesson", "status": 200, "content": "**Fixing the Error**\n\nThe error message is not provided, but based on the context, it seems like the issue is with the verification step in the lesson. The verification step is checking if the \"good first issue\" command is successful. Here's a concrete, actionable fix:\n\n**Step 1: Install the Required Python Script**\n\nThe `skill/pr_genius.py` script is required for this lesson. You can install it using pip:\n\n```bash\npip3 install git+https://github.com/patrickbrosset/skill.git\n```\n\n**Step 2: Run the Good First Issue Command**\n\nRun the following command to check if the \"good first issue\" command is successful:\n\n```bash\npython3 skill/pr_genius.py coach \"feat: add feature\" --repo org/repo --body \"Fixes 123\"\n```\n\n**Step 3: Verify the Output**\n\nThe verification step is checking if the command completes without error and prints \"Verification passed: fix command exited 0\". You can verify this by checking the output of the command:\n\n```bash\ngood first issue\necho \"Verification passed: fix command exited 0\"\n```\n\nIf the command completes without error and prints the expected output, then the verification step is", "metrics": { "length": 1116, "commands": 4, "command_list": [ "pip3 install git+https://github.com/patrickbrosset/skill.git", "python3 skill/pr_genius.py coach \"feat: add feature\" --repo org/repo --body \"Fixes 123\"", "good first issue", "echo \"Verification passed: fix command exited 0\"" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 2, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "跨 Sheet 同名合并导致数据混乱:机器人唯一标识必须带前缀 (cross-sheet-name-merge-data-chaos)", "condition": "with_lesson", "status": 200, "content": "**Fix Command:**\n\n```python\n# Import necessary libraries\nimport pandas as pd\n\n# Define a function to add sheet prefix to robot name\ndef add_sheet_prefix(df, sheet_name):\n # Add a new column 'robot_id' with sheet prefix and robot name\n df['robot_id'] = sheet_name + '_' + df['robotName']\n return df\n\n# Load all sheets into a dictionary\nsheets = {...} # Replace with your actual sheet data\n\n# Initialize an empty list to store data from all sheets\nall_data = []\n\n# Iterate over each sheet and add sheet prefix to robot name\nfor sheet_name, df in sheets.items():\n df = add_sheet_prefix(df, sheet_name)\n all_data.append(df)\n\n# Concatenate all data from sheets\nresult = pd.concat(all_data)\n\n# Group by 'robot_id' and perform aggregation\nresult = result.groupby('robot_id').agg(...)\n\n# Verification: Check if the 'robot_id' column is correctly formed\nprint(\"Verification passed: fix command exited 0\")\n```\n\n**Explanation:**\n\n1. Define a function `add_sheet_prefix` to add the sheet prefix to the robot name.\n2. Iterate over each sheet and add the sheet prefix to", "metrics": { "length": 1074, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 2, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "跨 Sheet 同名合并导致数据混乱:机器人唯一标识必须带前缀 (cross-sheet-name-merge-data-chaos)", "condition": "plain", "status": 200, "content": "This error is caused by having duplicate sheet names across different sheets in your Google Sheets document, which can lead to data merging issues when using the `unique` function or other functions that rely on unique sheet names.\n\nTo fix this issue, you can follow these steps:\n\n1. **List all sheet names in your document**:\n - Open your Google Sheets document.\n - Go to the \"Tools\" menu and select \"Script editor\".\n - In the script editor, click on the \"File\" menu and select \"Get ID of current spreadsheet\".\n - This will open the \"Spreadsheet Properties\" window. Click on the \"Spreadsheet ID\" link.\n - Copy the spreadsheet ID.\n\n2. **List all sheet names**:\n - Open a new Google Sheets document.\n - Go to the \"Insert\" menu and select \"Sheet\".\n - Name the new sheet \"Sheet Names\".\n - Go back to your original document.\n - Select all data in the original document (Ctrl+A or Cmd+A).\n - Copy the selected data.\n - Go back to the \"Sheet Names\" document.\n - Go to the \"Edit\" menu and select \"Paste values only\" (Ctrl+Alt+V or Cmd+Alt+V).\n", "metrics": { "length": 1062, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 1, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "CSS z-index Not Working — Stacking Context Inversion in Modal Overlays (css-z-index-stacking-context-modal)", "condition": "with_lesson", "status": 200, "content": "To fix the issue of the modal overlay not working due to stacking context inversion, you need to change the modal's stacking context to be at the document root level. This can be achieved by removing the `position: relative` property from the `.modal-overlay` class and adding `position: fixed` to the parent element that creates the stacking context. However, since you can't change the parent's position property, you can use a different approach.\n\nHere are the steps to fix the issue:\n\n1. Add `position: relative` to the parent element that creates the stacking context. However, since you can't change the parent's position property, you can add a wrapper element around the modal and set its position to relative.\n\n```html\n\n
\n
\n \n
\n
\n```\n\n2. Add `position: relative` to the `.modal-container` class.\n\n```css\n.modal-container {\n position: relative;\n}\n```\n\n3. Remove the `position: relative` property from the `.modal-overlay` class.\n\n```css\n.modal-overlay {\n position:", "metrics": { "length": 1166, "commands": 2, "command_list": [ "2. Add `position: relative` to the `.modal-container` class.", "3. Remove the `position: relative` property from the `.modal-overlay` class." ], "has_command_block": true, "actionable": true, "inline_code_count": 12, "lesson_hits": 5, "lesson_hit_rate": 0.833 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "CSS z-index Not Working — Stacking Context Inversion in Modal Overlays (css-z-index-stacking-context-modal)", "condition": "plain", "status": 200, "content": "**Fixing CSS z-index Not Working Issue with Stacking Context Inversion in Modal Overlays**\n\nTo resolve the issue of CSS `z-index` not working as expected with modal overlays due to stacking context inversion, you can follow these steps:\n\n### Step 1: Identify the Stacking Context\n\nIn your HTML, identify the elements that create the stacking context. Typically, this is the element that contains the modal overlay and has a position property (e.g., `position: relative` or `position: absolute`).\n\n```html\n\n
\n
\n \n
\n
\n```\n\n### Step 2: Set the Stacking Context to the Modal Container\n\nTo ensure the modal container is the stacking context, add the following CSS to the `.modal-container` class:\n\n```css\n.modal-container {\n position: relative; /* Set position to relative */\n z-index: 1; /* Set a base z-index */\n}\n```\n\n### Step 3: Set the Modal Overlay's Z-index\n\nSet the `z-index` of the modal overlay to a higher value than the base `z-index` of the modal container:\n\n```css\n.modal-overlay {\n", "metrics": { "length": 1109, "commands": 2, "command_list": [ "To ensure the modal container is the stacking context, add the following CSS to the `.modal-container` class:", "Set the `z-index` of the modal overlay to a higher value than the base `z-index` of the modal container:" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 5, "lesson_hit_rate": 0.833 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "curl / wget 请求失败通用Diagnosis (curl-request-troubleshoot)", "condition": "with_lesson", "status": 200, "content": "Based on the provided troubleshooting guide, here's a step-by-step fix for the `curl` request failure:\n\n**Step 1: Verify DNS Configuration**\n\nRun the following commands to check the DNS configuration:\n\n```bash\nnslookup example.com\ndig example.com\n```\n\nIf you get a normal return with an IP address, it indicates that the DNS configuration is correct.\n\n**Step 2: Check Network Connectivity (Skip Proxy)**\n\nRun the following command to check network connectivity:\n\n```bash\ncurl -v --noproxy \"\" https://example.com\n```\n\nIf the connection is established but times out, it indicates a firewall/ proxy issue.\n\n**Step 3: Verify Certificate Validation**\n\nRun the following command to check certificate validation:\n\n```bash\ncurl -v https://example.com\n```\n\nIf you encounter an SSL certificate problem, it indicates a certificate issue.\n\nTo temporarily bypass the certificate validation (only for testing):\n\n```bash\ncurl -k https://example.com\n```\n\n**Step 4: Verify Proxy Configuration**\n\nRun the following commands to check the current proxy configuration:\n\n```bash\necho $http_proxy\necho $https_proxy\n```\n\n**Step 5: Specify Timeout**\n\nRun the following command to specify a timeout:\n\n```bash\n", "metrics": { "length": 1183, "commands": 7, "command_list": [ "nslookup example.com", "dig example.com", "curl -v --noproxy \"\" https://example.com", "curl -v https://example.com", "curl -k https://example.com" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "curl / wget 请求失败通用Diagnosis (curl-request-troubleshoot)", "condition": "plain", "status": 200, "content": "The error you're experiencing is a generic error message that can be caused by various issues. However, I'll provide you with a step-by-step troubleshooting guide to help you diagnose and fix the issue.\n\n**Step 1: Check the URL**\n\nEnsure that the URL you're trying to access is correct and properly formatted. You can use the `curl` command with the `-I` option to check the HTTP headers of the server:\n\n```bash\ncurl -I \n```\n\nReplace `` with the actual URL you're trying to access.\n\n**Step 2: Verify the Server Response**\n\nUse the `curl` command with the `-v` option to enable verbose mode and see the entire request and response:\n\n```bash\ncurl -v \n```\n\nThis will help you identify any issues with the request or response.\n\n**Step 3: Check the Server Status Code**\n\nUse the `curl` command with the `-s` option to suppress output and the `-w` option to specify a custom output format that includes the server status code:\n\n```bash\ncurl -s -w \"%{http_code}\" \n```\n\nThis will output the server status code (e.g., 200, 404, etc.).\n\n**Step 4", "metrics": { "length": 1055, "commands": 3, "command_list": [ "curl -I ", "curl -v ", "curl -s -w \"%{http_code}\" " ], "has_command_block": true, "actionable": true, "inline_code_count": 13, "lesson_hits": 1, "lesson_hit_rate": 0.167 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "数据封顶=伪造数据:超出阈值应剔除而非截断 (data-capping-equals-forging-data)", "condition": "with_lesson", "status": 200, "content": "Here's a concrete, actionable fix in Python:\n\n**Before**\n```python\ndef calculate_utilization(actual_cycle, target_cycle):\n utilization = min(actual_cycle / target_cycle, 1.0)\n return utilization\n```\n\n**After**\n```python\ndef calculate_utilization(actual_cycle, target_cycle):\n if actual_cycle > target_cycle:\n return None # or any other value to indicate data has been removed\n else:\n utilization = min(actual_cycle / target_cycle, 1.0)\n return utilization\n```\n\nHowever, to make the code more robust and follow the best practices, we can use the following approach:\n\n```python\ndef calculate_utilization(actual_cycle, target_cycle, threshold=1.0):\n \"\"\"\n Calculate utilization based on actual and target cycles.\n\n Args:\n actual_cycle (float): Actual cycle time.\n target_cycle (float): Target cycle time.\n threshold (float, optional): Threshold for utilization. Defaults to 1.0.\n\n Returns:\n float or None: Utilization if within threshold, otherwise None.\n \"\"\"\n if actual_cycle > target_cycle * threshold:\n return None # or any other value to indicate data has been removed\n else:\n utilization = min", "metrics": { "length": 1192, "commands": 2, "command_list": [ "**After**", "However, to make the code more robust and follow the best practices, we can use the following approach:" ], "has_command_block": true, "actionable": true, "inline_code_count": 4, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "数据封顶=伪造数据:超出阈值应剔除而非截断 (data-capping-equals-forging-data)", "condition": "plain", "status": 200, "content": "Based on the error message \"数据封顶=伪造数据:超出阈值应剔除而非截断\", it seems like you are working with a dataset that has a threshold or cap on the data. The error is likely caused by the fact that you are trying to truncate or cap the data instead of removing it.\n\nHowever, without more information about the specific code or system you are using, it's difficult to provide a concrete fix. But I can give you a general idea of how to approach this issue.\n\nHere are a few possible solutions:\n\n**Solution 1: Remove data above threshold**\n\nIf you want to remove data that exceeds a certain threshold, you can use the following approach:\n\n```python\nimport pandas as pd\n\n# assume 'data' is a pandas DataFrame\nthreshold = 100 # adjust this value based on your needs\ndata = data[data['column_name'] <= threshold]\n```\n\n**Solution 2: Use a cap function**\n\nIf you want to cap the data at a certain value, you can use the `np.clip` function from the NumPy library:\n\n```python\nimport numpy as np\n\n# assume 'data' is a pandas DataFrame\nthreshold = 100 # adjust this value based", "metrics": { "length": 1051, "commands": 2, "command_list": [ "**Solution 2: Use a cap function**", "If you want to cap the data at a certain value, you can use the `np.clip` function from the NumPy library:" ], "has_command_block": true, "actionable": true, "inline_code_count": 3, "lesson_hits": 3, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "数据管道 lessons.json 必须用规范生成器 update_lessons_json.py (data-pipeline-lessons-json-canonical-generator)", "condition": "with_lesson", "status": 200, "content": "**修复方案**\n\n### 步骤 1: 确认规范生成器\n\n```bash\n# 找谁负责生成 lessons.json\ngrep -rn \"lessons.json\" .github/workflows/ scripts/\n```\n\n### 步骤 2: 确认当前线上格式\n\n```bash\n# 确认当前线上格式\npython3 -c \"import json; d=json.load(open('data/lessons.json')); print(d[0].keys())\"\n```\n\n### 步骤 3: 修复规范生成器\n\n**步骤 3.1: 编辑规范生成器**\n\n```bash\n# 编辑 scripts/update_lessons_json.py\nvim scripts/update_lessons_json.py\n```\n\n在 `scripts/update_lessons_json.py` 文件中,添加以下代码以生成 `evidence_level`、`evidence_source` 和 `trust_score` 字段:\n\n```python\nimport json\n\nwith open('data/lessons.json', 'r') as f:\n lessons = json.load(f)\n\n# 生成 evidence_level 字段\nfor lesson in lessons:\n # 使用 frontmatter 优先级\n evidence_level = lesson.get('frontmatter', {}).get('evidence_level", "metrics": { "length": 708, "commands": 3, "command_list": [ "grep -rn \"lessons.json\" .github/workflows/ scripts/", "python3 -c \"import json; d=json.load(open('data/lessons.json')); print(d[0].keys())\"", "vim scripts/update_lessons_json.py" ], "has_command_block": true, "actionable": false, "inline_code_count": 9, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "数据管道 lessons.json 必须用规范生成器 update_lessons_json.py (data-pipeline-lessons-json-canonical-generator)", "condition": "plain", "status": 200, "content": "To fix this error, you need to generate the `lessons.json` file using the `update_lessons_json.py` script, which is a canonical generator for the data pipeline. Here's a concrete, actionable fix:\n\n**Step 1: Run the canonical generator script**\n\n1. Open your terminal or command prompt.\n2. Navigate to the directory where the `update_lessons_json.py` script is located.\n3. Run the following command to execute the script:\n ```bash\npython update_lessons_json.py\n```\n This command will generate the `lessons.json` file in the correct format.\n\n**Step 2: Verify the generated file**\n\n1. Check the generated `lessons.json` file to ensure it's in the correct format and contains the expected data.\n2. Verify that the file is located in the correct directory and has the correct permissions.\n\n**Step 3: Update the data pipeline**\n\n1. Once the `lessons.json` file is generated and verified, update the data pipeline to use the new file.\n2. Run the following command to update the data pipeline:\n ```bash\ndata-pipeline update\n```\n This command will update the data pipeline with the new `lessons.json` file.\n\n**Step 4: Verify the", "metrics": { "length": 1127, "commands": 2, "command_list": [ "python update_lessons_json.py", "data-pipeline update" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 1, "lesson_hit_rate": 0.167 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "DCO Signoff Lost During Force Push (dco-signoff-force-push-pitfall)", "condition": "plain", "status": 200, "content": "The \"DCO Signoff Lost During Force Push\" error occurs when you force-push changes to a repository that has a dependency on a downstream repository, and the DCO (Developer Certificate of Origin) signoff is lost during the process.\n\nHere's a concrete, actionable fix:\n\n**Step 1: Identify the affected repositories**\n\nTo identify the affected repositories, you can use the following command:\n```bash\ngit config --get remote.origin.url\n```\nThis command will display the URL of the repository that you're trying to push to.\n\n**Step 2: Find the lost signoffs**\n\nTo find the lost signoffs, you can use the following command:\n```bash\ngit log --format=%s --author= \n```\nReplace `` with the author name who signed off on the commit, and `` with the hash of the commit that you're trying to push.\n\n**Step 3: Revert the lost signoffs**\n\nTo revert the lost signoffs, you can use the following command:\n```bash\ngit revert --no-commit\n```\nReplace `` with the hash of the commit that you're trying to revert.\n\n**Step 4: Re-push the", "metrics": { "length": 1094, "commands": 3, "command_list": [ "git config --get remote.origin.url", "git log --format=%s --author= ", "git revert --no-commit" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "DCO Signoff Lost During Force Push (dco-signoff-force-push-pitfall)", "condition": "with_lesson", "status": 200, "content": "Here's a concrete, actionable fix with exact commands to resolve the \"DCO Signoff Lost During Force Push\" issue:\n\n**Step 1: Fetch the latest changes from the upstream repository**\n\n```bash\ngit fetch upstream main\n```\n\n**Step 2: Reset your local branch to the latest changes from the upstream repository**\n\n```bash\ngit reset --hard upstream/main\n```\n\n**Step 3: Cherry-pick the commit with the `--signoff` option to preserve the signoff**\n\n```bash\ngit cherry-pick --signoff\n```\n\n**Step 4: Push the changes to your fork with the `--force` option**\n\n```bash\ngit push fork branch --force\n```\n\n**Verification:**\n\n1. Check if the PR has only one commit:\n\n```bash\ngh api repos/UPSTREAM/REPO/pulls/NUMBER/commits --jq 'length'\n```\n\n2. Verify that the commit has a signoff:\n\n```bash\ngit log --oneline main..branch\n```\n\nIf the commit has a signoff, you should see a `Signed-off-by` line in the commit message.\n\n**Prevention measures:**\n\n1. Set `git config format.signoff true", "metrics": { "length": 978, "commands": 6, "command_list": [ "git fetch upstream main", "git reset --hard upstream/main", "git cherry-pick --signoff", "git push fork branch --force", "gh api repos/UPSTREAM/REPO/pulls/NUMBER/commits --jq 'length'" ], "has_command_block": true, "actionable": true, "inline_code_count": 15, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "磁盘空间不足 / chroma_db_v4 CacheCleanup (disk-space-cleanup)", "condition": "with_lesson", "status": 200, "content": "To fix the error \"磁盘空间不足 / chroma_db_v4 CacheCleanup (disk-space-cleanup)\" and free up disk space, follow these steps:\n\n**Step 1: Check disk space usage**\n\nRun the following commands to check the disk space usage:\n```bash\n# Check ~/.hermes/ directory\ndu -sh ~/.hermes/ 2>/dev/null | sort -h\n\n# Check chroma_db_v4 directory\ndu -sh /mnt/d/Eric/知识库/chroma_db_v4/ 2>/dev/null\n```\nThis will show you the disk space usage of the specified directories.\n\n**Step 2: Clean up chroma_db_v4**\n\nRun the following commands to clean up chroma_db_v4:\n```bash\n# Check chroma version\nls /mnt/d/Eric/知识库/chroma_db_v4/\n\n# Backup chroma_db_v4 before cleaning\ncp -r /mnt/d/Eric/知识库/chroma_db_v4/ ~/chroma_db_v4_backup_$(date +%Y%m%d)\n\n# Clean up chroma_db_v4\n/mnt/d/Eric/知识库/chroma_db_v4/ CacheCleanup\n```\nThis will clean up the chroma", "metrics": { "length": 813, "commands": 5, "command_list": [ "du -sh ~/.hermes/ 2>/dev/null | sort -h", "du -sh /mnt/d/Eric/知识库/chroma_db_v4/ 2>/dev/null", "ls /mnt/d/Eric/知识库/chroma_db_v4/", "cp -r /mnt/d/Eric/知识库/chroma_db_v4/ ~/chroma_db_v4_backup_$(date +%Y%m%d)", "/mnt/d/Eric/知识库/chroma_db_v4/ CacheCleanup" ], "has_command_block": true, "actionable": true, "inline_code_count": 3, "lesson_hits": 2, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "磁盘空间不足 / chroma_db_v4 CacheCleanup (disk-space-cleanup)", "condition": "plain", "status": 200, "content": "The error message \"磁盘空间不足 / chroma_db_v4 CacheCleanup (disk-space-cleanup)\" indicates that the disk space is insufficient for the Chroma database to clean up its cache. Here's a step-by-step fix:\n\n**Step 1: Check the current disk usage**\n\nRun the following command to check the current disk usage:\n```bash\ndf -h\n```\nThis command will display the disk usage statistics for all partitions on your system.\n\n**Step 2: Identify the Chroma database directory**\n\nRun the following command to identify the Chroma database directory:\n```bash\nps -ef | grep chroma\n```\nThis command will display the process ID and command line of the Chroma process. Look for the directory path in the command line, which should be similar to `/path/to/chroma_db_v4`.\n\n**Step 3: Delete the cache directory**\n\nRun the following command to delete the cache directory:\n```bash\nrm -rf /path/to/chroma_db_v4/cache\n```\nReplace `/path/to/chroma_db_v4` with the actual directory path of your Chroma database.\n\n**Step 4: Restart the Chroma service**\n\nRun the following command to restart the Chroma service:\n```bash\nsystem", "metrics": { "length": 1085, "commands": 3, "command_list": [ "df -h", "ps -ef | grep chroma", "rm -rf /path/to/chroma_db_v4/cache" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 1, "lesson_hit_rate": 0.167 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Debugging memory leaks in Ruby (debugging-memory-leaks-in-ruby)", "condition": "with_lesson", "status": 200, "content": "Here's a concrete, actionable fix to debug memory leaks in Ruby:\n\n**Step 1: Graph Memory Over Time**\n\nTo monitor RSS (Resident Set Size) for key Ruby processes over extended periods, you can use the following tools:\n\n* **Graphite, statsd, and Grafana**: Install Graphite, statsd, and Grafana on your system. Configure statsd to collect metrics from your Ruby processes. Then, use Grafana to create dashboards to visualize the metrics.\n* **New Relic**: Install the New Relic agent in your Ruby application. Configure the agent to collect memory metrics. Then, use the New Relic dashboard to view the memory usage over time.\n* **Datadog**: Install the Datadog agent in your Ruby application. Configure the agent to collect memory metrics. Then, use the Datadog dashboard to view the memory usage over time.\n\n**Step 2: Enable Heap Dumping with Allocation Tracing (Ruby 2.1+)**\n\nTo enable heap dumping with allocation tracing, follow these steps:\n\n1. **Add the `objspace` gem to your Gemfile**:\n\n```ruby\ngem 'objspace'\n```\n\n2. **Require the `objspace` gem in your Ruby code**:\n\n", "metrics": { "length": 1074, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 3, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Debugging memory leaks in Ruby (debugging-memory-leaks-in-ruby)", "condition": "plain", "status": 200, "content": "**Fixing Memory Leaks in Ruby**\n\nTo debug memory leaks in Ruby, we can use the `ruby-prof` gem, which is a Ruby implementation of the profiling system found in the gprof profiling tool. We'll also use the `objspace` module to inspect the memory usage of objects.\n\n**Step 1: Install `ruby-prof`**\n\n Run the following command in your terminal:\n```bash\ngem install ruby-prof\n```\n**Step 2: Create a Test Script**\n\nCreate a new file called `test.rb` with the following code:\n```ruby\nrequire 'objspace'\nrequire 'ruby-prof'\n\nclass MemoryLeak\n def initialize\n @data = []\n end\n\n def add_data\n @data << \"some data\"\n end\n\n def get_data\n @data\n end\nend\n\nmemory_leak = MemoryLeak.new\n\n10000.times do\n memory_leak.add_data\nend\n\nputs memory_leak.get_data.size\n```\nThis script creates a `MemoryLeak` class that simulates a memory leak by storing a large amount of data in an array.\n\n**Step 3: Run the Test Script with `ruby-prof`**\n\n Run the following command in your terminal", "metrics": { "length": 976, "commands": 1, "command_list": [ "gem install ruby-prof" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "DSH Plugin Install Failures — GitHub codeload Timeout vs npm Channel (dsh-plugin-install-github-codeload-timeout)", "condition": "with_lesson", "status": 200, "content": "Here's a concrete, actionable fix with exact commands to resolve the DSH plugin install failures:\n\n**Step 1: Update the `dsh-plugin-install-github-codeload-timeout` plugin**\n\nRun the following command to update the plugin:\n```bash\ndsh plugin update dsh-plugin-install-github-codeload-timeout\n```\n**Step 2: Verify connectivity to codeload.github.com**\n\nRun the following command to verify connectivity to codeload.github.com:\n```bash\ncurl -sS -o /dev/null -w \"%{http_code}\\n\" https://codeload.github.com/\n```\nIf the command fails with a timeout error, you may need to configure your network settings to allow access to codeload.github.com.\n\n**Step 3: Update the `dsh-plugin-install-github-codeload-timeout` configuration**\n\nRun the following command to update the configuration:\n```bash\ndsh config set dsh-plugin-install-github-codeload-timeout prefer-npm\n```\nThis will force the plugin to prefer the npm channel when installing plugins.\n\n**Step 4: Verify plugin installation**\n\nRun the following command to verify plugin installation:\n```bash\ndsh plugin add misakanet --from", "metrics": { "length": 1074, "commands": 3, "command_list": [ "dsh plugin update dsh-plugin-install-github-codeload-timeout", "curl -sS -o /dev/null -w \"%{http_code}\\n\" https://codeload.github.com/", "dsh config set dsh-plugin-install-github-codeload-timeout prefer-npm" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 4, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "CI key rotation silently breaking scheduled automation without a code change (ci-key-rotation-silent-failure)", "condition": "with_lesson", "status": 200, "content": "To fix the issue of CI key rotation silently breaking scheduled automation without a code change, follow these steps:\n\n**Step 1: Verify the old secret value**\n\nRun the following command to check where the automation reads the secret from and confirm it still holds the old value:\n```bash\ngrep -rn \"ghp_\\|gho_\\|github_pat_\" .env ci/ 2/dev/null\n```\nThis command will search for lines containing `ghp_` or `gho_` or `github_pat_` in the `.env` and `ci/` directories, and print the matching lines along with their line numbers.\n\n**Step 2: Rotate the secret in one place**\n\nTo rotate the secret in one place, follow these steps:\n\n1. **Update the CI secret**: Log in to your CI platform and update the personal access token or long-lived secret with the new value.\n2. **Update the `.env` file**: Update the `.env` file with the new secret value. You can do this by running the following command:\n```bash\necho \"GITHUB_TOKEN=your-new-secret-value\" >> .env\n```\nReplace `your-new-secret-value` with the actual new secret value.\n3. **Update the deploy config", "metrics": { "length": 1047, "commands": 2, "command_list": [ "grep -rn \"ghp_\\|gho_\\|github_pat_\" .env ci/ 2/dev/null", "echo \"GITHUB_TOKEN=your-new-secret-value\" >> .env" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "CI key rotation silently breaking scheduled automation without a code change (ci-key-rotation-silent-failure)", "condition": "plain", "status": 200, "content": "The \"CI key rotation silently breaking scheduled automation without a code change\" issue is a known problem in GitHub Actions. Here's a concrete, actionable fix:\n\n**Step 1: Check if the issue is due to the GitHub Actions CI key rotation**\n\nRun the following command in your terminal to check if the issue is due to the CI key rotation:\n```bash\ngh api /repos/{owner}/{repo}/actions/secrets/public-keys | jq '.[] | .key_id'\n```\nReplace `{owner}` and `{repo}` with your actual repository owner and name.\n\nIf the output shows that the CI key has been rotated, proceed to the next step.\n\n**Step 2: Update the GitHub Actions secrets**\n\nRun the following command to update the GitHub Actions secrets:\n```bash\ngh api /repos/{owner}/{repo}/actions/secrets/public-keys | jq '.[] | .key_id' | xargs -I {} gh api /repos/{owner}/{repo}/actions/secrets/public-keys/{} -X PATCH -H \"Accept: application/vnd.github.v3+json\" -H \"Content-Type: application/json\" -d '{\"key_id\": \"{}\"}'\n```\nReplace `{owner}` and `{repo}` with your actual repository owner and name.\n\nThis command", "metrics": { "length": 1057, "commands": 2, "command_list": [ "gh api /repos/{owner}/{repo}/actions/secrets/public-keys | jq '.[] | .key_id'", "gh api /repos/{owner}/{repo}/actions/secrets/public-keys | jq '.[] | .key_id' | xargs -I {} gh api /repos/{owner}/{repo}/actions/secrets/public-keys/{} -X PATCH -H \"Accept: application/vnd.github.v3+json\" -H \"Content-Type: application/json\" -d '{\"key_id\": \"{}\"}'" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "DSH Plugin Install Failures — GitHub codeload Timeout vs npm Channel (dsh-plugin-install-github-codeload-timeout)", "condition": "plain", "status": 200, "content": "The error you're encountering is due to a timeout issue when trying to install a GitHub codeload plugin using the `dsh-plugin-install-github-codeload-timeout` command. Here's a concrete, actionable fix with exact commands to resolve this issue:\n\n**Fix 1: Increase the timeout value**\n\nYou can increase the timeout value by adding the `--timeout` option to the `dsh-plugin-install-github-codeload-timeout` command.\n\n```bash\ndsh plugin install github-codeload --timeout 300\n```\n\nIn this command, `300` is the new timeout value in seconds. You can adjust this value to a higher number if needed.\n\n**Fix 2: Use the `--no-timeout` option**\n\nAlternatively, you can use the `--no-timeout` option to disable the timeout check.\n\n```bash\ndsh plugin install github-codeload --no-timeout\n```\n\nThis option might not be suitable for all scenarios, as it disables the timeout check altogether.\n\n**Fix 3: Upgrade the `dsh` plugin**\n\nMake sure you're running the latest version of the `dsh` plugin. You can upgrade it using the following command:\n\n```bash\ndsh plugin upgrade\n``", "metrics": { "length": 1060, "commands": 2, "command_list": [ "dsh plugin install github-codeload --timeout 300", "dsh plugin install github-codeload --no-timeout" ], "has_command_block": true, "actionable": true, "inline_code_count": 13, "lesson_hits": 2, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "DSH Plugin Install Failures — GitHub codeload Timeout vs npm Channel (dsh-plugin-install-github-codeload-timeout)", "condition": "with_lesson", "status": 200, "content": "To fix the DSH plugin install failure due to GitHub codeload timeout, follow these steps:\n\n### Step 1: Verify Connectivity to GitHub Endpoints\n\nBefore choosing a channel, verify connectivity to GitHub endpoints using the following commands:\n\n```bash\n# Verify connectivity to codeload.github.com\ncurl -sS -o /dev/null -w \"%{http_code}\\n\" https://codeload.github.com\n\n# Verify connectivity to raw.githubusercontent.com\ncurl -sS -o /dev/null -w \"%{http_code}\\n\" https://raw.githubusercontent.com\n\n# Verify connectivity to registry.npmjs.org\ncurl -sS -o /dev/null -w \"%{http_code}\\n\" https://registry.npmjs.org\n```\n\nIf any of these endpoints return a non-200 status code, it may indicate a network issue.\n\n### Step 2: Prefer the npm Channel\n\nTo prefer the npm channel when the plugin is published to npm, use the following command:\n\n```bash\ndsh plugin add misakanet from npm registry — fast, no GitHub dependency\n```\n\nThis will install the plugin from the npm registry, which is faster and does not rely on GitHub.\n\n### Step 3: Update Marketplace Metadata (", "metrics": { "length": 1056, "commands": 4, "command_list": [ "curl -sS -o /dev/null -w \"%{http_code}\\n\" https://codeload.github.com", "curl -sS -o /dev/null -w \"%{http_code}\\n\" https://raw.githubusercontent.com", "curl -sS -o /dev/null -w \"%{http_code}\\n\" https://registry.npmjs.org", "dsh plugin add misakanet from npm registry — fast, no GitHub dependency" ], "has_command_block": true, "actionable": true, "inline_code_count": 3, "lesson_hits": 4, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "DSH Plugin Install Failures — GitHub codeload Timeout vs npm Channel (dsh-plugin-install-github-codeload-timeout)", "condition": "plain", "status": 200, "content": "To resolve the DSH Plugin Install Failures issue related to GitHub codeload timeout vs npm channel, you can try the following steps:\n\n**Step 1: Remove the existing plugin installation**\n\nRun the following command to remove the existing plugin installation:\n```bash\ndsh plugin uninstall dsh-plugin-install-github-codeload-timeout\n```\n\n**Step 2: Install the plugin using the npm channel**\n\nRun the following command to install the plugin using the npm channel:\n```bash\ndsh plugin install dsh-plugin-install-github-codeload-timeout --npm\n```\n\n**Step 3: Verify the plugin installation**\n\nRun the following command to verify the plugin installation:\n```bash\ndsh plugin list\n```\n\nThis should list the installed plugins, including the `dsh-plugin-install-github-codeload-timeout` plugin.\n\n**Alternative Solution:**\n\nIf the above solution doesn't work, you can also try the following:\n\n**Step 1: Remove the existing plugin installation**\n\nRun the following command to remove the existing plugin installation:\n```bash\ndsh plugin uninstall dsh-plugin-install-github-codeload-timeout\n```\n\n**Step 2: Install the plugin using the GitHub codeload timeout option**\n\nRun the", "metrics": { "length": 1158, "commands": 4, "command_list": [ "dsh plugin uninstall dsh-plugin-install-github-codeload-timeout", "dsh plugin install dsh-plugin-install-github-codeload-timeout --npm", "dsh plugin list", "dsh plugin uninstall dsh-plugin-install-github-codeload-timeout" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 2, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "DSH Plugin dsh.so L5 web-smoke — duplicate Loader entry id crashes plugin tree (dsh-plugin-l5-web-smoke-cordis-duplicate-entry)", "condition": "plain", "status": 200, "content": "The error you're encountering is due to a duplicate Loader entry ID in your DSH plugin. This issue can be resolved by removing the duplicate entry from your `dsh-plugin-l5-web-smoke-cordis.xml` file.\n\nHere's a step-by-step guide to fix the issue:\n\n1. **Stop the DSH service**: Before making any changes to the configuration file, stop the DSH service. You can do this by running the following command:\n\n ```bash\nsudo systemctl stop dsh\n```\n\n2. **Find the duplicate entry**: Locate the `dsh-plugin-l5-web-smoke-cordis.xml` file in the DSH configuration directory. The default location is `/etc/dsh/plugins/`. You can use the following command to find the file:\n\n ```bash\nsudo find /etc/dsh/plugins -name dsh-plugin-l5-web-smoke-cordis.xml\n```\n\n This will list the path to the file. You can then edit the file to remove the duplicate entry.\n\n3. **Edit the configuration file**: Open the `dsh-plugin-l5-web-smoke-cordis.xml` file in a text editor. You can use the following command to edit the file:\n\n ```bash\nsudo nano", "metrics": { "length": 1024, "commands": 2, "command_list": [ "sudo systemctl stop dsh", "sudo find /etc/dsh/plugins -name dsh-plugin-l5-web-smoke-cordis.xml" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 1, "lesson_hit_rate": 0.2 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "DSH Plugin dsh.so L5 web-smoke — duplicate Loader entry id crashes plugin tree (dsh-plugin-l5-web-smoke-cordis-duplicate-entry)", "condition": "with_lesson", "status": 200, "content": "The error occurs because the plugin is trying to insert the same entry ID twice, which is not allowed. To fix this issue, you can remove the `insert` section from the `cordis.patch.yml` file in the `dsh.bundle.patch` file. \n\nHere's the corrected `cordis.patch.yml` file:\n\n```yaml\n- remove:\n - id: misakanet\n name: misakanet\n```\n\nYou can apply this change using the following command:\n\n```bash\n$ patch -p0 < cordis.patch\n```\n\nAfter applying the patch, you can publish the updated plugin to DSH:\n\n```bash\n$ export DSH_HOME=/tmp/dsh-home\n$ mkdir -p $DSH_HOME/profiles/test\n$ cat $DSH_HOME/profiles/test/package.json < cordis.patch.yml.fixed\n```\n\n3. Replace the original `cordis.patch.yml` file with the modified one:\n ```bash\nmv cordis.patch.yml.fixed cordis.patch.yml\n```\n\n4. Rebuild the `dsh.bundle.patch` file using the modified `cordis.patch.yml` file:\n ```bash\n./gradlew build\n```\n\n5. Verify that the `dsh.bundle.patch` file has been rebuilt successfully:\n ```bash\nls dsh.bundle.patch\n```\n\n6. Publish the updated MisakaNet plugin to `dsh.so`:\n ```bash\ncurl -X", "metrics": { "length": 916, "commands": 6, "command_list": [ "git clone https://github.com/Ikalus1988/MisakaNet.git", "cd MisakaNet/dsh", "cat cordis.patch.yml | sed 's/- id: misakanet//g' > cordis.patch.yml.fixed", "mv cordis.patch.yml.fixed cordis.patch.yml", "./gradlew build" ], "has_command_block": true, "actionable": true, "inline_code_count": 20, "lesson_hits": 2, "lesson_hit_rate": 0.4 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "DSH Plugin dsh.so L5 web-smoke — duplicate Loader entry id crashes plugin tree (dsh-plugin-l5-web-smoke-cordis-duplicate-entry)", "condition": "plain", "status": 200, "content": "The error you're experiencing is due to a duplicate entry in the plugin tree of DSH (Distributed Shell). This can occur when there are multiple plugins with the same name but different versions. To fix this issue, you'll need to remove the duplicate plugin entry from the plugin tree.\n\nHere's a concrete, actionable fix:\n\n**Step 1: Stop the DSH service**\n\n```bash\nsudo service dsh stop\n```\n\n**Step 2: Delete the duplicate plugin entry**\n\nYou can find the plugin tree in the `/etc/dsh/plugins` directory. Navigate to this directory and find the plugin with the duplicate entry. In your case, it's `dsh-plugin-l5-web-smoke-cordis`. Delete the duplicate entry:\n\n```bash\nsudo rm /etc/dsh/plugins/dsh-plugin-l5-web-smoke-cordis\n```\n\n**Step 3: Remove the duplicate entry from the plugin list**\n\nYou can find the plugin list in the `/etc/dsh/plugins.lst` file. Open this file in a text editor and remove the duplicate entry:\n\n```bash\nsudo nano /etc/dsh/plugins.lst\n```\n\nDelete the line containing the duplicate plugin entry and save the file.\n\n**Step 4: Restart the DSH", "metrics": { "length": 1062, "commands": 3, "command_list": [ "sudo service dsh stop", "sudo rm /etc/dsh/plugins/dsh-plugin-l5-web-smoke-cordis", "sudo nano /etc/dsh/plugins.lst" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 1, "lesson_hit_rate": 0.2 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Erreur de permission Docker: permission denied sur /var/run/docker.sock (erreur-permission-docker-linux)", "condition": "with_lesson", "status": 200, "content": "To fix the \"Erreur de permission Docker: permission denied sur /var/run/docker.sock\" error, follow these steps:\n\n**Step 1: Check if the docker group exists**\n\n```bash\ngrep docker /etc/group\n```\n\nIf the group does not exist, proceed to the next step.\n\n**Step 2: Create the docker group (if it doesn't exist)**\n\n```bash\nsudo groupadd docker\n```\n\n**Step 3: Add your user to the docker group**\n\n```bash\nsudo usermod -aG docker $USER\n```\n\n**Step 4: Activate the group change**\n\nYou can either log out and log back in, or run:\n\n```bash\nnewgrp docker\n```\n\n**Step 5: Verify the fix**\n\n```bash\ngrep docker /etc/group\necho \"Verification passed: fix command exited 0\"\n```\n\nThis should output \"Verification passed: fix command exited 0\" without any errors.\n\n**Optional Step 6: Restart the Docker service (if the error persists)**\n\n```bash\nsudo systemctl restart docker\n```\n\nAfter completing these steps, you should be able to run Docker commands without any permission errors.", "metrics": { "length": 964, "commands": 7, "command_list": [ "grep docker /etc/group", "sudo groupadd docker", "sudo usermod -aG docker $USER", "newgrp docker", "grep docker /etc/group" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 5, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Erro de push rejeitado no Git: branches divergentes e como resolver (erro-push-git-rejeitado-divergente)", "condition": "with_lesson", "status": 200, "content": "To fix the \"branches divergentes\" error in Git, follow these steps:\n\n**Approach 1: Merge (Recommended for Beginners)**\n\n1. **Fetch the latest changes from the remote repository:**\n ```bash\ngit fetch origin\n```\n2. **Merge the latest changes into your local branch:**\n ```bash\ngit pull origin main\n```\n If conflicts occur, you'll see a message indicating the conflicts.\n3. **Resolve the conflicts manually by editing the conflicting files:**\n Open the files mentioned in the conflict message and resolve the issues.\n4. **Add the resolved files to the staging area:**\n ```bash\ngit add arquivo.txt\n```\n Replace \"arquivo.txt\" with the actual file name.\n5. **Commit the resolved merge conflicts:**\n ```bash\ngit commit -m \"Resolve merge conflicts with origin/main\"\n```\n6. **Push the updated branch to the remote repository:**\n ```bash\ngit push origin main\n```\n\n**Approach 2: Rebase (Linear History, More Advanced)**\n\n1. **Fetch the latest changes from the remote repository:**\n ```bash\ngit fetch origin\n```\n2. **Rebase the latest changes onto", "metrics": { "length": 1053, "commands": 6, "command_list": [ "git fetch origin", "git pull origin main", "git add arquivo.txt", "git commit -m \"Resolve merge conflicts with origin/main\"", "git push origin main" ], "has_command_block": true, "actionable": false, "inline_code_count": 11, "lesson_hits": 7, "lesson_hit_rate": 0.875 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Error de DCO sign-off en commits de Git en Windows (error-dco-signoff-windows)", "condition": "with_lesson", "status": 200, "content": "Aquí te dejo un paso a paso para solucionar el problema de DCO sign-off en commits de Git en Windows:\n\n**Paso 1: Verificar la configuración actual**\n\nEjecuta el siguiente comando en Git Bash, PowerShell o WSL:\n```bash\ngit config --list --show-origin | grep user\n```\nEsto te mostrará la configuración actual de `user.name` y `user.email` en los diferentes niveles (sistema, global y local).\n\n**Paso 2: Configurar la configuración de usuario**\n\nEjecuta los siguientes comandos en Git Bash, PowerShell o WSL:\n```bash\ngit config --global user.name \"Tu Nombre\"\ngit config --global user.email \"tu.email@example.com\"\n```\nReemplaza \"Tu Nombre\" y \"tu.email@example.com\" con tus datos reales.\n\n**Paso 3: Verificar la configuración**\n\nEjecuta el siguiente comando para verificar que la configuración se haya establecido correctamente:\n```bash\ngit config --list --show-origin | grep user\n```\nDeberías ver que la configuración de `user.name` y `user.email` se ha establecido en el nivel global.\n\n**P", "metrics": { "length": 986, "commands": 4, "command_list": [ "git config --list --show-origin | grep user", "git config --global user.name \"Tu Nombre\"", "git config --global user.email \"tu.email@example.com\"", "git config --list --show-origin | grep user" ], "has_command_block": true, "actionable": false, "inline_code_count": 9, "lesson_hits": 5, "lesson_hit_rate": 0.625 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Error de DCO sign-off en commits de Git en Windows (error-dco-signoff-windows)", "condition": "plain", "status": 200, "content": "El error \"Error de DCO sign-off en commits de Git en Windows\" se debe a que Git no puede encontrar la clave GPG para firmar los commits. Aquí te dejo un paso a paso para solucionar este problema:\n\n**1. Instalar GPG**\n\nPrimero, debes instalar GPG (GNU Privacy Guard) en tu sistema. Puedes hacerlo de la siguiente manera:\n\n* Abrir el administrador de paquetes de tu sistema (en Windows 10, puedes hacerlo escribiendo \"Administrador de paquetes\" en la barra de búsqueda).\n* Buscar y instalar \"GPG Tools\" (en Windows 10, es posible que debas buscar \"GnuPG\" en la tienda de aplicaciones).\n* Seguir las instrucciones de instalación.\n\n**2. Configurar GPG**\n\nUna vez instalado GPG, debes configurarlo para que funcione correctamente con Git. Puedes hacerlo de la siguiente manera:\n\n* Abrir la terminal de Git (si no tienes la terminal de Git instalada, puedes descargar Git y seguir las instrucciones de instalación).\n* Ejecutar el siguiente comando para generar una clave GPG:\n``", "metrics": { "length": 972, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 0, "lesson_hits": 4, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "FANUC Backup Payload Extraction — .VR/.SV Binary Parsing and .LS Text Fallback (fanuc-backup-payload-extraction)", "condition": "plain", "status": 200, "content": "The error you're encountering with the FANUC Backup Payload Extraction library is likely due to missing dependencies or incorrect installation. Here's a step-by-step guide to resolve the issue:\n\n**Prerequisites:**\n\n1. Python 3.8 or later installed on your system.\n2. pip (Python package installer) installed on your system.\n\n**Step 1: Install Required Libraries**\n\nOpen your terminal or command prompt and run the following commands to install the required libraries:\n\n```bash\npip install pefile\npip install pytz\npip install pyyaml\npip install requests\npip install pillow\n```\n\n**Step 2: Install FANUC Backup Payload Extraction Library**\n\nIf you haven't installed the FANUC Backup Payload Extraction library yet, you can do so by running the following command:\n\n```bash\npip install fanuc-backup-payload-extraction\n```\n\n**Step 3: Verify Installation**\n\nTo verify that the library has been installed correctly, you can run the following command:\n\n```bash\npython -c \"import fanuc_backup_payload_extraction\"\n```\n\nIf the installation was successful, you should not see any errors.\n\n**Step 4: Update the Library (if necessary)**\n\nIf you're still encountering issues, you can try updating", "metrics": { "length": 1180, "commands": 7, "command_list": [ "pip install pefile", "pip install pytz", "pip install pyyaml", "pip install requests", "pip install pillow" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 3, "lesson_hit_rate": 0.375 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "FANUC DCS Safety System — Configuration and Stop Modes (fanuc-dcs-safety-configuration)", "condition": "with_lesson", "status": 200, "content": "**Fixing FANUC DCS Safety System Configuration Issue**\n\nTo resolve the issue, you need to review and adjust the configuration of the FANUC DCS safety system. The exact steps may vary depending on your specific system and configuration. Here's a step-by-step guide to help you fix the issue:\n\n**Step 1: Check the Configuration File**\n\n1. Open the FANUC DCS configuration file using a text editor or a configuration software (e.g., FANUC R-30iB Plus).\n2. Review the configuration settings to ensure they match the recommended settings for your system.\n\n**Step 2: Verify the Stop Modes**\n\n1. Check the stop modes configuration in the FANUC DCS configuration file.\n2. Ensure that the emergency stop mode is set to \"Cut drive power on E-stop button (default)\".\n3. Verify that the position/speed check, joint speed check, and basic position check are enabled and configured correctly.\n\n**Step 3: Review Safety I/O Connections**\n\n1. Check the safety I/O connections configuration in the FANUC DCS configuration file.\n2. Ensure that the safety signals are connected correctly and that the safety I/O connection option is enabled.\n\n**Step 4: Update the Configuration", "metrics": { "length": 1157, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "FANUC DCS Safety System — Configuration and Stop Modes (fanuc-dcs-safety-configuration)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely due to a configuration issue with the FANUC DCS Safety System. To troubleshoot and fix the issue, you'll need to follow these steps:\n\n**Step 1: Check the Safety System Status**\n\n1. Connect to the FANUC DCS Safety System using a terminal or console.\n2. Run the following command to check the safety system status:\n```bash\nSVC-STAT\n```\nThis command will display the current status of the safety system.\n\n**Step 2: Check the Stop Modes**\n\n1. Run the following command to check the stop modes:\n```bash\nSVC-STOP\n```\nThis command will display the current stop modes.\n\n**Step 3: Check the Configuration**\n\n1. Run the following command to check the configuration:\n```bash\nSVC-CONF\n```\nThis command will display the current configuration of the safety system.\n\n**Step 4: Reset the Safety System**\n\n1. If the safety system is not functioning correctly, you may need to reset it.\n2. Run the following command to reset the safety system:\n```bash\nSVC-RST\n```\nThis command will reset the safety system to its default state.\n\n**Step 5: Re-configure the", "metrics": { "length": 1077, "commands": 4, "command_list": [ "SVC-STAT", "SVC-STOP", "SVC-CONF", "SVC-RST" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "FANUC INTP-102 DETECT JOINT — OLP Whitespace Bug (fanuc-intp-102-detect-joint-olp-whitespace)", "condition": "with_lesson", "status": 200, "content": "**Fixing the FANUC INTP-102 DETECT JOINT OLP Whitespace Bug**\n\n**Step 1: Compare .ls Files**\n\nExtract the `.ls` from the robot controller (FTP or memory card) and diff against the OLP-generated version:\n\n```bash\ndiff robot_original.ls olp_generated.ls\n```\n\n**Step 2: Fix Trailing Whitespace**\n\nRemove extra spaces before semicolons in sensor instructions. Use the following command to fix the `.ls` file generated by the OLP tool:\n\n```bash\nsed -i 's/; */; /g' olp_generated.ls\n```\n\nThis command uses `sed` to replace all occurrences of one or more spaces (`*`) followed by a semicolon (`;`) with just a semicolon (`;`).\n\n**Step 3: Verify the Fix**\n\nAfter fixing the `.ls` file, verify that the FANUC controller accepts the program without throwing an INTP-102 error.\n\n**Additional Verification Steps**\n\nTo ensure that the fix is correct and the issue is resolved, you can perform the following additional verification steps:\n\n1. Re-upload the fixed `.ls` file to the FANUC controller and verify that the program executes without errors.\n", "metrics": { "length": 1039, "commands": 2, "command_list": [ "diff robot_original.ls olp_generated.ls", "sed -i 's/; */; /g' olp_generated.ls" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "FANUC INTP-102 DETECT JOINT — OLP Whitespace Bug (fanuc-intp-102-detect-joint-olp-whitespace)", "condition": "plain", "status": 200, "content": "To fix the FANUC INTP-102 DETECT JOINT — OLP Whitespace Bug, you'll need to update the OLP (Operating Logic Programmer) on your FANUC robot controller. Here are the exact steps:\n\n**Note:** Before making any changes to your OLP, ensure you have a backup of the current version. This will allow you to revert to the previous version if needed.\n\n**Step 1: Connect to the FANUC Robot Controller**\n\n1. Connect to the FANUC robot controller using a terminal or command prompt.\n2. Log in to the controller using the default username and password (usually \"admin\" and \"password\").\n\n**Step 2: Download the Latest OLP Update**\n\n1. Open a web browser and navigate to the FANUC support website: [www.fanuc.com](http://www.fanuc.com).\n2. Click on \"Support\" and then \"Robot Support\".\n3. Select your robot model and click on \"Download\".\n4. Search for the latest OLP update for your robot model.\n5. Download the update to your local machine.\n\n**Step 3: Upload the New OLP Update**\n\n1. Connect to the FANUC robot controller using a terminal or command prompt", "metrics": { "length": 1041, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "FANUC IO Marker M[] Instruction — Background Logic Alternative (fanuc-io-marker-m-instruction)", "condition": "with_lesson", "status": 200, "content": "**Fix: Enable Markers and Use M[] Option**\n\nTo enable markers and use the M[] option, follow these steps:\n\n### Step 1: Enable Markers\n\nOpen the `~/.fswrapper` file in a text editor (e.g., `nano` or `vim`) and add the following line:\n\n```bash\n$MIX_LOGIC.$USE_MKR = TRUE\n```\n\nSave the file.\n\n### Step 2: Restart FSW\n\nRestart the FSW (FANUC Handling Tool) to apply the changes.\n\n```bash\nsudo systemctl restart fsw\n```\n\n### Step 3: Verify Marker Option\n\nOpen the FSW and navigate to `MENU → I/O`. The Marker option should now be visible.\n\n### Step 4: Use M[] Option\n\nTo use the M[] option, add the following line to your FSW program:\n\n```bash\nfanuc\nM[1] = (DI[1] AND DI[2])\n```\n\nThis will continuously evaluate the Boolean expression and update the M[1] marker accordingly.\n\n### Example Use Case: Analog Sensor to Digital Input\n\nTo map an analog sensor to a marker for an MH valve input, use the following code:\n\n```bash\nfanuc\n", "metrics": { "length": 923, "commands": 4, "command_list": [ "$MIX_LOGIC.$USE_MKR = TRUE", "sudo systemctl restart fsw", "fanuc", "M[1] = (DI[1] AND DI[2])" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 2, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "FANUC IO Marker M[] Instruction — Background Logic Alternative (fanuc-io-marker-m-instruction)", "condition": "plain", "status": 200, "content": "The error you're encountering is related to the FANUC IO Marker M[] instruction in the Background Logic Alternative. \n\nTo resolve this issue, you'll need to check the following:\n\n1. **IO Marker Configuration**: Ensure that the IO Marker M[] is properly configured in the FANUC controller. Check the controller's documentation for the correct configuration settings.\n\n2. **IO Marker M[] Instruction**: Verify that the IO Marker M[] instruction is correctly programmed in the Background Logic Alternative. The instruction should be properly formatted, and the parameters should match the expected values.\n\n3. **IO Marker M[] Data Type**: Ensure that the data type of the IO Marker M[] is correctly set. It should match the expected data type for the instruction.\n\n4. **IO Marker M[] Bit Position**: Verify that the bit position of the IO Marker M[] is correctly set. It should match the expected bit position for the instruction.\n\nHere's an example of how to fix the issue:\n\nAssuming you're using a FANUC controller with a programming language like FANUC MELSEC L-series, you can use the following commands to check and fix the IO Marker M[] configuration:\n\n```sql\n-- Check the IO Marker M[] configuration\nSELECT * FROM FANUC", "metrics": { "length": 1223, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 1, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "FANUC MI Standard Software — Complete Instruction Reference (MI01-MI22) (fanuc-mi-standard-software-instructions)", "condition": "with_lesson", "status": 200, "content": "**Fixing the FANUC MI Standard Software Error**\n\nBased on the provided instructions, the error seems to be related to the `CollZone` instruction in the `MI01_CMN` module. The `CollZone` instruction requires the following parameters:\n\n* Param 1: `CollZone`\n* Param 2: `Request` or `Release`\n* Param 3: `ZoneNo.` (1-32)\n* Param 4: `Comment` (max 32 chars)\n\nTo fix the error, you need to provide the correct parameters for the `CollZone` instruction. Here's a concrete, actionable fix:\n\n**Example 1: Requesting a collision zone**\n\n```karel\nCALL MI01_CMN(CollZone, Request, ZoneNo.=1, 'Requesting collision zone 1')\n```\n\n**Example 2: Releasing a collision zone**\n\n```karel\nCALL MI01_CMN(CollZone, Release, ZoneNo.=1, 'Releasing collision zone 1')\n```\n\nMake sure to replace `ZoneNo.=1` with the actual zone number you want to request or release. Also, update the comment parameter as needed.\n\n**Additional Tips**\n\n* Double-check the instruction format and parameters to ensure", "metrics": { "length": 971, "commands": 1, "command_list": [ "**Example 2: Releasing a collision zone**" ], "has_command_block": true, "actionable": true, "inline_code_count": 13, "lesson_hits": 1, "lesson_hit_rate": 0.125 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Erreur de permission Docker: permission denied sur /var/run/docker.sock (erreur-permission-docker-linux)", "condition": "plain", "status": 200, "content": "**Fixing Docker Permission Error on Linux**\n\nThe error \"Erreur de permission Docker: permission denied sur /var/run/docker.sock\" typically occurs when the Docker daemon is not running with the correct permissions. Here's a step-by-step solution:\n\n### 1. Stop the Docker Service\n\nFirst, stop the Docker service to prevent any conflicts during the permission change:\n```bash\nsudo systemctl stop docker\n```\n### 2. Change the Docker Group Ownership\n\nBy default, the Docker group is `docker`. We'll change the ownership of the `/var/run/docker.sock` file to the `docker` group:\n```bash\nsudo groupadd docker\n```\n### 3. Add Your User to the Docker Group\n\nAdd your current user to the `docker` group:\n```bash\nsudo usermod -aG docker $USER\n```\nThe `-aG` flag adds the user to the group without modifying the existing groups.\n\n### 4. Reload the Docker Service\n\nReload the Docker service to apply the new group ownership:\n```bash\nsudo systemctl daemon-reload\n```\n### 5. Restart the Docker Service\n\nFinally, restart the Docker service to ensure the changes take effect:\n```bash\nsudo systemctl start docker\n```\n### 6.", "metrics": { "length": 1104, "commands": 5, "command_list": [ "sudo systemctl stop docker", "sudo groupadd docker", "sudo usermod -aG docker $USER", "sudo systemctl daemon-reload", "sudo systemctl start docker" ], "has_command_block": true, "actionable": true, "inline_code_count": 14, "lesson_hits": 5, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Erro de push rejeitado no Git: branches divergentes e como resolver (erro-push-git-rejeitado-divergente)", "condition": "plain", "status": 200, "content": "O erro \"branches divergentes\" no Git ocorre quando você tenta pushar um commit para um repositório remoto, mas o repositório remoto não está atualizado com os commits locais. Aqui está um passo a passo para resolver o problema:\n\n**Passo 1: Verifique a situação atual**\n\nVerifique quais branches você está trabalhando e quais branches existem no repositório remoto:\n\n```bash\ngit branch -a\ngit ls-remote --heads origin\n```\n\n**Passo 2: Rebaixe o repositório remoto**\n\nRebaixe o repositório remoto para atualizar seus commits locais:\n\n```bash\ngit fetch origin\n```\n\n**Passo 3: Resolva as divergências**\n\nUse o comando `git merge` ou `git rebase` para resolver as divergências entre o seu branch local e o branch remoto:\n\n**Opção 1: Merge**\n\n```bash\ngit merge origin/\n```\n\n**Opção 2: Rebase**\n\n```bash\ngit rebase origin/\n```\n\nSe você preferir usar `git rebase`, cert", "metrics": { "length": 892, "commands": 5, "command_list": [ "git branch -a", "git ls-remote --heads origin", "git fetch origin", "git merge origin/", "git rebase origin/" ], "has_command_block": true, "actionable": false, "inline_code_count": 10, "lesson_hits": 6, "lesson_hit_rate": 0.75 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "FANUC Backup Payload Extraction — .VR/.SV Binary Parsing and .LS Text Fallback (fanuc-backup-payload-extraction)", "condition": "with_lesson", "status": 200, "content": "**Fixing FANUC Backup Payload Extraction**\n\nTo extract the payload configuration from a FANUC robot backup directory, we will use the `pefile` and `pyreadline` libraries to parse the proprietary binary formats (.vr, .sv) and the `re` library for regular expression matching.\n\n**Step 1: Install required libraries**\n\n```bash\npip install pefile pyreadline\n```\n\n**Step 2: Define a function to parse .vr and .sv files**\n\n```python\nimport pefile\nimport pyreadline\nimport re\n\ndef parse_vr_sv(file_path):\n # Open the file in binary mode\n with open(file_path, 'rb') as f:\n # Read the file contents\n data = f.read()\n\n # Check the magic header for .vr files\n if data[:2] == b'\\xfe\\xef':\n # Parse the .vr file\n payload = parse_vr(data)\n elif data[:6] == b'system':\n # Parse the .sv file\n payload = parse_sv(data)\n else:\n # If the file is not a .vr or .sv file, return an error message\n return 'Error:", "metrics": { "length": 963, "commands": 1, "command_list": [ "pip install pefile pyreadline" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 3, "lesson_hit_rate": 0.375 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "FANUC MI Standard Software — Complete Instruction Reference (MI01-MI22) (fanuc-mi-standard-software-instructions)", "condition": "plain", "status": 200, "content": "However, I need more information about the error you're encountering. The FANUC MI Standard Software Instruction Reference document covers a wide range of instructions, and without knowing which specific instruction or error you're dealing with, it's challenging to provide a precise fix.\n\nThat being said, I can offer some general guidance on how to troubleshoot and potentially resolve errors related to FANUC MI instructions.\n\n**Troubleshooting Steps:**\n\n1. **Check the Instruction Code**: Verify that you're using the correct instruction code. Make sure to check the instruction reference manual for the exact code and syntax.\n2. **Check the Syntax**: Ensure that the instruction syntax is correct. Pay attention to the order of parameters, data types, and any other specific requirements.\n3. **Check the Parameters**: Verify that the parameters passed to the instruction are correct and match the expected data types.\n4. **Check the Instruction Set**: Ensure that the instruction is part of the supported instruction set for your FANUC controller.\n\n**Example Fix:**\n\nLet's assume you're encountering an error with the `MOV` instruction, which moves data from one register to another. Suppose the error message indicates that the destination register is incorrect.\n\n**Error Message:** `Invalid destination register`\n\n**Fix:**\n\n1", "metrics": { "length": 1332, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 2, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Async question answers are pulled, not pushed (stateless MCP) (mcp-question-answer-pull-delivery)", "condition": "plain", "status": 200, "content": "The error you're encountering suggests that your application is not updating the question answers in real-time, but rather only on push updates. This is because you're using a stateless MCP (Message Queueing Protocol) for question answer delivery.\n\nHere's a concrete, actionable fix to update question answers in real-time using WebSockets:\n\n**Step 1: Install required packages**\n\nIn your project directory, run the following command:\n```bash\nnpm install ws\n```\nThis will install the WebSocket library.\n\n**Step 2: Set up WebSockets**\n\nCreate a new file called `ws.js` in your project directory:\n```javascript\nconst WebSocket = require('ws');\n\nconst wss = new WebSocket.Server({ port: 8080 });\n\nwss.on('connection', (ws) => {\n console.log('Client connected');\n\n // Handle incoming messages from the client\n ws.on('message', (message) => {\n console.log(`Received message: ${message}`);\n // Process the message here\n });\n\n // Handle errors\n ws.on('error', (error) => {\n console.error('Error occurred:', error);\n });\n\n // Handle disconnections\n ws.on('close', () => {\n console.log('Client disconnected');\n", "metrics": { "length": 1122, "commands": 1, "command_list": [ "npm install ws" ], "has_command_block": true, "actionable": true, "inline_code_count": 4, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "FANUC Payload Estimation — Auto and Manual Load Configuration (fanuc-payload-estimation)", "condition": "with_lesson", "status": 200, "content": "To fix the FANUC Payload Estimation error, you need to follow the steps for either Auto Estimation or Manual Configuration, depending on whether you want the system to calculate the payload parameters or if you already know them.\n\n**Auto Estimation:**\n\n1. **Install end effector on robot**: Make sure the end effector is properly attached to the robot.\n2. **Navigate to payload estimation function**:\n - Press the `MENU` button on the FANUC controller.\n - Select `Setup`.\n - Choose `Payload Estimation`.\n - Select the estimation method (typically 4-point or 6-point).\n - Press `EXECUTE` to start the calibration process.\n3. **Review and save results**:\n - After the calibration process is complete, review the estimated payload parameters (mass, center of gravity, and inertia).\n - If the results are accurate, press `SAVE RESULTS` to store the payload parameters.\n\n**Manual Configuration:**\n\n1. **Navigate to payload configuration**:\n - Press the `MENU` button on the FANUC controller.\n - Select `Setup`.\n - Choose `Frames`.\n - Select `Payload`.\n - Choose the payload number you want to configure (e.g., payload", "metrics": { "length": 1136, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 9, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Async question answers are pulled, not pushed (stateless MCP) (mcp-question-answer-pull-delivery)", "condition": "with_lesson", "status": 200, "content": "To address the issue of async question answers being pulled, not pushed, we need to modify the MCP system to make the answer a re-queryable artifact and provide the asker with an explicit way to pull it. Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Update the MCP tool to store the answer in a re-queryable artifact**\n\nUpdate the `misakanet_submit_intake` function to store the answer in a re-queryable artifact, such as a Redis hash with a TTL of 7 days:\n```python\nimport redis\n\n# Connect to Redis\nredis_client = redis.Redis(host='localhost', port=6379, db=0)\n\ndef misakanet_submit_intake(data):\n # ... (existing code)\n answer = data['answer']\n question_id = data['question_id']\n \n # Store the answer in a re-queryable artifact\n redis_client.hset('answers', question_id, answer, ex=604800) # 7-day TTL\n \n # ... (existing code)\n```\n**Step 2: Update the MCP tool to return a unique key for the answer**\n\nUpdate the `misakanet_submit_intake` function to return a unique key for the answer, which can", "metrics": { "length": 1043, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 3, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "mcporter Cloudflare OAuth: Correct Endpoint, No Scope, and WSL Callback Trap (mcporter-cloudflare-oauth-endpoint-scope-wsl-callback)", "condition": "with_lesson", "status": 200, "content": "To fix the error, you'll need to update your `mcporter-cloudflare-oauth-endpoint-scope-wsl-callback` library to use the correct authorization endpoint and omit the scope parameter. Additionally, you'll need to modify your callback handling to ensure that the callback reaches WSL.\n\nHere are the concrete, actionable fixes:\n\n**Update the authorization endpoint in the `mcporter-cloudflare-oauth-endpoint-scope-wsl-callback` library**\n\nReplace the following line in `lib/index.js` with the corrected code:\n```javascript\nconst authEndpoint = 'https://dash.cloudflare.com/oauth2/auth';\n```\nwith:\n```javascript\nconst authEndpoint = 'https://mcp.cloudflare.com/authorize';\n```\n**Omit the scope parameter**\n\nIn `lib/index.js`, replace the following line:\n```javascript\nconst scope = 'mcp:tools';\n```\nwith:\n```javascript\nconst scope = '';\n```\nor simply omit it altogether:\n```javascript\nconst scope = undefined;\n```\n**Modify the callback handling to reach WSL**\n\nYou'll need to create a new process in WSL to handle the callback. You can use the `child_process` module to achieve this.\n\nIn `lib/index.js`, add the following code to", "metrics": { "length": 1123, "commands": 5, "command_list": [ "with:", "**Omit the scope parameter**", "In `lib/index.js`, replace the following line:", "with:", "or simply omit it altogether:" ], "has_command_block": true, "actionable": true, "inline_code_count": 15, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "FANUC Payload Estimation — Auto and Manual Load Configuration (fanuc-payload-estimation)", "condition": "plain", "status": 200, "content": "The error you're encountering with the FANUC Payload Estimation package is likely due to a missing or incompatible dependency. Here's a step-by-step guide to resolve the issue:\n\n**Method 1: Upgrade the FANUC Payload Estimation Package**\n\n1. **Check the current package version**: Run the following command to check the current version of the FANUC Payload Estimation package:\n ```bash\npip show fanuc-payload-estimation\n```\n2. **Update the package**: Upgrade the package to the latest version using the following command:\n ```bash\npip install --upgrade fanuc-payload-estimation\n```\n3. **Verify the update**: Check the package version again to ensure it has been updated:\n ```bash\npip show fanuc-payload-estimation\n```\n\n**Method 2: Install Required Dependencies**\n\n1. **Check dependencies**: The FANUC Payload Estimation package requires the `pyserial` and `numpy` libraries. Install them using the following commands:\n ```bash\npip install pyserial numpy\n```\n2. **Verify dependencies**: Check if the dependencies are installed correctly:\n ```bash\npip show pyserial numpy\n```\n\n**Method 3: Reinstall the F", "metrics": { "length": 1111, "commands": 5, "command_list": [ "pip show fanuc-payload-estimation", "pip install --upgrade fanuc-payload-estimation", "pip show fanuc-payload-estimation", "pip install pyserial numpy", "pip show pyserial numpy" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "mcporter Cloudflare OAuth: Correct Endpoint, No Scope, and WSL Callback Trap (mcporter-cloudflare-oauth-endpoint-scope-wsl-callback)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely due to a mismatch between the OAuth callback URL and the URL specified in your Cloudflare OAuth settings.\n\nHere's a step-by-step guide to fix the issue:\n\n**Step 1: Identify the correct callback URL**\n\n1. Go to the Cloudflare dashboard and navigate to **Settings** > **Security** > **Two-Factor Authentication (2FA)**.\n2. Click on **Advanced settings** and then click on **OAuth**.\n3. Look for the **Callback URL** field and note the exact URL provided.\n\n**Step 2: Update your WSL configuration**\n\n1. Open your WSL terminal and run the following command to update the `~/.bashrc` file:\n```bash\nnano ~/.bashrc\n```\n2. Add the following line at the end of the file:\n```bash\nexport MCPORTER_CLOUDFLARE_OAUTH_CALLBACK_URL=\"YOUR_CALLBACK_URL\"\n```\nReplace `YOUR_CALLBACK_URL` with the exact callback URL you noted in Step 1.\n\n3. Save and close the file by pressing `Ctrl+X`, then `Y`, and finally `Enter`.\n\n4. Run the following command to apply the changes:\n```bash\nsource ~/.bashrc\n```\n\n**Step ", "metrics": { "length": 1027, "commands": 3, "command_list": [ "nano ~/.bashrc", "export MCPORTER_CLOUDFLARE_OAUTH_CALLBACK_URL=\"YOUR_CALLBACK_URL\"", "source ~/.bashrc" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "RAG Memory Injection Benchmark: Small Models Gain, Large Models Can Be Distracted (rag-injection-benchmark-small-models-gain-large-distracted)", "condition": "with_lesson", "status": 200, "content": "Here's a concrete, actionable fix with exact commands to address the issues mentioned in the problem:\n\n**Step 1: Modify the benchmark scripts to exclude prose lines and treat fenced blocks as commands**\n\nOpen the `scripts/benchmark_workers_ai.py` file and modify the following lines:\n\n```python\ndef extract_reference_commands(text):\n # ... (rest of the function remains the same)\n\n # New function to extract commands from prose\n def extract_prose_commands(text):\n lines = text.split('\\n')\n commands = []\n in_block = False\n for line in lines:\n if line.strip().startswith('```'):\n in_block = not in_block\n if in_block and line.strip().startswith('bash') or line.strip().startswith('run:'):\n commands.append(line.strip())\n return commands\n\n # ... (rest of the function remains the same)\n\ndef run_inference(model, text):\n # ... (rest of the function remains the same)\n\n # Extract reference commands\n commands = extract_reference_commands(text)\n if commands:\n # ... (rest of the function remains the same)\n```\n\nThen, modify the `extract_reference_commands` function to use the `extract_prose_commands` function:\n\n```python\ndef", "metrics": { "length": 1239, "commands": 1, "command_list": [ "Then, modify the `extract_reference_commands` function to use the `extract_prose_commands` function:" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "RAG Memory Injection Benchmark: Small Models Gain, Large Models Can Be Distracted (rag-injection-benchmark-small-models-gain-large-distracted)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely due to an issue with the RAG (Reformer Attention Generator) model in the RAG Injection Benchmark. This benchmark is designed to test the performance of attention-based models on a variety of tasks.\n\nHere's a concrete, actionable fix with exact commands:\n\n**Install the required packages**\n\n```bash\npip install transformers\npip install torch\npip install transformers==4.14.3\n```\n\n**Update the transformers library**\n\n```bash\npip install --upgrade transformers\n```\n\n**Run the benchmark with the following command**\n\n```bash\npython -m torchrun rag-injection-benchmark-small-models-gain-large-distracted.py --model_name_or_path google/pegasus-large\n```\n\n**Note:** The `--model_name_or_path` argument specifies the model to use for the benchmark. In this case, we're using the `google/pegasus-large` model.\n\n**Alternative Solution**\n\nIf you're experiencing issues with the `torchrun` command, you can try running the benchmark using the `torch` command directly:\n\n```bash\npython -m torch rag_injection_benchmark_small_models_gain_large_distracted.py --model_name_or_path google/pegasus-large\n```\n\n**Verify", "metrics": { "length": 1140, "commands": 6, "command_list": [ "pip install transformers", "pip install torch", "pip install transformers==4.14.3", "pip install --upgrade transformers", "python -m torchrun rag-injection-benchmark-small-models-gain-large-distracted.py --model_name_or_path google/pegasus-large" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "WebCrypto API Fallback Consistency in Dual Node and Cloudflare Worker Runtimes (webcrypto-fallback-consistency-node-worker)", "condition": "with_lesson", "status": 200, "content": "To fix the WebCrypto API Fallback Consistency in Dual Node and Cloudflare Worker Runtimes, you can modify the code to use the following approach:\n\n**Step 1: Update the code**\n\nModify the code to use the following consistent fallback for WebCrypto across environments:\n\n```javascript\n// Before\nconst crypto = globalThis.crypto || (await import(\"node:crypto\"));\n\n// After\nconst crypto = globalThis.crypto || ((await import(\"node:crypto\")).webcrypto || globalThis.crypto);\n```\n\n**Step 2: Verify the fix**\n\nTo verify the fix, run the tests using the following commands:\n\n```bash\n# Node.js tests\nnode --test workers/.test.mjs\n\n# Cloudflare Worker tests\ncurl -X POST \\\n https://api.cloudflare.com/client/v1/accounts/your_account_id/workers \\\n -H 'X-Auth-Token: your_api_token' \\\n -H 'Content-Type: application/json' \\\n -d '{\"name\": \"workers/register-proxy-sw\", \"type\": \"sw\", \"workerScript\": \"workers/register-proxy-sw.js\"}'\n\ncurl -X POST \\\n https://api.cloudflare.com/client/v1/accounts/your_account_id/workers \\\n -H 'X-Auth-Token", "metrics": { "length": 1030, "commands": 2, "command_list": [ "**Step 2: Verify the fix**", "To verify the fix, run the tests using the following commands:" ], "has_command_block": true, "actionable": true, "inline_code_count": 2, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Cron and a desktop starter both launch `earn_all.py`, fighting for the same lock, double-submitting, or skipping forever. (agent-pid-lockfile)", "condition": "with_lesson", "status": 200, "content": "To fix the issue of `earn_all.py` being launched multiple times by both the desktop starter and cron job, you can implement a lock mechanism that ensures only one process can run the script at a time. Here's an updated version of the code:\n\n```python\nfrom pathlib import Path\nimport os, time, psutil\n\nLOCK = Path.home() / \".local/state/app/job.lock\"\n\ndef acquire(stale_sec: int = 600) -> bool:\n \"\"\"\n Acquire the lock file.\n\n Args:\n stale_sec (int): Time in seconds before a stale lock can be acquired. Defaults to 600.\n\n Returns:\n bool: True if the lock was acquired, False if it was already held by another process.\n \"\"\"\n LOCK.parent.mkdir(parents=True, exist_ok=True)\n if LOCK.exists():\n try:\n pid = int(LOCK.read_text().strip().split()[0])\n age = time.time() - LOCK.stat().st_mtime\n if Path(f\"/proc/{pid}\").exists() and age < stale_sec:\n # Log a message to indicate that the lock is held by another process\n print(f\"skip: lock held by pid={pid}\")\n return False\n # Check if", "metrics": { "length": 1098, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 1, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "WebCrypto API Fallback Consistency in Dual Node and Cloudflare Worker Runtimes (webcrypto-fallback-consistency-node-worker)", "condition": "plain", "status": 200, "content": "The WebCrypto API Fallback Consistency error is a known issue in some environments, including Cloudflare Worker Runtimes and Node.js environments. Here's a concrete, actionable fix:\n\n**Fix:**\n\n1. **Update Node.js version:** Make sure you're running Node.js version 14.17.0 or later. You can check your current Node.js version by running:\n ```bash\nnode -v\n```\n If you're running an earlier version, update to the latest version using:\n ```bash\nnpm install -g n\nn install 14.17.0\n```\n Alternatively, you can use a package manager like Homebrew on macOS or apt-get on Linux to update Node.js.\n\n2. **Update Cloudflare Worker Runtime:** If you're using Cloudflare Worker Runtimes, ensure that you're running the latest version. You can check for updates in the Cloudflare dashboard.\n\n3. **Disable WebCrypto fallback:** To disable the WebCrypto fallback, you can add the following flag to your `worker.js` file:\n ```javascript\nconst { WebCrypto } = require('worker-crypto');\nWebCrypto.fallback = false;\n```\n This flag tells the WebCrypto API to use the fallback mechanism only", "metrics": { "length": 1082, "commands": 3, "command_list": [ "node -v", "npm install -g n", "n install 14.17.0" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Earn sites auth in Firefox but Python APIs get 401. (browser-cookie-export-for-apis)", "condition": "with_lesson", "status": 200, "content": "To fix the issue, you can use the following Python script to export the cookies from Firefox, then send them as a Cookie header in your API requests. We'll use the `requests` library to make the API calls.\n\n```python\nimport sqlite3\nimport tempfile\nimport os\nimport requests\n\ndef get_cookies():\n # Get the path to the cookies.sqlite file\n src = os.path.join(os.path.expanduser(\"~\"), \".mozilla/firefox//cookies.sqlite\")\n tmp = tempfile.mkdtemp()\n shutil.copy2(src, tmp)\n con = sqlite3.connect(tmp)\n cookies = {}\n for row in con.execute(\"SELECT host, name, value FROM moz_cookies WHERE host LIKE '%example.com%'\"):\n cookies[row[0]] = \"; \".join([f\"{n}={v}\" for n, v in zip(row[1:], row[2:])])\n con.close()\n shutil.rmtree(tmp)\n return cookies\n\ndef send_request(host, path, cookies, auth=None):\n headers = {\"Cookie\": cookies}\n if auth:\n headers[\"Authorization\"] = auth\n response = requests.get(f\"http://{host}{path}\", headers=headers)\n if response.status_code == 401:\n print(f\"", "metrics": { "length": 1043, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 1, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Cron and a desktop starter both launch `earn_all.py`, fighting for the same lock, double-submitting, or skipping forever. (agent-pid-lockfile)", "condition": "plain", "status": 200, "content": "The issue you're experiencing is due to the fact that your `earn_all.py` script is not designed to handle concurrent execution, and both the cron job and desktop starter are trying to run it simultaneously.\n\nOne way to fix this is to use a lock file to prevent the script from running multiple times at the same time. Here's a step-by-step guide to implement this:\n\n**Step 1: Install the `lockfile` library**\n\nYou'll need to install the `lockfile` library, which provides a simple way to create and manage lock files. You can install it using pip:\n\n```bash\npip install lockfile\n```\n\n**Step 2: Modify your `earn_all.py` script**\n\nAdd the following code to your `earn_all.py` script to create a lock file:\n\n```python\nimport os\nimport lockfile\n\ndef create_lock_file(lock_file):\n try:\n lockfile.LockFile(lock_file, exclusive=True)\n except lockfile.LockFileError:\n print(f\"Lock file {lock_file} already exists. Exiting.\")\n sys.exit(1)\n\ndef main():\n lock_file = '/tmp/earn_all_lock'\n create_lock_file(lock_file)\n\n # Your script code here...\n\n lockfile.release(lock_file", "metrics": { "length": 1102, "commands": 1, "command_list": [ "pip install lockfile" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Earn sites auth in Firefox but Python APIs get 401. (browser-cookie-export-for-apis)", "condition": "plain", "status": 200, "content": "The error \"Earn sites auth in Firefox but Python APIs get 401\" is typically due to the browser cookies not being exported correctly, causing the API to authenticate incorrectly. Here's a step-by-step solution to fix this issue:\n\n**Step 1: Export cookies from Firefox**\n\n1. Open Firefox and go to `about:debugging`.\n2. Click on the \"This Firefox\" tab.\n3. Click on the \"Load Temporary Add-on\" button.\n4. Click on the \"Cookies\" tab.\n5. Click on the \"Export Cookies\" button.\n6. Save the cookies file as a `.txt` file.\n\n**Step 2: Import cookies into Python**\n\n1. Install the `requests` library if you haven't already: `pip install requests`\n2. Import the cookies file into Python using the `requests` library:\n```python\nimport requests\n\nwith open('cookies.txt', 'r') as f:\n cookies = dict(line.split('=') for line in f)\n\n# Set the cookies in the requests session\nsession = requests.Session()\nsession.cookies.update(cookies)\n```\n**Step 3: Use the cookies in your Python API**\n\n1. Use the `session` object to make API requests:\n```python\nresponse = session", "metrics": { "length": 1052, "commands": 2, "command_list": [ "**Step 3: Use the cookies in your Python API**", "1. Use the `session` object to make API requests:" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Fork PRs fail DCO or related CI even when the code is fine. Agents see red X and thrash. Sometimes quality bots also fail while trying to comment (`Resource not accessible by integration`). (ci-dco-fork-pr-signoff)", "condition": "with_lesson", "status": 200, "content": "Here is a concrete, actionable fix with exact commands to address the issue of Fork PRs failing DCO or related CI even when the code is fine:\n\n**Step 1: Fix last commit and verify Signed-off-by trailer**\n\n1. Make sure the last commit is signed with a Signed-off-by trailer by running:\n ```bash\ngit log -1 --format=%B | grep Signed-off-by\n```\n If the trailer is missing, fix it by adding it:\n ```bash\ngit commit --amend --no-edit -s\n```\n Then push the changes with `--force-with-lease` to avoid conflicts:\n ```bash\ngit push --force-with-lease\n```\n\n**Step 2: Update Author information**\n\n1. Verify the author information by running:\n ```bash\ngit config user.name\ngit config user.email\n```\n Update the author information to match the GitHub noreply or verified email for the account.\n\n**Step 3: Install package in editable mode for Python CI in forks**\n\n1. Install the package in editable mode before importing local modules:\n ```bash\npip install -e .\n```\n or\n ```bash\nexport PYTHONPATH=\"$PWD${PYTHONPATH:+:$PYTHON", "metrics": { "length": 1031, "commands": 6, "command_list": [ "git log -1 --format=%B | grep Signed-off-by", "git commit --amend --no-edit -s", "git push --force-with-lease", "git config user.name", "git config user.email" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 8, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Fork PRs fail DCO or related CI even when the code is fine. Agents see red X and thrash. Sometimes quality bots also fail while trying to comment (`Resource not accessible by integration`). (ci-dco-fork-pr-signoff)", "condition": "plain", "status": 200, "content": "The error you're experiencing is likely due to a misconfigured `dco` or CI pipeline, causing the fork PRs to fail and display a red X. Here's a step-by-step fix with exact commands:\n\n**Step 1: Verify `dco` configuration**\n\n Run the following command to check if the `dco` configuration is correct:\n```bash\ndco status\n```\nThis command will display the current DCO status, including any errors or warnings.\n\n**Step 2: Check CI pipeline configuration**\n\n Run the following command to check the CI pipeline configuration:\n```bash\ngit config --get remote.origin.url\n```\nThis command will display the URL of your remote origin repository.\n\n**Step 3: Update `dco` configuration file**\n\nUpdate the `dco` configuration file (`~/.dco/config`) to include the correct repository URL:\n```bash\ndco config set origin_url \n```\nReplace `` with the URL of your remote origin repository.\n\n**Step 4: Run `dco` with `--verbose` option**\n\n Run the following command to verify that `dco` is working correctly:\n```bash\ndco --verbose\n```\nThis command will display detailed", "metrics": { "length": 1079, "commands": 4, "command_list": [ "dco status", "git config --get remote.origin.url", "dco config set origin_url ", "dco --verbose" ], "has_command_block": true, "actionable": true, "inline_code_count": 17, "lesson_hits": 2, "lesson_hit_rate": 0.25 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Superteam returns `403 Insufficient credits` on submit. Agents idle and ship nothing when credits finally appear. (content-pack-ready-before-credits)", "condition": "with_lesson", "status": 200, "content": "To fix the issue of Superteam returning 403 Insufficient credits on submit, we need to implement a system that checks for ready content packs before submitting them. We will also ensure that the agents are idle and not shipping nothing when credits finally appear.\n\nHere's a step-by-step solution:\n\n**Step 1: Create a script to check for ready content packs**\n\nCreate a new file named `check_ready_packs.py` with the following content:\n\n```python\nimport os\nimport json\nimport time\n\ndef check_ready_packs():\n # Check if the work directory exists\n if not os.path.exists('work'):\n print(\"Work directory does not exist. Please create it.\")\n return\n\n # Check if the links.json file exists\n links_file = os.path.join('work', 'submit-ready', 'links.json')\n if not os.path.exists(links_file):\n print(\"links.json file does not exist. Please create it.\")\n return\n\n # Load the links.json file\n with open(links_file, 'r') as f:\n links = json.load(f)\n\n # Check if there are any ready packs\n if len(links) == 0:\n print(\"No ready packs found.\")\n return\n\n #", "metrics": { "length": 1120, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 1, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Superteam returns `403 Insufficient credits` on submit. Agents idle and ship nothing when credits finally appear. (content-pack-ready-before-credits)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely due to a bug in the Superteam system. To resolve this issue, you'll need to use the following commands to fix the problem:\n\n**Note:** These commands are based on the assumption that you're using a Minecraft server with a Superteam plugin. If you're using a different plugin or server setup, you may need to modify the commands accordingly.\n\n**Step 1: Check and fix the plugin configuration**\n\n1. Open your server's console and navigate to the Superteam plugin directory.\n2. Run the following command to check the plugin's configuration:\n```bash\n/minecraft plugin list\n```\nThis will list all the plugins installed on your server, including the Superteam plugin.\n\n3. Check the Superteam plugin's configuration file (`config.yml` or `plugin.yml`) for any errors or incorrect settings. Make sure the `credits` setting is set to a valid value (e.g., `1000` or `5000`).\n\n**Step 2: Rebuild the Superteam plugin**\n\n1. Run the following command to rebuild the Superteam plugin:\n```bash\n/minecraft plugin rebuild\n```\nThis will rebuild the plugin and update its configuration.\n\n**Step 3:", "metrics": { "length": 1116, "commands": 2, "command_list": [ "/minecraft plugin list", "/minecraft plugin rebuild" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "curl hangs or follows bad redirects; scripts look stuck. (curl-fail-fast-flags)", "condition": "with_lesson", "status": 200, "content": "To fix the issue of `curl` hanging or following bad redirects, you can use the following command:\n\n```bash\ncurl -fsS --connect-timeout 10 --max-time 30 -A \"agent/1.0\" \"$URL\" -o out.json\n```\n\nHere's a breakdown of the options used:\n\n- `-f`: Fail on HTTP errors. This option tells `curl` to exit with a non-zero status code if it encounters an HTTP error.\n- `-S`: Show the progress meter.\n- `--connect-timeout 10`: Set the timeout for establishing a connection to the server. In this case, it's set to 10 seconds.\n- `--max-time 30`: Set the maximum time allowed for the entire operation. In this case, it's set to 30 seconds.\n- `-A \"agent/1.0\"`: Set the User-Agent header to \"agent/1.0\". This can help identify the issue if the server is blocking your request due to a suspicious User-Agent string.\n- `-o out.json`: Save the output to a file named \"out.json\".\n\nYou can also use this command in a script to automate the process:\n\n```bash\n#!/bin/bash\n\nURL=\"https://example", "metrics": { "length": 968, "commands": 1, "command_list": [ "curl -fsS --connect-timeout 10 --max-time 30 -A \"agent/1.0\" \"$URL\" -o out.json" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 1, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Logs mix UTC and local time; a \"9am job\" misses by two hours on Hetzner UTC boxes. (date-sast-logging)", "condition": "with_lesson", "status": 200, "content": "To fix the issue of logs mixing UTC and local time, you can apply the following steps:\n\n**For Bash Script**\n\n1. Update the `TZ` environment variable to `Africa/Johannesburg` before printing the date and time.\n\n```bash\nTZ=Africa/Johannesburg date '+%F %T %Z'\n```\n\n**For Python Script**\n\n1. Create a timezone object with a 2-hour offset from UTC.\n\n```python\nfrom datetime import datetime, timezone, timedelta\n\n# Create a timezone object with a 2-hour offset from UTC\nSAST = timezone(timedelta(hours=2))\n\n# Get the current date and time in SAST\ncurrent_time = datetime.now(SAST)\n\n# Print the date and time in SAST format\nprint(current_time.strftime(\"%Y-%m-%d %H:%M:%S SAST\"))\n```\n\n**For a General Solution**\n\nTo ensure that logs are always displayed in SAST, you can create a function that applies the timezone offset to the current date and time. This function can be called at the display edges, such as when logging success/failure messages.\n\n```python\nfrom datetime import datetime, timezone, timedelta\n\ndef get_sast_time():\n # Create a timezone object with a", "metrics": { "length": 1063, "commands": 3, "command_list": [ "TZ=Africa/Johannesburg date '+%F %T %Z'", "**For a General Solution**", "To ensure that logs are always displayed in SAST, you can create a function that applies the timezone offset to the current date and time. This function can be called at the display edges, such as when logging success/failure messages." ], "has_command_block": true, "actionable": false, "inline_code_count": 6, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Logs mix UTC and local time; a \"9am job\" misses by two hours on Hetzner UTC boxes. (date-sast-logging)", "condition": "plain", "status": 200, "content": "The issue is likely due to the fact that Hetzner's UTC boxes are in the Central European Summer Time (CEST) zone, which is UTC+2, while most systems use UTC+0. When you log in UTC time, but the server is in CEST, it can result in a two-hour discrepancy.\n\nHere's a concrete, actionable fix with exact commands:\n\n**Step 1: Set the system clock to UTC**\n\n```bash\nsudo timedatectl set-ntp true\nsudo timedatectl set-timezone UTC\n```\n\n**Step 2: Set the timezone to the Hetzner CEST zone**\n\n```bash\nsudo timedatectl set-timezone Europe/Berlin\n```\n\n**Step 3: Configure the logging system to use the system clock**\n\nYou'll need to configure your logging system (e.g., Logstash, ELK Stack) to use the system clock. The exact configuration will depend on your logging system, but here's an example for Logstash:\n\n```bash\nsudo nano /etc/logstash/conf.d/date.conf\n```\n\nAdd the following configuration:\n\n```ruby\ndate {\n match => [ \"timestamp\", \"ISO8601\" ]\n timezone => \"UTC\"\n}\n```\n\n**Step ", "metrics": { "length": 977, "commands": 4, "command_list": [ "sudo timedatectl set-ntp true", "sudo timedatectl set-timezone UTC", "sudo timedatectl set-timezone Europe/Berlin", "sudo nano /etc/logstash/conf.d/date.conf" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "curl hangs or follows bad redirects; scripts look stuck. (curl-fail-fast-flags)", "condition": "plain", "status": 200, "content": "To resolve the issue of `curl` hanging or following bad redirects, you can use the following command with the `--max-time` and `--max-redirs` flags to limit the execution time and the maximum number of redirects.\n\n```bash\ncurl -s --max-time 10 --max-redirs 5 https://example.com\n```\n\nHere's a breakdown of the options used:\n\n- `--max-time 10`: This sets a maximum execution time of 10 seconds for the `curl` command. If the command takes longer than 10 seconds to complete, it will be terminated.\n- `--max-redirs 5`: This sets a maximum number of redirects to 5. If the URL is redirected more than 5 times, `curl` will stop following redirects.\n\nYou can adjust the values of `--max-time` and `--max-redirs` according to your needs.\n\nIf you're using a script, you can use these flags like this:\n\n```bash\n#!/bin/bash\n\nurl=\"https://example.com\"\n\n# Set the maximum execution time and the maximum number of redirects\nmax_time=10\nmax_redirs=5\n\n# Use curl with the flags\ncurl -s --max-time $max_time --max-red", "metrics": { "length": 1002, "commands": 1, "command_list": [ "curl -s --max-time 10 --max-redirs 5 https://example.com" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 1, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Agent machines fill `/tmp` or `work/runs` with screenshots, tarballs, and venvs. New jobs fail with `No space left on device`. (disk-full-agent-tmp-gc)", "condition": "plain", "status": 200, "content": "To fix the \"No space left on device\" error caused by disk-full-agent-tmp-gc, you'll need to increase the disk space allocated to the agent's temporary directories. Here's a step-by-step guide with exact commands:\n\n**For Linux systems:**\n\n1. **Increase the disk space for `/tmp`:**\n ```bash\nsudo mkfs.ext4 /dev/sdx1 # replace 'sdx1' with your actual device (e.g., /dev/sda1)\nsudo mount /dev/sdx1 /tmp\nsudo echo \"/tmp 2048 0 0\" >> /etc/fstab # increase the size to 2048 MB\n```\n Replace `/dev/sdx1` with your actual device (e.g., `/dev/sda1`).\n\n2. **Increase the disk space for `/work/runs`:**\n ```bash\nsudo mkdir -p /work/runs\nsudo chown -R agent:agent /work/runs # change ownership to the agent user\nsudo chmod -R 755 /work/runs # set permissions to allow the agent user to write\n```\n This will create a new directory `/work/runs` and set the ownership and permissions to", "metrics": { "length": 882, "commands": 6, "command_list": [ "sudo mkfs.ext4 /dev/sdx1 # replace 'sdx1' with your actual device (e.g., /dev/sda1)", "sudo mount /dev/sdx1 /tmp", "sudo echo \"/tmp 2048 0 0\" >> /etc/fstab # increase the size to 2048 MB", "sudo mkdir -p /work/runs", "sudo chown -R agent:agent /work/runs # change ownership to the agent user" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Agent machines fill `/tmp` or `work/runs` with screenshots, tarballs, and venvs. New jobs fail with `No space left on device`. (disk-full-agent-tmp-gc)", "condition": "with_lesson", "status": 200, "content": "To fix the \"Disk full from agent tmp dirs\" issue, you can use the following commands:\n\n**1. Delete old runs and screenshots**\n\nCreate a cron job to run the following commands weekly:\n\n```bash\n0 4 0 * * * find \"$HOME/hermes-moneymaker/work/runs\" -mindepth 1 -mtime +3 -exec rm -rf {} + 2/dev/null || true\nfind /tmp -name '.png' -mtime +1 -size +1M -delete 2/dev/null || true\n```\n\nThis will delete files older than 3 days in the `work/runs` directory and files older than 1 day in the `/tmp` directory.\n\n**2. Delete large tarballs**\n\nCreate a cron job to run the following command weekly:\n\n```bash\n0 4 0 * * * find \"$HOME/hermes-moneymaker/work\" -name '.tgz' -mtime +14 -delete\n```\n\nThis will delete tarballs older than 14 days in the `work` directory.\n\n**3. Set a job-scoped TMPDIR**\n\nCreate a script to set a job-scoped TMPDIR and delete it on success:\n\n```bash\n#!/bin/bash\n\n", "metrics": { "length": 879, "commands": 3, "command_list": [ "0 4 0 * * * find \"$HOME/hermes-moneymaker/work/runs\" -mindepth 1 -mtime +3 -exec rm -rf {} + 2/dev/null || true", "find /tmp -name '.png' -mtime +1 -size +1M -delete 2/dev/null || true", "0 4 0 * * * find \"$HOME/hermes-moneymaker/work\" -name '.tgz' -mtime +14 -delete" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 3, "lesson_hit_rate": 0.75 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Empty boards cause noisy errors and pager spam from cron. (empty-board-idle-exit)", "condition": "plain", "status": 200, "content": "To fix the \"empty-board-idle-exit\" error, you can use the following command to remove any idle or empty boards from your RabbitMQ system:\n\n```bash\nrabbitmqctl flush\n```\n\nHowever, this command will remove all messages from all queues. If you want to remove only the empty boards, you can use the following command:\n\n```bash\nrabbitmqctl flush queues\n```\n\nThis command will remove all messages from the queues, but it will not remove the queues themselves. If you want to remove the queues as well, you can use the following command:\n\n```bash\nrabbitmqctl flush queues --force\n```\n\nNote: Be careful when using the `--force` option, as it will permanently delete the queues.\n\nAlternatively, you can use the `rabbitmqctl delete_exchange` command to delete the empty exchanges, which can also resolve the issue:\n\n```bash\nrabbitmqctl delete_exchange empty-board\n```\n\nReplace \"empty-board\" with the actual name of the empty exchange.\n\nTo prevent this issue from happening in the future, you can use a cron job to run the `rabbitmqctl flush queues` command on a regular basis. For example:\n\n```bash\n0 0 * * * rabbitmqctl flush queues\n", "metrics": { "length": 1124, "commands": 4, "command_list": [ "rabbitmqctl flush", "rabbitmqctl flush queues", "rabbitmqctl flush queues --force", "rabbitmqctl delete_exchange empty-board" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 2, "lesson_hit_rate": 0.4 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "API keys in `.env` are world-readable. Other users or leaked backups expose tokens. (env-file-mode-600)", "condition": "with_lesson", "status": 200, "content": "Here's a concrete, actionable fix to secure your API keys in `.env`:\n\n**Step 1: Set umask to 077**\n\nOpen your shell configuration file (usually `~/.bashrc` or `~/.bash_profile`) and add the following line:\n```bash\numask 077\n```\nThen, run the following command to apply the changes:\n```bash\nsource ~/.bashrc\n```\nor\n```bash\nsource ~/.bash_profile\n```\n**Step 2: Set the correct permissions for `.env`**\n\nCreate a new file named `.env` with the following commands:\n```bash\ntouch .env\nchmod 600 .env\n```\nThis sets the permissions for `.env` to 600, which is the recommended mode for sensitive files.\n\n**Step 3: Add `.env` to `.gitignore`**\n\nCreate a new file named `.gitignore` with the following commands:\n```bash\ntouch .gitignore\necho '.env' >> .gitignore\n```\nThis tells Git to ignore the `.env` file, preventing it from being committed to the repository.\n\n**Step 4: Redact secrets in logs (optional)**\n\nIf you're using a logging tool like `logrotate`, you", "metrics": { "length": 953, "commands": 7, "command_list": [ "umask 077", "source ~/.bashrc", "source ~/.bash_profile", "touch .env", "chmod 600 .env" ], "has_command_block": true, "actionable": true, "inline_code_count": 20, "lesson_hits": 6, "lesson_hit_rate": 0.857 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Empty boards cause noisy errors and pager spam from cron. (empty-board-idle-exit)", "condition": "with_lesson", "status": 200, "content": "Here's a concrete, actionable fix for the issue:\n\n**Step 1: Update the `taskbounty_client.py` script**\n\nOpen the `taskbounty_client.py` script in your preferred text editor and update it to the following code:\n\n```python\nimport subprocess\nimport sys\n\ndef run_command(command):\n try:\n output = subprocess.check_output(command, shell=True).decode('utf-8')\n return output\n except subprocess.CalledProcessError as e:\n print(f\"Error running command: {e}\")\n return None\n\ndef check_board_status():\n open_command = f\"python3 scripts/taskbounty_client.py open\"\n no_open_tasks_command = \"python3 scripts/taskbounty_client.py open | grep NO_OPEN_TASKS\"\n open_output = run_command(open_command)\n no_open_tasks_output = run_command(no_open_tasks_command)\n\n if no_open_tasks_output:\n print(\"idle: empty board\")\n sys.exit(0)\n else:\n print(\"Claiming path...\")\n # Add your logic here to claim the path\n sys.exit(0)\n\ncheck_board_status()\n```\n\n**Step 2: Add a cron job to run the script**\n\nCreate a new cron job to run the script", "metrics": { "length": 1097, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 3, "lesson_hits": 3, "lesson_hit_rate": 0.6 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "API keys in `.env` are world-readable. Other users or leaked backups expose tokens. (env-file-mode-600)", "condition": "plain", "status": 200, "content": "**Fixing World-Readable API Keys in `.env` File**\n\nTo prevent world-readable API keys in your `.env` file, you can use a secure way to store sensitive data. Here's a step-by-step solution using Git, a `.gitignore` file, and environment variables.\n\n### Step 1: Create a `.gitignore` file\n\nCreate a new file named `.gitignore` in the root of your project and add the following line:\n```makefile\n.env\n```\nThis will ignore the `.env` file when running Git commands.\n\n### Step 2: Create environment variables\n\nCreate a new file named `env_variables.sh` in the root of your project with the following content:\n```bash\n#!/bin/bash\n\n# Load environment variables from .env file\nsource .env\n\n# Set API keys as environment variables\nexport API_KEY1=$API_KEY1\nexport API_KEY2=$API_KEY2\n```\nMake the file executable by running the following command:\n```bash\nchmod +x env_variables.sh\n```\n### Step 3: Run the script\n\nCreate a new file named `run.sh` in the root of your project with the following content:\n```bash\n#!/bin/bash\n\n# Load environment variables from .", "metrics": { "length": 1048, "commands": 4, "command_list": [ "This will ignore the `.env` file when running Git commands.", "Create a new file named `env_variables.sh` in the root of your project with the following content:", "Make the file executable by running the following command:", "Create a new file named `run.sh` in the root of your project with the following content:" ], "has_command_block": true, "actionable": true, "inline_code_count": 14, "lesson_hits": 4, "lesson_hit_rate": 0.571 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Docs PRs sit red for trivial reasons: missing DCO, quality score, or dirty base. (gh-pr-ready-checklist)", "condition": "with_lesson", "status": 200, "content": "To fix the error \"Docs PRs sit red for trivial reasons: missing DCO, quality score, or dirty base,\" follow these steps:\n\n**Step 1: Fetch and rebase from the upstream repository**\n\nOpen your terminal and navigate to your local repository. Run the following commands:\n\n```bash\ngit fetch upstream main\ngit rebase upstream/main\n```\n\n**Step 2: Amend the commit to include Signed-off-by**\n\nTo ensure your commit is signed with the correct email and name, run the following command:\n\n```bash\ngit commit -s --amend --no-edit\n```\n\nThis will update the commit message and include the Signed-off-by line.\n\n**Step 3: Run the quality scorer**\n\nRun the following command to score the quality of your documentation:\n\n```bash\npython3 scripts/quality_scorer.py path/to/lesson.md --json | tee /tmp/q.json\n```\n\nReplace `path/to/lesson.md` with the actual path to your Markdown file.\n\n**Step 4: Check the total score**\n\nVerify that the total score is 0.5 for MisakaNet CI. If it's not, you may need to adjust your documentation.\n\n**Step 5: Push the changes with force-with-lease**\n\n", "metrics": { "length": 1062, "commands": 4, "command_list": [ "git fetch upstream main", "git rebase upstream/main", "git commit -s --amend --no-edit", "python3 scripts/quality_scorer.py path/to/lesson.md --json | tee /tmp/q.json" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 4, "lesson_hit_rate": 0.571 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Docs PRs sit red for trivial reasons: missing DCO, quality score, or dirty base. (gh-pr-ready-checklist)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely due to a missing `DOCS PR` checklist item, specifically the quality score or dirty base. Here's a concrete, actionable fix with exact commands:\n\n**Prerequisites:**\n\n1. Make sure you have a GitHub repository and a pull request (PR) open.\n2. Ensure you have the `github` CLI installed on your machine. If not, install it using `npm install -g github-cli` or `yarn global add github-cli`.\n\n**Fix:**\n\n**Option 1: Add quality score**\n\n1. Open the PR page on GitHub.\n2. Click on the \"Files changed\" tab.\n3. Locate the file with the dirty base (usually the `.md` file).\n4. Run the following command to add a quality score:\n ```bash\ngithub pr update --files \"path/to/file.md\" --quality-score 10\n```\n Replace `\"path/to/file.md\"` with the actual path to the file.\n\n**Option 2: Remove dirty base**\n\n1. Open the PR page on GitHub.\n2. Click on the \"Files changed\" tab.\n3. Locate the file with the dirty base (usually the `.md` file).\n4. Run the following command to remove the dirty", "metrics": { "length": 1013, "commands": 1, "command_list": [ "github pr update --files \"path/to/file.md\" --quality-score 10" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 1, "lesson_hit_rate": 0.143 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Agent cannot push to a fork or open PRs; or a PAT is over-scoped (`admin:org`) and risky if leaked. (github-pat-scopes-minimum)", "condition": "plain", "status": 200, "content": "This error is occurring because your GitHub Personal Access Token (PAT) has a scope of `admin:org` which is too broad. To fix this, you need to reduce the scope of your PAT to a more limited set.\n\nHere are the steps to fix this:\n\n1. Go to your GitHub profile page: https://github.com/\n2. Click on your profile picture in the top right corner and select \"Settings\".\n3. Click on \"Developer settings\" from the left-hand menu.\n4. Scroll down to the \"Personal access tokens\" section.\n5. Click on \"Generate new token\".\n6. In the \"Scopes\" field, remove `admin:org` from the list of scopes.\n7. Add the scopes that you need to use, such as `repo`, `read:org`, `write:org`, or `delete_repo`.\n\nHere's an example of how the scopes field should look:\n\n```\nrepo, read:org, write:org\n```\n\nAlternatively, you can also use a tool like `gh api` to generate a new PAT with the correct scope.\n\n1. Install `gh api` using npm or yarn: `npm install -g gh-api` or `yarn global add gh-api`\n", "metrics": { "length": 980, "commands": 1, "command_list": [ "repo, read:org, write:org" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Agent cannot push to a fork or open PRs; or a PAT is over-scoped (`admin:org`) and risky if leaked. (github-pat-scopes-minimum)", "condition": "with_lesson", "status": 200, "content": "To fix the error, you need to create a GitHub Personal Access Token (PAT) with the minimum required scopes to push to a fork or open PRs. Here are the steps:\n\n**Step 1: Create a new PAT with the required scopes**\n\nOpen a terminal and run the following commands:\n\n```bash\nstore mode 600\nprintf '%s\\n' \"gh auth login --with-token < ~/hermes-moneymaker/secrets/github-pat.txt\" | sudo -u $USER bash -c\n```\n\nThis command creates a new PAT with the required scopes for fork and PR operations.\n\n**Step 2: Create a file to store the PAT**\n\nCreate a new file `~/hermes-moneymaker/secrets/github-pat.txt` and add the PAT to it.\n\n```bash\nprintf '%s\\n' \"$PAT\" > ~/hermes-moneymaker/secrets/github-pat.txt\n```\n\n**Step 3: Set the file permissions**\n\nSet the file permissions to 600 to ensure it's only accessible by the owner.\n\n```bash\nchmod 600 ~/hermes-moneymaker/secrets/github-pat.txt\n```\n\n**Step 4: Login to GitHub with the new PAT**\n\nRun the following command", "metrics": { "length": 951, "commands": 4, "command_list": [ "store mode 600", "printf '%s\\n' \"gh auth login --with-token < ~/hermes-moneymaker/secrets/github-pat.txt\" | sudo -u $USER bash -c", "printf '%s\\n' \"$PAT\" > ~/hermes-moneymaker/secrets/github-pat.txt", "chmod 600 ~/hermes-moneymaker/secrets/github-pat.txt" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 3, "lesson_hit_rate": 0.6 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Supervisors cannot tell if a local earn dashboard or API is up. Restarts thrash blindly. (healthcheck-endpoint-pattern)", "condition": "with_lesson", "status": 200, "content": "To fix the issue, you need to create a separate liveness probe for your local earn dashboard or API. Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Create a new file for the liveness probe**\n\nCreate a new file called `liveness.py` with the following content:\n```python\nfrom http.server import BaseHTTPRequestHandler, HTTPServer\n\nclass Liveness(BaseHTTPRequestHandler):\n def do_GET(self):\n if self.path == \"/healthz\":\n self.send_response(200)\n self.send_header(\"Content-Type\", \"text/plain\")\n self.end_headers()\n self.wfile.write(b\"ok\\n\")\n else:\n self.send_response(404)\n self.end_headers()\n\nHTTPServer((\"127.0.0.1\", 8766), Liveness).serve_forever()\n```\nThis file creates a new HTTP server that listens on port 8766 and responds to GET requests to the `/healthz` endpoint.\n\n**Step 2: Configure the liveness probe in your earn dashboard or API**\n\nUpdate your earn dashboard or API to use the new liveness probe. You can do this by adding a new endpoint that returns a 200 response when the liveness probe is healthy.\n\nFor example,", "metrics": { "length": 1129, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 3, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Supervisors cannot tell if a local earn dashboard or API is up. Restarts thrash blindly. (healthcheck-endpoint-pattern)", "condition": "plain", "status": 200, "content": "The error you're experiencing is due to the lack of a health check endpoint that allows supervisors to verify the availability of your local earn dashboard or API. Here's a concrete, actionable fix with exact commands to implement a health check endpoint:\n\n**Solution: Implement a Health Check Endpoint using HTTP**\n\nCreate a new file named `healthcheck.py` in the root directory of your project:\n```python\nfrom fastapi import FastAPI, Response\n\napp = FastAPI()\n\n@app.get(\"/healthcheck\")\ndef healthcheck():\n try:\n # Add your logic to verify the health of your local earn dashboard or API here\n # For example, you can check if a database connection is established\n # or if a specific endpoint is responding correctly\n return Response(content=\"Health check passed\", status_code=200)\n except Exception as e:\n return Response(content=\"Health check failed\", status_code=500)\n```\nThis code defines a simple health check endpoint that returns a success message (200 OK) if everything is healthy, or an error message (500 Internal Server Error) if something goes wrong.\n\n**Deploy the Health Check Endpoint**\n\nTo deploy the health check endpoint, you'll need to use a WSGI server or a web server that supports FastAPI.", "metrics": { "length": 1250, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 2, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Agents accept arbitrary JSON from task boards and crash later on missing keys or wrong types. Failures look like random bugs. (json-schema-validate-input)", "condition": "with_lesson", "status": 200, "content": "To fix the error, you can use the `jsonschema` library to validate the JSON input against a minimal schema. Here's an example of how you can do it:\n\n**Install jsonschema**\n\n```bash\npip install jsonschema\n```\n\n**Add the following code to your agent**\n\n```python\nimport json\nimport jsonschema\nfrom typing import Any\n\nREQUIRED = {\n \"title\": {\"type\": \"string\"},\n \"budget_cents\": {\"type\": \"integer\"}\n}\n\ndef validate(data: Any) -> dict:\n try:\n jsonschema.validate(instance=data, schema=REQUIRED)\n except jsonschema.exceptions.ValidationError as e:\n raise ValueError(str(e))\n\n return data\n```\n\n**Explanation**\n\nIn this code, we define a minimal schema `REQUIRED` that specifies the required keys and their data types. The `validate` function takes a dictionary `data` as input and uses `jsonschema.validate` to check if the input conforms to the schema. If the input is invalid, it raises a `ValueError` with a message describing the validation error.\n\n**Example usage**\n\n```python\ndata = {\"title\": \"x\", \"budget_cents\": 500}\ntry:\n validated_data = validate(data)\n print(validated", "metrics": { "length": 1107, "commands": 4, "command_list": [ "pip install jsonschema", "**Explanation**", "In this code, we define a minimal schema `REQUIRED` that specifies the required keys and their data types. The `validate` function takes a dictionary `data` as input and uses `jsonschema.validate` to check if the input conforms to the schema. If the input is invalid, it raises a `ValueError` with a message describing the validation error.", "**Example usage**" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Two agents create the same work dir; one crashes on FileExistsError in code that used os.mkdir. (mkdir-p-race-safe)", "condition": "with_lesson", "status": 200, "content": "To fix the issue of two agents creating the same work directory and one crashing on `FileExistsError` in parallel, you can use the `exist_ok=True` parameter in the `Path.mkdir()` method from the `pathlib` module in Python. This parameter ensures that the directory is created only if it does not already exist, preventing the `FileExistsError`.\n\nHere's an example of how you can use it:\n\n```bash\nmkdir -p \"$WORK/out\"\n```\n\nor\n\n```python\nfrom pathlib import Path\nPath(\"$WORK/out\").mkdir(parents=True, exist_ok=True)\n```\n\nHowever, to make the directory creation race-safe, you can use a combination of `os` and `pathlib` modules. Here's an example:\n\n```bash\nimport os\nfrom pathlib import Path\n\n# Define the work directory\nwork_dir = \"$WORK/out\"\n\n# Create the work directory if it does not exist\nif not Path(work_dir).exists():\n Path(work_dir).mkdir(parents=True)\n```\n\nor\n\n```python\nimport os\nfrom pathlib import Path\n\n# Define the work directory\nwork_dir = \"$WORK/out\"\n\n# Create the work directory if it does not exist\nif not Path(work_dir).exists():\n Path", "metrics": { "length": 1059, "commands": 3, "command_list": [ "mkdir -p \"$WORK/out\"", "However, to make the directory creation race-safe, you can use a combination of `os` and `pathlib` modules. Here's an example:", "or" ], "has_command_block": true, "actionable": true, "inline_code_count": 13, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Agents accept arbitrary JSON from task boards and crash later on missing keys or wrong types. Failures look like random bugs. (json-schema-validate-input)", "condition": "plain", "status": 200, "content": "To fix the issue of agents accepting arbitrary JSON from task boards and crashing later on due to missing keys or wrong types, you can use a JSON schema validation library to validate the input JSON before passing it to the agents.\n\nHere's a concrete, actionable fix:\n\n**Step 1: Install the required library**\n\nYou can install the `jsonschema` library using pip:\n```bash\npip install jsonschema\n```\n**Step 2: Define the JSON schema**\n\nCreate a JSON schema that defines the expected structure and types of the input JSON. For example:\n```json\n{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"title\": \"Task Board Input\",\n \"type\": \"object\",\n \"properties\": {\n \"task_id\": {\"type\": \"string\"},\n \"task_name\": {\"type\": \"string\"},\n \"task_description\": {\"type\": \"string\"},\n \"task_status\": {\"type\": \"string\", \"enum\": [\"pending\", \"in_progress\", \"done\"]}\n },\n \"required\": [\"task_id\", \"task_name\", \"task_description\"]\n}\n```\nThis schema defines an object with four properties: `task_id`, `task_name`, `task_description`, and `", "metrics": { "length": 1037, "commands": 1, "command_list": [ "pip install jsonschema" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Two agents create the same work dir; one crashes on FileExistsError in code that used os.mkdir. (mkdir-p-race-safe)", "condition": "plain", "status": 200, "content": "The issue you're encountering is due to a race condition where two agents try to create the same directory simultaneously, resulting in a `FileExistsError`. Here's a concrete, actionable fix using the `os` and `threading` modules in Python:\n\n```python\nimport os\nimport threading\n\ndef create_directory(directory):\n \"\"\"Create a directory safely using a lock.\"\"\"\n lock = threading.Lock()\n with lock:\n if not os.path.exists(directory):\n os.mkdir(directory)\n else:\n print(f\"Directory '{directory}' already exists.\")\n\n# Usage\ndirectory = \"my_directory\"\ncreate_directory(directory)\n```\n\nHere's how it works:\n\n1. We create a lock using the `threading.Lock` class.\n2. We acquire the lock using the `with` statement, which ensures that only one thread can execute the code within the block.\n3. Inside the block, we check if the directory exists using `os.path.exists`.\n4. If the directory doesn't exist, we create it using `os.mkdir`.\n5. If the directory already exists, we print a message indicating that the directory already exists.\n\nThis approach ensures that only one thread can create the directory, preventing the `FileExistsError` due to a race condition.\n\nAlternatively,", "metrics": { "length": 1214, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 9, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A job is \"done\" in chat but there is no artifact path, screenshot, or payout id. Disputes and accounting fail. (proof-folder-for-paid-jobs)", "condition": "with_lesson", "status": 200, "content": "To fix the issue where a job is marked as \"done\" in chat but there is no artifact path, screenshot, or payout ID, you can implement the following steps:\n\n1. Create a script that will check for the existence of the proof folder and its contents.\n\n2. Modify the Hermes Moneymaker bot to append a ledger row only when money moves.\n\nHere is a concrete, actionable fix with exact commands:\n\nFirst, create a script to check for the existence of the proof folder and its contents:\n\n```bash\n#!/bin/bash\n\n# Define the path to the proof folder\nPROOF_FOLDER_PATH=\"$HOME/hermes-moneymaker/proofs\"\n\n# Check if the proof folder exists\nif [ ! -d \"$PROOF_FOLDER_PATH\" ]; then\n echo \"Proof folder does not exist\"\n exit 1\nfi\n\n# Check if the folder has the required files\nif [ ! -f \"$PROOF_FOLDER_PATH/README.md\" ] || [ ! -d \"$PROOF_FOLDER_PATH/deliverable\" ] || [ ! -d \"$PROOF_FOLDER_PATH/evidence\" ] || [ ! -f \"$PROOF_FOLDER_PATH/payout.txt\" ]; then\n echo \"Proof folder is missing required files\"\n ", "metrics": { "length": 984, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A job is \"done\" in chat but there is no artifact path, screenshot, or payout id. Disputes and accounting fail. (proof-folder-for-paid-jobs)", "condition": "plain", "status": 200, "content": "To resolve the issue, you'll need to add artifact paths, screenshots, and payout IDs to the job. Here's a step-by-step guide:\n\n**Step 1: Identify the job ID and job name**\n\nRun the following command to find the job ID and job name:\n```bash\ngcloud jobs describe --format='get(status)'\n```\nReplace `` with the actual ID of the job.\n\n**Step 2: Check the job's status**\n\nRun the following command to check the job's status:\n```bash\ngcloud jobs describe --format='get(status)'\n```\nThe job should be in the \"done\" state.\n\n**Step 3: Add artifact paths**\n\nRun the following command to add artifact paths to the job:\n```bash\ngcloud jobs update --artifact-urls ,,\n```\nReplace `` with the actual ID of the job, and ``, ``, and `` with the actual paths to your artifacts.\n\n**Step 4:", "metrics": { "length": 909, "commands": 3, "command_list": [ "gcloud jobs describe --format='get(status)'", "gcloud jobs describe --format='get(status)'", "gcloud jobs update --artifact-urls ,," ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "You patch `earn_all.py` but the old process keeps running with the bug. (restart-earn-loop-after-code-fix)", "condition": "with_lesson", "status": 200, "content": "To fix the issue where the old process keeps running with the bug after patching `earn_all.py`, you need to stop the old process and start a new one. Here are the steps:\n\n1. **Stop the old process**:\n\n Use the following command to stop the old process:\n\n ```bash\nmm-desktop stop || true\n```\n\n This command will stop the `mm-desktop` process if it's running, and do nothing if it's not.\n\n2. **Kill the old process (optional)**:\n\n If you want to explicitly kill the old process, you can use the following command:\n\n ```bash\nkill $(cat ~/.local/state/hermes-moneymaker/earn_loop.pid)\n```\n\n This command will kill the process with the given PID.\n\n3. **Start a new process**:\n\n Use the following command to start a new `mm-desktop` process:\n\n ```bash\nOPEN_BROWSER=0 mm-desktop start\n```\n\n This command will start a new `mm-desktop` process, and it will write the new PID to the `.local/state/hermes-moneymaker/earn_loop.pid` file.\n\n4. **Verify the new process**:\n\n Use the following command to verify that the new process is", "metrics": { "length": 1039, "commands": 3, "command_list": [ "mm-desktop stop || true", "kill $(cat ~/.local/state/hermes-moneymaker/earn_loop.pid)", "OPEN_BROWSER=0 mm-desktop start" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 3, "lesson_hit_rate": 0.75 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "You patch `earn_all.py` but the old process keeps running with the bug. (restart-earn-loop-after-code-fix)", "condition": "plain", "status": 200, "content": "To fix the issue where the old process keeps running with the bug after patching `earn_all.py`, you'll need to terminate the old process and restart the new process. Here's a step-by-step guide to fix the issue:\n\n**Step 1: Identify the old process**\n\nFirst, you need to identify the process ID (PID) of the old process running with the bug. You can use the `ps` command to find the PID:\n\n```bash\nps aux | grep earn_all.py\n```\n\nThis will list all processes running with `earn_all.py` in their name. Take note of the PID.\n\n**Step 2: Kill the old process**\n\nOnce you have the PID, you can kill the old process using the `kill` command:\n\n```bash\nkill \n```\n\nReplace `` with the actual PID you found in Step 1.\n\n**Step 3: Check if the process is running**\n\nAfter killing the old process, check if the new process is running:\n\n```bash\nps aux | grep earn_all.py\n```\n\nIf the new process is not running, proceed to Step 4.\n\n**Step 4: Restart the new process**\n\nIf the new process is not running, you need to restart it.", "metrics": { "length": 1019, "commands": 3, "command_list": [ "ps aux | grep earn_all.py", "kill ", "ps aux | grep earn_all.py" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 1, "lesson_hit_rate": 0.25 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A research script accidentally claims paid tasks or spends credits during scouting. (separate-scout-and-worker-modes)", "condition": "with_lesson", "status": 200, "content": "To fix the error, you can modify your research script to include the `MODE` gate and use the `tr` command to remove newline characters from the input file. Here's a concrete, actionable fix:\n\n```bash\n# Define the mode variable and remove newline characters from the input file\nmode=$(tr -d '\\n' < MODE 2/dev/null || echo scout)\n\n# Check if the mode is not worker\nif [[ \"$mode\" != \"worker\" ]]; then\n echo \"scout/halt: no claim\"\n exit 0\nfi\n\n# If the mode is worker, check if the item is in APPROVED.md\nwhile IFS= read -r line; do\n if [[ \"$line\" =~ \"Approved\" ]]; then\n echo \"Claiming approved item\"\n # Add your claim logic here\n else\n echo \"Not claiming item\"\n fi\ndone < APPROVED.md\n```\n\nHowever, to avoid the issue of accidentally claiming paid tasks or spending credits during scouting, you should modify the script to only claim items that are in the APPROVED.md file when the mode is worker. Here's an updated version of the script:\n\n```bash\n# Define the mode variable and remove newline characters from", "metrics": { "length": 1019, "commands": 12, "command_list": [ "mode=$(tr -d '\\n' < MODE 2/dev/null || echo scout)", "if [[ \"$mode\" != \"worker\" ]]; then", "echo \"scout/halt: no claim\"", "exit 0", "fi" ], "has_command_block": true, "actionable": true, "inline_code_count": 4, "lesson_hits": 5, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A research script accidentally claims paid tasks or spends credits during scouting. (separate-scout-and-worker-modes)", "condition": "plain", "status": 200, "content": "To fix the error \"A research script accidentally claims paid tasks or spends credits during scouting. (separate-scout-and-worker-modes)\", you'll need to modify the script to handle paid tasks and scouting separately. Here's a step-by-step guide to fix the issue:\n\n**Step 1: Identify the problematic code**\n\nLocate the code that's causing the error. This might be a research script, a function, or a module that's being used in your game. Take note of the specific lines of code that are causing the issue.\n\n**Step 2: Separate scouting and worker modes**\n\nCreate a new function or module that handles scouting separately from the worker mode. This function should check if the scouting is being performed in a paid mode and handle it accordingly.\n\nHere's an example of how you can create a new function to handle scouting:\n```lua\n-- scouting.lua\n\nlocal scouting = {}\n\nfunction scouting.isScoutingPaid()\n -- Check if scouting is being performed in a paid mode\n -- Replace this with your actual logic to check if scouting is paid\n return true\nend\n\nfunction scouting.performScouting()\n if scouting.isScoutingPaid() then\n -- Perform scouting in paid mode\n print(\"Scouting in paid mode\")\n", "metrics": { "length": 1208, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 1, "lesson_hit_rate": 0.2 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Child python jobs run forever and pile up CPU. (signal-timeout-wrapper)", "condition": "with_lesson", "status": 200, "content": "To fix the issue where child Python jobs run forever and pile up CPU, you can use the `timeout` command to set a time limit for each job. Here's how you can do it:\n\n**Using Bash (shell script)**\n\n1. Create a shell script that runs your Python job with a timeout:\n```bash\n#!/bin/bash\n\n# Run your Python job with a timeout\ntimeout 120s python3 job.py || echo \"Job failed\"\n```\n2. Make the script executable:\n```bash\nchmod +x job_script.sh\n```\n3. Run the script:\n```bash\n./job_script.sh\n```\n\n**Using Python**\n\n1. Install the `subprocess` and `timeout` libraries if you haven't already:\n```bash\npip install subprocess\n```\n2. Create a Python script that runs your job with a timeout:\n```python\nimport subprocess\nimport time\n\ndef run_job_with_timeout(job, timeout):\n try:\n subprocess.run([\"python3\", job], timeout=timeout, check=False)\n except subprocess.TimeoutExpired:\n print(f\"Job '{job}' timed out\")\n\n# Run your job with a timeout\nrun_job_with_timeout(\"job.py\", 120)\n```\n**Using `concurrent", "metrics": { "length": 1007, "commands": 4, "command_list": [ "timeout 120s python3 job.py || echo \"Job failed\"", "chmod +x job_script.sh", "./job_script.sh", "pip install subprocess" ], "has_command_block": true, "actionable": true, "inline_code_count": 13, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Child python jobs run forever and pile up CPU. (signal-timeout-wrapper)", "condition": "plain", "status": 200, "content": "The error \"signal-timeout-wrapper\" typically occurs when a child Python process is running indefinitely and consuming excessive CPU resources. Here's a concrete, actionable fix to address this issue:\n\n**Solution:**\n\n1. **Install `psutil` library**: The `psutil` library provides an interface for retrieving information on running processes and system utilization (CPU, memory, disks, network, users, etc.) in Python. You can install it using pip:\n ```bash\npip install psutil\n```\n2. **Create a Python script to monitor and terminate long-running processes**: Create a new Python script, e.g., `monitor_processes.py`, with the following code:\n ```python\nimport psutil\nimport time\nimport os\n\ndef get_long_running_processes():\n long_running_processes = []\n for proc in psutil.process_iter(['pid', 'name']):\n try:\n info = proc.info\n if info['create_time'] < time.time() - 60 * 60: # 1 hour ago\n long_running_processes.append(info['name'])\n except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess):\n pass\n return long_running_processes\n\ndef terminate_long_running_processes(processes", "metrics": { "length": 1173, "commands": 1, "command_list": [ "pip install psutil" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Two cron invocations of `mm-snipe` overlap and double-hit the same API. (single-instance-flock)", "condition": "with_lesson", "status": 200, "content": "To fix the issue of overlapping cron invocations of `mm-snipe` and double-hitting the same API, you can use a single-instance lock file as described in the provided lesson. Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Create a lock file**\n\nCreate a lock file in the `/tmp` directory. This will be used to prevent multiple instances of `mm-snipe` from running concurrently.\n\n```bash\nsudo mkdir -p /tmp\nsudo touch /tmp/mm-snipe.lock\nsudo chmod 600 /tmp/mm-snipe.lock\n```\n\n**Step 2: Modify the `mm-snipe` script**\n\nUpdate the `mm-snipe` script to use the lock file. You can do this by adding the following code at the beginning of the script:\n\n```bash\n#!/usr/bin/env bash\nset -euo pipefail\nLOCK=/tmp/mm-snipe.lock\nexec 9\"$LOCK\"\nif ! flock -n 9; then\n echo \"skip: another sniper holds lock\"\n exit 0\nfi\n```\n\n**Step 3: Make the script executable**\n\nMake the `mm-snipe` script executable by running the following command:\n\n```bash\nsudo chmod +x /", "metrics": { "length": 962, "commands": 10, "command_list": [ "sudo mkdir -p /tmp", "sudo touch /tmp/mm-snipe.lock", "sudo chmod 600 /tmp/mm-snipe.lock", "set -euo pipefail", "LOCK=/tmp/mm-snipe.lock" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 5, "lesson_hit_rate": 0.714 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Two cron invocations of `mm-snipe` overlap and double-hit the same API. (single-instance-flock)", "condition": "plain", "status": 200, "content": "To prevent the double-hit issue when two cron invocations of `mm-snipe` overlap, you can use a lock file to ensure only one instance runs at a time. Here's a step-by-step fix:\n\n**Step 1: Create a lock file**\n\nCreate a new file called `mm-snipe.lock` in the same directory where `mm-snipe` is installed. You can do this using the following command:\n\n```bash\ntouch /path/to/mm-snipe/mm-snipe.lock\n```\n\nReplace `/path/to/mm-snipe` with the actual path to the `mm-snipe` executable.\n\n**Step 2: Modify the `mm-snipe` script**\n\nEdit the `mm-snipe` script to check for the lock file and exit if it exists. You can use the following command to modify the script:\n\n```bash\nsudo nano /path/to/mm-snipe/mm-snipe\n```\n\nAdd the following code at the beginning of the script:\n\n```bash\n#!/bin/bash\n\n# Check if lock file exists\nif [ -f /path/to/mm-snipe/mm-snipe.lock ]; then\n echo \"Another instance is running, exiting...\"\n exit 1\nfi\n\n# ... rest of the script ...\n```\n\n**Step", "metrics": { "length": 961, "commands": 6, "command_list": [ "touch /path/to/mm-snipe/mm-snipe.lock", "sudo nano /path/to/mm-snipe/mm-snipe", "if [ -f /path/to/mm-snipe/mm-snipe.lock ]; then", "echo \"Another instance is running, exiting...\"", "exit 1" ], "has_command_block": true, "actionable": true, "inline_code_count": 12, "lesson_hits": 2, "lesson_hit_rate": 0.286 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Cron mails mix debug prints and real errors; failures hide in noise. (stdout-stderr-split-cron)", "condition": "with_lesson", "status": 200, "content": "To fix the error, you need to separate the stdout and stderr streams in your cron job. Here's a concrete, actionable fix with exact commands:\n\n1. Add the following lines to your cron job:\n\n```bash\n0 0 * * * mm-snipe \"$LOGDIR/snipe.out\" 2>\"$LOGDIR/snipe.err\"\n```\n\nIn this command:\n\n- `mm-snipe \"$LOGDIR/snipe.out\" 2>\"$LOGDIR/snipe.err\"` will append the stdout to `snipe.out` and the stderr to `snipe.err`.\n\n- `0 0 * * *` is the cron job's timing, running the job every day at midnight.\n\n2. To alert only on non-empty `.err` or non-zero exit, you can use the following command:\n\n```bash\n0 0 * * * mm-snipe \"$LOGDIR/snipe.out\" 2>\"$LOGDIR/snipe.err\" || echo FAIL \"$LOGDIR/snipe.err\"\n```\n\nThis command will run `mm-snipe` as before, but if it fails (i.e., returns a non-zero exit code), it will print \"FAIL\" to `snipe.err`.\n\n3. To keep the last 7 days of rotated logs", "metrics": { "length": 862, "commands": 2, "command_list": [ "0 0 * * * mm-snipe \"$LOGDIR/snipe.out\" 2>\"$LOGDIR/snipe.err\"", "0 0 * * * mm-snipe \"$LOGDIR/snipe.out\" 2>\"$LOGDIR/snipe.err\" || echo FAIL \"$LOGDIR/snipe.err\"" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 2, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Cron mails mix debug prints and real errors; failures hide in noise. (stdout-stderr-split-cron)", "condition": "plain", "status": 200, "content": "The error you're experiencing is due to the cron job printing both debug messages and actual errors to the console. To fix this, you'll need to redirect the error output of your cron job to a log file. Here's a step-by-step guide on how to do it:\n\n**Step 1: Create a log file**\n\nCreate a new file in the same directory where your cron job is located. For example, if your cron job is in `/etc/cron.d/`, create a file called `cron.log`:\n\n```bash\nsudo touch /etc/cron.d/cron.log\n```\n\n**Step 2: Edit your cron job**\n\nOpen the file containing your cron job in a text editor. For example, if your cron job is in `/etc/cron.d/`, edit the file using `sudo`:\n\n```bash\nsudo nano /etc/cron.d/your_cron_job\n```\n\nReplace `your_cron_job` with the actual name of your cron job.\n\n**Step 3: Redirect error output to log file**\n\nAdd the following line at the end of your cron job file:\n\n```bash\n2>&1 > /etc/cron.d/cron.log 2>&1\n```\n\nThis will redirect both the standard output", "metrics": { "length": 959, "commands": 3, "command_list": [ "sudo touch /etc/cron.d/cron.log", "sudo nano /etc/cron.d/your_cron_job", "2>&1 > /etc/cron.d/cron.log 2>&1" ], "has_command_block": true, "actionable": false, "inline_code_count": 10, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "APIs block default Python-urllib user agents or cannot rate-limit fairly across bots. (user-agent-identify-bots)", "condition": "with_lesson", "status": 200, "content": "To fix the error, you need to set a clear User-Agent on your HTTP clients. Here's a concrete, actionable fix with exact commands:\n\n**Solution:**\n\nYou can use the `requests` library in Python to set a custom User-Agent. First, install the `requests` library if you haven't already:\n\n```bash\npip install requests\n```\n\nThen, modify your Python script to include the custom User-Agent:\n\n```python\nimport requests\n\nURL = \"https://example.com\" # replace with your API URL\n\nHEADERS = {\n \"User-Agent\": \"HermesMoneymaker/1.0 (+earn-agent)\",\n \"Accept\": \"application/json\",\n}\n\nresponse = requests.get(URL, headers=HEADERS)\n\nif response.status_code == 200:\n print(\"Success\")\nelse:\n print(\"Failure\")\n```\n\n**Verification:**\n\nTo verify that the custom User-Agent is being used, you can use `curl` with the `-A` option:\n\n```bash\ncurl -sI -A \"HermesMoneymaker/1.0\" \"$URL\"\n```\n\nThis command will print the HTTP headers, including the User-Agent, to the console.\n\n**Note:**\n\nMake sure to replace `", "metrics": { "length": 991, "commands": 3, "command_list": [ "pip install requests", "**Verification:**", "To verify that the custom User-Agent is being used, you can use `curl` with the `-A` option:" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "APIs block default Python-urllib user agents or cannot rate-limit fairly across bots. (user-agent-identify-bots)", "condition": "plain", "status": 200, "content": "To fix the \"user-agent-identify-bots\" error in Python-urllib, you can use the `User-Agent` library to generate a unique and random user agent for each request. Here's how you can do it:\n\nFirst, install the `User-Agent` library using pip:\n```bash\npip install user-agent\n```\nThen, you can use the following code to generate a random user agent:\n```python\nimport user_agent\n\ndef generate_random_user_agent():\n return user_agent.random()\n\n# Usage:\nua = generate_random_user_agent()\nprint(ua)\n```\nHowever, if you need to specify a specific user agent, you can use the following code:\n```python\nimport user_agent\n\ndef generate_specific_user_agent(ua_string):\n return user_agent.UserAgent(ua_string=ua_string)\n\n# Usage:\nua = generate_specific_user_agent('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3')\nprint(ua)\n```\nTo use the generated user agent in your Python script, you can use the `headers` dictionary to set the `User-Agent` header", "metrics": { "length": 1007, "commands": 2, "command_list": [ "pip install user-agent", "However, if you need to specify a specific user agent, you can use the following code:" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Cloudflare AI Gateway: gateway token ≠ account token, /workers-ai/run/ path required (cloudflare-ai-gateway-auth-pitfalls)", "condition": "with_lesson", "status": 200, "content": "To fix the error, you need to create a gateway token in the Cloudflare AI Gateway Settings page, use the correct gateway URL, and set the correct headers. Here are the exact steps:\n\n**Step 1: Create a gateway token in the Cloudflare AI Gateway Settings page**\n\n1. Log in to your Cloudflare account and navigate to the AI Gateway settings page.\n2. Click on the \"Settings\" tab.\n3. Scroll down to the \"Authentication\" section.\n4. Click on the \"Create token\" button.\n5. Select the \"Run\" permission scope.\n6. Copy the generated token immediately, as it cannot be retrieved later.\n\n**Step 2: Use the correct gateway URL**\n\n1. Replace `{account_id}` and `{gateway_id}` with your actual Cloudflare account ID and gateway ID.\n2. Use the full gateway URL: `https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/workers-ai/run/@cf/{model}`\n\nExample:\n```bash\nhttps://gateway.ai.cloudflare.com/v1/1234567890/abc123/workers-ai/run/@cf/my_model\n```\n**Step 3: Set the correct headers**\n\n1. In your code, set the `Authorization` header with", "metrics": { "length": 1032, "commands": 1, "command_list": [ "https://gateway.ai.cloudflare.com/v1/1234567890/abc123/workers-ai/run/@cf/my_model" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Cloudflare AI Gateway: gateway token ≠ account token, /workers-ai/run/ path required (cloudflare-ai-gateway-auth-pitfalls)", "condition": "plain", "status": 200, "content": "The error you're encountering typically occurs when the gateway token and account token do not match, which can happen if you've made changes to your Cloudflare settings. To resolve this issue, follow these steps:\n\n1. **Log in to your Cloudflare account**: Go to the Cloudflare dashboard and log in to your account.\n\n2. **Navigate to the Workers tab**: Click on the \"Workers\" tab from the top navigation menu.\n\n3. **Select the Workers project**: Choose the Workers project that contains the AI Gateway worker.\n\n4. **Click on the \"AI Gateway\" tab**: In the Workers project, click on the \"AI Gateway\" tab.\n\n5. **Click on \"Edit\"**: Next to the AI Gateway, click on the \"Edit\" button.\n\n6. **Select the correct token**: In the \"AI Gateway\" settings, make sure to select the correct token from the dropdown menu. This token should match the account token you're using to authenticate with Cloudflare.\n\n7. **Save changes**: After making the necessary changes, click the \"Save\" button.\n\nIf you're still experiencing issues, try the following:\n\n- **Clear the cache**: Clear the cache for your Workers project by clicking on the \"Cache\" button in the top-right corner of", "metrics": { "length": 1160, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "DeepWiki Architecture Review: Fair Hits, Stale-Snapshot Misses, and the Right Trajectory (deepwiki-review-fair-hits-stale-misses-trajectory)", "condition": "with_lesson", "status": 200, "content": "To address the issues raised by the external architecture review, you'll need to update the documentation and make some changes to the code. Here's a step-by-step guide with concrete, actionable fixes:\n\n**Update documentation**\n\n1. Open the `docs/LIMITATIONS.md` file in a text editor.\n2. Replace the outdated text with the following:\n```markdown\n# Limitations\n\nMisakaNet is a local-only tool with a thin technical moat. It does not have a real-time sync and is vulnerable to model vendors internalizing memory. However, it provides a powerful search functionality with keyword BM25 and semantic similarity.\n\n## Technical Limitations\n\n* Local core loads all lessons into memory, which can be heavy for large datasets (50k lessons).\n* No automated fact-checking; lessons are community-contributed and rely on evidence levels (E0–E4) + me_events reuse signals for correctness.\n* No real-time sync; local sync is batch by design.\n\n## Semantic Similarity\n\nTo enable semantic similarity, use the `--semantic` flag when running `search_knowledge.py`.\n```\n3. Save the changes to the `docs/LIMITATIONS.md` file.\n\n**Update README**\n\n1. Open the `README.md` file in a text", "metrics": { "length": 1162, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 5, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "DeepWiki Architecture Review: Fair Hits, Stale-Snapshot Misses, and the Right Trajectory (deepwiki-review-fair-hits-stale-misses-trajectory)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely due to a missing or incorrect dependency in your project. DeepWiki is a Python package that provides a simple and efficient way to calculate the fair hits, stale-snapshot misses, and the right trajectory for a given set of hits.\n\nTo fix this error, you can try the following steps:\n\n1. **Install the required package**:\n\n You need to install the `deepwiki` package. You can install it using pip:\n\n ```bash\npip install deepwiki\n```\n\n2. **Update your package.json (if you're using npm)**:\n\n If you're using npm, you need to update your `package.json` file to include the `deepwiki` package. You can do this by adding the following line to your `dependencies` section:\n\n ```json\n\"deepwiki\": \"^1.0.0\"\n```\n\n Then, run the following command to install the package:\n\n ```bash\nnpm install\n```\n\n3. **Check for conflicts with other packages**:\n\n Sometimes, conflicts with other packages can cause issues with DeepWiki. You can try to remove any conflicting packages by running the following command:\n\n ```bash\npip freeze\n```\n\n This will list all packages", "metrics": { "length": 1114, "commands": 4, "command_list": [ "pip install deepwiki", "Then, run the following command to install the package:", "3. **Check for conflicts with other packages**:", "Sometimes, conflicts with other packages can cause issues with DeepWiki. You can try to remove any conflicting packages by running the following command:" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "DSH Plugin Installation Troubleshooting — Common Failures and Fixes (dsh-plugin-installation-troubleshooting)", "condition": "with_lesson", "status": 200, "content": "Based on the provided information, here are some concrete, actionable fixes for the common failures encountered when installing the MisakaNet DSH plugin:\n\n**1. npm Install — Registry Unreachable**\n\nSymptom: `dsh plugin add misakanet` hangs or times out.\n\nCause: Corporate firewall or proxy blocks `registry.npmjs.org`. Alternatively, `npm` cache is corrupted.\n\nFix:\n\n**Option A: Check registry connectivity and clear npm cache**\n\n```bash\n# Check registry connectivity\ncurl -sS -o /dev/null -w \"%{http_code}\\n\" https://registry.npmjs.org/\n\n# Clear npm cache and retry\nnpm cache clean --force\ndsh plugin add misakanet\n```\n\n**Option B: Set proxy**\n\n```bash\n# Set proxy\nnpm config set proxy http://proxy:8080\nnpm config set https-proxy http://proxy:8080\n\n# Retry installation\ndsh plugin add misakanet\n```\n\n**2. Git Method — codeload.github.com Timeout**\n\nSymptom: `dsh plugin add github:ikalus1988/MisakaNet` fails with `request timeout: cannot reach GitHub`.\n\nCause: `codeload.github.com` is blocked or slow in", "metrics": { "length": 1007, "commands": 6, "command_list": [ "curl -sS -o /dev/null -w \"%{http_code}\\n\" https://registry.npmjs.org/", "npm cache clean --force", "dsh plugin add misakanet", "npm config set proxy http://proxy:8080", "npm config set https-proxy http://proxy:8080" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "DSH Plugin Installation Troubleshooting — Common Failures and Fixes (dsh-plugin-installation-troubleshooting)", "condition": "plain", "status": 200, "content": "The error you're experiencing is likely due to the fact that the DSH plugin installation is failing because it requires a specific version of Ruby to be installed on your system.\n\nTo fix this issue, you need to install Ruby and the DSH plugin using the following commands:\n\n**Step 1: Install Ruby**\n\nYou can install Ruby using Homebrew (on macOS) or by downloading the Ruby installer from the official Ruby website.\n\n**On macOS (using Homebrew):**\n\n```bash\nbrew install ruby\n```\n\n**On Linux (or macOS with non-brew Ruby):**\n\nDownload the latest version of Ruby from the official Ruby website: https://www.ruby-lang.org/downloads/\n\nFollow the installation instructions for your specific Linux distribution or macOS.\n\n**Step 2: Install DSH plugin**\n\nOnce Ruby is installed, you can install the DSH plugin using the following command:\n\n```bash\ngem install dsh\n```\n\nIf you encounter any issues during the installation process, you can try the following:\n\n* Make sure you have the latest version of Homebrew (on macOS) or Ruby (on Linux or macOS).\n* If you're using a Linux distribution, ensure that you have the necessary dependencies installed, such as `make` and `gcc`.\n* If you're", "metrics": { "length": 1179, "commands": 2, "command_list": [ "brew install ruby", "gem install dsh" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Timeout de curl detrás de proxy corporativo: inspección SSL rompe validación de certificados (proxy-corporativo-curl-timeout)", "condition": "with_lesson", "status": 200, "content": "**Solución con configuración permanente**\n\nPara evitar problemas de certificado en futuras sesiones, te recomiendo utilizar la opción 2: agregar CA corporativa al almacén de confianza.\n\n**Paso 1: Encontrar el certificado CA corporativo**\n\nRevisa con tu IT o revisa el navegador para encontrar el certificado CA corporativo. El nombre del archivo puede variar, pero típicamente se llama algo como `corporate-ca.crt` o `ca.corp`.\n\n**Paso 2: Copiar el certificado CA corporativo al almacén de confianza**\n\nCopia el certificado CA corporativo al almacén de confianza `/etc/ssl/certs/`:\n\n```bash\nsudo cp /path/to/corporate-ca.crt /etc/ssl/certs/\n```\n\n**Paso 3: Configurar la variable de entorno para utilizar el certificado CA corporativo**\n\nConfigura la variable de entorno `CURL_CA_BUNDLE` para utilizar el certificado CA corporativo:\n\n```bash\nexport CURL_CA_BUNDLE=/etc/ssl/certs/corporate-ca.crt\n```\n\n**Paso 4: Verificar la configuración**\n\nVer", "metrics": { "length": 943, "commands": 2, "command_list": [ "sudo cp /path/to/corporate-ca.crt /etc/ssl/certs/", "export CURL_CA_BUNDLE=/etc/ssl/certs/corporate-ca.crt" ], "has_command_block": true, "actionable": false, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Timeout de curl detrás de proxy corporativo: inspección SSL rompe validación de certificados (proxy-corporativo-curl-timeout)", "condition": "plain", "status": 200, "content": "The error message you're encountering indicates that there's an issue with the SSL certificate validation when using a corporate proxy with cURL. This is often due to the proxy server not providing the correct SSL certificates or the certificates not being trusted by the system.\n\nHere are some steps you can take to resolve this issue:\n\n**Step 1: Update your system's trust store**\n\nYou need to update the system's trust store to include the SSL certificates provided by your corporate proxy. The steps to do this vary depending on your operating system:\n\n**For Ubuntu/Debian:**\n\n```bash\nsudo apt update\nsudo apt install ca-certificates\nsudo update-ca-certificates\n```\n\n**For Red Hat/CentOS/Fedora:**\n\n```bash\nsudo yum install ca-certificates\nsudo update-ca-certificates\n```\n\n**For macOS (using Homebrew):**\n\n```bash\nbrew install ca-certificates\nbrew link ca-certificates\n```\n\n**Step 2: Add the corporate proxy's SSL certificates to the system's trust store**\n\nYou need to add the SSL certificates provided by your corporate proxy to the system's trust store. The steps to do this vary depending on your operating system:\n\n**For Ubuntu/Debian:**\n\n```bash\nsudo curl -", "metrics": { "length": 1167, "commands": 7, "command_list": [ "sudo apt update", "sudo apt install ca-certificates", "sudo update-ca-certificates", "sudo yum install ca-certificates", "sudo update-ca-certificates" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "pip install falha com ReadTimeoutError atrás de proxy corporativo (instalacao-pip-timeout-proxy)", "condition": "with_lesson", "status": 200, "content": "Para resolver o erro `pip install falha com ReadTimeoutError atrás de proxy corporativo`, você pode seguir as seguintes etapas:\n\n**Opção 1: Aumentar timeout e confiar no host PyPI**\n\n```bash\npip install --timeout 120 --trusted-host pypi.org --trusted-host files.pythonhosted.org nome-do-pacote\n```\n\n**Opção 2: Configurar CA corporativa globalmente**\n\n1. Encontre o caminho do certificado CA corporativa:\n```bash\nfind /usr/ -name corporate-ca.crt\n```\n2. Copie o certificado para o diretório `~/.local/share/ca-certificates/`:\n```bash\ncp /path/to/corporate-ca.crt ~/.local/share/ca-certificates/\n```\n3. Atualize os certificados do sistema:\n```bash\nupdate-ca-certificates\n```\n\n**Opção 3: Usar configurações de proxy do sistema**\n\n1. Configure o proxy HTTP e HTTPS:\n```bash\nexport HTTP_PROXY=http://proxy.corp:8080\nexport HTTPS_PROXY=http://proxy.corp:8080\n```\n2. Instale o pacote:\n```bash\npip install nome-do-pac", "metrics": { "length": 909, "commands": 6, "command_list": [ "pip install --timeout 120 --trusted-host pypi.org --trusted-host files.pythonhosted.org nome-do-pacote", "find /usr/ -name corporate-ca.crt", "cp /path/to/corporate-ca.crt ~/.local/share/ca-certificates/", "update-ca-certificates", "export HTTP_PROXY=http://proxy.corp:8080" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "pip install falha com ReadTimeoutError atrás de proxy corporativo (instalacao-pip-timeout-proxy)", "condition": "plain", "status": 200, "content": "The error message you're encountering is due to a timeout issue while installing packages via pip behind a corporate proxy. Here's a step-by-step fix:\n\n**Method 1: Using the `--proxy` option with `pip`**\n\n1. Open your terminal or command prompt.\n2. Update your `pip` installation with the corporate proxy by running the following command:\n```bash\npip install --proxy pip\n```\nReplace `` with the URL of your corporate proxy server, in the format `http://proxy_url` or `https://proxy_url`.\n\nExample:\n```bash\npip install --proxy http://your_corporate_proxy.com:8080 pip\n```\n**Method 2: Using the `--trusted-host` option with `pip`**\n\n1. Open your terminal or command prompt.\n2. Update your `pip` installation with the corporate proxy by running the following command:\n```bash\npip install --trusted-host pip\n```\nReplace `` with the URL of your corporate proxy server, in the format `http://proxy_url` or `https://proxy_url`.\n\nExample:\n```bash\npip install --trusted-host http://your_corporate_proxy.com:8080 pip\n``", "metrics": { "length": 1055, "commands": 3, "command_list": [ "pip install --proxy pip", "pip install --proxy http://your_corporate_proxy.com:8080 pip", "pip install --trusted-host pip" ], "has_command_block": true, "actionable": true, "inline_code_count": 19, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Readers see half-written `data.json` while the dashboard refreshes and parse errors flash. (atomic-write-replace)", "condition": "with_lesson", "status": 200, "content": "To fix the error you're experiencing, you can apply the atomic-write pattern to your `data.json` file. Here's a step-by-step guide:\n\n**Step 1: Install the required packages**\n\nFirst, you need to install the `pathlib`, `os`, `json`, and `tempfile` packages. These packages are part of the Python Standard Library, so you don't need to install anything extra.\n\n**Step 2: Create a function to perform atomic writes**\n\nCreate a new file (e.g., `atomic_write.py`) and add the following code:\n```python\nfrom pathlib import Path\nimport os\nimport json\nimport tempfile\n\ndef atomic_write(path: Path, obj) -> None:\n \"\"\"\n Perform an atomic write to the given file.\n\n Args:\n path (Path): The path to the file to write to.\n obj (dict): The object to write to the file.\n \"\"\"\n path = Path(path)\n path.parent.mkdir(parents=True, exist_ok=True)\n fd, tmp = tempfile.mkstemp(dir=str(path.parent), prefix=\".tmp-\")\n try:\n with os.fdopen(fd, \"w\", encoding=\"utf-8\") as f:\n json.dump(obj, f,", "metrics": { "length": 1014, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 5, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Retry loops sleep 2^n without a ceiling and burn the whole night after attempt 10. (exponential-backoff-cap)", "condition": "with_lesson", "status": 200, "content": "To fix the issue of exponential backoff without a ceiling, you can use a logarithmic backoff strategy instead of exponential backoff. Logarithmic backoff increases the delay by a constant factor with each retry, which prevents the delay from growing exponentially.\n\nHere's a modified version of your code that implements logarithmic backoff:\n\n```python\nimport time\nimport random\nimport logging\n\n# Set up logging\nlogging.basicConfig(level=logging.INFO)\nlogger = logging.getLogger(__name__)\n\ndef sleep_attempt(i: int, base=1.0, factor=2, cap=45.0) -> None:\n \"\"\"\n Sleep for a delay based on the attempt number, base, factor, and cap.\n \"\"\"\n delay = min(cap, base * (factor ** i))\n logger.info(f\"Attempt {i+1} sleeping for {delay} seconds\")\n time.sleep(random.uniform(0, delay))\n\ndef retry_with_log(max_attempts: int, func, *args, **kwargs):\n \"\"\"\n Retry a function with exponential backoff and logging.\n \"\"\"\n for i in range(max_attempts):\n try:\n return func(*args, **kwargs)\n except Exception as e:\n logger.error(f\"Attempt {i+1} failed with", "metrics": { "length": 1101, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Readers see half-written `data.json` while the dashboard refreshes and parse errors flash. (atomic-write-replace)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely due to the fact that the `data.json` file is not being fully written to disk when the dashboard refreshes. This can happen if the program is interrupted or terminated abruptly, leaving the file in an incomplete state.\n\nHere's a concrete, actionable fix to resolve this issue:\n\n**Step 1: Create a lock file**\n\nCreate a lock file to prevent multiple instances of your program from writing to the `data.json` file simultaneously.\n\nCreate a new file called `data.json.lock` in the same directory as your `data.json` file:\n```bash\ntouch data.json.lock\n```\n**Step 2: Modify your program to use the lock file**\n\nModify your program to check for the existence of the lock file before attempting to write to `data.json`. If the lock file exists, exit immediately to prevent further writes.\n\nHere's an example using Python:\n```python\nimport os\n\ndef write_to_data_json(data):\n lock_file = 'data.json.lock'\n if os.path.exists(lock_file):\n print(\"Another instance is writing to data.json. Exiting.\")\n exit(1)\n\n # Write data to JSON file\n with open('data.json', 'w') as f:\n f.write(data)\n\n", "metrics": { "length": 1148, "commands": 1, "command_list": [ "touch data.json.lock" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Dashboards show large \"pending\" Superteam pools and humans hear it as paid. (honest-zero-cash-reporting)", "condition": "with_lesson", "status": 200, "content": "Based on the provided lesson, the issue is that the \"pending\" Superteam pools are not being accurately represented as non-paid on the dashboard. This is because the `pending_judging` field is not being updated correctly.\n\nHere's a concrete, actionable fix:\n\n**Update the `pending_judging` field to reflect the correct balance**\n\nYou can use the following command to update the `pending_judging` field:\n```bash\ngrep -i 'pending_judging' MONEY.md\n```\nThis will show you the current value of the `pending_judging` field.\n\n**Update the value to reflect the correct balance**\n\nSince the `pending_judging` field represents the amount of cash that has been submitted but not yet awarded, you can update it to reflect the correct balance by subtracting the `pending_judging` amount from the `cash` amount.\n\nFor example, if the current values are:\n```markdown\nCash: $0\nPending judging: ~$5600 (not guaranteed)\nWins: 0\n```\nYou can update the `pending_judging` field to:\n```markdown\nCash: $0\nPending judging: $0\nWins: 0\n```\nThis will accurately represent the fact that the Superteam pool is", "metrics": { "length": 1079, "commands": 2, "command_list": [ "grep -i 'pending_judging' MONEY.md", "You can update the `pending_judging` field to:" ], "has_command_block": true, "actionable": true, "inline_code_count": 13, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Retry loops sleep 2^n without a ceiling and burn the whole night after attempt 10. (exponential-backoff-cap)", "condition": "plain", "status": 200, "content": "The error you're encountering is due to the exponential backoff mechanism not being capped at a certain limit. This can cause the program to sleep for an excessively long time, leading to a \"burning the whole night\" issue.\n\nHere's a concrete, actionable fix:\n\n**Solution: Implement a capped exponential backoff**\n\nYou can use the `time` and `random` modules in Python to implement a capped exponential backoff. Here's an example code snippet that demonstrates how to do this:\n\n```python\nimport time\nimport random\n\ndef capped_exponential_backoff(max_attempts, max_sleep):\n \"\"\"\n Capped exponential backoff with a maximum number of attempts and a maximum sleep time.\n\n Args:\n max_attempts (int): The maximum number of attempts to make before giving up.\n max_sleep (int): The maximum sleep time in seconds.\n\n Yields:\n int: The sleep time in seconds for the next attempt.\n \"\"\"\n sleep_time = 2 ** random.randint(0, 3) # Randomly select an attempt between 2^0 and 2^3\n if sleep_time > max_sleep:\n sleep_time = max_sleep\n yield sleep_time\n if max_attempts > 1:\n # Rec", "metrics": { "length": 1122, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 2, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Overnight earn agents hang forever on a dead HTTP peer, or fail once on a blip and abandon a good job. (http-timeout-retry-pattern)", "condition": "plain", "status": 200, "content": "The error you're experiencing is due to the agents hanging indefinitely on a dead HTTP peer or failing after a brief connection blip and abandoning a good job. To resolve this issue, you can try the following steps:\n\n**Step 1: Increase the HTTP timeout**\n\nYou can increase the HTTP timeout to give the agents more time to wait for a response from the dead peer. You can do this by adding the following command to your `config.yaml` file:\n\n```yml\nhttp:\n timeout: 300s\n```\n\nThis sets the HTTP timeout to 5 minutes.\n\n**Step 2: Implement a retry mechanism**\n\nYou can implement a retry mechanism to allow agents to retry failed jobs after a brief delay. You can do this by adding the following command to your `config.yaml` file:\n\n```yml\nhttp:\n timeout: 300s\n retry:\n max_retries: 3\n retry_delay: 30s\n```\n\nThis sets the maximum number of retries to 3 and the delay between retries to 30 seconds.\n\n**Step 3: Configure the agent to reconnect**\n\nYou can configure the agent to reconnect to a dead peer after a brief delay. You can do this by adding the following command to your `config", "metrics": { "length": 1087, "commands": 3, "command_list": [ "This sets the HTTP timeout to 5 minutes.", "**Step 2: Implement a retry mechanism**", "You can implement a retry mechanism to allow agents to retry failed jobs after a brief delay. You can do this by adding the following command to your `config.yaml` file:" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Overnight earn agents hang forever on a dead HTTP peer, or fail once on a blip and abandon a good job. (http-timeout-retry-pattern)", "condition": "with_lesson", "status": 200, "content": "The issue you're encountering is due to the default socket timeout and the retry pattern used in your code. To fix this, you can use the following modifications to your existing function:\n\n```python\nimport json, time, urllib.error, urllib.request\nimport logging\n\n# Set up logging\nlogging.basicConfig(level=logging.INFO)\nlogger = logging.getLogger(__name__)\n\ndef get_json(url: str, headers: dict | None = None, tries: int = 4, timeout: float = 20.0):\n \"\"\"\n Sends a GET request to the provided URL with the given headers and \n attempts to parse the response as JSON.\n\n Args:\n url (str): The URL to send the request to.\n headers (dict, optional): The headers to include in the request. Defaults to None.\n tries (int, optional): The number of times to retry the request. Defaults to 4.\n timeout (float, optional): The timeout for the request in seconds. Defaults to 20.0.\n\n Returns:\n dict: The parsed JSON response.\n \"\"\"\n last = None\n for i in range(tries):\n req = urllib.request.Request(url, headers=headers or {\"User-Agent\": \"agent/1.0\"})\n try", "metrics": { "length": 1094, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Dashboards show large \"pending\" Superteam pools and humans hear it as paid. (honest-zero-cash-reporting)", "condition": "plain", "status": 200, "content": "To fix the \"honest-zero-cash-reporting\" issue, you'll need to adjust the threshold for \"pending\" Superteam pools in your Dashboards. Here's a step-by-step solution:\n\n**Prerequisites:**\n\n1. Make sure you have a basic understanding of Dashboards and Superteam pools in your application.\n2. Ensure you have the necessary permissions to edit Dashboards.\n\n**Step 1: Locate the Superteam pool threshold**\n\n1. Log in to your application and navigate to the Dashboards section.\n2. Find the Superteam pool you want to adjust and click on the three dots next to it.\n3. Select \"Edit\" from the dropdown menu.\n4. In the \"Superteam pool\" settings, look for the \"Threshold\" or \"Threshold amount\" field.\n\n**Step 2: Update the threshold**\n\n1. Update the threshold value to a lower amount. For example, if the current threshold is 100, set it to 50 or 20.\n2. Click \"Save\" to apply the changes.\n\n**Step 3: Verify the changes**\n\n1. Refresh the Superteam pool dashboard.\n2. Check if the \"pending\" Superteam pools are now displaying a lower amount.\n\n", "metrics": { "length": 1028, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Two sniper ticks claim the same OPEN task, double-work, or confuse the board. (idempotent-task-claim)", "condition": "with_lesson", "status": 200, "content": "The error you're encountering is due to the lack of a local claim ledger, which causes network retries to replay the POST claim. To fix this issue, you can implement a local claim ledger using a JSON file. Here's an updated version of your code with a local claim ledger:\n\n```python\nfrom pathlib import Path\nimport json, time\n\n# Define the path to the local claim ledger\nLEDGER = Path.home() / \".local/state/earn/claims.json\"\n\ndef already(task_id: str) -> bool:\n \"\"\"Check if a task ID already exists in the local claim ledger.\"\"\"\n if not LEDGER.exists():\n return False\n data = json.loads(LEDGER.read_text())\n return task_id in data\n\ndef mark(task_id: str, meta: dict) -> None:\n \"\"\"Mark a task ID in the local claim ledger.\"\"\"\n LEDGER.parent.mkdir(parents=True, exist_ok=True)\n data = json.loads(LEDGER.read_text()) if LEDGER.exists() else {}\n data[task_id] = {\"ts\": time.time(), \"meta\": meta}\n LEDGER.write_text(json.dumps(data, indent=2))\n\ndef claim(task_id: str, do_claim) -> str:\n \"\"\"Claim a task ID and", "metrics": { "length": 1043, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Two sniper ticks claim the same OPEN task, double-work, or confuse the board. (idempotent-task-claim)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely due to two sniper ticks trying to claim the same task or board state. To fix this, you can implement the following solution:\n\n**Solution:**\n\n1. **Unique Task IDs**: Ensure that each task has a unique ID. If tasks are being generated dynamically, make sure to use a unique identifier for each task.\n\n2. **Task Locking**: Implement a locking mechanism to prevent multiple ticks from claiming the same task. This can be achieved using a database lock or a distributed lock.\n\n3. **Board State Validation**: Validate the board state before making any moves. This can help prevent double-work and confusion.\n\n**Example Code (in Python):**\n\nAssuming you're using a game board with a `Task` class and a `Tick` class:\n\n```python\nimport uuid\nimport time\n\nclass Task:\n def __init__(self):\n self.id = uuid.uuid4() # Unique task ID\n self.claimed = False\n\nclass Tick:\n def __init__(self, game_board):\n self.game_board = game_board\n\n def claim_task(self, task_id):\n task = self.game_board.tasks.get(task_id)\n if task and not task.claimed:\n task.claimed", "metrics": { "length": 1133, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 2, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Chat history is the only record of what the earn agent did; audits fail. (jsonl-activity-ledger)", "condition": "with_lesson", "status": 200, "content": "To fix the issue of having only chat history as a record of what the earn agent did and to make audits pass, we need to create a durable activity stream on disk. Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Create a directory for the activity stream**\n\nOpen a terminal and run the following command to create a directory for the activity stream:\n\n```bash\nmkdir ~/hermes-moneymaker/ledger/activity\n```\n\n**Step 2: Initialize the activity stream**\n\nRun the following command to initialize the activity stream:\n\n```bash\ntouch ~/hermes-moneymaker/ledger/activity/activity.jsonl\n```\n\n**Step 3: Create a function to log events**\n\nCreate a Python function to log events to the activity stream. This function will ensure that events are logged in a JSONL format.\n\n```python\nimport json, time\nfrom pathlib import Path\n\ndef log_event(action: str, kw):\n path = Path.home() / \"hermes-moneymaker\" / \"ledger\" / \"activity.jsonl\"\n path.parent.mkdir(parents=True, exist_ok=True)\n row = {\"ts\": time.time(), \"action\": action, \"kw\": kw}\n with path.open(\"a\",", "metrics": { "length": 1069, "commands": 2, "command_list": [ "mkdir ~/hermes-moneymaker/ledger/activity", "touch ~/hermes-moneymaker/ledger/activity/activity.jsonl" ], "has_command_block": true, "actionable": true, "inline_code_count": 4, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Chat history is the only record of what the earn agent did; audits fail. (jsonl-activity-ledger)", "condition": "plain", "status": 200, "content": "The error message \"Chat history is the only record of what the earn agent did; audits fail (jsonl-activity-ledger)\" suggests that the earn agent is not logging its activities in a way that is easily auditable, and the only remaining record of its actions is the chat history.\n\nTo fix this issue, you can try the following steps:\n\n1. **Enable logging**: Make sure that the earn agent is configured to log its activities. Check the earn agent's configuration to ensure that logging is enabled.\n\n For example, if you're using a Docker container:\n ```bash\ndocker run -d --name earn-agent \\\n -e EARN_AGENT_LOGGING=true \\\n -e EARN_AGENT_LOGGING_LEVEL=INFO \\\n earn-agent-image\n```\n2. **Configure logging**: Configure the earn agent to log its activities to a file or a database. This will provide a more structured and auditable record of its actions.\n\n For example, if you're using a Docker container:\n ```bash\ndocker run -d --name earn-agent \\\n -e EARN_AGENT_LOGGING_FILE=/log/earn-agent.log \\\n -e EARN_AGENT_LOGGING_LEVEL=INFO \\\n earn-agent-image\n```\n3. **Verify", "metrics": { "length": 1072, "commands": 8, "command_list": [ "docker run -d --name earn-agent \\", "-e EARN_AGENT_LOGGING=true \\", "-e EARN_AGENT_LOGGING_LEVEL=INFO \\", "earn-agent-image", "docker run -d --name earn-agent \\" ], "has_command_block": true, "actionable": true, "inline_code_count": 3, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "`links.json` mixes URL strings and `{local, ready}` objects. Code calls `.startswith(\"http\")` and crashes. (links-json-mixed-types)", "condition": "with_lesson", "status": 200, "content": "To fix the error, you need to normalize the mixed types in your `links.json` file. Here's a step-by-step guide:\n\n**Step 1: Identify the mixed types**\n\nOpen your `links.json` file and look for entries that contain both URL strings and `{local, ready}` objects.\n\n**Step 2: Update the JSON file**\n\nUse the following command to update the JSON file:\n\n```bash\njq '.[] | .url = .url | .link = .link | .href = .href | .public = .public' links.json > temp.json\n```\n\nThis command uses the `jq` command-line JSON processor to update each entry in the JSON file. It sets the `url`, `link`, `href`, and `public` fields to the corresponding values.\n\n**Step 3: Remove mixed types**\n\nUse the following command to remove the mixed types:\n\n```bash\njq '.[] | del(.local, .ready)' temp.json > updated.json\n```\n\nThis command uses `jq` to delete the `local` and `ready` fields from each entry in the JSON file.\n\n**Step 4: Verify the updated file**\n\nUse the following command to verify the updated file:\n\n```bash\njq '.[] |", "metrics": { "length": 1000, "commands": 2, "command_list": [ "jq '.[] | .url = .url | .link = .link | .href = .href | .public = .public' links.json > temp.json", "jq '.[] | del(.local, .ready)' temp.json > updated.json" ], "has_command_block": true, "actionable": true, "inline_code_count": 14, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "`links.json` mixes URL strings and `{local, ready}` objects. Code calls `.startswith(\"http\")` and crashes. (links-json-mixed-types)", "condition": "plain", "status": 200, "content": "The error is due to the fact that your `links.json` file contains both URL strings and objects with keys like `{local, ready}`. When you try to check if a link starts with \"http\" using `.startswith(\"http\")`, it crashes because it doesn't know how to handle the object.\n\nHere's a concrete, actionable fix:\n\n**Step 1: Install `jsonschema` library**\n\nYou'll need to install the `jsonschema` library to validate your JSON file. Run the following command in your terminal:\n\n```bash\npip install jsonschema\n```\n\n**Step 2: Define a schema for your JSON file**\n\nCreate a new file named `schema.json` with the following content:\n\n```json\n{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"title\": \"Links\",\n \"type\": \"object\",\n \"properties\": {\n \"links\": {\n \"type\": \"array\",\n \"items\": {\n \"oneOf\": [\n {\n \"type\": \"string\",\n \"format\": \"uri\"\n },\n {\n \"type\": \"object\",\n \"additionalProperties\": false\n }\n ]\n }\n }\n }\n}\n```\n\nThis schema", "metrics": { "length": 1043, "commands": 1, "command_list": [ "pip install jsonschema" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Earn agents log full HTTP headers, cookies, or env dumps. Tokens leak into chat transcripts and public gists. (log-redaction-secrets)", "condition": "with_lesson", "status": 200, "content": "**Redacting Secrets from Agent Logs**\n\nTo fix the issue, you need to modify your logging function to redact sensitive information before printing it to the console. Here's an updated version of the code:\n\n```python\nimport re\nimport logging\n\n# Regular expressions for matching sensitive fields\nSECRET_RE = re.compile(\n r\"(?i)(authorization|cookie|api[_-]?key|token|secret|private[_-]?key)\\s[:=]\\s\\S+\"\n)\nBEARER_RE = re.compile(r\"(?i)bearer\\s+[a-z0-9._\\-]+\")\n\n# Redaction function\ndef redact(text: str) -> str:\n \"\"\"\n Redact sensitive information from the given text.\n \n Args:\n text (str): The text to redact.\n \n Returns:\n str: The text with sensitive information redacted.\n \"\"\"\n text = SECRET_RE.sub(r\"\\1: [REDACTED]\", text)\n text = BEARER_RE.sub(\"Bearer [REDACTED]\", text)\n return text\n\n# Logging function with redaction\ndef log(msg: str) -> None:\n \"\"\"\n Log a message with redaction of sensitive information.\n \n Args:\n ", "metrics": { "length": 970, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Agents spin forever on one 403 (credits) or captcha and ship nothing else. (multi-lane-rotate-on-block)", "condition": "with_lesson", "status": 200, "content": "To fix the issue of agents spinning forever on one 403 (credits) or captcha and shipping nothing else, you can implement the following solution:\n\n**Step 1: Update the `rotate_earn_lanes` function**\n\nReplace the existing `rotate_earn_lanes` function with the following code:\n\n```python\nimport time\nfrom datetime import datetime, timedelta\n\ndef rotate_earn_lanes(tb, misaka_opentask):\n for lane in tb.st_misaka_opentask:\n try:\n # Wait for a short period of time before checking the task again\n time.sleep(1)\n # Check if the task is blocked\n if (lane.blocked_until is not None and\n (lane.blocked_until < datetime.now() + timedelta(seconds=1) or\n (lane.credits == 0 and not lane.captcha))):\n # Mark the task as blocked\n lane.blocked_until = datetime.now() + timedelta(seconds=10) # Set a 10-second timeout\n print(f\"Task {lane.name} is blocked\")\n except Exception as e:\n print(f\"Error checking task {lane.name}: {e}\")\n```\n\n**Step 2: Update the `tb.st_mis", "metrics": { "length": 1098, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 4, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Agents spin forever on one 403 (credits) or captcha and ship nothing else. (multi-lane-rotate-on-block)", "condition": "plain", "status": 200, "content": "To address the issue of agents spinning forever on one 403 (credits) or captcha and shipping nothing else, you can try the following concrete and actionable fix:\n\n**Step 1: Update the agent configuration**\n\n Run the following command to update the agent configuration:\n```bash\npython -m multiproxy_agent --config_path /path/to/agent/config.json --update\n```\nReplace `/path/to/agent/config.json` with the actual path to your agent configuration file.\n\n**Step 2: Increase the number of retries**\n\nAdd the following configuration to your agent configuration file (or create a new configuration file if you don't have one):\n```json\n{\n \"retry\": {\n \"max_retries\": 10,\n \"retry_delay\": 60\n }\n}\n```\nThis configuration sets the maximum number of retries to 10 and the retry delay to 60 seconds.\n\n**Step 3: Update the agent with the new configuration**\n\nRun the following command to update the agent with the new configuration:\n```bash\npython -m multiproxy_agent --config_path /path/to/agent/config.json --update\n```\n**Step 4: Run the agent in debug mode**\n\nRun the agent in debug mode to monitor its behavior and identify", "metrics": { "length": 1131, "commands": 4, "command_list": [ "python -m multiproxy_agent --config_path /path/to/agent/config.json --update", "This configuration sets the maximum number of retries to 10 and the retry delay to 60 seconds.", "**Step 3: Update the agent with the new configuration**", "Run the following command to update the agent with the new configuration:" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Earn agents log full HTTP headers, cookies, or env dumps. Tokens leak into chat transcripts and public gists. (log-redaction-secrets)", "condition": "plain", "status": 200, "content": "The error you're experiencing is likely due to the fact that your application is logging sensitive information, such as tokens, HTTP headers, cookies, or environment variables, to the console or a log file. This information is being exposed in the chat transcripts and public gists, which is a security risk.\n\nHere's a concrete, actionable fix with exact commands to help you address this issue:\n\n**Command 1: Remove sensitive information from environment variables**\n\nYou can remove sensitive information from your environment variables using the following command:\n\n```bash\nexport SECRET_TOKEN=\"\"\n```\n\nOr, if you're using a `.env` file, you can add the following line at the top:\n\n```makefile\nSECRET_TOKEN=\"\"\n```\n\n**Command 2: Use environment variables in a secure way**\n\nInstead of hardcoding sensitive information directly in your code, you can use environment variables to store and retrieve the information. For example, you can use the `dotenv` package to load environment variables from a `.env` file:\n\n```bash\nnpm install dotenv\n```\n\nThen, in your code, you can use the `dotenv` package to load the environment variables:\n\n```javascript\nrequire('dotenv').config();\nconst secretToken = process.env.SECRET_TOKEN;\n```\n\n**Command 3", "metrics": { "length": 1236, "commands": 4, "command_list": [ "export SECRET_TOKEN=\"\"", "**Command 2: Use environment variables in a secure way**", "Instead of hardcoding sensitive information directly in your code, you can use environment variables to store and retrieve the information. For example, you can use the `dotenv` package to load environment variables from a `.env` file:", "Then, in your code, you can use the `dotenv` package to load the environment variables:" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Many sniper processes wake on the same cron second, hit 429 together, and back off on the same schedule forever. (rate-limit-jitter-sleep)", "condition": "with_lesson", "status": 200, "content": "To fix the issue of many sniper processes waking up at the same cron second, hitting 429 together, and backoff on the same schedule forever, you can use the following steps:\n\n**Step 1: Add Jitter to Retry Sleeps**\n\nYou can add jitter to retry sleeps by using the `random` module in Python. Here's an example of how you can modify the `backoff_sleep` function to add jitter:\n\n```python\nimport random\nimport time\n\ndef backoff_sleep(attempt: int, base: float = 1.0, cap: float = 60.0) -> None:\n exp = min(cap, base * (2 ** attempt)) # exponential backoff\n delay = random.uniform(0, exp) + random.uniform(0, exp / 2) # add jitter\n time.sleep(delay)\n```\n\nIn this modified function, we add a random jitter to the delay by adding another `random.uniform(0, exp / 2)` to the delay. This ensures that the delays are not perfectly uniform and helps to avoid the \"thundering herd\" problem.\n\n**Step 2: Offset the Schedule**\n\nTo offset the schedule, you can use a random sleep before the main sleep.", "metrics": { "length": 997, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 4, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Many sniper processes wake on the same cron second, hit 429 together, and back off on the same schedule forever. (rate-limit-jitter-sleep)", "condition": "plain", "status": 200, "content": "The error you're encountering is due to the fact that multiple sniper processes are waking up at the same cron second, hitting the rate limit, and then sleeping for the same amount of time, causing a jitter. This can result in a situation where the rate limit is exceeded and the process is unable to recover.\n\nHere's a concrete, actionable fix to resolve this issue:\n\n**Solution:**\n\n1. **Increase the sleep time:** To reduce the jitter, you can increase the sleep time of each process. This will give the process more time to recover before the next cron second.\n\n ```bash\n# Increase the sleep time to 30 seconds\nsleep 30\n```\n\n You can adjust the sleep time to a value that works best for your use case.\n\n2. **Use a random sleep time:** Another approach is to use a random sleep time for each process. This will help distribute the sleep times evenly and reduce the likelihood of multiple processes waking up at the same time.\n\n ```bash\n# Use a random sleep time between 20 and 40 seconds\nsleep $(( RANDOM % 21 + 20 ))\n```\n\n This command will generate a random number between 20 and 40 seconds, and then sleep for that amount of time.\n\n", "metrics": { "length": 1151, "commands": 2, "command_list": [ "sleep 30", "sleep $(( RANDOM % 21 + 20 ))" ], "has_command_block": true, "actionable": true, "inline_code_count": 3, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Pure static pages (HTML+JS on CDN/GitHub Pages, no backend) call third-party APIs from the browser. Risks:\n\n- Hard rate limits (e.g. GitHub REST unauthenticated **60 req/hour**)\n- `fetch` with no timeout hangs forever on bad networks\n- One failed call kills unrelated UI via a shared `Promise.all` / try-catch\n- No server-side key, cache, or request coalescing (static-page-github-api-fault-tolerance)", "condition": "with_lesson", "status": 200, "content": "To fix the error you're experiencing, you can implement the design principles mentioned in the lesson. Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Set a timeout for every external request**\n\nCreate a new function `fetchWithTimeout` that sets a timeout for every external request:\n```javascript\n// static-page-github-api-fault-tolerance.js\n\nconst fetchWithTimeout = async (url, timeoutMs = 8000) => {\n const ctrl = new AbortController();\n const timer = setTimeout(() => ctrl.abort(), timeoutMs);\n try {\n const r = await fetch(url, { signal: ctrl.signal });\n clearTimeout(timer);\n if (!r.ok) throw new Error(`${HTTP ${r.status}}`);\n return r.json();\n } catch (e) {\n clearTimeout(timer);\n throw e;\n }\n};\n\nexport default fetchWithTimeout;\n```\n**Step 2: Parallel requests fail independently**\n\nCreate a new function `parallelFetch` that makes parallel requests and catches any errors independently:\n```javascript\n// parallel-fetch.js\n\nconst parallelFetch = async (urls) => {\n const promises = urls.map((url) => fetchWithTimeout(url));\n const results = await Promise.all(promises.map((promise", "metrics": { "length": 1133, "commands": 2, "command_list": [ "**Step 2: Parallel requests fail independently**", "Create a new function `parallelFetch` that makes parallel requests and catches any errors independently:" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Pure static pages (HTML+JS on CDN/GitHub Pages, no backend) call third-party APIs from the browser. Risks:\n\n- Hard rate limits (e.g. GitHub REST unauthenticated **60 req/hour**)\n- `fetch` with no timeout hangs forever on bad networks\n- One failed call kills unrelated UI via a shared `Promise.all` / try-catch\n- No server-side key, cache, or request coalescing (static-page-github-api-fault-tolerance)", "condition": "plain", "status": 200, "content": "To mitigate the risks associated with making third-party API calls from pure static pages, you can implement the following fixes:\n\n1. **Rate Limiting**: Implement a rate limiter to prevent excessive API calls.\n\n * Install the `ratelimit` package using npm or yarn:\n\n ```bash\nnpm install ratelimit\n```\n\n * Create a new file called `rate-limiter.js` and add the following code:\n\n ```javascript\nconst { RateLimiterMemory } = require('ratelimit');\n\nconst limiter = new RateLimiterMemory({\n points: 60, // 60 requests per hour\n duration: 60 * 60 * 1000 // 1 hour\n});\n\nmodule.exports = limiter;\n```\n\n * In your API call, use the `limiter` to check if the request is within the allowed limit:\n\n ```javascript\nconst limiter = require('./rate-limiter');\n\nasync function makeApiCall() {\n try {\n const response = await fetch('https://api.example.com/data');\n const data = await response.json();\n console.log(data);\n } catch (error) {\n console.error(error);\n }\n}\n\nmakeApiCall().catch((error)", "metrics": { "length": 1033, "commands": 2, "command_list": [ "npm install ratelimit", "* In your API call, use the `limiter` to check if the request is within the allowed limit:" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC 备份打不开?先别急,试这 3 步 (fanuc-backup-extract-guide)", "condition": "with_lesson", "status": 200, "content": "To fix the issue with FANUC backup files (.VR/.SV) not opening, follow these steps:\n\n**Step 1: Ensure you have kconvars.exe**\n\nFirst, verify that you have `kconvars.exe` installed. This executable is required to convert the backup files. You can download it from the WinOLPC website.\n\nIf you don't have it, download and install it from the official website: https://www.winolpc.com/\n\n**Step 2: Check for robot.ini**\n\nNext, check if the `robot.ini` file is present in the same directory as the backup file or in a parent directory. If you encounter an error, try copying the `robot.ini` file to the backup file directory and then try again.\n\n**Step 3: Check the path**\n\nFinally, check if the path contains any Chinese characters or special characters that may cause `kconvars` to crash. Try moving the backup file to a pure English short path, such as `C:\\temp\\`.\n\nHere are the exact commands to try:\n\n1. Open a command prompt and navigate to the directory containing the backup file.\n2. Run the following command to convert the backup file:\n```bash\nkconvars.exe .sv output.txt", "metrics": { "length": 1086, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 5, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC 备份打不开?先别急,试这 3 步 (fanuc-backup-extract-guide)", "condition": "plain", "status": 200, "content": "The error message you're encountering seems to be related to a FANUC backup file that cannot be opened. Based on the provided guide, here's a step-by-step solution to extract the data from the backup file:\n\n**Step 1: Check the backup file format**\n\nThe FANUC backup file format is typically `.bak` or `.dfl`. Ensure that your backup file has one of these extensions.\n\n**Step 2: Extract the data using the FANUC backup extractor**\n\nYou can use the following command to extract the data from the backup file:\n\n```bash\nfanuc-backup-extract /path/to/your/bakfile\n```\n\nReplace `/path/to/your/bakfile` with the actual path to your backup file.\n\n**Step 3: Check the extracted data**\n\nAfter extracting the data, check the output to ensure that it is in the expected format. If the data is not extracted correctly, you can try the following:\n\n```bash\nfanuc-backup-extract -h\n```\n\nThis will display the available options and usage guidelines for the `fanuc-backup-extract` command.\n\nIf you're still encountering issues, you can try the following:\n\n* Check the FANUC documentation for any specific requirements or", "metrics": { "length": 1104, "commands": 2, "command_list": [ "fanuc-backup-extract /path/to/your/bakfile", "fanuc-backup-extract -h" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "pip install ReadTimeoutError Behind Corporate Proxy: Certificate Validation and Timeout Configuration (pip-install-proxy-timeout)", "condition": "with_lesson", "status": 200, "content": "To fix the `ReadTimeoutError` or `ConnectionResetError` when installing packages behind a corporate proxy with SSL inspection, you can follow these steps:\n\n**Option 1: Increase timeout and trust PyPI host (quick)**\n\n```bash\npip install --timeout 120 --trusted-host pypi.org --trusted-host files.pythonhosted.org package-name\n```\n\nThis will increase the timeout to 120 seconds and trust the PyPI host and files.pythonhosted.org.\n\n**Option 2: Set corporate CA globally (recommended)**\n\n1. Find the corporate CA certificate:\n\n```bash\nfind /etc/ssl/certs -name corporate-ca.crt\n```\n\n2. Copy the corporate CA certificate to `~/.local/share/ca-certificates/`:\n\n```bash\ncp /path/to/corporate-ca.crt ~/.local/share/ca-certificates/\n```\n\n3. Update the system CA store:\n\n```bash\nsudo update-ca-certificates\n```\n\nAlternatively, you can set the corporate CA via pip configuration:\n\n```bash\npip config set global.cert /path/to/corporate-ca.crt\n```\n\n**Option 3: Use system proxy settings**\n\n1. Set the proxy settings for pip:\n\n```bash\npip install --proxy http://proxy.cor", "metrics": { "length": 1057, "commands": 5, "command_list": [ "pip install --timeout 120 --trusted-host pypi.org --trusted-host files.pythonhosted.org package-name", "find /etc/ssl/certs -name corporate-ca.crt", "cp /path/to/corporate-ca.crt ~/.local/share/ca-certificates/", "sudo update-ca-certificates", "pip config set global.cert /path/to/corporate-ca.crt" ], "has_command_block": true, "actionable": true, "inline_code_count": 13, "lesson_hits": 6, "lesson_hit_rate": 0.75 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "pip install ReadTimeoutError Behind Corporate Proxy: Certificate Validation and Timeout Configuration (pip-install-proxy-timeout)", "condition": "plain", "status": 200, "content": "The error you're encountering is due to the proxy configuration not being properly set up for certificate validation and timeout configuration. Here's a step-by-step solution to resolve the issue:\n\n**Step 1: Install the required packages**\n\nYou need to install the `pip-install-proxy-timeout` package, which is a proxy that sets the timeout for pip installations. You can install it using the following command:\n\n```bash\npip install pip-install-proxy-timeout\n```\n\n**Step 2: Configure your proxy settings**\n\nYou need to configure your proxy settings to include the certificate validation and timeout configuration. You can do this by adding the following environment variables to your shell configuration file (e.g., `~/.bashrc` or `~/.zshrc`):\n\n```bash\nexport http_proxy='http://your-proxy-server:your-proxy-port'\nexport https_proxy='http://your-proxy-server:your-proxy-port'\nexport HTTPS_PROXY='http://your-proxy-server:your-proxy-port'\nexport PROXY_NO_PROXY='your-no-proxy-domain'\n```\n\nReplace `your-proxy-server` and `your-proxy-port` with your actual proxy server and port numbers.\n\n**Step 3: Verify the proxy configuration**\n\nTo verify that the proxy configuration is working correctly, you can use the", "metrics": { "length": 1207, "commands": 5, "command_list": [ "pip install pip-install-proxy-timeout", "export http_proxy='http://your-proxy-server:your-proxy-port'", "export https_proxy='http://your-proxy-server:your-proxy-port'", "export HTTPS_PROXY='http://your-proxy-server:your-proxy-port'", "export PROXY_NO_PROXY='your-no-proxy-domain'" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 6, "lesson_hit_rate": 0.75 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Prompt Preset Governance: Schema Validation and Immutable Versioning (agent-prompt-preset-template-governance)", "condition": "with_lesson", "status": 200, "content": "To fix the error, we'll implement schema validation and immutable versioning for prompt presets. We'll use the `marshmallow` library for schema validation and `dataclasses` for immutable versioning.\n\n**Step 1: Install required libraries**\n\n```bash\npip install marshmallow dataclasses\n```\n\n**Step 2: Define the schema for prompt presets**\n\nCreate a file `prompt preset schema.py` with the following content:\n\n```python\nfrom marshmallow import Schema, fields, validates, ValidationError\n\nclass PromptPresetSchema(Schema):\n template = fields.Str(required=True)\n contextual_variables = fields.List(fields.Str())\n hyperparameters = fields.Dict()\n\n @validates('template')\n def validate_template(self, value):\n # Add custom validation logic here\n if '{' not in value or '}' not in value:\n raise ValidationError(\"Template must contain placeholders\")\n\n @validates('hyperparameters')\n def validate_hyperparameters(self, value):\n # Add custom validation logic here\n for key, value in value.items():\n if not isinstance(value, (int, float)):\n raise ValidationError(f\"Invalid hyperparameter value: {key} = {value}\")\n```\n\n**Step 3: Define the dataclass for immutable prompt", "metrics": { "length": 1244, "commands": 1, "command_list": [ "pip install marshmallow dataclasses" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 1, "lesson_hit_rate": 0.25 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Mitigating Time Consistency Hallucinations in Conversational Roleplay Agents (agent-roleplay-time-consistency-hallucination)", "condition": "with_lesson", "status": 200, "content": "To mitigate time consistency hallucinations in conversational roleplay agents, you can implement the following steps:\n\n**Step 1: Add Ground-Truth Temporal Anchors**\n\nModify your code to include the current date or a specific date as a ground-truth temporal anchor in your conversation logs. You can use the `datetime` module in Python to achieve this:\n\n```python\nimport datetime\n\n# Get the current date\ncurrent_date = datetime.date.today()\n\n# Add the current date to the conversation log\nconversation_log = [\"Hello, how are you?\", \"I'm doing well, thanks for asking. It's currently \" + current_date.strftime(\"%Y-%m-%d\") + \".\"]\n```\n\n**Step 2: Use Explicit Temporal Normalization**\n\nInstead of relying on neural attention mechanisms to compute relative elapsed durations, you can use explicit temporal normalization techniques. One approach is to use a temporal normalization layer in your model architecture. Here's an example of how you can implement it using PyTorch:\n\n```python\nimport torch\nimport torch.nn as nn\n\nclass TemporalNormalization(nn.Module):\n def __init__(self, embedding_dim):\n super(TemporalNormalization, self).__init__()\n self.embedding_dim = embedding_dim\n self.time_embedding = nn", "metrics": { "length": 1224, "commands": 2, "command_list": [ "**Step 2: Use Explicit Temporal Normalization**", "Instead of relying on neural attention mechanisms to compute relative elapsed durations, you can use explicit temporal normalization techniques. One approach is to use a temporal normalization layer in your model architecture. Here's an example of how you can implement it using PyTorch:" ], "has_command_block": true, "actionable": true, "inline_code_count": 3, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Prompt Preset Governance: Schema Validation and Immutable Versioning (agent-prompt-preset-template-governance)", "condition": "plain", "status": 200, "content": "The error you're encountering is related to a governance issue with the agent-prompt-preset-template-governance schema validation and immutable versioning. Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Update the `agent-prompt-preset-template-governance` schema**\n\nRun the following command to update the schema:\n```bash\nkubectl apply -f https://raw.githubusercontent.com/IBM-Cloud/agent-prompt-preset-template-governance/main/manifests/schemas/agent-prompt-preset-template-governance.yaml\n```\nThis will update the schema with the latest version.\n\n**Step 2: Verify the schema validation**\n\nRun the following command to verify the schema validation:\n```bash\nkubectl get pods -n -l app=agent-prompt-preset-template-governance -o yaml\n```\nReplace `` with the actual namespace where your pods are running.\n\n**Step 3: Apply the governance configuration**\n\nRun the following command to apply the governance configuration:\n```bash\nkubectl apply -f https://raw.githubusercontent.com/IBM-Cloud/agent-prompt-preset-template-governance/main/manifests/governance/agent-prompt-preset-template-governance.yaml\n```\n", "metrics": { "length": 1143, "commands": 3, "command_list": [ "kubectl apply -f https://raw.githubusercontent.com/IBM-Cloud/agent-prompt-preset-template-governance/main/manifests/schemas/agent-prompt-preset-template-governance.yaml", "kubectl get pods -n -l app=agent-prompt-preset-template-governance -o yaml", "kubectl apply -f https://raw.githubusercontent.com/IBM-Cloud/agent-prompt-preset-template-governance/main/manifests/governance/agent-prompt-preset-template-governance.yaml" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Prompt Preset Governance: Schema Validation and Immutable Versioning (agent-prompt-preset-template-governance)", "condition": "plain", "status": 200, "content": "The error you're experiencing is likely due to a mismatch between the schema version of your prompt preset template and the expected schema version in your Governance configuration. Here's a step-by-step fix:\n\n**1. Check the schema version of your prompt preset template**\n\nOpen your `agent-prompt-preset-template.yml` file and look for the `schema` field. It should be in the format of `x.x.x`, e.g., `1.0.0`. Make sure this version matches the expected schema version in your Governance configuration.\n\n**2. Check the expected schema version in your Governance configuration**\n\nOpen your `agent-prompt-preset-template-governance.yml` file and look for the `schema` field in the `PromptPresetTemplate` section. It should also be in the format of `x.x.x`, e.g., `1.0.0`. Ensure that this version matches the schema version of your prompt preset template.\n\n**3. Update the schema version in your prompt preset template (if necessary)**\n\nIf the schema versions don't match, update the `schema` field in your `agent-prompt-preset-template.yml` file to match the expected version in your Governance configuration.\n\n**4. Update the schema version in your Governance configuration (", "metrics": { "length": 1176, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 11, "lesson_hits": 1, "lesson_hit_rate": 0.25 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Prompt Preset Governance: Schema Validation and Immutable Versioning (agent-prompt-preset-template-governance)", "condition": "with_lesson", "status": 200, "content": "To address the issues mentioned in the Prompt Preset Governance lesson, you can implement the following concrete, actionable fixes:\n\n**1. Unchecked Template Interpolation:**\n\nTo prevent unchecked template interpolation, you can use a library like `jinja2` to template your prompt presets. Here's a step-by-step guide:\n\n**Step 1: Install `jinja2`**\n\n```bash\npip install jinja2\n```\n\n**Step 2: Define a template engine**\n\n```python\nfrom jinja2 import Template\n\nclass PromptPresetTemplateEngine:\n def __init__(self, template_string):\n self.template = Template(template_string)\n\n def render(self, context):\n return self.template.render(context)\n```\n\n**Step 3: Use the template engine to render prompt presets**\n\n```python\ntemplate_engine = PromptPresetTemplateEngine('''\n Hello, {{ name }}! You are a {{ role }}.\n''')\n\ncontext = {'name': 'John', 'role': 'Developer'}\nrendered_template = template_engine.render(context)\n\nprint(rendered_template) # Output: Hello, John! You are a Developer.\n```\n\n**2. Untyped Hyperparameter Bundling:**\n\nTo prevent untyped hyperparameter bundling, you can", "metrics": { "length": 1105, "commands": 2, "command_list": [ "pip install jinja2", "**Step 3: Use the template engine to render prompt presets**" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 1, "lesson_hit_rate": 0.25 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Mitigating Time Consistency Hallucinations in Conversational Roleplay Agents (agent-roleplay-time-consistency-hallucination)", "condition": "plain", "status": 200, "content": "The error you're experiencing is related to the concept of \"Time Consistency Hallucinations\" in conversational roleplay agents. This issue occurs when the agent's internal state or memory becomes inconsistent with the current context or conversation history.\n\nHere's a concrete, actionable fix using a Python implementation of a conversational roleplay agent:\n\n**Error:** `agent-roleplay-time-consistency-hallucination`\n\n**Fix:**\n\n1. **Implement a Conversation History Mechanism:**\n\nCreate a data structure to store the conversation history. You can use a list or a dictionary to store the previous user inputs and the agent's responses.\n\n```python\nclass ConversationHistory:\n def __init__(self):\n self.history = []\n\n def add_input(self, input_text):\n self.history.append(input_text)\n\n def get_last_input(self):\n return self.history[-1]\n```\n\n2. **Update the Agent's Internal State:**\n\nModify the agent's internal state to reflect the conversation history. You can use a dictionary to store the agent's internal state.\n\n```python\nclass Agent:\n def __init__(self):\n self.state = {}\n\n def update_state(self, input_text):\n self.state[input_text] = self.state.get(input_text, 0)", "metrics": { "length": 1223, "commands": 2, "command_list": [ "2. **Update the Agent's Internal State:**", "Modify the agent's internal state to reflect the conversation history. You can use a dictionary to store the agent's internal state." ], "has_command_block": true, "actionable": true, "inline_code_count": 3, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Mitigating Time Consistency Hallucinations in Conversational Roleplay Agents (agent-roleplay-time-consistency-hallucination)", "condition": "with_lesson", "status": 200, "content": "**Mitigating Time Consistency Hallucinations in Conversational Roleplay Agents**\n\n**Problem Statement**\n\nTime consistency hallucinations occur when conversation logs are concatenated and fed into large language models without structured temporal envelopes, causing agents to exhibit severe chronological hallucinations.\n\n**Root Cause**\n\n1. Absence of Ground-Truth Temporal Anchors\n2. Implicit and Ambiguous Relative Phrases\n\n**Concrete, Actionable Fix**\n\nTo mitigate time consistency hallucinations, we will introduce the following changes:\n\n**1. Include Ground-Truth Temporal Anchors**\n\n* Add a `timestamp` field to the conversation logs, which stores the date and time of each dialogue turn in UTC format.\n* Use a library like `pytz` to handle time zone conversions and ensure consistent timestamp formatting.\n\n**2. Normalize Relative Phrases**\n\n* Create a custom tokenizer that normalizes relative phrases, such as \"yesterday\", \"today\", and \"tomorrow\", to their corresponding absolute timestamps.\n* Use a dictionary to map relative phrases to their absolute timestamps, and update the conversation logs accordingly.\n\n**Code Implementation**\n\n```python\nimport datetime\nimport pytz\nfrom transformers import AutoTokenizer\n\n# Load pre-trained tokenizer\ntokenizer = AutoTokenizer.from_pretrained('bert-base-uncased')\n\n", "metrics": { "length": 1316, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 2, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Mitigating Time Consistency Hallucinations in Conversational Roleplay Agents (agent-roleplay-time-consistency-hallucination)", "condition": "plain", "status": 200, "content": "The error \"Mitigating Time Consistency Hallucinations in Conversational Roleplay Agents\" doesn't seem to be a specific error message, but rather a research paper title. However, I can provide a general solution to mitigate time consistency hallucinations in conversational roleplay agents.\n\nTime consistency hallucinations occur when a conversational agent generates responses that contradict its previous statements or actions, creating an inconsistent timeline. Here's a concrete, actionable fix to mitigate this issue:\n\n**Solution:** Implement a Temporal Consistency Mechanism\n\n**Step 1: Identify the root cause of the hallucination**\n\nAnalyze the agent's conversation history to identify the point where the hallucination occurs. This will help you understand the context and determine the cause of the inconsistency.\n\n**Step 2: Update the agent's knowledge graph**\n\nEnsure that the agent's knowledge graph is up-to-date and accurate. This includes:\n\n* Verifying the agent's understanding of time-related concepts, such as dates, times, and durations.\n* Ensuring that the agent's knowledge graph is consistent across different conversations and interactions.\n\n**Step 3: Implement a temporal consistency check**\n\nAdd a temporal consistency check to the agent's response generation pipeline. This can be done by:\n\n* Creating a temporal", "metrics": { "length": 1343, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "GitHub Actions: a fork PR can never receive the comment that explains its red check (ci-fork-pr-no-comment-token)", "condition": "plain", "status": 200, "content": "The error you're encountering is due to the GitHub Actions workflow not being able to verify the comment token when a fork PR is created. This is because the comment token is only available for pull requests created by a user with a GitHub account, not for fork PRs.\n\nTo resolve this issue, you can modify your GitHub Actions workflow to not require a comment token for fork PRs. Here's an example of how you can do this:\n\n1. Open your GitHub repository's settings.\n2. Go to Actions > Workflows.\n3. Select the workflow that's causing the error.\n4. In the `on` section, replace `pull_request` with `fork`.\n\nHere's an example of what the modified `on` section might look like:\n\n```yml\non:\n pull_request:\n branches:\n - main\n fork:\n types: [create, edit]\n```\n\nThis will allow your workflow to run on both pull requests and fork PRs.\n\nIf you want to still require a comment token for pull requests, you can use a conditional statement to check if the PR is a fork:\n\n```yml\non:\n pull_request:\n branches:\n - main\n types: [opened, synchronize]\n fork:\n types:", "metrics": { "length": 1079, "commands": 2, "command_list": [ "This will allow your workflow to run on both pull requests and fork PRs.", "If you want to still require a comment token for pull requests, you can use a conditional statement to check if the PR is a fork:" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 1, "lesson_hit_rate": 0.2 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "GitHub Actions: a fork PR can never receive the comment that explains its red check (ci-fork-pr-no-comment-token)", "condition": "with_lesson", "status": 200, "content": "The issue arises from the fact that the `GITHUB_TOKEN` is read-only for a fork PR, and secrets are not passed to the run. To fix this, you can create a separate `GITHUB_TOKEN` for the fork PR, and use that in the workflow. Here's a concrete, actionable fix:\n\n**Step 1: Create a new GITHUB_TOKEN for the fork PR**\n\nYou can create a new GITHUB_TOKEN for the fork PR by following these steps:\n\n```bash\ngh api /users/{user}/tokens --method POST --body '{\"name\":\"fork-pr-token\",\"note\":\"For fork PRs only\"}'\n```\n\nReplace `{user}` with the username of the user who created the fork PR.\n\n**Step 2: Update the workflow to use the new GITHUB_TOKEN**\n\nUpdate your workflow to use the new `fork-pr-token` in the `env` section:\n\n```yml\nenv:\n GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n FORK_PR_TOKEN: ${{ secrets.FORK_PR_TOKEN }}\n```\n\n**Step 3: Update the report step to use the new GITHUB_TOKEN**\n\nUpdate the report step to use the new `fork-pr-token`:\n\n```yml\n- name: Report\n ", "metrics": { "length": 962, "commands": 3, "command_list": [ "gh api /users/{user}/tokens --method POST --body '{\"name\":\"fork-pr-token\",\"note\":\"For fork PRs only\"}'", "**Step 3: Update the report step to use the new GITHUB_TOKEN**", "Update the report step to use the new `fork-pr-token`:" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 1, "lesson_hit_rate": 0.2 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "GitHub Actions: a fork PR can never receive the comment that explains its red check (ci-fork-pr-no-comment-token)", "condition": "with_lesson", "status": 200, "content": "**Fix:**\n\nThe issue arises from the fact that a fork PR run uses a read-only `GITHUB_TOKEN`, which doesn't have the necessary permissions to post comments on the PR. To fix this, we need to use a personal access token with the `repo` scope, which has the necessary permissions to post comments.\n\nHere are the steps to fix the issue:\n\n**Step 1: Create a new personal access token**\n\n1. Log in to your GitHub account and navigate to your profile.\n2. Click on **Settings** and then **Developer settings**.\n3. Click on **Personal access tokens**.\n4. Click on **New personal access token**.\n5. Choose a name for the token (e.g., `sheldon-pat`) and select the `repo` scope.\n6. Click on **Generate token**.\n7. Copy the generated token.\n\n**Step 2: Update your GitHub Actions workflow**\n\n1. Open your GitHub Actions workflow file (e.g., `.github/workflows/main.yml`).\n2. Update the `env` section to use the new personal access token:\n```yaml\nenv:\n GH_TOKEN: ${{ secrets.SHELDON_PAT || 'your-new-token-here' }}\n```\nReplace `'", "metrics": { "length": 1016, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 8, "lesson_hits": 1, "lesson_hit_rate": 0.2 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A manual CI run that sweeps the whole corpus always fails, so nobody trusts the red (ci-manual-dispatch-whole-corpus-false-red)", "condition": "plain", "status": 200, "content": "To fix the error you're encountering, we'll need to identify the specific step in your CI pipeline that's causing the failure. However, I'll provide a general solution that can help you troubleshoot and resolve the issue.\n\n**Step 1: Identify the failing step**\n\nCheck your CI pipeline logs to determine which step is causing the failure. You can usually find these logs in the CI platform's UI or by running `git log` commands.\n\n**Step 2: Check the pipeline's configuration**\n\nReview your pipeline's configuration to ensure that it's correctly set up for a manual CI run. Make sure that the `ci-manual-dispatch-whole-corpus-false-red` flag is set to `true` and that the pipeline is configured to sweep the entire corpus.\n\nHere's an example of how to configure the `ci-manual-dispatch-whole-corpus-false-red` flag in a GitHub Actions workflow:\n```yaml\nname: Manual CI Run\non:\n push:\n branches:\n - main\njobs:\n run:\n runs-on: ubuntu-latest\n steps:\n - name: Checkout code\n uses: actions/checkout@v2\n - name: Run manual CI run\n uses: github-actions/", "metrics": { "length": 1084, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 4, "lesson_hits": 1, "lesson_hit_rate": 0.125 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "GitHub Actions: a fork PR can never receive the comment that explains its red check (ci-fork-pr-no-comment-token)", "condition": "plain", "status": 200, "content": "The error you're experiencing is due to a GitHub Actions limitation. When a fork pull request is created, the GitHub Actions workflow for the parent repository is not triggered by default. To fix this issue, you need to configure the GitHub Actions workflow to run on fork pull requests.\n\nHere's a concrete, actionable fix:\n\n**Step 1: Create a new GitHub Actions workflow file**\n\nIn your repository, create a new file in the `.github/workflows` directory. For example, you can create a file named `.github/workflows/fork-pr.yml`.\n\n**Step 2: Configure the GitHub Actions workflow**\n\nIn the `fork-pr.yml` file, add the following YAML configuration:\n```yml\nname: Fork PR\n\non:\n pull_request:\n types: [opened, synchronize]\n branches:\n - main\n\njobs:\n build:\n runs-on: ubuntu-latest\n steps:\n - name: Checkout code\n uses: actions/checkout@v3\n\n - name: Run workflow\n uses: actions/github-script@v6\n with:\n github-token: ${{ secrets.GITHUB_TOKEN }}\n script: |\n github.issues.createComment({\n issue_number: github.context.pullRequest.number,\n owner: github", "metrics": { "length": 1150, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 3, "lesson_hits": 1, "lesson_hit_rate": 0.2 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A manual CI run that sweeps the whole corpus always fails, so nobody trusts the red (ci-manual-dispatch-whole-corpus-false-red)", "condition": "with_lesson", "status": 200, "content": "The issue arises from the fact that the audit step is not properly auditing the lessons for a manual CI run. To fix this, we need to modify the audit step to only validate the lessons that were affected by the manual dispatch.\n\nHere's a concrete, actionable fix with exact commands:\n\n```bash\n# Update the audit step in the .github/workflows/audit.yml file\nif [ \"${{ github.event_name }}\" = \"pull_request\" ]; then\n mapfile -t TARGETS < <(git diff --name-only \"$BASE_SHA\" \"$HEAD_SHA\" -- 'lessons//.md' 'lessons/.md')\nelse\n # Only validate lessons that were modified in the manual dispatch\n TARGETS=$(git diff --name-only \"$BASE_SHA\" \"$HEAD_SHA\" -- 'lessons//.md' 'lessons/.md' | grep -v 'lessons/.md')\n TARGETS=$(find \"$HOME\" -type f -name \"$TARGETS\" | xargs -I {} rm -f {} | tr '\\n' ' ')\nfi\n```\n\nHowever, the above approach will still not work as expected because the `TARGETS` variable will be empty after removing the modified lessons. To fix this, we need to find the lessons that", "metrics": { "length": 986, "commands": 6, "command_list": [ "if [ \"${{ github.event_name }}\" = \"pull_request\" ]; then", "mapfile -t TARGETS < <(git diff --name-only \"$BASE_SHA\" \"$HEAD_SHA\" -- 'lessons//.md' 'lessons/.md')", "else", "TARGETS=$(git diff --name-only \"$BASE_SHA\" \"$HEAD_SHA\" -- 'lessons//.md' 'lessons/.md' | grep -v 'lessons/.md')", "TARGETS=$(find \"$HOME\" -type f -name \"$TARGETS\" | xargs -I {} rm -f {} | tr '\\n' ' ')" ], "has_command_block": true, "actionable": true, "inline_code_count": 2, "lesson_hits": 5, "lesson_hit_rate": 0.625 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "A manual CI run that sweeps the whole corpus always fails, so nobody trusts the red (ci-manual-dispatch-whole-corpus-false-red)", "condition": "with_lesson", "status": 200, "content": "**Fix: Restrict Schema Gate to Only Validate PR-Related Lessons**\n\nTo fix the issue, you need to modify the audit step to only validate lessons related to the pull request when the event is a manual dispatch. Here are the exact commands:\n\n1. **Backup the existing workflow file**:\n\n```bash\ncp .github/workflows/pr-audit.yml .github/workflows/pr-audit.yml.backup\n```\n\n2. **Modify the workflow file to restrict the audit step to PR-related lessons**:\n\n```bash\nsed -i 's/else/elif [ \"${{ github.event_name }}\" = \"workflow_dispatch\" ]; then/' .github/workflows/pr-audit.yml\n```\n\nThis will add an `elif` condition to the `else` branch to check if the event is a manual dispatch. If it is, the code will fall through to the next branch, which will only validate lessons related to the pull request.\n\n3. **Add a new branch to validate lessons related to the pull request**:\n\n```bash\nsed -i '/if [ \"${{ github.event_name }}\" = \"pull_request\" ]; then/,+3d' .github/workflows/pr-audit.yml\n```\n\nThis will delete the existing `else` branch and add a", "metrics": { "length": 1037, "commands": 3, "command_list": [ "cp .github/workflows/pr-audit.yml .github/workflows/pr-audit.yml.backup", "sed -i 's/else/elif [ \"${{ github.event_name }}\" = \"workflow_dispatch\" ]; then/' .github/workflows/pr-audit.yml", "sed -i '/if [ \"${{ github.event_name }}\" = \"pull_request\" ]; then/,+3d' .github/workflows/pr-audit.yml" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 3, "lesson_hit_rate": 0.375 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Push-triggered bot workflow races itself: `|| true` hides rebase conflict and leaves detached HEAD (ci-push-triggered-bot-races-generated-artifact)", "condition": "with_lesson", "status": 200, "content": "The issue arises because the `git pull --rebase` command in the workflow is allowed to fail silently due to `|| true`, which means that if the rebase fails, the command will simply continue to the next step without reporting the error.\n\nTo fix this issue, you can modify the `git pull --rebase` command to fail loudly when the rebase fails, and also to checkout the correct branch before pushing the commit. Here's an example of how you can do this:\n\n```yaml\nsteps:\n - name: Checkout code\n uses: actions/checkout@v2\n with:\n fetch-depth: 0\n\n - name: Pull and rebase\n run: |\n git pull --rebase origin main --no-commit\n git checkout main\n git push origin HEAD:main\n```\n\nIn this example, the `git pull --rebase` command is modified to fail loudly when the rebase fails, and the `git checkout` command is added to ensure that the correct branch is checked out before pushing the commit.\n\nAlternatively, you can also use the `git merge` command instead of `git pull --rebase`, and then use `git merge --abort` to undo the merge if it fails:\n\n", "metrics": { "length": 1067, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 9, "lesson_hits": 4, "lesson_hit_rate": 0.571 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "A manual CI run that sweeps the whole corpus always fails, so nobody trusts the red (ci-manual-dispatch-whole-corpus-false-red)", "condition": "plain", "status": 200, "content": "To fix the issue of a manual CI run that sweeps the whole corpus always failing, you can try the following steps:\n\n**Step 1: Identify the issue**\n\n* Run the CI manually again and check the logs for any errors or warnings.\n* Look for any clues in the error messages, such as \"AssertionError\", \"TypeError\", or \"AssertionError: False is not true\".\n\n**Step 2: Check the code**\n\n* Review your code to ensure that the assertions are correct and not causing any issues.\n* Check if there are any conditional statements that might be causing the assertion to fail.\n\n**Step 3: Run the CI with debug mode**\n\n* Run the CI with the `--debug` flag to enable debug mode.\n* This will provide more detailed logs and help you identify the issue.\n\n**Step 4: Use the `--skip-tests` flag**\n\n* Run the CI with the `--skip-tests` flag to skip the tests and see if the issue is related to the tests.\n* If the issue is resolved, then the issue is likely related to the tests.\n\n**Step 5: Check the corpus**\n\n* Check the corpus to ensure that it is not empty or corrupted.\n* If", "metrics": { "length": 1070, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 3, "lesson_hits": 1, "lesson_hit_rate": 0.125 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Push-triggered bot workflow races itself: `|| true` hides rebase conflict and leaves detached HEAD (ci-push-triggered-bot-races-generated-artifact)", "condition": "plain", "status": 200, "content": "The error message you're seeing is due to a Git issue where a push-triggered bot workflow is creating a new branch, rebasing it, and then pushing it, causing a rebase conflict. The `|| true` in your workflow is essentially ignoring any errors, which can lead to this issue.\n\nHere's a concrete, actionable fix with exact commands:\n\n**Step 1: Update your workflow file**\n\nOpen your workflow file (e.g., `.github/workflows/push-triggered-bot.yml`) and update the `on` event to use `push` instead of `push: branches/*`:\n\n```yaml\non:\n push:\n branches: [ main ]\n```\n\nThis will ensure that the workflow only triggers on pushes to the `main` branch.\n\n**Step 2: Use `rebase` instead of `push`**\n\nUpdate the `jobs` section to use `rebase` instead of `push`:\n\n```yaml\njobs:\n build-and-deploy:\n runs-on: ubuntu-latest\n steps:\n - name: Checkout code\n uses: actions/checkout@v2\n - name: Rebase and push\n uses: appleboy/ssh-action@v1\n with:\n host: github", "metrics": { "length": 990, "commands": 3, "command_list": [ "This will ensure that the workflow only triggers on pushes to the `main` branch.", "**Step 2: Use `rebase` instead of `push`**", "Update the `jobs` section to use `rebase` instead of `push`:" ], "has_command_block": true, "actionable": true, "inline_code_count": 13, "lesson_hits": 2, "lesson_hit_rate": 0.286 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Push-triggered bot workflow races itself: `|| true` hides rebase conflict and leaves detached HEAD (ci-push-triggered-bot-races-generated-artifact)", "condition": "with_lesson", "status": 200, "content": "To fix the issue, you need to handle the rebase conflict explicitly and ensure the workflow doesn't leave a detached HEAD. Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Update the workflow to handle rebase conflicts**\n\nReplace the existing step with the following code:\n\n```bash\n# Rebase with conflict resolution\ngit pull --rebase origin main\nif [ $? -ne 0 ]; then\n # Handle rebase conflict\n git status\n git add .\n git rebase --continue\n if [ $? -ne 0 ]; then\n # If rebase fails, fail the workflow\n exit 1\n fi\nfi\n```\n\n**Step 2: Ensure the workflow doesn't leave a detached HEAD**\n\nAdd the following code after the rebase step:\n\n```bash\n# Checkout to a branch to avoid detached HEAD\ngit checkout -b temp-branch\n# Now you can push the changes\ngit push\n```\n\n**Step 3: Clean up the temporary branch**\n\nAdd a final step to clean up the temporary branch:\n\n```bash\n# Clean up the temporary branch\ngit branch -d temp-branch\n```\n\nBy following these steps, you should be able to fix the", "metrics": { "length": 1008, "commands": 12, "command_list": [ "git pull --rebase origin main", "if [ $? -ne 0 ]; then", "git status", "git add .", "git rebase --continue" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 6, "lesson_hit_rate": 0.857 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A hook that swallows every error makes a misconfiguration look like \"nothing to do (claude-code-hook-silent-failure)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely due to the fact that you're using a silent hook in your `~/.config/fish/config.fish` file. To fix this, you can modify your hook to re-throw any errors that occur. Here's an example of how you can do this:\n\n```fish\n# Silent hook that swallows every error\nset -x my_silent_hook (function)\n # Your code here\n echo \"This code should not swallow errors\"\n\n # Re-throw any errors that occur\n if status -eq 1\n echo \"Error occurred\"\n return 1\n end\n\n # More code here\n echo \"This code should not swallow errors\"\n\n # Re-throw any errors that occur\n if status -eq 1\n echo \"Error occurred\"\n return 1\n end\n\n # More code here\n echo \"This code should not swallow errors\"\n\nset -e\n```\n\nHowever, if you want a more generic and reusable hook, you can use the following code:\n\n```fish\n# Generic silent hook that re-throws errors\nfunction -a my_silent_hook\n # Your code here\n if status -eq 1\n ", "metrics": { "length": 940, "commands": 1, "command_list": [ "However, if you want a more generic and reusable hook, you can use the following code:" ], "has_command_block": true, "actionable": true, "inline_code_count": 3, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A hook that swallows every error makes a misconfiguration look like \"nothing to do (claude-code-hook-silent-failure)", "condition": "with_lesson", "status": 200, "content": "To fix this issue, you can log the error in a way that the host can surface it, and also provide some feedback to the user. Here's a concrete, actionable fix with exact commands:\n\n```bash\n# Add the following lines to your UserPromptSubmit hook\nimport logging\nimport sys\n\n# Configure logging to surface errors\nlogging.basicConfig(level=logging.ERROR, format='%(asctime)s - %(levelname)s - %(message)s')\n\ntry:\n run_hook()\n return 0\nexcept Exception as e:\n # Log the error in a way that the host can surface it\n logging.error(f\"image-vision hook crashed: {e}\")\n # Provide some feedback to the user\n print(f\"An error occurred while processing your prompt. Please try again or contact support.\")\n print(json.dumps({\"error\": \"Internal Server Error\"}))\n return 1\n```\n\nIn this code:\n\n1. We configure logging to surface errors at the ERROR level.\n2. We log the error in a way that the host can surface it, including the timestamp, log level, and error message.\n3. We provide some feedback to the user, indicating that an error occurred and asking them to try again or contact support.\n4. We return a non", "metrics": { "length": 1118, "commands": 11, "command_list": [ "import logging", "import sys", "logging.basicConfig(level=logging.ERROR, format='%(asctime)s - %(levelname)s - %(message)s')", "try:", "run_hook()" ], "has_command_block": true, "actionable": true, "inline_code_count": 1, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Push-triggered bot workflow races itself: `|| true` hides rebase conflict and leaves detached HEAD (ci-push-triggered-bot-races-generated-artifact)", "condition": "plain", "status": 200, "content": "The error you're experiencing is due to a rebase conflict that occurs when a push-triggered bot workflow tries to push changes while the previous push is still being processed. This can be fixed by modifying the bot workflow to handle rebase conflicts.\n\nHere's a concrete, actionable fix:\n\n**Step 1: Update your bot workflow to use a separate branch for rebasing**\n\nInstead of rebasing directly on the main branch, create a separate branch for rebasing. This will prevent the rebase conflict and allow the bot workflow to push changes successfully.\n\n**Step 2: Update your bot workflow to use `--no-rebase` and `--no-ff` when pushing**\n\nWhen pushing changes, use `--no-rebase` and `--no-ff` to prevent rebasing and fast-forwarding. This will ensure that the bot workflow pushes changes without rebasing on the main branch.\n\n**Step 3: Update your bot workflow to checkout the detached HEAD and reset it**\n\nAfter pushing changes, checkout the detached HEAD and reset it to prevent leaving a detached HEAD.\n\nHere are the exact commands to update your bot workflow:\n\n```bash\n# Create a separate branch for rebasing\ngit config --global push.rebase true\ngit config --global push.rebase", "metrics": { "length": 1178, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 4, "lesson_hits": 3, "lesson_hit_rate": 0.429 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "A hook that swallows every error makes a misconfiguration look like \"nothing to do (claude-code-hook-silent-failure)", "condition": "with_lesson", "status": 200, "content": "To fix the issue, you need to modify the UserPromptSubmit hook to not swallow every error. Here's a concrete, actionable fix:\n\n**Step 1: Identify the problematic code**\n\nFind the code that's causing the issue, which is likely the `except Exception as e:` block in the UserPromptSubmit hook. This code is swallowing the error and printing an empty JSON object.\n\n**Step 2: Modify the code to log the error**\n\nInstead of swallowing the error, modify the code to log the error using a logging framework like Python's built-in `logging` module. This will ensure that the error is recorded somewhere that the user can see.\n\nHere's an example of how you can modify the code:\n```python\nimport logging\n\n# Create a logger\nlogger = logging.getLogger('image-vision-hook')\nlogger.setLevel(logging.ERROR)\n\n# Create a file handler to log errors to a file\nfile_handler = logging.FileHandler('image-vision-hook.log')\nfile_handler.setLevel(logging.ERROR)\n\n# Create a formatter to format the log messages\nformatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')\nfile_handler.setFormatter(formatter)\n\n# Add the file handler to the logger\nlogger.addHandler(file_handler)\n\ntry:\n ", "metrics": { "length": 1188, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 2, "lesson_hits": 1, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "A hook that swallows every error makes a misconfiguration look like \"nothing to do (claude-code-hook-silent-failure)", "condition": "plain", "status": 200, "content": "The error you're experiencing is likely due to a hook in your Git repository configuration that is set to swallow all errors. This can be problematic because it can mask actual issues and make it difficult to diagnose problems.\n\nTo fix this issue, you'll need to identify the hook that's causing the problem and modify it to log errors instead of swallowing them. However, if you're not comfortable modifying the hook or don't know which hook is causing the issue, you can try the following steps:\n\n1. **Check your Git hooks**:\n Run the following command in your terminal to list all the Git hooks in your repository:\n ```bash\ngit ls-files -z -- .git/hooks/\n```\n This will show you all the hooks in your repository. Look for any hooks that might be related to error handling or logging.\n\n2. **Identify the problematic hook**:\n Once you've identified a potential hook, you can try to disable it temporarily to see if it's the cause of the issue. To do this, rename the hook file to something like `.disabled`:\n ```bash\nmv .git/hooks/claude-code-hook-silent-failure .git/hooks/claude-code-hook-silent-failure.disabled\n```\n If this resolves", "metrics": { "length": 1149, "commands": 2, "command_list": [ "git ls-files -z -- .git/hooks/", "mv .git/hooks/claude-code-hook-silent-failure .git/hooks/claude-code-hook-silent-failure.disabled" ], "has_command_block": true, "actionable": true, "inline_code_count": 4, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "curl Timeout Behind Corporate Proxy: SSL Inspection Breaks Certificate Validation (corporate-proxy-curl-timeout)", "condition": "plain", "status": 200, "content": "The error you're encountering is due to the SSL inspection performed by your corporate proxy breaking the certificate validation in curl. Here's a concrete and actionable fix with exact commands:\n\n**Solution 1: Disable SSL Inspection on the Corporate Proxy**\n\nYou can disable SSL inspection on your corporate proxy server by configuring it to bypass certificate validation. This approach may require technical expertise and access to your corporate proxy server.\n\n**For Apache HTTP Server (assuming you're using it as your corporate proxy):**\n\n1. Locate the `httpd.conf` or `apache2.conf` file (depending on your Apache version).\n2. Add the following lines to the file:\n```bash\n\n Order deny,allow\n Deny from all\n Allow from 127.0.0.1\n\n\n\n Order deny,allow\n Deny from all\n Allow from 127.0.0.1\n\n```\n3. Save the changes to the file and restart the Apache server:\n```bash\nsudo service apache2 restart\n```\n**For Nginx (assuming you're using it as your corporate proxy):**\n\n1. Locate the `nginx.conf` file.\n2", "metrics": { "length": 1081, "commands": 11, "command_list": [ "", "Order deny,allow", "Deny from all", "Allow from 127.0.0.1", "" ], "has_command_block": true, "actionable": false, "inline_code_count": 6, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "curl Timeout Behind Corporate Proxy: SSL Inspection Breaks Certificate Validation (corporate-proxy-curl-timeout)", "condition": "with_lesson", "status": 200, "content": "To fix the issue, you can follow the recommended solution, which is to add the corporate CA to curl's trust store. Here's a step-by-step guide:\n\n**Option 2: Add corporate CA to curl's trust store**\n\n1. **Find the corporate CA**:\n - Ask your IT department for the corporate CA certificate.\n - Check your browser's certificate store (e.g., in Google Chrome, go to `chrome://settings/advanced/show%20advanced%20settings/Manage%20certificates/Authorities`).\n\n2. **Copy the corporate CA certificate to the curl trust store**:\n - `cp /path/to/corporate-ca.crt /etc/ssl/certs/`\n - Replace `/path/to/corporate-ca.crt` with the actual path to the corporate CA certificate.\n\n3. **Verify the fix**:\n - Run the following command to test the API:\n ```bash\n curl -sS -o /dev/null -w '%{http_code}' https://api.example.com\n ```\n - This should return a 200 status code if the fix is successful.\n\nAlternatively, you can also set the corporate CA certificate as a per-request option using the `--cacert` flag:\n\n```bash", "metrics": { "length": 1024, "commands": 1, "command_list": [ "curl -sS -o /dev/null -w '%{http_code}' https://api.example.com" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 3, "lesson_hit_rate": 0.429 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "curl Timeout Behind Corporate Proxy: SSL Inspection Breaks Certificate Validation (corporate-proxy-curl-timeout)", "condition": "with_lesson", "status": 200, "content": "To fix the \"curl Timeout Behind Corporate Proxy: SSL Inspection Breaks Certificate Validation\" error, you can follow the recommended solution: Add corporate CA to curl's trust store.\n\nHere are the exact steps:\n\n**Step 1: Find the corporate CA**\n\n* Ask your IT department for the corporate CA certificate.\n* Alternatively, you can check the browser's certificate store (e.g., Google Chrome's settings > Advanced > System > Certificate Manager) to find the corporate CA certificate.\n\n**Step 2: Copy the corporate CA certificate to the system**\n\n* Copy the corporate CA certificate to the `/etc/ssl/certs/` directory.\n\n```bash\ncp /path/to/corporate-ca.crt /etc/ssl/certs/\n```\n\n**Step 3: Update the curl configuration**\n\n* To set the corporate CA certificate permanently, add the following lines to your shell configuration file (e.g., `~/.bashrc` or `~/.zshrc`):\n\n ```bash\nexport CURL_CA_BUNDLE=/etc/ssl/certs/corporate-ca.crt\n```\n\n Alternatively, you can set the `CURL_CA_BUNDLE` environment variable for a single curl command:\n\n ```bash\ncurl --cacert /etc/", "metrics": { "length": 1072, "commands": 2, "command_list": [ "cp /path/to/corporate-ca.crt /etc/ssl/certs/", "export CURL_CA_BUNDLE=/etc/ssl/certs/corporate-ca.crt" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 5, "lesson_hit_rate": 0.714 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Docker Compose Basics: Multi-Container Networking and Service Healthcheck Orchestration (docker-compose-basics)", "condition": "with_lesson", "status": 200, "content": "Here's a concrete, actionable fix to address the issues mentioned in the problem:\n\n**Step 1: Define Custom Network with DNS Resolution**\n\nCreate a new network with DNS resolution enabled:\n\n```bash\ndocker network create --driver bridge dns --subnet 10.0.0.0/16 my-network\n```\n\n**Step 2: Update Docker Compose File**\n\nUpdate the `docker-compose.yml` file to use the custom network:\n\n```yml\nversion: '3'\nservices:\n web:\n build: .\n ports:\n - \"80:80\"\n networks:\n - my-network\n depends_on:\n - db\n - cache\n\n db:\n image: postgres\n environment:\n POSTGRES_USER: myuser\n POSTGRES_PASSWORD: mypass\n networks:\n - my-network\n\n cache:\n image: redis\n networks:\n - my-network\n\nnetworks:\n my-network:\n driver: bridge\n ipam:\n config:\n - subnet: 10.0.0.0/16\n```\n\n**Step 3: Update Service Healthcheck**\n\nUpdate the service healthcheck to ensure the database is ready:\n\n```yml\nversion: '3'\nservices", "metrics": { "length": 965, "commands": 3, "command_list": [ "docker network create --driver bridge dns --subnet 10.0.0.0/16 my-network", "**Step 3: Update Service Healthcheck**", "Update the service healthcheck to ensure the database is ready:" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 4, "lesson_hit_rate": 0.8 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "curl Timeout Behind Corporate Proxy: SSL Inspection Breaks Certificate Validation (corporate-proxy-curl-timeout)", "condition": "plain", "status": 200, "content": "The \"corporate-proxy-curl-timeout\" error is caused by SSL Inspection, which breaks certificate validation. Here's a concrete, actionable fix:\n\n**Method 1: Disable SSL Verification**\n\nYou can disable SSL verification using the `-k` or `--insecure` flag in the `curl` command. However, this is not recommended for production environments as it compromises security.\n\n```bash\ncurl -k https://example.com\n```\n\n**Method 2: Use a Certificate Bundle**\n\nYou can download the certificate bundle from your corporate proxy's SSL inspection server and use it to verify the certificate. This method requires the certificate bundle file.\n\n```bash\ncurl -o /path/to/cacert.pem https://example.com/cacert.pem\n\ncurl --cacert /path/to/cacert.pem https://example.com\n```\n\n**Method 3: Use a Custom CA Certificate**\n\nYou can download the custom CA certificate from your corporate proxy's SSL inspection server and use it to verify the certificate.\n\n```bash\ncurl -o /path/to/custom_ca.pem https://example.com/custom_ca.pem\n\ncurl --cacert /path/to/custom_ca.pem https://example.com\n```\n\n**Method 4: Configure curl to Trust the Corporate Proxy's CA Certificate", "metrics": { "length": 1135, "commands": 5, "command_list": [ "curl -k https://example.com", "curl -o /path/to/cacert.pem https://example.com/cacert.pem", "curl --cacert /path/to/cacert.pem https://example.com", "curl -o /path/to/custom_ca.pem https://example.com/custom_ca.pem", "curl --cacert /path/to/custom_ca.pem https://example.com" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Docker Compose Basics: Multi-Container Networking and Service Healthcheck Orchestration (docker-compose-basics)", "condition": "with_lesson", "status": 200, "content": "To fix the issues with multi-container networking and service health checks, you can follow these steps:\n\n**Step 1: Create a Declarative Multi-Service Specification (docker-compose.yml)**\n\nCreate a new file named `docker-compose.yml` in the root directory of your project with the following content:\n```yaml\nversion: '3'\n\nservices:\n web:\n build: ./web\n ports:\n - \"8000:8000\"\n depends_on:\n - db\n environment:\n - DATABASE_HOST=db\n\n worker:\n build: ./worker\n depends_on:\n - db\n environment:\n - DATABASE_HOST=db\n\n db:\n image: postgres\n environment:\n - POSTGRES_USER=myuser\n - POSTGRES_PASSWORD=mypassword\n - POSTGRES_DB=mydb\n volumes:\n - ./db-data:/var/lib/postgresql/data\n\n cache:\n image: redis\n ports:\n - \"6379:6379\"\n```\nThis file defines a multi-service topology with a web service, a worker service, a PostgreSQL database, and a Redis cache.\n\n**Step 2: Define Custom User-Defined Bridge Network**\n\nCreate a new file named `docker-compose-network.yml", "metrics": { "length": 1039, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 3, "lesson_hits": 4, "lesson_hit_rate": 0.8 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Docker Compose Basics: Multi-Container Networking and Service Healthcheck Orchestration (docker-compose-basics)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely due to Docker Compose not being able to resolve the service names in your `docker-compose.yml` file. This can happen if the services are not defined correctly or if there are any typos in the service names.\n\nHere's a concrete, actionable fix with exact commands to resolve this issue:\n\n**Step 1: Check your `docker-compose.yml` file**\n\nOpen your `docker-compose.yml` file in a text editor and verify that the service names are correctly defined. Make sure there are no typos or extra spaces in the service names.\n\n**Step 2: Run `docker-compose up --build`**\n\nRun the following command to rebuild and start your containers:\n```bash\ndocker-compose up --build\n```\nThis command will rebuild your containers if they have changed and start them if they haven't.\n\n**Step 3: Run `docker-compose config`**\n\nIf the issue persists, run the following command to check the configuration of your `docker-compose.yml` file:\n```bash\ndocker-compose config\n```\nThis command will check the configuration of your `docker-compose.yml` file and report any errors or warnings.\n\n**Step 4: Check for network issues**\n\nIf you're using a network with multiple services, try", "metrics": { "length": 1186, "commands": 2, "command_list": [ "docker-compose up --build", "docker-compose config" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 4, "lesson_hit_rate": 0.8 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Docker Compose Basics: Multi-Container Networking and Service Healthcheck Orchestration (docker-compose-basics)", "condition": "plain", "status": 200, "content": "Without knowing the exact error message, I'll provide a general solution to common issues in Docker Compose.\n\n**Step 1: Check the Docker Compose File**\n\nMake sure your `docker-compose.yml` file is correctly formatted and has the necessary services defined.\n\n**Step 2: Run `docker-compose up` with Debugging**\n\nTry running `docker-compose up` with the `-d` flag to run in detached mode, and the `--build` flag to rebuild the images, and the `--no-deps` flag to prevent dependent services from being started. The `-v` flag will increase the verbosity of the output.\n\n```bash\ndocker-compose up -d --build --no-deps -v\n```\n\n**Step 3: Check the Logs**\n\nRun the following command to check the logs of the containers:\n\n```bash\ndocker-compose logs\n```\n\n**Step 4: Check the Service Status**\n\nRun the following command to check the status of the services:\n\n```bash\ndocker-compose ps\n```\n\n**Step 5: Check the Docker Images and Containers**\n\nRun the following commands to check the images and containers:\n\n```bash\ndocker images\ndocker ps\n```\n\n**Common Fixes**\n\n1. **Incorrect Port Mapping**: Make sure the", "metrics": { "length": 1093, "commands": 5, "command_list": [ "docker-compose up -d --build --no-deps -v", "docker-compose logs", "docker-compose ps", "docker images", "docker ps" ], "has_command_block": true, "actionable": true, "inline_code_count": 14, "lesson_hits": 4, "lesson_hit_rate": 0.8 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Uncommitted work has no undo: `git checkout -- .` and reset --hard during branch juggling (git-checkout-discards-uncommitted-work)", "condition": "with_lesson", "status": 200, "content": "To fix the issue of uncommitted work having no undo when using `git checkout -- .` and `reset --hard` during branch juggling, you can use the following steps:\n\n1. **Revert the changes in the working tree**: Before resetting the branch, you can use `git checkout -- -- .` to revert the changes in the working tree to the previous branch's version.\n\n ```bash\ngit checkout -- pr1656 -- .\n```\n\n2. **Stage the changes in the index**: Then, stage the changes in the index using `git add .` to ensure that the changes are not lost.\n\n ```bash\ngit add .\n```\n\n3. **Reset the branch**: Now, you can safely reset the branch using `git reset --hard `.\n\n ```bash\ngit reset --hard pr1656\n```\n\n4. **Commit the changes**: Finally, commit the changes using `git commit -m \"Revert changes after PR inspection\"`.\n\n ```bash\ngit commit -m \"Revert changes after PR inspection\"\n```\n\nHere's the complete sequence of commands:\n\n```bash\ngit checkout -- pr1656 -- .\ngit add .\ngit reset --hard pr1656\ngit commit -m", "metrics": { "length": 1014, "commands": 4, "command_list": [ "git checkout -- pr1656 -- .", "git add .", "git reset --hard pr1656", "git commit -m \"Revert changes after PR inspection\"" ], "has_command_block": true, "actionable": true, "inline_code_count": 14, "lesson_hits": 3, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Uncommitted work has no undo: `git checkout -- .` and reset --hard during branch juggling (git-checkout-discards-uncommitted-work)", "condition": "plain", "status": 200, "content": "The error message \"Uncommitted work has no undo\" indicates that there are changes in your working directory that are not tracked by Git. This is because you're trying to discard those changes with `git checkout -- .` and `reset --hard`, but Git doesn't know how to undo them.\n\nHere's a step-by-step fix with exact commands:\n\n1. **Stage the changes**: Before discarding the changes, make sure to stage them so that Git knows what changes you're trying to discard.\n\n ```bash\ngit add .\n```\n\n2. **Commit the changes**: If you want to keep the changes, commit them with a meaningful commit message.\n\n ```bash\ngit commit -m \"Changes made during branch juggling\"\n```\n\n3. **Discard the changes**: Now you can safely discard the changes with `git checkout -- .` and `reset --hard`.\n\n ```bash\ngit checkout -- .\ngit reset --hard\n```\n\nAlternatively, if you don't want to commit the changes, you can use `git checkout -- .` alone:\n\n```bash\ngit checkout -- .\n```\n\nHowever, keep in mind that this will only discard the changes in your working directory and not in your staging area or commit history.\n\n4. **Verify", "metrics": { "length": 1104, "commands": 5, "command_list": [ "git add .", "git commit -m \"Changes made during branch juggling\"", "git checkout -- .", "git reset --hard", "git checkout -- ." ], "has_command_block": true, "actionable": true, "inline_code_count": 12, "lesson_hits": 2, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "GITHUB_TOKEN cannot push changes to .github/workflows/** — your bot job will fail at push time (github-token-cannot-push-workflow-files)", "condition": "with_lesson", "status": 200, "content": "To fix the error, you'll need to use a token that has the `workflows` permission. Here's a step-by-step solution:\n\n**Step 1: Create a new GitHub App**\n\n1. Log in to your GitHub account and navigate to the [GitHub Apps page](https://github.com/settings/applications).\n2. Click on \"New GitHub App\".\n3. Fill in the required information, such as the app name, description, and URL.\n4. Click on \"Create App\".\n5. You'll receive a client ID and client secret. You'll need these later.\n\n**Step 2: Create a new Personal Access Token with workflows permission**\n\n1. Log in to your GitHub account and navigate to the [Personal Access Tokens page](https://github.com/settings/tokens).\n2. Click on \"New token\".\n3. Fill in the required information, such as the token name and expiration time.\n4. In the \"Scopes\" section, select \"repo\", \"workflow\", and \"workflows\".\n5. Click on \"Generate token\".\n\n**Step 3: Use the new token to push changes to .github/workflows**\n\n1. Replace the `GITHUB_TOKEN` variable in your workflow file with the new token.\n2. Use the", "metrics": { "length": 1041, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 2, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Clearing a Go linter backlog to zero: revive doc comments, De Morgan predicates, cascading unused deletions (go-linter-cleanup-go-fix)", "condition": "with_lesson", "status": 200, "content": "To fix the issue of clearing a Go linter backlog to zero, you'll need to address the orphaned comments, boolean predicates with outer negation, and unreferenced utility methods. Here's a step-by-step guide with exact commands:\n\n**Step 1: Find and fix orphaned comments**\n\n* Run the following command to find all exported types with orphaned comments:\n```bash\ngolangci-lint run --tags=revive --exit-unerr --exit-fail --tags=staticcheck --exit-unerr --exit-fail --tags=unused --go-check=gocheck --go-check=gocheck-order --go-check=gocheck-flags --go-check=gocheck-flags --tags=de-morgan --exit-unerr --exit-fail --tags=quickfix --exit-unerr --exit-fail --tags=unused --exit-unerr --exit-fail --go-check=gocheck --go-check=gocheck-order --go-check=gocheck-flags --go-check=gocheck-flags --tags=unused --exit-unerr --exit-fail --tags=quickfix --exit-unerr --exit-fail --tags=quickfix --exit-unerr --exit-fail --go-check=gocheck", "metrics": { "length": 923, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 4, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Clearing a Go linter backlog to zero: revive doc comments, De Morgan predicates, cascading unused deletions (go-linter-cleanup-go-fix)", "condition": "plain", "status": 200, "content": "The error you're encountering is related to Go linter issues. Here's a step-by-step solution to fix the error:\n\n**Step 1: Install the required tools**\n\nYou need to install `golang-migrate` and `golang-migrate/v3` to migrate your Go code to the latest linter rules.\n\n```bash\ngo get github.com/golang-migrate/migrate\ngo get github.com/golang-migrate/v3/cmd/migrate\n```\n\n**Step 2: Run the linter with the recommended flags**\n\nRun the following command to clear the linter backlog:\n\n```bash\ngolang-migrate v3 -path ./... -database sqlite3://./migrations.db -dry-run\n```\n\nThis command will clear the linter backlog by running the `golang-migrate` command with the recommended flags.\n\n**Step 3: Fix the linter issues**\n\nIf the `golang-migrate` command doesn't fix the issues, you can try fixing the linter issues manually. Here are some common issues and their fixes:\n\n- Revive doc comments: Use the `//go:doc` directive to add doc comments to your functions.\n\n```go\n//go:doc Summary of the function\nfunc myFunction()", "metrics": { "length": 1011, "commands": 3, "command_list": [ "go get github.com/golang-migrate/migrate", "go get github.com/golang-migrate/v3/cmd/migrate", "golang-migrate v3 -path ./... -database sqlite3://./migrations.db -dry-run" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 1, "lesson_hit_rate": 0.125 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "GITHUB_TOKEN cannot push changes to .github/workflows/** — your bot job will fail at push time (github-token-cannot-push-workflow-files)", "condition": "plain", "status": 200, "content": "This error occurs when your GitHub token doesn't have the necessary permissions to push changes to workflow files. To fix this, you can add the `repository` scope to your GitHub token. Here are the steps:\n\n**Step 1: Create a new token with the repository scope**\n\nOpen your GitHub settings and navigate to **Settings > Developer settings > Personal access tokens**. Click on **Generate new token**.\n\nIn the **Token name** field, enter a name for your token (e.g., `github-token-workflows`). In the **Select scopes** dropdown, select **repo** and **workflow**. Click on **Generate token**.\n\n**Step 2: Update your workflow file**\n\nOpen your workflow file (`.yml` or `.yaml`) and add the `github-token` scope to the `token` field in the `actions/checkout` step. Here's an example:\n\n```yml\nname: My Workflow\n\non:\n push:\n branches:\n - main\n\njobs:\n build:\n runs-on: ubuntu-latest\n steps:\n - name: Checkout code\n uses: actions/checkout@v2\n with:\n token: ${{ secrets.GITHUB_TOKEN }}\n token: ${{ secrets.GITHUB", "metrics": { "length": 1054, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 7, "lesson_hits": 2, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Go strings.Contains Case Sensitivity Pitfalls and Zero-Allocation Matching (go-strings-contains-case-sensitivity-pitfalls)", "condition": "with_lesson", "status": 200, "content": "**Fixing Case Sensitivity Issues in `strings.Contains`**\n\nTo fix the case sensitivity issues in `strings.Contains`, you can use the `strings.ToLower` function to normalize both the `haystack` and `needle` strings to lowercase. This approach avoids creating two heap allocations and ensures that the comparison is case-insensitive.\n\n**Example Code**\n\n```go\npackage main\n\nimport (\n \"fmt\"\n \"strings\"\n)\n\nfunc main() {\n haystack := \"Hello, World!\"\n needle := \"world\"\n\n // Original implementation with potential case sensitivity issues\n result := strings.Contains(haystack, needle)\n fmt.Println(result) // Output: false\n\n // Fixed implementation with case-insensitive comparison\n result = strings.Contains(strings.ToLower(haystack), strings.ToLower(needle))\n fmt.Println(result) // Output: true\n}\n```\n\n**Alternative Solution: Use `strings.Index`**\n\nAlternatively, you can use the `strings.Index` function to find the index of the `needle` in the `haystack`. This approach is more efficient than using `strings.Contains` and avoids the need for case normalization.\n\n```go\npackage main\n\nimport (\n \"fmt\"\n \"strings\"\n)\n\nfunc main() {\n haystack := \"Hello", "metrics": { "length": 1181, "commands": 2, "command_list": [ "**Alternative Solution: Use `strings.Index`**", "Alternatively, you can use the `strings.Index` function to find the index of the `needle` in the `haystack`. This approach is more efficient than using `strings.Contains` and avoids the need for case normalization." ], "has_command_block": true, "actionable": true, "inline_code_count": 12, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Go strings.Contains Case Sensitivity Pitfalls and Zero-Allocation Matching (go-strings-contains-case-sensitivity-pitfalls)", "condition": "plain", "status": 200, "content": "The error you're encountering is due to the fact that the `strings.Contains` function in Go is case-sensitive by default. This means that it treats uppercase and lowercase letters as distinct characters.\n\nTo fix this issue, you can use the `strings.ContainsFunc` function instead, which allows you to provide a custom function to determine whether a substring matches a string. Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Define a custom function to compare strings in a case-insensitive manner**\n\nCreate a new file called `strings_utils.go` with the following code:\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n)\n\n// containsCaseInsensitive checks if a given string contains another string in a case-insensitive manner.\nfunc containsCaseInsensitive(s, substr string) bool {\n\treturn strings.Contains(strings.ToLower(s), strings.ToLower(substr))\n}\n```\n**Step 2: Use the custom function to fix the error**\n\nReplace the `strings.Contains` function calls in your code with the `containsCaseInsensitive` function:\n```go\npackage main\n\nimport (\n\t\"fmt\"\n)\n\nfunc main() {\n\ts := \"Hello, World!\"\n\tsubstr := \"world\"\n\tif containsCaseInsensitive(s, substr) {\n\t\tfmt.Println(\"The string contains the", "metrics": { "length": 1206, "commands": 2, "command_list": [ "**Step 2: Use the custom function to fix the error**", "Replace the `strings.Contains` function calls in your code with the `containsCaseInsensitive` function:" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "IAP TCP Forwarding: Numpy Upload Bandwidth Optimization and Buffer Tuning (iap-tcp-forwarding-numpy-bandwidth)", "condition": "with_lesson", "status": 200, "content": "To fix the IAP TCP Forwarding issue with Numpy Upload Bandwidth Optimization and Buffer Tuning, you'll need to adjust the operating system kernel TCP buffers and socket options. Here's a step-by-step guide with exact commands:\n\n**Step 1: Increase OS Kernel TCP Buffers**\n\n1. Open the terminal on your Compute Engine instance and run the following command to increase the TCP buffer size:\n\n```bash\nsudo sysctl -w net.core.sndbuf=1048576\nsudo sysctl -w net.core.wmem_default=1048576\nsudo sysctl -w net.core.rmem_default=1048576\n```\n\nThese commands set the send and receive buffer sizes to 1MB each.\n\n**Step 2: Enable TCP Congestion Control**\n\n1. Run the following command to enable TCP congestion control:\n\n```bash\nsudo sysctl -w net.ipv4.tcp_fastopen=3\n```\n\nThis enables the TCP Fast Open feature, which allows for faster connections.\n\n**Step 3: Disable Nagle's Algorithm**\n\n1. Run the following command to disable Nagle's algorithm, which can introduce latency:\n\n```bash\nsudo sysctl -w net.ipv4.tcp_nagle=0\n```\n\n**Step 4: Configure", "metrics": { "length": 1031, "commands": 5, "command_list": [ "sudo sysctl -w net.core.sndbuf=1048576", "sudo sysctl -w net.core.wmem_default=1048576", "sudo sysctl -w net.core.rmem_default=1048576", "sudo sysctl -w net.ipv4.tcp_fastopen=3", "sudo sysctl -w net.ipv4.tcp_nagle=0" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A JSON Schema `\"key\": true` says \"any value allowed\" — not \"set it to true (json-schema-boolean-subschema-means-any-value)", "condition": "with_lesson", "status": 200, "content": "To fix this issue, we need to correct the JSON Schema and the automation configuration. Here's a step-by-step guide:\n\n**Correcting the JSON Schema:**\n\n1. Open the JSON Schema file in a text editor.\n2. Replace the line `\"key\": true` with `\"key\": {}` (or `\"key\": null` if it's a required field). This will indicate that the `key` field is optional and can contain any value.\n\nExample:\n```json\n{\n \"key\": {}\n}\n```\n\n**Correcting the Automation Configuration:**\n\n1. Open the automation configuration file in a text editor.\n2. Locate the line that contains the incorrect `key` value (e.g., `key: true`).\n3. Replace the line with the corrected value (e.g., `key: {}`).\n\nExample:\n```json\n{\n \"key\": {}\n}\n```\n\n**Commit Message:**\n\nIf you're committing these changes to a Git repository, use a descriptive commit message that explains the changes you made. For example:\n\n```\nFix JSON Schema and automation configuration for `key` field\nCorrectly interpreted JSON Schema boolean subschema and updated automation configuration\n```\n\n**Verify the Changes:**\n\n1. Run the automation tool again to", "metrics": { "length": 1080, "commands": 7, "command_list": [ "**Correcting the Automation Configuration:**", "1. Open the automation configuration file in a text editor.", "2. Locate the line that contains the incorrect `key` value (e.g., `key: true`).", "3. Replace the line with the corrected value (e.g., `key: {}`).", "Example:" ], "has_command_block": true, "actionable": true, "inline_code_count": 13, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A JSON Schema `\"key\": true` says \"any value allowed\" — not \"set it to true (json-schema-boolean-subschema-means-any-value)", "condition": "plain", "status": 200, "content": "The issue you're encountering is due to the fact that JSON Schema version 6 and later versions use the `x-anyOf` keyword to define any of the values as \"any value allowed.\" However, if you're using an older version of JSON Schema, you'll need to use the `anyOf` keyword instead.\n\nHere's how you can fix the issue:\n\n**Using JSON Schema version 6 and later:**\n\n```json\n{\n \"$schema\": \"http://json-schema.org/draft-06/schema#\",\n \"type\": \"object\",\n \"properties\": {\n \"key\": {\n \"x-anyOf\": [true]\n }\n }\n}\n```\n\nHowever, this will not work as expected. The `x-anyOf` keyword should be used with an array of values, not a single value. Here's the correct way to use it:\n\n```json\n{\n \"$schema\": \"http://json-schema.org/draft-06/schema#\",\n \"type\": \"object\",\n \"properties\": {\n \"key\": {\n \"x-anyOf\": [true, true]\n }\n }\n}\n```\n\n**Using JSON Schema version 5 and earlier:**\n\n```json\n{\n \"$schema\": \"http://", "metrics": { "length": 916, "commands": 2, "command_list": [ "However, this will not work as expected. The `x-anyOf` keyword should be used with an array of values, not a single value. Here's the correct way to use it:", "**Using JSON Schema version 5 and earlier:**" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "IAP TCP Forwarding: Numpy Upload Bandwidth Optimization and Buffer Tuning (iap-tcp-forwarding-numpy-bandwidth)", "condition": "plain", "status": 200, "content": "The error you're encountering is related to the IAP TCP Forwarding service, specifically with the Numpy Upload Bandwidth Optimization and Buffer Tuning feature. This feature is designed to optimize the upload bandwidth for NumPy arrays, but it seems like it's not working as expected.\n\nTo troubleshoot and potentially fix this issue, you can try the following steps:\n\n1. **Check if the feature is enabled**: Make sure that the IAP TCP Forwarding service is enabled and that the Numpy Upload Bandwidth Optimization and Buffer Tuning feature is enabled.\n\n```bash\ngcloud compute firewall-rules describe --format='get enabled'\n```\n\nReplace `` with the actual name of your firewall rule.\n\n2. **Check the network tags**: Ensure that the network tags are correctly configured to enable the feature.\n\n```bash\ngcloud compute network-tags describe --format='get tags'\n```\n\nReplace `` with the actual name of your network tag.\n\n3. **Check the firewall rules**: Verify that the firewall rules are correctly configured to allow incoming traffic on the specified port (usually 9000).\n\n```bash\ngcloud compute firewall-rules describe --", "metrics": { "length": 1219, "commands": 2, "command_list": [ "gcloud compute firewall-rules describe --format='get enabled'", "gcloud compute network-tags describe --format='get tags'" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Centralized SDK Client Architecture for High-Concurrency Multi-Agent Runtimes (llm-sdk-client-centralization-architecture)", "condition": "with_lesson", "status": 200, "content": "Here's a concrete, actionable fix to address the issues mentioned in the problem statement. We will implement a centralized client SDK client architecture for high-concurrency multi-agent runtimes using Python.\n\n**Step 1: Install Required Libraries**\n\nWe will use `httpx` and `urllib3` to create a centralized client SDK. Install the required libraries using pip:\n\n```bash\npip install httpx urllib3\n```\n\n**Step 2: Implement the Centralized Client SDK**\n\nCreate a new Python file (e.g., `centralized_client_sdk.py`) and implement the centralized client SDK:\n\n```python\nimport httpx\nimport urllib3\nimport logging\n\n# Create a singleton instance of the centralized client SDK\nclass CentralizedClientSDK:\n _instance = None\n _http_client = None\n\n @staticmethod\n def get_instance():\n if CentralizedClientSDK._instance is None:\n CentralizedClientSDK._instance = CentralizedClientSDK()\n return CentralizedClientSDK._instance\n\n def __init__(self):\n self._http_client = httpx.Client()\n self._urllib3_pool = urllib3.PoolManager()\n\n def openai(self):\n # Replace with your actual OpenAI API endpoint\n return self", "metrics": { "length": 1169, "commands": 1, "command_list": [ "pip install httpx urllib3" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Centralized SDK Client Architecture for High-Concurrency Multi-Agent Runtimes (llm-sdk-client-centralization-architecture)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely due to the `llm-sdk-client-centralization-architecture` not being installed or not being properly configured.\n\nHere are the steps to fix this error:\n\n**Step 1: Install the required dependencies**\n\nRun the following command in your terminal:\n```bash\npip install -r requirements.txt\n```\nThis will install the required dependencies for the `llm-sdk-client-centralization-architecture`.\n\n**Step 2: Create a new virtual environment**\n\nCreate a new virtual environment using the following command:\n```bash\npython -m venv myenv\n```\nReplace `myenv` with the name of your virtual environment.\n\n**Step 3: Activate the virtual environment**\n\nActivate the virtual environment using the following command:\n```bash\n# For Windows\nmyenv\\Scripts\\activate\n\n# For macOS/Linux\nsource myenv/bin/activate\n```\n**Step 4: Install the `llm-sdk-client-centralization-architecture`**\n\nInstall the `llm-sdk-client-centralization-architecture` using pip:\n```bash\npip install llm-sdk-client-centralization-architecture\n```\n**Step 5: Verify the installation**\n\nVerify that the installation was successful by running the following command:\n```bash\npython -c", "metrics": { "length": 1164, "commands": 5, "command_list": [ "pip install -r requirements.txt", "python -m venv myenv", "myenv\\Scripts\\activate", "source myenv/bin/activate", "pip install llm-sdk-client-centralization-architecture" ], "has_command_block": true, "actionable": true, "inline_code_count": 13, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Streaming Thought Tags Stripping: State-Machine Buffer for Reasoning Models (llm-streaming-thought-tags-stripping)", "condition": "with_lesson", "status": 200, "content": "To fix the Streaming Thought Tags Stripping issue, you can use the following approach:\n\n1. **Buffer the incoming chunks**: Store each chunk in a buffer until you've processed all the tags in that chunk. This will prevent the tag boundaries from fragmenting across network read buffers.\n\n2. **Process the buffer in chunks**: Divide the buffer into smaller chunks and process each chunk separately. This will ensure that you process the tags in the correct order.\n\nHere's a concrete, actionable fix using Python:\n\n```bash\n# Create a buffer to store the incoming chunks\nbuffer = []\n\n# Process the buffer in chunks\nwhile True:\n # Read a chunk from the incoming stream\n chunk = incoming_stream.read(1024)\n\n # If the chunk is empty, break out of the loop\n if not chunk:\n break\n\n # Add the chunk to the buffer\n buffer.append(chunk)\n\n # Process the buffer in chunks\n while len(buffer) > 0:\n # Get the next chunk from the buffer\n chunk = buffer.pop(0)\n\n # Process the chunk\n processed_chunk = process_chunk(chunk)\n\n # Add the processed chunk back to the buffer\n buffer.append(processed_chunk)\n\n# Process the remaining buffer", "metrics": { "length": 1190, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Streaming Thought Tags Stripping: State-Machine Buffer for Reasoning Models (llm-streaming-thought-tags-stripping)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely due to an issue with the Hugging Face library, which is commonly used for natural language processing tasks. Here's a step-by-step solution to resolve the issue:\n\n**Step 1: Update the Hugging Face library**\n\nRun the following command to update the library to the latest version:\n```bash\npip install --upgrade transformers\n```\n**Step 2: Update the model and tokenizer**\n\nTry updating the model and tokenizer to the latest versions:\n```bash\npip install --upgrade transformers[all]\n```\n**Step 3: Check for compatibility issues**\n\nIf the above steps don't resolve the issue, try updating the specific model and tokenizer you're using. You can do this by running:\n```bash\npip install --upgrade transformers[llm]\n```\nReplace \"llm\" with the specific model you're using (e.g., \"t5\", \"bert\", etc.).\n\n**Step 4: Check for dependencies**\n\nVerify that the required dependencies are installed:\n```bash\npip install --upgrade torch torchvision\n```\n**Step 5: Try a different version of the library**\n\nIf none of the above steps work, try downgrading the library to a previous version:\n```bash\npip install transformers==4", "metrics": { "length": 1143, "commands": 4, "command_list": [ "pip install --upgrade transformers", "pip install --upgrade transformers[all]", "pip install --upgrade transformers[llm]", "pip install --upgrade torch torchvision" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "On OpenClaw 8.2.x, manually editing `session_nodes.entry_json` (e.g. to clear\n`mainRestartRecovery` fields) leaves `entry_valid=0` permanently, even after\nrestarting the gateway. Every subsequent `openclaw agent --agent main` call\nreturns:\n\n```\nSessionCanonicalKeyMigrationRequiredError: invalid persisted session row\nrequires repair for agent:main:main; stop the Gateway and run\nopenclaw doctor --fix: code=SESSION_CANONICAL_KEY_MIGRATION_REQUIRED\n```\n\nFeishu DM inbound messages hit the same error during `feishu[default]:\ndispatching to agent`, so the bot stops replying. The reported symptom is\n\"channel connected, works, but no reply arrives.\"\n\nManual `UPDATE session_nodes SET entry_valid=1` does NOT stick — three\n`AFTER INSERT/UPDATE` triggers on the table re-set it back to 0:\n\n- `session_nodes_entry_valid_after_insert`\n- `session_nodes_entry_valid_after_entry_update`\n- `session_nodes_entry_valid_after_identity_update`\n\nThe triggers fire because `entry_valid=1` is only ever set as a side effect\nof OpenClaw's own internal re-validation pass, which the gateway runs once\nat startup and which checks two invariant conditions on the row. (openclaw-session-row-entry-updatedat-mismatch)", "condition": "with_lesson", "status": 200, "content": "To fix this issue, you need to modify the `scanCanonicalSqliteSessionEntries` function in `session-accessor.sqlite-transcript-state-.js` to ignore the `entry_valid` field when checking for `SessionCanonicalKeyMigrationRequiredError`.\n\nHere's a concrete, actionable fix:\n\n1. Open `session-accessor.sqlite-transcript-state-.js` in your preferred text editor.\n2. Find the `scanCanonicalSqliteSessionEntries` function and modify it as follows:\n\n```javascript\nfunction scanCanonicalSqliteSessionEntries(entries) {\n // ... existing code ...\n\n for (const entry of entries) {\n // Ignore the entry_valid field when checking for SessionCanonicalKeyMigrationRequiredError\n if (entry.entry_valid !== 1) {\n continue;\n }\n\n if (!parseSqliteSessionEntryRecord(entry)) {\n throw new SessionCanonicalKeyMigrationRequiredError(`Invalid persisted session row requires repair for agent:${entry.agent}:${entry.agent}; stop the Gateway and run openclaw doctor --fix: code=SESSION_CANONICAL_KEY_MIGRATION_REQUIRED`);\n }\n }\n\n // ... existing code ...\n}\n```\n\n3. Save the changes to `session-accessor.sqlite-transcript-state-.js`.\n4. Restart the OpenClaw", "metrics": { "length": 1195, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 9, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "On OpenClaw 8.2.x, manually editing `session_nodes.entry_json` (e.g. to clear\n`mainRestartRecovery` fields) leaves `entry_valid=0` permanently, even after\nrestarting the gateway. Every subsequent `openclaw agent --agent main` call\nreturns:\n\n```\nSessionCanonicalKeyMigrationRequiredError: invalid persisted session row\nrequires repair for agent:main:main; stop the Gateway and run\nopenclaw doctor --fix: code=SESSION_CANONICAL_KEY_MIGRATION_REQUIRED\n```\n\nFeishu DM inbound messages hit the same error during `feishu[default]:\ndispatching to agent`, so the bot stops replying. The reported symptom is\n\"channel connected, works, but no reply arrives.\"\n\nManual `UPDATE session_nodes SET entry_valid=1` does NOT stick — three\n`AFTER INSERT/UPDATE` triggers on the table re-set it back to 0:\n\n- `session_nodes_entry_valid_after_insert`\n- `session_nodes_entry_valid_after_entry_update`\n- `session_nodes_entry_valid_after_identity_update`\n\nThe triggers fire because `entry_valid=1` is only ever set as a side effect\nof OpenClaw's own internal re-validation pass, which the gateway runs once\nat startup and which checks two invariant conditions on the row. (openclaw-session-row-entry-updatedat-mismatch)", "condition": "plain", "status": 200, "content": "Here's a concrete, actionable fix for the issue you're experiencing:\n\n**Step 1: Disable the triggers**\n\nThe triggers you mentioned are likely defined in a function, e.g., `session_nodes_entry_valid_after_insert`, `session_nodes_entry_valid_after_entry_update`, and `session_nodes_entry_valid_after_identity_update`. You'll need to disable these triggers temporarily to allow you to update the `entry_valid` field manually.\n\n```sql\n-- Disable the triggers\nALTER FUNCTION session_nodes_entry_valid_after_insert DISABLE;\nALTER FUNCTION session_nodes_entry_valid_after_entry_update DISABLE;\nALTER FUNCTION session_nodes_entry_valid_after_identity_update DISABLE;\n```\n\n**Step 2: Manually update the `entry_valid` field**\n\nNow that the triggers are disabled, you can manually update the `entry_valid` field to `1`:\n\n```sql\n-- Update the entry_valid field to 1\nUPDATE session_nodes SET entry_valid = 1 WHERE entry_json = 'your_desired_entry_json';\n```\n\nReplace `'your_desired_entry_json'` with the desired value for `entry_json`.\n\n**Step 3: Re-enable the triggers**\n\nAfter manually updating the `entry_valid` field, re-enable the triggers:\n\n```sql\n-- Re-enable the triggers\nALTER FUNCTION session_nodes_entry", "metrics": { "length": 1201, "commands": 5, "command_list": [ "**Step 2: Manually update the `entry_valid` field**", "Now that the triggers are disabled, you can manually update the `entry_valid` field to `1`:", "Replace `'your_desired_entry_json'` with the desired value for `entry_json`.", "**Step 3: Re-enable the triggers**", "After manually updating the `entry_valid` field, re-enable the triggers:" ], "has_command_block": true, "actionable": true, "inline_code_count": 14, "lesson_hits": 1, "lesson_hit_rate": 0.125 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "2026-08-21/22 R-2000iC 换油周期案例:hermes 回答\"数值对(碰巧)但来源错位\",④ 误判\"KB 蒸馏覆盖缺口\"——实际 **B-82334CM/05 §7.3 数据完整在库**(3年/11520h + 指定润滑脂 Alvania S2 + 各轴供脂量 8370ml 等),是**检索漏召回**。同类案例:M-900iB 换油(数据在库但 hermes 答\"未覆盖\")。两次都被 LLM 误判为\"数据缺失\",根因都在检索层。 (rag-retrieval-sink-multilayer-cutoff)", "condition": "with_lesson", "status": 200, "content": "To fix the error, you need to modify the `search_knowledge.py` script to incorporate the suggested fixes. Here are the concrete, actionable steps:\n\n**Step 1: Update the `_augment_query` function**\n\nAdd the following code to the `_augment_query` function:\n```python\nif re.search(r'R-?2000\\siC', query, re.I) and re.search(r'换油|润滑|保养', query):\n query += \" B-82334CM B-82334EN 润滑脂 更换 定期检修 11520\"\n```\nThis code checks if the query contains \"R-2000iC\" and \"换油|润滑|保养\" (or \"换油\", \"润滑\", or \"保养\" individually). If both conditions are met, it appends the manual page number and other relevant information to the query.\n\n**Step 2: Update the `top_k2` to `top_k3`**\n\nModify the `search_knowledge.py` script to use `top_k3` instead of `top_k2`:\n```python\ntop_k = 3\n```\nThis change will ensure that the top 3 results are retained,", "metrics": { "length": 818, "commands": 3, "command_list": [ "This code checks if the query contains \"R-2000iC\" and \"换油|润滑|保养\" (or \"换油\", \"润滑\", or \"保养\" individually). If both conditions are met, it appends the manual page number and other relevant information to the query.", "**Step 2: Update the `top_k2` to `top_k3`**", "Modify the `search_knowledge.py` script to use `top_k3` instead of `top_k2`:" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "2026-08-21/22 R-2000iC 换油周期案例:hermes 回答\"数值对(碰巧)但来源错位\",④ 误判\"KB 蒸馏覆盖缺口\"——实际 **B-82334CM/05 §7.3 数据完整在库**(3年/11520h + 指定润滑脂 Alvania S2 + 各轴供脂量 8370ml 等),是**检索漏召回**。同类案例:M-900iB 换油(数据在库但 hermes 答\"未覆盖\")。两次都被 LLM 误判为\"数据缺失\",根因都在检索层。 (rag-retrieval-sink-multilayer-cutoff)", "condition": "plain", "status": 200, "content": "The error message indicates that the issue is related to the HerMES (Hermes Retrieval Engine for Metadata and Entity Search) system, which is used to retrieve data from the system. The error is caused by a mismatch between the data source and the data being retrieved.\n\nTo fix this issue, you can try the following steps:\n\n1. Check the HerMES configuration:\n```bash\nhermes-config\n```\nThis command will display the current HerMES configuration, including the data sources and the multilayer cutoff.\n\n2. Verify the data source:\n```bash\nhermes-check-data-source\n```\nThis command will check the data source for the specified data and verify if it matches the expected data.\n\n3. Update the HerMES configuration to include the correct data source:\n```bash\nhermes-config --update --data-source \n```\nReplace `` with the correct data source, such as `B-82334CM/05 §7.3`.\n\n4. Restart the HerMES service:\n```bash\nsystemctl restart hermes\n```\nThis will apply the changes to the HerMES configuration.\n\n5. Verify the issue is resolved:\n```bash\nhermes-check-data-source\n```\nThis command should now return the correct", "metrics": { "length": 1127, "commands": 5, "command_list": [ "hermes-config", "hermes-check-data-source", "hermes-config --update --data-source ", "systemctl restart hermes", "hermes-check-data-source" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Two truncations silently became the soul of an agent-facing search: a default page size and a 400-char projection (retrieval-projection-truncation-caps-recall)", "condition": "plain", "status": 200, "content": "The error you're encountering suggests that you're experiencing issues with truncation in a search application, specifically with regards to the default page size and the 400-character projection limit. Here's a concrete, actionable fix with exact commands to address this issue:\n\n**Step 1: Check the current truncation settings**\n\nYou can check the current truncation settings by running the following command in your terminal or command prompt:\n\n```bash\n# On Linux/Mac\necho \"retrieval-projection-truncation-caps-recall\" | grep\n\n# On Windows\necho \"retrieval-projection-truncation-caps-recall\" | findstr\n```\n\nThis command will display the current truncation settings, including the default page size and the 400-character projection limit.\n\n**Step 2: Increase the default page size**\n\nTo increase the default page size, you can modify the `retrieval-projection-truncation-caps-recall` setting. The exact command to increase the default page size depends on your search application and its configuration.\n\nFor example, if you're using Elasticsearch, you can increase the default page size by modifying the `max_result_window_size` parameter:\n\n```bash\n# On Linux/Mac\ncurl -XPUT 'http://", "metrics": { "length": 1184, "commands": 2, "command_list": [ "echo \"retrieval-projection-truncation-caps-recall\" | grep", "echo \"retrieval-projection-truncation-caps-recall\" | findstr" ], "has_command_block": true, "actionable": false, "inline_code_count": 4, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Two truncations silently became the soul of an agent-facing search: a default page size and a 400-char projection (retrieval-projection-truncation-caps-recall)", "condition": "with_lesson", "status": 200, "content": "To fix the issue, we need to increase the default page size and the projection size to prevent truncation. Here's a concrete, actionable fix:\n\n**Step 1: Increase the default page size**\n\nIn your `fetchLessonsFromD1` function, change the line:\n```javascript\nconst limit = Math.min(Math.max(parseInt(filters.limit, 10) || 100, 1), 5000);\n```\nto:\n```javascript\nconst limit = Math.min(Math.max(parseInt(filters.limit, 10) || 1000, 1), 5000);\n```\nThis will increase the default page size to 1000 documents per page.\n\n**Step 2: Increase the projection size**\n\nIn your `fetchLessonsFromD1` function, change the line:\n```javascript\nconst sql = SELECT id, title, ... FROM lessons + where +\n ORDER BY updated DESC LIMIT ${limit};\n```\nto:\n```javascript\nconst sql = SELECT id, title, ... FROM lessons + where +\n ORDER BY updated DESC LIMIT ${limit}, 1000;\n```\nThis will increase the projection size to 1000 characters per document.\n\n**Step 3: Verify the changes**\n\nRun your tests again to verify that the changes have", "metrics": { "length": 1033, "commands": 5, "command_list": [ "to:", "This will increase the default page size to 1000 documents per page.", "**Step 2: Increase the projection size**", "In your `fetchLessonsFromD1` function, change the line:", "to:" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A cloned confirmation line poisons the context: loop detection must compare dialogue, not whole messages (roleplay-dialogue-loop-context-poisoning)", "condition": "plain", "status": 200, "content": "The error you're encountering is due to a context being poisoned by a cloned confirmation line. This occurs when the loop detection algorithm is comparing the entire message, including the context, instead of just the dialogue. Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Create a new file for your dialogue**\n\nCreate a new file called `dialogue.json` with the following structure:\n\n```json\n{\n \"dialogue\": \"Hello, how can I assist you?\",\n \"context\": \"Welcome to our chatbot\",\n \"next_lines\": [\n {\n \"dialogue\": \"What can I help you with?\",\n \"context\": \"User input\",\n \"next_lines\": []\n },\n {\n \"dialogue\": \"I'm happy to help.\",\n \"context\": \"Chatbot response\",\n \"next_lines\": []\n }\n ]\n}\n```\n\n**Step 2: Update your loop detection algorithm**\n\nUpdate your loop detection algorithm to compare only the dialogue, not the entire message. Here's an example using Python and the `json` library:\n\n```python\nimport json\n\ndef loop_detection(dialogue):\n # Load the dialogue data from the JSON file\n with open('dialogue.json') as f:\n", "metrics": { "length": 1090, "commands": 2, "command_list": [ "**Step 2: Update your loop detection algorithm**", "Update your loop detection algorithm to compare only the dialogue, not the entire message. Here's an example using Python and the `json` library:" ], "has_command_block": true, "actionable": false, "inline_code_count": 4, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A marker-replacement sync consumes its own marker: run #2 is a silent no-op (ssot-marker-replacement-runs-once)", "condition": "with_lesson", "status": 200, "content": "To fix the issue, we need to modify the code to check if the replacement was successful. Here's the updated code:\n\n```python\nimport os\n\nCOUNT_MARKER_DOCS = [\"README.md\", \"site/index.md\", \"site/404.md\", \"site/search.md\", \"docs/llms.txt\", \"docs/integration-guides.md\"]\nREPO = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))\n\nfor name in COUNT_MARKER_DOCS:\n text = (REPO / name).read_text(encoding=\"utf-8\")\n if \"{{LESSONS_COUNT}}\" not in text:\n continue\n\n # Generate the replacement string\n count = 378 # Replace with the actual count\n replacement = text.replace(\"{{LESSONS_COUNT}}\", str(count))\n\n # Write the updated text to the file\n if (REPO / name).write_text(replacement, encoding=\"utf-8\"):\n print(f\"Updated {name}\")\n else:\n print(f\"Failed to update {name}: {name}\")\n```\n\nIn this updated code, we check if the write operation was successful by checking the return value of the `write_text` method. If it returns `True`, we print a success message; if it", "metrics": { "length": 1013, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 3, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A cloned confirmation line poisons the context: loop detection must compare dialogue, not whole messages (roleplay-dialogue-loop-context-poisoning)", "condition": "with_lesson", "status": 200, "content": "To fix this issue, we need to modify the sampling layer to compare only the dialogue, not the whole messages. We can achieve this by adding a custom tokenization function that splits the input message into individual tokens (words or subwords) and then compares the dialogue.\n\nHere's a concrete, actionable fix with exact commands:\n\n**Step 1: Create a custom tokenization function**\n\nCreate a new file `tokenization.py` with the following code:\n```python\nimport re\n\ndef tokenize_message(message):\n # Split the message into individual tokens (words or subwords)\n tokens = re.findall(r'\\w+|[^\\w\\s]', message)\n return tokens\n```\nThis function uses regular expressions to split the input message into individual tokens.\n\n**Step 2: Modify the sampling layer**\n\nUpdate the sampling layer to use the custom tokenization function:\n```python\nimport torch\nfrom transformers import AutoModelForConditionalGeneration, AutoTokenizer\n\n# Load the model and tokenizer\nmodel = AutoModelForConditionalGeneration.from_pretrained('t5-small')\ntokenizer = AutoTokenizer.from_pretrained('t5-small')\n\ndef sample_dialogue(context, max_length=50):\n # Tokenize the context and user input\n context_tokens = tokenizer.encode(context, return", "metrics": { "length": 1226, "commands": 3, "command_list": [ "This function uses regular expressions to split the input message into individual tokens.", "**Step 2: Modify the sampling layer**", "Update the sampling layer to use the custom tokenization function:" ], "has_command_block": true, "actionable": true, "inline_code_count": 3, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "One stray `', '', content, flags=re.DOTALL)\n\n with open(file_path, 'w') as file:\n file.write(content)\n\n# Specify the files to fix\nfiles_to_fix = ['file1.md', 'file2.md', ...] # replace with your list of files\n\nfor file in files_to_fix:\n fix_markdown(file)\n```\n\n Replace `file1.md`, `file2.md`, etc., with your actual list of markdown files.\n\n3. Run the script using Python:\n\n ```bash\n", "metrics": { "length": 1001, "commands": 3, "command_list": [ "sudo apt-get install grep", "Replace `file1.md`, `file2.md`, etc., with your actual list of markdown files.", "3. Run the script using Python:" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A marker-replacement sync consumes its own marker: run #2 is a silent no-op (ssot-marker-replacement-runs-once)", "condition": "plain", "status": 200, "content": "The error you're encountering is related to a marker replacement sync consuming its own marker, which is a known issue in Git. Here's a step-by-step fix to resolve the issue:\n\n**Step 1: Delete the marker file**\n\nRun the following command to delete the marker file:\n\n```bash\ngit rm --cached -f .git/objects//ssot-marker-replacement-runs-once\n```\n\nReplace `` with the actual hash value of the marker file you want to delete. You can find the hash value by running:\n\n```bash\ngit cat-file -t .git/objects/\n```\n\n**Step 2: Remove the marker file from the Git index**\n\nRun the following command to remove the marker file from the Git index:\n\n```bash\ngit rm --cached .git/objects//ssot-marker-replacement-runs-once\n```\n\nAgain, replace `` with the actual hash value of the marker file you want to remove.\n\n**Step 3: Force push the changes**\n\nRun the following command to force push the changes to the remote repository:\n\n```bash\ngit push origin --force\n```\n\nReplace `` with the name of the branch you're pushing", "metrics": { "length": 1059, "commands": 4, "command_list": [ "git rm --cached -f .git/objects//ssot-marker-replacement-runs-once", "git cat-file -t .git/objects/", "git rm --cached .git/objects//ssot-marker-replacement-runs-once", "git push origin --force" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Vertex AI 成本归因:BigQuery billing exports + traces + Gemma 混合计费 (vertex-ai-cost-attribution-bigquery-billing-gemma)", "condition": "with_lesson", "status": 200, "content": "根据给出的问题和解决方案,下面是一步一步的具体操作:\n\n**步骤 1:启用并解析 BigQuery Detailed Billing Export 表结构**\n\n1. 打开Google Cloud Console并访问 [BigQuery](https://console.cloud.google.com/bigquery)。\n2. 在左侧导航菜单中,选择 **Billing** > **Export**。\n3. 在 **Export settings** 中,选择 **Standard**(标准计费导出)并点击 **Save**。\n4. 在 **Export settings** 中,点击 **Add export**,选择 **Detailed**(详细导出)。\n5. 在 **Detailed export settings** 中,选择 **Resource**(资源)并设置 **Resource name** 为 `vertex-ai-endpoint`。\n6. 点击 **Save**。\n\n现在,我们需要解析 BigQuery Detailed Billing Export 表结构。我们可以使用以下 SQL 查询来获取表结构:\n\n```sql\nSELECT *\nFROM `bigquery-public-data.gcp_billing_export.resource`\nWHERE resource_type = 'vertex-ai-endpoint';\n```\n\n这将返回表结构,其中包括 `resource_name`、`resource_type`、`labels` 等列。\n\n**步骤 2:启用", "metrics": { "length": 716, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 6, "lesson_hits": 1, "lesson_hit_rate": 0.167 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Vertex AI 成本归因:BigQuery billing exports + traces + Gemma 混合计费 (vertex-ai-cost-attribution-bigquery-billing-gemma)", "condition": "plain", "status": 200, "content": "The error you're encountering is due to Vertex AI's cost attribution model, which is designed to provide a breakdown of costs associated with your projects. The error message indicates that BigQuery billing exports, traces, and Gemma are contributing to the overall cost.\n\nHere's a step-by-step guide to resolve this issue:\n\n**Step 1: Disable BigQuery billing exports**\n\nBigQuery billing exports are responsible for the majority of the costs. To disable them, follow these steps:\n\n```bash\ngcloud ai-platform services disable-billing-exports --project=\n```\n\nReplace `` with your actual Google Cloud project ID.\n\n**Step 2: Disable Vertex AI tracing**\n\nVertex AI tracing is another significant contributor to costs. To disable it, run the following command:\n\n```bash\ngcloud ai-platform services disable-tracing --project=\n```\n\nAgain, replace `` with your actual Google Cloud project ID.\n\n**Step 3: Disable Gemma**\n\nGemma is a cost estimation tool that provides an estimate of the costs associated with your Vertex AI projects. To disable Gemma, follow these steps:\n\n```bash\ngcloud ai-platform services disable-gemma --project=\n```\n\nReplace", "metrics": { "length": 1221, "commands": 3, "command_list": [ "gcloud ai-platform services disable-billing-exports --project=", "gcloud ai-platform services disable-tracing --project=", "gcloud ai-platform services disable-gemma --project=" ], "has_command_block": true, "actionable": false, "inline_code_count": 7, "lesson_hits": 2, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Vertex AI Streaming: Robust SSE Chunk Assembly and Buffer Handling (vertex-ai-streaming-response-sse)", "condition": "with_lesson", "status": 200, "content": "To fix the Vertex AI Streaming: Robust SSE Chunk Assembly and Buffer Handling issue, you can implement the following changes:\n\n**1. Use a library that handles chunk assembly and buffer handling for SSE**\n\nYou can use a library like `sse` (Simple Server-Sent Events) in Python, which handles chunk assembly and buffer handling for SSE. Install it using pip:\n```bash\npip install sse\n```\n**2. Use a library that handles JSON parsing with chunked decoding**\n\nYou can use a library like `json5` (JSON5 parser) in Python, which handles chunked decoding for JSON. Install it using pip:\n```bash\npip install json5\n```\n**3. Implement a custom middleware or handler to handle chunk assembly and buffer handling**\n\nHere's an example of a custom middleware using Flask in Python:\n```python\nfrom flask import Flask, Response\nimport json5\nimport sse\n\napp = Flask(__name__)\n\n@app.route('/stream', methods=['GET'])\ndef stream():\n # Your stream generation code here\n for chunk in streamGenerateContent():\n yield f'data: {chunk}\\n\\n'\n yield 'event: message\\n\\n'\n try:\n json_data = json5.loads(chunk)\n", "metrics": { "length": 1119, "commands": 2, "command_list": [ "pip install sse", "pip install json5" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Vertex AI Streaming: Robust SSE Chunk Assembly and Buffer Handling (vertex-ai-streaming-response-sse)", "condition": "plain", "status": 200, "content": "The error you're encountering, \"Robust SSE Chunk Assembly and Buffer Handling,\" is related to a known issue in Vertex AI Streaming. This issue can be resolved by updating the `vertex-ai-streaming-response-sse` package to the latest version. Here's a step-by-step guide to fix the issue:\n\n**For Google Cloud Platform (GCP) users:**\n\n1. Update the `vertex-ai-streaming-response-sse` package using the following command:\n\n ```bash\ngcloud components update vertex-ai-streaming-response-sse\n```\n\n This command updates the package to the latest version available in the Google Cloud SDK.\n\n2. Verify that the package has been updated successfully by running:\n\n ```bash\ngcloud components list\n```\n\n This command lists all the components installed in your Google Cloud SDK. Look for `vertex-ai-streaming-response-sse` and verify its version.\n\n**For non-GCP users (local environment):**\n\n1. Install the required package using pip:\n\n ```bash\npip install --upgrade vertex-ai-streaming-response-sse\n```\n\n This command updates the package to the latest version available in PyPI.\n\n2. Verify that the package has been updated successfully by running", "metrics": { "length": 1156, "commands": 3, "command_list": [ "gcloud components update vertex-ai-streaming-response-sse", "gcloud components list", "pip install --upgrade vertex-ai-streaming-response-sse" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Windows Node sandbox: a hardcoded /root silently confined the agent to the wrong directory (windows-node-sandbox-hardcoded-root)", "condition": "plain", "status": 200, "content": "The error you're encountering is related to the Windows Node.js sandbox. The issue occurs when the `/root` directory in the sandbox is hardcoded, causing the agent to be confined to the wrong directory.\n\nHere's a concrete, actionable fix to resolve this issue:\n\n**Update the Windows Node.js sandbox configuration**\n\nYou can update the Windows Node.js sandbox configuration to use a dynamic `/root` directory instead of a hardcoded one. Here are the steps:\n\n1. **Open the Windows Node.js settings**:\n You can open the Windows Node.js settings by running the following command in your Command Prompt or PowerShell:\n\n ```bash\nnode -v --version\n```\n This will display the version of Node.js installed on your system. Next, run:\n\n ```bash\nnode -v --version | findstr /c:\"v\"\n```\n This will display the version number of Node.js. Append the version number to the following command to open the settings:\n\n ```bash\nnode -v --version | findstr /c:\"v\" && node -v --version | findstr /c:\"v\" -- settings\n```\n Then, open the `settings.json` file in your default text editor.\n\n2. **Update the `settings.json` file", "metrics": { "length": 1112, "commands": 3, "command_list": [ "node -v --version", "node -v --version | findstr /c:\"v\"", "node -v --version | findstr /c:\"v\" && node -v --version | findstr /c:\"v\" -- settings" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 1, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Windows Node sandbox: a hardcoded /root silently confined the agent to the wrong directory (windows-node-sandbox-hardcoded-root)", "condition": "with_lesson", "status": 200, "content": "To fix the issue, you need to use a platform-agnostic way to construct the sandbox root. One way to do this is to use the `path` module in Node.js, which provides a way to work with file paths in a way that is independent of the operating system.\n\nHere's an example of how you can fix the issue:\n\n```typescript\nimport * as path from 'path';\n\nconst SANDBOX_HOME = path.join(__dirname, 'sandbox');\n```\n\nIn this example, `path.join(__dirname, 'sandbox')` constructs a path that is relative to the current working directory, which is independent of the operating system. This ensures that the sandbox root is created in the correct location, regardless of whether the process is running on Linux or Windows.\n\nAdditionally, you can use the `process.cwd()` function to get the current working directory, and then use `path.join()` to construct the sandbox root:\n\n```typescript\nconst SANDBOX_HOME = path.join(process.cwd(), 'sandbox');\n```\n\nThis way, the sandbox root will be created in the current working directory, regardless of whether the process is running in a container or on a local machine.\n\nAs for the confinement check, you can use the `path.dirname()` function to get the directory path", "metrics": { "length": 1192, "commands": 2, "command_list": [ "In this example, `path.join(__dirname, 'sandbox')` constructs a path that is relative to the current working directory, which is independent of the operating system. This ensures that the sandbox root is created in the correct location, regardless of whether the process is running on Linux or Windows.", "Additionally, you can use the `process.cwd()` function to get the current working directory, and then use `path.join()` to construct the sandbox root:" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Character Creator Assistants — Repetitive Name and Archetype Loop from Prompt Anchors (character-assistant-repetition-loop)", "condition": "with_lesson", "status": 200, "content": "To break the repetitive name and archetype loop from prompt anchors, you can try the following:\n\n1. **Add a catalog of generated characters**: Before generating a character, make sure the model has access to a catalog of previously generated characters. This can be done by adding a prompt parameter that includes the generated characters from previous runs.\n\n Example:\n ```python\ngenerate a unique character that is not Luna and does not have the traits \"teimosa\" or \"stubborn\"\n```\n\n2. **Use a more diverse set of example anchors**: Instead of using a single example like \"Luna\" or \"curiosa, teimosa\", use a more diverse set of examples that are not too similar.\n\n Example:\n ```python\ngenerate a unique character that is not similar to any of the following: Luna, Astrid, Lyra, Kaida, or Zara\n```\n\n3. **Add a \"novelty\" metric to the loss function**: To encourage the model to generate more diverse characters, you can add a \"novelty\" metric to the loss function. This can be done by penalizing the model for generating characters that are too similar to previously generated characters.\n\n Example (using PyTorch):\n ```python\nimport", "metrics": { "length": 1144, "commands": 4, "command_list": [ "2. **Use a more diverse set of example anchors**: Instead of using a single example like \"Luna\" or \"curiosa, teimosa\", use a more diverse set of examples that are not too similar.", "Example:", "3. **Add a \"novelty\" metric to the loss function**: To encourage the model to generate more diverse characters, you can add a \"novelty\" metric to the loss function. This can be done by penalizing the model for generating characters that are too similar to previously generated characters.", "Example (using PyTorch):" ], "has_command_block": true, "actionable": true, "inline_code_count": 4, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Character Creator Assistants — Repetitive Name and Archetype Loop from Prompt Anchors (character-assistant-repetition-loop)", "condition": "plain", "status": 200, "content": "The error you're experiencing is likely due to a repetitive name or archetype in your prompt anchors, causing the model to get stuck in a loop. Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Clear the cache**\n\nOpen a new terminal or command prompt and run the following command to clear the cache:\n```\npython -c \"import transformers; transformers.__version__\"\n```\nThis command will reset the cache and allow you to start fresh.\n\n**Step 2: Delete the `cache` directory**\n\nDelete the `cache` directory in your project directory. This directory stores cached models and prompt anchors, which can cause issues if they're not up-to-date.\n\n```\nrm -rf cache\n```\n**Step 3: Re-run the model with a new prompt anchor**\n\nRe-run your model with a new prompt anchor that doesn't contain any repetitive names or archetypes. You can try rephrasing your prompt or using a different anchor.\n\nFor example, if your original prompt was:\n```\n\"Create a character with the name 'John Smith' and archetype 'Warrior'\"\n```\nTry rephrasing it to:\n```\n\"Create a character with a unique name and a heroic backstory\"\n```\n**Step 4:", "metrics": { "length": 1118, "commands": 4, "command_list": [ "python -c \"import transformers; transformers.__version__\"", "rm -rf cache", "\"Create a character with the name 'John Smith' and archetype 'Warrior'\"", "\"Create a character with a unique name and a heroic backstory\"" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Cloudflare Observability MCP OAuth: Separate Authorization Domain + mcporter Client Trap (cloudflare-observability-mcp-oauth-separate-domain)", "condition": "with_lesson", "status": 200, "content": "To resolve the error, you'll need to update your `mcporter` configuration to use the correct OAuth audience for the Cloudflare Observability MCP OAuth endpoint. Here are the steps:\n\n**Step 1: Update the `mcporter` configuration**\n\nYou'll need to update the `client_id` and `audience` in your `mcporter` configuration. Run the following command to update the configuration:\n```bash\nmcporter config update --audience https://observability.mcp.cloudflare.com\n```\nThis will update the `audience` field in your `mcporter` configuration to the correct OAuth audience for the Cloudflare Observability MCP OAuth endpoint.\n\n**Step 2: Update the `PKCE` state file**\n\nTo generate a valid `PKCE` state file, you'll need to update the `state` field in your `mcporter` configuration. Run the following command to generate a new `PKCE` state file:\n```bash\nmcporter config update --pkce-state-file /path/to/new/state.json\n```\nThis will generate a new `PKCE` state file with the correct JSON string.\n\n**Step 3: Verify the configuration**\n\nOnce you've updated your `mcporter` configuration, verify that the configuration is correct", "metrics": { "length": 1113, "commands": 2, "command_list": [ "mcporter config update --audience https://observability.mcp.cloudflare.com", "mcporter config update --pkce-state-file /path/to/new/state.json" ], "has_command_block": true, "actionable": true, "inline_code_count": 17, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Cloudflare Observability MCP OAuth: Separate Authorization Domain + mcporter Client Trap (cloudflare-observability-mcp-oauth-separate-domain)", "condition": "plain", "status": 200, "content": "The error you're encountering is due to Cloudflare Observability MCP OAuth not being able to separate the authorization domain from the client. This is a known issue, and the solution involves updating the configuration for the Cloudflare Observability MCP OAuth.\n\nHere's a step-by-step guide to fix the issue:\n\n**Step 1: Update the Cloudflare Observability MCP OAuth configuration**\n\n1. Log in to your Cloudflare account and navigate to the Observability settings.\n2. Click on \"MCP OAuth\" from the left-hand menu.\n3. Click on the \"Edit\" button next to \"Authorization Domain\".\n4. In the \"Authorization Domain\" field, enter the same domain that you're using for your client (e.g., `https://your-client.com`).\n5. Click \"Save Changes\".\n\n**Step 2: Update the client configuration**\n\n1. Navigate to the Cloudflare dashboard and click on \" Workers\" from the left-hand menu.\n2. Click on the \"Edit\" button next to your client (e.g., `your-client`).\n3. In the \"Client\" section, click on the \"OAuth\" tab.\n4. In the \"OAuth\" section, click on the \"Edit\" button next to \"Authorization Domain\".\n5. In", "metrics": { "length": 1086, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 2, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Gemini Safety Settings: Multi-Hop Gateway Passthrough and Compliance Preservation (gemini-safety-settings-multi-hop-passthrough)", "condition": "with_lesson", "status": 200, "content": "Here's a concrete, actionable fix to resolve the Gemini Safety Settings: Multi-Hop Gateway Passthrough and Compliance Preservation error.\n\n**Step 1: Update Client SDK to use snake_case for safety settings**\n\nModify your client SDK to use snake_case for safety settings. This will ensure that the safety array is properly formatted for downstream processing.\n\nFor example, if you're using Python with the `transformers` library, you can update your code as follows:\n```python\nimport pandas as pd\nfrom transformers import GeminiModel\n\n# Create a new instance of the Gemini model with snake_case safety settings\nmodel = GeminiModel.from_pretrained('gemini-safety-settings-multi-hop-passthrough', \n safety_settings={'safety': 'block_medium_and_above', 'harm_category': 'none'}, \n config={'safety_settings': {'safety': 'block_medium_and_above', 'harm_category': 'none'}})\n\n# Make a prediction using the model\ninputs = {'prompt': 'Hello, how are you?', 'max_tokens': 10}\noutputs = model.generate(inputs, safety_settings={'safety': 'block_low', 'harm_category': 'none'})\n```\n**Step 2: Configure the proxy to enforce safety floors**\n\nConfigure the", "metrics": { "length": 1209, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 2, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Gemini Safety Settings: Multi-Hop Gateway Passthrough and Compliance Preservation (gemini-safety-settings-multi-hop-passthrough)", "condition": "plain", "status": 200, "content": "The error you're experiencing is related to Gemini's safety settings. To resolve this issue, you'll need to update your `gemini-safety-settings` configuration. Here's a step-by-step guide to fix the error:\n\n1. **Update the `gemini-safety-settings` package:**\n\n Run the following command to update the package:\n\n ```bash\ngem install gemini-safety-settings\n```\n\n or\n\n ```bash\nbrew install gemini-safety-settings\n```\n\n (For Homebrew users)\n\n2. **Update the configuration file:**\n\n Gemini uses a configuration file to store safety settings. The default location of the configuration file is `~/.config/gemini/safety_settings.yaml`.\n\n Run the following command to update the configuration file:\n\n ```bash\ngem config set safety_settings multi_hop_gateway_passthrough true\ngem config set safety_settings compliance_preservation true\n```\n\n These commands will set the `multi-hop-gateway-passthrough` and `compliance-preservation` settings to `true` in the configuration file.\n\n3. **Restart Gemini:**\n\n After updating the configuration file, you'll need to restart Gemini to apply the changes:\n\n ```bash\ngemini restart\n```\n\n or", "metrics": { "length": 1142, "commands": 5, "command_list": [ "gem install gemini-safety-settings", "brew install gemini-safety-settings", "gem config set safety_settings multi_hop_gateway_passthrough true", "gem config set safety_settings compliance_preservation true", "gemini restart" ], "has_command_block": true, "actionable": true, "inline_code_count": 13, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Roleplay Vocative vs Mention — Entity Disambiguation Failure in Portuguese Turn Routing (roleplay-vocative-entity-disambiguation-portuguese)", "condition": "plain", "status": 200, "content": "The error you're encountering is related to entity disambiguation in Portuguese turn routing, specifically when using roleplay vocative. To resolve this issue, you can try the following steps:\n\n1. Update your model to the latest version:\n\nYou can update your model to the latest version by running the following command:\n\n```bash\npython -m spacy download pt_core_news_sm\n```\n\nThis will update your model to the latest version of the Portuguese language model.\n\n2. Check for out-of-vocabulary words:\n\nRoleplay vocative entities often contain out-of-vocabulary words. To resolve this issue, you can use the following command to check for out-of-vocabulary words:\n\n```bash\npython -m spacy vocab pt_core_news_sm\n```\n\nThis will display a list of out-of-vocabulary words in your model.\n\n3. Add out-of-vocabulary words to your model:\n\nYou can add out-of-vocabulary words to your model by running the following command:\n\n```bash\npython -m spacy add pt_core_news_sm \n```\n\nReplace `` with the out-of-vocabulary word you want to add.\n\n4. Update your code to handle roleplay vocative entities:\n\nYou can update your code to handle roleplay vocative entities", "metrics": { "length": 1156, "commands": 3, "command_list": [ "python -m spacy download pt_core_news_sm", "python -m spacy vocab pt_core_news_sm", "python -m spacy add pt_core_news_sm " ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Roleplay Vocative vs Mention — Entity Disambiguation Failure in Portuguese Turn Routing (roleplay-vocative-entity-disambiguation-portuguese)", "condition": "with_lesson", "status": 200, "content": "To fix the `Roleplay Vocative vs Mention — Entity Disambiguation Failure in Portuguese Turn Routing` error, we need to modify the `resolveSpeaker` function in the turn router to correctly distinguish between vocative addresses and mentions.\n\nHere's a concrete, actionable fix with exact commands:\n\n**Step 1: Modify the `resolveSpeaker` function**\n\n```go\nfunc (r *RoleplayRouter) resolveSpeaker(text string) string {\n // ... existing code ...\n\n // Add a new function to check if a word is a vocative address\n func isVocativeAddress(word string) bool {\n // Check if the word starts with a capital letter and is followed by a comma\n return strings.HasPrefix(word, strings.ToUpper(string(r.vocatives[0].Name[0]))) && strings.HasSuffix(word, \",\")\n }\n\n // Add a new function to check if a word is a mention\n func isMention(word string) bool {\n // Check if the word is not a vocative address and is not a registered NPC name\n return !isVocativeAddress(word) && !r.registeredNPCs.Contains(word)\n }\n\n // ... existing code ...\n\n // Iterate through the words in the text\n", "metrics": { "length": 1115, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 3, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Vertex AI Embedding 迁移实战:Python 与 Go 双客户端接入、Qwen 适配与维度配额避坑指南 (vertex-ai-embedding-qwen-go-migration)", "condition": "with_lesson", "status": 200, "content": "为了解决这些问题,我们需要进行以下步骤:\n\n**步骤 1:解决 Go 语言客户端序列化报错**\n\n1. 使用 `protoc` 命令生成 Go 语言的 gRPC 客户端代码:\n```bash\nprotoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative vertex_ai_embedding.proto\n```\n2. 使用 `go mod tidy` 命令更新 Go 语言模块:\n```bash\ngo mod tidy\n```\n3. 使用 `go test` 命令测试 Go 语言客户端代码:\n```bash\ngo test\n```\n\n**步骤 2:解决 Model Garden Qwen 嵌入接口协议不匹配**\n\n1. 检查 Vertex AI Model Garden 上的 Qwen 嵌入模型的端点 URL:\n```bash\ngcloud ai-platform models describe <模型名称> --format='get endpoints.url'\n```\n2. 使用 `curl` 命令发送原始 Vertex AI 预测请求体:\n```bash\ncurl -X POST \\\n https://<端点 URL>/predict \\\n -H 'Content-Type", "metrics": { "length": 620, "commands": 4, "command_list": [ "protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative vertex_ai_embedding.proto", "go mod tidy", "go test", "gcloud ai-platform models describe <模型名称> --format='get endpoints.url'" ], "has_command_block": true, "actionable": false, "inline_code_count": 12, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Vertex AI Embedding 迁移实战:Python 与 Go 双客户端接入、Qwen 适配与维度配额避坑指南 (vertex-ai-embedding-qwen-go-migration)", "condition": "plain", "status": 200, "content": "I can help you troubleshoot the issue.\n\nThe error message you provided doesn't seem to be related to the code or the Vertex AI Embedding migration. However, I can provide you with some general steps to troubleshoot and fix common issues that may be related to the migration process.\n\nHere are some steps you can try:\n\n1. Check the Vertex AI documentation for the latest information on the migration process.\n\n2. Make sure you have the correct version of the Vertex AI client library installed. You can check the version using the following command:\n\n```bash\ngo list -m github.com/google/vertexai\n```\n\n3. If you are using the `--embeddings` option, make sure you have the correct configuration for Qwen. You can check the Qwen documentation for more information on how to configure it.\n\n4. Make sure you have the correct quota and limits set up for your project. You can check the quota and limits using the following command:\n\n```bash\ngcloud ai-vertex embeddings describe --project=\n```\n\n5. If you are still experiencing issues, try deleting the cache and restart the client.\n\n```bash\nrm -rf ~/.cache/go-build\n```\n\n6. Try running the client again and see if the issue persists", "metrics": { "length": 1188, "commands": 3, "command_list": [ "go list -m github.com/google/vertexai", "gcloud ai-vertex embeddings describe --project=", "rm -rf ~/.cache/go-build" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "alembic upgrade head fails with exit code 255 or subprocess error (alembic-upgrade-head-failed)", "condition": "with_lesson", "status": 200, "content": "To diagnose and fix the issue, let's go through each of the three root causes:\n\n### 1. Multiple heads (migration chain diverged)\n\nIf you see two heads in the `alembic heads` output, it means that your migration chain has diverged into multiple branches. To fix this, you need to merge the two heads.\n\n```bash\n# Merge the two heads\nalembic merge -m \"merge heads\" a1b2c3d4 e5f6g7h8\n\n# Upgrade to the new head\nalembic upgrade head\n```\n\n### 2. Version table inconsistency\n\nIf the `alembic current` output shows a revision that doesn't exist in the migration chain (as indicated by `alembic history`), it means that the version table is inconsistent.\n\n```bash\n# Stamp to a known-good revision (or head if schema is already correct)\nalembic stamp head\n\n# Upgrade to the new head\nalembic upgrade head\n```\n\n### 3. Model import side effects (the exit 255 case)\n\nTo diagnose this issue, you need to check your `env.py` file for any model imports that might be causing code to fail.\n\n1. Open your `", "metrics": { "length": 987, "commands": 4, "command_list": [ "alembic merge -m \"merge heads\" a1b2c3d4 e5f6g7h8", "alembic upgrade head", "alembic stamp head", "alembic upgrade head" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 7, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Alembic upgrade fails after dependency update (alembic-upgrade-failure)", "condition": "with_lesson", "status": 200, "content": "To fix the `alembic-upgrade-failure` issue, we'll follow the steps outlined in the provided lesson. Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Diagnose the current state**\n\nFirst, we'll use `alembic current` to see what alembic thinks the current state is:\n\n```bash\nalembic current\n```\n\nThis will show us the current migration head and the state of the `alembic_version` table.\n\n**Step 2: See what migrations exist**\n\nNext, we'll use `alembic history` to see what migrations exist:\n\n```bash\nalembic history\n```\n\nThis will list all the migrations that have been applied to the database.\n\n**Step 3: See what heads exist**\n\nThen, we'll use `alembic heads` to see what heads exist:\n\n```bash\nalembic heads\n```\n\nThis will list all the migration heads in the `alembic/versions` directory.\n\n**Step 4: Merge heads if necessary**\n\nIf there are two heads, we need to merge them. We'll use `alembic merge` to merge the two heads:\n\n```bash\nalembic merge -m \"merge", "metrics": { "length": 973, "commands": 3, "command_list": [ "alembic current", "alembic history", "alembic heads" ], "has_command_block": true, "actionable": true, "inline_code_count": 13, "lesson_hits": 4, "lesson_hit_rate": 0.8 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Alembic upgrade fails after dependency update (alembic-upgrade-failure)", "condition": "with_lesson", "status": 200, "content": "Here's a concrete, actionable fix with exact commands to resolve the `alembic-upgrade-failure` issue:\n\n**Step 1: Diagnose the issue**\n\n1. Run `alembic current` to see what alembic thinks the current state is:\n ```bash\nalembic current\n```\n This will output the current revision ID and the script path.\n\n2. Run `alembic history` to see what migrations exist:\n ```bash\nalembic history\n```\n This will output a list of all migration scripts.\n\n3. Run `alembic heads` to see what heads exist:\n ```bash\nalembic heads\n```\n This will output a list of all head revisions.\n\n**Step 2: Identify and resolve the issue**\n\nBased on the output of the above commands, follow these steps:\n\n### If two heads exist:\n\n1. Merge the two heads using `alembic merge`:\n ```bash\nalembic merge -m \"merge heads\" head1 head2\n```\n Replace `head1` and `head2` with the actual head revision IDs.\n\n### If a revision is not found:\n\n1. Stamp to a known-good state using `ale", "metrics": { "length": 952, "commands": 4, "command_list": [ "alembic current", "alembic history", "alembic heads", "alembic merge -m \"merge heads\" head1 head2" ], "has_command_block": true, "actionable": true, "inline_code_count": 15, "lesson_hits": 4, "lesson_hit_rate": 0.8 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Alembic upgrade fails after dependency update (alembic-upgrade-failure)", "condition": "plain", "status": 200, "content": "The \"alembic-upgrade-failure\" error typically occurs when Alembic fails to upgrade your database schema due to dependencies not being met. Here's a step-by-step solution to resolve this issue:\n\n**Step 1: Downgrade to a previous version**\n\nBefore upgrading, downgrade to a version that is known to work. This will help you identify if the issue is related to the specific version you're trying to upgrade to.\n\n```bash\n# Navigate to your Alembic directory\ncd alembic\n\n# Downgrade to the previous version\nalembic revision --autogenerate -m \"Downgrade to previous version\"\n```\n\n**Step 2: Update Alembic dependencies**\n\nUpdate Alembic and its dependencies to the latest versions.\n\n```bash\n# Update Alembic and its dependencies\npip install --upgrade alembic\npip install --upgrade sqlalchemy\npip install --upgrade sqlalchemy[server]\n```\n\n**Step 3: Re-apply the upgrade**\n\nNow that Alembic and its dependencies are updated, re-apply the upgrade.\n\n```bash\n# Re-apply the upgrade\nalembic upgrade head\n```\n\n**Step 4: Verify the database schema**\n\nAfter the upgrade, verify that the database", "metrics": { "length": 1079, "commands": 6, "command_list": [ "cd alembic", "alembic revision --autogenerate -m \"Downgrade to previous version\"", "pip install --upgrade alembic", "pip install --upgrade sqlalchemy", "pip install --upgrade sqlalchemy[server]" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 4, "lesson_hit_rate": 0.8 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Alembic upgrade fails after dependency update (alembic-upgrade-failure)", "condition": "plain", "status": 200, "content": "**Alembic Upgrade Failure After Dependency Update**\n\nWhen you update your dependencies, it's possible that your Alembic migration history becomes out of sync with your database schema. This can cause an upgrade failure when you try to apply the latest migrations.\n\n**Fix:**\n\n1. **Downgrade to the previous version of Alembic**:\n ```bash\npip install --force-reinstall alembic==\n```\n Replace `` with the version you were using before the update.\n\n2. **Re-run the `alembic init` command**:\n ```bash\nalembic init alembic\n```\n This will recreate the `alembic.ini` file and the `versions` directory.\n\n3. **Delete the existing `alembic_version` table**:\n ```bash\nalembic downgrade base\n```\n This will delete the existing `alembic_version` table in your database.\n\n4. **Re-run the `alembic upgrade` command**:\n ```bash\nalembic upgrade head\n```\n This will re-apply all the migrations and bring your database schema up to date.\n\n5. **Upgrade Alembic to the latest version**:\n ", "metrics": { "length": 1019, "commands": 4, "command_list": [ "pip install --force-reinstall alembic==", "alembic init alembic", "alembic downgrade base", "alembic upgrade head" ], "has_command_block": true, "actionable": true, "inline_code_count": 14, "lesson_hits": 4, "lesson_hit_rate": 0.8 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "alembic upgrade head fails with exit code 255 or subprocess error (alembic-upgrade-head-failed)", "condition": "with_lesson", "status": 200, "content": "To fix the `alembic upgrade head fails with exit code 255 or subprocess error (alembic-upgrade-head-failed)` issue, you need to diagnose the root cause and apply the matching fix. Here are the exact steps:\n\n### Diagnose the Root Cause\n\n1. **Check for Multiple Heads**: Run the following command to see if there are multiple heads in your migration chain.\n ```bash\nalembic heads\n```\n If you see two or more heads, it means your migration chain has diverged into multiple heads.\n\n2. **Check the alembic_version Table**: Run the following commands to see if the `alembic_version` table references a revision not in the current chain.\n ```bash\nalembic current\n```\n This will show you the current revision that alembic thinks is the latest. Then, run:\n ```bash\nalembic history\n```\n This will show you the entire migration chain. If the current revision is not in the migration chain, it means there's an inconsistency in the `alembic_version` table.\n\n3. **Check for Unhandled Exceptions in env.py**: Run the following command to see if there are any unhandled exceptions in your `", "metrics": { "length": 1087, "commands": 3, "command_list": [ "alembic heads", "alembic current", "alembic history" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 6, "lesson_hit_rate": 0.857 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "alembic upgrade head fails with exit code 255 or subprocess error (alembic-upgrade-head-failed)", "condition": "plain", "status": 200, "content": "The error \"alembic upgrade head failed with exit code 255 or subprocess error (alembic-upgrade-head-failed)\" typically occurs when Alembic encounters a migration that cannot be applied due to a dependency issue or a conflict with the database schema. Here's a step-by-step guide to resolve this issue:\n\n**Step 1: Check the Alembic Version**\n\nFirst, check the Alembic version that you are currently using. You can do this by running the following command:\n\n```bash\nalembic --version\n```\n\nTake note of the version number.\n\n**Step 2: Check the Alembic History**\n\nRun the following command to check the Alembic history:\n\n```bash\nalembic history\n```\n\nThis will display a list of all the migrations that have been applied to your database.\n\n**Step 3: Identify the Failed Migration**\n\nLook for the most recent migration that failed to apply. It should be marked as \"failed\" or \"skipped\" in the Alembic history.\n\n**Step 4: Revert the Failed Migration**\n\nTo resolve the issue, you need to revert the failed migration. You can do this by running the following command:\n\n```bash\nalembic revision --autogenerate", "metrics": { "length": 1099, "commands": 2, "command_list": [ "alembic --version", "alembic history" ], "has_command_block": true, "actionable": false, "inline_code_count": 4, "lesson_hits": 6, "lesson_hit_rate": 0.857 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A fork PR's workflow run is created as action_required: the suite exists and never executes (ci-fork-pr-run-held-as-action-required)", "condition": "with_lesson", "status": 200, "content": "To resolve the issue of a fork PR's workflow run being created as `action_required` but never executing, you need to ensure that the workflow file is being executed for the correct branch. Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Update the workflow file to use the `pull_request` event with the correct branch**\n\nOpen your workflow file in a text editor and update the `on: [pull_request]$` event to use the `pull_request` event with the correct branch. For example:\n\n```yaml\non:\n pull_request:\n branches:\n - main\n types:\n - opened\n - synchronize\n```\n\n**Step 2: Update the `pull_request` event to use the `pull_request.target.pull_request` property**\n\nUpdate the `pull_request` event to use the `pull_request.target.pull_request` property to ensure that the workflow is triggered with the correct pull request. For example:\n\n```yaml\non:\n pull_request:\n branches:\n - main\n types:\n - opened\n - synchronize\n pull_request:\n target:\n pull_request:\n pull_request: true\n```\n\n**Step 3: Update the `github.event.pull_request.number` property to", "metrics": { "length": 1129, "commands": 2, "command_list": [ "**Step 2: Update the `pull_request` event to use the `pull_request.target.pull_request` property**", "Update the `pull_request` event to use the `pull_request.target.pull_request` property to ensure that the workflow is triggered with the correct pull request. For example:" ], "has_command_block": true, "actionable": true, "inline_code_count": 12, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A fork PR's workflow run is created as action_required: the suite exists and never executes (ci-fork-pr-run-held-as-action-required)", "condition": "plain", "status": 200, "content": "The error message indicates that the workflow run is being held as an action_required due to the suite existing but never executing. This is likely caused by a missing `on: [push]` or `on: [pull_request]` trigger in your GitHub Actions workflow file.\n\nHere's a concrete, actionable fix:\n\n**Step 1: Update your workflow file**\n\nOpen your GitHub Actions workflow file (`.yml` file) and add the following lines at the top:\n\n```yml\non:\n push:\n branches:\n - main\n pull_request:\n types: [opened, synchronize]\n```\n\nReplace `main` with the name of your default branch.\n\n**Step 2: Update the workflow to execute on pull request creation**\n\nUpdate the `jobs` section of your workflow file to execute on pull request creation:\n\n```yml\njobs:\n build-and-test:\n runs-on: ubuntu-latest\n steps:\n - name: Checkout code\n uses: actions/checkout@v2\n - name: Run tests\n run: |\n # Your test commands here\n```\n\n**Step 3: Update the workflow to resolve the action_required error**\n\nTo resolve the `action_required` error, you can add a", "metrics": { "length": 1064, "commands": 3, "command_list": [ "Replace `main` with the name of your default branch.", "**Step 2: Update the workflow to execute on pull request creation**", "Update the `jobs` section of your workflow file to execute on pull request creation:" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "alembic upgrade head fails with exit code 255 or subprocess error (alembic-upgrade-head-failed)", "condition": "plain", "status": 200, "content": "**Troubleshooting Alembic Upgrade Issues**\n\nThe error `alembic upgrade head fails with exit code 255 or subprocess error (alembic-upgrade-head-failed)` can be caused by various reasons such as:\n\n* Inconsistent database schema\n* Missing or corrupted Alembic migration files\n* Permission issues\n* Outdated Alembic version\n\nTo resolve this issue, follow these concrete and actionable steps:\n\n### Step 1: Check the Alembic Version\n\nFirst, ensure that you're running the latest version of Alembic. You can check the current version using the following command:\n\n```bash\npip show alembic\n```\n\nIf you're running an outdated version, update it using:\n\n```bash\npip install --upgrade alembic\n```\n\n### Step 2: Inspect the Alembic Migration History\n\nRun the following command to inspect the Alembic migration history:\n\n```bash\nalembic history\n```\n\nThis will display a list of all the migrations that have been applied to your database. Look for any inconsistencies or missing migrations.\n\n### Step 3: Re-Apply the Latest Migration\n\nTry re-applying the latest migration using:\n\n```bash\nalembic upgrade base\n", "metrics": { "length": 1102, "commands": 3, "command_list": [ "pip show alembic", "pip install --upgrade alembic", "alembic history" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 6, "lesson_hit_rate": 0.857 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A GITHUB_TOKEN push cannot trigger workflows, so a branch sync freezes CI (ci-github-token-push-does-not-trigger-workflows)", "condition": "with_lesson", "status": 200, "content": "The issue you're experiencing is due to the GitHub token not being able to trigger workflows, which causes the branch sync to freeze CI. To fix this, you can use a personal access token instead of a GitHub token. Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Create a personal access token**\n\n1. Log in to your GitHub account.\n2. Click on your profile picture in the top right corner, then click on \"Settings\".\n3. Scroll down to the \"Developer settings\" section.\n4. Click on \"Personal access tokens\".\n5. Click on \"Generate new token\".\n6. Choose the \"repo\" and \"workflow\" scopes.\n7. Give the token a name (e.g., \"github-token-for-ci\").\n8. Click on \"Generate token\".\n\n**Step 2: Update your workflow file**\n\n1. Open your workflow file (e.g., `.github/workflows/workflow.yml`).\n2. Replace the `GITHUB_TOKEN` placeholder with the personal access token you created:\n```yaml\nname: CI\n\non:\n push:\n branches:\n - main\n\njobs:\n build:\n runs-on: ubuntu-latest\n steps:\n - name: Checkout code\n uses: actions/", "metrics": { "length": 1041, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 2, "lesson_hits": 2, "lesson_hit_rate": 0.25 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A GITHUB_TOKEN push cannot trigger workflows, so a branch sync freezes CI (ci-github-token-push-does-not-trigger-workflows)", "condition": "plain", "status": 200, "content": "The error message is indicating that GitHub is preventing a push to the repository because it's trying to trigger a workflow that can only be triggered by a pull request or a push to a specific branch (e.g., `main` or `master`).\n\nTo fix this issue, you need to update your GitHub repository settings to allow pushes to trigger workflows. Here are the steps:\n\n**Step 1: Go to your repository settings**\n\n1. Log in to your GitHub account and navigate to the repository where you're experiencing the issue.\n2. Click on the \"Settings\" icon (looks like a gear) in the top right corner of the page.\n3. Click on \"Actions\" from the left-hand menu.\n\n**Step 2: Update the workflow triggers**\n\n1. In the \"Actions\" tab, scroll down to the \"Workflows\" section.\n2. Click on the workflow that's causing the issue.\n3. Click on the \"Triggers\" tab.\n4. Click on the \"Add trigger\" button.\n5. Select \"Push events\" as the trigger type.\n6. Select the branch that you want to trigger the workflow for.\n7. Click on the \"Add\" button.\n\n**Step 3: Update the workflow permissions**\n\n1. In the", "metrics": { "length": 1063, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 2, "lesson_hits": 1, "lesson_hit_rate": 0.125 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "A fork PR's workflow run is created as action_required: the suite exists and never executes (ci-fork-pr-run-held-as-action-required)", "condition": "with_lesson", "status": 200, "content": "The issue is due to the fact that the workflow file is evaluated from the base branch of the pull request, which in this case is a stale feature branch. To fix this issue, you need to ensure that the workflow file is evaluated from the main branch.\n\nHere are the concrete, actionable steps to fix the issue:\n\n**Step 1: Verify the base branch**\n\nFirst, verify the base branch of the pull request:\n\n```bash\ngh api /repos/{o}/{r}/pulls/{p} --jq '.base.ref'\n```\n\nReplace `{o}`, `{r}`, and `{p}` with the owner, repository, and pull request number respectively.\n\n**Step 2: Update the base branch**\n\nIf the base branch is not `main`, update the pull request to target `main`:\n\n```bash\ngh pr update {p} --base main\n```\n\nReplace `{p}` with the pull request number.\n\n**Step 3: Verify the workflow file**\n\nVerify that the workflow file is evaluated from the `main` branch:\n\n```bash\ngh api /repos/{o}/{r}/pulls/{p}/check-runs --jq '.check_runs[0].name'\n```\n\nThis should output the name of the workflow file, which should be", "metrics": { "length": 1012, "commands": 3, "command_list": [ "gh api /repos/{o}/{r}/pulls/{p} --jq '.base.ref'", "gh pr update {p} --base main", "gh api /repos/{o}/{r}/pulls/{p}/check-runs --jq '.check_runs[0].name'" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 1, "lesson_hit_rate": 0.25 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "A fork PR's workflow run is created as action_required: the suite exists and never executes (ci-fork-pr-run-held-as-action-required)", "condition": "plain", "status": 200, "content": "The error \"A fork PR's workflow run is created as action_required: the suite exists and never executes (ci-fork-pr-run-held-as-action-required)\" is typically caused by a GitHub Actions workflow that is not properly configured to handle forked pull requests.\n\nTo fix this issue, you can try the following steps:\n\n**Step 1: Check the workflow file**\n\nOpen the `.yml` file that defines the workflow and check if it contains the following lines:\n```yaml\nname: CI\non:\n pull_request:\n types: [opened, synchronize, reopened]\njobs:\n build:\n runs-on: ubuntu-latest\n steps:\n - name: Checkout code\n uses: actions/checkout@v2\n```\nIf the `types` field is missing or does not include `opened`, `synchronize`, and `reopened`, update the workflow file to include these types.\n\n**Step 2: Add the `paths` field**\n\nAdd the `paths` field to the `on` section to specify the paths that should trigger the workflow:\n```yaml\non:\n pull_request:\n types: [opened, synchronize, reopened]\n paths:\n - '**/*.md' # trigger the workflow for Markdown files\n", "metrics": { "length": 1059, "commands": 3, "command_list": [ "If the `types` field is missing or does not include `opened`, `synchronize`, and `reopened`, update the workflow file to include these types.", "**Step 2: Add the `paths` field**", "Add the `paths` field to the `on` section to specify the paths that should trigger the workflow:" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "A GITHUB_TOKEN push cannot trigger workflows, so a branch sync freezes CI (ci-github-token-push-does-not-trigger-workflows)", "condition": "with_lesson", "status": 200, "content": "To resolve this issue, you need to update your repository automation to ignore the merge commit created by the bot. Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Update your repository automation script**\n\nThe script that merges `main` into the branches of open same-repo PRs should be updated to ignore the merge commit created by the bot. You can achieve this by adding a check to skip the merge commit.\n\nFor example, if you're using a script written in Bash, you can add the following check:\n```bash\n#!/bin/bash\n\n# Merge main into the branch\ngit merge --no-ff origin/main\n\n# Check if the merge commit is created by the bot\nif [ \"$(git show --no-patch --no-notes --format=%s HEAD)\" = \"Merge remote-tracking branch 'origin/main' into \" ]; then\n # Skip the merge commit if it's created by the bot\n git reset --hard HEAD~1\nfi\n```\n**Step 2: Update your GitHub Actions workflow**\n\nThe GitHub Actions workflow that triggers the branch sync should be updated to ignore the merge commit created by the bot. You can achieve this by adding a check to skip the merge commit.\n\nFor example, if", "metrics": { "length": 1112, "commands": 4, "command_list": [ "git merge --no-ff origin/main", "if [ \"$(git show --no-patch --no-notes --format=%s HEAD)\" = \"Merge remote-tracking branch 'origin/main' into \" ]; then", "git reset --hard HEAD~1", "fi" ], "has_command_block": true, "actionable": false, "inline_code_count": 2, "lesson_hits": 2, "lesson_hit_rate": 0.25 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "A GITHUB_TOKEN push cannot trigger workflows, so a branch sync freezes CI (ci-github-token-push-does-not-trigger-workflows)", "condition": "plain", "status": 200, "content": "To resolve the issue, you need to use a personal access token (PAT) instead of a GitHub token to trigger workflows. Here are the steps:\n\n**Step 1: Generate a Personal Access Token (PAT)**\n\n1. Log in to your GitHub account.\n2. Click on your profile picture in the top right corner and select \"Settings\".\n3. Click on \"Developer settings\" from the left menu.\n4. Click on \"Personal access tokens\" and then \"Generate new token\".\n5. Give your token a name, select the \"repo\" and \"workflow\" permissions, and click on \"Generate token\".\n6. Copy the generated token.\n\n**Step 2: Update Your GitHub Actions Secrets**\n\n1. Navigate to your repository's settings.\n2. Click on \"Actions\" from the left menu.\n3. Click on \"Secrets\" and then click on \"New secret\".\n4. Name the secret (e.g., \"GITHUB_PAT\") and paste the copied token.\n5. Click on \"Add secret\".\n\n**Step 3: Update Your Workflow File**\n\n1. Open your workflow file (e.g., `.github/workflows/main.yml`).\n2. Update the `GITHUB_TOKEN` to `GITHUB_PAT` in your workflow", "metrics": { "length": 1005, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 3, "lesson_hits": 2, "lesson_hit_rate": 0.25 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Docker multi-stage build OOM-killed with exit code 137 on GitHub Actions (docker-build-exit-137-multistage-oom)", "condition": "with_lesson", "status": 200, "content": "To fix the Docker multi-stage build OOM-killed issue, you can follow these steps:\n\n**Step 1: Split stages into separate jobs**\n\nUpdate your GitHub Actions YAML file to split the stages into separate jobs:\n\n```yml\nname: Docker Build\n\non:\n push:\n branches:\n - main\n\njobs:\n build-deps:\n runs-on: ubuntu-latest\n steps:\n - name: Build dependencies\n run: docker build --target deps -t app:deps .\n build-app:\n needs: build-deps\n runs-on: ubuntu-latest\n steps:\n - name: Build app\n run: docker build --target runtime -t app:runtime .\n```\n\n**Step 2: Reduce intermediate layer size**\n\nUpdate your Dockerfile to reduce the intermediate layer size:\n\n```dockerfile\nFROM node:20 AS build\nCOPY . .\nRUN npm install --no-cache && npm run build --no-cache\n```\n\nHere's what changed:\n\n* `--no-cache` tells Docker to skip caching the intermediate layer, reducing the memory usage.\n* `--no-cache` is also used for `npm install` and `npm run build` to prevent caching the build artifacts.\n\n**Additional recommendations:", "metrics": { "length": 1045, "commands": 2, "command_list": [ "**Step 2: Reduce intermediate layer size**", "Update your Dockerfile to reduce the intermediate layer size:" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Docker multi-stage build OOM-killed with exit code 137 on GitHub Actions (docker-build-exit-137-multistage-oom)", "condition": "plain", "status": 200, "content": "The \"docker-build-exit-137-multistage-oom\" error on GitHub Actions typically occurs when the Docker build process runs out of memory (OOM). Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Increase the Docker build cache size**\n\nThe Docker build cache can help reduce the build time and memory usage. Increase the cache size by setting the `DOCKER_CACHE_SIZE` environment variable.\n\n```yaml\nenv:\n DOCKER_CACHE_SIZE: 10G\n```\n\n**Step 2: Use a larger Docker image**\n\nIf your Docker image is too large, it can consume a lot of memory during the build process. Try using a larger image or reducing the size of your image by removing unnecessary layers.\n\n```bash\n# Use the official Python image\nfrom python:3.9-slim\n\n# Use the official Node.js image\nfrom node:14-slim\n```\n\n**Step 3: Use multi-stage builds**\n\nMulti-stage builds can help reduce the size of your Docker image and memory usage during the build process.\n\n```yaml\nstages:\n - build\n - test\n - deploy\n\nbuild:\n stage: build\n script:\n - docker build --no-cache -t my-image .\n ", "metrics": { "length": 1054, "commands": 4, "command_list": [ "**Step 2: Use a larger Docker image**", "If your Docker image is too large, it can consume a lot of memory during the build process. Try using a larger image or reducing the size of your image by removing unnecessary layers.", "**Step 3: Use multi-stage builds**", "Multi-stage builds can help reduce the size of your Docker image and memory usage during the build process." ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "LLM cost telemetry undercounting: wrong model label + discarded retries invisible (llm-cost-telemetry-undercount)", "condition": "plain", "status": 200, "content": "The error you're experiencing is due to an issue with the cost telemetry of your LLM model. Here's a step-by-step guide to help you resolve the issue:\n\n**Fix:**\n\n1. **Update your model**: Make sure you're running the latest version of your model. You can do this by updating your model using the following command:\n ```bash\npip install --upgrade transformers\n```\n Then, retrain your model using the following command:\n ```bash\npython -m transformers.trainer --model_name_or_path your_model_name --train_file your_train_file --eval_file your_eval_file --output_dir your_output_dir\n```\n\n2. **Increase the number of retries**: The error message indicates that retries are being discarded. You can increase the number of retries by setting the `max_retries` argument in the `CostTelemetry` configuration. You can do this by adding the following configuration to your `config.json` file:\n ```json\n{\n \"CostTelemetry\": {\n \"max_retries\": 3\n }\n}\n```\n\n3. **Increase the model's learning rate**: The error message also indicates that the model's learning rate might be too low. You can increase the learning rate by setting the `", "metrics": { "length": 1131, "commands": 2, "command_list": [ "pip install --upgrade transformers", "python -m transformers.trainer --model_name_or_path your_model_name --train_file your_train_file --eval_file your_eval_file --output_dir your_output_dir" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "LLM cost telemetry undercounting: wrong model label + discarded retries invisible (llm-cost-telemetry-undercount)", "condition": "with_lesson", "status": 200, "content": "To fix the issue, you'll need to make the following changes to your code:\n\n1. Add a `model_served` field to the `ChatResult` struct to store the actual model served by the provider.\n\n2. Update the `ChatResult` struct to include the `model_served` field.\n\n3. Create a new field in the `ChatResult` struct to store the `model_served` field when the model is different from the requested model.\n\n4. Update the code that reads the `ChatResult` struct to set the `model_served` field when it differs from the requested model.\n\n5. Use the `model_served` field to calculate the cost metrics.\n\nHere's a concrete, actionable fix with exact commands:\n\n```bash\n# Create a new field in the ChatResult struct to store the model_served field\ngo mod edit\ngo mod tidy\n\n# Create a new file called chat_result.go with the following content\npackage chat\n\nimport (\n \"errors\"\n \"fmt\"\n)\n\n// ChatResult represents the result of a chat request\ntype ChatResult struct {\n // ... existing fields ...\n Model string `json:\"model\"`\n ModelServed string `json:\"model_served\"`\n", "metrics": { "length": 1063, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 11, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Mock attribute cascade — adding attribute access breaks existing tests (mock-attribute-cascade-test-breakage)", "condition": "with_lesson", "status": 200, "content": "Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Update your tests to include all required attributes**\n\nOpen the test file that's causing the error, e.g., `test_my_module.py`. Update the line where you're mocking `trial.paths` to include all the attributes that your production code now touches:\n\n```python\nimport unittest\nfrom unittest.mock import SimpleNamespace\nimport os\nimport tmpdir\n\nclass TestMyModule(unittest.TestCase):\n def test_something(self):\n # ...\n trial.paths = SimpleNamespace(\n trial_dir=tmpdir,\n config_path=tmpdir / \"_config_sentinel.json\",\n result_path=tmpdir / \"_result_sentinel.json\",\n )\n # ...\n```\n\n**Step 2: Use `spec` to auto-enforce the mock object's attribute surface**\n\nUpdate your test to use the `spec` parameter when creating the mock object:\n\n```python\nimport unittest\nfrom unittest.mock import Mock\nfrom my_module import RealPaths # Replace with the actual module name\n\nclass TestMyModule(unittest.TestCase):\n def test_something(self):\n # ...\n trial.paths = Mock(spec=RealPaths)\n trial.paths.config_path = os.path.join(tmpdir, \"_config_sentinel.json\")\n", "metrics": { "length": 1193, "commands": 2, "command_list": [ "**Step 2: Use `spec` to auto-enforce the mock object's attribute surface**", "Update your test to use the `spec` parameter when creating the mock object:" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Mock attribute cascade — adding attribute access breaks existing tests (mock-attribute-cascade-test-breakage)", "condition": "plain", "status": 200, "content": "The \"Mock attribute cascade\" error typically occurs when you're trying to use the `@mock.patch` decorator from the `unittest.mock` library to mock an attribute of an object, and then you're trying to access that attribute on the same object.\n\nHere's a concrete example of how this might happen:\n\n```python\nimport unittest\nfrom unittest.mock import patch, MagicMock\n\nclass MyClass:\n def __init__(self):\n self._private_attr = 'private value'\n\n @property\n def public_attr(self):\n return self._private_attr\n\ndef test_my_class():\n obj = MyClass()\n with patch('my_module.MyClass._private_attr', 'mocked value') as mock_attr:\n print(obj.public_attr)\n```\n\nIn this example, the `patch` decorator is used to mock the `_private_attr` attribute of the `MyClass` object. However, when we try to access `obj.public_attr`, Python will try to access the mocked `_private_attr` attribute, which breaks the mock.\n\nTo fix this issue, we need to avoid accessing the mocked attribute directly. Instead, we can create a new property on the object that returns the mocked attribute:\n\n```python\nimport unittest\nfrom unittest.mock import patch, MagicMock\n\nclass", "metrics": { "length": 1172, "commands": 2, "command_list": [ "In this example, the `patch` decorator is used to mock the `_private_attr` attribute of the `MyClass` object. However, when we try to access `obj.public_attr`, Python will try to access the mocked `_private_attr` attribute, which breaks the mock.", "To fix this issue, we need to avoid accessing the mocked attribute directly. Instead, we can create a new property on the object that returns the mocked attribute:" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "NPC dispatch causes spatial bilocation and active speaker loss (npc-dispatch-speaker-dislocation)", "condition": "with_lesson", "status": 200, "content": "To address the issue of NPC dispatch causing spatial bilocation and active speaker loss, you can implement the following changes:\n\n**Step 1: Modify the speaker resolution mechanism to preserve the active speaker**\n\nIn your `speaker_resolution` function, add a new branch to handle unresolved references. This branch should keep the current active speaker instead of defaulting to the protagonist.\n\n```python\ndef speaker_resolution(context, reference):\n # ... (existing code)\n \n # New branch to handle unresolved references\n if reference not in context['present_npcs']:\n # Keep the current active speaker\n return context['active_speaker']\n # ... (existing code)\n```\n\n**Step 2: Enforce spatial consistency per scene**\n\nTo ensure that the scene location tracks the correct speaker, you can modify the `scene_location` function to validate the speaker attribution.\n\n```python\ndef scene_location(context, speaker):\n # ... (existing code)\n \n # Validate speaker attribution\n if speaker not in context['present_npcs']:\n raise ValueError(\"Speaker mismatch: expected {} but found {}\".format(speaker, context['active_speaker']))\n # ... (existing code)\n```\n\n**Step 3: Update the NPC dispatch mechanism**\n\nIn your `npc_dispatch`", "metrics": { "length": 1266, "commands": 2, "command_list": [ "**Step 2: Enforce spatial consistency per scene**", "To ensure that the scene location tracks the correct speaker, you can modify the `scene_location` function to validate the speaker attribution." ], "has_command_block": true, "actionable": false, "inline_code_count": 6, "lesson_hits": 1, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "pkill -f kills the shell that runs it: the pattern matches its own command line (pkill-pattern-matches-its-own-shell)", "condition": "with_lesson", "status": 200, "content": "To avoid the issue of `pkill -f` killing its own shell, you can use `pgrep -f` to find the PID of the process you want to kill, and then use `kill` with the PID to kill the process directly.\n\nHere's a concrete, actionable fix with exact commands:\n\n```bash\n# Find the PID of the process you want to kill\npgrep -f \"http.server 8877\"\n\n# Get the PID from the output\nPID=$(pgrep -f \"http.server 8877\")\n\n# Kill the process directly\nkill $PID\n```\n\nThis approach avoids the problem of `pkill -f` matching against its own command line and killing the shell before the kill is reported.\n\nAlternatively, you can use `killall` instead of `pkill -f`:\n\n```bash\n# Find the PID of the process you want to kill\npgrep -f \"http.server 8877\"\n\n# Get the PID from the output\nPID=$(pgrep -f \"http.server 8877\")\n\n# Kill the process directly\nkillall http.server 8877\n```\n\n`killall` is a safer alternative to `pkill -f` because it only kills the process with the specified name", "metrics": { "length": 951, "commands": 6, "command_list": [ "pgrep -f \"http.server 8877\"", "PID=$(pgrep -f \"http.server 8877\")", "kill $PID", "pgrep -f \"http.server 8877\"", "PID=$(pgrep -f \"http.server 8877\")" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 1, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "NPC dispatch causes spatial bilocation and active speaker loss (npc-dispatch-speaker-dislocation)", "condition": "plain", "status": 200, "content": "The error `npc-dispatch-speaker-dislocation` typically occurs when an NPC (Non-Player Character) is dispatched to a location that has an active speaker, causing the NPC to lose its active speaker and potentially become stuck or behave erratically.\n\nTo fix this issue, you can try the following commands:\n\n**Command 1: Reset the NPC's speaker**\n\nOpen the console and type the following command to reset the NPC's speaker:\n```\nresetactor \n```\nReplace `` with the actual name of the NPC that is causing the issue.\n\n**Command 2: Force the NPC to re-assign a speaker**\n\nIf the above command doesn't work, you can try forcing the NPC to re-assign a speaker:\n```\nresetspeaker \n```\nAgain, replace `` with the actual name of the NPC.\n\n**Command 3: Remove and re-add the NPC**\n\nIf the above commands don't work, you can try removing the NPC from the game and re-adding it:\n```\nremoveactor \naddactor \n```\nReplace `` with the actual name of the NPC.\n\n**Command 4: Check for conflicting actors**\n\nIf the issue", "metrics": { "length": 1066, "commands": 4, "command_list": [ "resetactor ", "resetspeaker ", "removeactor ", "addactor " ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "pkill -f kills the shell that runs it: the pattern matches its own command line (pkill-pattern-matches-its-own-shell)", "condition": "plain", "status": 200, "content": "The issue you're experiencing is due to the fact that `pkill` matches its own command line, which prevents it from killing itself. To avoid this, you can use the following command instead:\n\n```bash\npgrep -f \"pkill *\"\n```\n\nHere's what's happening in this command:\n\n- `pgrep` is a command that finds the process ID of a process based on a pattern.\n- `-f` option tells `pgrep` to use a regular expression to match the pattern.\n- `\"pkill *\"` is the pattern that matches the command `pkill` with any arguments (`*` matches any characters).\n\nThis command will find the process ID of the `pkill` command that matches the pattern, and then you can use that process ID to kill the process.\n\nAlternatively, you can also use the following command:\n\n```bash\npgrep -f \"pkill $0\"\n```\n\nIn this command, `$0` is a special variable in bash that represents the command name. This command will match the process ID of the `pkill` command that matches its own command name.\n\nBoth of these commands will avoid the issue of `pkill` matching its own command line.", "metrics": { "length": 1040, "commands": 2, "command_list": [ "pgrep -f \"pkill *\"", "pgrep -f \"pkill $0\"" ], "has_command_block": true, "actionable": true, "inline_code_count": 14, "lesson_hits": 1, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "SSE streaming returns no data through reverse proxy (sse-streaming-failure-via-proxy)", "condition": "with_lesson", "status": 200, "content": "To fix the issue of SSE streaming not working through a reverse proxy, you can follow these steps:\n\n**For Nginx:**\n\n1. Add the following configuration to your Nginx server to disable buffering for SSE endpoints:\n\n```nginx\nlocation /sse {\n proxy_pass http://backend:8000;\n proxy_buffering off; critical: don't buffer SSE chunks\n proxy_cache off; don't cache streaming responses\n proxy_read_timeout 86400s; SSE connections are long-lived\n chunked_transfer_encoding on; pass chunks through as-is\n proxy_set_header Connection ''; disable keepalive pooling\n}\n```\n\n2. Restart the Nginx server to apply the changes.\n\n**For Caddy:**\n\n1. Add the following configuration to your Caddyfile to disable buffering:\n\n```caddy\nhttp://:80 {\n flush_interval -1;\n}\n```\n\n2. Restart the Caddy server to apply the changes.\n\n**For Cloudflare:**\n\n1. In the Cloudflare dashboard, navigate to the \"SSL/TLS\" section.\n2. Click on \"Proxy Settings\".\n3. In the \"Buffering\" section, select \"Off\" for the \"Buffering\" option.\n4. Click", "metrics": { "length": 1055, "commands": 3, "command_list": [ "2. Restart the Nginx server to apply the changes.", "**For Caddy:**", "1. Add the following configuration to your Caddyfile to disable buffering:" ], "has_command_block": true, "actionable": false, "inline_code_count": 3, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "SSE streaming returns no data through reverse proxy (sse-streaming-failure-via-proxy)", "condition": "plain", "status": 200, "content": "The error you're encountering, \"sse-streaming-failure-via-proxy,\" typically occurs when a server behind a reverse proxy is unable to handle Server-Sent Events (SSE) properly. This can be due to various reasons such as the reverse proxy not properly handling the `Connection: keep-alive` header or the server not sending the `Content-Type: text/event-stream` header.\n\nHere's a step-by-step guide to fix this issue:\n\n**Step 1: Update your reverse proxy configuration**\n\nYou need to update your reverse proxy configuration to properly handle SSE. Here's an example configuration for Nginx:\n\n```bash\nhttp {\n ...\n server {\n listen 80;\n server_name example.com;\n\n location / {\n proxy_pass http://localhost:8080;\n proxy_http_version 1.1;\n proxy_set_header Upgrade $http_upgrade;\n proxy_set_header Connection 'upgrade';\n proxy_set_header Host $host;\n proxy_cache_bypass $http_upgrade;\n }\n }\n}\n```\n\nIn this example, we're setting the `proxy_set_header` directives to handle the `Upgrade` and `Connection` headers, which are required for SSE.\n\n**Step 2: Update your server configuration**\n\nYou also need to", "metrics": { "length": 1199, "commands": 15, "command_list": [ "http {", "...", "server {", "listen 80;", "server_name example.com;" ], "has_command_block": true, "actionable": false, "inline_code_count": 6, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "LLM god-moding: model speaks or acts for the user in roleplay (godmoding-model-acts-for-user)", "condition": "with_lesson", "status": 200, "content": "To prevent godmoding in LLM roleplay conversations, you can use the following three-layer defense:\n\n**Layer 1: Add a \"turn boundary\" prompt**\n\n* Before starting a roleplay conversation, add a prompt that explicitly sets a turn boundary. For example:\n ```\n Roleplay: I'm Maria, and I'm exploring a mysterious mansion. You can give me commands or ask me questions. I'll respond as Maria. Go ahead and start.\n ```\n\n**Layer 2: Use \"I think\" statements**\n\n* When the model generates dialogue, use \"I think\" statements to indicate that it's the model's interpretation of the user's character's thoughts. For example:\n ```\n Assistant: I think Maria says, \"I'm not sure what's going on.\"\n ```\n\n**Layer 3: Explicitly ask for user input**\n\n* After each action or dialogue block, explicitly ask the user for input. For example:\n ```\n You open the door slowly. What do you do next?\n ```\n\nBy using these three-layer defense, you can ensure that the model doesn't take agency away from the user and that the user's character is not controlled by the model.\n\nHere's an example of how these prompts would", "metrics": { "length": 1097, "commands": 3, "command_list": [ "Roleplay: I'm Maria, and I'm exploring a mysterious mansion. You can give me commands or ask me questions. I'll respond as Maria. Go ahead and start.", "Assistant: I think Maria says, \"I'm not sure what's going on.\"", "You open the door slowly. What do you do next?" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "LLM god-moding: model speaks or acts for the user in roleplay (godmoding-model-acts-for-user)", "condition": "plain", "status": 200, "content": "To fix the \"LLM god-moding: model speaks or acts for the user in roleplay (godmoding-model-acts-for-user)\" error, you can try the following steps:\n\n1. **Disable Roleplaying**: If you're using Discord or another platform for roleplaying, try disabling it temporarily to see if the issue persists. You can do this by going to your server settings or channel settings and looking for the roleplaying or \"Godmode\" option.\n\n2. **Use a Roleplaying Bot**: If you're using a bot to facilitate roleplaying, consider using a bot that has a built-in mechanism to prevent godmoding. Some popular roleplaying bots include:\n - `!rp` (for Discord)\n - `!roleplay` (for Discord)\n - `@Roleplay` (for Discord)\n - `!rpg` (for Discord)\n\n You can install these bots using the Discord Bot List or other third-party platforms.\n\n3. **Implement a Roleplaying System**: If you're not using a bot, you can implement a simple roleplaying system using commands. Here's an example using Discord's slash commands:\n - `/start` to begin a new roleplaying scenario\n - `/help` to see", "metrics": { "length": 1061, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 6, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Prompt cache prefix invalidation causes location hallucination in roleplay (prompt-cache-prefix-invalidation-roleplay)", "condition": "plain", "status": 200, "content": "The error \"Prompt cache prefix invalidation causes location hallucination in roleplay\" is typically caused by an issue with the LLM (Large Language Model) prompt cache. Here's a concrete, actionable fix:\n\n**Step 1: Clear the LLM cache**\n\nYou can try clearing the LLM cache by running the following command in your terminal:\n\n```bash\nlm-cleanup\n```\n\n**Step 2: Update the LLM model**\n\nIf the above step doesn't work, you can try updating the LLM model to the latest version. Here are the steps:\n\n- For Discord LLM:\n ```bash\n!update\n```\n\n- For Discord Bot LLM:\n ```bash\n!llm update\n```\n\n- For other LLM platforms (e.g., GitHub LLM):\n Please refer to the documentation of the specific LLM platform you're using.\n\n**Step 3: Reset the LLM cache**\n\nIf updating the model doesn't work, you can try resetting the LLM cache. Here are the steps:\n\n- For Discord LLM:\n ```bash\n!cache reset\n```\n\n- For Discord Bot LLM:\n ```bash\n!llm cache reset\n```\n\n- For other LLM platforms (e.g", "metrics": { "length": 971, "commands": 5, "command_list": [ "lm-cleanup", "!update", "!llm update", "!cache reset", "!llm cache reset" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Prompt cache prefix invalidation causes location hallucination in roleplay (prompt-cache-prefix-invalidation-roleplay)", "condition": "with_lesson", "status": 200, "content": "To fix the \"Prompt cache prefix invalidation causes location hallucination in roleplay\" error, you can modify your code to inject the location into the dynamic prompt. Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Modify the stable prompt**\n\nModify the `stable_prompt` to include the location, but keep it in the stable prefix:\n\n```python\nstable_prompt = f\"\"\"You are {character.name}. Setting: {location}. ...\"\"\"\n```\n\n**Step 2: Modify the dynamic prompt**\n\nModify the `dynamic_prompt` to include the location in the dynamic prefix, high-recency position:\n\n```python\ndynamic_prompt = f\"\"\"CURRENT SCENE STATE (always enforce):\n- Location: {current_location}\n- Characters present: {present_characters}\n- Time: {current_time}\n\nRecent conversation:\n{recent_turns}\"\"\"\n```\n\nHowever, to truly fix the issue, you need to ensure that the location is always in the dynamic prefix. Here's how you can modify your code to do that:\n\n**Step 3: Modify the dynamic prompt to always include the location**\n\nYou can use a technique called \"anti-regression constraints\" to ensure that the location is always in the dynamic prefix. Here's how you can modify your code", "metrics": { "length": 1166, "commands": 2, "command_list": [ "**Step 2: Modify the dynamic prompt**", "Modify the `dynamic_prompt` to include the location in the dynamic prefix, high-recency position:" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Pronoun misidentified as NPC in roleplay extraction (pronoun-treated-as-instruction-roleplay)", "condition": "with_lesson", "status": 200, "content": "Here's a concrete, actionable fix for the issue:\n\n**Step 1: Add a blacklist filter to the NPC extraction LLM**\n\nUpdate the NPC extraction LLM to use a deterministic blacklist filter after extraction. This filter will exclude pronouns and generic user terms from being treated as NPCs.\n\n**Step 2: Implement whole-word boundary matching**\n\nUse regular expressions to match whole words in the text, rather than matching individual characters. This will prevent the LLM from treating pronouns as separate entities.\n\nHere's an updated implementation in Python:\n\n```python\nimport re\nfrom typing import List, Dict\n\nINVALID_NPC_NAMES = {\n \"ele\", \"ela\", \"eles\", \"elas\", \"o\", \"a\", \"os\", \"as\",\n \"he\", \"she\", \"they\", \"him\", \"her\", \"them\",\n \"user\", \"player\", \"you\", \"eu\", \"você\", \"tu\",\n}\n\ndef is_invalid_npc_name(name: str) -> bool:\n return name.lower().strip() in INVALID_NPC_NAMES\n\ndef purge_invalid_npcs(npcs: List[Dict]) -> List[Dict]:\n return [npc for npc in npcs if not is_invalid_npc_name(npc[\"name\"])]\n\ndef match", "metrics": { "length": 1022, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Pronoun misidentified as NPC in roleplay extraction (pronoun-treated-as-instruction-roleplay)", "condition": "plain", "status": 200, "content": "The error message \"Pronoun misidentified as NPC in roleplay extraction (pronoun-treated-as-instruction-roleplay)\" suggests that the model is treating pronouns as instructions or commands instead of pronouns referring to characters in a roleplay.\n\nHere's a concrete, actionable fix with exact commands:\n\n**For Text Analysis Tools:**\n\n1. Open your text analysis tool (e.g., Natural Language Toolkit, NLTK, spaCy, etc.).\n2. Load your text data into the tool.\n3. Run the following code to extract pronouns:\n ```python\nimport nltk\nfrom nltk.tokenize import word_tokenize\n\n# Load the text data\ntext = \"Your text here\"\n\n# Tokenize the text\ntokens = word_tokenize(text)\n\n# Filter out pronouns\npronouns = [token for token in tokens if token.lower() in ['i', 'me', 'my', 'myself', 'you', 'your', 'yours', 'he', 'him', 'his', 'she', 'her', 'hers', 'it', 'its', 'itself', 'we', 'our', 'ours', 'ourselves', 'they', 'them', 'their', 'theirs', 'themselves']]\n\n#", "metrics": { "length": 948, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Vertex AI vs Gemini model ID naming conventions differ (vertex-gemini-model-id-naming)", "condition": "with_lesson", "status": 200, "content": "To fix the error, you need to map the provider to the model ID and endpoint explicitly. Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Create a new file `config.py`**\n\nCreate a new file named `config.py` in your project directory. This file will contain the provider configurations.\n\n```python\n# config.py\n\nPROVIDER_CONFIG = {\n \"gemini\": {\n \"base_url\": \"https://generativelanguage.googleapis.com/v1beta\",\n \"model_id\": \"gemini-2.0-flash\",\n \"auth\": \"GOOGLE_API_KEY\",\n },\n \"vertex\": {\n \"base_url\": \"https://{region}-aiplatform.googleapis.com/v1/projects/{project}/locations/{region}/publishers/google/models\",\n \"model_id\": \"gemini-2.0-flash\",\n \"auth\": \"GOOGLE_APPLICATION_CREDENTIALS\",\n },\n # Add other providers as needed\n}\n```\n\n**Step 2: Update your code to use the `config.py` file**\n\nUpdate your code to import the `PROVIDER_CONFIG` from the `config.py` file. Here's an example:\n\n```python\n# main.py\n\nimport os\nimport json", "metrics": { "length": 999, "commands": 2, "command_list": [ "**Step 2: Update your code to use the `config.py` file**", "Update your code to import the `PROVIDER_CONFIG` from the `config.py` file. Here's an example:" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Vertex AI vs Gemini model ID naming conventions differ (vertex-gemini-model-id-naming)", "condition": "plain", "status": 200, "content": "The error you're encountering is due to a difference in naming conventions between Vertex AI and Gemini models. Here's a step-by-step solution to resolve this issue:\n\n**For Vertex AI models:**\n\n1. Identify the correct naming convention for your Vertex AI model. The correct naming convention is `projects-project-id-model-id`.\n2. Check if your model ID is in the correct format. The model ID should be in the format `projects-project-id-model-id`.\n\n**For Gemini models:**\n\n1. Identify the correct naming convention for your Gemini model. The correct naming convention is `projects-project-id-model-id-variant`.\n2. Check if your model ID is in the correct format. The model ID should be in the format `projects-project-id-model-id-variant`.\n\n**Fix:**\n\nTo fix the error, you need to update the model ID to match the correct naming convention for your model type.\n\n**For Vertex AI models:**\n\nIf your model is a Vertex AI model, update the model ID to include the variant:\n```bash\ngcloud ai-platform models update \\\n --model-id=projects//models/-variant\n```\nReplace `` with the name of your model, `` with", "metrics": { "length": 1157, "commands": 2, "command_list": [ "gcloud ai-platform models update \\", "--model-id=projects//models/-variant" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A corpus cached in one row has a ceiling, and the diagnosis cannot live in that row (a-corpus-cached-in-one-row-has-a-ceiling)", "condition": "plain", "status": 200, "content": "To fix the error \"A corpus cached in one row has a ceiling, and the diagnosis cannot live in that row,\" you'll need to update the ceiling value for the corpus. Here's a step-by-step solution:\n\n**Assumptions:**\n\n* You're using a MySQL database.\n* The error message suggests that the corpus has a ceiling value, which is a column in the database table.\n* The diagnosis you're trying to insert into the table has a ceiling value that exceeds the existing ceiling value of the corpus.\n\n**Solution:**\n\n1. **Identify the table and columns involved:**\n The error message doesn't specify the table name, but based on the error message, we can assume it's related to a table that stores corpora and diagnoses. Let's assume the table name is `corpora` and the columns are `id`, `corpus`, `ceiling`, and `diagnosis`.\n\n2. **Check the ceiling value of the corpus:**\n Run the following query to check the ceiling value of the corpus:\n ```sql\nSELECT ceiling FROM corpora WHERE id = [insert_id];\n```\n Replace `[insert_id]` with the actual ID of the corpus you're working with.\n\n3. **Update the ceiling value", "metrics": { "length": 1099, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 6, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A stubbed success is not a sandbox — a faked `git push` let the suite rewrite the published index (a-stubbed-success-is-not-a-sandbox)", "condition": "with_lesson", "status": 200, "content": "The issue you're encountering is due to a stubbed success in your test, which is causing the test suite to rewrite the published index. This is because the test is expecting the `git push` operation to be successful, but it's actually being stubbed.\n\nTo fix this, you need to ensure that the test suite doesn't rewrite the published index when a stubbed success is encountered. Here's a concrete, actionable fix:\n\n**Step 1: Update the `pytest.ini` file**\n\nAdd the following line to your `pytest.ini` file:\n```ini\n[pytest]\naddopts = --no-capture=auto\n```\nThis will prevent pytest from automatically capturing the output of the `git push` command.\n\n**Step 2: Update the `test_lesson_page_generator.py` file**\n\nModify the `test_lesson_page_generator.py` file to use a `mock` library to stub the `git push` command instead of actually running it. You can use the `pytest-mock` library to achieve this.\n\nFirst, install the `pytest-mock` library:\n```bash\npip install pytest-mock\n```\nThen, modify the `test_lesson_page_generator.py` file as follows:\n```python\nimport pytest\nfrom pytest", "metrics": { "length": 1078, "commands": 5, "command_list": [ "This will prevent pytest from automatically capturing the output of the `git push` command.", "**Step 2: Update the `test_lesson_page_generator.py` file**", "Modify the `test_lesson_page_generator.py` file to use a `mock` library to stub the `git push` command instead of actually running it. You can use the `pytest-mock` library to achieve this.", "First, install the `pytest-mock` library:", "Then, modify the `test_lesson_page_generator.py` file as follows:" ], "has_command_block": true, "actionable": true, "inline_code_count": 15, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A corpus cached in one row has a ceiling, and the diagnosis cannot live in that row (a-corpus-cached-in-one-row-has-a-ceiling)", "condition": "with_lesson", "status": 200, "content": "To fix the issue of a corpus cached in one row having a ceiling and the diagnosis cannot live in that row, you can try the following steps:\n\n**Step 1: Check the size of the index**\n\nRun the following command to check the size of the index:\n```bash\ncloudflare d1 storage row get --size \n```\nReplace `` with the ID of the row that contains the index.\n\n**Step 2: Increase the size cap**\n\nIf the index is too large, you can increase the size cap of the row. Run the following command:\n```bash\ncloudflare d1 storage row update --size 4M \n```\nThis will increase the size cap of the row to 4MB.\n\n**Step 3: Rebuild the index**\n\nRun the following command to rebuild the index:\n```bash\ncloudflare d1 storage row rebuild \n```\nThis will rebuild the index and update the size cap.\n\n**Step 4: Refresh the index**\n\nRun the following command to refresh the index:\n```bash\ncloudflare d1 storage row refresh \n```\nThis will refresh the index and update the size cap.\n\n**Step 5: Check", "metrics": { "length": 1004, "commands": 4, "command_list": [ "cloudflare d1 storage row get --size ", "cloudflare d1 storage row update --size 4M ", "cloudflare d1 storage row rebuild ", "cloudflare d1 storage row refresh " ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "A corpus cached in one row has a ceiling, and the diagnosis cannot live in that row (a-corpus-cached-in-one-row-has-a-ceiling)", "condition": "plain", "status": 200, "content": "The error \"a corpus cached in one row has a ceiling, and the diagnosis cannot live in that row\" is typically encountered when working with Pandas DataFrames in Python, specifically when using the `to_excel()` method to save a DataFrame to an Excel file.\n\nHere's a concrete, actionable fix:\n\n**Step 1: Check for duplicate columns**\n\nBefore saving the DataFrame to an Excel file, check for duplicate columns. If you have duplicate columns, you'll need to remove or rename them.\n\n```python\nimport pandas as pd\n\n# assume df is your DataFrame\ndf = pd.DataFrame({\n 'A': [1, 2, 3],\n 'B': [4, 5, 6],\n 'A': [7, 8, 9] # duplicate column\n})\n\n# check for duplicate columns\nprint(df.columns.duplicated()) # prints [True]\n\n# remove duplicate columns\ndf = df.loc[:, ~df.columns.duplicated()]\nprint(df.columns) # prints ['A', 'B']\n```\n\n**Step 2: Save the DataFrame to an Excel file**\n\nOnce you've removed or renamed any duplicate columns, you can save the DataFrame to an Excel file using the `to_excel()` method.\n\n```python", "metrics": { "length": 1020, "commands": 2, "command_list": [ "**Step 2: Save the DataFrame to an Excel file**", "Once you've removed or renamed any duplicate columns, you can save the DataFrame to an Excel file using the `to_excel()` method." ], "has_command_block": true, "actionable": false, "inline_code_count": 4, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "A corpus cached in one row has a ceiling, and the diagnosis cannot live in that row (a-corpus-cached-in-one-row-has-a-ceiling)", "condition": "with_lesson", "status": 200, "content": "**Fix: Shard the Index to Avoid Size Limitation**\n\nThe root cause of the issue is the size limitation of the storage row where the published index is stored. To fix this, we need to shard the index into multiple smaller pieces, each stored in a separate row. This will allow us to avoid the size limitation and ensure that the index remains up-to-date.\n\n**Step 1: Update the Index Sharding Configuration**\n\nUpdate the `cloudflare.json` file to enable sharding:\n```json\n{\n \"crons\": [\"/15 \"],\n \"indexSharding\": {\n \"enabled\": true,\n \"shardSize\": 1000 // adjust this value based on your needs\n }\n}\n```\nThis configuration enables sharding and sets the shard size to 1000 documents.\n\n**Step 2: Update the Index Build Script**\n\nUpdate the `build_index.py` script to shard the index:\n```python\nimport os\nimport json\nimport requests\n\n# ... (rest of the script remains the same)\n\n# Shard the index\nshard_size = 1000\nnum_shards = -(-len(lessons) // shard_size) # calculate the number of shards\n\nfor i in range(num_shards):\n", "metrics": { "length": 1025, "commands": 3, "command_list": [ "This configuration enables sharding and sets the shard size to 1000 documents.", "**Step 2: Update the Index Build Script**", "Update the `build_index.py` script to shard the index:" ], "has_command_block": true, "actionable": true, "inline_code_count": 4, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A stubbed success is not a sandbox — a faked `git push` let the suite rewrite the published index (a-stubbed-success-is-not-a-sandbox)", "condition": "plain", "status": 200, "content": "The error message is indicating that a stubbed success (i.e., a test that passes) is not a sandbox, which means that the test is rewriting the published index. This is likely due to the fact that the test is modifying the repository's state, which is not allowed in a sandbox environment.\n\nTo fix this issue, you can try the following:\n\n1. **Use `--no-rewrite-index` flag**: You can use the `--no-rewrite-index` flag when running your test to prevent it from rewriting the published index. Here's an example command:\n\n ```bash\n./run-tests.sh --no-rewrite-index\n```\n\n This will run your tests without rewriting the published index.\n\n2. **Use a different test environment**: If the above solution doesn't work, you can try running your tests in a different environment, such as a separate branch or a different repository. This will ensure that your tests are not modifying the published index.\n\n ```bash\n# Create a new branch\ngit checkout -b test-branch\n\n# Run your tests\n./run-tests.sh\n\n# Switch back to the original branch\ngit checkout master\n```\n\n3. **Use a sandboxed test environment**: If you're using a testing", "metrics": { "length": 1127, "commands": 4, "command_list": [ "./run-tests.sh --no-rewrite-index", "git checkout -b test-branch", "./run-tests.sh", "git checkout master" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Supervise macOS Chrome Headless PDF Generation and Handle Process Timeouts (macos-chrome-headless-pdf-supervision)", "condition": "with_lesson", "status": 200, "content": "To fix the issue of Chrome remaining alive after generating PDFs on macOS, you can use the following approach:\n\n1. **Wait for the PDF file to be written to disk**: Before trying to close the Chrome process, wait for the PDF file to be written to disk. You can do this by checking the file's last modified time.\n\n2. **Use the `--print-to-pdf` flag with the `--disable-printing` flag**: By default, the `--print-to-pdf` flag doesn't work when Chrome is running in headless mode. To fix this, you can use the `--disable-printing` flag to enable printing, and then use `--print-to-pdf` to generate the PDF.\n\n3. **Use `osascript` to close the Chrome process**: Instead of relying on the `subprocess` module to close the Chrome process, you can use `osascript` to send a quit command to the Chrome process.\n\nHere is a concrete, actionable fix:\n\n```bash\n#!/bin/bash\n\n# Wait for the PDF file to be written to disk\nwhile [ ! -f \"output.pdf\" ]; do\n sleep 1\ndone\n\n# Use osascript to close the Chrome process\nosascript -e", "metrics": { "length": 1015, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 8, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "A stubbed success is not a sandbox — a faked `git push` let the suite rewrite the published index (a-stubbed-success-is-not-a-sandbox)", "condition": "plain", "status": 200, "content": "This error is related to the `git` version and the way it handles the index. The issue arises when a test suite tries to push a fake `git push` to a repository, which allows it to rewrite the published index. This is a known issue in older versions of `git`.\n\nTo fix this issue, you need to update your `git` version to the latest one. Here are the steps:\n\n**1. Check the current `git` version:**\n```bash\ngit --version\n```\n\n**2. If your version is older than 2.28, update `git`:**\n\nYou can update `git` using your package manager or by downloading the latest version from the official `git` website.\n\n**For Ubuntu/Debian-based systems:**\n```bash\nsudo apt update\nsudo apt install git\n```\n\n**For macOS (with Homebrew):**\n```bash\nbrew upgrade git\n```\n\n**3. Verify the updated `git` version:**\n```bash\ngit --version\n```\n\nAfter updating `git`, the error should be resolved. If you're still experiencing issues, try to reproduce the error and check if it's related to any specific test or code changes.\n\n**Additional tip:** If you're using a", "metrics": { "length": 1035, "commands": 5, "command_list": [ "git --version", "sudo apt update", "sudo apt install git", "brew upgrade git", "git --version" ], "has_command_block": true, "actionable": true, "inline_code_count": 17, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Supervise macOS Chrome Headless PDF Generation and Handle Process Timeouts (macos-chrome-headless-pdf-supervision)", "condition": "plain", "status": 200, "content": "To supervise macOS Chrome Headless PDF Generation and handle process timeouts, you can use the `pmap` and `killall` commands along with a bash script. Here's a step-by-step guide:\n\n**Step 1: Create a bash script**\n\nCreate a new file called `supervise_chrome.sh` using your preferred text editor (e.g., `nano` or `vim`):\n\n```bash\nnano supervise_chrome.sh\n```\n\n**Step 2: Add script content**\n\nPaste the following script into the file:\n\n```bash\n#!/bin/bash\n\n# Set the path to Chrome\nCHROME_PATH=\"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome\"\n\n# Set the path to the PDF file\nPDF_FILE=\"path_to_your_pdf_file.pdf\"\n\n# Set the timeout in seconds\nTIMEOUT=300\n\n# Run Chrome Headless PDF Generation\nchrome --headless --print-to-pdf \"$PDF_FILE\" &\n\n# Get the PID of the Chrome process\nPID=$!\n\n# Supervise the process\nwhile [ $PID -gt 0 ]; do\n # Get the process memory usage\n mem_usage=$(pmap -d $PID | awk '/total/ {print $2}')\n\n # Check if", "metrics": { "length": 952, "commands": 1, "command_list": [ "nano supervise_chrome.sh" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "A stubbed success is not a sandbox — a faked `git push` let the suite rewrite the published index (a-stubbed-success-is-not-a-sandbox)", "condition": "with_lesson", "status": 200, "content": "**Fixing the Stubbed Success is not a Sandbox Issue**\n\nTo fix the issue, you need to modify the `tests/test_frontmatter_writers_agree.py` file to correctly handle the side effects of the code. Here are the exact steps:\n\n1. **Identify the problematic test**: In the `tests/test_frontmatter_writers_agree.py` file, find the test that is causing the issue. It's likely a test that uses a stub to fake a `git push` operation.\n\n2. **Update the test to use a sandbox**: Instead of faking a `git push` operation, use a sandbox to isolate the changes made by the test. You can use the `pytest-sandbox` plugin to create a sandbox for the test.\n\n First, install the `pytest-sandbox` plugin:\n ```bash\npip install pytest-sandbox\n```\n\n Then, update the test to use a sandbox:\n ```python\nimport pytest\nfrom pytest_sandbox import sandbox\n\n@pytest.fixture(scope='function')\ndef sandboxed_repo(tmp_path_factory):\n \"\"\"Create a sandboxed Git repository.\"\"\"\n repo_path = tmp_path_factory.mktemp('repo')\n repo = sandbox.create_sandbox(repo_path)\n yield repo\n repo.teardown", "metrics": { "length": 1074, "commands": 1, "command_list": [ "pip install pytest-sandbox" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "zsh: command not found: python — the interpreter exists, just not under that name (python-command-not-found-only-python3)", "condition": "with_lesson", "status": 200, "content": "To fix this issue, you need to use the correct version of Python, which in this case is `python3`. Here are the steps:\n\n**Method 1: Using `command -v`**\n\nOpen your terminal and type the following command:\n\n```bash\ncommand -v python3\n```\n\nThis command will print the path to the `python3` executable if it exists. If it does, you can use it to run Python scripts.\n\n**Method 2: Using `python3 -V`**\n\nAlternatively, you can use the following command to check the version of Python:\n\n```bash\npython3 -V\n```\n\nIf this command prints a version number, it means that `python3` is installed and you can use it to run Python scripts.\n\n**Method 3: Updating your shell configuration**\n\nIf you want to make `python` a valid alias for `python3`, you can add the following line to your shell configuration file (usually `~/.zshrc` or `~/.bashrc`):\n\n```bash\nalias python=python3\n```\n\nThen, restart your terminal or run `source ~/.zshrc` (or `source ~/.bashrc`) to apply the changes.\n\n**Method 4: Adding `python", "metrics": { "length": 994, "commands": 3, "command_list": [ "command -v python3", "python3 -V", "alias python=python3" ], "has_command_block": true, "actionable": true, "inline_code_count": 17, "lesson_hits": 4, "lesson_hit_rate": 0.571 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A zero-result search is not proof of absence — check what swallowed the query (search-quota-exhaustion-false-zero)", "condition": "plain", "status": 200, "content": "The error you're encountering is due to the search quota being exhausted. This can happen when you're performing a large number of searches in a short amount of time. To fix this issue, you'll need to reset the search quota. Here's a step-by-step guide to help you resolve the issue:\n\n**For Google Search Console:**\n\n1. Go to the Google Search Console website: https://search.google.com/search-console\n2. Sign in with your Google account.\n3. Click on the \"Queries\" tab.\n4. Click on the \"Search Quota\" button.\n5. Click on the \"Reset Quota\" button.\n\n**For Bing Webmaster Tools:**\n\n1. Go to the Bing Webmaster Tools website: https://www.bing.com/webmaster/\n2. Sign in with your Microsoft account.\n3. Click on the \"Search\" tab.\n4. Click on the \"Search Quota\" button.\n5. Click on the \"Reset Quota\" button.\n\n**For DuckDuckGo:**\n\n1. Go to the DuckDuckGo website: https://duckduckgo.com/\n2. Click on the \"Help\" tab.\n3. Scroll down to the \"Search Quota\" section.\n4. Click on the \"Reset", "metrics": { "length": 976, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "zsh: command not found: python — the interpreter exists, just not under that name (python-command-not-found-only-python3)", "condition": "plain", "status": 200, "content": "The error message indicates that you have multiple versions of Python installed on your system, and the default shell (zsh) is unable to find the Python interpreter you're trying to use.\n\nTo fix this issue, you need to specify the correct Python version to use. Here are the steps:\n\n**Method 1: Using the `which` command to find the Python interpreter**\n\n1. Open a new terminal window.\n2. Run the following command to find the path to the Python interpreter:\n```bash\nwhich python\n```\nThis will output the path to the Python interpreter you want to use (e.g., `/usr/bin/python3` or `/usr/local/bin/python3.9`).\n\n**Method 2: Using the `python` command with the `-m` option**\n\n1. Open a new terminal window.\n2. Run the following command to specify the Python version:\n```bash\npython3 -m py_compile your_script.py\n```\nReplace `your_script.py` with the name of your Python script.\n\n**Method 3: Adding the Python path to your shell configuration**\n\n1. Open your shell configuration file in a text editor (e.g., `~/.zshrc` for zsh):\n```bash\nnano ~/.zshrc\n", "metrics": { "length": 1048, "commands": 2, "command_list": [ "which python", "python3 -m py_compile your_script.py" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 4, "lesson_hit_rate": 0.571 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Silent Data Loss in Google Cloud: BigQuery Schema Mismatch and Firestore Overwrite Failures (silent-data-loss-google-cloud)", "condition": "plain", "status": 200, "content": "The error \"Silent Data Loss in Google Cloud: BigQuery Schema Mismatch and Firestore Overwrite Failures\" indicates that there is a schema mismatch between your BigQuery and Firestore databases, which can lead to silent data loss. Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Identify the schema mismatch**\n\nRun the following command to identify the schema mismatch:\n```bash\ngcloud bigquery datasets describe --format='table’\n```\nReplace `` with the ID of the dataset you want to check.\n\n**Step 2: Update the schema in BigQuery**\n\nIf you find a schema mismatch, you need to update the schema in BigQuery. You can do this by running the following command:\n```bash\ngcloud bigquery schema update --json \n```\nReplace `` with the ID of the dataset you want to update, and `` with the path to the JSON file that defines the updated schema.\n\nFor example, if you have a JSON file named `schema.json` in the same directory as your `gcloud` command, you can run:\n```bash\ngcloud bigquery schema update --json", "metrics": { "length": 1121, "commands": 2, "command_list": [ "gcloud bigquery datasets describe --format='table’", "gcloud bigquery schema update --json " ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 2, "lesson_hit_rate": 0.25 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A zero-result search is not proof of absence — check what swallowed the query (search-quota-exhaustion-false-zero)", "condition": "with_lesson", "status": 200, "content": "The error message indicates that the search quota has been exhausted, and the search result is being swallowed by the system. To fix this issue, you need to clear the search quota. Here's a step-by-step guide:\n\n**Step 1: Locate the quota file**\n\nThe quota file is usually located at `~/.search-quota.json`. If you're using a virtual environment or a different user directory, the path might be different. You can try searching for the file in your home directory or use the command `find ~ -name .search-quota.json` to locate it.\n\n**Step 2: Delete the quota file**\n\nIf you're using a virtual environment, you might need to delete the quota file from the virtual environment directory. The exact command to delete the file will depend on the virtual environment software you're using. Here are some examples:\n\n* If you're using `conda`, run `conda env remove --name your-environment` and then `rm ~/.search-quota.json`.\n* If you're using `virtualenv`, run `virtualenv --delete your-environment` and then `rm ~/.search-quota.json`.\n* If you're using `venv`, run `python -m venv --delete your-environment` and then `", "metrics": { "length": 1113, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 10, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Silent Data Loss in Google Cloud: BigQuery Schema Mismatch and Firestore Overwrite Failures (silent-data-loss-google-cloud)", "condition": "with_lesson", "status": 200, "content": "**Fixing BigQuery Schema Mismatch and Firestore Overwrite Failures**\n\nTo address the silent data loss in Google Cloud services, we'll implement two fixes:\n\n1. **BigQuery Schema Mismatch Fix**\n\n * We'll validate the schema before inserting data into BigQuery.\n * We'll use the `bigquery.Schema` type to define the schema and check for missing fields.\n2. **Firestore Overwrite Fix**\n\n * We'll use the `firestore.Merge` option to overwrite documents in Firestore while preserving fields with `omitempty` tags.\n\n**Fixing BigQuery Schema Mismatch**\n\n```go\npackage main\n\nimport (\n \"context\"\n \"encoding/json\"\n \"log\"\n\n \"cloud.google.com/go/bigquery\"\n \"google.golang.org/api/option\"\n)\n\nfunc main() {\n // Set up BigQuery client\n ctx := context.Background()\n client, err := bigquery.NewClient(ctx, \"your-project-id\")\n if err != nil {\n log.Fatal(err)\n }\n defer client.Close()\n\n // Define schema\n schema := bigquery.Schema{\n Fields: []bigquery.Field{\n {\"id\", bigquery.StringField, true},\n {\"name\", bigquery", "metrics": { "length": 1085, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 3, "lesson_hits": 4, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "An allowlist that rejects real data is worse than no validation — test the rule against the corpus (allowlist-must-be-tested-against-the-corpus)", "condition": "with_lesson", "status": 200, "content": "The issue arises because the regular expression used to validate the path and ID does not account for non-ASCII characters, such as those found in Korean names. To fix this, we need to update the regular expressions to allow for non-ASCII characters.\n\nHere's the updated code:\n\n```javascript\n// Path validation regular expression\nconst LESSON_PATH_RE = /^lessons\\/[^\\s]+$/;\n\n// ID validation regular expression\nconst LESSON_ID_RE = /^[a-zA-Z0-9._-]+$/;\n```\n\nExplanation:\n\n- In the `LESSON_PATH_RE`, the `^` symbol marks the start of the string, and the ` lessons\\/` ensures that the path starts with \"lessons/\". The `[^\\s]+` part matches one or more characters that are not whitespace. This allows for any characters, including non-ASCII ones, after the \"lessons/\" prefix.\n\n- In the `LESSON_ID_RE`, the `^` symbol marks the start of the string, and the `[a-zA-Z0-9._-]+` part matches one or more characters that are alphanumeric, dots, underscores, or hyphens. This allows for any characters, including non-ASCII ones, after the ID prefix.\n\nTo test these regular expressions", "metrics": { "length": 1074, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 8, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "An allowlist that rejects real data is worse than no validation — test the rule against the corpus (allowlist-must-be-tested-against-the-corpus)", "condition": "plain", "status": 200, "content": "The error message indicates that you need to test your allowlist against the corpus (the dataset or data set you're trying to validate against). This is because an allowlist that rejects real data is not useful, as it will reject all data, including the data you're trying to validate.\n\nHere's a concrete, actionable fix with exact commands:\n\n**Step 1: Install required libraries**\n\nIf you haven't installed the necessary libraries, run the following commands:\n```bash\npip install pandas\npip install numpy\n```\n**Step 2: Load your dataset**\n\n Load your dataset into a Pandas DataFrame. For example, if your dataset is in a CSV file called `data.csv`, you can use the following command:\n```bash\nimport pandas as pd\ndf = pd.read_csv('data.csv')\n```\n**Step 3: Create a test dataset**\n\nCreate a test dataset that includes the same features as your original dataset, but with some allowed values that you want to test against. For example:\n```python\n# Create a test dataset\ntest_df = df.copy()\ntest_df['feature1'] = np.random.choice(['allowed', 'not_allowed'], size=len(test_df))\ntest_df['feature2'] = np.random.choice(['allowed', 'not", "metrics": { "length": 1129, "commands": 4, "command_list": [ "pip install pandas", "pip install numpy", "import pandas as pd", "df = pd.read_csv('data.csv')" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A not-found answered with a retryable error code makes agents retry a 404 forever (an-error-code-that-says-retry-cannot-carry-a-not-found)", "condition": "with_lesson", "status": 200, "content": "To fix this issue, we need to differentiate between retryable errors and non-retryable errors. We'll create three separate error handlers to handle different scenarios.\n\n**Step 1: Create a new error handler for retryable errors**\n\nWe'll create a new error handler that returns a retryable error code. This will be used for errors that can be retried.\n\n```javascript\nconst retryableErrorCodes = {\n internal_error: {\n retryAfter: 1000, // retry after 1 second\n },\n};\n\nconst retryableErrorHandler = (error) => {\n if (retryableErrorCodes[error.code]) {\n return { error: error.message, code: error.code, retryAfter: retryableErrorCodes[error.code].retryAfter };\n }\n return { error: error.message, code: error.code };\n};\n```\n\n**Step 2: Create a new error handler for non-retryable errors**\n\nWe'll create a new error handler that returns a non-retryable error code. This will be used for errors that cannot be retried.\n\n```javascript\nconst nonRetryableErrorCodes = {\n not_found: {\n error: 'Record not found',\n },\n};\n\nconst nonRetryableErrorHandler = (", "metrics": { "length": 1060, "commands": 2, "command_list": [ "**Step 2: Create a new error handler for non-retryable errors**", "We'll create a new error handler that returns a non-retryable error code. This will be used for errors that cannot be retried." ], "has_command_block": true, "actionable": false, "inline_code_count": 2, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A not-found answered with a retryable error code makes agents retry a 404 forever (an-error-code-that-says-retry-cannot-carry-a-not-found)", "condition": "plain", "status": 200, "content": "The error you're experiencing is because when a retryable error code is returned with a 404 status code, the agent will continue to retry indefinitely. To resolve this, you can use the `retry-after` header to specify the time the server expects the client to wait before retrying.\n\nHere's a concrete, actionable fix with exact commands:\n\n**Using HTTP Client Library (e.g., `requests` in Python)**\n\nIf you're using a Python library like `requests` to make HTTP requests, you can use the `retry` parameter to specify a custom retry strategy.\n\n```python\nimport requests\n\ndef retry_request(url, max_retries=3, backoff_factor=0.5):\n def decorator(func):\n def wrapper(*args, **kwargs):\n for attempt in range(max_retries + 1):\n try:\n return func(*args, **kwargs)\n except requests.exceptions.HTTPError as e:\n if e.response.status_code == 404:\n retry_after = e.response.headers.get('Retry-After')\n if retry_after:\n print(f\"Retrying in {retry_after} seconds...\")\n time.sleep(int(retry_after))\n else:\n raise\n return wrapper\n return decorator\n\n@retry_request\ndef", "metrics": { "length": 1291, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 4, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A whole-file content push silently reverts the lines another writer owns (whole-file-content-push-reverts-managed-lines)", "condition": "with_lesson", "status": 200, "content": "The issue arises because the `git push` command with `--whole-file` option does not handle conflicts or changes made by other writers. To resolve this, you can use `git push` with `--force-with-lease` option, which allows you to force a push while checking if the remote branch has been modified since the last successful push.\n\nHere's a step-by-step solution:\n\n1. First, you need to make sure that the `--force-with-lease` option is available in your Git version. This option was introduced in Git version 2.31.\n\n2. If you are using an older version of Git, you can use `git push` with `--force` and then manually check if the push was successful.\n\nHere's a concrete, actionable fix with exact commands:\n\n```bash\n# If you are using Git version 2.31 or later\ngit push origin main --force-with-lease --whole-file\n\n# If you are using an older version of Git\ngit push origin main --force\n```\n\nHowever, using `--force-with-lease` option is recommended as it provides a better guarantee that the push was successful.\n\nAdditionally, you should also consider using `git fetch` before pushing to ensure that you have the", "metrics": { "length": 1112, "commands": 2, "command_list": [ "git push origin main --force-with-lease --whole-file", "git push origin main --force" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A whole-file content push silently reverts the lines another writer owns (whole-file-content-push-reverts-managed-lines)", "condition": "plain", "status": 200, "content": "The error \"whole-file content push silently reverts the lines another writer owns\" typically occurs when you're using Git and multiple developers are working on the same repository.\n\nTo resolve this issue, you can try the following steps:\n\n1. Pull the latest changes from the remote repository:\n ```bash\ngit pull origin \n```\n Replace `` with the name of the branch you're currently on.\n\n2. Check if there are any conflicts:\n ```bash\ngit status\n```\n If there are any conflicts, Git will display them.\n\n3. Resolve the conflicts:\n ```bash\ngit mergetool\n```\n This will open a graphical interface where you can resolve the conflicts.\n\n4. If you're using Git Bash, you can also resolve conflicts manually:\n ```bash\ngit checkout --theirs \n```\n Replace `` with the name of the file that needs to be resolved.\n\n5. After resolving the conflicts, commit the changes:\n ```bash\ngit add .\ngit commit -m \"Resolved conflicts\"\n```\n\nAlternatively, you can also use `git stash` and `git checkout` to temporarily remove your changes and then reapply them after resolving the conflicts:\n```", "metrics": { "length": 1135, "commands": 6, "command_list": [ "git pull origin ", "git status", "git mergetool", "git checkout --theirs ", "git add ." ], "has_command_block": true, "actionable": true, "inline_code_count": 14, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "An assertion that cannot fail is not a test — five shapes it took in one working session (assertion-that-cannot-fail)", "condition": "with_lesson", "status": 200, "content": "The error message you're encountering is due to an assertion that cannot fail, which is not a test. This is because the assertion is always true, and it's occupying a place where a test should be.\n\nTo fix this, you can replace the assertion with a test that actually checks for the expected behavior. Here's a concrete example using Python:\n\nLet's say you have the following code:\n\n```python\ndef get_draft_count(results):\n draft_count = sum(1 for r in results if r.get(\"status\") == \"draft\")\n return draft_count\n\ndef check_draft_count(gate_file_text, results):\n draft_count = get_draft_count(results)\n assert draft_count == len([r for r in results if r.get(\"status\") == \"draft\"])\n```\n\nThe assertion in the `check_draft_count` function is always true because the `draft_count` variable is calculated using a guard that never fails. To fix this, you can replace the assertion with a test that checks if the `draft_count` is equal to the actual number of draft lessons in the results.\n\nHere's the updated code:\n\n```python\nimport unittest\n\ndef get_draft_count(results):\n draft_count = sum(1 for r in results if r.get(\"status\") ==", "metrics": { "length": 1139, "commands": 2, "command_list": [ "The assertion in the `check_draft_count` function is always true because the `draft_count` variable is calculated using a guard that never fails. To fix this, you can replace the assertion with a test that checks if the `draft_count` is equal to the actual number of draft lessons in the results.", "Here's the updated code:" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "An assertion that cannot fail is not a test — five shapes it took in one working session (assertion-that-cannot-fail)", "condition": "plain", "status": 200, "content": "The error you're encountering is due to an assertion that cannot fail, which means the assertion is always true and doesn't provide any useful information about the test. Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Identify the problematic assertion**\n\nOpen your test file and find the assertion that's causing the error. It's likely a simple equality check like `assert x == 5`.\n\n**Step 2: Refactor the assertion**\n\nReplace the problematic assertion with a more meaningful one. For example, if you're testing a function that calculates the area of a shape, you could assert that the area is within a certain range:\n\n```python\nimport unittest\n\ndef calculate_area(shape, size):\n # implementation...\n\nclass TestShapeArea(unittest.TestCase):\n def test_area_range(self):\n shape = calculate_area(\"circle\", 5)\n self.assertGreaterEqual(shape, 0)\n self.assertLessEqual(shape, 25) # assuming the formula for circle area is πr^2\n```\n\n**Step 3: Run the test again**\n\nSave the changes and run the test again using the command:\n\n```bash\npython -m unittest test_file.py\n```\n\nReplace `test_file.py` with the actual name of your", "metrics": { "length": 1162, "commands": 2, "command_list": [ "**Step 3: Run the test again**", "Save the changes and run the test again using the command:" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Supervisor reports 'daemon start failed' with no detail: the child's own log holds the reason (daemon-start-failed-empty-detail-missing-credential)", "condition": "with_lesson", "status": 200, "content": "To fix this issue, you need to set the `PLUGIN_API_LLM_API_KEY` environment variable. Here are the steps:\n\n1. Open your terminal.\n2. Check if the environment variable is set. Run the following command:\n\n```bash\nexport | grep PLUGIN_API_LLM_API_KEY\n```\n\nIf the variable is not set, proceed to the next step.\n\n3. Set the environment variable. Run the following command:\n\n```bash\nexport PLUGIN_API_LLM_API_KEY=\"YOUR_API_KEY_HERE\"\n```\n\nReplace `\"YOUR_API_KEY_HERE\"` with your actual LLM API key.\n\n4. Verify that the environment variable is set. Run the following command:\n\n```bash\nexport | grep PLUGIN_API_LLM_API_KEY\n```\n\nIf the variable is set correctly, you should see the value of the variable printed.\n\n5. Try running your supervisor again to see if the issue is resolved.\n\nIf you're using a `.bashrc` or `.bash_profile` file to set environment variables, you may need to restart your terminal or source the file after setting the variable.\n\nAlternatively, you can set the environment variable permanently by adding the following line to your `.bashrc` or `.bash_profile` file:\n\n```bash\nexport PLUGIN_API_LLM_API_KEY=\"", "metrics": { "length": 1119, "commands": 3, "command_list": [ "export | grep PLUGIN_API_LLM_API_KEY", "export PLUGIN_API_LLM_API_KEY=\"YOUR_API_KEY_HERE\"", "export | grep PLUGIN_API_LLM_API_KEY" ], "has_command_block": true, "actionable": true, "inline_code_count": 12, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Migrating DSH_HOME with robocopy materializes the profile node_modules junctions, and dsh refuses to boot (dsh-home-robocopy-junction-fallback-breakage)", "condition": "with_lesson", "status": 200, "content": "The issue arises from the fact that `robocopy` materializes the junctions, making them real directories, while `dsh` expects them to be symlinks. Here's a step-by-step fix:\n\n**Step 1: Restore junctions**\n\nBefore migrating `DSH_HOME` to a new location, restore the junctions to their original state. This will ensure that the packages are referenced as symlinks, which `dsh` expects.\n\n```bash\nrobocopy /SL \"C:\\path\\to\\old\\DSH_HOME\" \"C:\\path\\to\\new\\DSH_HOME\"\n```\n\nReplace `C:\\path\\to\\old\\DSH_HOME` with the original location of `DSH_HOME` and `C:\\path\\to\\new\\DSH_HOME` with the new location.\n\n**Step 2: Run `dsh` with the `/reset` flag**\n\nAfter restoring the junctions, run `dsh` with the `/reset` flag to ensure that it re-establishes the symlinks.\n\n```bash\ndsh /reset\n```\n\nThis flag tells `dsh` to re-evaluate the symlinks and re-establish them.\n\n**Step 3: Migrate", "metrics": { "length": 864, "commands": 2, "command_list": [ "robocopy /SL \"C:\\path\\to\\old\\DSH_HOME\" \"C:\\path\\to\\new\\DSH_HOME\"", "dsh /reset" ], "has_command_block": true, "actionable": true, "inline_code_count": 15, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Migrating DSH_HOME with robocopy materializes the profile node_modules junctions, and dsh refuses to boot (dsh-home-robocopy-junction-fallback-breakage)", "condition": "plain", "status": 200, "content": "The error you're encountering is due to a known issue with the `dsh` command. Here's a concrete, actionable fix:\n\n**Step 1: Remove the `node_modules` junction**\n\nRun the following command to remove the `node_modules` junction created by `robocopy`:\n```bash\nrobocopy /mov /minage:0 \"C:\\Program Files\\DSH_HOME\" \"C:\\Program Files\\DSH_HOME\\..\\node_modules\"\n```\nThis command moves the `node_modules` directory from the `DSH_HOME` directory to a sibling directory.\n\n**Step 2: Update the `DSH_HOME` environment variable**\n\nAfter removing the junction, update the `DSH_HOME` environment variable to point to the correct location:\n```bash\nset DSH_HOME=C:\\Program Files\\DSH_HOME\n```\n**Step 3: Re-run `dsh`**\n\nRe-run the `dsh` command to verify that it boots successfully:\n```bash\ndsh\n```\nIf you're still encountering issues, you can try the following:\n\n**Step 4: Re-create the `node_modules` junction (optional)**\n\nIf you want to re-create the `node_modules` junction, run the following", "metrics": { "length": 976, "commands": 3, "command_list": [ "robocopy /mov /minage:0 \"C:\\Program Files\\DSH_HOME\" \"C:\\Program Files\\DSH_HOME\\..\\node_modules\"", "set DSH_HOME=C:\\Program Files\\DSH_HOME", "dsh" ], "has_command_block": true, "actionable": true, "inline_code_count": 17, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Supervisor reports 'daemon start failed' with no detail: the child's own log holds the reason (daemon-start-failed-empty-detail-missing-credential)", "condition": "plain", "status": 200, "content": "The error you're encountering, 'daemon start failed' with 'daemon-start-failed-empty-detail-missing-credential', typically occurs when the supervisor is unable to find the necessary credentials to start a service. Here's a step-by-step guide to troubleshoot and resolve this issue:\n\n**Step 1: Check the service configuration**\n\n1. Identify the service that's causing the issue. You can do this by checking the supervisor logs or the service itself.\n2. Check the service configuration file (usually in the `/etc/supervisor/conf.d/` directory) to ensure that the credentials are correctly specified.\n\n**Step 2: Verify the credentials**\n\n1. Check if the credentials are correctly formatted and exist in the expected location.\n2. If using environment variables, verify that the variables are set correctly.\n3. If using a specific credential file, ensure it exists and has the correct permissions.\n\n**Step 3: Update the supervisor configuration**\n\n1. Open the supervisor configuration file (usually in the `/etc/supervisor/supervisord.conf` file).\n2. Add the following line to the `[supervisord]` section:\n```\nreread_interval = 60\n```\nThis will force supervisor to re-read its configuration every 60", "metrics": { "length": 1194, "commands": 1, "command_list": [ "reread_interval = 60" ], "has_command_block": true, "actionable": false, "inline_code_count": 4, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A child stat failure must not fail the whole parent directory listing (a-child-probe-failure-must-not-poison-the-parent-listing)", "condition": "plain", "status": 200, "content": "The error message you're encountering is related to Apache configuration and permissions. The issue arises when a child directory (e.g., a subdirectory within a parent directory) fails to serve files, causing the parent directory's directory listing to fail as well.\n\nTo resolve this issue, you'll need to adjust the configuration of your Apache server to prevent this kind of failure from propagating. Here's a step-by-step guide with exact commands to help you fix the problem:\n\n**Step 1: Check the Apache configuration**\n\n1. Open your Apache configuration file in a text editor. The location of this file varies depending on your operating system and Apache version. For most systems, it's located at `/etc/apache2/apache2.conf` or `/etc/httpd.conf`.\n2. Look for the `Directory` directive that corresponds to your parent directory. For example, if you're using Apache 2.x, it might look something like this:\n ```apache\n\n Options Indexes FollowSymLinks MultiViews\n AllowOverride None\n Require all granted\n\n```\n\n**Step 2: Set the `ErrorDocument` directive**\n\n1. Add the following directive to the `Directory` block to specify an error document that will", "metrics": { "length": 1202, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 6, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A hit is not evidence of relevance — the boundary queries that must come back empty (a-hit-is-not-evidence-of-relevance)", "condition": "with_lesson", "status": 200, "content": "The error you're experiencing is due to the asymmetry in the search results, where a query returning no results is considered \"legible\" but a query returning multiple results is not. This is because the search algorithm is treating the absence of results as evidence of irrelevance, whereas the presence of multiple results is not being handled as evidence of irrelevance.\n\nTo fix this issue, you can try the following steps:\n\n1. **Modify the relevance scoring function**: Instead of using a simple lexical scoring function, you can use a more sophisticated scoring function that takes into account the relevance of the query and the content of the search results. One approach is to use a weighted sum of the relevance scores, where the weights are adjusted based on the number of results returned.\n\n2. **Add a \"no-match\" penalty**: Introduce a penalty term that is added to the relevance score when the query returns no results. This will encourage the search algorithm to return more results when the query is not relevant.\n\n3. **Use a different scoring function**: Instead of using a floor-based scoring function, you can use a ceiling-based scoring function that takes into account the number of results returned. This will encourage the search algorithm to return more results when the query is relevant.\n\nHere is a concrete example", "metrics": { "length": 1338, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A child stat failure must not fail the whole parent directory listing (a-child-probe-failure-must-not-poison-the-parent-listing)", "condition": "with_lesson", "status": 200, "content": "The error you're experiencing is due to the way `dsh-fs-local` handles child directory failures. The issue arises when a child directory fails to be listed, and the error is propagated up the directory hierarchy as a parent directory failure.\n\nTo fix this issue, you can try the following steps:\n\n**Step 1: Update `dsh-fs-local`**\n\nYou can update `dsh-fs-local` by running the following command:\n```bash\nnpm install --save dsh-fs-local@latest\n```\n**Step 2: Create a custom `resolveListedChildTarget` function**\n\nYou can create a custom `resolveListedChildTarget` function that catches the `listingIoError` and returns a more informative error message. Here's an example implementation:\n```javascript\nconst { resolveListedChildTarget } = require('dsh-fs-local');\n\nfunction customResolveListedChildTarget(target, entry) {\n try {\n return resolveListedChildTarget(target, entry);\n } catch (error) {\n if (error.code === 'EACCES') {\n return {\n name: entry.name,\n displayPath: target.displayPath,\n error: 'permission denied',\n };\n }\n throw error", "metrics": { "length": 1083, "commands": 1, "command_list": [ "npm install --save dsh-fs-local@latest" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 2, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "A child stat failure must not fail the whole parent directory listing (a-child-probe-failure-must-not-poison-the-parent-listing)", "condition": "with_lesson", "status": 200, "content": "**Fixing the \"A child stat failure must not fail the whole parent directory listing\" Error**\n\nTo fix this issue, you need to modify the `listDirectory` function in `dsh-fs-local` to handle child stat failures separately from the parent directory listing. Here's the concrete, actionable fix:\n\n**Step 1: Identify the affected file**\n\nThe affected file is `lib/index.js` in the `dsh-fs-local` module. Open this file in your favorite code editor.\n\n**Step 2: Modify the `listDirectory` function**\n\nFind the `listDirectory` function (around line 304) and modify it as follows:\n```javascript\nlistDirectory = async function (target, options) {\n const listing = await readdir(target.displayPath);\n const enrichedListing = listing.map((entry) => {\n const childTarget = resolveListedChildTarget(target, entry);\n return {\n ...entry,\n target: childTarget,\n };\n });\n try {\n // Add a separate stat probe for each child entry\n const stats = await Promise.all(enrichedListing.map(async (entry) => {\n try {\n return await stat(entry.target.displayPath);\n } catch (error) {\n // Handle", "metrics": { "length": 1118, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 6, "lesson_hits": 2, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A hit is not evidence of relevance — the boundary queries that must come back empty (a-hit-is-not-evidence-of-relevance)", "condition": "plain", "status": 200, "content": "The error message you're encountering suggests that you're trying to use a hit as evidence of relevance, but the boundary queries are returning empty, indicating that the hit is not within the relevant range.\n\nHere's a concrete, actionable fix with exact commands. Let's assume you're using Elasticsearch and Python.\n\n**Step 1: Verify the boundary queries are returning empty**\n\nYou can use the `explain` parameter in your Elasticsearch query to see the query plan and the relevance score. You can do this by adding `explain=true` to your query.\n\n```python\nimport requests\n\n# Your Elasticsearch URL and index name\nurl = 'http://localhost:9200/myindex'\nindex_name = 'myindex'\n\n# Your search query\nquery = {\n \"query\": {\n \"match\": {\n \"name\": \"John\"\n }\n }\n}\n\n# Add explain parameter\nquery['explain'] = True\n\n# Send the request\nresponse = requests.post(url, json=query)\n\n# Check if the response was successful\nif response.status_code == 200:\n # Get the response JSON\n data = response.json()\n print(data)\nelse:\n print(f\"Failed to retrieve data. Status code: {response.status_code}\")\n```\n\n**Step 2", "metrics": { "length": 1133, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 3, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "A hit is not evidence of relevance — the boundary queries that must come back empty (a-hit-is-not-evidence-of-relevance)", "condition": "with_lesson", "status": 200, "content": "The error you're experiencing is due to the ambiguity between relevance and existence in your search query. This is a classic problem in information retrieval, and there are several ways to address it. Here's a concrete, actionable fix:\n\n**Step 1: Introduce a relevance score**\n\nTo distinguish between existence and relevance, you can introduce a separate relevance score. This score can be based on a combination of factors such as term frequency-inverse document frequency (TF-IDF), word embeddings, or other relevance metrics.\n\n**Step 2: Use a relevance threshold**\n\nSet a relevance threshold to filter out results that are not relevant to the query. This threshold can be a fixed value or a dynamic value that is learned from the data.\n\n**Step 3: Use a coverage score**\n\nCalculate a coverage score to measure the proportion of query terms that are present in the document. This score can be used to filter out results that do not cover the query.\n\n**Step 4: Combine scores**\n\nCombine the relevance score, coverage score, and other relevant metrics to produce a final score that reflects both existence and relevance.\n\n**Step 5: Use a ranking algorithm**\n\nUse a ranking algorithm such as ranking by relevance score, coverage score, or a combination of both to rank the results.\n\nHere", "metrics": { "length": 1286, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "A child stat failure must not fail the whole parent directory listing (a-child-probe-failure-must-not-poison-the-parent-listing)", "condition": "plain", "status": 200, "content": "The error \"A child stat failure must not fail the whole parent directory listing\" typically occurs when a child process fails to retrieve the contents of a directory, causing the parent process to fail as well. This can be due to a variety of reasons such as permission issues, file system errors, or a network connection issue.\n\nTo fix this issue, you can use the following steps:\n\n**Step 1: Identify the child process that is failing**\n\nYou can use the `ps` command to identify the child process that is failing. Run the following command to list all processes:\n```bash\nps -ef\n```\nLook for the process ID (PID) of the child process that is failing.\n\n**Step 2: Check the file system and permissions**\n\nUse the `ls` command to check if the directory exists and is accessible:\n```bash\nls -ld /path/to/directory\n```\nCheck the permissions of the directory and its contents:\n```bash\nls -l /path/to/directory\n```\nIf the directory or its contents are not accessible, you may need to change the permissions or ownership of the directory.\n\n**Step 3: Check the network connection**\n\nIf the issue is related to a network connection, you can try to ping the remote", "metrics": { "length": 1153, "commands": 3, "command_list": [ "ps -ef", "ls -ld /path/to/directory", "ls -l /path/to/directory" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "A hit is not evidence of relevance — the boundary queries that must come back empty (a-hit-is-not-evidence-of-relevance)", "condition": "plain", "status": 200, "content": "The error you're encountering is related to Elasticsearch, a search and analytics engine. The specific error message you provided, \"A hit is not evidence of relevance,\" is related to a boundary query, which is a type of query used in Elasticsearch to find the boundary of a query.\n\nHere's a concrete, actionable fix to resolve the issue:\n\n**Step 1: Identify the problematic query**\n\nCheck your Elasticsearch query to see if you're using a `match_all` query or a query that could potentially return a hit, even if the document is not relevant. If you're using a `match_all` query, you can try to replace it with a more specific query that targets the relevant fields.\n\n**Step 2: Use a `match_none` query**\n\nIf you're trying to test the relevance of a query, you can use a `match_none` query to ensure that no documents match the query. Here's an example of how to use a `match_none` query:\n```bash\nGET /my_index/_search\n{\n \"query\": {\n \"match_none\": {}\n }\n}\n```\nThis query will return an empty response, indicating that no documents match the query.\n\n**Step 3: Use a `bool` query with a `must", "metrics": { "length": 1095, "commands": 6, "command_list": [ "GET /my_index/_search", "{", "\"query\": {", "\"match_none\": {}", "}" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "pip install agentcap gets a different project — huggingface/agentcap is a Rust binary (agentcap-is-not-on-pypi)", "condition": "with_lesson", "status": 200, "content": "To fix the issue, you need to install the Rust binary from the Hugging Face GitHub project instead of the Python package from PyPI. Here are the exact commands to do so:\n\n1. Open a terminal.\n2. Run the following command to download and install the Rust binary:\n\n```bash\ncurl -fsSL https://raw.githubusercontent.com/huggingface/agentcap/main/scripts/install.sh | sh\n```\n\nIf you want to specify a custom installation directory, you can use the following command:\n\n```bash\ncurl -fsSL .../install.sh | sh -s -- -b /usr/local/bin\n```\n\nReplace `.../` with the actual path to the `install.sh` script.\n\n3. To pin a specific version of the Rust binary, you can use the following command:\n\n```bash\ncurl -fsSL https://raw.githubusercontent.com/huggingface/agentcap/main/scripts/install.sh | sh -s -- -b /usr/local/bin --version 1.0.0\n```\n\nReplace `1.0.0` with the desired version number.\n\nBy following these steps, you should be able to install the Hugging Face `agentcap` Rust binary and use its CLI commands.", "metrics": { "length": 999, "commands": 3, "command_list": [ "curl -fsSL https://raw.githubusercontent.com/huggingface/agentcap/main/scripts/install.sh | sh", "curl -fsSL .../install.sh | sh -s -- -b /usr/local/bin", "curl -fsSL https://raw.githubusercontent.com/huggingface/agentcap/main/scripts/install.sh | sh -s -- -b /usr/local/bin --version 1.0.0" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "pip install agentcap gets a different project — huggingface/agentcap is a Rust binary (agentcap-is-not-on-pypi)", "condition": "plain", "status": 200, "content": "The error you're experiencing is due to the fact that `agentcap` is not a Python package and therefore cannot be installed via pip. However, it's likely that you're trying to use `agentcap` for its Python API, which is actually a part of the `huggingface/diffusers` package.\n\nHere's a concrete, actionable fix:\n\n1. **Uninstall the existing `agentcap` package (if it's installed)**:\n ```bash\npip uninstall agentcap\n```\n\n2. **Install the `transformers` package (which includes the `agentcap` API)**:\n ```bash\npip install transformers\n```\n\n3. **Verify that you have the correct `agentcap` API**:\n You should now be able to import the `agentcap` API from the `transformers` package:\n ```python\nfrom transformers import AgentCap\n```\n\n4. **Install the required dependencies (if any)**:\n Depending on your specific use case, you may need to install additional dependencies. For example, if you're working with a specific model or library, you may need to install its dependencies.\n\n5. **Test your code**:\n Once you've installed the required dependencies, test your code to ensure", "metrics": { "length": 1084, "commands": 2, "command_list": [ "pip uninstall agentcap", "pip install transformers" ], "has_command_block": true, "actionable": true, "inline_code_count": 14, "lesson_hits": 1, "lesson_hit_rate": 0.167 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "pip install agentcap gets a different project — huggingface/agentcap is a Rust binary (agentcap-is-not-on-pypi)", "condition": "with_lesson", "status": 200, "content": "To fix the issue, you need to install the Rust binary from the GitHub project instead of the Python package from PyPI. Here are the exact steps:\n\n**Step 1: Install the Rust binary using the GitHub script**\n\n```bash\ncurl -fsSL https://raw.githubusercontent.com/huggingface/agentcap/main/scripts/install.sh | sh\n```\n\nThis script will detect your platform and install the matching binary to `~/.local/bin`.\n\n**Step 2: Verify the installation**\n\nYou can verify that the binary has been installed by running:\n\n```bash\nagentcap --help\n```\n\nIf the installation was successful, you should see the help message for the `agentcap` binary.\n\n**Optional flags for the installation script**\n\nIf you want to customize the installation, you can use the following flags:\n\n* `-b /usr/local/bin` to install the binary to a custom directory (e.g., `/usr/local/bin`):\n```bash\ncurl -fsSL https://raw.githubusercontent.com/huggingface/agentcap/main/scripts/install.sh | sh -s -- -b /usr/local/bin\n```\n* `--version` to pin a specific version of the binary:\n```bash\ncurl -fsSL https://raw.githubusercontent.com/huggingface/", "metrics": { "length": 1098, "commands": 3, "command_list": [ "curl -fsSL https://raw.githubusercontent.com/huggingface/agentcap/main/scripts/install.sh | sh", "agentcap --help", "curl -fsSL https://raw.githubusercontent.com/huggingface/agentcap/main/scripts/install.sh | sh -s -- -b /usr/local/bin" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "pip install agentcap gets a different project — huggingface/agentcap is a Rust binary (agentcap-is-not-on-pypi)", "condition": "plain", "status": 200, "content": "The issue you're encountering is due to the `agentcap` package being a Rust binary, not a Python package. This means that you can't install it using pip.\n\nHere's a concrete, actionable fix:\n\n**Option 1: Install using pip with a different package**\n\nInstead of using `agentcap`, you can try installing the `transformers` package, which is a Python library that provides a wide range of pre-trained models and a simple interface for fine-tuning them.\n\n```bash\npip install transformers\n```\n\n**Option 2: Install using pip and download the Rust binary**\n\nIf you still want to use `agentcap`, you can try installing it using pip, but you'll need to download the Rust binary manually.\n\n```bash\npip install agentcap\n```\n\nThis will download the Python wrapper for the Rust binary. Then, you can download the Rust binary itself from the [Hugging Face repository](https://github.com/huggingface/agentcap) and install it using Rust.\n\n```bash\n# Clone the repository\ngit clone https://github.com/huggingface/agentcap.git\n\n# Navigate to the repository\ncd agentcap\n\n# Build the Rust binary\nrustup target add nightly\ncargo build --release\n\n# Install", "metrics": { "length": 1132, "commands": 2, "command_list": [ "pip install transformers", "pip install agentcap" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 1, "lesson_hit_rate": 0.167 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "AgentCap secret-safe verification rejects sensitive metadata — how to diagnose without leaking (agentcap-secret-safe-verification-failure)", "condition": "with_lesson", "status": 200, "content": "To diagnose and fix the \"agentcap-secret-safe-verification-failure\" error without leaking sensitive metadata, follow these steps:\n\n### Step 1: Identify the Affected Field\n\n1. Run the verification with verbose output and grep for \"secret-safe\" to identify the affected field:\n\n ```bash\nagentcap verify --verbose 2>&1 | grep \"secret-safe\"\n```\n\n This command will output the JSON paths of the fields that triggered the \"secret-safe\" check.\n\n### Step 2: Inspect the Field (Read-Only)\n\n1. Export the capability metadata to a temporary JSON file:\n\n ```bash\nagentcap export --format json /tmp/caps.json\n```\n\n2. Find the specific field by inspecting the exported JSON file:\n\n ```bash\ncat /tmp/caps.json | jq '.capabilities[] | select(.description | type == \"string\")'\n```\n\n This command will output the descriptions of the capability objects. You can use this information to identify the field that triggered the \"secret-safe\" check.\n\n### Step 3: Fix the Offending Field\n\nOnce you have identified the field, you can fix it by modifying its value to avoid triggering the \"secret-safe\" check.\n\nFor example, if the affected", "metrics": { "length": 1122, "commands": 3, "command_list": [ "agentcap verify --verbose 2>&1 | grep \"secret-safe\"", "agentcap export --format json /tmp/caps.json", "cat /tmp/caps.json | jq '.capabilities[] | select(.description | type == \"string\")'" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 3, "lesson_hit_rate": 0.375 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "AgentCap secret-safe verification rejects sensitive metadata — how to diagnose without leaking (agentcap-secret-safe-verification-failure)", "condition": "plain", "status": 200, "content": "The error message \"AgentCap secret-safe verification rejects sensitive metadata\" indicates that the Secret Manager agent is rejecting the sensitive metadata due to its format or content. Here's a step-by-step guide to diagnose and fix the issue without leaking sensitive information:\n\n**Step 1: Check the Secret Manager agent logs**\n\n Run the following command to check the Secret Manager agent logs:\n```bash\ngcloud secrets agent logs --zone --project \n```\nReplace `` with the zone where the Secret Manager agent is running, and `` with your project ID.\n\nThis command will display the latest log entries from the Secret Manager agent. Look for any errors or warnings related to secret-safe verification.\n\n**Step 2: Check the secret format**\n\n Run the following command to check the format of the secret:\n```bash\ngcloud secrets versions access --secret --format='get payload'\n```\nReplace `` with the name of the secret that's causing the error.\n\nThis command will display the payload of the secret in JSON format. Check if the payload contains sensitive metadata that might be causing the error.\n\n**Step 3: Update the secret format**\n\nIf the secret payload contains sensitive metadata, you can update the secret", "metrics": { "length": 1274, "commands": 2, "command_list": [ "gcloud secrets agent logs --zone --project ", "gcloud secrets versions access --secret --format='get payload'" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 3, "lesson_hit_rate": 0.375 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Always Add Tests with Code Changes to Pass CI Coverage Gates (ci-test-coverage-gate)", "condition": "plain", "status": 200, "content": "This error typically occurs when you make changes to your codebase and fail to add corresponding tests to cover those changes. Here's a step-by-step guide to fix this issue:\n\n**Step 1: Run your tests**\n\nFirst, run your tests to identify which parts of your code are not covered by tests.\n\n```bash\n./run-tests.sh # or your test command\n```\n\n**Step 2: Identify uncovered code**\n\nLook for lines of code that are not covered by tests. You can use tools like `lcov` or `gcov` to generate coverage reports.\n\n```bash\nlcov -c -d . --out-file coverage.info\ngcov -c -d . --out-file coverage.info\n```\n\n**Step 3: Write new tests**\n\nCreate new tests to cover the uncovered code. Use a testing framework like Jest, Mocha, or Pytest to write your tests.\n\nFor example, let's say you have an uncovered function called `addNumbers()` in a file called `math.js`:\n\n```javascript\n// math.js\nfunction addNumbers(a, b) {\n return a + b;\n}\n```\n\nYou can write a test for this function using Jest:\n\n```javascript\n// math.test.js\nconst addNumbers", "metrics": { "length": 1020, "commands": 4, "command_list": [ "./run-tests.sh # or your test command", "lcov -c -d . --out-file coverage.info", "gcov -c -d . --out-file coverage.info", "You can write a test for this function using Jest:" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 1, "lesson_hit_rate": 0.25 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "AgentCap secret-safe verification rejects sensitive metadata — how to diagnose without leaking (agentcap-secret-safe-verification-failure)", "condition": "with_lesson", "status": 200, "content": "Here's a concrete, actionable fix to diagnose and resolve the issue without leaking sensitive data:\n\n**Step 1: Identify the affected field**\n\nRun verification with verbose output:\n\n```bash\nagentcap verify --verbose 2>&1 | grep \"secret-safe\"\n```\n\nThis command will output JSON paths like `capabilities[2].description` or `skills[name=deploy].config.endpoint`.\n\n**Step 2: Inspect the field (read-only)**\n\nExport the capability metadata to a temporary file:\n\n```bash\nagentcap export --format json /tmp/caps.json\n```\n\nThis will save the capability metadata to a JSON file at `/tmp/caps.json`.\n\n**Step 3: Find the specific field**\n\nOpen the JSON file in a text editor or use a JSON parser like `jq` to find the specific field:\n\n```bash\njq '.capabilities[2].description' /tmp/caps.json\n```\n\nReplace `[2]` with the actual index of the field that triggered the `secret-safe` error.\n\nIf the field is nested, use a more specific path, like:\n\n```bash\njq '.skills[name=\"deploy\"].config.endpoint' /tmp/caps.json\n```\n\n**Step 4: Fix the field**\n\nOnce you've identified", "metrics": { "length": 1053, "commands": 4, "command_list": [ "agentcap verify --verbose 2>&1 | grep \"secret-safe\"", "agentcap export --format json /tmp/caps.json", "jq '.capabilities[2].description' /tmp/caps.json", "jq '.skills[name=\"deploy\"].config.endpoint' /tmp/caps.json" ], "has_command_block": true, "actionable": true, "inline_code_count": 13, "lesson_hits": 3, "lesson_hit_rate": 0.375 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "AgentCap secret-safe verification rejects sensitive metadata — how to diagnose without leaking (agentcap-secret-safe-verification-failure)", "condition": "plain", "status": 200, "content": "The error \"AgentCap secret-safe verification rejects sensitive metadata\" is typically encountered when using the `agentcap` plugin in a Kubernetes cluster. This plugin is used for secret-safe verification, which checks the metadata of a secret against a set of predefined rules to ensure it's safe to use.\n\nTo diagnose and fix this issue without leaking sensitive information, follow these steps:\n\n### Step 1: Gather Information\n\nRun the following command to gather information about the secret:\n```bash\nkubectl get secret -o yaml\n```\nReplace `` with the actual name of your secret.\n\nThis will display the secret's metadata in YAML format. Look for any sensitive information that might be causing the verification failure.\n\n### Step 2: Identify the Problematic Field\n\nIn the secret's metadata, identify the field that's causing the verification failure. This field is usually marked as `sensitive` or has a specific label.\n\nFor example, let's say the problematic field is `username`:\n```yaml\nmetadata:\n annotations:\n secret-name: my-secret\n labels:\n app: my-app\n sensitive:\n username: my-username\n```\n### Step 3: Update the Secret\n\nUpdate the secret to remove or mask the sensitive", "metrics": { "length": 1220, "commands": 1, "command_list": [ "kubectl get secret -o yaml" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 3, "lesson_hit_rate": 0.375 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Always Add Tests with Code Changes to Pass CI Coverage Gates (ci-test-coverage-gate)", "condition": "with_lesson", "status": 200, "content": "**Fixing the \"Always Add Tests with Code Changes to Pass CI Coverage Gates\" Error**\n\nTo fix the error, follow these steps:\n\n### Step 1: Identify the CI gate behavior\n\nCheck if the repository has a \"Changed tests fail without the change\" CI job:\n```bash\ngh pr checks --json name,bucket | jq '.[] | select(.name | contains(\"test\"))'\n```\nReplace `` with the actual PR number.\n\n### Step 2: Add a test file matching the changed source\n\nFor bug fixes, add a test that reproduces the bug and verifies the fix:\n```python\n# tests/unit/test_fixed_module.py\nimport unittest\nfrom src.module import fixed_function\n\nclass TestBugFix(unittest.TestCase):\n def test_bug_fix_verifies_correct_behavior(self):\n \"\"\"Verify the bug is fixed — this test would fail without the code change.\"\"\"\n buggy_input = ... # input that triggers the bug\n expected_output = ... # expected output after fixing the bug\n result = fixed_function(buggy_input)\n self.assertEqual(result, expected_output)\n```\nFor refactors or new code, add a test that covers the new functionality:\n```python\n# tests/unit/test_new_function", "metrics": { "length": 1141, "commands": 2, "command_list": [ "gh pr checks --json name,bucket | jq '.[] | select(.name | contains(\"test\"))'", "For refactors or new code, add a test that covers the new functionality:" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 2, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Always Add Tests with Code Changes to Pass CI Coverage Gates (ci-test-coverage-gate)", "condition": "with_lesson", "status": 200, "content": "Here's a step-by-step solution with concrete, actionable commands to fix the issue:\n\n**Step 1: Identify the CI gate behavior**\n\nOpen a terminal and navigate to your repository's root directory. Run the following command to check if the repository has a \"Changed tests fail without the change\" CI job:\n```bash\ngh pr checks ` with the actual number of the pull request you're working on.\n\nIf the CI job is present, you should see a JSON object containing the name of the job. If not, proceed to the next step.\n\n**Step 2: Add a test file matching the changed source**\n\nNavigate to the `tests` directory and create a new file with the same name as the changed source file. For example, if the source file is `src/module.py`, create a new file `tests/test_module.py`.\n\nIn this file, add a test that reproduces the bug and verifies the fix:\n```python\n# tests/test_module.py\nimport unittest\nfrom src.module import fixed_function, buggy_input, expected_output\n\nclass TestBugFix(unittest.TestCase):\n def test_bug_fix_verifies_correct_behavior", "metrics": { "length": 1136, "commands": 1, "command_list": [ "gh pr checks ` with the actual ID of the run you want to view. This command will display all 15 jobs, including their individual conclusions.\n\n**Example**\n\nLet's say you have a workflow file named `matrix-builds.yml` with the", "metrics": { "length": 1002, "commands": 2, "command_list": [ "**Step 2: Verify all matrix jobs run**", "After updating your workflow file, push your changes to your repository. Then, use the following command to verify that all matrix jobs ran:" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Set fail-fast: false for Matrix Builds to See All Failures (ci-workflow-fail-fast-matrix)", "condition": "plain", "status": 200, "content": "To fix the issue, you need to set `fail-fast` to `false` in your GitHub Actions workflow file. Here are the exact steps:\n\n1. Open your GitHub Actions workflow file (`*.yml` file) in a text editor.\n2. Find the section related to matrix builds. It should look something like this:\n```yml\nmatrix:\n strategy:\n fail-fast: true\n```\n3. Change the `fail-fast` value to `false`:\n```yml\nmatrix:\n strategy:\n fail-fast: false\n```\n4. Save the changes to your workflow file.\n\nAlternatively, you can also use the GitHub UI to update the workflow file:\n\n1. Go to your repository settings > Actions > Workflows.\n2. Click on the three dots next to your workflow and select \"Edit\".\n3. In the workflow editor, find the section related to matrix builds.\n4. Click on the three dots next to the `fail-fast` field and select \"Edit\".\n5. Change the value to `false` and save the changes.\n\nAfter making these changes, your workflow should run with `fail-fast` set to `false`, allowing you to see all failures in your matrix builds.", "metrics": { "length": 1012, "commands": 1, "command_list": [ "3. Change the `fail-fast` value to `false`:" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Set fail-fast: false for Matrix Builds to See All Failures (ci-workflow-fail-fast-matrix)", "condition": "with_lesson", "status": 200, "content": "Here's a concrete, actionable fix with exact commands to resolve the issue:\n\n**Step 1: Add explicit fail-fast: false**\n\n1. Open your GitHub Actions workflow file (e.g., `.github/workflows/ci.yml`) in a text editor.\n2. Locate the `strategy` block and add the following line:\n```yaml\nstrategy:\n matrix:\n python-version: [\"3.10\", \"3.11\", \"3.12\"]\n test-group: [\"unit\", \"integration\", \"e2e\", \"smoke\", \"regression\"]\n fail-fast: false\n```\nThis sets `fail-fast` to `false` explicitly.\n\n**Step 2: Verify all matrix jobs run**\n\n1. Run the following command in your terminal to view the workflow run:\n```bash\ngh run view --json jobs --jq '.jobs[] | {name: .name, conclusion: .conclusion}'\n```\nReplace `` with the actual ID of the workflow run.\n\n**Expected output**\n\nThe expected output should show all 15 jobs with their individual conclusions, not 1 failure + 14 cancelled. The output should look something like this:\n```json\n[\n {\n \"name\": \"python", "metrics": { "length": 966, "commands": 6, "command_list": [ "This sets `fail-fast` to `false` explicitly.", "**Step 2: Verify all matrix jobs run**", "1. Run the following command in your terminal to view the workflow run:", "Replace `` with the actual ID of the workflow run.", "**Expected output**" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "codesign --entitlements prints a Usage banner unless you give it a destination (codesign-entitlements-needs-a-destination)", "condition": "with_lesson", "status": 200, "content": "To fix this issue, you need to provide a destination argument to the `--entitlements` flag. Here are some concrete and actionable fixes with exact commands:\n\n**Fix 1: Write to stdout**\n\n```bash\ncodesign --entitlements - /System/Applications/Calculator.app\n```\n\nThis will print the entitlements to the console.\n\n**Fix 2: Write to a file**\n\n```bash\ncodesign --entitlements /out.plist /System/Applications/Calculator.app\n```\n\nThis will write the entitlements to a file named `out.plist` in the current directory.\n\n**Fix 3: Write to a human-readable format**\n\n```bash\ncodesign --entitlements - --human-readable /System/Applications/Calculator.app\n```\n\nThis will print the entitlements in a human-readable format.\n\n**Fix 4: Write to a plist XML format**\n\n```bash\ncodesign --entitlements - --xml /System/Applications/Calculator.app\n```\n\nThis will write the entitlements to a plist XML file that can be parsed by `plutil/xmllint`.\n\nBy providing a destination argument, you can specify how the entitlements should be written, which should resolve the issue and prevent the Usage banner from", "metrics": { "length": 1082, "commands": 4, "command_list": [ "codesign --entitlements - /System/Applications/Calculator.app", "codesign --entitlements /out.plist /System/Applications/Calculator.app", "codesign --entitlements - --human-readable /System/Applications/Calculator.app", "codesign --entitlements - --xml /System/Applications/Calculator.app" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 5, "lesson_hit_rate": 0.625 }, "error": null }, { "model": "@cf/meta/llama-3.1-8b-instruct-fp8-fast", "scenario": "Always Add Tests with Code Changes to Pass CI Coverage Gates (ci-test-coverage-gate)", "condition": "plain", "status": 200, "content": "The error \"Always Add Tests with Code Changes to Pass CI Coverage Gates (ci-test-coverage-gate)\" typically occurs when you've made code changes but haven't updated the test coverage to pass the Continuous Integration (CI) coverage gates. Here's a concrete, actionable fix with exact commands:\n\n**Assumptions:**\n\n* You're using a CI/CD tool like Jenkins, Travis CI, or CircleCI.\n* You have a test coverage metric set up in your CI/CD pipeline.\n* You've made code changes that require new tests.\n\n**Step 1: Run your tests to identify the new code coverage**\n\nRun your tests to identify the new code coverage:\n```bash\npython -m unittest discover -s path/to/your/tests\n```\nThis command will run all your tests and provide a coverage report.\n\n**Step 2: Update your test suite to cover the new code**\n\nUpdate your test suite to cover the new code. You can do this by:\n\n* Writing new tests for the new code\n* Updating existing tests to cover the new code\n* Refactoring your code to make it testable\n\n**Step 3: Run your tests again to verify the new code coverage**\n\nRun your tests again to verify the new code coverage:\n```", "metrics": { "length": 1116, "commands": 1, "command_list": [ "python -m unittest discover -s path/to/your/tests" ], "has_command_block": true, "actionable": true, "inline_code_count": 2, "lesson_hits": 1, "lesson_hit_rate": 0.25 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "codesign --entitlements prints a Usage banner unless you give it a destination (codesign-entitlements-needs-a-destination)", "condition": "plain", "status": 200, "content": "The error message you're seeing is because the `--entitlements` option in `codesign` requires a destination to write the entitlements to. Here's a concrete and actionable fix:\n\n**Solution:**\n\n1. Create a file named `entitlements.plist` with the following content:\n\n```xml\n\n\n\n \n com.example.entitlements\n \n com.example.key\n value\n \n \n\n```\n\nReplace `com.example` with your actual bundle ID and `com.example.key` with the actual key you want to add entitlements for.\n\n2. Run the following command to generate the entitlements:\n\n```bash\ncodesign --entitlements -e /path/to/entitlements.plist -f\n```\n\nReplace `/path/to/entitlements.plist` with the path to the `entitlements.plist`", "metrics": { "length": 967, "commands": 2, "command_list": [ "Replace `com.example` with your actual bundle ID and `com.example.key` with the actual key you want to add entitlements for.", "2. Run the following command to generate the entitlements:" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 5, "lesson_hit_rate": 0.625 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Codex desktop: reload MCP config without restarting the app (codex-desktop-mcp-config-reload)", "condition": "with_lesson", "status": 200, "content": "Here's a concrete, actionable fix to reload MCP config without restarting the Codex desktop app:\n\n**Solution for macOS Desktop App:**\n\n1. Open the Terminal app on your macOS machine.\n2. Find the process ID (PID) of the running Codex desktop app-server using the following command:\n\n```bash\nlsof | grep codex.app-server\n```\n\nThis will display a line with the PID of the running process.\n\n3. Kill the process using the following command:\n\n```bash\npkill -f \"codex.app-server\" -9\n```\n\nThe `-9` option sends a SIGKILL signal to the process, which forces it to exit immediately.\n\n4. Open the Terminal app again and verify that the MCP config has been reloaded:\n\n```bash\ncodex mcp get \n```\n\nReplace `` with the name of the MCP server you removed.\n\n5. Verify that the removed server is no longer listed:\n\n```bash\ncodex mcp list 2/dev/null | head -5\n```\n\nThis command redirects the output to `/dev/null` and displays the first 5 lines of the output, which should not include the removed server.\n\n**Solution for Windows Desktop App:**\n\n1. Open", "metrics": { "length": 1059, "commands": 4, "command_list": [ "lsof | grep codex.app-server", "pkill -f \"codex.app-server\" -9", "codex mcp get ", "codex mcp list 2/dev/null | head -5" ], "has_command_block": true, "actionable": false, "inline_code_count": 10, "lesson_hits": 4, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Codex desktop: reload MCP config without restarting the app (codex-desktop-mcp-config-reload)", "condition": "plain", "status": 200, "content": "The error `codex-desktop-mcp-config-reload` typically occurs when the MCP (Mod Configuration Platform) configuration file is not properly loaded. Here's a concrete, actionable fix to reload the MCP config without restarting the Codex desktop app:\n\n**Method 1: Using the Command Line**\n\n1. Open a terminal or command prompt.\n2. Navigate to the Codex desktop app directory. You can find the directory by running `cd ~` (on Linux/macOS) or `cd %USERPROFILE%` (on Windows).\n3. Run the following command to reload the MCP config:\n```\n./codex-desktop --reload-mcp-config\n```\nThis command will reload the MCP config without restarting the app.\n\n**Method 2: Using the GUI**\n\n1. Open the Codex desktop app.\n2. Click on the three dots (⋯) in the top-right corner of the app window.\n3. Select \"Options\" from the dropdown menu.\n4. In the Options window, click on the \"General\" tab.\n5. Scroll down to the \"Reload MCP Config\" section and click on the \"Reload\" button.\n\nThis will reload the MCP config without restarting the app.\n\n**Method 3: Using the MCP Config Reload Tool**\n\n", "metrics": { "length": 1064, "commands": 1, "command_list": [ "./codex-desktop --reload-mcp-config" ], "has_command_block": true, "actionable": true, "inline_code_count": 4, "lesson_hits": 3, "lesson_hit_rate": 0.75 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Codex CLI: keyring 'User interaction is not allowed' diagnosis (codex-keyring-user-interaction-not-allowed)", "condition": "plain", "status": 200, "content": "The error \"User interaction is not allowed\" typically occurs when the `keyring` library is unable to retrieve or store sensitive information due to the lack of user interaction. Here's a concrete, actionable fix with exact commands:\n\n**Fix 1: Install `keyring` with `sudo` (for system-wide installation)**\n\nIf you're using a Linux or macOS system, you can try installing `keyring` with `sudo` to ensure it has the necessary permissions to interact with the system's keyring:\n\n```bash\nsudo apt-get update (for Ubuntu-based systems)\nsudo yum install keyring (for RHEL-based systems)\nsudo brew install keyring (for macOS with Homebrew)\n```\n\n**Fix 2: Use `keyring` with `keyring.backend=store` (for local keyring)**\n\nAlternatively, you can configure `keyring` to use a local keyring instead of the system's keyring. This can help avoid the \"User interaction is not allowed\" error:\n\n```bash\npip install --upgrade keyring\n```\n\nThen, add the following configuration to your `~/.config/keyring/keys.conf` file (create the directory if it doesn't exist):\n\n```ini\n[General]\nbackend = store\n", "metrics": { "length": 1080, "commands": 4, "command_list": [ "sudo apt-get update (for Ubuntu-based systems)", "sudo yum install keyring (for RHEL-based systems)", "sudo brew install keyring (for macOS with Homebrew)", "pip install --upgrade keyring" ], "has_command_block": true, "actionable": true, "inline_code_count": 13, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Codex CLI: MCP handshake succeeds but the model never receives the tools (codex-mcp-tools-not-injected-despite-handshake)", "condition": "with_lesson", "status": 200, "content": "To fix the issue \"Codex CLI: MCP handshake succeeds but the model never receives the tools (codex-mcp-tools-not-injected-despite-handshake)\", you can try the following steps:\n\n1. **Update Codex CLI**: Ensure you are running the latest version of Codex CLI. You can update it using the following command:\n ```bash\npip install --upgrade codex-cli\n```\n\n2. **Re-register MCP server**: Try re-registering the MCP server using the following command:\n ```bash\ncodex mcp add --h\n```\n\n3. **Re-import MCP server**: If re-registering doesn't work, try re-importing the MCP server using the following command:\n ```bash\ncodex mcp import --h\n```\n\n4. **Check MCP server configuration**: Verify that the MCP server configuration is correct and matches the expected format. You can check the configuration using the following command:\n ```bash\ncodex mcp config --h\n```\n\n5. **Try a different transport**: Although the issue is not specific to the transport layer, you can try switching to a different transport (e.g., from streamable-http to stdio) to see if it resolves the issue. Use the following commands", "metrics": { "length": 1098, "commands": 4, "command_list": [ "pip install --upgrade codex-cli", "codex mcp add --h", "codex mcp import --h", "codex mcp config --h" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Codex CLI: MCP handshake succeeds but the model never receives the tools (codex-mcp-tools-not-injected-despite-handshake)", "condition": "plain", "status": 200, "content": "The error \"codex-mcp-tools-not-injected-despite-handshake\" typically occurs when the MCP handshake is successful, but the model doesn't receive the tools. This can be caused by several factors, including incorrect configuration or dependencies. Here's a step-by-step guide to help you resolve the issue:\n\n**Step 1: Update Codex CLI and MCP tools**\n\nFirst, make sure you're running the latest versions of Codex CLI and MCP tools. You can update them using the following commands:\n\n```bash\n# Update Codex CLI\ngit pull origin main\n\n# Install the latest MCP tools\ngit pull origin main\npip install --upgrade codex-mcp-tools\n```\n\n**Step 2: Check MCP configuration**\n\nVerify that your MCP configuration is correct. You can do this by checking the `codex.yaml` file or the `mcp.yaml` file, depending on your configuration. Make sure that the `mcp` section is correctly configured, including the `tools` and `model` settings.\n\n```yml\n# codex.yaml example\nmcp:\n tools:\n - tool1\n - tool2\n model:\n - model1\n - model2\n```\n\n**Step 3: Check dependencies", "metrics": { "length": 1052, "commands": 3, "command_list": [ "git pull origin main", "git pull origin main", "pip install --upgrade codex-mcp-tools" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Codex CLI: keyring 'User interaction is not allowed' diagnosis (codex-keyring-user-interaction-not-allowed)", "condition": "with_lesson", "status": 200, "content": "To fix the Codex CLI error 'User interaction is not allowed', follow these steps:\n\n**Step 1: Diagnose the ACL**\n\n1. Check the Keychain item's ACL:\n```bash\nsecurity find-generic-password -s \"Codex Auth\" -a \"\" 2>&1\n```\nReplace `` with your actual email address used for Codex authentication.\n\n2. Look for \"accc\" (access control) entries, which indicate the app paths allowed to access the Keychain item.\n\n3. Check if Keychain is actually locked from the CLI perspective:\n```bash\nsecurity show-keychain-info ~/Library/Keychains/login.keychain-db 2>&1\n```\n\n**Step 2: Fix the ACL**\n\n**Option A: Delete and recreate the item**\n\nThis will delete the existing Keychain item and recreate it, which will allow the Codex CLI to write OAuth tokens.\n\n1. Delete the existing Keychain item:\n```bash\nsecurity delete-generic-password -s \"Codex Auth\" -a \"\" 2>&1\n```\nReplace `` with your actual email address used for Codex authentication.\n\n2. Log out of Codex and wait for the login status to", "metrics": { "length": 1022, "commands": 3, "command_list": [ "security find-generic-password -s \"Codex Auth\" -a \"\" 2>&1", "security show-keychain-info ~/Library/Keychains/login.keychain-db 2>&1", "security delete-generic-password -s \"Codex Auth\" -a \"\" 2>&1" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC 客户端假活排查:装有 DLP/EDR 的工控站上分层定位注入与内核过滤 (fanuc-rgcore-hang-endpoint-security-injection)", "condition": "with_lesson", "status": 200, "content": "根据提供的错误信息和解决方案,以下是解决 FANUC 客户端假活排查的具体步骤:\n\n**步骤 1: 停用 User Mode Detours 注入**\n\n1. 打开 Command Prompt 或 PowerShell。\n2. 运行以下命令:`dlt` -u -r -s frsock.dll -x -v`\n\n 这个命令会停用 User Mode Detours 注入,防止它干扰 FANUC 进程。\n\n**步骤 2: 停用 Windows Filtering Platform (WFP) 内核过滤**\n\n1. 打开 Command Prompt 或 PowerShell。\n2. 运行以下命令:`netsh wfp delete filtername=\"FANUC\"`\n\n 这个命令会删除 WFP 内核过滤,防止它干扰 FANUC 进程。\n\n**步骤 3: 停用 EDR 内核驱动**\n\n1. 打开 Command Prompt 或 PowerShell。\n2. 运行以下命令:`msiexec /x {EDR_drivers_installation_key}`\n\n 这个命令会卸载 EDR 内核驱动,防止它", "metrics": { "length": 514, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 3, "lesson_hits": 2, "lesson_hit_rate": 0.25 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC 客户端假活排查:装有 DLP/EDR 的工控站上分层定位注入与内核过滤 (fanuc-rgcore-hang-endpoint-security-injection)", "condition": "plain", "status": 200, "content": "The error message you're encountering is related to a security issue in FANUC's CNC system. The specific error code \"fanuc-rgcore-hang-endpoint-security-injection\" indicates that there's an issue with the endpoint security injection feature. Here's a step-by-step guide to resolve this issue:\n\n**Prerequisites:**\n\n* You have administrative access to the FANUC system.\n* You have the necessary permissions to modify system settings.\n\n**Step 1: Check the System Settings**\n\n1. Open the FANUC system settings by navigating to `Settings` > `System Settings` or `System Setup` > `System Settings`.\n2. Check if the `Endpoint Security` feature is enabled. If it's enabled, proceed to the next step.\n\n**Step 2: Disable Endpoint Security**\n\n1. Go to `Settings` > `System Settings` or `System Setup` > `System Settings`.\n2. Click on `Endpoint Security` and toggle the switch to the \"Off\" position.\n3. Click \"Apply\" to save the changes.\n\n**Step 3: Verify the System**\n\n1. Restart the FANUC system by running the command: `sudo restart fanuc-rgcore`\n2. Verify that the system is running without", "metrics": { "length": 1082, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 11, "lesson_hits": 1, "lesson_hit_rate": 0.125 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "gh pr edit --body with an empty variable silently wipes the PR description (gh-cli-empty-body-silently-wipes-pr-description)", "condition": "with_lesson", "status": 200, "content": "The issue you're facing is due to the way `gh pr edit` handles empty variables. To fix this, you can use the `--body` flag with a default value, or you can check if the variable is empty before passing it to the `gh pr edit` command.\n\nHere's an example of how you can fix this using a default value:\n\n```bash\nNEW=$(echo \"This is the new PR body\" || echo \"\")\ngh pr edit --repo R --body \"$NEW\"\n```\n\nIn this command, if the `echo` command fails (i.e., the variable is empty), it will print an empty string to the `NEW` variable, and `gh pr edit` will set the PR body to an empty string.\n\nAlternatively, you can use a more robust way to handle empty variables by checking if the variable is empty before passing it to `gh pr edit`:\n\n```bash\nif [ -z \"$NEW\" ]; then\n gh pr edit --repo R --body \"No PR body provided\"\nelse\n gh pr edit --repo R --body \"$NEW\"\nfi\n```\n\nIn this command, if the `NEW` variable is empty, it will print a default message to the user, and `gh pr edit", "metrics": { "length": 969, "commands": 7, "command_list": [ "NEW=$(echo \"This is the new PR body\" || echo \"\")", "gh pr edit --repo R --body \"$NEW\"", "if [ -z \"$NEW\" ]; then", "gh pr edit --repo R --body \"No PR body provided\"", "else" ], "has_command_block": true, "actionable": true, "inline_code_count": 12, "lesson_hits": 4, "lesson_hit_rate": 0.8 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "gh pr edit --body with an empty variable silently wipes the PR description (gh-cli-empty-body-silently-wipes-pr-description)", "condition": "plain", "status": 200, "content": "The error you're encountering is due to an empty variable in the `gh pr edit` command, which silently wipes the PR description. Here's a concrete, actionable fix:\n\n**Step 1: Identify the empty variable**\n\nRun the following command to identify the empty variable:\n```bash\ngh pr edit --body\n```\nThis will display the current PR description. Look for any empty variables in the format `{{variable_name}}`.\n\n**Step 2: Replace the empty variable with a valid value**\n\nReplace the empty variable with a valid value. For example, if the empty variable is `{{description}}`, you can replace it with a valid description, like this:\n```bash\ngh pr edit --body \"This is a sample PR description\"\n```\n**Step 3: Update the PR**\n\nRun the following command to update the PR:\n```bash\ngh pr edit --body \"This is a sample PR description\"\n```\n**Alternative solution: Use a template**\n\nIf you frequently find yourself using the same PR description, you can create a template to avoid manual typing. Create a file named `pr-description-template` with the following content:\n```yaml\n---\ntitle: \"Sample PR Description\"\ndescription: \"This is a sample PR description\"\n```\n", "metrics": { "length": 1145, "commands": 3, "command_list": [ "gh pr edit --body", "gh pr edit --body \"This is a sample PR description\"", "gh pr edit --body \"This is a sample PR description\"" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 2, "lesson_hit_rate": 0.4 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "git stash is repository-wide, not worktree-local — a bare stash pop can apply another session's work (git-stash-is-repository-wide)", "condition": "plain", "status": 200, "content": "The error you're encountering is due to the fact that you're trying to stash and pop changes in a bare repository, which is a repository that's not associated with any worktree. Stashing and popping changes in a bare repository can lead to unexpected behavior, as the stash is repository-wide and can be applied to any branch in the repository.\n\nTo fix this issue, you need to stash and pop changes in a worktree. Here's how you can do it:\n\n1. Create a new worktree:\n\n```bash\ngit worktree add \n```\n\nReplace `` with the name of the branch you want to work on, and `` with the desired path for the worktree.\n\n2. Stash changes in the worktree:\n\n```bash\ngit stash\n```\n\nThis will stash all changes in the current branch of the worktree.\n\n3. Switch to the worktree:\n\n```bash\ngit worktree use \n```\n\nThis will switch you to the worktree you created earlier.\n\n4. Pop the stash:\n\n```bash\ngit stash pop\n```\n\nThis will apply the stash to the current branch in the worktree.\n\nAlternatively, you can use `git stash", "metrics": { "length": 1076, "commands": 4, "command_list": [ "git worktree add ", "git stash", "git worktree use ", "git stash pop" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 1, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "git stash is repository-wide, not worktree-local — a bare stash pop can apply another session's work (git-stash-is-repository-wide)", "condition": "with_lesson", "status": 200, "content": "The error you're encountering is due to the fact that `git stash` is a repository-wide feature, not worktree-local. This means that all worktrees in the same clone share the same stash storage.\n\nTo avoid this issue, you can use `git stash` with the `--work-tree` option, which tells Git to stash the changes in a specific worktree. Here's how you can do it:\n\n1. First, make sure you're in the correct worktree by running `git worktree add `.\n2. Then, stash the changes in the current worktree using the following command:\n ```bash\ngit stash --work-tree= -p\n```\n Replace `` with the name of the worktree where you want to stash the changes.\n\n3. To apply the stash, use the following command:\n ```bash\ngit stash apply --work-tree=\n```\n\nBy using `--work-tree`, you ensure that the stash is created and applied in a specific worktree, avoiding the repository-wide stash issue.\n\nNote: Make sure to replace `` with the actual name of the worktree where you want to stash and apply", "metrics": { "length": 1072, "commands": 2, "command_list": [ "git stash --work-tree= -p", "git stash apply --work-tree=" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 1, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Green unit tests hid a build-only type error, because the test runner strips types and never checks them (green-tests-hid-a-build-only-type-error)", "condition": "with_lesson", "status": 200, "content": "The issue you're facing is due to the test runner (vitest or jest) stripping types and not performing type checks. This means that even if a type error exists in your code, the test runner won't catch it.\n\nTo fix this, you can use a tool like `tslint` or `ts-morph` to lint your code before running the tests. This will help catch type errors and ensure that your code is type-safe.\n\nHere's a concrete, actionable fix:\n\n1. Install the `tslint` package:\n ```bash\nnpm install tslint --save-dev\n```\n or\n ```bash\nyarn add tslint --dev\n```\n\n2. Create a `tslint.json` configuration file in the root of your project:\n ```json\n{\n \"rules\": {\n \"no-empty-interface\": true,\n \"no-implicit-any\": true,\n \"no-any\": true\n }\n}\n```\n\n3. Create a script in your `package.json` to run the tests with type checking:\n ```json\n\"scripts\": {\n \"test\": \"tslint ./src/**/*.ts && vitest ./src/**/*.test.ts\"\n}\n```\n\n4. Run the tests with type checking:\n ```", "metrics": { "length": 948, "commands": 4, "command_list": [ "npm install tslint --save-dev", "yarn add tslint --dev", "3. Create a script in your `package.json` to run the tests with type checking:", "4. Run the tests with type checking:" ], "has_command_block": true, "actionable": true, "inline_code_count": 13, "lesson_hits": 2, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Green unit tests hid a build-only type error, because the test runner strips types and never checks them (green-tests-hid-a-build-only-type-error)", "condition": "plain", "status": 200, "content": "To fix the \"green-tests-hid-a-build-only-type-error\" error, you need to ensure that the test runner is not stripping types from your tests. Here's a concrete, actionable fix:\n\n**Solution:**\n\n1. **Install `ts-jest`**: If you're using Jest, you can install `ts-jest` which is a TypeScript version of Jest. This will allow you to use TypeScript types in your tests.\n\n ```bash\nnpm install --save-dev ts-jest\n```\n\n2. **Configure `ts-jest`**: Create a `ts-jest.config.js` file in the root of your project with the following configuration:\n\n ```javascript\nmodule.exports = {\n // ... other configurations ...\n moduleFileExtensions: ['js', 'json', 'ts', 'tsx', 'jsx'],\n testEnvironment: 'jsdom',\n testPathIgnorePatterns: ['node_modules'],\n transform: {\n '^.+\\\\.(ts|tsx)$': 'ts-jest',\n },\n};\n```\n\n3. **Update your `jest.config.js` file**: If you're using Jest, you can remove the `moduleFileExtensions` configuration from your `jest.config.js` file, as `ts-jest` will handle", "metrics": { "length": 977, "commands": 1, "command_list": [ "npm install --save-dev ts-jest" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 2, "lesson_hit_rate": 0.667 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "An IM bot is a guest on someone else's stack: pin the client, the OS, and the install order (im-bot-environment-contracts)", "condition": "with_lesson", "status": 200, "content": "The error message indicates that an IM bot (WeChat, Feishu, WeCom) is running on someone else's stack, which is causing issues with the client, OS, and install order. To fix this issue, we need to pin the client, OS, and install order. Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Pin the client**\n\nWeChat uses the Tencent desktop process, so we need to pin this process to ensure it runs on the same client version. We can do this by using the `wcferry` command:\n\n```bash\nwcferry pin --client-version \n```\n\nReplace `` with the exact version number of the WeChat desktop process that you want to pin.\n\n**Step 2: Pin the OS**\n\nSince the automation library needs a specific OS, we need to pin the OS to ensure it runs on the same version. We can do this by using the `wcferry` command:\n\n```bash\nwcferry pin --os-version \n```\n\nReplace `` with the exact version number of the OS that you want to pin.\n\n**Step 3: Pin the install order**\n\nTo pin the install order, we need", "metrics": { "length": 1043, "commands": 2, "command_list": [ "wcferry pin --client-version ", "wcferry pin --os-version " ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Verify Import Paths After Refactoring Python Modules (import-path-verification-after-refactor)", "condition": "with_lesson", "status": 200, "content": "Here's a concrete, actionable fix with exact commands to resolve the \"Verify Import Paths After Refactoring Python Modules\" error:\n\n### Step 1: Find all references to the old import path\n\nRun the following commands to search for old import paths across the entire repository:\n\n```bash\n# Search for old import path across the entire repo\ngrep -r \"from old.module import\" --include=\".py\" .\ngrep -r \"from old.module import\" --include=\".py\" tests/\n\n# Search for direct module references\ngrep -r \"old\\.module\\.\" --include=\".py\"\n```\n\n### Step 2: Update all import statements\n\nUpdate all import statements to use the new paths:\n\n```bash\n# Replace old imports with new paths\nfind . -type f -name \"*.py\" -exec sed -i 's/from old.module import /from new.module import /g' {} \\;\nfind . -type f -name \"*.py\" -exec sed -i 's/old\\.module\\.//g' {} \\;\nfind . -type f -name \"*.py\" -exec sed -i 's/old\\.module\\.//g' {} \\;\n```\n\nHere's what each command does:\n\n- `find . -type", "metrics": { "length": 956, "commands": 6, "command_list": [ "grep -r \"from old.module import\" --include=\".py\" .", "grep -r \"from old.module import\" --include=\".py\" tests/", "grep -r \"old\\.module\\.\" --include=\".py\"", "find . -type f -name \"*.py\" -exec sed -i 's/from old.module import /from new.module import /g' {} \\;", "find . -type f -name \"*.py\" -exec sed -i 's/old\\.module\\.//g' {} \\;" ], "has_command_block": true, "actionable": true, "inline_code_count": 4, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "An IM bot is a guest on someone else's stack: pin the client, the OS, and the install order (im-bot-environment-contracts)", "condition": "plain", "status": 200, "content": "The error message \"An IM bot is a guest on someone else's stack: pin the client, the OS, and the install order (im-bot-environment-contracts)\" typically occurs in the context of a Hyperledger Fabric network. Here's a step-by-step fix to resolve this issue:\n\n**Prerequisites:**\n\n* You have a Hyperledger Fabric network set up with multiple organizations (Org1 and Org2).\n* You have installed the Fabric SDK and CLI tools.\n* You have created a channel (e.g., mychannel) and have the necessary permissions.\n\n**Step 1: Identify the conflicting environment**\n\nTo identify the conflicting environment, you can run the following command:\n\n```bash\nfabric-shim list-environment\n```\n\nThis will list all the environments in your Fabric network. Look for the environment that is causing the conflict.\n\n**Step 2: Remove the conflicting environment**\n\nTo remove the conflicting environment, you can use the following command:\n\n```bash\nfabric-shim rm-environment \n```\n\nReplace `` with the name of the conflicting environment. For example:\n\n```bash\nfabric-shim rm-environment im-bot-environment\n```\n\n**Step 3: Pin the client, OS, and install order**\n\nTo", "metrics": { "length": 1173, "commands": 3, "command_list": [ "fabric-shim list-environment", "fabric-shim rm-environment ", "fabric-shim rm-environment im-bot-environment" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Verify Import Paths After Refactoring Python Modules (import-path-verification-after-refactor)", "condition": "plain", "status": 200, "content": "The error \"Verify Import Paths After Refactoring Python Modules\" is raised when the import paths in your code have changed, but the Python interpreter hasn't been updated to reflect these changes.\n\nTo fix this issue, you can try the following steps:\n\n1. **Update your `sys.path`**: You can manually update your `sys.path` to include the new import paths. However, this is not recommended as it can lead to version conflicts.\n\n Instead, you can use the `sys.path.insert` method to insert the new paths at the beginning of the list.\n\n ```bash\npython -m sys.path.insert(0, '/path/to/new/import')\n```\n\n2. **Use `python -m pip freeze`**: This command will list all the packages that are currently installed in your Python environment.\n\n Then, you can use the `pip install` command with the `--upgrade` option to upgrade all packages to the latest versions.\n\n ```bash\npython -m pip freeze\npip install --upgrade -r requirements.txt\n```\n\n3. **Use `python -m pip install --upgrade -r requirements.txt`**: This command will upgrade all packages to the latest versions.\n\n4. **Check for virtual environments**: If you're using virtual environments,", "metrics": { "length": 1144, "commands": 3, "command_list": [ "python -m sys.path.insert(0, '/path/to/new/import')", "python -m pip freeze", "pip install --upgrade -r requirements.txt" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 2, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Sanitizing every interpolated value is not enough — exc_info=True appends the raw traceback (log-sanitizer-must-live-in-the-formatter)", "condition": "plain", "status": 200, "content": "The error message you're encountering is due to the `exc_info=True` parameter in the `traceback` module. This parameter is used to include the raw traceback in the exception information. However, this can lead to issues when trying to debug the issue, as the traceback can be large and may not be easily readable.\n\nOne way to fix this issue is to use the `traceback.format_exc()` function instead of `traceback.format_exc(exc_info=True)`. Here's how you can do it:\n\n```python\nimport traceback\n\ndef my_function():\n try:\n # Code that may raise an exception\n pass\n except Exception as e:\n formatted_exc = traceback.format_exc()\n # Do something with the formatted exception\n print(formatted_exc)\n\nmy_function()\n```\n\nIn this example, `traceback.format_exc()` will format the exception without including the raw traceback. This will prevent the error message you're seeing.\n\nAlternatively, if you're using Python 3.9 or later, you can use the `traceback.format_exception()` function instead. This function allows you to specify the exception type and the exception instance, which can be more useful than just formatting the exception.\n\n```python\nimport traceback\n\ndef my_function():\n try:\n", "metrics": { "length": 1228, "commands": 2, "command_list": [ "In this example, `traceback.format_exc()` will format the exception without including the raw traceback. This will prevent the error message you're seeing.", "Alternatively, if you're using Python 3.9 or later, you can use the `traceback.format_exception()` function instead. This function allows you to specify the exception type and the exception instance, which can be more useful than just formatting the exception." ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 1, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A disabled NSOpenPanel/NSSavePanel is usually the sandbox, not your code — and how to read entitlements (macos-sandbox-panel-needs-the-entitlement-in-the-signature)", "condition": "with_lesson", "status": 200, "content": "To resolve the issue, you need to add the required entitlements to your `entitlements.plist` file and update your `CODE_SIGN_ENTITLEMENTS` build setting to point to it. Here's a step-by-step guide:\n\n**Step 1: Create an `entitlements.plist` file**\n\n1. In the Finder, navigate to your project's directory.\n2. Create a new file named `entitlements.plist` by right-clicking (or control-clicking) on the project directory and selecting \"New\" > \"File\".\n3. Open the `entitlements.plist` file in a text editor (e.g., TextEdit or Xcode's built-in editor).\n4. Add the following lines to the file:\n\n```xml\n\n\n\n \n com.apple.security.files.user-selected.read-only\n \n com.apple.security.files.user-selected.read-write\n \n \nNSAppTransportSecurity\n\n NSAllowsArbitraryLoads\n \n\n\nNSOpenPanel\n\n NSAllowsArbitraryLoads\n \n\n\nNSSavePanel\n\n NSAllowsArbitraryLoads\n \n\n```\n\n**Step 2: Verify the entitlements in your Info.plist file**\n\nAfter adding the", "metrics": { "length": 958, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 6, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Sanitizing every interpolated value is not enough — exc_info=True appends the raw traceback (log-sanitizer-must-live-in-the-formatter)", "condition": "with_lesson", "status": 200, "content": "The problem arises from the fact that the sanitizer is applied to the values at the call site, but the logging module appends the formatted traceback, which contains the exception's own text. To fix this issue, you can manually sanitize the traceback before passing it to the logger. Here's how you can do it:\n\n```python\nimport logging\nimport traceback\n\n# Create a logger\nlogger = logging.getLogger(__name__)\n\ndef sanitize_traceback(tb):\n # Sanitize the traceback\n sanitized_tb = []\n for line in tb.splitlines():\n # Remove any newline characters\n line = line.strip()\n # Remove any control characters\n line = ''.join(c for c in line if ord(c) >= 32)\n sanitized_tb.append(line)\n return '\\n'.join(sanitized_tb)\n\ntry:\n handle(request)\nexcept Exception as error:\n # Manually sanitize the traceback\n tb = traceback.format_exception(type(error), error, error.__traceback__)\n tb = sanitize_traceback(tb)\n logger.error(\"request failed\", exc_info=False, tb=tb)\n```\n\nIn the code above, we've added a new function called `sanitize_traceback` that takes a traceback as input and returns a sanitized version of it.", "metrics": { "length": 1162, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 2, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "macOS: os.listxattr missing and OCR returns empty for transparent PNG (macos-xattr-ocr-transparent-png)", "condition": "with_lesson", "status": 200, "content": "Here's a concrete, actionable fix with exact commands to resolve the error:\n\n**Step 1: Install the xattr Python package**\n\nOpen your terminal and run the following command to install the xattr package:\n\n```bash\npip install xattr\n```\n\n**Step 2: Use the xattr command-line tool to access xattrs**\n\nTo access xattrs using the command-line tool, run the following command:\n\n```bash\nxattr -l transparent.png\n```\n\nThis will list all xattrs for the file `transparent.png`.\n\n**Step 3: Pre-process the image to flatten transparency before OCR**\n\nTo flatten transparency before OCR, use the following Python code:\n\n```python\nfrom PIL import Image\n\n# Open the image\nimg = Image.open(\"transparent.png\")\n\n# Convert the image to RGBA mode\nimg = img.convert(\"RGBA\")\n\n# Create a white background image\nbackground = Image.new(\"RGB\", img.size)\n\n# Paste the image onto the white background\nimg.paste(background, mask=img)\n\n# Save the pre-processed image\nimg.save(\"pre-processed.png\")\n```\n\nThis code will create a new image with a white background and paste the original image onto it, effectively flattening the transparency.\n\n**Step 4: Use T", "metrics": { "length": 1123, "commands": 2, "command_list": [ "pip install xattr", "xattr -l transparent.png" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 1, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "macOS: os.listxattr missing and OCR returns empty for transparent PNG (macos-xattr-ocr-transparent-png)", "condition": "plain", "status": 200, "content": "The error you're experiencing is due to a missing `os.listxattr` function on macOS. This function is required for OCR (Optical Character Recognition) to work properly with transparent PNG images.\n\nTo fix this issue, you can use the following command to install the `osx-xattr-ocr` package:\n\n```bash\nbrew install osx-xattr-ocr\n```\n\nIf you're using Homebrew, this command should install the package.\n\nAlternatively, you can use the following command to install the `xattr` package, which is required for `osx-xattr-ocr` to work:\n\n```bash\nbrew install xattr\n```\n\nAfter installing the package, you should be able to use OCR with transparent PNG images.\n\nTo verify that the package has been installed correctly, you can run the following command:\n\n```bash\nbrew list | grep osx-xattr-ocr\n```\n\nThis should display the package name if it's installed correctly.\n\nNote: If you're using a different package manager, you may need to use a different command to install the package.\n\nAfter installing the package, you should be able to use OCR with transparent PNG images.", "metrics": { "length": 1058, "commands": 3, "command_list": [ "brew install osx-xattr-ocr", "brew install xattr", "brew list | grep osx-xattr-ocr" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 1, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A source that does not exist must not resolve to a default — the bug that reports 'pending' forever (missing-source-must-not-resolve-to-a-default)", "condition": "with_lesson", "status": 200, "content": "To fix the issue of a source not existing but reporting a default instead of failing, we need to change the code to either fail with an error when the source is absent or to explicitly indicate that the source is missing. Here's an example of how to modify your code to raise an error when the source is absent:\n\n```python\nimport logging\n\ndef read_source():\n # Simulate reading a source that does not exist\n try:\n return {}\n except Exception as e:\n logging.error(f\"Error reading source: {e}\")\n raise ValueError(\"Source does not exist\")\n\ndef get_state(source):\n try:\n return source.get(\"state\", \"pending\")\n except ValueError as e:\n logging.error(f\"Error getting state: {e}\")\n raise e\n```\n\nIn the above code, `read_source` raises a `ValueError` when the source is absent, which is then propagated to `get_state` where it is caught and logged. \n\nAlternatively, you could modify the code to explicitly indicate that the source is missing:\n\n```python\nimport logging\n\ndef read_source():\n # Simulate reading a source that does not exist\n try:\n return {}\n except Exception as e:\n logging.error(f\"Error reading", "metrics": { "length": 1181, "commands": 2, "command_list": [ "In the above code, `read_source` raises a `ValueError` when the source is absent, which is then propagated to `get_state` where it is caught and logged.", "Alternatively, you could modify the code to explicitly indicate that the source is missing:" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Node strip-only mode rejects TypeScript syntax that needs lowering, not just type annotations (node-strip-types-rejects-syntax-that-needs-lowering)", "condition": "plain", "status": 200, "content": "The error you're encountering is due to the fact that the `--strip-types` flag in the TypeScript compiler doesn't only reject type annotations, but also any other TypeScript syntax that needs to be lowered to JavaScript. \n\nHere's a concrete and actionable fix with exact commands:\n\n1. Open your terminal and navigate to the directory where your TypeScript project is located.\n\n2. Run the following command to compile your TypeScript code with the `--strip-types` flag:\n\n```bash\ntsc --strip-types your_file.ts\n```\n\nReplace `your_file.ts` with the name of your TypeScript file.\n\nHowever, if you want to compile all TypeScript files in your project with the `--strip-types` flag, you can use the following command:\n\n```bash\ntsc --strip-types --outDir outputDir\n```\n\nReplace `outputDir` with the name of the directory where you want to output the compiled JavaScript files.\n\nNote: If you're using a `tsconfig.json` file to configure your TypeScript project, you can add the `--stripTypes` flag to the compilerOptions section in the file:\n\n```json\n{\n \"compilerOptions\": {\n // Other options...\n \"stripTypes\": true\n }\n}\n```\n\nThen, you can compile", "metrics": { "length": 1147, "commands": 2, "command_list": [ "tsc --strip-types your_file.ts", "tsc --strip-types --outDir outputDir" ], "has_command_block": true, "actionable": true, "inline_code_count": 12, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Node strip-only mode rejects TypeScript syntax that needs lowering, not just type annotations (node-strip-types-rejects-syntax-that-needs-lowering)", "condition": "with_lesson", "status": 200, "content": "The issue arises because `node-strip-types` does not support lowering constructor parameters to separate field declarations and assignments. To fix this, you can use the `--experimental-strip-types` flag with `tsc` and `--noEmit` to compile the TypeScript file to JavaScript without emitting any files, and then use `node-strip-types` with the `--no-lower` flag to remove type annotations without lowering constructor parameters.\n\nHere's a step-by-step solution:\n\n1. Compile the TypeScript file to JavaScript without emitting any files using the following command:\n ```bash\ntsc --noEmit your_file.ts\n```\n Replace `your_file.ts` with the name of your TypeScript file.\n\n2. Remove type annotations from the JavaScript file using `node-strip-types` with the `--no-lower` flag:\n ```bash\nnode-strip-types --no-lower your_file.js\n```\n Replace `your_file.js` with the name of the JavaScript file generated by `tsc`.\n\nAlternatively, you can use `tsc` with the `--noEmit` flag and `node-strip-types` with the `--lower` flag to achieve the same result:\n ```bash\ntsc --noEmit your_file.ts\n", "metrics": { "length": 1087, "commands": 2, "command_list": [ "tsc --noEmit your_file.ts", "node-strip-types --no-lower your_file.js" ], "has_command_block": true, "actionable": true, "inline_code_count": 19, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A source that does not exist must not resolve to a default — the bug that reports 'pending' forever (missing-source-must-not-resolve-to-a-default)", "condition": "plain", "status": 200, "content": "The error you're experiencing is due to a missing source file in your project. Here's a step-by-step guide to fix it:\n\n**Step 1: Check the Error Message**\n\nThe error message indicates that the source you're trying to resolve is missing, and it's causing the build process to hang indefinitely. This is a common issue when you're trying to resolve a missing source file.\n\n**Step 2: Locate the Missing Source File**\n\nTo locate the missing source file, you can try the following:\n\n* Check the project structure and ensure that the missing file is present in the correct directory.\n* Check the `pom.xml` or `build.gradle` file to see if the missing file is referenced anywhere.\n\n**Step 3: Fix the Missing Source File**\n\nOnce you've located the missing source file, you can fix it by:\n\n* If the file is missing from the project structure, add it to the project.\n* If the file is referenced in the `pom.xml` or `build.gradle` file, update the reference to point to the correct location.\n\n**Step 4: Clean and Rebuild the Project**\n\nAfter fixing the missing source file, you need to clean and rebuild the project to ensure that the changes take effect.\n\nFor Maven projects, run", "metrics": { "length": 1169, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 4, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "npm E403 Forbidden is three failures: registry auth, scope routing, or a proxy that never reached npm (npm-e403-forbidden-three-layers)", "condition": "with_lesson", "status": 200, "content": "The error you're encountering is due to a combination of issues with your registry authentication, scope routing, and/or proxy configuration. To resolve this issue, you'll need to address each of these layers. Here's a step-by-step guide with concrete, actionable fixes:\n\n**Layer 1: Registry Refusal (403 Forbidden)**\n\nThis error is usually caused by an expired or invalid token, or a mismatch between the token's read scope and the package you're trying to install.\n\n1. **Check your token expiration**: If you're using a private registry like GitHub Packages, ensure that your token has not expired. You can check the expiration date on the GitHub Packages dashboard.\n2. **Update your token**: If your token has expired, regenerate a new one and update your `package.json` file with the new token.\n3. **Verify token scope**: Ensure that your token's read scope covers the private package you're trying to install.\n\n**Command:** `npm config set registry https://registry.npmjs.org/`\n\n**Layer 2: Proxy Refusal (403 Forbidden)**\n\nThis error occurs when your proxy refuses the request before npm's registry ever sees it.\n\n1. **Check your proxy configuration**: Ensure that your proxy is correctly configured in your `package.json", "metrics": { "length": 1226, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 2, "lesson_hits": 3, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "npm E403 Forbidden is three failures: registry auth, scope routing, or a proxy that never reached npm (npm-e403-forbidden-three-layers)", "condition": "plain", "status": 200, "content": "The E403 Forbidden error in npm can be caused by several factors, including:\n\n1. Registry authentication issues\n2. Scope routing issues\n3. Proxy configuration issues\n\nHere's a step-by-step guide to fixing the error:\n\n**Step 1: Update npm and Node.js**\n\nMake sure you're running the latest versions of npm and Node.js. Run the following commands:\n\n```bash\nnpm install -g npm@latest\nnpm install -g node@latest\n```\n\n**Step 2: Check and update your npm configuration**\n\nRun the following command to check your npm configuration:\n\n```bash\nnpm config ls\n```\n\nThis will display your current npm configuration. Look for the following settings:\n\n* `registry`: This should point to the npm registry URL. If it's set to `http://registry.npmjs.org/`, try updating it to `https://registry.npmjs.org/`.\n* `cache`: Make sure this is set to a valid directory.\n* `proxy`: If you're using a proxy, make sure it's set correctly.\n\nUpdate these settings as needed:\n\n```bash\nnpm config set registry https://registry.npmjs.org/\nnpm config set cache /tmp/node-cache\nnpm config set proxy http://your-proxy-url:", "metrics": { "length": 1085, "commands": 3, "command_list": [ "npm install -g npm@latest", "npm install -g node@latest", "npm config ls" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 3, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "An on-chain payout has no retry: the checks an agent must pass before it signs (onchain-payout-preflight-checklist)", "condition": "with_lesson", "status": 200, "content": "Based on the provided information, it seems that the issue is related to the fact that on-chain payouts do not allow retries. To fix this issue, you'll need to modify your code to handle the case where the payout fails and cannot be retried.\n\nHere's an example of how you can modify your code to handle this issue:\n\nLet's assume you're using a programming language like Python, and you have a function called `process_payout` that attempts to process a payout:\n\n```python\nimport requests\n\ndef process_payout(payout_data):\n # Attempt to process the payout\n response = requests.post('https://example.com/payout', json=payout_data)\n if response.status_code == 200:\n # Payout was successful, return True\n return True\n else:\n # Payout failed, return False\n return False\n```\n\nTo handle the case where the payout fails and cannot be retried, you can modify the `process_payout` function to catch any exceptions that occur during the payout process:\n\n```python\nimport requests\n\ndef process_payout(payout_data):\n try:\n # Attempt to process the payout\n response = requests.post('https://example.com/payout', json=payout_data)\n", "metrics": { "length": 1173, "commands": 1, "command_list": [ "To handle the case where the payout fails and cannot be retried, you can modify the `process_payout` function to catch any exceptions that occur during the payout process:" ], "has_command_block": true, "actionable": true, "inline_code_count": 4, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "NSOpenPanel/NSSavePanel buttons stay disabled in sandboxed SwiftUI macOS app (nsopenpanel-nssavepanel-button-disabled-sandbox)", "condition": "with_lesson", "status": 200, "content": "The issue you're facing is due to the way `NSOpenPanel` and `NSSavePanel` are being used in your SwiftUI app. Here's a concrete, actionable fix with exact commands:\n\n1. Create a new SwiftUI view to handle the file picker:\n ```swift\nimport SwiftUI\nimport AppKit\n\nstruct FilePicker: View {\n @State private var isShowingOpenPanel = false\n @State private var isShowingSavePanel = false\n @State private var selectedFile: URL?\n\n var body: some View {\n VStack {\n Button(\"Open\") {\n isShowingOpenPanel = true\n }\n .sheet(isPresented: $isShowingOpenPanel) {\n self.openPanel()\n }\n Button(\"Save\") {\n isShowingSavePanel = true\n }\n .sheet(isPresented: $isShowingSavePanel) {\n self.savePanel()\n }\n }\n }\n\n private func openPanel() {\n let openPanel = NSOpenPanel()\n openPanel.allowedContentTypes = [\"public.text\", \"public.data\"]\n openPanel.canChooseFiles = true\n openPanel.canChooseDirectories = false\n openPanel.beginSheetModal(for: nil, completionHandler: { (", "metrics": { "length": 1162, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 2, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "An on-chain payout has no retry: the checks an agent must pass before it signs (onchain-payout-preflight-checklist)", "condition": "plain", "status": 200, "content": "The error message \"An on-chain payout has no retry\" suggests that the agent is unable to complete the preflight checks required before signing an on-chain payout. This could be due to a variety of reasons, such as:\n\n1. Incorrect agent configuration\n2. Missing or invalid agent dependencies\n3. Insufficient funds or balance issues\n\nTo fix this issue, you can try the following steps:\n\n**Step 1: Check agent configuration**\n\nVerify that your agent is correctly configured by checking the following:\n\n* `agent config` command to ensure that the agent is properly set up\n* `agent status` command to check the agent's current status\n\nExample commands:\n```bash\n# Check agent configuration\nagent config\n\n# Check agent status\nagent status\n```\n\n**Step 2: Update agent dependencies**\n\nEnsure that your agent has the necessary dependencies installed. You can do this by running the following command:\n```bash\n# Update agent dependencies\nagent update\n```\n\n**Step 3: Check for balance issues**\n\nVerify that your agent has sufficient funds to complete the payout. You can do this by running the following command:\n```bash\n# Check agent balance\nagent balance\n```\n\nIf your agent balance is insufficient, you may need to deposit more funds", "metrics": { "length": 1222, "commands": 4, "command_list": [ "agent config", "agent status", "agent update", "agent balance" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "NSOpenPanel/NSSavePanel buttons stay disabled in sandboxed SwiftUI macOS app (nsopenpanel-nssavepanel-button-disabled-sandbox)", "condition": "plain", "status": 200, "content": "The issue you're encountering is due to the way `NSOpenPanel` and `NSSavePanel` work in a sandboxed macOS app. These panels are not fully sandboxed, which means they can still interact with the system and potentially bypass your app's security restrictions.\n\nTo fix this issue, you can use the `NSAppKitCompatibilityKey` key to disable the panels' ability to bypass your app's security restrictions.\n\nHere's an example of how you can do this in your SwiftUI app:\n\n```swift\n@main\nstruct MyApp: App {\n @AppStorage(\"allowOpenPanel\") var allowOpenPanel = true\n @AppStorage(\"allowSavePanel\") var allowSavePanel = true\n\n var body: some Scene {\n WindowGroup {\n ContentView()\n .frame(maxWidth: .infinity, maxHeight: .infinity)\n .windowTitle(\"My App\")\n .toolbar {\n ToolbarItem(placement: .navigationBarTrailing) {\n Button(action: {\n allowOpenPanel.toggle()\n }) {\n Label(\"Open Panel\", systemImage: \"openfile\")\n }\n Button(action: {\n allowSavePanel.toggle()\n }) {\n Label(\"Save Panel\", systemImage: \"savesymbol\")\n }\n ", "metrics": { "length": 1359, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 3, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "pdf-oxide drops compound-word hyphen when PDF wraps at that hyphen (pdf-text-extraction-drops-hyphen)", "condition": "with_lesson", "status": 200, "content": "To fix the issue where pdf-oxide drops compound-word hyphens when PDF wraps at that hyphen, you can follow these steps:\n\n**Option A: Use Poppler for extraction**\n\nFirst, install Poppler on your system:\n\n* macOS (using Homebrew):\n ```bash\nbrew install poppler\n```\n* Ubuntu (using apt):\n ```bash\nsudo apt install poppler-utils\n```\n\nThen, use `pdftotext` to extract text from the PDF file:\n\n```bash\npdftotext input.pdf - output.txt\n```\n\nThis will extract the text from the PDF file and save it to a file named `output.txt`.\n\n**Option B: Post-process pdf-oxide output**\n\nIf you must use pdf-oxide, you can post-process the output to restore likely compound-word hyphens using the following Python script:\n\n```python\nimport re\n\ndef restore_hyphens(text: str) -> str:\n \"\"\"\n Restore hyphens at line boundaries where the word exists with a hyphen.\n \"\"\"\n pattern = r'([a-z])\\n([a-z])'\n return re.sub(pattern, r'\\1-\\2', text)\n\n# Example usage:\npdf_oxide_output =", "metrics": { "length": 977, "commands": 3, "command_list": [ "brew install poppler", "sudo apt install poppler-utils", "pdftotext input.pdf - output.txt" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 2, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "pdf-oxide drops compound-word hyphen when PDF wraps at that hyphen (pdf-text-extraction-drops-hyphen)", "condition": "plain", "status": 200, "content": "The issue you're experiencing is due to a limitation in pdf-oxide, which is a command-line tool for extracting text from PDF files. To fix this issue, you can use the `--hyphenate` option along with `--strip-trailing-spaces` when extracting text.\n\nHere's an example of how you can use the `pdf-oxide` command to extract text from a PDF file while avoiding the issue of dropped hyphens:\n\n```bash\npdf-oxide --hyphenate --strip-trailing-spaces -o output.txt input.pdf\n```\n\nIn this command:\n\n- `pdf-oxide` is the command to extract text from PDF files.\n- `--hyphenate` tells `pdf-oxide` to hyphenate the text, ensuring that compound words are separated by hyphens.\n- `--strip-trailing-spaces` removes any trailing spaces from the extracted text.\n- `-o output.txt` specifies the output file name.\n- `input.pdf` is the input PDF file.\n\nBy using the `--hyphenate` option, `pdf-oxide` will ensure that compound words are separated by hyphens, preventing the issue of dropped hyphens when the PDF wraps at that hyphen.", "metrics": { "length": 1009, "commands": 1, "command_list": [ "pdf-oxide --hyphenate --strip-trailing-spaces -o output.txt input.pdf" ], "has_command_block": true, "actionable": true, "inline_code_count": 12, "lesson_hits": 2, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "PowerShell Add-Type blocked by policy: call the Win32 API with Python ctypes instead (powershell-add-type-blocked-use-python-ctypes-instead)", "condition": "plain", "status": 200, "content": "The error you're experiencing is due to PowerShell's security restrictions on calling native code with Python's ctypes library. Here's a concrete, actionable fix:\n\n**Method 1: Use PowerShell's built-in cmdlets with Python**\n\nYou can use PowerShell's built-in cmdlets with Python to avoid the security restrictions. First, install the `python` module using pip:\n\n```bash\npip install python\n```\n\nThen, run the following PowerShell command:\n\n```powershell\npython -c \"import clr; clr.AddReference('System.Windows.Forms'); Add-Type -MemberDefinition '[DllImport(\\\"user32.dll\\\")] public static extern int MessageBox(int hWnd, String text, String caption, int type);' -Name MyType -Namespace My -Language CSharp\"\n```\n\nThis command will add a new .NET type that allows you to call the `MessageBox` function from the `user32.dll` library.\n\n**Method 2: Use a third-party library**\n\nAnother option is to use a third-party library that allows you to call native code with Python. One such library is `pywin32`.\n\nFirst, install `pywin32` using pip:\n\n```bash\npip install pywin32\n```\n\nThen, run the following PowerShell command:\n\n```powershell\npython", "metrics": { "length": 1135, "commands": 6, "command_list": [ "pip install python", "This command will add a new .NET type that allows you to call the `MessageBox` function from the `user32.dll` library.", "**Method 2: Use a third-party library**", "Another option is to use a third-party library that allows you to call native code with Python. One such library is `pywin32`.", "First, install `pywin32` using pip:" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 2, "lesson_hit_rate": 0.25 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "PowerShell Add-Type blocked by policy: call the Win32 API with Python ctypes instead (powershell-add-type-blocked-use-python-ctypes-instead)", "condition": "with_lesson", "status": 200, "content": "The error you're encountering is due to the PowerShell Add-Type cmdlet being blocked by the machine's security policy. This can be caused by a number of factors, including the language mode of the PowerShell session, AppLocker policies, and Windows Defender Application Control (Intelligent Security Graph).\n\nTo resolve this issue, we'll need to modify the language mode of the PowerShell session and remove any AppLocker policies that may be blocking the Add-Type cmdlet.\n\nHere are the steps to take:\n\n**Step 1: Modify the PowerShell language mode**\n\nOpen PowerShell and run the following command to change the language mode to FullLanguage:\n\n```powershell\n$ExecutionContext.SessionState.LanguageMode = 'FullLanguage'\n```\n\nYou can also add this to your PowerShell profile (e.g., `~\\Documents\\WindowsPowerShell\\profile.ps1`) so it runs automatically when you start PowerShell.\n\n**Step 2: Remove AppLocker policies (if necessary)**\n\nIf you're running Windows 10 or later, AppLocker policies may be blocking the Add-Type cmdlet. To remove these policies, follow these steps:\n\n1. Open the AppLocker settings by running the following command:\n\n```powershell\nGet-AppLockerPolicy -Effective -Xml | Select-Object -ExpandProperty RuleCollections", "metrics": { "length": 1237, "commands": 4, "command_list": [ "You can also add this to your PowerShell profile (e.g., `~\\Documents\\WindowsPowerShell\\profile.ps1`) so it runs automatically when you start PowerShell.", "**Step 2: Remove AppLocker policies (if necessary)**", "If you're running Windows 10 or later, AppLocker policies may be blocking the Add-Type cmdlet. To remove these policies, follow these steps:", "1. Open the AppLocker settings by running the following command:" ], "has_command_block": true, "actionable": false, "inline_code_count": 3, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Relative-path command retry loop — No such file or directory means the shell is in the wrong directory (relative-path-command-retry-loop-is-a-cwd-bug)", "condition": "plain", "status": 200, "content": "The error \"Relative-path command retry loop — No such file or directory means the shell is in the wrong directory\" occurs when the shell is not in the correct directory to execute a command with a relative path. Here's a concrete, actionable fix:\n\n**Fix: Change the Current Working Directory (CWD)**\n\nTo fix this issue, you need to change the current working directory (CWD) to the directory where the file you're trying to access is located. Here's how you can do it using the `cd` command:\n\n```bash\n# Navigate to the directory where the file is located\ncd /path/to/directory\n```\n\nReplace `/path/to/directory` with the actual path to the directory where the file is located.\n\n**Example:**\n\nLet's say you have a file named `example.txt` in the `/home/user/documents` directory. To access it, you need to change the CWD to that directory:\n\n```bash\n# Navigate to the documents directory\ncd /home/user/documents\n```\n\nOnce you're in the correct directory, you can execute the relative-path command again.\n\n**Alternatively:**\n\nIf you don't know the exact path to the directory, you can use the `pwd` command to print the current working directory", "metrics": { "length": 1141, "commands": 2, "command_list": [ "cd /path/to/directory", "cd /home/user/documents" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Relative-path command retry loop — No such file or directory means the shell is in the wrong directory (relative-path-command-retry-loop-is-a-cwd-bug)", "condition": "with_lesson", "status": 200, "content": "The issue you're facing is due to the shell's working directory not being set to the repository root. To fix this, you need to ensure that the shell's working directory is set to the repository root before running the command. Here's a concrete, actionable fix:\n\n**Step 1: Set the repository root as the working directory**\n\nFirst, you need to find the path to your repository root. You can do this by running the following command in your terminal:\n```bash\npwd\n```\nThis will print the absolute path to your current working directory.\n\nNext, you need to set the repository root as the working directory. You can do this by running the following command:\n```bash\ncd /path/to/your/repository/root\n```\nReplace `/path/to/your/repository/root` with the actual path to your repository root.\n\n**Step 2: Run the command with absolute path**\n\nOnce you've set the repository root as the working directory, you can run the command with an absolute path. You can do this by running the following command:\n```bash\npython3 /path/to/your/repository/root/scripts/lesson_gate.py\n```\nReplace `/path/to/your/repository/root/scripts/lesson_gate.py` with the actual path to your script.\n\n**", "metrics": { "length": 1169, "commands": 3, "command_list": [ "pwd", "cd /path/to/your/repository/root", "python3 /path/to/your/repository/root/scripts/lesson_gate.py" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 2, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A retry must not widen the axis the guardrail measures, and must have a discard terminal state (retry-must-not-also-loosen-the-axis-the-detector-checks)", "condition": "with_lesson", "status": 200, "content": "The issue you're facing is related to the retry mechanism not properly discarding the contaminated sample and not widening the axis the guardrail measures. Here's a concrete, actionable fix:\n\n**Step 1: Update the retry mechanism to discard contaminated samples**\n\nIn your retry loop, you need to discard the contaminated sample and not store it in the chat history. You can do this by adding a condition to discard the sample before re-requesting the turn.\n\n```python\ndef retry_turn(self):\n # Check if the reply is contaminated\n if self.is_contaminated():\n # Discard the contaminated sample\n self.discard_sample()\n # Re-request the turn with a new sampling temperature\n self.request_turn()\n else:\n # Re-request the turn with the current sampling temperature\n self.request_turn()\n```\n\n**Step 2: Update the guardrail to measure the correct axis**\n\nThe guardrail is currently measuring the wrong axis. You need to update the guardrail to measure the axis that is not being widened by the retry mechanism.\n\n```python\ndef check_guardrail(self):\n # Check if the reply is contaminated\n if self.is_contaminated():\n # Calculate the new sampling temperature\n new_temperature = self.get_new_temperature", "metrics": { "length": 1262, "commands": 2, "command_list": [ "**Step 2: Update the guardrail to measure the correct axis**", "The guardrail is currently measuring the wrong axis. You need to update the guardrail to measure the axis that is not being widened by the retry mechanism." ], "has_command_block": true, "actionable": false, "inline_code_count": 2, "lesson_hits": 1, "lesson_hit_rate": 0.5 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A retry must not widen the axis the guardrail measures, and must have a discard terminal state (retry-must-not-also-loosen-the-axis-the-detector-checks)", "condition": "plain", "status": 200, "content": "The error message you're encountering is related to a specific constraint in the LTL (Linear Temporal Logic) model checking community. This constraint ensures that a retry mechanism does not widen the axis guarded by a detector check.\n\nTo fix this issue, you can use the `ax` and `ux` operators in your LTL formula to specify the axis and the opposite axis, respectively. Here's an example of how you can modify your LTL formula to satisfy the constraint:\n\n```ltl\nG (ax (G (P ∧ (ux (Q ∨ R))))\n U (ax (G (P ∧ (ux (Q ∨ R)))))\n U (ax G P))\n```\n\nIn this formula, `ax` is the \"always-x\" operator, which ensures that the axis remains the same throughout the entire LTL formula. `ux` is the \"until-x\" operator, which allows the axis to change only when the condition inside the parentheses is true.\n\nHowever, without more context about your specific LTL formula and the model checking tool you're using, it's difficult to provide a more concrete solution.\n\nHere's an example of how you can modify your LTL formula using the `ltl2rata` tool:\n\n```bash\nltl2", "metrics": { "length": 1053, "commands": 3, "command_list": [ "In this formula, `ax` is the \"always-x\" operator, which ensures that the axis remains the same throughout the entire LTL formula. `ux` is the \"until-x\" operator, which allows the axis to change only when the condition inside the parentheses is true.", "However, without more context about your specific LTL formula and the model checking tool you're using, it's difficult to provide a more concrete solution.", "Here's an example of how you can modify your LTL formula using the `ltl2rata` tool:" ], "has_command_block": true, "actionable": true, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Navigating a shared browser tab is a destructive action — treat it like deleting a file (shared-tab-navigation-is-destructive)", "condition": "with_lesson", "status": 200, "content": "To fix the issue of destructive navigation in a shared browser tab, you can implement the following steps:\n\n1. **Prevent the agent from navigating away from the current page**:\n\n * Instead of using `history.back()`, use `history.go(-1)`. This will take the user back to the previous page in the history stack, rather than going to the previous page in the URL.\n * To prevent the agent from navigating away from the current page, you can use a flag to track whether the agent is currently interacting with the page. If the flag is set, the agent should not be able to navigate away.\n\n ```javascript\n let isAgentInteracting = false;\n\n // Set the flag to true when the agent starts interacting with the page\n function startInteraction() {\n isAgentInteracting = true;\n }\n\n // Set the flag to false when the agent stops interacting with the page\n function stopInteraction() {\n isAgentInteracting = false;\n }\n```\n\n2. **Use a shared state to track the agent's interaction**:\n\n * Create a shared state object that tracks whether the agent is currently interacting with the page.\n * Update the shared state when the agent starts", "metrics": { "length": 1179, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 3, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Injected scene state is a cache, not the roster: filter it before the model reads it (stale-injected-state-must-be-filtered-before-the-model-sees-it)", "condition": "plain", "status": 200, "content": "The error you're encountering is due to the fact that the injected scene state is being treated as a cache, not a roster, which can lead to stale data being used by the model.\n\nHere's a concrete, actionable fix:\n\n**Step 1: Update the Scene State**\n\nFirst, you need to update the scene state to ensure it's a roster, not a cache. You can do this by calling the `setSceneState` method on the scene.\n\n```lua\nlocal scene = require(\"scene\")\n\n-- Update the scene state to a roster\nscene:setSceneState(\"roster\")\n```\n\n**Step 2: Filter the Scene State**\n\nNext, you need to filter the scene state to remove any stale data. You can do this by creating a new table that only includes the data you need.\n\n```lua\nlocal sceneState = scene:getSceneState()\nlocal filteredState = {}\n\nfor _, entity in pairs(sceneState) do\n -- Filter out any entities you don't need\n if entity.type == \"player\" or entity.type == \"enemy\" then\n table.insert(filteredState, entity)\n end\nend\n\n-- Update the scene state with the filtered data\nscene:setSceneState(filteredState)\n```\n\n**Step 3:", "metrics": { "length": 1067, "commands": 2, "command_list": [ "**Step 2: Filter the Scene State**", "Next, you need to filter the scene state to remove any stale data. You can do this by creating a new table that only includes the data you need." ], "has_command_block": true, "actionable": false, "inline_code_count": 4, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Navigating a shared browser tab is a destructive action — treat it like deleting a file (shared-tab-navigation-is-destructive)", "condition": "plain", "status": 200, "content": "The error message is indicating that you're trying to navigate between tabs in a shared browser tab, which can cause unintended behavior. Here's a concrete, actionable fix:\n\n**Solution:**\n\n1. Close the shared browser tab.\n2. Open the shared browser tab again.\n3. Right-click on the tab and select \"New Incognito Window\" (or \"New Private Window\" depending on your browser).\n\nAlternatively, you can also try:\n\n1. Close the shared browser tab.\n2. Open the shared browser tab again.\n3. Press `Ctrl + T` (Windows/Linux) or `Cmd + T` (Mac) to open a new tab.\n\nBy doing this, you'll create a new, isolated tab that won't interfere with the original tab.\n\n**Note:** If you're using a browser extension that allows sharing tabs, you may need to disable the extension or remove it from your browser before attempting to navigate between tabs.\n\n**Example commands:**\n\n* Google Chrome:\n\t+ Close shared tab: `Ctrl + W` (Windows/Linux) or `Cmd + W` (Mac)\n\t+ Open new incognito window: `Ctrl + Shift + N` (Windows/Linux) or `Cmd + Shift + N` (Mac)\n* Mozilla Firefox:\n\t", "metrics": { "length": 1053, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 6, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Injected scene state is a cache, not the roster: filter it before the model reads it (stale-injected-state-must-be-filtered-before-the-model-sees-it)", "condition": "with_lesson", "status": 200, "content": "To fix the issue, you need to filter the injected scene state before passing it to the model. Here's a concrete, actionable fix with exact commands:\n\n```python\n# Before the model reads the scene state\ndef get_filtered_scene_state(scene):\n # Filter out entities that are no longer in the scene\n filtered_scene = {\n entity_id: entity\n for entity_id, entity in scene.items()\n if entity_id in get_current_roster()\n }\n\n # Return the filtered scene state\n return filtered_scene\n\n# Pass the filtered scene state to the model\ndef get_model_output(scene):\n filtered_scene = get_filtered_scene_state(scene)\n # Now the model will only see entities that are currently in the scene\n return model.get_output(filtered_scene)\n```\n\nHere's what's changed:\n\n1. We've added a new function `get_filtered_scene_state` that takes the scene state as input and returns a filtered version of it.\n2. In the `get_filtered_scene_state` function, we use a dictionary comprehension to filter out entities that are no longer in the current roster.\n3. We pass the filtered scene state to the `get_model_output` function, which now only sees entities that are currently in the scene.\n\nBy", "metrics": { "length": 1198, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 4, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "svglib leaves glyph state set between text nodes: one italic slants every node drawn after it (svglib-mutates-shared-state-while-walking-the-document)", "condition": "with_lesson", "status": 200, "content": "To fix the issue, you need to ensure that the shared glyph/paragraph state is properly reset after each text element. Here's how you can do it:\n\nFirst, you need to install the required packages:\n\n```bash\npip install svglib reportlab\n```\n\nNext, you can modify your Python script to reset the glyph state after each text element. Here's an example:\n\n```python\nfrom svglib.svglib import svg2rlg\nfrom reportlab.graphics import renderPDF\n\ndef convert_svg_to_pdf(svg_file, pdf_file):\n drawing = svg2rlg(svg_file)\n for page in drawing.pages:\n page.showPage()\n page.saveState()\n for elem in page.getElements():\n if elem.tag == 'text':\n elem.setGlyphState(0) # Reset glyph state\n renderPDF.drawToFile(page, pdf_file, resolution=100)\n\n# Example usage\nconvert_svg_to_pdf('input.svg', 'output.pdf')\n```\n\nIn the modified code, we're saving the current state of the page before drawing each text element, and then resetting the glyph state to its initial state (0) after drawing each text element. This ensures that the shared glyph/paragraph state is properly reset after each text element.\n\nNote", "metrics": { "length": 1144, "commands": 1, "command_list": [ "pip install svglib reportlab" ], "has_command_block": true, "actionable": true, "inline_code_count": 3, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "SwiftUI ScrollView scrollTo no effect unless .id() on each row and scrollTo called in onChange (swiftui-scrollview-scrollto-doesnt-scroll)", "condition": "with_lesson", "status": 200, "content": "To fix the issue, you need to add `.id()` to each row in your `ForEach` loop and call `scrollTo` outside the `body` of the `ScrollView`. Here's the corrected code:\n\n```swift\nstruct RecordDetailForm: View {\n let sections: [RecordSection]\n\n @State private var selectedSection: RecordSection?\n\n var body: some View {\n ScrollView {\n ScrollViewReader { scrollProxy in\n ForEach(sections, id: \\.id) { section in\n VStack(alignment: .leading) {\n Text(section.name)\n .font(.headline)\n Text(section.description)\n .font(.subheadline)\n // Add other fields here\n }\n .frame(height: 100) // Replace with actual height\n }\n }\n .onChange(of: selectedSection) { newSection in\n if let newSection = newSection {\n scrollProxy.scrollTo(newSection.id, anchor: .center)\n }\n }\n }\n .navigationBarTitle(\"Record Detail Form\")\n }\n}\n```\n\nIn this corrected code:\n\n1. We add `.id()` to the `ForEach` loop to provide a unique identifier for each row.\n2. We wrap the `ForEach` loop", "metrics": { "length": 1281, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 9, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "svglib leaves glyph state set between text nodes: one italic slants every node drawn after it (svglib-mutates-shared-state-while-walking-the-document)", "condition": "plain", "status": 200, "content": "The error you're encountering is due to the way `svglib` handles glyph state between text nodes. Here's a concrete, actionable fix with exact commands to resolve the issue:\n\n1. **Update `svglib` to the latest version**: Make sure you're running the latest version of `svglib`. You can update it by running the following command:\n\n ```bash\nnpm install --save-dev svglib@latest\n```\n\n2. **Update `svglib` to the latest `@svglib/ svglib` version**: Ensure you're using the latest `@svglib/ svglib` version by running the following command:\n\n ```bash\nnpm install --save-dev @svglib/ svglib@latest\n```\n\n3. **Use the `resetGlyphState` function**: After the text node, use the `resetGlyphState` function to reset the glyph state:\n\n ```javascript\nimport { resetGlyphState } from '@svglib/svglib';\n\n// ...\n\nconst textNode = document.createElementNS('http://www.w3.org/2000/svg', 'text');\ntextNode.textContent = 'Italic text';\ntextNode.style.fontStyle = 'italic';\n\n// ...\n\nconst svg = document.createElementNS('http://www.w3.org/200", "metrics": { "length": 1027, "commands": 2, "command_list": [ "npm install --save-dev svglib@latest", "npm install --save-dev @svglib/ svglib@latest" ], "has_command_block": true, "actionable": true, "inline_code_count": 12, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "swift-format rejects directories without --recursive; only some rules are auto-fixed (swift-format-lint-recursive-format-inplace)", "condition": "with_lesson", "status": 200, "content": "To resolve the issue with `swift-format` rejecting directories without the `--recursive` option, you can follow these steps:\n\n1. Run `swift-format format --in-place` to auto-fix formatting rules in the directory. This will modify the files in the directory to conform to the formatting rules.\n\n2. Then, run `swift-format lint` to check for any remaining linter-only rules. This will report the issues that require manual edits.\n\nHere are the exact commands to resolve the issue:\n\n```bash\n# Auto-fix formatting rules in the directory\nswift-format format --in-place Sources/\n\n# Check for remaining linter-only rules\nswift-format lint\n```\n\nNote that you can also use the `--recursive` option with both `format` and `lint` commands to handle directories automatically.\n\n```bash\n# Auto-fix formatting rules in the directory with recursive option\nswift-format format --in-place --recursive Sources/\n\n# Check for remaining linter-only rules in the directory with recursive option\nswift-format lint --recursive Sources/\n```\n\nBy following these steps, you can ensure that `swift-format` correctly handles directories and reports any remaining issues that require manual edits.", "metrics": { "length": 1167, "commands": 4, "command_list": [ "swift-format format --in-place Sources/", "swift-format lint", "swift-format format --in-place --recursive Sources/", "swift-format lint --recursive Sources/" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "swift-format rejects directories without --recursive; only some rules are auto-fixed (swift-format-lint-recursive-format-inplace)", "condition": "plain", "status": 200, "content": "The error you're encountering is due to the `swift-format` tool's behavior when it encounters directories without the `--recursive` flag. Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Update your `swift-format` tool**\n\nBefore fixing the issue, make sure you're using the latest version of `swift-format`. You can update it using the following command:\n\n```bash\nbrew upgrade swift-format\n```\n\nor\n\n```bash\npip install --upgrade swift-format\n```\n\n**Step 2: Use the `--recursive` flag with `swift-format`**\n\nTo fix the issue, you can use the `--recursive` flag with `swift-format`. Here's how:\n\n```bash\nswift-format --recursive --fix\n```\n\nThis command will recursively format all files and subdirectories in your project.\n\n**Step 3: Use `swift-format-lint-recursive-format-inplace` (optional)**\n\nIf you want to use a more advanced version of `swift-format` that can fix some rules automatically, you can use `swift-format-lint-recursive-format-inplace`. Here's how:\n\n```bash\nswift-format-lint-recursive-format-inplace --fix\n```\n\nThis command will recursively format all files and sub", "metrics": { "length": 1099, "commands": 4, "command_list": [ "brew upgrade swift-format", "pip install --upgrade swift-format", "swift-format --recursive --fix", "swift-format-lint-recursive-format-inplace --fix" ], "has_command_block": true, "actionable": true, "inline_code_count": 18, "lesson_hits": 6, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "SwiftUI ScrollView scrollTo no effect unless .id() on each row and scrollTo called in onChange (swiftui-scrollview-scrollto-doesnt-scroll)", "condition": "plain", "status": 200, "content": "The issue you're experiencing is due to the fact that the `ScrollView` in SwiftUI doesn't automatically scroll to a specific row when you add a new item. You need to use the `.id()` modifier and `onChange` to achieve this.\n\nHere's an example of how you can fix this:\n\n```swift\nimport SwiftUI\n\nstruct MyView: View {\n @State var items: [String] = []\n @State private var index = 0\n\n var body: some View {\n ScrollView {\n ForEach(items.indices, id: \\.self) { index in\n Text(\"Row \\(index)\")\n }\n .onChange(of: items, perform: { [weak self] _ in\n if let self = self, let lastItem = items.last, index < lastItem {\n self.index = index\n }\n })\n }\n .onAppear {\n // Add some items to the list\n items.append(\"Item 1\")\n items.append(\"Item 2\")\n items.append(\"Item 3\")\n }\n }\n}\n```\n\nIn this example, we're using the `.onChange` modifier to check if the `items` array has changed. If it has, we're checking if the index is less", "metrics": { "length": 1099, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 6, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Voice pipelines fail without failing: the acceptance is the artifact, not the exit code (voice-pipeline-silent-failures)", "condition": "with_lesson", "status": 200, "content": "The issue you're experiencing is due to each stage of the voice pipeline verifying itself instead of verifying the artifact. Here are some concrete, actionable fixes to address each stage:\n\n### FFmpeg Encoding\n\nThe FFmpeg command used a nonexistent `-format ogg` flag and resulted in a 0-byte output. To fix this:\n\n1. Check the FFmpeg version: `ffmpeg -version` (on macOS) or `ffmpeg -v` (on Linux)\n2. Update FFmpeg to the latest version if necessary.\n3. Verify the FFmpeg command is correct and the output is being generated correctly.\n4. Add a check for the output size in the FFmpeg command using the `-f` option, for example: `ffmpeg -i input.mp3 -f ogg -ar 16000 output.ogg`\n\n```bash\nffmpeg -i input.mp3 -f ogg -ar 16000 -v 10 output.ogg\n```\n\n### GPT-SoVITS\n\nThe GPT-SoVITS stage has issues with HuBERT feature extraction, phoneme dictionary, and reference-audio bugs.\n\n1. Check the GPT-SoVITS configuration and parameters to ensure they match the requirements.\n2. Update the GPT-SoVITS model", "metrics": { "length": 997, "commands": 1, "command_list": [ "ffmpeg -i input.mp3 -f ogg -ar 16000 -v 10 output.ogg" ], "has_command_block": true, "actionable": false, "inline_code_count": 5, "lesson_hits": 1, "lesson_hit_rate": 0.333 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Voice pipelines fail without failing: the acceptance is the artifact, not the exit code (voice-pipeline-silent-failures)", "condition": "plain", "status": 200, "content": "The error message \"Voice pipelines fail without failing: the acceptance is the artifact, not the exit code (voice-pipeline-silent-failures)\" is typically caused by a Voice Pipeline that is not failing when it should. This is because the pipeline's acceptance is being set to the artifact, rather than the exit code.\n\nTo fix this issue, you'll need to update the pipeline to use the exit code instead of the artifact as the acceptance. Here's a step-by-step guide to help you do this:\n\n**Step 1: Identify the pipeline configuration**\n\nYou'll need to identify the pipeline configuration that's causing the issue. You can do this by searching for the pipeline in the AWS Management Console or by using the AWS CLI.\n\n**Step 2: Update the pipeline configuration**\n\nUpdate the pipeline configuration to use the exit code as the acceptance. You can do this by editing the pipeline configuration file (e.g. `pipeline.yaml` or `pipeline.json`) and changing the `Acceptance` property to use the `ExitCode` property instead of the `Artifact` property.\n\nHere's an example of what the updated pipeline configuration might look like:\n```yaml\npipeline:\n name: MyVoicePipeline\n role: MyVoicePipelineRole\n version: ", "metrics": { "length": 1201, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 5, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "TS2305 under NodeNext is usually a real missing export, not a types-condition problem (ts2305-under-nodenext-is-usually-a-real-missing-export)", "condition": "plain", "status": 200, "content": "The error TS2305 \"under NodeNext is usually a real missing export, not a types-condition problem\" typically occurs when a module is being imported but the module itself is not exporting the expected function or variable.\n\nTo fix this issue, you need to check if the module you're trying to import is actually exporting what you're trying to import. Here's a step-by-step solution:\n\n1. **Check the module documentation**: Look up the documentation for the module you're trying to import to see what it's supposed to export.\n\n2. **Check the module's code**: Open the module's code in your preferred IDE or text editor. Look for any export statements.\n\n3. **Identify the missing export**: If you can't find the export, try searching for it in the code.\n\n4. **Create the missing export**: If the module is missing the export, create it by adding an export statement in the code.\n\n5. **Install the module with npm or yarn**: If the module is not installed, install it using npm or yarn.\n\n6. **Check your import statement**: Make sure you're importing the correct export from the module.\n\nHere's an example using TypeScript and the `ts-node` command:\n\nLet's say you're trying to import a function", "metrics": { "length": 1190, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 1, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "TS2305 under NodeNext is usually a real missing export, not a types-condition problem (ts2305-under-nodenext-is-usually-a-real-missing-export)", "condition": "with_lesson", "status": 200, "content": "The issue you're facing is due to a limitation in NodeNext's module resolution. When using a \"type\": \"module\" package, NodeNext only resolves imports from the `default` export and types listed in the `types` field of the `moduleResolution` configuration.\n\nTo fix the issue, you can try the following solutions:\n\n**Solution 1: Use `moduleResolution: 'node'` instead of `moduleResolution: 'bundler'`**\n\nTry changing the `moduleResolution` field in your `tsconfig.json` file from `'bundler'` to `'node'`. This should allow NodeNext to resolve imports from the `types` field.\n\nHere's an example `tsconfig.json` file:\n```json\n{\n \"compilerOptions\": {\n // ... other options ...\n \"moduleResolution\": \"node\",\n // ... other options ...\n }\n}\n```\n\n**Solution 2: Add an `import` statement with a `require` branch**\n\nAs mentioned in the intake report, adding an `import` statement with a `require` branch can fix the issue. You can try adding the following line to your code:\n```typescript\nimport { Context } from 'example-lib';\nrequire('example-lib');\n```\nThis will", "metrics": { "length": 1063, "commands": 2, "command_list": [ "**Solution 2: Add an `import` statement with a `require` branch**", "As mentioned in the intake report, adding an `import` statement with a `require` branch can fix the issue. You can try adding the following line to your code:" ], "has_command_block": true, "actionable": true, "inline_code_count": 18, "lesson_hits": 3, "lesson_hit_rate": 0.75 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "AgentCap uses 'inspect' not 'show' for capability lookup; macOS codesign needs -xml for plistlib (agentcap-inspect-subcommand-and-codesign-xml-output)", "condition": "with_lesson", "status": 200, "content": "To fix the error, you need to replace `show` with `inspect` in the `agentcap` command. Here's a concrete, actionable fix with exact commands:\n\n```bash\n# Run the command with the correct subcommand\nagentcap inspect my-capability-id\n```\n\nThis command uses the `inspect` subcommand to look up the capability by exact ID, which is the correct way to do it.", "metrics": { "length": 352, "commands": 1, "command_list": [ "agentcap inspect my-capability-id" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 4, "lesson_hit_rate": 0.8 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "An empty Wayback availability answer is not 'no captures' — separate it from a failed index request (wayback-empty-availability-is-not-no-captures)", "condition": "with_lesson", "status": 200, "content": "The error message indicates that the `wayback-empty-availability-is-not-no-captures` error occurs when the Wayback availability lookup returns an empty object and the CDX index request fails with a 503 status code. This is because the two endpoints are answering different questions and are not properly filtered.\n\nTo fix this issue, you can try the following commands:\n\n1. Filter the CDX index request to only include HTTP 200 responses:\n\n```bash\n# Filter CDX index request to only include HTTP 200 responses\ncurl -X GET 'https://web.archive.org/cdx/verify' -H 'Accept: application/json' -H 'Accept-Encoding: gzip' | jq '.[] | select(.status == 200)'\n```\n\nThis command uses `jq` to select only the JSON objects with a status code of 200 from the CDX index response.\n\n2. Filter the Wayback availability lookup to only include HTTP 200 responses:\n\n```bash\n# Filter Wayback availability lookup to only include HTTP 200 responses\ncurl -X GET 'https://web.archive.org/wayback/available' -H 'Accept: application/json' -H 'Accept-Encoding: gzip' | jq '.[] | select(.status == 200)'\n```\n\nThis command uses", "metrics": { "length": 1098, "commands": 2, "command_list": [ "curl -X GET 'https://web.archive.org/cdx/verify' -H 'Accept: application/json' -H 'Accept-Encoding: gzip' | jq '.[] | select(.status == 200)'", "curl -X GET 'https://web.archive.org/wayback/available' -H 'Accept: application/json' -H 'Accept-Encoding: gzip' | jq '.[] | select(.status == 200)'" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "An empty Wayback availability answer is not 'no captures' — separate it from a failed index request (wayback-empty-availability-is-not-no-captures)", "condition": "plain", "status": 200, "content": "The error message you're seeing indicates that the Wayback API is unable to retrieve any captures for a given URL, but it's not returning the expected \"no captures\" response. Instead, it's returning an empty response, which is causing the error.\n\nTo fix this issue, you can use the `--empty` flag with the Wayback API. Here's an example of how you can use it:\n\n```bash\nwget --save-all --mirror --convert-links --adjust-date --no-parent --no-check-certificate --http-user= --http-passwd= --http-proxy= --http-proxy-user= --http-proxy-passwd= --no-check-certificate --no-check-hosts --no-check-content --no-check-date --no-check-certificate --no-check-ssl --no-check-peer --no-check-hosts --no-check-ssl --no-check-peer --no-check-content --no-check-date --no-check-certificate --no-check-ssl --no-check-peer --no-check-hosts --no-check-content --no-check-date --no-check-certificate --no-check-ssl --no-check-peer --no-check-hosts --no-check-content --no-check-date --no-check-certificate --no-check", "metrics": { "length": 1057, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 1, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A Windows ACL write sandbox lost command execution: SetNamedSecurityInfoW failed (Win32 5) grantWrite (windows-acl-write-sandbox-grantwrite-win32-5)", "condition": "plain", "status": 200, "content": "The error you're encountering is due to the Windows Sandbox not being able to write to the file system because of the lack of a grantWrite permission. Here's a step-by-step fix to resolve the issue:\n\n**Step 1: Run the following command in the Command Prompt with administrator privileges:**\n\n```bash\nicacls C:\\Windows\\Sandbox\\ /grant:r IUSR:GRANT_WRITE\n```\n\nReplace `C:\\Windows\\Sandbox` with the actual path where your Windows Sandbox is located.\n\n**What this command does:**\n\n- `icacls` is a command-line utility used to manage access control lists (ACLs) on files and directories.\n- `C:\\Windows\\Sandbox` is the path to the Windows Sandbox.\n- `/grant:r` specifies that you want to grant permissions recursively.\n- `IUSR` is the built-in user account that runs the Windows Sandbox.\n- `GRANT_WRITE` grants the write permission to the sandbox.\n\n**Step 2: Run the following command in the Command Prompt with administrator privileges:**\n\n```bash\nicacls C:\\Windows\\Sandbox\\ /grant:r IUSRMEMBER:GRANT_WRITE\n```\n\nAgain, replace `C:\\Windows\\Sandbox` with the actual path to your Windows Sandbox", "metrics": { "length": 1087, "commands": 2, "command_list": [ "icacls C:\\Windows\\Sandbox\\ /grant:r IUSR:GRANT_WRITE", "icacls C:\\Windows\\Sandbox\\ /grant:r IUSRMEMBER:GRANT_WRITE" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A Windows ACL write sandbox lost command execution: SetNamedSecurityInfoW failed (Win32 5) grantWrite (windows-acl-write-sandbox-grantwrite-win32-5)", "condition": "with_lesson", "status": 200, "content": "To resolve the issue, you'll need to modify the sandbox's security descriptor to include the necessary permissions. Here are the steps:\n\n1. **Open the Sandbox's Properties**:\n - Right-click on the sandbox and select \"Properties\".\n - In the Properties window, click on the \"Security\" tab.\n\n2. **Modify the Sandbox's DACL and SACL**:\n - Click on the \"Edit\" button to open the \"Edit Security\" window.\n - In the \"Edit Security\" window, click on the \"Add\" button.\n - Select \"Permissions\" and then \"Allow\" for the following permissions:\n - \"Read\" for the \"Everyone\" group.\n - \"Write\" for the \"Everyone\" group.\n - \"Read and Execute\" for the \"Everyone\" group.\n - Click \"OK\" to save the changes.\n\n Alternatively, you can use the following commands to modify the sandbox's DACL and SACL:\n\n ```bash\nicacls /grant:r \"Everyone\":R,W,X \"C:\\Path\\To\\Sandbox\"\nicacls /s /t /g \"Everyone\":R,W,X \"C:\\Path\\To\\Sandbox\"\n```\n\n Replace `C:\\Path\\To\\S", "metrics": { "length": 953, "commands": 2, "command_list": [ "icacls /grant:r \"Everyone\":R,W,X \"C:\\Path\\To\\Sandbox\"", "icacls /s /t /g \"Everyone\":R,W,X \"C:\\Path\\To\\Sandbox\"" ], "has_command_block": true, "actionable": true, "inline_code_count": 2, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "AgentCap uses 'inspect' not 'show' for capability lookup; macOS codesign needs -xml for plistlib (agentcap-inspect-subcommand-and-codesign-xml-output)", "condition": "plain", "status": 200, "content": "The error message indicates that you're trying to use the `inspect` subcommand with the `agentcap` tool, which is not the correct subcommand for this purpose. Additionally, the `codesign` tool requires the `-xml` option to generate XML output, which is needed for `agentcap` to work correctly.\n\nHere's a concrete, actionable fix:\n\n**Step 1: Update `agentcap` to the latest version**\n\nRun the following command to update `agentcap` to the latest version:\n```bash\nbrew upgrade agentcap\n```\nOr, if you're using a different package manager, update `agentcap` accordingly.\n\n**Step 2: Use the correct subcommand and options**\n\nRun the following command to inspect the capability lookup and generate XML output:\n```bash\nagentcap inspect -xml /path/to/your/capability-file.plist\n```\nReplace `/path/to/your/capability-file.plist` with the actual path to your capability file.\n\n**Step 3: Run `codesign` with the `-xml` option**\n\nRun the following command to codesign your application with the `-xml` option:\n```bash\ncodesign -s - -xml /path/to/your/applications/capability-file.plist", "metrics": { "length": 1073, "commands": 2, "command_list": [ "brew upgrade agentcap", "agentcap inspect -xml /path/to/your/capability-file.plist" ], "has_command_block": true, "actionable": true, "inline_code_count": 16, "lesson_hits": 4, "lesson_hit_rate": 0.8 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "swift-format diagnostics that need source edits vs auto-fixable; NSOpenPanel/NSSavePanel disabled in sandbox (swift-format-diagnostics-and-nsopenpanel-disabled)", "condition": "with_lesson", "status": 200, "content": "Here's a step-by-step guide to fixing the errors:\n\n**Step 1: Use swift-format correctly**\n\nTo fix the first issue, you need to pass a single file path to `swift-format` instead of a directory path. You can do this by navigating to the directory containing the file you want to format and running the following command:\n\n```bash\nswift-format -f path/to/your/file.swift\n```\n\nReplace `path/to/your/file.swift` with the actual path to the file you want to format.\n\n**Step 2: Add the necessary entitlement to your app's Info.plist**\n\nTo fix the second issue, you need to add the `com.apple.security.files.user-selected.read-write` entitlement to your app's Info.plist file. Here's how you can do it:\n\n1. Open your project in Xcode.\n2. Select the target that contains your app.\n3. Go to the `Signing & Capabilities` tab.\n4. Click on the `+` button next to `Capabilities`.\n5. Search for `File System Access` and select it.\n6. Make sure the `Read/Write` capability is selected.\n7. Click on the `+` button next to `Entitlements`.\n8. Search for `com.apple", "metrics": { "length": 1045, "commands": 1, "command_list": [ "swift-format -f path/to/your/file.swift" ], "has_command_block": true, "actionable": true, "inline_code_count": 12, "lesson_hits": 3, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A pystray menu crash on macOS is an AppKit main-thread violation in a background thread, not a host-app bug (a-pystray-menu-thread-crash-is-an-appkit-main-thread-violation)", "condition": "plain", "status": 200, "content": "To fix the error \"pystray menu crash on macOS is an AppKit main-thread violation in a background thread\", you can use the following steps:\n\n1. Open your terminal and run the following command to install the `pystray` package with the `osx` backend, which is designed to work correctly on macOS:\n\n```bash\npip install pystray[osx]\n```\n\n2. If you're using a virtual environment, make sure it's activated before running the above command.\n\n3. After installing the `osx` backend, try running your script again to see if the error persists.\n\nIf the issue still occurs, you can try to use a different backend by running:\n\n```bash\npip install pystray[win] # for Windows\npip install pystray[linux] # for Linux\n```\n\nHowever, if you're experiencing the issue on macOS, the `osx` backend is the recommended solution.\n\nHere's a simple example of how to use `pystray` with the `osx` backend:\n\n```python\nimport pystray\nfrom pystray import Icon, Menu, MenuItem\nimport time\n\ndef main():\n icon = Icon('pystray', 'PyStray')\n", "metrics": { "length": 1010, "commands": 3, "command_list": [ "pip install pystray[osx]", "pip install pystray[win] # for Windows", "pip install pystray[linux] # for Linux" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "swift-format diagnostics that need source edits vs auto-fixable; NSOpenPanel/NSSavePanel disabled in sandbox (swift-format-diagnostics-and-nsopenpanel-disabled)", "condition": "plain", "status": 200, "content": "The error message is indicating that you're trying to use `NSOpenPanel` and `NSSavePanel` in a sandboxed environment, but these panels are disabled in sandboxed environments.\n\nThe `swift-format` command is trying to use these panels to prompt the user for input, but since they're disabled, it's throwing an error.\n\nTo fix this, you can use the `--no-panels` flag with `swift-format` to disable the panels. Here's an example:\n\n```bash\nswift-format --no-panels --fix\n```\n\nThis will run `swift-format` in non-interactive mode, without prompting the user for input. The `--fix` flag tells `swift-format` to automatically fix any formatting issues it finds.\n\nIf you want to keep the interactive mode, but still avoid using the panels, you can use the `--no-panels` flag and specify the input files manually:\n\n```bash\nswift-format --no-panels --fix --input-file=\"path/to/input/file.swift\"\n```\n\nReplace `\"path/to/input/file.swift\"` with the actual path to the file you want to format.\n\nAlternatively, if you're using `swift-format` in a script, you can use the `--no-panels` flag and", "metrics": { "length": 1077, "commands": 2, "command_list": [ "swift-format --no-panels --fix", "swift-format --no-panels --fix --input-file=\"path/to/input/file.swift\"" ], "has_command_block": true, "actionable": true, "inline_code_count": 15, "lesson_hits": 3, "lesson_hit_rate": 1.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A pystray menu crash on macOS is an AppKit main-thread violation in a background thread, not a host-app bug (a-pystray-menu-thread-crash-is-an-appkit-main-thread-violation)", "condition": "with_lesson", "status": 200, "content": "The issue you're experiencing is due to the `pystray` library not properly handling the main-thread requirement for `NSStatusItem` operations. Here's a concrete, actionable fix:\n\n**Update `pystray` to the latest version**\n\nBefore making any changes to your code, ensure you're running the latest version of `pystray`. You can update it using pip:\n\n```bash\npip install --upgrade pystray\n```\n\n**Modify your code to use `pystray` with the main thread**\n\nCreate a new file, e.g., `pystray_thread_safe.py`, and add the following code:\n\n```python\nimport pystray\nimport threading\n\ndef update_menu_thread_safe(menu, status_item):\n def update_menu_wrapper():\n pystray.update_menu(menu, status_item)\n\n threading.Thread(target=update_menu_wrapper).start()\n\n# Usage\nmenu = pystray.Menu(\n \"My Menu\",\n [\n pystray.MenuItem(\"Item 1\"),\n pystray.MenuItem(\"Item 2\"),\n ],\n)\n\nstatus_item = pystray.StatusItem(\n \"My Status Item\",\n menu=menu,\n)\n\npystray.StatusItem.update_menu(menu, status_item)\n```\n\nIn this modified", "metrics": { "length": 1036, "commands": 1, "command_list": [ "pip install --upgrade pystray" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "An archive container name is not an entity name: parse the entries before grouping (an-archive-container-name-is-not-an-entity-name)", "condition": "with_lesson", "status": 200, "content": "The issue arises because the `fileName` variable is being used as both the container name and the entity name. To fix this, you need to extract the entity name from the `fileName` and use that as the entity name for grouping.\n\nHere's a concrete, actionable fix with exact commands:\n\n```javascript\n// Assuming you're using Node.js and the fs and path modules\nconst fs = require('fs');\nconst path = require('path');\n\n// Define the function to extract the entity name\nfunction extractEntityName(fileName) {\n // Remove the extension from the file name\n const nameWithoutExtension = fileName.replace(/\\.rar|\\.7z|\\.zip|\\.tar$/, '');\n \n // Split the name into parts (assuming the entity name is the first part)\n const entityNameParts = nameWithoutExtension.split('_');\n \n // Return the first part as the entity name\n return entityNameParts[0];\n}\n\n// Define the function to group the files\nfunction groupFiles(fileNames) {\n // Initialize an empty object to store the grouped files\n const groupedFiles = {};\n \n // Iterate over the file names\n fileNames.forEach((fileName) => {\n // Extract the entity name from the file name\n const", "metrics": { "length": 1140, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 2, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "curl exit 23 is a write failure, not a network failure: change the writer (curl-exit-23-is-a-write-failure-not-a-network-failure)", "condition": "plain", "status": 200, "content": "The error you're encountering is due to the fact that `curl` is exiting with a non-zero status code (23 in your case) without providing any error message. This is often caused by a write failure, such as when a file cannot be written or a network connection is lost.\n\nTo fix this issue, you can use the `-v` option with `curl` to enable verbose mode, which will provide more detailed information about the request and any errors that occur.\n\nHere's how you can use it:\n\n```bash\ncurl -v -X GET https://example.com\n```\n\nIn this command:\n\n- `-v` stands for verbose mode, which will display detailed information about the request and any errors that occur.\n- `-X GET` specifies the request method (in this case, a GET request).\n\nBy running this command, you should be able to see the exact error message that's causing the issue. This will help you diagnose and fix the problem.\n\nAdditionally, you can also try to use the `--trace` option instead of `-v`, which will provide an even more detailed output:\n\n```bash\ncurl --trace /tmp/curl.trace /X GET https://example.com\n```\n\nThis will save the output to a file named `curl.trace", "metrics": { "length": 1124, "commands": 2, "command_list": [ "curl -v -X GET https://example.com", "curl --trace /tmp/curl.trace /X GET https://example.com" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "An archive container name is not an entity name: parse the entries before grouping (an-archive-container-name-is-not-an-entity-name)", "condition": "plain", "status": 200, "content": "The error message \"An archive container name is not an entity name: parse the entries before grouping\" is typically encountered when using the `groupby` method with a DataFrame that contains a column with non-string values. The `groupby` method requires all columns to be of a compatible data type.\n\nTo fix this issue, you can convert the problematic column to string type before grouping. Here's an example using Python and the pandas library:\n\n```bash\nimport pandas as pd\n\n# Create a sample DataFrame\ndata = {\n 'Entity Name': ['Entity1', 'Entity2', 'Entity3', 'Entity4'],\n 'Archive Container Name': ['Archive1', 'Archive2', 'Archive3', 'Archive4']\n}\ndf = pd.DataFrame(data)\n\n# Group by 'Entity Name' and 'Archive Container Name'\ngrouped_df = df.groupby(['Entity Name', 'Archive Container Name']).size().reset_index(name='Count')\n\n# Print the resulting DataFrame\nprint(grouped_df)\n```\n\nHowever, if you're using the `groupby` method with a specific column (not 'Entity Name'), you need to specify the column to group by and convert the other columns to string type.\n\n```bash\nimport pandas as pd\n\n# Create a sample", "metrics": { "length": 1119, "commands": 8, "command_list": [ "import pandas as pd", "data = {", "'Entity Name': ['Entity1', 'Entity2', 'Entity3', 'Entity4'],", "'Archive Container Name': ['Archive1', 'Archive2', 'Archive3', 'Archive4']", "}" ], "has_command_block": true, "actionable": false, "inline_code_count": 5, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "curl exit 23 is a write failure, not a network failure: change the writer (curl-exit-23-is-a-write-failure-not-a-network-failure)", "condition": "with_lesson", "status": 200, "content": "The issue you're experiencing is due to a known problem with `curl` on Windows, where it fails to write the response body to disk even when the TLS handshake and connection are successful. This is a known issue in `curl` version 7.64.0 and later.\n\nHere's a concrete, actionable fix with exact commands:\n\n1. Update `curl` to the latest version:\n\n```bash\nbrew upgrade curl # on macOS (using Homebrew)\napt-get update && apt-get install libcurl4-openssl-dev && apt-get install libcurl4-openssl-dev -y # on Ubuntu\napt-get update && apt-get install libcurl4-openssl-dev && apt-get install libcurl4-openssl-dev -y # on Debian\npip install --upgrade curl # on Python\n```\n\n2. If updating `curl` doesn't solve the issue, try using the `--output` option with the `-w` option to specify a verbose output format that includes the write error code:\n\n```bash\ncurl -w \"%{http_code}\" -o output.json https://example.com/api/data\n```\n\n3. If the above doesn't work, try using the `--output` option with the `-v` option to specify a", "metrics": { "length": 1014, "commands": 5, "command_list": [ "brew upgrade curl # on macOS (using Homebrew)", "apt-get update && apt-get install libcurl4-openssl-dev && apt-get install libcurl4-openssl-dev -y # on Ubuntu", "apt-get update && apt-get install libcurl4-openssl-dev && apt-get install libcurl4-openssl-dev -y # on Debian", "pip install --upgrade curl # on Python", "curl -w \"%{http_code}\" -o output.json https://example.com/api/data" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC LS 程序解析:段标记必须行首锚定,否则注释会截断程序体 (fanuc-ls-parser-comment-and-segment-boundary)", "condition": "with_lesson", "status": 200, "content": "以下是解决FANUC LS 程序解析错误的具体步骤:\n\n1. 使用正则表达式匹配段标记在行首:\n\n ```bash\n# 在使用的python版本中,使用如下命令进行匹配\nm = re.search(r'/MN\\n([\\s\\S]?)(?=^/POS\\b|^/END\\b)', text, re.M)\nif m is None:\n # 在python3.10中,使用如下命令进行匹配\n m = re.search(r'/MN\\n([\\s\\S]?)(?=/POS|/END|$)', text)\n```\n\n2. 统一换行符:\n\n ```bash\n# 使用如下命令进行换行符的替换\ntext = text.replace('\\r\\n', '\\n')\n```\n\n3. 先剥离注释,再判定指令存在性:\n\n ```python\ndef isRemarkLine(line: str) -> bool:\n s = line.strip()\n return s.startswith('!') or s.startswith('//')\n\ndef stripRemarks(text: str) -> str:\n return '\\n'.join(l for l in text.split('\\n') if not isRemarkLine(l))\n\n# 使用如下命令进行段提", "metrics": { "length": 606, "commands": 4, "command_list": [ "m = re.search(r'/MN\\n([\\s\\S]?)(?=^/POS\\b|^/END\\b)', text, re.M)", "if m is None:", "m = re.search(r'/MN\\n([\\s\\S]?)(?=/POS|/END|$)', text)", "text = text.replace('\\r\\n', '\\n')" ], "has_command_block": true, "actionable": false, "inline_code_count": 4, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Instrumentation that never reached the artifact: a silent probe is not evidence (instrumentation-that-never-reached-the-artifact)", "condition": "plain", "status": 200, "content": "The error \"Instrumentation that never reached the artifact: a silent probe is not evidence (instrumentation-that-never-reached-the-artifact)\" typically occurs when your test instrumentation is not properly configured to reach the artifact (e.g., a Java class or method) you're trying to test.\n\nHere's a concrete, actionable fix with exact commands:\n\n**Step 1: Verify the instrumentation configuration**\n\nCheck your instrumentation configuration file (usually `instrumentation.xml` or `instrumentation.json`) to ensure that the probe is correctly configured to reach the artifact.\n\nFor example, if your instrumentation configuration file looks like this:\n\n```xml\n\n \n com.example.MyClass\n myMethod\n \n\n```\n\n**Step 2: Use the `--instrument` flag with the correct classpath**\n\nRun your test with the `--instrument` flag and specify the correct classpath that includes the artifact you're trying to test. For example:\n\n```bash\nmvn test --instrument -Dinstrumentation.target=com.example.MyClass\n```\n\nReplace `com.example.MyClass` with the actual package name of the class you're trying to test.\n\n**Step 3", "metrics": { "length": 1183, "commands": 2, "command_list": [ "**Step 2: Use the `--instrument` flag with the correct classpath**", "Run your test with the `--instrument` flag and specify the correct classpath that includes the artifact you're trying to test. For example:" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC LS 程序解析:段标记必须行首锚定,否则注释会截断程序体 (fanuc-ls-parser-comment-and-segment-boundary)", "condition": "plain", "status": 200, "content": "The error message \"段标记必须行首锚定,否则注释会截断程序体\" in FANUC LS programming language roughly translates to \"Segment marker must be anchored at the beginning of a line, otherwise comments will be cut off\".\n\nTo fix this issue, you need to ensure that each comment is anchored to the beginning of a line. Here are the steps:\n\n1. Open your FANUC LS program in a text editor.\n2. Find the comments in your program that are not anchored to the beginning of a line.\n3. Move the cursor to the beginning of the line containing the comment.\n4. Press `Ctrl+G` (or `Ctrl+Shift+G` on some systems) to anchor the comment to the beginning of the line.\n\nAlternatively, you can use the `G` command in the FANUC LS editor to anchor a comment to the beginning of the line. Here's how:\n\n1. Open your FANUC LS program in the FANUC LS editor.\n2. Select the comment that needs to be anchored to the beginning of the line.\n3. Press `G` while holding down the left mouse button (or press `G` on the keyboard).\n\nThis will anchor the comment to the", "metrics": { "length": 1009, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 4, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Instrumentation that never reached the artifact: a silent probe is not evidence (instrumentation-that-never-reached-the-artifact)", "condition": "with_lesson", "status": 200, "content": "The error you're encountering is due to the fact that the instrumentation probes you added are not being executed because they are not part of the compiled artifact. The host serves the browser-side plugins as a prebuilt merged combo, which doesn't allow for individual plugin edits to be reflected in the browser.\n\nTo fix this issue, you'll need to rebuild the artifact after making changes to the plugin's source code. Here's a step-by-step guide to help you do so:\n\n**Step 1: Rebuild the artifact**\n\nYou can use the following command to rebuild the artifact:\n\n```bash\nnpm run build\n```\n\nThis command will rebuild the merged combo, which will include the updated instrumentation probes.\n\n**Step 2: Restart the host or toggle the plugin**\n\nAfter rebuilding the artifact, you'll need to restart the host or toggle the plugin to make the changes take effect. You can do this using the following commands:\n\n```bash\nnpm run start\n```\n\nor\n\n```bash\nnpm run toggle-plugin\n```\n\nThis will restart the host or toggle the plugin, allowing the updated instrumentation probes to be executed.\n\n**Step 3: Verify the changes**\n\nOnce the artifact has been rebuilt and the host has been restarted or the plugin has been toggled, you can", "metrics": { "length": 1219, "commands": 3, "command_list": [ "npm run build", "npm run start", "npm run toggle-plugin" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "npm ERESOLVE is a dependency-graph report, not an install failure — read the chain before reaching for --force (npm-eresolve-peer-conflict)", "condition": "plain", "status": 200, "content": "The error you're encountering is due to a peer dependency conflict. This occurs when two packages have different versions of the same peer dependency. Here's a step-by-step guide to resolve the issue:\n\n1. **Check the error message**: The error message indicates that `npm-eresolve-peer-conflict` is being triggered. This package is used to resolve peer dependency conflicts.\n\n2. **Run `npm ls`**: This command will display the dependency tree of your project, including peer dependencies. This will help you identify the conflicting peer dependency.\n\n ```bash\nnpm ls\n```\n\n3. **Identify the conflicting peer dependency**: Look for the conflicting peer dependency in the output of `npm ls`. It should be listed as a peer dependency of one of your packages.\n\n4. **Resolve the conflict**: There are two ways to resolve the conflict:\n - **Downgrade the conflicting package**: You can try downgrading the conflicting package to a version that is compatible with the peer dependency of the other package.\n\n ```bash\nnpm install @\n```\n\n Replace `` with the name of the package and `` with the version you want to install.\n\n - **Upgrade the peer dependency**: You can also try upgrading", "metrics": { "length": 1236, "commands": 2, "command_list": [ "npm ls", "npm install @" ], "has_command_block": true, "actionable": true, "inline_code_count": 8, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "npm ERESOLVE is a dependency-graph report, not an install failure — read the chain before reaching for --force (npm-eresolve-peer-conflict)", "condition": "with_lesson", "status": 200, "content": "The error message indicates that there's a peer dependency conflict between `react@18.2.0` and `some-ui-lib@2.4.1`, which is requiring `react@^17.0.0`. This is a common issue in npm 7+ due to its automatic peer dependency installation feature.\n\nHere's a step-by-step solution:\n\n**Step 1: Check the library's changelog and issues**\n\nFirst, you need to check if the library's peer dependency range is outdated. You can do this by checking the library's changelog and issues.\n\n1. Open the library's GitHub page or npm page.\n2. Check the changelog to see if there are any updates related to peer dependencies.\n3. Check the issues to see if there are any known issues related to peer dependencies.\n\n**Step 2: Update the library to a compatible version**\n\nIf the library's peer dependency range is outdated, you need to update the library to a compatible version.\n\n1. Open the library's npm page.\n2. Check the `dependencies` section to see if there's an updated version available.\n3. Run the following command to update the library:\n```bash\nnpm install some-ui-lib@latest\n```\n**Step 3: Fix", "metrics": { "length": 1083, "commands": 1, "command_list": [ "npm install some-ui-lib@latest" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "OWA thread view exposes only the newest message's attachments; older ones need a manual relay (owa-thread-view-historical-attachments-not-accessible)", "condition": "with_lesson", "status": 200, "content": "To bypass this limitation and access historical attachments in a mail thread, you can use the following approach:\n\n1. **Use the `EWS` (Exchange Web Services) endpoint**: Instead of relying on the OWA thread view, you can use the EWS endpoint to access the mailbox. This endpoint provides more flexibility and allows you to bypass the OWA thread view limitation.\n\nHere's an example PowerShell script that uses EWS to access historical attachments:\n\n```powershell\n# Import the Exchange Web Services (EWS) module\nImport-Module ExchangeOnlineManagement\n\n# Set the mailbox credentials and the mailbox ID\n$cred = Get-Credential\n$mailboxId = \"user1@example.com\"\n\n# Create a new EWS session\n$ewsSession = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService\n$ewsSession.Url = \"https://outlook.office365.com/EWS/Exchange.asmx\"\n$ewsSession.Credentials = $cred\n$ewsSession.ImpersonatedUserId = New-Object Microsoft.Exchange.WebServices.Data.ImpersonatedUserId(\"http://schemas.microsoft.com/exchange/2006/types/ImpersonatedUserId\")\n$ewsSession.ImpersonatedUserId.UserOrRoleType = [Microsoft.Exchange.WebServices.Data.ImpersonatedUserIdType]::My", "metrics": { "length": 1142, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 1, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "OWA thread view exposes only the newest message's attachments; older ones need a manual relay (owa-thread-view-historical-attachments-not-accessible)", "condition": "plain", "status": 200, "content": "To fix the error \"OWA thread view exposes only the newest message's attachments; older ones need a manual relay (owa-thread-view-historical-attachments-not-accessible)\", you can try the following steps:\n\n**Step 1: Enable the \"owasthreadviewhistoricalattachments\" feature**\n\nYou need to enable the \"owasthreadviewhistoricalattachments\" feature on your Exchange server. Here are the steps:\n\n1. Open the Exchange Management Shell on your Exchange server.\n2. Run the following command to enable the feature:\n```\nSet-OrganizationConfig -OWAThreadViewHistoricalAttachmentsEnabled $true\n```\n3. Press Enter to execute the command.\n\n**Step 2: Update the Exchange Web Services (EWS) configuration**\n\nYou need to update the EWS configuration to include the \"owasthreadviewhistoricalattachments\" feature. Here are the steps:\n\n1. Open the Exchange Management Shell on your Exchange server.\n2. Run the following command to update the EWS configuration:\n```\nSet-WebServicesConfig -OWAThreadViewHistoricalAttachmentsEnabled $true\n```\n3. Press Enter to execute the command.\n\n**Step 3: Restart the Exchange Web Services (EWS) service**\n\nAfter updating the EWS", "metrics": { "length": 1141, "commands": 2, "command_list": [ "Set-OrganizationConfig -OWAThreadViewHistoricalAttachmentsEnabled $true", "Set-WebServicesConfig -OWAThreadViewHistoricalAttachmentsEnabled $true" ], "has_command_block": true, "actionable": true, "inline_code_count": 3, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A compatibility-gate rejection is a verdict, not something to overwrite with --accept-risk (compatibility-gate-rejection-is-verdict-not-accept-risk)", "condition": "with_lesson", "status": 200, "content": "To fix the error, you can follow the steps below:\n\n### Step 1: Report the gate's verdict verbatim and stop\n\nInstead of offering the user an option to self-grant a version exemption, you should report the gate's verdict verbatim and stop the installation process.\n\n```bash\necho \"Compatibility-gate rejection is a verdict, not something to overwrite with --accept-risk (compatibility-gate-rejection-is-verdict-not-accept-risk)\"\n```\n\n### Step 2: Do not self-grant a version exemption\n\nThe agent should never invoke the `allow-version ... --accept-risk` command on the user's behalf. The exemption must be the user's own explicit risk acceptance, labelled as such.\n\n```bash\n# Do not do this\n# allow-version dsh-compaction-instant@0.1.4 --accept-risk\n\n# Do this instead\necho \"Please manually allow the version if you want to proceed.\"\n```\n\n### Step 3: If the user still wants the package, label the risk explicit\n\nIf the user still wants the package, you can provide a concrete, actionable fix with exact commands.\n\n```bash\necho \"If you still want to install the package, please manually run the following command to allow the version", "metrics": { "length": 1129, "commands": 2, "command_list": [ "echo \"Compatibility-gate rejection is a verdict, not something to overwrite with --accept-risk (compatibility-gate-rejection-is-verdict-not-accept-risk)\"", "echo \"Please manually allow the version if you want to proceed.\"" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null, "run_at": "2026-10-12T08:20:51+00:00" }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "git diff --check only flags whitespace on added lines, and git diff -w hides whitespace inside a quoted string (git-diff-whitespace-verification-traps)", "condition": "with_lesson", "status": 200, "content": "To resolve the issue of `git diff --check` only flagging whitespace on added lines and `git diff -w` hiding whitespace inside quoted strings, you can use the following commands:\n\n```bash\n# Remove trailing whitespace from the CSS file\nprintf 'a {\\n color: red;\\n}\\n' s.css > s.css.trim\n\n# Stage the updated CSS file\ngit add -A\n\n# Commit the changes\ngit commit -qm \"Trimmed trailing whitespace\"\n\n# Use `git diff --cached` to check for whitespace changes\ngit diff --cached --check s.css\n\n# Use `git diff -w --` to check for whitespace changes, ignoring quoted strings\ngit diff -w -- s.css\n```\n\nHere's what's happening:\n\n1. We use `printf` to trim trailing whitespace from the CSS file `s.css`. The `> s.css.trim` redirection sends the output to a new file `s.css.trim`.\n2. We stage the updated CSS file using `git add -A`.\n3. We commit the changes using `git commit -qm`.\n4. We use `git diff --cached --check` to check for whitespace changes. This command only checks for added lines, which is what we want.\n5", "metrics": { "length": 1007, "commands": 5, "command_list": [ "printf 'a {\\n color: red;\\n}\\n' s.css > s.css.trim", "git add -A", "git commit -qm \"Trimmed trailing whitespace\"", "git diff --cached --check s.css", "git diff -w -- s.css" ], "has_command_block": true, "actionable": true, "inline_code_count": 12, "lesson_hits": 3, "lesson_hit_rate": 0.75 }, "error": null, "run_at": "2026-10-12T08:20:51+00:00" }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "git diff --check only flags whitespace on added lines, and git diff -w hides whitespace inside a quoted string (git-diff-whitespace-verification-traps)", "condition": "plain", "status": 200, "content": "The issue you're encountering is due to the way Git handles whitespace in diffs. To fix this, you can use the following commands:\n\n1. For `git diff --check`, you can use the following command to flag whitespace on added lines and ignore whitespace inside quoted strings:\n\n```bash\ngit diff -w --check --ignore-space-at-eol\n```\n\n The `--ignore-space-at-eol` option tells Git to ignore whitespace at the end of lines.\n\n2. For `git diff -w`, you can use the following command to show whitespace inside quoted strings and flag whitespace on added lines:\n\n```bash\ngit diff -w --ignore-space-at-eol --check\n```\n\n The `--check` option will only flag whitespace on added lines, and the `--ignore-space-at-eol` option will ignore whitespace at the end of lines.\n\nAlternatively, you can use `git diff -w --ignore-all-space` to ignore all whitespace in the diff output, including whitespace inside quoted strings.\n\n```bash\ngit diff -w --ignore-all-space --check\n```\n\nNote that `--ignore-all-space` is a more aggressive option that will ignore all whitespace, including spaces inside quoted strings, and may not be suitable for all use cases", "metrics": { "length": 1132, "commands": 3, "command_list": [ "git diff -w --check --ignore-space-at-eol", "git diff -w --ignore-space-at-eol --check", "git diff -w --ignore-all-space --check" ], "has_command_block": true, "actionable": true, "inline_code_count": 12, "lesson_hits": 1, "lesson_hit_rate": 0.25 }, "error": null, "run_at": "2026-10-12T08:20:51+00:00" }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A compatibility-gate rejection is a verdict, not something to overwrite with --accept-risk (compatibility-gate-rejection-is-verdict-not-accept-risk)", "condition": "plain", "status": 200, "content": "The error message you're seeing is a known issue with the `--accept-risk` flag in some versions of the `git` command. Here's a concrete, actionable fix with exact commands:\n\n1. Update to the latest version of Git:\n ```bash\ngit version\n```\n Check the version of Git installed on your system. If it's an older version, you can update it using the following command:\n\n ```bash\ngit --version\n```\n\n For Windows users:\n ```bash\ngit --version\n```\n For macOS users:\n ```bash\ngit --version\n```\n For Linux users:\n ```bash\ngit --version\n```\n\n You can download the latest version of Git from the official Git website: https://git-scm.com/downloads\n\n2. If you're using a Linux or macOS system, you can update Git using your package manager. For example:\n\n - On Ubuntu/Debian:\n ```bash\nsudo apt-get update\nsudo apt-get install git\n```\n - On Red Hat/Fedora/CentOS:\n ```bash\nsudo yum update\nsudo yum install git\n```\n - On macOS (using Homebrew):\n ```bash\nbrew update\nbrew", "metrics": { "length": 993, "commands": 9, "command_list": [ "git version", "git --version", "git --version", "git --version", "git --version" ], "has_command_block": true, "actionable": true, "inline_code_count": 16, "lesson_hits": 1, "lesson_hit_rate": 1.0 }, "error": null, "run_at": "2026-10-12T08:20:51+00:00" }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "在 WSL2 上 `git push` / `git clone` / `git ls-remote` 卡到 124 超时,但**裸 `curl https://github.com` 反而 HTTP 200**。第一次遇到时很容易判成\"网络被墙\",于是去改 hosts、加代理、装 CA——而真正的原因在仓库自己的 `.git/config` 里。\n\n2026-08-01 的实际案例:`Agent-Medici` 仓(已废弃)配了 `http.proxy=socks5://172.19.128.1:7890`,那是一条已经死掉的 Windows Clash 链路。WSL 不继承 Windows 的 git 配置,所以**只有这一个仓**的 git 操作撞墙,其他仓正常——这个\"只有部分仓坏\"的特征正是本条的第一判据。 (github-connectivity-4-fallbacks)", "condition": "with_lesson", "status": 200, "content": "解决git push/clone/ls-remote卡到124超时的问题步骤如下:\n\n1. 检查当前仓的`.git/config`文件中是否有代理配置:\n```bash\ngit config --local --list | grep -i proxy\n```\n2. 如果有代理配置,则清除http.proxy和https.proxy:\n```bash\ngit config --local --unset http.proxy\ngit config --local --unset https.proxy\n```\n3. 全局也清除http.proxy和https.proxy(保险):\n```bash\ngit config --global --unset http.proxy\ngit config --global --unset https.proxy\n```\n4. 验证:\n```bash\ncd /tmp\ngit ls-remote https://github.com//.git HEAD\n```\n如果命令执行正常,则代理配置已清除。\n\n如果上述步骤无法解决问题,则可以尝试Fallback2:git alias ghub 强制IP解析。\n\n1. 添加alias到~/.gitconfig:\n```bash\ngit config --global alias.ghub '!f() {\n http --resolve $@ --no-check-certificate\n}'\n```\n2. 验证:\n```bash\ncd /tmp\n", "metrics": { "length": 684, "commands": 10, "command_list": [ "git config --local --list | grep -i proxy", "git config --local --unset http.proxy", "git config --local --unset https.proxy", "git config --global --unset http.proxy", "git config --global --unset https.proxy" ], "has_command_block": true, "actionable": false, "inline_code_count": 11, "lesson_hits": 7, "lesson_hit_rate": 1.0 }, "error": null, "run_at": "2026-10-12T08:20:52+00:00" }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "在 WSL2 上 `git push` / `git clone` / `git ls-remote` 卡到 124 超时,但**裸 `curl https://github.com` 反而 HTTP 200**。第一次遇到时很容易判成\"网络被墙\",于是去改 hosts、加代理、装 CA——而真正的原因在仓库自己的 `.git/config` 里。\n\n2026-08-01 的实际案例:`Agent-Medici` 仓(已废弃)配了 `http.proxy=socks5://172.19.128.1:7890`,那是一条已经死掉的 Windows Clash 链路。WSL 不继承 Windows 的 git 配置,所以**只有这一个仓**的 git 操作撞墙,其他仓正常——这个\"只有部分仓坏\"的特征正是本条的第一判据。 (github-connectivity-4-fallbacks)", "condition": "plain", "status": 200, "content": "解决 WSL2 上 Git Push/Clone/LS-Remote 卡到 124 超时的问题\n\n问题出在 `.git/config` 文件中,WSL2 不继承 Windows 的 Git 配置。为了解决这个问题,我们需要修改 `.git/config` 文件。\n\n**步骤 1:找到 `.git/config` 文件**\n\n在 WSL2 中,`.git/config` 文件位于 `~/.gitconfig` 或 `~/.git/config`(取决于你的 WSL2 phiên本)。你可以使用以下命令找到它:\n\n```bash\ngit config --get --show-origin config file\n```\n\n**步骤 2:查找相关配置**\n\n在 `.git/config` 文件中,找到以下配置:\n```yaml\nhttp.proxy = socks5://172.19.128.1:7890\n```\n如果找到该配置,则说明你的 Git 配置是从 Windows Clash 链路继承的。\n\n**步骤 3:修改配置**\n\n要解决这个问题,你需要删除 `.git/config` 中的 `http.proxy` 配置。可以使用以下命令:\n\n```bash\ngit config --local --remove http.proxy\n```\n\n如果你只想为特定仓库修改配置", "metrics": { "length": 595, "commands": 4, "command_list": [ "git config --get --show-origin config file", "如果找到该配置,则说明你的 Git 配置是从 Windows Clash 链路继承的。", "**步骤 3:修改配置**", "要解决这个问题,你需要删除 `.git/config` 中的 `http.proxy` 配置。可以使用以下命令:" ], "has_command_block": true, "actionable": false, "inline_code_count": 14, "lesson_hits": 6, "lesson_hit_rate": 0.857 }, "error": null, "run_at": "2026-10-12T08:20:52+00:00" }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Three checks that were green and covered nothing: the subject was outside the scope (green-check-subject-outside-scope)", "condition": "with_lesson", "status": 200, "content": "The issue here is that the `type` field is not present in the lesson data, but the code is trying to access it. To fix this, you need to make sure that the code is only trying to access fields that are present in the data. Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Update the `misakanet_tool.py` files**\n\nOpen the `integrations/langchain/misakanet_tool.py` and `integrations/llamaindex/misakanet_tool.py` files and update the lines that format the results to use the `domain` field instead of `type`:\n\n```python\npython\nlesson_type = result.get(\"domain\", \"unknown\")\nlines.append(f\"{i}. [{lesson_type}] {title} (relevance: {score:.2f})\")\n```\n\n**Step 2: Update the `test_integrations.py` file**\n\nOpen the `tests/test_integrations.py` file and update the assertion to check for the presence of the `domain` field:\n\n```python\npython\nassert \"Found 1 relevant lessons\" in re.search(r\".*domain.*\", re.search(r\".*domain.*\", re.search(r\".*domain.*\", re.search", "metrics": { "length": 973, "commands": 2, "command_list": [ "**Step 2: Update the `test_integrations.py` file**", "Open the `tests/test_integrations.py` file and update the assertion to check for the presence of the `domain` field:" ], "has_command_block": true, "actionable": true, "inline_code_count": 11, "lesson_hits": 2, "lesson_hit_rate": 0.5 }, "error": null, "run_at": "2026-10-12T08:20:52+00:00" }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Three checks that were green and covered nothing: the subject was outside the scope (green-check-subject-outside-scope)", "condition": "plain", "status": 200, "content": "The error you're encountering is due to a variable being used outside its scope. To fix this, you need to make sure that the variable is accessible within the scope where it's being used. Here's a concrete example with a step-by-step fix:\n\nLet's say you have a JavaScript function that calculates the area of a rectangle:\n\n```javascript\nfunction calculateArea(length, width) {\n // Use a variable 'area' that is not accessible outside the function\n let area = length * width;\n return area;\n}\n\n// Now, you're trying to use the 'area' variable outside the function\nconsole.log(calculateArea(10, 5));\n```\n\nWhen you run this code, you'll get the error: `Three checks that were green and covered nothing: the subject was outside the scope (green-check-subject-outside-scope)`.\n\nTo fix this, you can simply declare the `area` variable as a global variable or return it from the function:\n\n**Option 1: Declare `area` as a global variable**\n\n```javascript\nlet area;\n\nfunction calculateArea(length, width) {\n area = length * width;\n}\n\ncalculateArea(10, 5);\nconsole.log(area);\n```\n\n**Option 2: Return", "metrics": { "length": 1101, "commands": 3, "command_list": [ "When you run this code, you'll get the error: `Three checks that were green and covered nothing: the subject was outside the scope (green-check-subject-outside-scope)`.", "To fix this, you can simply declare the `area` variable as a global variable or return it from the function:", "**Option 1: Declare `area` as a global variable**" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null, "run_at": "2026-10-12T08:20:53+00:00" }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Killing a PID by 'has a connection to the LLM API' inference terminated the agent's own running turn (kill-pid-by-llm-api-inference-terminates-own-turn)", "condition": "plain", "status": 200, "content": "The error you're experiencing is due to the fact that the process that terminated the agent's turn is the same process that's trying to kill the PID. This can happen when the process that's running the inference is the same process that's running the agent.\n\nTo fix this issue, you can try killing the PID using the `kill` command, but first, you need to find the PID of the process that's running the inference. You can do this by running the following command:\n\n```bash\npgrep kill-pid-by-llm-api-inference\n```\n\nThis will give you the PID of the process that's running the inference.\n\nOnce you have the PID, you can kill the process using the following command:\n\n```bash\nkill \n```\n\nHowever, be careful when killing a process, as it can cause unexpected behavior or data loss.\n\nAlternatively, you can also try to use the `pkill` command to kill the process, which is a more gentle way of killing a process:\n\n```bash\npkill -9 kill-pid-by-llm-api-inference\n```\n\nThe `-9` flag tells `pkill` to force the process to exit immediately.\n\nIf you're using a Linux-based system, you can also try", "metrics": { "length": 1090, "commands": 3, "command_list": [ "pgrep kill-pid-by-llm-api-inference", "kill ", "pkill -9 kill-pid-by-llm-api-inference" ], "has_command_block": true, "actionable": true, "inline_code_count": 9, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null, "run_at": "2026-10-12T08:20:53+00:00" }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Killing a PID by 'has a connection to the LLM API' inference terminated the agent's own running turn (kill-pid-by-llm-api-inference-terminates-own-turn)", "condition": "with_lesson", "status": 200, "content": "Based on the problem description, the issue arises from the agent trying to kill a process that has a connection to the LLM API endpoint. This process can be either the agent itself or a background service, and the agent is unable to distinguish between the two.\n\nTo fix this issue, you need to modify the agent's logic to handle this case correctly. Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Modify the agent's logic**\n\nAdd the following code to the agent's script:\n```python\n# Define a new variable to store the process with the connection to the LLM API\nllm_api_process = None\n\n# ...\n\n# When the agent finds a process with a connection to the LLM API\nif has_connection_to_llm_api():\n # Get the process details\n process = get_process_with_connection_to_llm_api()\n \n # Check if the process is the agent itself\n if process.pid == get_my_pid():\n # If it's the agent, do not kill it\n print(\"Agent itself, skipping kill\")\n else:\n # If it's not the agent, kill the process\n kill_process(process)\n```\nThis code checks if the process with the connection to the LLM API", "metrics": { "length": 1132, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 1, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null, "run_at": "2026-10-12T08:20:53+00:00" }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A silent truncation in the MCP intake worker, fixed four times, each time at the next cap (mcp-intake-silent-truncation-family)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely due to a silent truncation issue in the MCP (Message Queuing Component) intake worker. This issue occurs when the worker tries to read a message from the queue that is longer than the buffer size. To fix this issue, you can try the following steps:\n\n**Step 1: Check the buffer size**\n\nOpen the MCPSQL database and run the following query to check the buffer size:\n```sql\nSELECT MAX(BufferSize) FROM sys.message_types\n```\nThis will return the maximum buffer size for the message type.\n\n**Step 2: Increase the buffer size**\n\nIf the buffer size is too small, you can increase it to prevent silent truncations. To do this, run the following command:\n```sql\nALTER MESSAGE TYPE mcp_intake TYPE 'text' WITH MAX_SIZE 65536;\n```\nThis will increase the buffer size to 65536 bytes for the `mcp_intake` message type.\n\n**Step 3: Update the worker configuration**\n\nOpen the MCPSQL database and run the following query to update the worker configuration:\n```sql\nUPDATE mcpsysmessageset\nSET BufferSize = 65536\nWHERE Name = 'mcp_intake';\n```\nThis will update the", "metrics": { "length": 1085, "commands": 6, "command_list": [ "This will return the maximum buffer size for the message type.", "**Step 2: Increase the buffer size**", "If the buffer size is too small, you can increase it to prevent silent truncations. To do this, run the following command:", "This will increase the buffer size to 65536 bytes for the `mcp_intake` message type.", "**Step 3: Update the worker configuration**" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null, "run_at": "2026-10-12T08:20:54+00:00" }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Node child_process with piped stdio fails with EPERM under the Windows sandbox (node-child-process-eperm-windows-sandbox-redirect-to-file)", "condition": "plain", "status": 200, "content": "The error you're encountering is due to the way Node.js handles child processes on Windows. By default, Node.js uses the `spawn` method, which doesn't support piping to a file when running in a sandboxed environment.\n\nTo fix this issue, you can use the `spawn` method with the `stdio` option set to `'ignore'` or `'pipe'`. However, since you're running in a Windows sandbox, you'll need to use the `spawn` method with the `stdio` option set to `'pipe'`, and then redirect the output to a file using the `stdout` option.\n\nHere's an example of how you can modify your code to fix the issue:\n\n```javascript\nconst { spawn } = require('child_process');\n\nconst child = spawn('your_command_here', ['arg1', 'arg2'], {\n stdio: 'pipe',\n cwd: 'your_cwd_here',\n env: {\n // Add any environment variables you need here\n },\n});\n\n// Redirect the output to a file\nchild.stdout.pipe(require('fs').createWriteStream('output.txt'));\n\n// Wait for the child process to finish\nchild.on('close', (code) => {\n if (code === 0) {\n console", "metrics": { "length": 1022, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 9, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null, "run_at": "2026-10-12T08:20:54+00:00" }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A silent truncation in the MCP intake worker, fixed four times, each time at the next cap (mcp-intake-silent-truncation-family)", "condition": "with_lesson", "status": 200, "content": "To fix the silent truncation in the MCP intake worker, you need to identify the root cause and apply the necessary changes. Based on the provided information, it seems that the issue lies in the Cloudflare Worker at `workers/register-proxy-sw.js`. The problem is that the limits on submitted text are not being checked correctly, resulting in silent truncations.\n\nHere's a concrete, actionable fix with exact commands:\n\n**Step 1: Update the `workers/register-proxy-sw.js` file**\n\nOpen the `workers/register-proxy-sw.js` file in your code editor and update the `redactIntake()` and `redactSecrets()` functions to correctly check the length of the submitted text.\n\n```javascript\n// workers/register-proxy-sw.js\n\nconst LIMIT = 2000;\n\nfunction redactIntake(text) {\n if (text.length > LIMIT) {\n // truncate the text to the limit\n return text.substring(0, LIMIT);\n }\n return text;\n}\n\nfunction redactSecrets(text) {\n if (text.length > LIMIT) {\n // truncate the text to the limit\n return text.substring(0, LIMIT);\n }\n return text;\n}\n```\n\n**Step 2: Update the `workers/register-proxy-sw.js`", "metrics": { "length": 1099, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 7, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null, "run_at": "2026-10-12T08:20:54+00:00" }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "npmjs registry unreachable from this host (self-signed/expired cert): pin a mirror, never disable TLS (npmjs-registry-unreachable-pin-a-mirror-never-disable-tls)", "condition": "with_lesson", "status": 200, "content": "To fix the issue, you'll need to pin a mirror for npm and never disable TLS. Here are the steps:\n\n**Step 1: Pin a mirror for npm**\n\nRun the following command to pin a mirror for npm:\n```bash\nnpm config set registry https://registry.npmjs.org/\n```\nThis sets the registry to the official npm registry, which is more likely to have a valid certificate.\n\n**Step 2: Verify the mirror**\n\nRun the following command to verify the mirror:\n```bash\ncurl -vI https://registry.npmjs.org/\n```\nThis should return a successful response with a 200 status code.\n\n**Step 3: Disable TLS verification temporarily**\n\nIf you need to install packages temporarily, you can disable TLS verification to force the installation through. However, as mentioned in the solution, this is not recommended as it exposes every subsequent download to silent MITM attacks.\n\nRun the following command to disable TLS verification temporarily:\n```bash\nnpm config set https-proxy false\n```\nThis disables the HTTPS proxy, which allows you to install packages without TLS verification.\n\n**Step 4: Re-enable TLS verification after installation**\n\nAfter installation, re-enable TLS verification to prevent silent MITM attacks:\n```bash\nnpm config set https-proxy", "metrics": { "length": 1215, "commands": 3, "command_list": [ "npm config set registry https://registry.npmjs.org/", "curl -vI https://registry.npmjs.org/", "npm config set https-proxy false" ], "has_command_block": true, "actionable": true, "inline_code_count": 6, "lesson_hits": 4, "lesson_hit_rate": 0.667 }, "error": null, "run_at": "2026-10-12T08:20:54+00:00" }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Node child_process with piped stdio fails with EPERM under the Windows sandbox (node-child-process-eperm-windows-sandbox-redirect-to-file)", "condition": "with_lesson", "status": 200, "content": "To fix the issue, you can redirect the child's output to a file and read that file. Here's a concrete, actionable fix with exact commands:\n\n```javascript\nconst { execFileSync } = require('child_process');\nconst fs = require('fs');\n\n// Create a temporary file\nconst tempFile = fs.mkdtempSync('tmp-');\n\ntry {\n // Redirect stdout/stderr to the temporary file\n const output = execFileSync('your-command', { stdio: ['pipe', 'pipe', 'pipe'] });\n \n // Read the output from the temporary file\n const outputContent = fs.readFileSync(tempFile, 'utf8');\n \n console.log(outputContent);\n \n // Clean up the temporary file\n fs.unlinkSync(tempFile);\n} catch (error) {\n if (error.code === 'EPERM') {\n console.error('Error: EPERM operation not permitted.');\n } else {\n console.error('Error:', error);\n }\n}\n```\n\nReplace `'your-command'` with the actual command you want to execute.\n\nThis code creates a temporary file, redirects the child's output to it, reads the output from the temporary file, and then cleans up the temporary file. If an EPERM error occurs", "metrics": { "length": 1060, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 2, "lesson_hits": 1, "lesson_hit_rate": 0.333 }, "error": null, "run_at": "2026-10-12T08:20:55+00:00" }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "npmjs registry unreachable from this host (self-signed/expired cert): pin a mirror, never disable TLS (npmjs-registry-unreachable-pin-a-mirror-never-disable-tls)", "condition": "plain", "status": 200, "content": "The error you're encountering is due to the fact that your system's certificate trust store is not configured to trust the NPM registry's self-signed certificate. Here's a step-by-step solution to resolve this issue:\n\n**Step 1: Update your system's certificate trust store**\n\nYou'll need to update the certificate trust store on your Linux or macOS system. The steps vary depending on your operating system:\n\n**For Linux (Ubuntu/Debian):**\n\n1. Update the package list: `sudo apt update`\n2. Install the `ca-certificates` package: `sudo apt install ca-certificates`\n3. Update the certificate trust store: `sudo update-ca-certificates`\n\n**For macOS (with Homebrew):**\n\n1. Update the certificate trust store: `brew install ca-certificates`\n\n**For Linux (with yum/rpm):**\n\n1. Update the package list: `sudo yum update`\n2. Install the `ca-certificates` package: `sudo yum install ca-certificates`\n3. Update the certificate trust store: `sudo update-ca-certificates`\n\n**Step 2: Verify the NPM registry's certificate**\n\nYou can verify the NPM registry's certificate by running the following command:\n```bash\nopenssl s_client -connect registry.npm", "metrics": { "length": 1138, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 9, "lesson_hits": 2, "lesson_hit_rate": 0.333 }, "error": null, "run_at": "2026-10-12T08:20:55+00:00" }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A permission denial that removes the deciding evidence is a stop signal, not an obstacle to route around (permission-denial-removes-evidence-is-stop-signal)", "condition": "with_lesson", "status": 200, "content": "To address the error, you'll need to modify your code to handle permission denials correctly. Here's an example of how you can modify your code to follow the steps outlined in the solution:\n\n**Step 1: Enumerate evidence before the destructive action**\n\nBefore performing any destructive action, list every piece of evidence the action depends on. If any of that evidence requires a channel the sandbox denies, stop and escalate rather than re-derive it.\n\n```python\nimport os\n\ndef enumerate_evidence(action):\n evidence = []\n # Process identity\n process_id = action['process_id']\n evidence.append({'type': 'process_id', 'value': process_id})\n \n # File path\n file_path = action['file_path']\n evidence.append({'type': 'file_path', 'value': file_path})\n \n # Ownership\n ownership = action['ownership']\n evidence.append({'type': 'ownership', 'value': ownership})\n \n # State\n state = action['state']\n evidence.append({'type': 'state', 'value': state})\n \n return evidence\n```\n\n**Step 2: Keep inference separate from fact**\n\nMaintain an explicit written separation between log fact (what the system reported) and your inference (", "metrics": { "length": 1173, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 1, "lesson_hits": 2, "lesson_hit_rate": 1.0 }, "error": null, "run_at": "2026-10-12T08:20:56+00:00" }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A patch that fails on a later hunk has usually already changed the earlier ones — patch and git apply disagree (patch-failed-hunk-already-changed-earlier-files)", "condition": "plain", "status": 200, "content": "This error occurs when you're trying to apply a patch to your codebase, but the patch has already changed some files that were modified earlier. Here's a step-by-step solution to resolve the issue:\n\n**Step 1: Remove the changes from the patch**\n\nFirst, you need to remove the changes from the patch that were made to files that were modified earlier. You can do this using the `git apply` command with the `--reject` option.\n\n```bash\ngit apply --reject --patch-header < patch_file.patch\n```\n\nThis command will apply the patch to your codebase, but it will leave the changes from the patch in the files that were modified earlier.\n\n**Step 2: Use `git apply` with the `--ignore-whitespace` option**\n\nNext, you need to use `git apply` with the `--ignore-whitespace` option to ignore the whitespace changes from the patch.\n\n```bash\ngit apply --ignore-whitespace < patch_file.patch\n```\n\nThis command will apply the patch to your codebase, ignoring any whitespace changes.\n\n**Step 3: Resolve the conflicts**\n\nAfter applying the patch, you'll need to resolve the conflicts manually. You can do this using the `git diff` command to identify the conflicting", "metrics": { "length": 1148, "commands": 2, "command_list": [ "git apply --reject --patch-header < patch_file.patch", "git apply --ignore-whitespace < patch_file.patch" ], "has_command_block": true, "actionable": true, "inline_code_count": 10, "lesson_hits": 3, "lesson_hit_rate": 0.75 }, "error": null, "run_at": "2026-10-12T08:20:56+00:00" }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A permission denial that removes the deciding evidence is a stop signal, not an obstacle to route around (permission-denial-removes-evidence-is-stop-signal)", "condition": "plain", "status": 200, "content": "To fix the error \"permission denial that removes the deciding evidence is a stop signal, not an obstacle to route around,\" you'll need to modify your code to handle this scenario. Since the error doesn't provide a specific code, I'll assume you're using a programming language like Python.\n\nHere's a concrete, actionable fix with exact commands:\n\n**Assumptions:**\n\n* You're using Python as your programming language.\n* You're using a library like `requests` to make API calls.\n* The API endpoint you're calling returns a JSON response.\n\n**Fix:**\n\n1. **Check the API documentation**: Before making any changes, check the API documentation to see if they have a specific error handling mechanism for this scenario. You might need to use a different endpoint or parameter to avoid this issue.\n\n2. **Handle the error**: If the API documentation doesn't provide a solution, you can handle the error using a try-except block. Here's an example in Python:\n```python\nimport requests\n\ndef make_api_call(url, params):\n try:\n response = requests.get(url, params=params)\n response.raise_for_status() # Raise an exception for HTTP errors\n return response.json()\n except requests.exceptions.HTTPError as http_err:\n ", "metrics": { "length": 1235, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 1, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null, "run_at": "2026-10-12T08:20:56+00:00" }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A port that is already allocated is an OS-level EADDRINUSE: name the holder with ss, free it, then retry (port-already-allocated-find-and-free-the-holder)", "condition": "with_lesson", "status": 200, "content": "To resolve the issue of a port being already allocated, you'll need to identify the process holding the port and stop it. Here's a step-by-step guide:\n\n1. Identify the process holding the port:\n\n You can use the `ss` command to list all listening sockets and find the one that's causing the issue:\n\n ```bash\nss -tlnp | grep 8080\n```\n\n This will show you the process ID (PID) of the process holding the port. Note down the PID.\n\n2. Find the process details:\n\n You can use `ss` with the `-p` option to show more detailed information about the process:\n\n ```bash\nss -ptlnp | grep 8080\n```\n\n This will show you the process name, command, and other details.\n\n3. Stop the process:\n\n You can use the `kill` command to stop the process:\n\n ```bash\nkill \n```\n\n Replace `` with the actual PID of the process you want to stop.\n\n4. Check if the port is available:\n\n After stopping the process, you can try binding to the port again:\n\n ```bash\nnc -l -p 8080\n```\n\n If the", "metrics": { "length": 990, "commands": 4, "command_list": [ "ss -tlnp | grep 8080", "ss -ptlnp | grep 8080", "kill ", "nc -l -p 8080" ], "has_command_block": true, "actionable": true, "inline_code_count": 12, "lesson_hits": 4, "lesson_hit_rate": 0.5 }, "error": null, "run_at": "2026-10-12T08:20:56+00:00" }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A patch that fails on a later hunk has usually already changed the earlier ones — patch and git apply disagree (patch-failed-hunk-already-changed-earlier-files)", "condition": "with_lesson", "status": 200, "content": "The issue arises because `patch` and `git apply` behave differently when a hunk fails and the earlier files have already been modified. `patch` keeps the changes it has already applied, while `git apply` is atomic and starts from scratch.\n\nTo resolve this issue, you can try the following steps:\n\n1. Use `git apply` with the `--ignore-missing` option. This will allow `git apply` to ignore the failed hunk and continue applying the rest of the patch.\n\n ```bash\ngit apply --ignore-missing m.diff\n```\n\n2. If the above method doesn't work, you can try using `git apply` with the `--reject` option. This will allow `git apply` to create a reject file for the failed hunk, which you can then manually edit to fix the conflict.\n\n ```bash\ngit apply --reject m.diff\n```\n\n3. If you still encounter issues, you can try to manually resolve the conflict by editing the file and then applying the patch again.\n\n ```bash\n# Manually edit the file to resolve the conflict\n# ...\n\n# Apply the patch again\ngit apply --apply-patch m.diff\n```\n\nNote: Make sure to replace `m.diff`", "metrics": { "length": 1067, "commands": 3, "command_list": [ "git apply --ignore-missing m.diff", "git apply --reject m.diff", "git apply --apply-patch m.diff" ], "has_command_block": true, "actionable": true, "inline_code_count": 16, "lesson_hits": 2, "lesson_hit_rate": 0.5 }, "error": null, "run_at": "2026-10-12T08:20:57+00:00" }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A port that is already allocated is an OS-level EADDRINUSE: name the holder with ss, free it, then retry (port-already-allocated-find-and-free-the-holder)", "condition": "plain", "status": 200, "content": "The error message indicates that the port you're trying to use is already in use by another process. Here's a concrete, actionable fix:\n\n**Step 1: Identify the process using the port**\n\nUse the `ss` command to identify the process using the port:\n```bash\nss -tlnp | grep \n```\nReplace `` with the actual port number you're trying to use.\n\nFor example:\n```bash\nss -tlnp | grep 8080\n```\nThis will show you the process ID and name of the process using port 8080.\n\n**Step 2: Kill the process using the port**\n\nUse the `kill` command to kill the process:\n```bash\nkill \n```\nReplace `` with the actual process ID shown in the previous step.\n\nFor example:\n```bash\nkill 1234\n```\nThis will kill the process using port 8080.\n\n**Step 3: Free the port**\n\nUse the `netsh` command to free the port:\n```bash\nnetsh int ip reset\n```\nThis will reset the port allocation and free the port.\n\n**Step 4: Retry your command**\n\nOnce the port is freed, you can", "metrics": { "length": 983, "commands": 5, "command_list": [ "ss -tlnp | grep ", "ss -tlnp | grep 8080", "kill ", "kill 1234", "netsh int ip reset" ], "has_command_block": true, "actionable": true, "inline_code_count": 14, "lesson_hits": 3, "lesson_hit_rate": 0.375 }, "error": null, "run_at": "2026-10-12T08:20:57+00:00" }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Writes outside the session workspace under workspace-write: escalate once with justification, don't retry other APIs (workspace-write-policy-denial-escalate-once-not-retry-apis)", "condition": "with_lesson", "status": 200, "content": "To fix the issue, you need to recognize that the error is a policy denial and not a transient failure. The solution involves escalating the denial with justification and not retrying through other APIs.\n\nHere's a step-by-step fix:\n\n1. **Escalate the denial**: Provide a justification for the denial. In this case, the justification is that the operation is outside the session workspace.\n\n ```bash\n # Escalate the denial with justification\n sandbox: escalate-write-access-denial-justification\n ```\n\n2. **Do not retry through other APIs**: Avoid retrying the operation through other APIs, such as PowerShell, Node fs, or the host CLI.\n\n ```bash\n # Avoid retrying through other APIs\n workspace-write-policy-denial-escalate-once-not-retry-apis\n ```\n\nHere's the complete command:\n\n```bash\nsandbox: escalate-write-access-denial-justification workspace-write-policy-denial-escalate-once-not-retry-apis\n```\n\nBy following these steps, you should be able to resolve the issue and write outside the session workspace.", "metrics": { "length": 1023, "commands": 3, "command_list": [ "sandbox: escalate-write-access-denial-justification", "workspace-write-policy-denial-escalate-once-not-retry-apis", "sandbox: escalate-write-access-denial-justification workspace-write-policy-denial-escalate-once-not-retry-apis" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 1, "lesson_hit_rate": 0.2 }, "error": null, "run_at": "2026-10-12T08:20:58+00:00" }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Following a README's --profile name verbatim installs into a profile the running host never loads (readme-profile-name-verbatim-installs-into-unloaded-profile)", "condition": "with_lesson", "status": 200, "content": "Here's a concrete, actionable fix with exact commands:\n\n**Step 1: Enumerate the real profiles before any plugin install**\n\nBefore running any install command, list the actual profiles on this host:\n\n```bash\n# On a default install\n$DSH_HOME/profiles/\n\n# On a managed host\n/opt/dsh/profiles/\n```\n\nThis command will show you the names of the profiles available on your host.\n\n**Step 2: Confirm which profile the running GUI/CLI actually consumes**\n\nOnce you have the list of profiles, check which one is currently being used by the GUI or CLI:\n\n```bash\n# On a default install\n$DSH_HOME/profiles/\n\n# On a managed host\n/opt/dsh/profiles/\n\n# To determine which profile is being used, you can run the following command:\n$DSH_HOME/bin/dsh --version\n```\n\nThis command will show you the version of DSH being used, which includes the name of the profile being used.\n\n**Step 3: Update the install command with the correct profile name**\n\nNow that you know which profile is being used, update the install command to use that profile name:\n\n```bash\n# Example: if the running GUI/CLI is using the \"web\" profile\n", "metrics": { "length": 1096, "commands": 5, "command_list": [ "$DSH_HOME/profiles/", "/opt/dsh/profiles/", "$DSH_HOME/profiles/", "/opt/dsh/profiles/", "$DSH_HOME/bin/dsh --version" ], "has_command_block": true, "actionable": true, "inline_code_count": 4, "lesson_hits": 3, "lesson_hit_rate": 1.0 }, "error": null, "run_at": "2026-10-12T08:20:58+00:00" }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Following a README's --profile name verbatim installs into a profile the running host never loads (readme-profile-name-verbatim-installs-into-unloaded-profile)", "condition": "plain", "status": 200, "content": "The error you're encountering is likely due to a mismatch between the profile name specified in the README file and the actual profile name loaded by the host.\n\nHere's a step-by-step solution to resolve this issue:\n\n**Step 1: Identify the mismatched profile name**\n\nRun the following command to list all profiles on your system:\n```bash\naws cloudformation describe-stacks --stack-name --query 'Stacks[0].Resources[]|{ProfileName}' --output text\n```\nReplace `` with the actual name of your CloudFormation stack.\n\n**Step 2: Update the README file**\n\nLocate the line in the README file that specifies the profile name. Update the profile name to match the actual profile name loaded by the host.\n\nFor example, if the current line is:\n```markdown\n--profile my-profile\n```\nUpdate it to:\n```markdown\n--profile \n```\nReplace `` with the actual profile name returned in Step 1.\n\n**Step 3: Update the CloudFormation template**\n\nIf the README file is part of a CloudFormation template, update the `Resources` section to reference the correct profile name. You can do this by adding the `Profile", "metrics": { "length": 1160, "commands": 2, "command_list": [ "aws cloudformation describe-stacks --stack-name --query 'Stacks[0].Resources[]|{ProfileName}' --output text", "Update it to:" ], "has_command_block": true, "actionable": false, "inline_code_count": 9, "lesson_hits": 2, "lesson_hit_rate": 0.667 }, "error": null, "run_at": "2026-10-12T08:20:58+00:00" }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Writes outside the session workspace under workspace-write: escalate once with justification, don't retry other APIs (workspace-write-policy-denial-escalate-once-not-retry-apis)", "condition": "plain", "status": 200, "content": "The error message you're seeing indicates that you're trying to write data outside of the session workspace, which is causing an escalation. The specific policy being applied is \"workspace-write-policy-denial-escalate-once-not-retry-apis\". To fix this, you'll need to modify the policy to allow retries or move the write operation inside the session workspace. Here are the steps to resolve this issue:\n\n**Option 1: Modify the policy to allow retries**\n\nYou can modify the policy to allow retries by updating the `workspace-write-policy` with the following command:\n\n```bash\nkubectl patch policy workspace-write-policy -p '{\"spec\":{\"retryPolicy\":{\"maxAttempts\":3,\"retryInterval\":\"1m\"}}}'\n```\n\nThis will update the policy to allow up to 3 retries with a 1-minute interval between each retry.\n\n**Option 2: Move the write operation inside the session workspace**\n\nIf you can't modify the policy, you can move the write operation inside the session workspace by using the following command:\n\n```bash\nkubectl exec -it -- /bin/bash\n```\n\nReplace `` with the name of the pod where you're trying to write data. This will open a shell session inside the pod.\n\nThen, use", "metrics": { "length": 1180, "commands": 2, "command_list": [ "kubectl patch policy workspace-write-policy -p '{\"spec\":{\"retryPolicy\":{\"maxAttempts\":3,\"retryInterval\":\"1m\"}}}'", "kubectl exec -it -- /bin/bash" ], "has_command_block": true, "actionable": true, "inline_code_count": 5, "lesson_hits": 1, "lesson_hit_rate": 0.2 }, "error": null, "run_at": "2026-10-12T08:20:59+00:00" }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Long context pollution — delegate independent tasks to subagents, keep only decisions in the main context (long-context-pollution-delegate-to-subagents-keep-only-decisions)", "condition": "plain", "status": 200, "content": "The error \"Long context pollution — delegate independent tasks to subagents, keep only decisions in the main context\" is a warning in the context of functional programming, specifically in Haskell. It's suggesting that you're passing too much context to your subagents, which can lead to long context pollution.\n\nHere's a concrete, actionable fix with exact commands:\n\n### Step 1: Identify the problematic code\n\nFind the functions or modules where you're delegating tasks to subagents and passing a large amount of context.\n\n### Step 2: Break down the context\n\nIdentify the parts of the context that are necessary for the subagent to perform its task. You can do this by:\n\n* Looking at the documentation or source code of the subagent library or module.\n* Analyzing the input and output types of the subagent functions.\n* Using a debugger or print statements to understand the flow of data.\n\n### Step 3: Refactor the code to reduce context pollution\n\nOnce you've identified the necessary parts of the context, refactor your code to pass only those parts to the subagent. You can do this by:\n\n* Creating a new data structure to hold the necessary context.\n* Passing the new data structure to the subagent function.\n* ", "metrics": { "length": 1227, "commands": 0, "command_list": [], "has_command_block": false, "actionable": false, "inline_code_count": 0, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null, "run_at": "2026-10-12T08:20:59+00:00" }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "FANUC RAG Knowledge-Base Build SOP: Anti-BSOD / Anti-Full-Loss (rag-kb-build-sop-anti-bsod)", "condition": "with_lesson", "status": 200, "content": "Here's a concrete, actionable fix with exact commands to prevent the BSOD/Full-Loss issue:\n\n**Step 1: Consult Lessons First**\n\nBefore starting the KB build, run the following commands to search for relevant lessons, read their contents, and copy the rules into the executable:\n\n```bash\n# Search for lessons related to build, chroma, ingest, rebuild, batch, and memory\ngrep -r 'build|chroma|ingest|rebuild|batch|memory' MisakaNet-lessons/ | grep -v 'not applicable' | grep -v 'skip' | grep -v 'not implemented'\n\n# Read the contents of each lesson and copy the rules into the executable\nfor file in MisakaNet-lessons/*; do\n if [[ $file == *build* || $file == *chroma* || $file == *ingest* || $file == *rebuild* || $file == *batch* || $file == *memory* ]]; then\n echo \"Copying rules from $file into the executable...\"\n cat $file >> MisakaNet-lessons/executable.sh\n fi\ndone\n```\n\n**Verify the Results**\n\nAfter running the above commands, verify that the executable file (`", "metrics": { "length": 975, "commands": 7, "command_list": [ "grep -r 'build|chroma|ingest|rebuild|batch|memory' MisakaNet-lessons/ | grep -v 'not applicable' | grep -v 'skip' | grep -v 'not implemented'", "for file in MisakaNet-lessons/*; do", "if [[ $file == *build* || $file == *chroma* || $file == *ingest* || $file == *rebuild* || $file == *batch* || $file == *memory* ]]; then", "echo \"Copying rules from $file into the executable...\"", "cat $file >> MisakaNet-lessons/executable.sh" ], "has_command_block": true, "actionable": true, "inline_code_count": 2, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null, "run_at": "2026-10-12T08:20:59+00:00" }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Long context pollution — delegate independent tasks to subagents, keep only decisions in the main context (long-context-pollution-delegate-to-subagents-keep-only-decisions)", "condition": "with_lesson", "status": 200, "content": "To fix the \"Long context pollution\" issue, you can use the following steps:\n\n### Step 1: Delegate Independent Work Units to Subagents\n\nYou can delegate independent work units to subagents using the `multiprocessing` module in Python. Here's an example:\n\n```python\nimport multiprocessing\nimport os\n\ndef delegate_work_unit(subagent_id, work_unit):\n # Process the work unit\n result = process_work_unit(work_unit)\n return result\n\ndef process_work_unit(work_unit):\n # Replace this with your actual work unit processing function\n return work_unit\n\nif __name__ == \"__main__\":\n # Define the work units to delegate\n work_units = [\n \"file1.txt\",\n \"search1\",\n \"regression_check1\",\n \"enumerate1\",\n \"file2.txt\",\n \"search2\",\n \"regression_check2\",\n \"enumerate2\",\n ]\n\n # Create subagents\n subagents = []\n for i, work_unit in enumerate(work_units):\n subagent = multiprocessing.Process(target=delegate_work_unit, args=(i, work_unit))\n subagents.append(subagent)\n subagent.start()\n\n # Wait for all subagents to finish\n for subagent in", "metrics": { "length": 1131, "commands": 0, "command_list": [], "has_command_block": false, "actionable": true, "inline_code_count": 1, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null, "run_at": "2026-10-12T08:20:59+00:00" }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "A doc link to the run's own output is not a broken link: validate against declared outputs, then re-check after writing (self-referential-verification-link)", "condition": "with_lesson", "status": 200, "content": "The issue arises from the fact that the verifier is checking the links before the report is written. This creates a circular dependency between the checks and the report. To fix this issue, we need to reorder the checks so that the report is written before the links are checked.\n\nHere is an example of how you can modify your code to fix this issue:\n\n```bash\n# Create a new directory to store the run\nmkdir my-run\ncd my-run\n\n# Create a directory to store the report\nmkdir report\n\n# Create a file to store the report\necho \"content: pass\" > report/verification-results.json\n\n# Create a file to store the checks\ncat > checks.json < document.json < --api-key --contract 0x --method getBalance --gasPrice \n\n# BscScan\nbscscan --address --api-key --contract 0x --method getBalance --gasPrice \n```\n\n**Step 3: Update the bounty description**\n\n* Update the bounty description to include the settlement value, payment unit, chain, gas model, and trust level.\n", "metrics": { "length": 1098, "commands": 2, "command_list": [ "etherscan --address --api-key --contract 0x --method getBalance --gasPrice ", "bscscan --address --api-key --contract 0x --method getBalance --gasPrice " ], "has_command_block": true, "actionable": true, "inline_code_count": 1, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null, "run_at": "2026-10-12T08:21:01+00:00" }, { "model": "@cf/meta/llama-3.2-3b-instruct", "scenario": "Crypto/Web3 bounty settlement — basic units, cross-chain payments, gas, platform trust grading (crypto-web3-bounty-settlement-units-cross-chain-gas-trust-grading)", "condition": "plain", "status": 200, "content": "I'll provide a step-by-step guide to resolve the error. However, I need to know the programming language and the exact error message you're encountering.\n\nAssuming you're using Solidity for smart contracts, I'll provide a general solution for the error \"Crypto/Web3 bounty settlement — basic units, cross-chain payments, gas, platform trust grading\".\n\nHere's an example of a basic contract that might be causing the issue:\n\n```solidity\npragma solidity ^0.8.0;\n\ncontract BountySettlement {\n // Basic units\n uint256 public basicUnits = 10;\n\n // Cross-chain payments\n mapping(address => uint256) public crossChainPayments;\n\n // Gas\n uint256 public gas = 2000000;\n\n // Platform trust grading\n mapping(address => uint256) public trustGrading;\n}\n```\n\nTo fix the error, you need to specify the exact error message you're encountering. However, I can provide a general solution for common errors related to this topic:\n\n### Error: \"unknown\" or \"not implemented\"\n\nIf you're encountering an \"unknown\" or \"not implemented\" error, it's likely because you're trying to use a function or variable that doesn't exist in the contract.\n\n```bash\n", "metrics": { "length": 1152, "commands": 2, "command_list": [ "To fix the error, you need to specify the exact error message you're encountering. However, I can provide a general solution for common errors related to this topic:", "If you're encountering an \"unknown\" or \"not implemented\" error, it's likely because you're trying to use a function or variable that doesn't exist in the contract." ], "has_command_block": true, "actionable": true, "inline_code_count": 2, "lesson_hits": 0, "lesson_hit_rate": 0.0 }, "error": null, "run_at": "2026-10-12T08:21:01+00:00" } ], "metric_definition": "lesson_hit_rate = the share of the injected lesson's commands reproduced in the answer. The scenario is that same lesson's title, no retrieval call is made, and correctness is not checked — it measures recitation of the document that was handed to the model.", "metric_summary": "the share of the injected lesson's commands reproduced in the answer" }