Repository navigation
feat(agent): agy visual review harness (#219) #222
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,103 @@ | ||
| # ADR-0023: Antigravity visual review harness (`agent review`) | ||
|
|
||
| - Status: Accepted | ||
| - Date: 2026-11-23 | ||
| - Layer: Current practice / execution contract, not Constitution | ||
| - Related: [#219](https://github.com/rebuildup/dotfiles/issues/219), [ADR-0022](ADR-0022.md), [#218](https://github.com/rebuildup/dotfiles/issues/218) | ||
| - Research: [docs/research/antigravity-cli-2026-11-23.md](../research/antigravity-cli-2026-11-23.md) | ||
|
|
||
| ## Context | ||
|
|
||
| Issue #219 asks for a Google AI Pro visual review harness on top of the | ||
| `agy` integration delivered by #218/ADR-0022. The operator requirements: | ||
|
|
||
| - single-shot `agy -p` execution; no ACP daemon, no persistent agent runtime; | ||
| - review inputs (images + spec) must be isolated from the reviewed repository; | ||
| - the original repository must be unwritable at the OS level, not merely by | ||
| model permission; | ||
| - results must be structured and failures/unverified runs must be classified | ||
| explicitly — `agy -p` reports `status: "SUCCESS"` even when forbidden | ||
| operations were attempted and denied (ADR-0022, research memo); | ||
| - quota information must be retrievable; | ||
| - direct execution and Herdr-mediated execution must share one contract; | ||
| - quota sharing control / scheduling is out of scope unless trivially small. | ||
|
|
||
| ## Decision | ||
|
|
||
| ### 1. One module, two transports | ||
|
|
||
| `script/agent/agy-review.ts` implements the whole contract. `agent review run` | ||
| executes locally; `agent review run --executor herdr` materializes the request | ||
| into an isolated workdir and re-enters `agent review run-file <workdir>` | ||
| inside a Herdr pane (`herdr workspace create` + `pane run`, existing | ||
| `script/agent/herdr.ts` primitives — no new worker registry, no second task | ||
| state model). The inner run is the same code path, so the result schema, | ||
| isolation layers and classification are identical by construction. | ||
|
|
||
| ### 2. Input isolation | ||
|
|
||
| The model only ever sees copies. Images are validated (absolute path, no | ||
| `..`, allowlisted extension, size cap) and copied into | ||
| `$AGENT_STATE_DIR/agy-review/<uuid>/inputs/`; the spec and JSON schema are | ||
| materialized beside them. The prompt references only the copies. The reviewed | ||
| repository is never the working directory and its path is never handed to | ||
| the model. | ||
|
|
||
| ### 3. Layered read-only enforcement | ||
|
|
||
| 1. **Permission layer** — `agy --settings` carries the ADR-0022 deny payload | ||
| (`write_file`, `command`, `read_url`, `execute_url`, `mcp`, `unsandboxed`). | ||
| The managed file `~/.config/agy/review.settings.json` is preferred; an | ||
| identical inline fallback keeps the harness fail-closed before `script/link` | ||
| has run. | ||
| 2. **OS layer** — on macOS the child runs under `sandbox-exec` (Seatbelt) | ||
| with `deny file-write*` outside an explicit allowlist (review workdir, | ||
| `~/.gemini`, `~/.cache`, Antigravity app-support, temp dirs). SBSL deny | ||
|
Comment on lines
+54
to
+55
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keep protected repositories out of the Seatbelt write allowlist.
Require that a protected path cannot be writable through the OS layer. Either reject an overlapping
|
||
| uses `require-not`/`require-any` because a later `(allow ...)` does not | ||
| override an earlier `(deny ...)`. Non-macOS records | ||
| `osSandbox: "unsupported"` in the result — reduced assurance, not silent. | ||
|
Comment on lines
+57
to
+58
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Enforce OS-level isolation or reject unsupported platforms. The requirements state that the original repository must be unwritable at the OS level. Linux and WSL runs proceed without an OS sandbox, so permission denies and post-run checks do not meet that requirement. Add an OS-level restriction for those platforms or reject the review when that restriction is unavailable.
|
||
| 3. **Post-run verification** — independent signals, never the CLI status | ||
| alone: `denied_actions`, permission-error markers in the response, | ||
| protected-path `git status --porcelain` snapshot diff (`--protect`), and | ||
| required-key validation of the structured verdict. | ||
|
|
||
| ### 4. Result contract and classification | ||
|
|
||
| `AgyReviewResult` (versioned `"1.0.0"`) records the agy envelope fields, the | ||
| readonly evidence, isolation facts, quota snapshot and `reasons[]`. | ||
| `classification` is one of `review-completed`, `agy-error`, `auth-required`, | ||
| `timeout`, `invalid-output`, `readonly-violation`, `executor-error`. | ||
| Any denied action, in-band permission error, or protected-path mutation | ||
| forces `readonly-violation` even when the envelope says SUCCESS. `verified` | ||
| is true only for a completed review whose supplied verification layers all | ||
| passed. Exit code is 0 only for `review-completed`, so schedulers fail | ||
| closed. | ||
|
|
||
| ### 5. Quota | ||
|
|
||
| `fetchAgyQuota()` runs `agy -p "/quota" --output-format json` once per review | ||
| (skip with `--no-quota`) and normalizes the observed TSV format | ||
| (`<group>\t<label>\t<remaining %>\t<reset ISO>`) into buckets; a JSON | ||
| `groups/buckets` shape is accepted for forward compatibility. Quota *sharing | ||
| control* and scheduling remain out of scope — they need the catalog/quota | ||
| scope machinery of issues #89/#91 and belong to a follow-up issue. | ||
|
|
||
| ### 6. Launcher surface and harness registration | ||
|
|
||
| `agent review run|run-file` is a launcher subcommand like `task`, parsed | ||
| outside the harness/provider grammar. `config/agents.toml` gains | ||
| `[harnesses.agy]` (`adapter = "passthrough"`, no env, no Infisical secret) | ||
| so `agent agy` / `agent native agy` run the CLI untouched; the review | ||
| contract deliberately does not ride the provider/route model because `agy` | ||
| authenticates via the Google subscription keyring, not a route credential. | ||
|
|
||
| ## Consequences | ||
|
|
||
| - Read-only is enforced at three independent layers; a failure in any one is | ||
| classified, not hidden. | ||
| - Herdr integration reuses workspace/pane primitives; `agent task` worker | ||
| semantics (attempts, acceptance, fallback) are unchanged and do not apply | ||
| to single-shot reviews. | ||
| - The Seatbelt profile is macOS-only; Linux/WSL reviews run with permission | ||
| denies + post-checks and report `osSandbox: "unsupported"`. | ||
| - Quota scheduler / shared-quota control is explicitly deferred. | ||
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.
Correct the unsupported
agent native agycommand.The parser does not accept
nativeas a launch keyword. Fornative agy, it readsnativeas the harness key andagyas a provider route. The command never reachescmdRunNative, which handles only thenativeaction. The documented untouched launch isagent agy.Document
agent agyonly, or add explicitnativeparsing before documenting this spelling.docs/adr/ADR-0023.md:90repeats the same spelling and needs the same correction.