-
Notifications
You must be signed in to change notification settings - Fork 84
chore: add Copilot code review instructions #261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,67 @@ | ||||||
| # GitHub Copilot Code Review Instructions | ||||||
|
|
||||||
| ## Review Philosophy | ||||||
| - Only comment when you have HIGH CONFIDENCE (>80%) that an issue exists | ||||||
| - Be concise: one sentence per comment when possible | ||||||
| - Focus on actionable feedback, not observations | ||||||
| - Silence is preferred over noisy false positives | ||||||
|
|
||||||
| ## Project Context | ||||||
| - **OpenAB**: A lightweight ACP (Agent Client Protocol) harness bridging Discord ↔ any ACP-compatible coding CLI over stdio JSON-RPC | ||||||
| - **Language**: Rust 2021 edition, single binary | ||||||
| - **Async runtime**: tokio (full features) | ||||||
| - **Discord**: serenity 0.12 (gateway + cache) | ||||||
| - **Error handling**: Prefer `anyhow::Result`; avoid `unwrap()` in production paths as a target, though some existing code may still use it | ||||||
| - **Serialization**: serde + serde_json for ACP JSON-RPC, toml for config | ||||||
| - **Key modules**: `acp/connection.rs` (ACP stdio bridge), `acp/pool.rs` (session pool), `discord.rs` (Discord event handler), `config.rs` (TOML config), `reactions.rs` (emoji reactions), `stt.rs` (speech-to-text) | ||||||
|
|
||||||
| ## Priority Areas (Review These) | ||||||
|
|
||||||
| ### Correctness | ||||||
| - Logic errors that could cause panics or incorrect behavior | ||||||
| - ACP JSON-RPC protocol violations (wrong method names, missing fields, incorrect response routing) | ||||||
| - 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 | ||||||
|
|
||||||
| ### Concurrency & Safety | ||||||
| - Multiple atomic fields updated independently — document if readers may see mixed snapshots | ||||||
| - `Mutex` held across `.await` points (potential deadlock) | ||||||
| - Session pool lock scope — `RwLock` held during I/O can stall all sessions | ||||||
| - 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) | ||||||
|
||||||
| - `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
AI
Apr 12, 2026
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 usesunwrap/expect(e.g.,src/config.rs:176,src/discord.rs:27/121), and would likely cause noisy reviews; consider narrowing it to flag newly introducedunwrap/expectin fallible paths rather than treating all uses as automatic bugs.