diff --git a/.github/workflows/attestation-renewal.yml b/.github/workflows/attestation-renewal.yml new file mode 100644 index 0000000..1f00451 --- /dev/null +++ b/.github/workflows/attestation-renewal.yml @@ -0,0 +1,58 @@ +name: Attestation renewal + +on: + schedule: + # Weekly reminder only: this workflow never calls providers or uses credentials. + # GitHub executes schedules from the default branch only; on release/* this + # stays dormant until the authorized release-* -> main landing. + - cron: '23 1 * * 1' + workflow_dispatch: + +permissions: + contents: read + issues: write + +jobs: + report: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 + with: + persist-credentials: false + - name: Set up Bun + uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 + with: + bun-version: '1.4.3' + - name: Install dev dependencies + run: bun install --frozen-lockfile + - name: Report fallback attestation state + run: | + bun script/agent.ts attest status --json > attest-status.json + cat attest-status.json + - name: Remind when measured evidence needs renewal + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + set -euo pipefail + count=$(jq '[.candidates[] | select(.usable == false and (.reason == "attestation-stale" or .reason == "attestation-unknown"))] | length' attest-status.json) + if [ "$count" -eq 0 ]; then + echo "No stale/unknown fallback attestation evidence." + exit 0 + fi + summary=$(jq -r '.candidates[] | select(.usable == false and (.reason == "attestation-stale" or .reason == "attestation-unknown")) | "- `\(.profile)` `\(.route)/\(.model)` — \(.reason), evidence=\(.evidence.at // "none")"' attest-status.json) + body=$(cat <` shows the reason). +- **Attestation freshness is time-bounded.** Committed E2E evidence expires + 7 days after its own `evidence.at`, so every `$0` continuity profile stops + resolving stale candidates until the evidence is refreshed. This is + deliberate (stale capacity claims must not silently look healthy) but it + means the `$0` safety nets are not "set and forget": re-measure and update + the `[catalog.*]` evidence, or accept that the profile reports no usable + candidate. `agent attest status [--json]` is the read-only status surface, + and the scheduled Attestation renewal workflow raises a repository reminder + when a fallback candidate is stale or unknown. The schedule activates only + on the default branch after the authorized release landing; until then the + status command is the manual check. Re-verifying stays bounded + and measured: only a real route/model probe may produce `verified-live` + evidence; CI never calls providers or uses credentials for renewal. ## Verification diff --git a/docs/adr/ADR-0022.md b/docs/adr/ADR-0022.md new file mode 100644 index 0000000..7801732 --- /dev/null +++ b/docs/adr/ADR-0022.md @@ -0,0 +1,117 @@ +# ADR-0022: Antigravity CLI (agy) management and read-only review profile + +- Status: Accepted +- Date: 2026-11-23 +- Layer: Current practice / tool management, not Constitution +- Related: [#218](https://github.com/rebuildup/dotfiles/issues/218), [#219](https://github.com/rebuildup/dotfiles/issues/219) (harness follow-up), rebuildup/pc-setup#230 / PR #231 (mise baseline) +- Research: [docs/research/antigravity-cli-2026-11-23.md](../research/antigravity-cli-2026-11-23.md) + +## Context + +The operator runs Google AI Pro and wants a read-only visual review harness on +macOS driven by the Antigravity CLI (`agy`, Google +`google-antigravity/antigravity-cli`, observed 1.5.14). Before this change the +binary was a standalone `~/.local/bin/agy` install outside any package manager, +and nothing in dotfiles described which parts of its state are managed versus +machine-local. + +Two properties of `agy` shape the design: + +- **Credential store follows the environment.** With `SSH_CONNECTION`, + `SSH_CLIENT` or `SSH_TTY` present, `agy` selects file-based token storage at + `~/.gemini/antigravity-cli/antigravity-oauth-token`; without them it uses the + OS keyring (macOS Keychain). A desktop login therefore does not authenticate + an SSH session, and an SSH login does not authenticate a desktop session + (upstream: google-antigravity/antigravity-cli#1336, #1514). +- **Headless permissions are deny-by-default for prompts but not for allowed + defaults.** In `agy -p` (print) mode a tool call that would prompt is + auto-denied and reported in `denied_actions`, yet `command(*)` still + executes by default policy. Read-only behaviour therefore requires explicit + `permissions.deny` rules, not just the absence of `--dangerously-skip-permissions`. + +## Decision + +### 1. Binary ownership stays in pc-setup mise; dotfiles owns only the shim + +`agy` is added to `rebuildup/pc-setup` `mise.global.toml` (`latest`, aqua +backend `google-antigravity/antigravity-cli`) alongside `claude`/`codex`. +dotfiles does not duplicate version management. `home/.local/bin/agy` (and the +`antigravity` sibling name via symlink) is a thin launcher that resolves the +mise binary and normalizes the SSH credential-store split; it contains no +version pins and no credentials. + +### 2. SSH/keyring normalization rule + +When any of `SSH_CONNECTION`/`SSH_CLIENT`/`SSH_TTY` is set **and** +`~/.gemini/antigravity-cli/antigravity-oauth-token` does not exist, the shim +removes those three variables for the child (keeping `SSH_AUTH_SOCK`) so `agy` +uses keyring auth. If the token file exists the environment passes through +unchanged, preserving SSH-native logins. This mirrors the proven approach in +the community `hermes-antigravity-subscription` plugin. + +### 3. Managed vs machine-local state boundary + +Managed by dotfiles (reproducible, shareable): + +- `home/.local/bin/agy` + `home/.local/bin/antigravity` — launcher shim +- `home/.config/agy/review.settings.json` — read-only `--settings` payload, + linked to `~/.config/agy/review.settings.json` on every machine + +Machine-local, never committed (contains account state, machine paths or +session history): + +- `~/.gemini/antigravity-cli/` — `settings.json` (`trustedWorkspaces` is + machine-specific), OAuth token file, conversation DBs, history, logs +- `~/.gemini/antigravity/`, `~/.cache/antigravity`, + `~/Library/Application Support/antigravity` — IDE-side state +- macOS Keychain items (`svce=gemini`, `acct=antigravity`) + +`script/link` is non-destructive: adopting `~/.local/bin/agy` requires moving +the pre-mise standalone binary aside once; `~/.config/agy/` has no prior +state. No composer/generator is added — the managed set is two small static +files, below the threshold that justified `script/claude-settings.ts`. + +### 4. Read-only enforcement is permission rules plus post-checks + +The review profile is `~/.config/agy/review.settings.json`, passed per +invocation with `--settings` (session-only, never persisted by `agy`): + +```json +{ "permissions": { "deny": [ + "write_file(*)", "command(*)", "read_url(*)", + "execute_url(*)", "mcp(*)", "unsandboxed(*)" ] } } +``` + +Verified on 1.5.14: `read_file` still works inside the workspace, `write_file` +and `command` fail with explicit deny-rule errors, and no files are created. +`toolPermission: "strict"` was evaluated and rejected — it prompts before +every tool including reads *even when an allow rule matches*, which makes +headless reads unusable. + +`--mode plan` and prompt-level instructions are **not** accepted as the +read-only guarantee. The harness (#219) must additionally treat +`denied_actions`, tool permission errors in the response, and any workspace +mutation as review failure — `status: "SUCCESS"` alone is not sufficient +evidence. + +### 5. Subscription auth only; quota is observable + +Review runs use the Google account sign-in (`oauth-personal`, Google AI Pro +subscription). `gemini-api-key`, `agent-platform` (Vertex/ADC) and any +pay-as-you-go route are out of scope and must not be configured. `agy -p +"/quota"` returns structured quota state (weekly + 5-hour windows per model +group, `remaining_fraction`, `reset_time`) usable by a future scheduler. + +## Consequences + +- `agy` resolves through mise on machines that applied pc-setup; the shim + fails closed with a clear message where mise has no `agy`. +- SSH-invoked `agy` (including future herdr/Rex workers) authenticates via + keyring as long as no SSH token file exists; a deliberate SSH login keeps + working through the token file. +- The read-only guarantee depends on the deny payload staying in sync with + `agy`'s permission action set (`read_file`, `write_file`, `command`, + `read_url`, `execute_url`, `mcp`, `unsandboxed`); new sensitive actions + upstream must be re-evaluated when bumping `agy`. +- Harness construction, herdr routing and quota scheduling are deferred to + #219. diff --git a/docs/adr/ADR-0023.md b/docs/adr/ADR-0023.md new file mode 100644 index 0000000..c0b0b91 --- /dev/null +++ b/docs/adr/ADR-0023.md @@ -0,0 +1,120 @@ +# 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 ` +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//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 + 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. +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 +(`\t