Repository navigation
docs(agents): add explicit comments policy to AGENTS.md - #3502
Conversation
Adds guidance to keep PR-style narration and diff summaries out of source comments, reserving comments for genuinely unintuitive context the reader cannot infer from the code itself. Closes #3498 Co-authored-by: openhands <openhands@all-hands.dev>
Python API breakage checks — ✅ PASSEDResult: ✅ PASSED |
REST API breakage checks (OpenAPI) — ✅ PASSEDResult: ✅ PASSED |
|
✅ Review complete. This review was performed through OpenHands Cloud Automation. You can log in and view the conversation here. |
all-hands-bot
left a comment
There was a problem hiding this comment.
PR Review: Add comments policy to AGENTS.md
Summary
This PR adds an explicit Comments policy bullet (with four sub-bullets) to the <CODE> section of AGENTS.md, in response to issue #3498. The change is straightforward and addresses the core request directly.
What's good
- Addresses the issue directly: The new policy logically covers all four scenarios flagged in #3498 — restating code, narrating diffs, describing non-local behavior, and the ratio test (3-line change → 19 lines of comments).
- Consistent style: The bullet format and voice match the surrounding
<CODE>section guidelines. - Tone and clarity: The language is direct, actionable, and appropriately prescriptive.
- Documentation-only change: Correctly categorized as
Docs / chore, no tests needed per the contributor checklist.
Minor style suggestion
The main bullet opens with:
Comments policy: write comments sparingly and strategically...
The other bullets in this section do not have an opening narrative line — they jump straight into the sub-bullets. For consistency, consider whether the main bullet should just be the heading and sub-bullets (no sentence following it). Either approach is fine; just ensuring the PR author is intentional about the deviation.
Verdict
Approve. The change is well-scoped, clearly motivated, and the policy content is sound. No further changes required.
This review was generated by an AI agent (OpenHands) on behalf of the user through OpenHands Automation. View conversation
all-hands-bot
left a comment
There was a problem hiding this comment.
✅ QA Report: PASS
The docs-only change was verified by setting up the repo and rendering the affected AGENTS.md guidance before/after; the new comments policy is visible only on the PR head and matches the stated issue.
Does this PR achieve its stated goal?
Yes. The stated goal was to add an explicit comments policy to the root AGENTS.md <CODE> section addressing verbose, redundant, non-local code comments. Baseline rendering of origin/main did not contain the policy terms, while the PR head rendered with Comments policy, genuinely unintuitive, and the 3-line change should not produce 19 lines guidance present.
| Phase | Result |
|---|---|
| Environment Setup | ✅ make build completed successfully; no tests/linters were run locally. |
| CI Status | ⏳ Observed 33 successful, 2 skipped, 1 pending (QA Changes by OpenHands) via gh pr checks. |
| Functional Verification | ✅ Before/after doc rendering confirmed the policy is added and visible. |
Functional Verification
Test 1: Before/after guidance presence in the rendered CODE section
Step 1 — Reproduce / establish baseline without the fix:
Ran a script that extracted AGENTS.md from origin/main, rendered the <CODE> section with markdown-it-py, and checked for the policy phrases:
--- base main ---
CODE section chars: 1331
Markdown rendered HTML chars: 1330
'Comments policy': False
'restate what the code already says': False
'summarize the surrounding diff/PR': False
'non-local parts of the system': False
'genuinely unintuitive': False
'3-line change should not produce 19 lines': False
This establishes the baseline: the root contributor guidance did not yet include the explicit comments policy requested by issue #3498.
Step 2 — Apply the PR's changes:
The local checkout was already on PR head 83dbe2bb6b39eab11a921fe19551c1486af1e170 (openhands/comments-policy-agents-md).
Step 3 — Re-run with the fix in place:
The same script against HEAD:AGENTS.md produced:
--- PR head ---
CODE section chars: 2505
Markdown rendered HTML chars: 2504
'Comments policy': True
'restate what the code already says': True
'summarize the surrounding diff/PR': True
'non-local parts of the system': True
'genuinely unintuitive': True
'3-line change should not produce 19 lines': True
This confirms the PR adds the policy in the intended section and covers the concrete issue themes: redundant comments, PR/blame context, non-local drift, genuinely unintuitive cases, and the 3-line/19-line example.
Test 2: GitHub-rendered Markdown visibility
Step 1 — Reproduce / establish baseline without the fix:
Rendered the base <CODE> section through GitHub's Markdown API:
--- base main GitHub-rendered CODE section ---
GitHub HTML chars: 1356
'Comments policy' visible in rendered output: False
'genuinely unintuitive' visible in rendered output: False
'3-line change should not produce 19 lines' visible in rendered output: False
This confirms a GitHub reader of the base documentation would not see the new policy.
Step 2 — Apply the PR's changes:
Used the same GitHub Markdown API workflow against the PR head content.
Step 3 — Re-run with the fix in place:
--- PR head GitHub-rendered CODE section ---
GitHub HTML chars: 2530
'Comments policy' visible in rendered output: True
'genuinely unintuitive' visible in rendered output: True
'3-line change should not produce 19 lines' visible in rendered output: True
This confirms the new guidance is visible in rendered documentation, which is the user-facing behavior for this docs-only PR.
Issues Found
None.
This QA review was created by an AI agent (OpenHands) on behalf of the requester.
Co-authored-by: openhands <openhands@all-hands.dev>
Why
Issue #3498 calls out that agent-authored PRs (especially on Claude Opus 4.7/4.8 — see the analysis in #3498) often add long, narrative comment blocks that:
The reporter asked specifically for an explicit "comments policy" item in the SDK contributor guidelines, e.g.
AGENTS.md<CODE>section.Summary
<CODE>section of rootAGENTS.md, covering:git blameare for),Issue Number
Closes #3498
How to Test
Documentation-only change. Verified by:
<CODE>section ofAGENTS.mdto confirm the new policy is consistent in tone/structure with the surrounding bullets.uv run pre-commit run --files AGENTS.md— passes (no hooks apply to Markdown files in this repo's pre-commit config, so it correctly skips).No code/runtime behavior changes, so no automated tests were added per the contributor checklist (
You do NOT need to write new tests if there are only changes to documentation or configuration files.).Type
Notes
This PR was created by an AI agent (OpenHands) on behalf of @juanmichelini in response to #3498.
@juanmichelini can click here to continue refining the PR
Agent Server images for this PR
• GHCR package: https://github.com/OpenHands/agent-sdk/pkgs/container/agent-server
Variants & Base Images
eclipse-temurin:17-jdknikolaik/python-nodejs:python3.13-nodejs22-slimgolang:1.21-bookwormPull (multi-arch manifest)
# Each variant is a multi-arch manifest supporting both amd64 and arm64 docker pull ghcr.io/openhands/agent-server:83dbe2b-pythonRun
All tags pushed for this build
About Multi-Architecture Support
83dbe2b-python) is a multi-arch manifest supporting both amd64 and arm6483dbe2b-python-amd64) are also available if needed