Skip to content

chore: add Copilot code review instructions#261

Closed
Reese-max wants to merge 2 commits intoopenabdev:mainfrom
Reese-max:chore/copilot-instructions
Closed

chore: add Copilot code review instructions#261
Reese-max wants to merge 2 commits intoopenabdev:mainfrom
Reese-max:chore/copilot-instructions

Conversation

@Reese-max
Copy link
Copy Markdown

Summary

Add .github/copilot-instructions.md to guide Copilot's automated PR reviews with OpenAB-specific context.

Motivation

Copilot code review currently uses generic analysis. With project-specific instructions, it can focus on what matters for OpenAB:

  • ACP protocol correctness — JSON-RPC routing, notification handling, timeout values
  • Concurrency safety — atomic fields, Mutex across await points, session pool lock scope
  • Discord API constraints — 2000 char message limit, 3s autocomplete deadline
  • Skip CI-covered checks — no redundant rustfmt/clippy/test comments

Design Decisions

Modeled after block/goose's production-grade instructions (widely referenced as best practice).

Key choices:

  • >80% confidence threshold — silence over noise
  • "Skip These" section — explicitly tell Copilot what NOT to flag
  • CI awareness — list exact CI commands so Copilot doesn't duplicate
  • 3440 / 4000 chars — within Copilot's read limit

Changes

File Change Description
.github/copilot-instructions.md NEW 67 lines, 3440 chars — review philosophy, priority areas, skip list

Add `.github/copilot-instructions.md` to guide GitHub Copilot's
automated PR reviews with project-specific context:

- ACP protocol correctness (JSON-RPC routing, notification handling)
- Concurrency safety (atomic fields, Mutex across await, pool locks)
- Discord API constraints (2000 char limit, 3s autocomplete deadline)
- Skip CI-covered checks (rustfmt, clippy, tests)
- >80% confidence threshold to reduce noise

Modeled after block/goose's production-grade instructions.
3440 chars — within the 4000 char limit.
@Reese-max Reese-max requested a review from thepagent as a code owner April 12, 2026 20:27
Copilot AI review requested due to automatic review settings April 12, 2026 20:27
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a repository-scoped .github/copilot-instructions.md to steer automated Copilot PR reviews toward OpenAB’s most important correctness/concurrency/protocol concerns and away from CI-covered noise.

Changes:

  • Introduce Copilot review philosophy (high-confidence, concise, actionable).
  • Document OpenAB-specific focus areas (ACP JSON-RPC correctness, async concurrency, Discord constraints, config/deployment).
  • Add “Skip” guidance aligned with CI checks to reduce redundant comments.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/copilot-instructions.md Outdated
Comment thread .github/copilot-instructions.md Outdated
Comment thread .github/copilot-instructions.md Outdated
Comment thread .github/copilot-instructions.md Outdated
Comment thread .github/copilot-instructions.md Outdated
@Reese-max
Copy link
Copy Markdown
Author

@copilot apply changes based on the comments in this thread

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@Reese-max Reese-max requested a review from Copilot April 12, 2026 20:42
@Reese-max Reese-max closed this Apr 12, 2026
@Reese-max Reese-max deleted the chore/copilot-instructions branch April 12, 2026 20:43
Copy link
Copy Markdown

Copilot AI left a comment

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 1 out of 1 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +51 to +54
## CI Pipeline (Do Not Flag These)
- `cargo fmt --check` — formatting is enforced by CI
- `cargo clippy --all-targets -- -D warnings` — lint warnings are enforced by CI
- `cargo test` — test failures are caught by CI
Copy link

Copilot AI Apr 12, 2026

Choose a reason for hiding this comment

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

The CI section is currently inaccurate: this repo’s CI runs cargo check, cargo clippy -- -D warnings, and cargo test, but does not run cargo fmt --check nor cargo clippy --all-targets (see .github/workflows/ci.yml). Consider updating this section (or adding a fmt check to CI) so Copilot doesn’t skip formatting/lint feedback based on a false assumption.

Copilot uses AI. Check for mistakes.
- Race conditions in async code (especially in the reader loop and session pool)
- Resource leaks (child processes not killed, channels not closed)
- Off-by-one in timeout calculations
- Incorrect error propagation — `unwrap()` in non-test code is always a bug
Copy link

Copilot AI Apr 12, 2026

Choose a reason for hiding this comment

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

The guidance "unwrap() in non-test code is always a bug" conflicts with the earlier note that some existing production code still uses unwrap/expect (e.g., src/config.rs:176, src/discord.rs:27/121), and would likely cause noisy reviews; consider narrowing it to flag newly introduced unwrap/expect in fallible paths rather than treating all uses as automatic bugs.

Suggested change
- Incorrect error propagation — `unwrap()` in non-test code is always a bug
- Incorrect error propagation — newly introduced `unwrap()`/`expect()` in fallible non-test production paths should usually be flagged unless failure is intentionally impossible and clearly justified

Copilot uses AI. Check for mistakes.
- Child process lifecycle — `kill_on_drop` must be set, zombie processes must not accumulate

### ACP Protocol
- `session/request_permission` must always get a response (auto-allow or forwarded)
Copy link

Copilot AI Apr 12, 2026

Choose a reason for hiding this comment

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

Given the repo already documents a real ACP interop pitfall where session/request_permission auto-replies without the required outcome wrapper (see docs/steering/triage.md and current implementation in src/acp/connection.rs), consider making this instruction more specific about validating the response shape (not just that a response exists) to prevent repeating that protocol bug.

Suggested change
- `session/request_permission` must always get a response (auto-allow or forwarded)
- `session/request_permission` must always get a protocol-valid response (auto-allow or forwarded); verify the response shape matches ACP expectations, including the required `outcome` wrapper, not just that some response exists

Copilot uses AI. Check for mistakes.
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.

3 participants