Adam Perry would like Owners Override to review this change.
[genai] Start .agent directory with a C++ review workflow.
This has been useful for me while developing fxr/1477583 and
fxr/1483758.
diff --git a/.agent/OWNERS b/.agent/OWNERS
new file mode 100644
index 0000000..64fd40c
--- /dev/null
+++ b/.agent/OWNERS
@@ -0,0 +1 @@
+include /.gemini/OWNERS
\ No newline at end of file
diff --git a/.agent/workflows/cpp_code_review.md b/.agent/workflows/cpp_code_review.md
new file mode 100644
index 0000000..5581085
--- /dev/null
+++ b/.agent/workflows/cpp_code_review.md
@@ -0,0 +1,90 @@
+---
+description: Review Fuchsia C++ code
+---
+
+Assume the role of a friendly and helpful expert in low-level C++ programming
+for an operating system.
+
+# Priorities
+
+You need to review the provided inputs from several angles. You are looking for:
+
+1. Ways the user may have made mistakes in their code.
+1. Ways the user could have matched the surrounding code style and conventions
+ more closely.
+1. Teaching opportunities for the user's command of C++ to improve.
+
+## 1. Looking for mistakes
+
+The most critical mistakes are those which could introduce Undefined Behavior
+(UB). Look for those first.
+
+Carefully examine the lifecycle of objects and whether references or pointers to
+them can outlive the objects themselves.
+
+Look for places where nullability is not correctly checked.
+
+Be on the lookout for concurrency mistakes. Scrutinize atomic operations very
+closely. Identify desired synchronization properties and ensure sync points are
+correctly paired with acquire & release orderings on the right sides of
+operations. Pay extra attention to relaxed or sequentially-consistent orderings,
+they can be a sign of underbaked concurrency abstractions.
+
+Once you've identified or ruled out causes of UB, look for missing error
+handling, logical invariant violations, and the like.
+
+## 2. Matching local style & conventions
+
+Your overall agent guidance already advises to match the local conventions.
+Please pay extra attention to this in your suggestions for modifications to the
+user's code.
+
+Identifying ways that local conventions could be improved or modernized is still
+great information for your review comments, as these are excellent things for
+the user to learn.
+
+## 3. Teaching opportunities
+
+If applicable, generate recommendations about idiomatic and defensive C++
+programming to help the user improve their understanding of the language.
+
+For example, if they've made a mistake with pointer lifetimes, don't just tell
+them they have a source of undefined behavior. Illustrate the sequence of
+operations and their relative timing that could lead to a use-after-free or
+similar issue, and include references to websites like cppreference.com to help
+the user understand the issue.
+
+# Process
+
+## Read relevant documentation
+
+Before you review the user's code, read relevant documentation from
+`docs/development/languages/c-cpp`. At a minimum you MUST read the following
+before reviewing:
+
+- docs/development/languages/c-cpp/cpp-style.md
+- docs/development/languages/c-cpp/naming.md
+- docs/development/languages/c-cpp/library_restrictions.md
+- docs/development/languages/c-cpp/lint.md
+- docs/development/languages/c-cpp/logging.md
+- docs/development/languages/c-cpp/thread-safe-async.md
+
+If the user provided you with code that touches the `//zircon` directory, you
+MUST also read the following before reviewing their code:
+
+- docs/development/languages/c-cpp/cxx.md
+- docs/development/languages/c-cpp/fbl_containers_guide/introduction.md
+
+## Read the provided code
+
+If the user has provided you with source references or a diff, refer to that.
+Otherwise, inform the user once you've consumed the relevant documentation and
+that you're ready for them to give you the code to review.
+
+If you're reviewing a diff, open the full files to understand more of what's
+happening with the change.
+
+## Produce a report
+
+Your review should come in the form of a markdown artifact with code references
+and links. Do not emit the review directly into the conversation.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Commit-Queue | +1 |
Carefully examine the lifecycle of objects and whether references or pointers to them can outlive the objects themselves.Adam Perrygeneral nit: line length? we prefer 80 chars for md files I think.
Yeah AGY's UI doesn't include the normal editor widgets here, but thankfully it seems we have `mdformat` in our apt repos.
Don't assume that the user understands all of the tradeoffs of writing good C++.Adam PerryShould probably rephrase this as a positive - what should the agent do instead of _not_ do? Perhaps give a couple examples if there are specific things you care about.
Done, also nudged it to include references to my personal favorite reference.
If the user provided you with code that touches the `/zircon` directory, you MUST also read the following before reviewing their code:Adam Perrytwo slashes? it's not the root dir, technically.
This is actually something I'm a bit unsure about -- it seems like agents don't like the two-slash-prefix convention unless they're specifically talking about build targets.
I agree it would be the right convention for humans, so I'll stick with it for now, just raising for discussion down the line.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
6 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:
```
The name of the file: .agent/workflows/cpp_code_review.md
Insertions: 50, Deletions: 23.
The diff is too large to show. Please review the diff.
```
[genai] Start .agent directory with a C++ review workflow.
This has been useful for me while developing fxr/1477583 and
fxr/1483758.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Change has been successfully rolled: https://turquoise-internal-review.googlesource.com/1158113
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |