generated-content.rst 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. ============================================
  2. Kernel Guidelines for Tool-Generated Content
  3. ============================================
  4. Purpose
  5. =======
  6. Kernel contributors have been using tooling to generate contributions
  7. for a long time. These tools can increase the volume of contributions.
  8. At the same time, reviewer and maintainer bandwidth is a scarce
  9. resource. Understanding which portions of a contribution come from
  10. humans versus tools is helpful to maintain those resources and keep
  11. kernel development healthy.
  12. The goal here is to clarify community expectations around tools. This
  13. lets everyone become more productive while also maintaining high
  14. degrees of trust between submitters and reviewers.
  15. Out of Scope
  16. ============
  17. These guidelines do not apply to tools that make trivial tweaks to
  18. preexisting content. Nor do they pertain to tooling that helps with
  19. menial tasks. Some examples:
  20. - Spelling and grammar fix ups, like rephrasing to imperative voice
  21. - Typing aids like identifier completion, common boilerplate or
  22. trivial pattern completion
  23. - Purely mechanical transformations like variable renaming
  24. - Reformatting, like running Lindent, ``clang-format`` or
  25. ``rust-fmt``
  26. Even whenever your tool use is out of scope, you should still always
  27. consider if it would help reviewing your contribution if the reviewer
  28. knows about the tool that you used.
  29. In Scope
  30. ========
  31. These guidelines apply when a meaningful amount of content in a kernel
  32. contribution was not written by a person in the Signed-off-by chain,
  33. but was instead created by a tool.
  34. Detection of a problem and testing the fix for it is also part of the
  35. development process; if a tool was used to find a problem addressed by
  36. a change, that should be noted in the changelog. This not only gives
  37. credit where it is due, it also helps fellow developers find out about
  38. these tools.
  39. Some examples:
  40. - Any tool-suggested fix such as ``checkpatch.pl --fix``
  41. - Coccinelle scripts
  42. - A chatbot generated a new function in your patch to sort list entries.
  43. - A .c file in the patch was originally generated by a coding
  44. assistant but cleaned up by hand.
  45. - The changelog was generated by handing the patch to a generative AI
  46. tool and asking it to write the changelog.
  47. - The changelog was translated from another language.
  48. If in doubt, choose transparency and assume these guidelines apply to
  49. your contribution.
  50. Guidelines
  51. ==========
  52. First, read the Developer's Certificate of Origin:
  53. Documentation/process/submitting-patches.rst. Its rules are simple
  54. and have been in place for a long time. They have covered many
  55. tool-generated contributions. Ensure that you understand your entire
  56. submission and are prepared to respond to review comments.
  57. Second, when making a contribution, be transparent about the origin of
  58. content in cover letters and changelogs. You can be more transparent
  59. by adding information like this:
  60. - What tools were used?
  61. - The input to the tools you used, like the Coccinelle source script.
  62. - If code was largely generated from a single or short set of
  63. prompts, include those prompts. For longer sessions, include a
  64. summary of the prompts and the nature of resulting assistance.
  65. - Which portions of the content were affected by that tool?
  66. - How is the submission tested and what tools were used to test the
  67. fix?
  68. As with all contributions, individual maintainers have discretion to
  69. choose how they handle the contribution. For example, they might:
  70. - Treat it just like any other contribution.
  71. - Reject it outright.
  72. - Treat the contribution specially, for example, asking for extra
  73. testing, reviewing with extra scrutiny, or reviewing at a lower
  74. priority than human-generated content.
  75. - Ask for some other special steps, like asking the contributor to
  76. elaborate on how the tool or model was trained.
  77. - Ask the submitter to explain in more detail about the contribution
  78. so that the maintainer can be assured that the submitter fully
  79. understands how the code works.
  80. - Suggest a better prompt instead of suggesting specific code changes.
  81. If tools permit you to generate a contribution automatically, expect
  82. additional scrutiny in proportion to how much of it was generated.
  83. As with the output of any tooling, the result may be incorrect or
  84. inappropriate. You are expected to understand and to be able to defend
  85. everything you submit. If you are unable to do so, then do not submit
  86. the resulting changes.
  87. If you do so anyway, maintainers are entitled to reject your series
  88. without detailed review.