Skip to content

docs(agents): Codify recurring review blockers in AGENTS.md - #857

Open
euxaristia wants to merge 3 commits into
Gitlawb:mainfrom
euxaristia:docs/agents-review-blockers
Open

docs(agents): Codify recurring review blockers in AGENTS.md#857
euxaristia wants to merge 3 commits into
Gitlawb:mainfrom
euxaristia:docs/agents-review-blockers

Conversation

@euxaristia

@euxaristia euxaristia commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Summary

Maintainer review threads (especially multi-round ones) keep restating the same defect classes: stale merge bases that roll back mainline work, non-canonical path tests that break macOS/Windows smoke, secrets in argv or unredacted error paths, fail-open ownership checks, partial setup without safe rollback, missing regression tests, and PR claims that do not match what shipped.

This PR adds a short Common Review Blockers section to AGENTS.md so coding agents and contributors address those classes before the first review, without bloating the file (~1.9KB / 32 lines).

Closes #856

Changes

AGENTS.md

  • New section 4 covering:
    • Fresh base / no silent mainline rollbacks
    • Platform-truth path handling (canonical paths, t.TempDir pitfalls)
    • Security edges (argv, redaction of errors, fail closed, symlink/reparse, setup rollback ownership)
    • Atomic shared-state writes
    • Regression tests that match the claim (including failure and non-Linux path cases)
    • Honest scope (wired entry points, no name-only security allowlists)

Test plan

  • Docs-only change; no Go code
  • git diff HEAD --check
  • Skim section 4 for density and accuracy against recent multi-round reviews
  • Confirm agents loading repo AGENTS.md pick up the new section

Summary by CodeRabbit

  • Documentation
    • Added guidance for avoiding common code review blockers, including keeping pull requests current, ensuring cross-platform compatibility, protecting sensitive information, enforcing secure failure behavior, handling rollbacks safely, updating shared data atomically, testing behavioral and security changes, and accurately describing the scope of each change.

Capture the high-frequency classes that drive multi-round maintainer reviews
(stale bases, path canonicalization, secret handling, partial setup, missing
regression tests, scope honesty) so coding agents fix them before first review.

Refs Gitlawb#856
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@euxaristia, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 58 minutes

Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 94b22014-59a5-469d-a091-e53f473ed5de

📥 Commits

Reviewing files that changed from the base of the PR and between 8e26679 and 1bfe6cb.

📒 Files selected for processing (1)
  • AGENTS.md

Walkthrough

AGENTS.md adds a “Common Review Blockers” section. It covers fresh bases, cross-platform paths, security boundaries, atomic shared-state updates, regression tests, and accurate pull-request scope.

Changes

Review Guidance

Layer / File(s) Summary
Common review blockers guidance
AGENTS.md
Adds requirements for rebasing, platform-independent path validation, secret handling, fail-closed security checks, atomic shared-state updates, failure-path and cross-platform regression tests, and accurate pull-request scope.

Estimated code review effort: 1 (Trivial) | ~3 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the documented review-blocker changes in AGENTS.md.
Linked Issues check ✅ Passed The documentation change addresses issue #856 objectives and remains limited to AGENTS.md.
Out of Scope Changes check ✅ Passed The PR contains only the scoped AGENTS.md documentation update and no unrelated changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@AGENTS.md`:
- Around line 91-93: Update the “Atomic shared state” guidance in AGENTS.md to
require writing complete contents to a temporary file and then atomically
replacing the target, rather than treating exclusive creation or locking alone
as atomic replacement. Separately require serialization of the full
read-modify-write sequence for lockfiles and shared stores, while noting that
reader protection depends on atomic replacement.
- Around line 80-87: Update the security guidance in the “Security edges”
section to prohibit relying on pre-open EvalSymlinks containment checks alone,
and require open/use operations that atomically bind containment, such as
no-follow or handle-relative APIs and their platform equivalents for symlinks
and reparse points.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 3bdf64d2-47ca-484e-aabd-3370f7ec8737

📥 Commits

Reviewing files that changed from the base of the PR and between 8e26679 and 2e7b53f.

📒 Files selected for processing (1)
  • AGENTS.md

Comment thread AGENTS.md Outdated
Comment thread AGENTS.md Outdated
Require open-time containment binding instead of pre-open EvalSymlinks, and
require temp-file then atomic replace rather than exclusive create alone.

Refs Gitlawb#856
@euxaristia

Copy link
Copy Markdown
Contributor Author

Addressed both CodeRabbit findings in f19a9a2:

  1. Security edges: Dropped the “resolve then use” wording. Guidance now forbids pre-open EvalSymlinks/containment checks alone and requires binding containment at open/use time (no-follow or handle-relative APIs, plus reparse equivalents).
  2. Atomic shared state: Requires write-complete temp file then atomic replace. Explicitly notes exclusive create / write lock alone does not protect readers. RMW serialization kept as a separate requirement.

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

@euxaristia I will run a full review of PR #857. I will verify the updated security and atomic-write guidance with the complete change set.

✅ Action performed

Full review finished.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@AGENTS.md`:
- Around line 86-89: Clarify the containment guidance to reject
final-component-only no-follow protection as insufficient. Require rooted or
handle-relative, traversal-resistant opening that prevents parent symlink or
Windows reparse-point redirection; if no-follow APIs are used, require them for
every traversed component and account for platform-specific reparse behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: c230ccf2-da8b-4b6a-958a-cef4c331290b

📥 Commits

Reviewing files that changed from the base of the PR and between 2e7b53f and f19a9a2.

📒 Files selected for processing (1)
  • AGENTS.md

Comment thread AGENTS.md Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
AGENTS.md (1)

86-89: ⚠️ Potential issue | 🟠 Major

Require traversal-wide containment for no-follow APIs.

The current wording can permit a final-component-only implementation. On Linux, O_NOFOLLOW does not prevent symlink traversal in earlier path components. Require rooted or handle-relative traversal, or explicitly require no-follow protection for every traversed component and the corresponding Windows reparse-point protections. (man7.org)

Proposed wording
-  Bind containment at open/use time (no-follow or handle-relative APIs, and
-  platform equivalents for reparse points).
+  Bind containment at open/use time with rooted or handle-relative,
+  traversal-resistant APIs. If a no-follow API is used, apply it to every
+  traversed component and enforce the platform's reparse-point protections;
+  final-component-only no-follow is insufficient.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@AGENTS.md` around lines 86 - 89, Update the containment guidance in AGENTS.md
to require protection across the entire path traversal, not only the final
component. Explicitly require rooted or handle-relative traversal, or no-follow
protections for every traversed component, with equivalent Windows reparse-point
safeguards; retain the requirement that containment is enforced at open/use
time.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Duplicate comments:
In `@AGENTS.md`:
- Around line 86-89: Update the containment guidance in AGENTS.md to require
protection across the entire path traversal, not only the final component.
Explicitly require rooted or handle-relative traversal, or no-follow protections
for every traversed component, with equivalent Windows reparse-point safeguards;
retain the requirement that containment is enforced at open/use time.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 1947cf8f-10ec-4024-862d-c919971ef46e

📥 Commits

Reviewing files that changed from the base of the PR and between 8e26679 and f19a9a2.

📒 Files selected for processing (1)
  • AGENTS.md

Final-component-only O_NOFOLLOW is insufficient on Linux and reparse
points need platform protections. Align the Security edges guidance
with the full-path containment requirement from review.
@euxaristia

Copy link
Copy Markdown
Contributor Author

Addressed remaining CodeRabbit finding in 1bfe6cb:

  • Security edges: Containment guidance now requires rooted/handle-relative traversal-resistant APIs, or no-follow on every traversed component with platform reparse protections. Final-component-only no-follow is called out as insufficient.

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- Repository state ---'
git status --short
git branch --show-current
git log -1 --oneline

printf '%s\n' '--- AGENTS.md outline ---'
ast-grep outline AGENTS.md --items all || true

printf '%s\n' '--- Changed files and complete diff from merge base ---'
base="$(git merge-base HEAD origin/main 2>/dev/null || git merge-base HEAD main)"
printf 'Merge base: %s\n' "$base"
git diff --name-status "$base"...HEAD
git diff --no-ext-diff --unified=80 "$base"...HEAD -- AGENTS.md

printf '%s\n' '--- Current Common Review Blockers section with context ---'
rg -n -A80 -B8 '^## Common Review Blockers\b' AGENTS.md

printf '%s\n' '--- Whitespace validation ---'
git diff --check "$base"...HEAD

Length of output: 7545


🏁 Script executed:

#!/bin/bash
set -u

base="$(git merge-base HEAD origin/main 2>/dev/null)"
printf '%s\n' '--- Branch ancestry ---'
if [ -n "${base:-}" ]; then
  printf 'Merge base with origin/main: %s\n' "$base"
  if git merge-base --is-ancestor origin/main HEAD; then
    printf '%s\n' 'HEAD contains origin/main.'
  else
    printf '%s\n' 'HEAD does not contain origin/main.'
  fi
else
  printf '%s\n' 'Could not determine a merge base with origin/main.'
fi

printf '%s\n' '--- Files changed from merge base ---'
if [ -n "${base:-}" ]; then
  git diff --name-only "$base"...HEAD
fi

printf '%s\n' '--- Final Common Review Blockers content ---'
awk '
  /^## 4\. Common Review Blockers$/ { show=1 }
  show { printf "%d:%s\n", NR, $0 }
' AGENTS.md

printf '%s\n' '--- Diff whitespace check ---'
if [ -n "${base:-}" ]; then
  if git diff --check "$base"...HEAD; then
    printf '%s\n' 'git diff --check passed.'
  else
    printf '%s\n' 'git diff --check failed.'
  fi
fi

printf '%s\n' '--- Commit changed-file scope ---'
git show --format='commit %H%n%s' --name-only --no-renames HEAD

Length of output: 4030


@euxaristia Full review completed.

No findings. The containment guidance now correctly rejects final-component-only no-follow protection and requires traversal-wide protection. The PR contains only the intended AGENTS.md change. HEAD contains origin/main, and git diff --check passed.

✅ Action performed

Full review finished.


Your included review limit is currently reached under our Fair Usage Limits Policy. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 58 minutes.

@Vasanthdev2004 Vasanthdev2004 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. This is docs-only, the numbering follows on correctly from §3, and the guidance is accurate — I checked it against real findings rather than just reading it.

Several of these map one-to-one onto things that were live in the review queue this week, which is a good sign the section is describing the actual failure modes rather than generic advice:

  • "A stale head that rolls back mainline commits is a hard blocker, not a merge-time detail" — this was a P0 on my own #808 yesterday, where the branch was 16 commits behind and would have reverted the 0.6.0 release manifest along with 134 other files.
  • "final-component-only no-follow is insufficient" — I pushed a fix for exactly this today (dd3520a6). FILE_FLAG_OPEN_REPARSE_POINT only protects the last component, so os.MkdirAll through a junctioned .git had elevated setup creating objects outside the workspace before the check ever ran.
  • "roll back only what this run created; never destroy pre-existing resources you did not create" and "never report success when cleanup or unlock failed" — both were findings on my sandbox PRs this week, and both were real.
  • "that is a check-to-use race" on EvalSymlinks-then-open is the correct diagnosis and the right remedy.

So this isn't theoretical. Thanks for writing it up — turning a rough review stretch into something that stops the next one is a genuinely useful contribution, and it will save reviewers repeating themselves.

Two small thoughts, neither blocking, take or leave:

The atomic-replace guidance is right on POSIX but worth a Windows caveat — os.Rename over an existing file fails there if any reader holds a handle without FILE_SHARE_DELETE, so "atomically replace" needs a retry or ReplaceFile to actually hold up cross-platform. Given the section explicitly asks for platform truth, that one's a bit self-referential.

"Do not bundle unrelated fixes" is the one I'd expect to cause the most friction in practice, since it's often only visible as unrelated in hindsight. Might be worth a note that splitting is cheap before review and expensive after.

Neither needs changing before merge.

@jatmn jatmn left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@euxaristia please feel free to contribute adapted versions of these to Node and OpenClaude if you would like. This a quite a good concept to help keep things more uniform for all Gitlawb projects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs(agents): codify recurring review blockers in AGENTS.md

3 participants