get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/2197376/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2197376,
    "url": "http://patchwork.ozlabs.org/api/patches/2197376/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/ltp/patch/20260217-agents_file-v4-1-e71ae27ea2d9@suse.com/",
    "project": {
        "id": 59,
        "url": "http://patchwork.ozlabs.org/api/projects/59/?format=api",
        "name": "Linux Test Project development",
        "link_name": "ltp",
        "list_id": "ltp.lists.linux.it",
        "list_email": "ltp@lists.linux.it",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20260217-agents_file-v4-1-e71ae27ea2d9@suse.com>",
    "list_archive_url": null,
    "date": "2026-02-17T19:22:56",
    "name": "[v4] agents: Add AI agent configuration for code reviews",
    "commit_ref": null,
    "pull_url": null,
    "state": "under-review",
    "archived": false,
    "hash": "49fef3e9ea6d08274b9a8819449c566caa8a6321",
    "submitter": {
        "id": 83220,
        "url": "http://patchwork.ozlabs.org/api/people/83220/?format=api",
        "name": "Andrea Cervesato",
        "email": "andrea.cervesato@suse.de"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/ltp/patch/20260217-agents_file-v4-1-e71ae27ea2d9@suse.com/mbox/",
    "series": [
        {
            "id": 492473,
            "url": "http://patchwork.ozlabs.org/api/series/492473/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/ltp/list/?series=492473",
            "date": "2026-02-17T19:22:56",
            "name": "[v4] agents: Add AI agent configuration for code reviews",
            "version": 4,
            "mbox": "http://patchwork.ozlabs.org/series/492473/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2197376/comments/",
    "check": "success",
    "checks": "http://patchwork.ozlabs.org/api/patches/2197376/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "ltp@lists.linux.it"
        ],
        "Delivered-To": [
            "patchwork-incoming@legolas.ozlabs.org",
            "ltp@picard.linux.it"
        ],
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256\n header.s=susede2_rsa header.b=DlIXHkTC;\n\tdkim=fail reason=\"signature verification failed\" header.d=suse.de\n header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519\n header.b=81VgdEEG;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key)\n header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa\n header.b=DlIXHkTC;\n\tdkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256\n header.s=susede2_ed25519 header.b=81VgdEEG;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it\n (client-ip=2001:1418:10:5::2; helo=picard.linux.it;\n envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it;\n receiver=patchwork.ozlabs.org)",
            "smtp-out1.suse.de;\n\tnone"
        ],
        "Received": [
            "from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fFqL35H9Qz1xpl\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 18 Feb 2026 06:23:06 +1100 (AEDT)",
            "from picard.linux.it (localhost [IPv6:::1])\n\tby picard.linux.it (Postfix) with ESMTP id 0E0353D0664\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 17 Feb 2026 20:23:04 +0100 (CET)",
            "from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it\n [IPv6:2001:4b78:1:20::5])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature ECDSA (secp384r1))\n (No client certificate requested)\n by picard.linux.it (Postfix) with ESMTPS id 491A63D0635\n for <ltp@lists.linux.it>; Tue, 17 Feb 2026 20:22:58 +0100 (CET)",
            "from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by in-5.smtp.seeweb.it (Postfix) with ESMTPS id C231F60029D\n for <ltp@lists.linux.it>; Tue, 17 Feb 2026 20:22:57 +0100 (CET)",
            "from imap1.dmz-prg2.suse.org (unknown [10.150.64.97])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n (No client certificate requested)\n by smtp-out1.suse.de (Postfix) with ESMTPS id 0BED93E6EE;\n Tue, 17 Feb 2026 19:22:57 +0000 (UTC)",
            "from imap1.dmz-prg2.suse.org (localhost [127.0.0.1])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest\n SHA256)\n (No client certificate requested)\n by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id C722A3EA65;\n Tue, 17 Feb 2026 19:22:56 +0000 (UTC)",
            "from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167])\n by imap1.dmz-prg2.suse.org with ESMTPSA id JGMnLhDAlGnAEAAAD6G6ig\n (envelope-from <andrea.cervesato@suse.de>); Tue, 17 Feb 2026 19:22:56 +0000"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_rsa;\n t=1771356177;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding;\n bh=1bBiqMXIl5lgi0bEH7jw3kobs3DbqnhMVp/pG6WL3ic=;\n b=DlIXHkTCayeXxCfkkRO8GlX4cfnFkzY5gh2nzsu3Sl6TP4BMvOURjz/nK7M7lAJt5pKgSK\n N2Rsh85X/vKcnd6To9UHdxOpHkMXet8tdhmvk0XueyoFJkqOokr2OW5vrNdqztm4oXU47l\n psaAqnI6CC39LYTEoeRtYUikQb3GjEg=",
            "v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_ed25519; t=1771356177;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding;\n bh=1bBiqMXIl5lgi0bEH7jw3kobs3DbqnhMVp/pG6WL3ic=;\n b=81VgdEEGvcQZ9uHFEL4gdMXEAdbjaIHcf01uV4drCJ0oztwqYd02bE1qOdQatSH1BW0z7V\n 5ggEsc+sK5S8wWAw==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_rsa;\n t=1771356177;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding;\n bh=1bBiqMXIl5lgi0bEH7jw3kobs3DbqnhMVp/pG6WL3ic=;\n b=DlIXHkTCayeXxCfkkRO8GlX4cfnFkzY5gh2nzsu3Sl6TP4BMvOURjz/nK7M7lAJt5pKgSK\n N2Rsh85X/vKcnd6To9UHdxOpHkMXet8tdhmvk0XueyoFJkqOokr2OW5vrNdqztm4oXU47l\n psaAqnI6CC39LYTEoeRtYUikQb3GjEg=",
            "v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de;\n s=susede2_ed25519; t=1771356177;\n h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc:\n mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding;\n bh=1bBiqMXIl5lgi0bEH7jw3kobs3DbqnhMVp/pG6WL3ic=;\n b=81VgdEEGvcQZ9uHFEL4gdMXEAdbjaIHcf01uV4drCJ0oztwqYd02bE1qOdQatSH1BW0z7V\n 5ggEsc+sK5S8wWAw=="
        ],
        "From": "Andrea Cervesato <andrea.cervesato@suse.de>",
        "Date": "Tue, 17 Feb 2026 20:22:56 +0100",
        "MIME-Version": "1.0",
        "Message-Id": "<20260217-agents_file-v4-1-e71ae27ea2d9@suse.com>",
        "X-B4-Tracking": "v=1; b=H4sIAA/AlGkC/33M3QqCMBjG8VuRHbfYlzM76j4iYs731UFpbDYK8\n d6bQqAddPg88PuPJIB3EMgxG4mH6ILruzTULiO2NV0D1NVpE8GEZoLn1DTQDeGK7gZUKlXVVkr\n GakaSeHhA91pq50varQtD799LPPL5/Xb0phM55TSXYLU5gEUpTuEZYG/7O5kzUfyhItFKG0RUv\n Mzxl8o1LbZUJopWgMayAGaKFZ2m6QOa5O8xGwEAAA==",
        "X-Change-ID": "20260215-agents_file-344bdc3300d0",
        "To": "Linux Test Project <ltp@lists.linux.it>",
        "X-Mailer": "b4 0.14.2",
        "X-Developer-Signature": "v=1; a=ed25519-sha256; t=1771356176; l=25022;\n i=andrea.cervesato@suse.com; s=20251210; h=from:subject:message-id;\n bh=rWZ93BVzSsisSolh+o8q3EAjr72v+FsSy0sV8FzeLJw=;\n b=Xd6zdI/bOoKKrAuGrEue+JjiLv1/kRPoGAT7xITDLY85mTn4nz2Gp/PJMWcAxvK1CVeXx8gba\n EToWI/+e01cBQ28Pwqnv1gPCoCLq/g3uzRHLPSRYHfFVQzcCYhxRqbS",
        "X-Developer-Key": "i=andrea.cervesato@suse.com; a=ed25519;\n pk=zKY+6GCauOiuHNZ//d8PQ/UL4jFCTKbXrzXAOQSLevI=",
        "X-Spamd-Result": "default: False [-4.30 / 50.00]; BAYES_HAM(-3.00)[100.00%];\n NEURAL_HAM_LONG(-1.00)[-1.000];\n NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain];\n FUZZY_RATELIMITED(0.00)[rspamd.com];\n RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[];\n RCPT_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[];\n DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519];\n TO_DN_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+];\n FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[];\n RCVD_COUNT_TWO(0.00)[2];\n DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo, suse.com:mid,\n suse.com:email]",
        "X-Spam-Score": "-4.30",
        "X-Spam-Level": "",
        "X-Spam-Status": "No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID,\n DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS shortcircuit=no\n autolearn=disabled version=4.0.1",
        "X-Spam-Checker-Version": "SpamAssassin 4.0.1 (2024-03-25) on in-5.smtp.seeweb.it",
        "X-Virus-Scanned": "clamav-milter 1.0.9 at in-5.smtp.seeweb.it",
        "X-Virus-Status": "Clean",
        "Subject": "[LTP] [PATCH v4] agents: Add AI agent configuration for code reviews",
        "X-BeenThere": "ltp@lists.linux.it",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "Linux Test Project <ltp.lists.linux.it>",
        "List-Unsubscribe": "<https://lists.linux.it/options/ltp>,\n <mailto:ltp-request@lists.linux.it?subject=unsubscribe>",
        "List-Archive": "<http://lists.linux.it/pipermail/ltp/>",
        "List-Post": "<mailto:ltp@lists.linux.it>",
        "List-Help": "<mailto:ltp-request@lists.linux.it?subject=help>",
        "List-Subscribe": "<https://lists.linux.it/listinfo/ltp>,\n <mailto:ltp-request@lists.linux.it?subject=subscribe>",
        "Content-Type": "text/plain; charset=\"utf-8\"",
        "Content-Transfer-Encoding": "base64",
        "Errors-To": "ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it",
        "Sender": "\"ltp\" <ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it>"
    },
    "content": "From: Andrea Cervesato <andrea.cervesato@suse.com>\n\nAdd agents/ directory with configuration files for automated code review\nassistance. The configuration includes:\n\n- ground-rules.md: Mandatory LTP development rules\n- c-tests.md: C test writing guidelines and examples\n- shell-tests.md: Shell test structure and style guide\n- review.md: Review protocol for AI agents\n- apply-patch.ms: How to download and apply patches before review\n\nAGENTS.md at root provides project overview and links to review protocol.\n\nSigned-off-by: Andrea Cervesato <andrea.cervesato@suse.com>\n---\nChanges in v4:\n- add patches apply section\n- review the entire structure using Claude Code\n- support as many LLM as possible\n- use an imperative language\n- edit/write new tests section\n- Link to v3: https://lore.kernel.org/r/20260217-agents_file-v3-1-fc2e6f97e0a7@suse.com\n\nChanges in v3:\n- review and fix the agents review configuration\n- Link to v2: https://lore.kernel.org/r/20260216-agents_file-v2-1-b6afff4195f2@suse.com\n\nChanges in v2:\n- rewrite the entire agents/ structure to reduce the LLM allucination\n  and to focus on reviews only\n- AGENTS.md now is defining basic project usage and it points to the\n  agents/review.md for review requests\n- Link to v1: https://lore.kernel.org/r/20260216-agents_file-v1-1-53ec6a8ecf32@suse.com\n---\n AGENTS.md              | 117 ++++++++++++++++++++++++++++++++++\n agents/apply-patch.md  | 123 +++++++++++++++++++++++++++++++++++\n agents/c-tests.md      | 170 +++++++++++++++++++++++++++++++++++++++++++++++++\n agents/ground-rules.md |  91 ++++++++++++++++++++++++++\n agents/review.md       | 108 +++++++++++++++++++++++++++++++\n agents/shell-tests.md  | 134 ++++++++++++++++++++++++++++++++++++++\n 6 files changed, 743 insertions(+)\n\n\n---\nbase-commit: 4ebee67c1563b7a4282f37bfea1d4325b391d6db\nchange-id: 20260215-agents_file-344bdc3300d0\n\nBest regards,",
    "diff": "diff --git a/AGENTS.md b/AGENTS.md\nnew file mode 100644\nindex 0000000000000000000000000000000000000000..050d1d1f557ab2e68758a70955c5b29b41b700f6\n--- /dev/null\n+++ b/AGENTS.md\n@@ -0,0 +1,117 @@\n+# Linux Test Project (LTP)\n+\n+LTP delivers tests to the open source community that validate the\n+reliability, robustness, and stability of the Linux kernel and related\n+features. Tests are written in C or portable POSIX shell. The project uses\n+GNU Autotools for its build system and follows the Linux kernel coding style.\n+\n+**License**: GPL-2.0-or-later (`SPDX-License-Identifier: GPL-2.0-or-later`)\n+\n+## Technology Stack\n+\n+- **Languages**: C (primary), portable POSIX shell\n+- **Build system**: GNU Autotools (autoconf, automake, make)\n+- **Compiler**: gcc (clang also supported in CI)\n+- **Coding style**: Linux kernel coding style\n+- **Test runner**: kirk (replacing legacy `runltp`)\n+- **Documentation**: reStructuredText + Sphinx\n+\n+## Project Structure\n+\n+- `testcases/` — All test binaries (C and shell)\n+  - `testcases/kernel/syscalls/` — Syscall and libc wrapper tests\n+  - `testcases/open_posix_testsuite/` — Open POSIX testsuite fork\n+  - `testcases/lib/` — Shell test library and shell loader\n+- `include/` — LTP library headers (`tst_test.h` is the main API)\n+  - `include/lapi/` — Fallback kernel API definitions for older systems\n+  - `include/mk/` — Build system include files\n+- `lib/` — LTP C library source (`tst_*.c` files)\n+  - `lib/newlib_tests/` — LTP library self-tests\n+- `runtest/` — Runtest files defining test suites (e.g. `syscalls`, `mm`)\n+- `scenario_groups/` — Default sets of runtest files\n+- `doc/` — Sphinx documentation (RST format)\n+- `scripts/` — Helper scripts\n+- `ci/` — CI dependency installation scripts\n+- `.github/workflows/` — GitHub Actions CI workflows\n+- `tools/` — Release and maintenance tools\n+- `agents/` — AI agent configuration files\n+\n+## Environment Setup\n+\n+### Prerequisites\n+\n+- git\n+- autoconf, automake, m4\n+- make\n+- gcc\n+- pkgconf / pkg-config\n+- libc headers\n+- linux headers\n+\n+### Download Source\n+\n+```sh\n+git clone --recurse-submodules https://github.com/linux-test-project/ltp.git\n+cd ltp\n+```\n+\n+### Build from Source\n+\n+```sh\n+make autotools\n+./configure\n+make\n+```\n+\n+### Install (default prefix: /opt/ltp)\n+\n+```sh\n+make install\n+```\n+\n+## Agent Instructions\n+\n+All agent configuration files are in the `agents/` directory.\n+\n+### Task: Patch Review\n+\n+**Trigger**: User requests a review of a patch, commit, branch, PR, or patchwork/lore URL.\n+\n+**Action**: Load `agents/review.md` and follow its instructions.\n+\n+### Task: Write or Modify C Tests\n+\n+**Trigger**: User asks to write, fix, or modify a C test.\n+\n+**Action**: Load `agents/c-tests.md` and `agents/ground-rules.md` before writing code.\n+\n+### Task: Write or Modify Shell Tests\n+\n+**Trigger**: User asks to write, fix, or modify a shell test.\n+\n+**Action**: Load `agents/shell-tests.md` and `agents/ground-rules.md` before writing code.\n+\n+### Task: General Questions\n+\n+**Trigger**: User asks about LTP architecture, APIs, or how to do something.\n+\n+**Action**: Use the project structure and documentation paths below to find answers.\n+\n+## Additional Resources\n+\n+- Documentation: https://linux-test-project.readthedocs.io/\n+- Source code: https://github.com/linux-test-project/ltp\n+- Mailing list: https://lore.kernel.org/ltp/\n+- Patchwork: https://patchwork.ozlabs.org/project/ltp/list/\n+- Kirk (test runner): https://github.com/linux-test-project/kirk\n+- Linux kernel coding style: https://www.kernel.org/doc/html/latest/process/coding-style.html\n+\n+### In-Repository Documentation\n+\n+- Development guide: `doc/developers/`\n+- Maintenance guide: `doc/maintenance/`\n+- User guide: `doc/users/`\n+- C API reference: `doc/developers/api_c_tests.rst`\n+- Shell API reference: `doc/developers/api_shell_tests.rst`\n+- Build system: `doc/developers/build_system.rst`\n+- Test writing tutorial: `doc/developers/test_case_tutorial.rst`\ndiff --git a/agents/apply-patch.md b/agents/apply-patch.md\nnew file mode 100644\nindex 0000000000000000000000000000000000000000..590c94b38ee8fd935bde3d453a4beedf806aad9a\n--- /dev/null\n+++ b/agents/apply-patch.md\n@@ -0,0 +1,123 @@\n+# Downloading and Applying Patches\n+\n+This file provides instructions for downloading and applying patches from\n+various sources. Use the appropriate section based on the input type.\n+\n+## Quick Reference\n+\n+- **Git commit**: No download needed - checkout directly\n+- **Git branch**: No download needed - checkout directly\n+- **Multiple commits**: Cherry-pick the range\n+- **Patchwork URL**: Use b4 or curl + git am\n+- **Lore URL**: Use b4 or curl + git am\n+- **Local patch file**: git am directly\n+- **GitHub PR**: Use gh or git fetch\n+\n+## From Git Commit\n+\n+```sh\n+git checkout -b review/<name> <commit-hash>\n+```\n+\n+## From Git Branch\n+\n+```sh\n+git checkout -b review/<name> <branch-name>\n+```\n+\n+## From Multiple Commits\n+\n+```sh\n+git checkout -b review/<name> master\n+git cherry-pick <start-commit>..<end-commit>\n+```\n+\n+## From Patchwork URL\n+\n+### Option 1: Using b4 (RECOMMENDED)\n+\n+```sh\n+git checkout master && git pull origin master\n+git checkout -b review/<patch-name> master\n+b4 shazam <message-id>\n+```\n+\n+To get the Message-ID: open the Patchwork patch page and find it in the details.\n+\n+### Option 2: Without b4\n+\n+```sh\n+git checkout master && git pull origin master\n+git checkout -b review/<patch-name> master\n+curl -sL \"https://patchwork.ozlabs.org/patch/<id>/mbox/\" -o /tmp/patch.mbox\n+git am /tmp/patch.mbox\n+```\n+\n+## From Lore URL\n+\n+### Option 1: Using b4 (RECOMMENDED)\n+\n+```sh\n+git checkout master && git pull origin master\n+git checkout -b review/<patch-name> master\n+b4 shazam <message-id>\n+```\n+\n+### Option 2: Without b4\n+\n+```sh\n+git checkout master && git pull origin master\n+git checkout -b review/<patch-name> master\n+curl -sL \"https://lore.kernel.org/ltp/<message-id>/raw\" -o /tmp/patch.mbox\n+git am /tmp/patch.mbox\n+```\n+\n+## From Local Patch File\n+\n+```sh\n+git checkout master && git pull origin master\n+git checkout -b review/<patch-name> master\n+git am /path/to/patch.patch\n+```\n+\n+## From GitHub PR\n+\n+### Option 1: Using gh (RECOMMENDED)\n+\n+```sh\n+git checkout master && git pull origin master\n+gh pr checkout <pr-number>\n+```\n+\n+### Option 2: Without gh\n+\n+```sh\n+git checkout master && git pull origin master\n+git fetch origin pull/<pr-number>/head:review/pr-<pr-number>\n+git checkout review/pr-<pr-number>\n+```\n+\n+## Applying a Patch Series\n+\n+For multiple patches in order:\n+\n+```sh\n+git am /tmp/patch1.mbox /tmp/patch2.mbox /tmp/patch3.mbox\n+```\n+\n+Or concatenate:\n+\n+```sh\n+cat /tmp/patch*.mbox | git am\n+```\n+\n+## b4 Command Reference\n+\n+- `b4 shazam <msgid>`: Download and apply patches directly\n+- `b4 am <msgid>`: Download patches as mbox (does not apply)\n+- `b4 am -o . <msgid>`: Save mbox to current directory\n+\n+**Options:**\n+\n+- `-o <dir>`: Save mbox to specific directory\n+- `-m <file>`: Use local mbox file instead of fetching\ndiff --git a/agents/c-tests.md b/agents/c-tests.md\nnew file mode 100644\nindex 0000000000000000000000000000000000000000..db4d8ef9a2810b61102496c7d5fb0412c3ded88c\n--- /dev/null\n+++ b/agents/c-tests.md\n@@ -0,0 +1,170 @@\n+# C Test Rules\n+\n+This file contains MANDATORY rules for C tests. Load this file when reviewing\n+or writing any patch that modifies `*.c` or `*.h` files.\n+\n+## Required Test Structure\n+\n+Every C test MUST follow this structure:\n+\n+```c\n+// SPDX-License-Identifier: GPL-2.0-or-later\n+/*\n+ * Copyright (c) YYYY Author Name <email@example.org>\n+ */\n+\n+/*\\\n+ * High-level RST-formatted test description goes here.\n+ * Explain _what_ is being tested (exported to docs).\n+ *\n+ * The following part is OPTIONAL:\n+ * [Algorithm]\n+ *\n+ * Explaination of how algorithm in the test works in a list (-) syntax.\n+ */\n+\n+#include \"tst_test.h\"\n+\n+static void run(void)\n+{\n+    tst_res(TPASS, \"Test passed\");\n+}\n+\n+static struct tst_test test = {\n+    .test_all = run,\n+};\n+```\n+\n+## Checklist\n+\n+When reviewing or writing C tests, verify ALL of the following:\n+\n+### 1. Coding Style\n+\n+- Code MUST follow Linux kernel coding style\n+- `make check` or `make check-$TCID` MUST pass (uses vendored `checkpatch.pl`)\n+\n+### 2. API Usage\n+\n+- MUST use new API (`tst_test.h`), NOT old API (`test.h`)\n+- MUST NOT define `main()` (unless `TST_NO_DEFAULT_MAIN` is used)\n+- MUST use `struct tst_test` for configuration\n+- Handlers MUST be thin; logic goes in `.setup` and `.cleanup` callbacks\n+\n+### 3. Syscall Usage\n+\n+- Syscall usage MUST match man pages and kernel code\n+\n+### 4. File Organization\n+\n+- New test binary MUST be added to corresponding `.gitignore`\n+- Datafiles go in `datafiles/` subdirectory (installed to `testcases/data/$TCID`)\n+- Syscall tests go under `testcases/kernel/syscalls/`\n+- Entry MUST exist in appropriate `runtest/` file\n+- Sub-executables MUST use `$TESTNAME_` prefix\n+- MUST use `.needs_tmpdir = 1` for temp files (work in current directory)\n+\n+### 5. Result Reporting\n+\n+- MUST use `tst_res()` for results: `TPASS`, `TFAIL`, `TCONF`, `TBROK`, `TINFO`\n+- MUST use `tst_brk()` for fatal errors that abort the test\n+- MUST use `TEST()` macro to capture return value (`TST_RET`) and errno (`TST_ERR`)\n+- MUST return `TCONF` (not `TFAIL`) when feature is unavailable\n+\n+### 6. Safe Macros\n+\n+- MUST use `SAFE_*` macros for system calls that must not fail\n+- Safe macros are defined in `include/` directory\n+\n+### 7. Kernel Version Handling\n+\n+- MUST use `.min_kver` for kernel version gating\n+- MUST prefer runtime checks over compile-time checks\n+\n+### 8. Tagging\n+\n+- Regression tests MUST include `.tags` in `struct tst_test`\n+\n+### 9. Cleanup\n+\n+- Cleanup MUST run on ALL exit paths\n+- MUST unmount, restore sysctls, delete temp files, kill processes\n+\n+### 10. Static Variables\n+\n+- Static variables MUST be initialized before use in test logic (for `-i` option)\n+- Static allocated variables MUST be released in cleanup if allocated in setup\n+\n+### 11. Memory Allocation\n+\n+- Memory MUST be correctly deallocated\n+- EXCEPTION: If `.bufs` is used, ignore check for memory allocated with it\n+\n+### 12. String Handling\n+\n+- MUST use `snprintf()` when combining strings\n+\n+### 13. Deprecated Features\n+\n+- MUST NOT define `[Description]` in the test description section\n+\n+## Code Examples\n+\n+### CORRECT: New API\n+\n+```c\n+#include <stdlib.h>\n+#include \"tst_test.h\"\n+\n+static int fd;\n+\n+static void setup(void)\n+{\n+    fd = SAFE_OPEN(\"test_file\", O_RDWR | O_CREAT, 0644);\n+}\n+\n+static void cleanup(void)\n+{\n+    if (fd > 0)\n+        SAFE_CLOSE(fd);\n+}\n+\n+static void run(void)\n+{\n+    SAFE_WRITE(SAFE_WRITE_ALL, fd, \"a\", 1);\n+    tst_res(TPASS, \"write() succeeded\");\n+}\n+\n+static struct tst_test test = {\n+    .test_all = run,\n+    .setup = setup,\n+    .cleanup = cleanup,\n+    .needs_tmpdir = 1,\n+    .needs_root = 1,\n+};\n+\n+```\n+\n+### INCORRECT: Legacy/Unsafe\n+\n+```c\n+/* WRONG: old header */\n+#include \"test.h\"\n+\n+/* WRONG: defining main */\n+int main(void)\n+{\n+    /* WRONG: unsafe call, hardcoded path */\n+    int fd = open(\"/tmp/file\", O_RDWR);\n+\n+    if (fd < 0) {\n+        /* WRONG: use tst_res or SAFE macro */\n+        perror(\"open\");\n+        exit(1);\n+    }\n+\n+    /* WRONG: old print function */\n+    tst_resm(TPASS, \"test passed\");\n+    tst_exit();\n+}\n+```\ndiff --git a/agents/ground-rules.md b/agents/ground-rules.md\nnew file mode 100644\nindex 0000000000000000000000000000000000000000..9c53f1a5289a6b61a879164bc309ac10177b807a\n--- /dev/null\n+++ b/agents/ground-rules.md\n@@ -0,0 +1,91 @@\n+# Ground Rules\n+\n+These rules are **MANDATORY** and must **NEVER** be violated when writing or\n+reviewing LTP code. Violations MUST be flagged in reviews.\n+\n+## Rule 1: No Kernel Bug Workarounds\n+\n+Code MUST NOT work around known kernel bugs.\n+\n+NEVER work around a kernel bug in LTP test code. Workarounds mask failures for\n+everyone else. If a test fails because a fix was not backported, that is the\n+expected (correct) result.\n+\n+## Rule 2: No Sleep-Based Synchronization\n+\n+Code MUST NOT use `sleep()`/`nanosleep()` for synchronization.\n+\n+NEVER use sleep to synchronize between processes. It causes rare flaky failures,\n+wastes CI time, and breaks under load.\n+\n+**Use instead:**\n+\n+- Parent waits for child to finish → `waitpid()` / `SAFE_WAITPID()`\n+- Child must reach code point before parent continues → `TST_CHECKPOINT_WAIT()` / `TST_CHECKPOINT_WAKE()`\n+- Child must be sleeping in a syscall → `TST_PROCESS_STATE_WAIT()`\n+- Async or deferred kernel actions → Exponential-backoff polling loop\n+\n+## Rule 3: Runtime Feature Detection Only\n+\n+Code MUST use runtime checks, NOT compile-time assumptions.\n+\n+Compile-time checks (`configure.ac`) may ONLY enable fallback API definitions\n+in `include/lapi/`. NEVER assume compile-time results reflect the running kernel.\n+\n+**Runtime detection methods:**\n+\n+- errno checks (`ENOSYS` / `EINVAL`)\n+- `.min_kver` in test struct\n+- `.needs_kconfigs` in test struct\n+- Kernel `.config` parsing\n+\n+## Rule 4: Minimize Root Usage\n+\n+Tests MUST NOT require root unless absolutely necessary.\n+\n+If root is required, the reason MUST be documented in the test's doc comment.\n+Drop privileges for sections that do not need them.\n+\n+## Rule 5: Always Clean Up\n+\n+Tests MUST clean up on ALL exit paths (success, failure, early exit).\n+\n+Every test MUST leave the system exactly as it found it:\n+\n+- Filesystems → Unmount\n+- Sysctls, `/proc`/`/sys` values → Restore\n+- Temp files/dirs → Delete\n+- Spawned processes → Kill\n+- Cgroups/namespaces → Remove\n+- Loop devices → Detach\n+- Ulimits → Restore\n+\n+**Prefer library helpers:** `.needs_tmpdir`, `.save_restore`, `.needs_device`,\n+`.restore_wallclock`, `.needs_cgroup_ctrls`\n+\n+## Rule 6: Write Portable Code\n+\n+- MUST NOT use nonstandard libc APIs when portable equivalent exists\n+- MUST NOT assume 64-bit, page size, endianness, or tool versions\n+- Architecture-specific tests MUST still compile everywhere (use `.supported_archs`)\n+- Shell tests MUST be portable POSIX shell (no bash-isms)\n+\n+Verify with `make check`.\n+\n+## Rule 7: One Logical Change Per Patch\n+\n+- Each patch MUST contain exactly ONE logical change\n+- Each patch MUST compile successfully on its own\n+- Each patch MUST keep all tests and tooling functional\n+- Each patch MUST NOT introduce intermediate breakage\n+- Commit message MUST clearly explain the change\n+\n+Patches mixing unrelated changes will be delayed or ignored.\n+\n+## Rule 8: Unreleased Kernel Features\n+\n+- Tests for unreleased kernel features MUST use `[STAGING]` subject prefix\n+- Staging tests MUST go into `runtest/staging` only\n+\n+Tests for features not yet in a mainline kernel release will NOT be merged into\n+default test suites until the kernel code is finalized and released.\ndiff --git a/agents/review.md b/agents/review.md\nnew file mode 100644\nindex 0000000000000000000000000000000000000000..a1b427e071ef2a72cfabcb2caf4e18c511879e78\n--- /dev/null\n+++ b/agents/review.md\n@@ -0,0 +1,108 @@\n+# LTP Patch Review Protocol\n+\n+You are an agent that performs a deep regression analysis on patches for the\n+LTP - Linux Test Project.\n+\n+## Supported Review Inputs\n+\n+- **Git commit**: `abc1234` or `HEAD~1`\n+- **Git branch**: `feature-branch`\n+- **Multiple commits**: `abc1234..def5678` or `HEAD~3..HEAD`\n+- **Patchwork URL**: `https://patchwork.ozlabs.org/patch/...`\n+- **Lore URL**: `https://lore.kernel.org/ltp/...`\n+- **Local patch file**: `./0001-fix-something.patch`\n+- **GitHub PR**: `https://github.com/linux-test-project/ltp/pull/123`\n+\n+## Step 1: Load Core Files (MANDATORY)\n+\n+Before starting ANY review, MUST load BOTH files in this order:\n+\n+1. `agents/apply-patch.md` — Patch download and application instructions\n+2. `agents/ground-rules.md` — Mandatory rules for all LTP code\n+\n+Do NOT proceed until both files have been read.\n+\n+## Step 2: Identify Patch Type\n+\n+Examine the changed files and classify the patch:\n+\n+- `*.c`, `*.h` files → **C test** → Load `agents/c-tests.md`\n+- `*.sh` files → **Shell test** → Load `agents/shell-tests.md`\n+- `Makefile*`, `configure.ac`, `*.mk` → **Build system** → No additional file\n+- `*.rst`, `*.md`, `doc/**` → **Documentation** → No additional file\n+- `.gitignore`, `.github/**` → **Repository config** → No additional file\n+- Mixed C + Shell → Load BOTH `agents/c-tests.md` AND `agents/shell-tests.md`\n+\n+## Step 3: Review Commit Messages\n+\n+For EVERY commit (except those containing `--- b4-submit-tracking ---`):\n+\n+- MUST have `Signed-off-by:` tag\n+- MUST be clear and follow kernel commit style\n+- MUST use `[STAGING]` prefix if targeting unreleased kernel features\n+- MUST have `Fixes: <hash>` if fixing an LTP commit\n+- MUST have `Fixes: #N` if fixing GitHub issue N\n+\n+## Step 4: Run Type-Specific Checks\n+\n+### For C Tests\n+\n+MUST verify ALL of the following:\n+\n+1. Patch applies cleanly to latest master\n+2. Code compiles without errors: `make -C <test-dir>`\n+3. Test runs with `-i 0` without failures\n+4. Test runs with `-i 10` without failures\n+5. Test runs with `-i 100` without failures\n+\n+**Timeout rule**: If any step takes longer than 60 seconds, STOP and mark\n+that step as `UNKNOWN` in the review output.\n+\n+**On failure**: If compilation or test fails, STOP and report the error.\n+Do NOT attempt to fix the code unless explicitly asked.\n+\n+### For Shell Tests\n+\n+MUST verify ALL of the following:\n+\n+1. Patch applies cleanly to latest master\n+2. `make check` emits no warnings for the test\n+3. All rules from `agents/shell-tests.md` are satisfied\n+\n+### For Build System / Documentation / Config\n+\n+MUST verify:\n+\n+1. Patch applies cleanly to latest master\n+2. Changes are consistent with existing patterns\n+3. No unrelated changes included\n+\n+## Step 5: Output Review Verdict\n+\n+End EVERY review with this exact format:\n+\n+```\n+### Summary\n+\n+- Signed-off-by: ✅ / ❌\n+- Commit message: ✅ / ❌\n+- Applies cleanly: ✅ / ❌ / N/A\n+- Compiles: ✅ / ❌ / N/A\n+- Tests pass (-i 0): ✅ / ❌ / UNKNOWN / N/A\n+- Tests pass (-i 10): ✅ / ❌ / UNKNOWN / N/A\n+- Tests pass (-i 100): ✅ / ❌ / UNKNOWN / N/A\n+\n+### Verdict\n+\n+**Approved** ✅ / **Needs revision** ❌ / **Needs discussion** ⚠️\n+\n+<explanation>\n+```\n+\n+## Error Handling\n+\n+- If a file fails to load → STOP and report the error\n+- If a patch does not apply → Report as \"Applies cleanly: ❌\" and STOP\n+- If the build fails → Report as \"Compiles: ❌\" and include the error message\n+- If tests fail → Report which iteration failed and include the failure output\n+- If uncertain about a rule → Flag it as \"Needs discussion\" in the verdict\ndiff --git a/agents/shell-tests.md b/agents/shell-tests.md\nnew file mode 100644\nindex 0000000000000000000000000000000000000000..5f95e36a0bba5cf23ae72fa31fca9cd5d3e0f826\n--- /dev/null\n+++ b/agents/shell-tests.md\n@@ -0,0 +1,134 @@\n+# Shell Test Rules\n+\n+This file contains MANDATORY rules for shell tests. Load this file when\n+reviewing or writing any patch that modifies `*.sh` files.\n+\n+## Required Test Structure\n+\n+Every shell test MUST follow this exact structure, in this exact order.\n+Omitting or reordering blocks will break the shell loader.\n+\n+```sh\n+#!/bin/sh\n+# SPDX-License-Identifier: GPL-2.0-or-later\n+# Copyright (c) YYYY Author Name <email@example.org>\n+# ---\n+# doc\n+# Brief RST description of what the test verifies.\n+#\n+# Additional detail if needed (exported to generated docs).\n+# ---\n+# ---\n+# env\n+# {\n+#  \"needs_root\": true,\n+#  \"needs_tmpdir\": true\n+# }\n+# ---\n+\n+TST_SETUP=setup\n+TST_CLEANUP=cleanup\n+\n+. tst_loader.sh\n+\n+setup()\n+{\n+    tst_res TINFO \"setup executed\"\n+}\n+\n+cleanup()\n+{\n+    tst_res TINFO \"cleanup executed\"\n+}\n+\n+tst_test()\n+{\n+    tst_res TPASS \"Test passed\"\n+}\n+\n+. tst_run.sh\n+```\n+\n+## Structure Checklist\n+\n+When reviewing or writing shell tests, verify ALL of the following:\n+\n+### Block 1: Shebang + License + Copyright\n+\n+- Shebang MUST be exactly `#!/bin/sh`\n+- License MUST be `GPL-2.0-or-later`\n+- Copyright line MUST be present with year and author\n+\n+### Block 2: Doc Block\n+\n+- `# --- doc` block MUST be present\n+- MUST contain RST-formatted description of WHAT is tested\n+- Will be exported to online test catalog\n+\n+### Block 3: Env Block\n+\n+- `# --- env` block MUST be present (even if empty: `{}`)\n+- MUST contain JSON serialization of `struct tst_test` fields\n+- Valid keys: `\"needs_root\"`, `\"needs_tmpdir\"`, `\"needs_kconfigs\"`, `\"tags\"`, etc.\n+\n+### Block 4: Variable Assignments\n+\n+- `TST_SETUP` and `TST_CLEANUP` MUST be set BEFORE sourcing `tst_loader.sh`\n+- These are optional but if used, MUST be set here\n+\n+### Block 5: Source Loader\n+\n+- `. tst_loader.sh` MUST come AFTER variable assignments\n+- `. tst_loader.sh` MUST come BEFORE function definitions\n+\n+### Block 6: Function Definitions\n+\n+- `setup()` and `cleanup()` MUST be defined AFTER loader is sourced\n+- Function names MUST match variables set in Block 4\n+\n+### Block 7: Test Function\n+\n+- `tst_test()` function MUST contain actual test logic\n+- MUST use `tst_res` and `tst_brk` for reporting\n+\n+### Block 8: Source Runner\n+\n+- `. tst_run.sh` MUST be the LAST line of the file\n+- NOTHING may come after this line\n+\n+## Coding Style Checklist\n+\n+- MUST be portable POSIX shell only (no bash-isms)\n+- MUST NOT use `[[ ]]` (use `[ ]` instead)\n+- MUST NOT use arrays\n+- MUST NOT use `function` keyword\n+- MUST NOT use process substitution\n+- MUST work with `dash`\n+- Lines SHOULD be under 80 characters\n+- MUST use tabs for indentation\n+- All variable expansions MUST be quoted\n+- SHOULD avoid unnecessary subshells\n+- Functions MUST NOT be named after common shell commands\n+\n+**Allowed exceptions:**\n+\n+- `local` keyword inside functions\n+- `-o` and `-a` test operators\n+\n+## Env Block Reference\n+\n+- `\"needs_root\"` (bool): Test requires root privileges\n+- `\"needs_tmpdir\"` (bool): Test needs a temporary directory\n+- `\"needs_kconfigs\"` (array): Required kernel configs, e.g. `[\"CONFIG_NUMA=y\"]`\n+- `\"tags\"` (object): Git tags, e.g. `{\"linux-git\": \"<hash>\"}`\n+- `\"min_kver\"` (string): Minimum kernel version\n+\n+## Running Shell Tests from Source Tree\n+\n+```sh\n+# From the test's directory (adjust ../ depth as needed)\n+PATH=$PATH:$PWD:$PWD/../../lib/ ./foo01.sh\n+```\n+\n+The path must reach `testcases/lib/` where `tst_loader.sh`, `tst_run.sh`, and\n+`tst_run_shell` binary reside.\n",
    "prefixes": [
        "v4"
    ]
}