Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
415 changes: 269 additions & 146 deletions java-bigquery-jdbc/.agents/skills/bigquery-jdbc-prepare-pr/SKILL.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
# The cross-model reviewer

Read this when step 3 of [SKILL.md](../SKILL.md) calls for a cross-model
reviewer.

## Which model

Don't rank models from memory. Their names say little about how well they
review, and the list changes. Ask the tool what it offers now
(`cross-review.sh models`, or `agy models`) and apply these rules in order:

1. Another vendor than your own model.
2. Not an alias, and not a small or fast model class. In a test here a small
model found 1 of 12 planted defects and opened no repository file.
3. In each model family, the second-highest reasoning effort. The highest took
about an hour for one round here, twice the time limit.
4. The first candidate that starts. A model that can't start fails within
seconds.

`cross-review.sh run` applies these rules to the model list of the conversation
CLI. This is how it reads that list:

- The vendor is the first word of a model's label, and the effort is the word
in brackets that ends it, as in `<Vendor> <Family> (High)`. A label without
an effort is taken for an alias or a small model and is left out.
- It ranks the efforts `Max`, `XHigh`, `High`, `Medium`, `Low` and `Minimal`. A
family that uses any other word is taken in the order of the list, which
puts the highest effort first.
- It tries one candidate per family, in the order of the list.
- It remembers the outcomes, per machine. A model that ran out of time is
skipped for 14 days, because finding that out again costs the whole wait. A
model that ended without an answer, or whose start call failed, is skipped
for one day. `--retry-failed` tries them again.

To set the order yourself, name the models. This replaces the rules:

```bash
git config --global bigquery-jdbc.review-models "<model>,<model>" # or BQ_JDBC_REVIEW_MODELS
cross-review.sh run --prompt-file "$PROMPT_FILE" --model "<model>" # for one run
```

An order of your own goes stale. When the CLI stops offering a model, its start
call fails, and the script goes on to the next model that you named.

## `cross-review.sh`: through the conversation CLI

Some Antigravity installations have a conversation CLI: a client for the IDE's
language server, with the commands `new-conversation`, `list-conversations`,
`get-conversation`, `get-invocation`, `cancel` and `archive`. It is not `agy`,
and it is not the launcher that opens files in the IDE. Tell the script where
it is, once per machine:

```bash
git config --global bigquery-jdbc.review-cli /path/to/the/conversation/cli
```

`BQ_JDBC_REVIEW_CLI` does the same for one shell. Run the script from an
Antigravity agent's shell. It takes the server address, the token and your own
conversation id from the `ANTIGRAVITY_*` variables that the IDE sets there.

```bash
.agents/skills/bigquery-jdbc-prepare-pr/scripts/cross-review.sh models
.agents/skills/bigquery-jdbc-prepare-pr/scripts/cross-review.sh run --prompt-file "$PROMPT_FILE"
```

`models` shows your own model, what the CLI offers and the order `run` would
try. `run` returns when the reviewer has ended, so start it in the background
and start the own-model reviewer meanwhile. Until it returns, don't edit,
stage, commit or switch branches in that checkout: the script can't tell a
change of yours from one of the reviewer, and ends with status 3. For each
candidate, until one answers, it does this:

1. Starts a new conversation on that model, with the start prompt. If the
start call fails, it reports the CLI's reason and goes on to the next
candidate. If the call succeeds and its output names no conversation, it
keeps that output next to the prompt file and stops with status 3.
2. Waits until the conversation ends, for 30 minutes at most (`--timeout-min`).
3. Cancels the conversation, whether it ended or not, waits until the CLI
reports that it no longer runs, and saves its transcript and its last
message next to the prompt file.
4. Compares the fingerprint of the checkout with the one from before the first
candidate, and audits the transcript: every tool step must be a file read or
a search. If either check fails, or the reviewer could not be stopped, it
stops with status 3 and tries no other model.
5. Goes on to the next candidate only if the model never answered, which is
how a model that can't start looks. After a reviewer that ran out of time or
gave a reply without the check word, it tries no other model.

When it tries no further candidate, it looks once more: the CLI still shows
every conversation that it stopped as stopped, and the fingerprint is still the
same. If so, it archives the conversations. If not, it cancels the
conversation in question once more and ends with status 3.

Then it prints what the report needs: the model and its id, the minutes, the
tool calls, the repository files read, the result of the audit, whether the
reviewer stopped, and whether the checkout changed.

| Exit status | `outcome` | Meaning | What you do |
| --- | --- | --- | --- |
| 0 | `ok` | The reply starts with the check word, every tool step was a file read or a search, the reviewer has stopped, and the checkout is unchanged. | Use the review in `reply_file`, after the two checks of step 3 in SKILL.md that the script leaves to you: `repo_files_read` is not 0, and `NOT_CHECKED` in the reply is `none`. |
| 1 | none | The script couldn't run: the CLI isn't configured, it listed no models, or the script can't tell which model you run on. | Fix the setup, or name a model with `--model`. If you can't, go on with the own-model reviewer and say so in the report. |
| 2 | `no-reviewer`, `timeout`, `bad-reply` | No usable review: the CLI offers no model of another vendor, no model answered, the reviewer ran out of time, or its reply doesn't start with the check word. | Go on with the own-model reviewer and say so in the report. If the script says that the CLI offers no model of another vendor, you can name one with `--model` first. |
| 2 | `all-candidates-skipped` | Every candidate failed recently, so none was tried. | Run it once more with `--retry-failed`. |
| 3 | `rejected` | The run can't show that no reviewer changed anything: the checkout changed, a reviewer took a tool step that is not a file read or a search, a transcript can't be read, a reviewer could not be stopped or runs again, a start call named no conversation, or the script ended before it had made these checks. | Discard the review, stop and tell the user. If the script's message says that a reviewer may still run, cancel it in the IDE. The conversations are left unarchived, so that they can look at them. |
| Any other | none | The script was interrupted, or one of its steps failed, while no reviewer was under check. | Read its message and run it again. |

### What the audit can and can't tell

A reviewer started this way is a full agent. It has write tools, and it loads
the same rules and skills as you. The start prompt tells it to stay read-only,
and the script checks afterwards that it did:

- The audit goes by the names that the transcript gives to tool steps. The
script holds a short list of steps that only read: viewing a file, searching
file contents, listing a directory and finding files by name. Any other tool
step fails the audit, whatever it did: a command, an edit, a subagent, a web
search or a tool the script has never seen. `other_tools` names them.
- The audit fails too if the transcript holds no step the script can read, a
step line it can't read, or a reply with the check word and not one tool
step, and if the CLI fails while it prints the transcript. That is what a
change in the CLI's output looks like.
- The audit finds a command only after it ran. For a diff that someone outside
the team wrote, use a reviewer without file-edit and shell tools instead: a
subagent of such a type. Look at what else it can do. In Antigravity a
`research` subagent can still search the web and call the MCP tools that are
configured.
- The audit doesn't look at what the reviewer read. A reviewer can open any
file that you can, also outside the repository.
- The fingerprint doesn't see ignored files outside the agent directories,
tags and remote-tracking refs, or anything outside the repository. Of `.git`
it covers `HEAD`, the local branches, the config (also the per-worktree
one), the hooks, and the exclude, attributes and sparse-checkout files, and
nothing else.
- While a reviewer is under check, an interrupt or a failing step of the
script cancels it and ends with status 3, because the checks were not made.
During the start call the script can't cancel, because it has no id yet: it
ends with status 3 and tells you to cancel in the IDE. If the script is
killed outright, the reviewer runs on: cancel it in the IDE.
- The CLI takes the token as a command-line argument, so other users of the
same machine can see it in the process list while a call runs.

To audit a saved transcript again:

```bash
.agents/skills/bigquery-jdbc-prepare-pr/scripts/cross-review.sh audit \
--transcript <transcript_file> --check-word <word>
```

## Through `agy`

`agy` is started by hand, so do by hand what `cross-review.sh run` does. Pick
the model from `agy models` by the rules above, stop the reviewer after 30
minutes, and run `review.sh fingerprint` before and after it. If the two
differ, discard the review, stop and tell the user.

`--sandbox` isolates the shell commands of that reviewer. Nobody has confirmed
here that it also keeps the reviewer's file tools from writing, so the
fingerprint is the check on this route, and `agy --sandbox` doesn't count as a
reviewer that can't write.
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
Review the diff below with the method above, and check the PR description
against the diff: it must say what changed, why, and how it was tested.

From round 2 on, the ledger below shows what the author did with the earlier
findings:

- If the ledger lists something that an earlier reviewer did not check, check
that first.
- For each finding marked FIXED, check the fix in the code. Don't repeat the
finding unless the fix is wrong or incomplete.
- For each finding marked PUSHBACK, say whether you ACCEPT the author's reason
(the finding is then closed) or MAINTAIN it, with a new argument.
- Findings marked WONTFIX are closed nits. Don't repeat them.
- Concentrate on what the ledger says changed since the previous round. Raise a
new finding on code that has not changed since then only if it is blocking or
major.

Reply in exactly this format, after the READ-CHECK line that the end of this
file asks for. Write `none` under a heading that has no entries.

VERDICT: APPROVE | CHANGES_REQUESTED
FINDINGS:
- id: R<round>-<n>
severity: blocking | major | minor | nit
location: <file>:<line> | PR description
issue: <what is wrong, when it happens and why it matters>
suggestion: <concrete fix>
QUESTIONS:
- <something only the author or the owners of the driver can settle: why a
behaviour exists, or which of two designs they want>
NOT_CHECKED:
- <a changed file, a claim or a kind of check that you did not get to, for
example because the tool calls ran out>
PUSHBACK_RESPONSES:
- id: <earlier finding id>
decision: ACCEPT | MAINTAIN
reason: <why>

APPROVE only if no blocking or major finding is open.
Loading
Loading