Skip to content

chore: optimize AI code review configuration (Copilot & CodeRabbit)#938

Merged
k8s-ci-robot merged 3 commits into
kubernetes-sigs:mainfrom
janetkuo:add-coderabbit-config
Jun 5, 2026
Merged

chore: optimize AI code review configuration (Copilot & CodeRabbit)#938
k8s-ci-robot merged 3 commits into
kubernetes-sigs:mainfrom
janetkuo:add-coderabbit-config

Conversation

@janetkuo

@janetkuo janetkuo commented Jun 5, 2026

Copy link
Copy Markdown
Member

What this PR does / why we need it:

The Kubernetes organization recently enabled coderabbitai for AI-assisted code reviews in this repository. This PR establishes a unified configuration strategy to evaluate both GitHub Copilot and CodeRabbit side-by-side, ensuring both tools enforce identical project standards without duplicating markdown rulebooks.

Specifically, this PR:

  • .github/copilot-instructions.md:
    • Strips redundant persona boilerplate and generic review missions.
    • Upgrades Project Context with explicit API groups (agents.x-k8s.io/v1beta1, extensions...), CRD names, and Go module paths borrowed from AGENTS.md.
    • Adds explicit project gotchas for structured logging (logr), error wrapping, Hugo docs site mounts, and Python SDK conventions.
  • .coderabbit.yaml:
    • Adds root configuration to ingest both .github/copilot-instructions.md and AGENTS.md as the shared knowledge base.
    • Configures path_filters to exclude generated code (zz_generated*.go, clients/k8s/**, k8s/crds/**).
    • Establishes granular path_instructions tailored to agent-sandbox's repository layout (CRD API rules, controller-runtime constraints, and Python SDK parity).

Which issue(s) this PR is related to:

NONE

Release Note

NONE

Summary by CodeRabbit

  • Chores

    • Enabled guideline-driven code review configuration and added per-path review rules; excluded generated, vendor, and selected repository areas from automated review scopes.
  • Documentation

    • Consolidated developer guidance into a structured AI code review guidelines document with targeted conventions for Kubernetes CRD controllers, Go client stability, Python client idioms (sync/async parity), controller/RBAC expectations, docs/snippet accuracy, testing/tooling reminders, and updated contribution/CLA instructions.
Copilot AI review requested due to automatic review settings June 5, 2026 01:06
@github-project-automation github-project-automation Bot moved this to Backlog in Agent Sandbox Jun 5, 2026
@netlify

netlify Bot commented Jun 5, 2026

Copy link
Copy Markdown

Deploy Preview for agent-sandbox canceled.

Name Link
🔨 Latest commit 4fc9b46
🔍 Latest deploy log https://app.netlify.com/projects/agent-sandbox/deploys/6a22fe03f0af5b0008ea0cf0
@k8s-ci-robot k8s-ci-robot requested review from barney-s and soltysh June 5, 2026 01:06
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jun 5, 2026
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jun 5, 2026
@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Enables CodeRabbit knowledge-base guidance and path-scoped review rules in .coderabbit.yaml, and replaces .github/copilot-instructions.md with a reorganized AI code-review guidelines document.

Changes

Code Review Workflow & Guidance

Layer / File(s) Summary
CodeRabbit configuration and review automation
.coderabbit.yaml
Enables knowledge_base.code_guidelines pointing at .github/copilot-instructions.md and AGENTS.md; keeps reviews.request_changes_workflow: true; adds reviews.path_filters to exclude clients/k8s/**, k8s/crds/**, generated Go files (*_generated*.go, zz_generated.*.go), and vendor/**; adds reviews.path_instructions for api/**/*.go, extensions/api/**/*.go, controllers/**/*.go, extensions/controllers/**/*.go, clients/python/agentic-sandbox-client/**/*.py, clients/go/**/*.go, and docs/**/*.md with focused review criteria.`
Developer and contributor guidance updates
.github/copilot-instructions.md
Replaces the file with a structured “AI Code Review Guidelines” layout: project context/toolchain/lint/scope, a consolidated “Specific Conventions & Gotchas” section, and an updated CLA reminder advising contributors not to use GitHub’s “Commit suggestion” button due to bot co-author CLA implications.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

lgtm

Suggested reviewers

  • soltysh
  • barney-s
  • justinsb

Poem

🐰 I nibbled YAML, set the rules just right,

Moved words to guide each code-review night,
Paths pruned clean, and docs rearranged,
The rabbit's hop left reviewers unchanged,
A quiet thump: CI hums polite.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'chore: optimize AI code review configuration (Copilot & CodeRabbit)' clearly and concisely describes the main changes, which involve configuring both Copilot and CodeRabbit with unified project standards.
Description check ✅ Passed The description comprehensively covers all required template sections: it explains what the PR does, references no specific issues (appropriate for this change), and provides a release note marked as NONE as required.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Copilot AI 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.

Pull request overview

This PR aligns the repository’s AI-assisted review workflow and configuration so GitHub Copilot and CodeRabbit can be evaluated side-by-side using a shared standards baseline (without duplicating rulebooks).

Changes:

  • Updates contributor-facing documentation (README/CONTRIBUTING/PR template) to describe the dual Copilot + CodeRabbit review workflow and CLA-safe handling of AI suggestions.
  • Refactors .github/copilot-instructions.md to focus on agent-sandbox-specific context and “gotchas” (API groups, controller-runtime constraints, structured logging, docs site mounts, Python SDK conventions).
  • Adds a .coderabbit.yaml configuration to ingest the shared knowledge base and apply path-specific review guidance while excluding generated/vendor content.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
README.md Updates the documented AI review workflow to include Copilot + CodeRabbit and interaction guidance.
CONTRIBUTING.md Updates contribution rules to include CodeRabbit alongside Copilot and reiterates CLA-safe application of AI suggestions.
.github/pull_request_template.md Updates PR template AI review bullets to mention both tools and the CLA constraint.
.github/copilot-instructions.md Replaces generic reviewer persona text with project-specific context and conventions/gotchas.
.coderabbit.yaml Adds CodeRabbit v2 config: shared knowledge base inputs, path filters, and path-scoped instructions.

@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 @.github/copilot-instructions.md:
- Line 1: The document starts with bold text ("**Project Context:**") instead of
a proper markdown top-level heading; replace or precede that line with a single
H1 heading (for example "# Copilot Review Instructions" or "# Code Review
Guidelines") so the file has a proper top-level heading and resolves the
markdown/linter warning, keeping the existing bold "Project Context:" content
below the new heading.
🪄 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: ASSERTIVE

Plan: Pro

Run ID: f49b13f1-bdd3-4327-a6c2-948bbf5d1e96

📥 Commits

Reviewing files that changed from the base of the PR and between 98952fd and 25e8d35.

📒 Files selected for processing (5)
  • .coderabbit.yaml
  • .github/copilot-instructions.md
  • .github/pull_request_template.md
  • CONTRIBUTING.md
  • README.md
Comment thread .github/copilot-instructions.md
@janetkuo janetkuo force-pushed the add-coderabbit-config branch from 25e8d35 to df49c76 Compare June 5, 2026 01:26
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 5, 2026
Copilot AI review requested due to automatic review settings June 5, 2026 01:39
@janetkuo janetkuo force-pushed the add-coderabbit-config branch from df49c76 to 1bc9363 Compare June 5, 2026 01:39
TAG=agy

CONV=39249a7a-100d-4cfa-9e07-c8c02c8850d4

Copilot AI 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.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread .github/copilot-instructions.md Outdated
@janetkuo janetkuo force-pushed the add-coderabbit-config branch from 1bc9363 to 5fbb18d Compare June 5, 2026 01:43

@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.

🧹 Nitpick comments (1)
.coderabbit.yaml (1)

22-45: ⚡ Quick win

Consider adding path instructions for clients/go/ SDK.

The configuration includes detailed path instructions for the Python SDK (clients/python/) but not for the hand-written Go SDK at clients/go/. According to AGENTS.md, clients/go/ is also a hand-written, editable public SDK that wraps lifecycle operations and connectivity features.

Adding path-scoped instructions for clients/go/ would ensure consistent review focus on SDK-specific concerns like API stability, idiomatic Go client patterns, and example correctness.

📦 Proposed addition for Go SDK path instructions
     - path: "clients/python/agentic-sandbox-client/**/*.py"
       instructions: |
         Review against Python 3.10+ idioms. Enforce Pydantic models for data structures. Ensure strict sync and async parity (every sync method must have an async sibling). Do not apply Go conventions here.
 
+    - path: "clients/go/**/*.go"
+      instructions: |
+        Focus on idiomatic Go client patterns, API stability, and clear examples. This is a hand-written public SDK wrapping SandboxClaim lifecycle and connectivity features. Ensure error handling is robust and the API surface remains backward-compatible.
+
     - path: "docs/**/*.md"
       instructions: |
         Focus on technical accuracy, clarity, and markdown formatting. Verify that code snippets and configuration examples match current CRD definitions.
🤖 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 @.coderabbit.yaml around lines 22 - 45, The path_instructions block in
.coderabbit.yaml lacks an entry for the hand-written Go SDK; add a new
path_instructions entry targeting "clients/go/**" that mirrors the Python entry
but for Go: emphasize idiomatic Go client patterns, API stability/semver
guarantees, context propagation and concurrency safety, pointer vs value
decisions, godoc comments and examples, backwards-compat checks, and CI/test
coverage for the SDK; reference the existing path_instructions symbol and
AGENTS.md as the rationale and ensure the new entry aligns with other SDK
instructions for consistent review behavior.
🤖 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.

Nitpick comments:
In @.coderabbit.yaml:
- Around line 22-45: The path_instructions block in .coderabbit.yaml lacks an
entry for the hand-written Go SDK; add a new path_instructions entry targeting
"clients/go/**" that mirrors the Python entry but for Go: emphasize idiomatic Go
client patterns, API stability/semver guarantees, context propagation and
concurrency safety, pointer vs value decisions, godoc comments and examples,
backwards-compat checks, and CI/test coverage for the SDK; reference the
existing path_instructions symbol and AGENTS.md as the rationale and ensure the
new entry aligns with other SDK instructions for consistent review behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 89a4e329-e51a-4b96-b72c-349c2b63d83b

📥 Commits

Reviewing files that changed from the base of the PR and between df49c76 and 1bc9363.

📒 Files selected for processing (2)
  • .coderabbit.yaml
  • .github/copilot-instructions.md
✅ Files skipped from review due to trivial changes (1)
  • .github/copilot-instructions.md
…instructions

TAG=agy

CONV=39249a7a-100d-4cfa-9e07-c8c02c8850d4
Copilot AI review requested due to automatic review settings June 5, 2026 01:45

Copilot AI 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.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

Comment thread .github/copilot-instructions.md Outdated
Comment thread .coderabbit.yaml Outdated
…le-level architectural parity

TAG=agy

CONV=39249a7a-100d-4cfa-9e07-c8c02c8850d4
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: aditya-shantanu, janetkuo

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@aditya-shantanu

Copy link
Copy Markdown
Collaborator

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 5, 2026
Comment thread .coderabbit.yaml
- "AGENTS.md"

reviews:
request_changes_workflow: true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I tried this as I really didn't like it.

I guess it will approve the PRs if the changes are good from coderabbit side. I disabled it for jobset/kueue because I find the approval from coderabbit to be odd.

Comment thread .coderabbit.yaml
- "!**/*_generated*.go"
- "!**/zz_generated.*.go"
- "!vendor/**"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One thing I added in mine was to forbid reviews if the PR has a label "needs-ok-to-test" or the PR is in draft stage.

  auto_review:
    enabled: true
    ignore_title_keywords:
      - "WIP"
      - "DO NOT MERGE"
    drafts: false
    base_branches:
      - "main"
    labels:
      - "!needs-ok-to-test"
@k8s-ci-robot k8s-ci-robot merged commit ec61679 into kubernetes-sigs:main Jun 5, 2026
11 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Agent Sandbox Jun 5, 2026
khirotaka pushed a commit to khirotaka/agent-sandbox that referenced this pull request Jun 12, 2026
…ubernetes-sigs#938)

* chore: optimize AI code review configuration (Copilot & CodeRabbit)

TAG=agy

CONV=39249a7a-100d-4cfa-9e07-c8c02c8850d4

* fix: correct Python SDK async parity description and add Go SDK path instructions

TAG=agy

CONV=39249a7a-100d-4cfa-9e07-c8c02c8850d4

* fix: refine Python SDK sync/async parity description to focus on module-level architectural parity

TAG=agy

CONV=39249a7a-100d-4cfa-9e07-c8c02c8850d4
alexatakvelon pushed a commit to volatilemolotov/agent-sandbox that referenced this pull request Jun 24, 2026
…ubernetes-sigs#938)

* chore: optimize AI code review configuration (Copilot & CodeRabbit)

TAG=agy

CONV=39249a7a-100d-4cfa-9e07-c8c02c8850d4

* fix: correct Python SDK async parity description and add Go SDK path instructions

TAG=agy

CONV=39249a7a-100d-4cfa-9e07-c8c02c8850d4

* fix: refine Python SDK sync/async parity description to focus on module-level architectural parity

TAG=agy

CONV=39249a7a-100d-4cfa-9e07-c8c02c8850d4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ready-for-review size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

5 participants