Reduce LLM code generation noise - #6235
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e9d21bc9d1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
e9d21bc to
4e50501
Compare
|
|
If this prevents all comments added by the LLM, that's too extreme.
So I think it's unfortunately not that simple. It's up to the creator of the PR to self-review and remove/trim redundant comments, and also clarify comments as the LLM can be quite unclear at times. Maybe we can instruct it to avoid adding comments for things that are obvious from the code or are already explained somewhere else (in that latter case, possibly "link" to that explanation)?
|
eregon
left a comment
There was a problem hiding this comment.
Marking it as request changes because I don't think we can merge this as-is.
|
That's fair pushback, but I think the rule already accounts for this. "Unless explicitly requested" covers exactly the cases you're pointing to: a PR author who identifies a struct field, constant, or non-obvious invariant worth documenting can ask for that comment directly, and the agent will write it. "Or instructed" covers cases like the What the rule removes is the LLM's own unprompted judgment about what's "worth explaining." In practice that judgment has been a source of noise, not signal: reviewers end up spending review time triaging and asking for cleanup of comments nobody asked for, many of which just restate the code. Shifting to "ask for the comment you actually want" puts a human in the loop on the one part of this that's genuinely subjective, instead of relying on the LLM to guess well every time. If it turns out this is still trimming too much in practice (e.g. agents interpreting "instructed" too narrowly and not writing the field-level comments you got good value from before), that's a signal to loosen the wording — but I'd rather tighten first and see if review load actually drops, since the status quo before this rule was the noisy one. |
But I did not request the LLM to comment this, it's just part of writing code to document/comment the tricky parts. |
bengl
left a comment
There was a problem hiding this comment.
What the rule removes is the LLM's own unprompted judgment about what's "worth explaining." In practice that judgment has been a source of noise, not signal: reviewers end up spending review time triaging and asking for cleanup of comments nobody asked for, many of which just restate the code.
This is indeed a real problem, but the solution here is way too heavy-handed. It's worth instead instructing the LLMs to be terse and to-the-point, only adding comments where it deems the code to be non-obvious, or where callouts to URLs/docs are necessary.
Otherwise, you're adding unnecessary friction to creating well-commented code.
|
Hey folks 👋 On one hand, my take is pretty much the same as Bryan's and Benoit's. Disabling code comments completely is likely to be harmful for more complex code. On the other hand, I do agree that sometimes Claude is too verbose and duplicate the code in the comment. Sometimes it also generates tests that consist of 99% of mocks, testing nothing. The rule says I think this is too wide and prevents AI from providing helpful comments (the unknown unknowns will be missed by a reviewer). The downside of having AI comments as of today is that they require extra maintenance and can cause confusion when they are badly written. What I would love us generally is to come up with a common core of best practices on code comments. And then we can supply these to AI. Some references for best practices that could be used as a starter: |
|
I want to push back on the framing that this is a close call between two reasonable tradeoffs. The comment noise is a real, ongoing cost — it's happening on PRs right now, to the reviewers who have to read them. The "good comments" being cited against it are a handful of retrospective examples pulled from specific PRs. That's not evidence of a reliable rate of value; it's survivorship bias. It's easy to point at two or three fields in There's also an assumption underneath "it's up to the creator of the PR to self-review and remove/trim redundant comments" — that this self-review reliably happens. In practice it doesn't. People don't go back and prune or tighten LLM-generated comments before asking for review; that's exactly how the noise ends up in front of reviewers in the first place. So the safety net this objection is leaning on isn't actually there today, which is part of why I don't think "just tell the LLM to be terse and use good judgment" fixes anything — that's roughly the standard already in place, and it's what produced the status quo this PR is responding to. I'd rather ship the strict version and revisit if we see clear, recurring evidence of real documentation being lost, than keep relying on a self-review step that isn't happening and a "use good judgment" standard that already isn't working. |
What does this PR do?
Prevent agent from writing code comment
Motivation:
Too much noise.
Change log entry
None.