Repository navigation
feat(harness): add Google Antigravity (agy) crewmate/scout adapter - #2186
Closed
nielsvandepavert wants to merge 5 commits into
Closed
nielsvandepavert wants to merge 5 commits into
nielsvandepavert wants to merge 5 commits into
Conversation
Verified live on agy 1.1.12 (docs/verification/antigravity.md) and wired as a crewmate/scout adapter beside the existing verified set: - fm-spawn: -i launch template with --dangerously-skip-permissions, foreign marker clearing, --model plus a low|medium|high --effort ceiling, a jq pre-trust of the worktree in agy's settings.json (fail-closed, because workspace hooks only load when the workspace is trusted at launch), and a per-task .agent/hooks.json wiring PreInvocation->busy and Stop->idle plus the turn-ended touch; --secondmate is refused like muse. - fm-harness: ANTIGRAVITY_AGENT marker fast path plus anchored agy ancestry. - fm-busy-lib: agy-hook trusted source with the interrupt and fullyIdle caveats documented at the owner. - fm-control-lib: interrupt/exit/kind/wiring tables; teardown and relaunch retire the hook file. - fm-composer-lib: the separated pair now accepts a live agy identity so the shell-glyph prompt row proves empty only with structure plus identity; the tmux identity probe and delivery busy regex learn agy. - tests: fm-agy-harness.test.sh (portable), an agy composer matrix case, and the opt-in fm-agy-signals-live-e2e.test.sh drift guard (passed live).
This was referenced Sep 2, 2026
|
Closed as superseded — this work already landed on main via #4200. — Kun's Firstmate |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Add and authorize Google Antigravity (agy, the Cloud Code Assist CLI, verified on version 1.1.12) as a selectable firstmate crewmate/scout harness beside claude, codex, opencode, pi, pi-signed, grok, kimi, and muse. The brief required empirically verifying the interactive TUI before wiring (no invented facts), and every recorded fact was verified live: busy/idle signals, interrupt, exit/resume, trust dialogs, skill invocation, model/effort launch flags, env markers, and composer shape, recorded in docs/verification/antigravity.md plus a passed opt-in live drift guard (tests/fm-agy-signals-live-e2e.test.sh). This branch already carries two captain-approved pipeline fix commits from the prior validation run, which are deliberate and accepted: (a) muse's launch template additionally clears ANTIGRAVITY_AGENT so the new marker cannot misidentify a markerless muse pane, and (b) teardown surgically removes the task worktree's exact pre-trust entry from agy's settings via the new fm_control_harness_trust_store_path table (captain chose teardown removal over accepting accumulation; the removal deliberately fails closed - loud refusal for a rerun - on symlinked, jq-less, or malformed settings, and the concurrent-spawn read-modify-write race stays accepted as a fail-closed spurious refusal, no lock). It also carries an approved docs commit folding agy into cross-harness behavior inventories. Deliberate decisions the reviewer should not flag as mistakes: (1) fm-spawn pre-trusts the exact worktree path in agy's own ~/.gemini/antigravity-cli/settings.json via a surgical fail-closed jq edit, because agy's workspace hook files only load when the workspace was already trusted at launch and --dangerously-skip-permissions does not suppress the trust dialog; a spawn that cannot prove trust refuses rather than arming a busy record with no writer. (2) Busy wiring is one per-task workspace hook file at /.agent/hooks.json - the singular .agent/ root is chosen so a project's own .agents/hooks.json is never touched (agy merges both roots); the spawn refuses if the project tracks .agent/hooks.json; only the flat no-decision events PreInvocation (busy) and Stop (idle plus turn-ended touch) are registered because a PreToolUse hook returning {} was verified to DENY tool calls; each hook command ends with printf '{}'. (3) Every Stop records idle even with fullyIdle=false, deliberately: gating idle on fullyIdle could latch a permanent busy under a long-lived background dev server, and interrupts fire no hook at all (the same documented claude gap). (4) The effort ceiling is high, not xhigh: agy rejects xhigh/max at launch, so fm-spawn omits them like grok; the model-conditional --effort validity is intake knowledge in the harness-adapters skill, not a static filter, because wrong pairings fail loudly at spawn. (5) --secondmate on agy is refused loudly like muse: no verified primary supervision protocol. (6) The launch template clears foreign harness markers because a retained foreign marker outranks agy ancestry in fm-harness.sh's documented precedence order; ANTIGRAVITY_AGENT=1 is a fast path and anchored exact-name agy ancestry is the guarantee, never a agy glob. (7) The shared composer classifier's separated pair now also accepts a live agy identity: agy draws the pi rule pair around a bare '>' SHELL glyph, so the pair alone must never prove the composer (a dead shell's PS2 prompt is the same byte); agy rows classify under the bordered content rules while pi's glyphless rows keep their any-text-is-pending rule. (8) The tmux 'esc to cancel' busy regex is a delivery guard only, never a state source, with its popup and background-task ambiguities documented. (9) The teardown dirty-check exception uses the directory-level .agent/ pattern matching the .claude/ precedent because git status collapses untracked directories. (10) Skill invocation for agy is natural language only - claude user-level skills are not discovered and an unknown /command errors inline. (11) Standing defaults are unchanged: agy is selectable via explicit --harness/dispatch only. Delivery path: the captain has no write access to upstream kunchenguid/firstmate, so the branch is pushed to the fork nielsvandepavert/firstmate and the PR opens against upstream kunchenguid/firstmate (the gate's recorded remote/fork split); report the PR URL when CI is green and do not merge. Constraints: do not break the existing adapters; keep AGENTS.md changes minimal per the one-owner rule; colocated tests shellcheck-0.11.0 clean; no secrets in git, logs, or argv. The lint step's ShellCheck binary is absent in the daemon environment (exit 127, environmental) - every changed shell file was verified clean against pinned ShellCheck 0.11.0 locally at this exact head, and CI re-verifies with its own pinned install. Two locally-failing suites (fm-muse-harness detection, fm-teardown herdr-preflight) were verified pre-existing environmental failures at the base commit on this macOS machine and are unrelated.
What Changed
agy, verified on Cloud Code Assist CLI 1.1.12) as a selectable--harnessbeside the existing adapters:fm-harness.shdetects it via theANTIGRAVITY_AGENTmarker with anchored exact-name ancestry as the guarantee;fm-spawn.shbuilds the launch command (model/effort flags with the effort ceiling athigh, foreign harness markers cleared, loud--secondmaterefusal), pre-trusts the exact worktree path in agy's~/.gemini/antigravity-cli/settings.jsonvia a fail-closed surgical jq edit, and wires busy/idle through a per-task<worktree>/.agent/hooks.jsonregistering only the no-decisionPreInvocation(busy) andStop(idle) events.fm-teardown.shremoves the task worktree's exact entry from the agy trust store (fail-closed loud refusal on symlinked, malformed, or jq-less settings), and a harness-switch relaunch infm-spawn.shretires it by worktree path so a pool-recycled worktree is never silently trusted; the trust-store path is owned by a newfm_control_harness_trust_store_pathtable infm-control-lib.sh. Muse's launch template additionally clearsANTIGRAVITY_AGENT, and the shared composer classifier accepts a live agy identity for the separated>pair so agy rows classify under the bordered content rules without weakening pi's.docs/verification/antigravity.md, folded agy into the cross-harness docs and the harness-adapters skill, and addedtests/fm-agy-harness.test.sh(17 adapter cases), an opt-in live drift guardtests/fm-agy-signals-live-e2e.test.sh, and a composer-matrix rule intests/fm-composer-lib.test.sh— the adapter and composer suites pass locally, with the lint step's exit 127 being an environmental missing ShellCheck binary (changed files verified clean against pinned ShellCheck 0.11.0 locally).Risk Assessment
✅ Low: The round-1 trust-lifetime gap is durably closed at both the teardown (path-keyed removal) and relaunch (wiring-retirement) boundaries with a dedicated regression test pinning the post-switch case, the failing sequence is no longer reachable, and the only remaining observations are informational tradeoffs inherent to the instructed design.
Testing
Ran the new agy adapter behavior suite and the updated composer-lib suite (both green), confirmed the muse suite failure reproduces identically at the base commit so it is pre-existing environmental and unrelated, and captured a manual end-to-end CLI transcript showing detection, the verified launch command, trust-store pre-trust and teardown retirement, hook-file wiring, effort-ceiling omission, and the secondmate refusal; the opt-in live agy e2e was not run because it spends real model quota and edits the operator's user-level agy trust store, which the intent records as already passed at this head.
Evidence: agy end-to-end CLI transcript (spawn, trust store, hooks, refusals, teardown)
Evidence: manual verification script that produced the transcript
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
bin/fm-teardown.sh:2574- The agy trust entry outlives the task on a harness-switch relaunch, contradicting the claimed invariant. Teardown gates removal on the currently recorded harness: remove_agy_workspace_trust "$(meta_value "$META" harness)" (fm-teardown.sh:2574, and fm-teardown.sh:2294 for children) returns 0 unless meta says harness=agy. Concrete sequence: (1) spawn --harness agy pre-trusts the worktree in trustedWorkspaces (fm-spawn.sh:2403); (2) an ordinary supported relaunch onto claude (docs/agent-control.md treats harness switch as one ordinary relaunch) rewrites meta harness=claude, and clear_relaunch_harness_wiring (fm-spawn.sh:801) removes only .agent/hooks.json from the fm_control_harness_wiring_paths table — it never touches the trust store; (3) teardown sees harness=claude and skips removal, so the exact worktree path stays trusted forever and a pool-recycled worktree at that path is silently trusted by a future agy session — the precise hazard the captain-approved teardown removal was accepted to close ("the trust entry does not outlive the task", captain chose removal over accumulation). Earliest supported shared boundary: retire the agy trust entry inside clear_relaunch_harness_wiring when the PRIOR harness family is agy (the prior-harness knowledge only exists there; a same-harness agy relaunch immediately re-adds the entry via the wiring pretrust), keeping teardown's removal as the end-of-life owner.bin/fm-spawn.sh:2403- A spawn that fails after agy_pretrust_workspace succeeds but before the task record lands (busy-arm failure at fm-spawn.sh:2411, or any later backend/launch failure) exits without unwinding the trust entry, and a failed spawn may leave no meta for teardown to retire it, so entries can accumulate on abnormal spawn failures. The relaunch unwind trap (RELAUNCH_REPLACEMENT_*) likewise restores wiring and busy gen but not the trust entry. Narrow window, entries are for firstmate-populated paths, and pretrust is idempotent (jq unique) — noting it as a bounded residue of the same trust-lifetime invariant rather than a blocker.bin/fm-spawn.sh:1155- ANTIGRAVITY_AGENT joins the pre-existing inherited-marker hazard for the markerless harnesses: only muse's launch template was updated to clear it (fm-spawn.sh:1156, the captain-approved fix), while the codex, opencode, and kimi launch templates clear no foreign markers, so a codex/opencode/kimi crewmate spawned from within an agy pane environment could be misdetected as agy by fm-harness.sh's marker precedence. The code comment at fm-spawn.sh:1155 explicitly documents this shared hazard and defers changing those verified launch boundaries to follow-up work, consistent with the approved scope — recorded here so the follow-up has a pointer.🔧 Fix: retire agy trust entry by worktree path across harness switches
2 infos still open:
bin/fm-spawn.sh:1395- The fail-closed trust-entry removal logic is now duplicated: agy_retire_workspace_trust (bin/fm-spawn.sh:1395) and remove_agy_workspace_trust (bin/fm-teardown.sh:682) are near-identical ~30-line surgical jq edits (symlink/jq/valid-JSON refusals, entry check, write, prove-gone) that already differ in one error-message suffix ('retry' vs 'rerun teardown'). Both scripts source bin/fm-control-lib.sh, which was deliberately made the one owner of the trust-store path (fm_control_harness_trust_store_path), so a single shared removal helper there would keep the two retirement sites drift-free. Follow-up simplification only; behavior is correct and test-pinned as is, and the local-helper placement follows the round-1 fix instruction.bin/fm-teardown.sh:682- Dropping the harness gate widens the fail-closed surface to non-agy teardowns: remove_agy_workspace_trust now runs for every task, and when ~/.gemini/antigravity-cli/settings.json exists but is a symlink, malformed JSON, or jq is absent, the teardown of a task that never used agy refuses loudly (bin/fm-teardown.sh:682-700). Non-agy teardowns are behavior-identical only when the store is absent or healthy. This is the direct consequence of the instructed path-keyed design (an exact-path entry can only come from firstmate's own pre-trust, and checking entry absence requires parsing the store) and matches the captain-accepted loud-refusal posture; recorded so the tradeoff is explicit.✅ **Test** - passed
✅ No issues found.
bin/fm-test-run.sh tests/fm-agy-harness.test.sh tests/fm-composer-lib.test.sh— all cases pass, including the 17 agy adapter cases and the new agy>-pair composer matrix rulebin/fm-test-run.sh tests/fm-muse-harness.test.shat target AND at base commit 76355e2 (tempgit archiveextraction) — fails identically at both, confirming the intent's pre-existing-environmental claim (macOS kills the relocated bash copy)Manual end-to-end CLI verification via sandboxed FM_HOME + fake tmux pane:ANTIGRAVITY_AGENT=1 bin/fm-harness.sh→ agy; foreign-marker precedence (CLAUDECODE outranks agy marker);fm-spawn <id> <proj> --harness agy --model gemini-3.6-flash --effort highcapturing the exact pane launch command, pre-trusted~/.gemini/antigravity-cli/settings.json(foreign entries preserved), and generated<worktree>/.agent/hooks.json(exactly PreInvocation/Stop,printf '{}'terminators);--effort xhighomitted from launch while meta retainseffort=xhigh; loud--secondmaterefusal (exit 1);fm-teardown --forceretiring only the task's trust entryOpt-in live drift guardtests/fm-agy-signals-live-e2e.test.shdeliberately NOT run: it launches the real installed agy, spends model quota, and temporarily edits the operator's user-level agy trust store outside the workspace boundary; the intent records it passed at this head✅ **Document** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.