Skip to content

Optimize copilot usage - #4581

Draft
atobiszei wants to merge 3 commits into
mainfrom
atobisze_economical_copilot
Draft

atobiszei wants to merge 3 commits into
mainfrom
atobisze_economical_copilot

Conversation

@atobiszei

Copy link
Copy Markdown
Collaborator

🛠 Summary

JIRA/Issue if applicable.
Describe the changes.

🧪 Checklist

  • Unit tests added.
  • The documentation updated.
  • Change follows security best practices.
    ``

@atobiszei atobiszei changed the title Atobisze economical copilot Optimize copilot usage Sep 18, 2026
@atobiszei
atobiszei requested a balanced review from Copilot September 18, 2026 09:08

Copilot AI left a comment

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.

🟡 Changes recommended

Several instructions conflict, omit supported file types, or inaccurately describe validation behavior.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Introduces modular, path-scoped Copilot guidance and a dedicated C++ validation agent.

Changes:

  • Adds repository and C++/Bazel guidance.
  • Extracts build and review instructions.
  • Adds automated build/test delegation.
File summaries
File Description
AGENTS.md Adds repository-wide guidance index.
.github/copilot-instructions.md Redirects Copilot to scoped guidance.
.github/instructions/ovms-auto-validate.instructions.md Requires delegated validation.
.github/instructions/cpp-sources.instructions.md Adds C++ source rules.
.github/instructions/cpp-headers.instructions.md Adds C++ header rules.
.github/instructions/code-review.instructions.md Defines C++ review standards.
.github/instructions/build-workflow.instructions.md Documents build and test workflows.
.github/instructions/bazel-build.instructions.md Defines Bazel conventions.
.github/agents/build-validate.agent.md Adds the validation subagent.
Review details

Suppressed comments (1)

.github/agents/build-validate.agent.md:62

  • This instruction conflicts with line 21, which requires restarting a stopped matching container. Clarify that validation stops only when the container cannot be found or restarted, otherwise agents may abort despite having a reusable container.
- If the build container is not running, report that and stop
  • Files reviewed: 9/9 changed files
  • Comments generated: 8
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +14 to +18
1. Find the build container that mounts the current workspace, deterministically, in **one** command.
It lists all containers (running + stopped) whose mounts include this workspace, puts running
ones first, and prints a single name:
```bash
for id in $(docker ps -aq); do docker inspect "$id" --format '{{if .State.Running}}0{{else}}1{{end}} {{.Name}} {{range .Mounts}}{{.Source}};{{end}}'; done | grep -F "$(pwd)" | sort | sed -E 's#^[01] /([^ ]+).*#\1#' | head -1
## Output Format
Return a compact structured report:
- **Build**: PASS/FAIL (if FAIL: last 20 lines of error output, lines truncated at 200 chars)
- **Tests**: PASS/FAIL (if FAIL: list of failing test names + assertion message only, one line each)
@@ -0,0 +1,32 @@
---
applyTo: "**/BUILD"
@@ -0,0 +1,27 @@
---
applyTo: "**/*.cpp"
description: "Use when: editing, implementing, fixing, or refactoring C++ source files in the OVMS repository"
applyTo: "src/**/*.{cc,cpp,h,hpp}"
---
After completing code changes to OVMS C++ files, you MUST run the **build-validate** subagent to verify the build, run relevant tests, and check lint.
| `make targz_package` | Extract `.tar.gz` release package |
| `make ovms_release_images` | Build CPU and GPU release Docker images |
| `make run_unit_tests` | Run C++ unit tests in the `-build` container |
| `make test_functional` | Run Python functional te| `make style` | All code style checks: spell, clang-format, cpplint, cppclean (see Style Checking section) |
Comment on lines +22 to +25
- **No dangling references / temporaries bound to `const T&`**:
- Never give a `const T&` parameter a default that constructs a temporary (e.g. `const std::string& p = ""`). Use an overload or pass by value.
- When a `const T&` is stored, verify the referenced object outlives its use.
- Prefer overloads over default arguments for non-trivial types passed by reference.
Comment thread AGENTS.md
| When you are… | Read |
|---|---|
| Editing a C++ **header** (`*.hpp`) | [.github/instructions/cpp-headers.instructions.md](.github/instructions/cpp-headers.instructions.md) |
| Editing a C++ **source** (`*.cpp`) | [.github/instructions/cpp-sources.instructions.md](.github/instructions/cpp-sources.instructions.md) |
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.

2 participants