mirror of
https://github.com/openwrt/packages.git
synced 2026-11-28 23:03:27 +04:00
CONTRIBUTING: explain the AI policy in more detail
The AI policy in CONTRIBUTING.md is short on purpose, but its review left open questions: how to disclose LLM use, whether a tool may add Signed-off-by, how LLM-assisted changes are tested and how the project's own review bot fits in. Answer them in a new AI_POLICY.md, linked from the policy section, and summarize the rules for coding agents in AGENTS.md. The short policy also says that untested pull requests opened in bulk are closed, and the PR template asks what the LLM was used for. Two general rules are added as well. OpenWrt integration files such as the init script and the UCI config live in files/ and are not installed from the upstream archive, so that they are reviewed here and can be fixed with a PKG_RELEASE bump. Explanations stay in proportion to the change. Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
This commit is contained in:
1 parent
c837db774d
commit
b72ddf2f67
4 files changed
+180
-4
No files matched your search
@@ -23,13 +23,13 @@
|
||||
- [ ] I have reviewed the [contributing guidelines](https://github.com/openwrt/packages/blob/master/CONTRIBUTING.md).
|
||||
- [ ] I have reviewed the [AI policy](https://github.com/openwrt/packages/blob/master/CONTRIBUTING.md#ai-policy).
|
||||
- [ ] I have used AI or LLM in my pull request, description, or commit
|
||||
messages.
|
||||
messages, and the description says what it was used for.
|
||||
|
||||
### If your PR contains a patch:
|
||||
|
||||
- [ ] It can be applied using `git am`
|
||||
- [ ] It has been refreshed to avoid offsets, fuzzes, etc.
|
||||
<!-- You can do this using: make package/<your-package>/refresh V=s -->
|
||||
<!-- You can do this using: make package/<your-package>/{clean,prepare} QUILT=1 V=s and then make package/<your-package>/refresh V=s -->
|
||||
- [ ] It is structured in a way that it is potentially upstreamable
|
||||
<!-- This relates to the header, subject, commit description, etc. -->
|
||||
<!-- We must try to upstream patches to reduce maintenance burden. -->
|
||||
@@ -0,0 +1,36 @@
|
||||
# Instructions for coding agents
|
||||
|
||||
This file summarizes rules from [CONTRIBUTING.md](CONTRIBUTING.md) and
|
||||
[AI_POLICY.md](AI_POLICY.md). Those files are the source of truth. Read them
|
||||
before you change anything.
|
||||
|
||||
- Never add a `Signed-off-by` tag, in commits or in patch files. The human
|
||||
adds it.
|
||||
- Never push, open a pull request or post a comment unless the human has read
|
||||
and approved it first.
|
||||
- Never write a comment on an issue or pull request for the human. The human
|
||||
writes comments. You may edit, shorten or translate one the human wrote.
|
||||
- Remind the human to say in the pull request what the LLM was used for. Do
|
||||
not add `Co-authored-by:` or other trailers that name a tool, and do not add
|
||||
links to the chat or agent session.
|
||||
- Keep commit messages, pull request and issue descriptions short and in
|
||||
proportion to the change: what changes and why. No diff summaries, no long
|
||||
logs.
|
||||
- Keep comments to a reasonable level. Do not overexplain, add comments to or
|
||||
remove comments from unrelated parts of the codebase.
|
||||
- Prefix the commit subject with the package name, for example
|
||||
`foopkg: add libzot dependency`.
|
||||
- Keep the init script, the UCI config and other OpenWrt integration files in
|
||||
`files/` next to the Makefile. Never install them from the upstream source
|
||||
archive, unless the OpenWrt project hosts that upstream.
|
||||
- Give every patch you add or change in `<package>/patches/` a `git am`
|
||||
compatible header and a description that says where it stands upstream.
|
||||
Suggest sending the fix upstream where possible.
|
||||
- Generate and update patches with
|
||||
`make package/<name>/{clean,prepare} QUILT=1` followed by
|
||||
`make package/<name>/refresh`, never by hand.
|
||||
- Build the package and run it on a device or in QEMU before the human
|
||||
submits it. Report where it was tested, and never claim a test that did not
|
||||
run.
|
||||
- Never open pull requests in bulk without a build, a runtime test and
|
||||
follow-up by the human for each one.
|
||||
+111
@@ -0,0 +1,111 @@
|
||||
# AI policy
|
||||
|
||||
This file expands on the short [AI policy](CONTRIBUTING.md#ai-policy) from the
|
||||
Contributing Guidelines. If these two disagree, the short one applies and this
|
||||
one needs to be updated.
|
||||
|
||||
## Scope
|
||||
|
||||
This policy applies to all code contributions, alongside issues and pull
|
||||
requests surrounding this codebase. This includes:
|
||||
|
||||
- Issue and PR descriptions
|
||||
- Issue and PR comments
|
||||
- Code review comments
|
||||
- Commit messages
|
||||
|
||||
## Permitted usage
|
||||
|
||||
- Writing or changing code, patches and tests with an LLM, as long as you
|
||||
understand every line and can explain it in review.
|
||||
- Letting an LLM draft a commit message, pull request description or issue
|
||||
description, as long as you review it, cut it down and disclose it.
|
||||
- Editing, shortening or translating a comment you wrote yourself.
|
||||
- Asking an LLM to review your own change before you submit it. If you fix
|
||||
what it finds yourself, nothing from the review ends up in your pull request,
|
||||
so the review needs no disclosure. If you take code or text it wrote,
|
||||
disclose it.
|
||||
|
||||
## Forbidden usage
|
||||
|
||||
- Comments in discussions that an LLM wrote for you. You write your comments.
|
||||
- Pull requests, pushes or comments that a tool publishes without you reading
|
||||
and approving each one first. This is what we mean by autonomous agents.
|
||||
- Posting an LLM review of someone else's pull request from your account.
|
||||
- Opening pull requests in bulk from a tool's output, such as version bumps
|
||||
for a list of packages, without building, testing and following up on each
|
||||
one.
|
||||
- Hiding or understating how much an LLM was involved.
|
||||
|
||||
## Disclosure
|
||||
|
||||
Tick the checkbox in the pull request template and say in the description
|
||||
what the LLM was used for. For example: "The patch and the commit message were
|
||||
drafted with an LLM. I reviewed both and tested them on my router." You do not
|
||||
need to name the tool or model. In an issue, say it in the issue description.
|
||||
What matters is that reviewers can tell at a glance where and how AI was
|
||||
involved in your contribution.
|
||||
|
||||
> [!IMPORTANT]
|
||||
> Do not add `Co-authored-by:` or other trailers that name a tool, and do not
|
||||
> link to the chat or agent session. A trailer lists the tool as an author
|
||||
> but says nothing about how it was used. A session link usually works only
|
||||
> for you. The `Co-authored-by:` that GitHub adds when you commit a
|
||||
> suggestion from the review bot is fine.
|
||||
|
||||
## Signed-off-by
|
||||
|
||||
Only you add your `Signed-off-by`, never a tool. With it you certify the
|
||||
[Developer Certificate of Origin](https://openwrt.org/submitting-patches#sign_your_work)
|
||||
for the whole change, including the parts an LLM wrote. That includes making
|
||||
sure no code was copied from a source under an incompatible license. The
|
||||
other [commit rules](CONTRIBUTING.md#commits-in-your-pull-requests-should)
|
||||
still apply.
|
||||
|
||||
## Patches
|
||||
|
||||
A patch to the packaged software follows the
|
||||
[patch rules](CONTRIBUTING.md#patches): a `git am` compatible header, a
|
||||
description with your `Signed-off-by`, and a note on where it stands upstream.
|
||||
Send an LLM-written fix upstream where you can, so that the people who know
|
||||
that code review it, and link the upstream pull request or issue in the patch.
|
||||
|
||||
## Testing
|
||||
|
||||
An LLM-assisted change needs the same testing as any other change. Build the
|
||||
package and run it on a device or in a VM, for example x86/64 or armsr/armv8
|
||||
in QEMU. Say in the pull request where and how you tested. Never claim a test
|
||||
you did not run.
|
||||
|
||||
A version bump is a change like any other. Read the upstream changelog for
|
||||
anything that affects OpenWrt, then build and run the new version.
|
||||
|
||||
## Keep it short
|
||||
|
||||
Commit messages and pull request descriptions say what changes and why. Issue
|
||||
descriptions say what is wrong or what you propose, and why. Leave out
|
||||
summaries of the diff, long test logs and filler. Match the length to the
|
||||
change: a one-line fix needs a few sentences, not a page. A reviewer should be
|
||||
able to read the description in a minute.
|
||||
|
||||
For a larger effort, agree on the direction in an issue before you open a
|
||||
series of pull requests, and keep that issue to a short list of open points
|
||||
with only the links a reader needs.
|
||||
|
||||
## Review bot
|
||||
|
||||
The project's own review bot (currently the
|
||||
[openwrt-ai](https://github.com/openwrt-ai) account) posts automated reviews
|
||||
on pull requests. Its comments are advisory, and maintainers decide which of
|
||||
them need to be addressed. The rules above apply to contributors, not to this
|
||||
bot.
|
||||
|
||||
## Enforcement
|
||||
|
||||
> [!WARNING]
|
||||
> If we suspect undisclosed AI usage in a contribution, we will ask for
|
||||
> disclosure. If you refuse to provide one, we will reject the contribution, and
|
||||
> close your PR or issue.
|
||||
|
||||
We may hide or remove comments that break these rules. The rules apply to
|
||||
maintainers' contributions too.
|
||||
+31
-2
@@ -27,13 +27,18 @@ prompts given to the automated LLM reviewer.
|
||||
|
||||
## AI policy
|
||||
|
||||
This is the short version. [AI_POLICY.md](AI_POLICY.md) explains how to
|
||||
disclose, what your `Signed-off-by` covers, how to test and how the review bot
|
||||
fits in.
|
||||
|
||||
> [!WARNING]
|
||||
> You **must** disclose any LLM usage in your pull request, description or
|
||||
> commit messages.
|
||||
|
||||
We support the use of LLMs for coding, but we hold a high bar for all
|
||||
contributions, and we expect a human in the loop who genuinely understands the
|
||||
work an LLM produces on their behalf.
|
||||
work an LLM produces on their behalf. You add your `Signed-off-by` yourself,
|
||||
never a tool, and it covers the parts an LLM wrote.
|
||||
|
||||
> [!IMPORTANT]
|
||||
> Don't rely on LLMs to write the whole thing for you when communicating with
|
||||
@@ -41,7 +46,9 @@ work an LLM produces on their behalf.
|
||||
|
||||
We expect comments on our projects to be written by humans. The readers are
|
||||
humans, and we'd like to hear from you, not from a model. We may hide or remove
|
||||
any comments that we believe are LLM-generated.
|
||||
any comments that we believe are LLM-generated. Commit messages and pull
|
||||
request and issue descriptions are different: an LLM may draft them, and you
|
||||
disclose that as described above.
|
||||
|
||||
If you're using an LLM to edit or – as a non-native English speaker – to
|
||||
translate your comments, keep them short, review before posting, and make sure
|
||||
@@ -51,6 +58,7 @@ they say what you mean.
|
||||
> Do not use autonomous agents for contributing to our projects.
|
||||
|
||||
We will close any pull requests that we believe were created autonomously.
|
||||
The same goes for untested pull requests opened in bulk.
|
||||
|
||||
## Package Sources (archives and repositories)
|
||||
|
||||
@@ -108,6 +116,24 @@ We will close any pull requests that we believe were created autonomously.
|
||||
- Avoid reuse of <strong>PKG_NAME</strong> in call, define and eval lines to improve
|
||||
readability.
|
||||
|
||||
### OpenWrt integration files
|
||||
|
||||
The files that make a package work on OpenWrt, such as the init script, the
|
||||
default UCI config, uci-defaults and hotplug scripts, and rpcd ACLs, live in
|
||||
`files/` next to the Makefile and are installed from there. Do not install
|
||||
them from the upstream source archive, even when upstream ships them.
|
||||
|
||||
They decide how the software runs on every installation, so they are reviewed
|
||||
here. If they come from the archive, a version bump only shows a new version
|
||||
and hash, and changes to them are never reviewed. Keeping them here also lets
|
||||
us fix them at any time, change many packages in one treewide commit and ship
|
||||
the fix with a `PKG_RELEASE` bump, without waiting for an upstream release.
|
||||
|
||||
Packages whose upstream is hosted by the OpenWrt project, such as usteer, are
|
||||
exempt, because OpenWrt developers can change the files there. Existing
|
||||
packages that install these files from the archive should move them to
|
||||
`files/` when they are next updated.
|
||||
|
||||
### Patches
|
||||
|
||||
Patches live in `<package>/patches/`, are managed with quilt, and are expected
|
||||
@@ -190,6 +216,9 @@ diff, so refreshing an existing patch will not cost you its text.
|
||||
GitHub private email addresses will not be accepted.
|
||||
- Follow all [Submission Guidelines](https://openwrt.org/submitting-patches#submission_guidelines)
|
||||
requirements, including maximum characters per line.
|
||||
- Explain what changes and why, in proportion to the change. A one-line fix
|
||||
needs a few sentences in the commit message and pull request description,
|
||||
not a page.
|
||||
|
||||
## Advice on pull requests
|
||||
|
||||
|
||||
Reference in new issue
Block a user