Skip to content

feat(harness): add Google Antigravity (agy) crewmate/scout adapter - #2186

Closed
nielsvandepavert wants to merge 5 commits into
kunchenguid:mainfrom
nielsvandepavert:fm/firstmate-antigravity-harness-q1
Closed

nielsvandepavert wants to merge 5 commits into
kunchenguid:mainfrom
nielsvandepavert:fm/firstmate-antigravity-harness-q1

Conversation

@nielsvandepavert

Copy link
Copy Markdown

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

  • Added Google Antigravity (agy, verified on Cloud Code Assist CLI 1.1.12) as a selectable --harness beside the existing adapters: fm-harness.sh detects it via the ANTIGRAVITY_AGENT marker with anchored exact-name ancestry as the guarantee; fm-spawn.sh builds the launch command (model/effort flags with the effort ceiling at high, foreign harness markers cleared, loud --secondmate refusal), pre-trusts the exact worktree path in agy's ~/.gemini/antigravity-cli/settings.json via a fail-closed surgical jq edit, and wires busy/idle through a per-task <worktree>/.agent/hooks.json registering only the no-decision PreInvocation (busy) and Stop (idle) events.
  • The trust entry does not outlive the task: fm-teardown.sh removes 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 in fm-spawn.sh retires it by worktree path so a pool-recycled worktree is never silently trusted; the trust-store path is owned by a new fm_control_harness_trust_store_path table in fm-control-lib.sh. Muse's launch template additionally clears ANTIGRAVITY_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.
  • Recorded the live-verified TUI behavior in docs/verification/antigravity.md, folded agy into the cross-harness docs and the harness-adapters skill, and added tests/fm-agy-harness.test.sh (17 adapter cases), an opt-in live drift guard tests/fm-agy-signals-live-e2e.test.sh, and a composer-matrix rule in tests/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)

=== 1. harness detection: ANTIGRAVITY_AGENT marker reports agy ===
$ ANTIGRAVITY_AGENT=1 bin/fm-harness.sh
agy


=== 2. precedence: a retained foreign marker (CLAUDECODE) outranks the agy marker ===
$ CLAUDECODE=1 ANTIGRAVITY_AGENT=1 bin/fm-harness.sh
claude


=== 3. fm-spawn: dispatch a crewmate on the agy harness (operator-visible output) ===
$ fm-spawn agy-demo-e1-19785 <project> --harness agy --mode no-mistakes --yolo off --model gemini-3.6-flash --effort high
warning: /var/folders/s4/7bvy9dmj1rv02rtk8w8kdl9h0000gn/T//fm-agy-demo.hipuQY/demo/home/data/agy-demo-e1-19785/brief.md records no delivery contract line (scaffolded before ship briefs recorded one); launching on the explicit --mode no-mistakes - confirm its definition of done matches
spawned agy-demo-e1-19785 harness=agy kind=ship mode=no-mistakes yolo=off window=firstmate:fm-agy-demo-e1-19785 worktree=/var/folders/s4/7bvy9dmj1rv02rtk8w8kdl9h0000gn/T//fm-agy-demo.hipuQY/demo/wt
exit=0

=== 4. the exact launch command typed into the task pane ===
env -u CLAUDECODE -u PI_CODING_AGENT -u GROK_AGENT -u FM_PI_HARNESS '/var/folders/s4/7bvy9dmj1rv02rtk8w8kdl9h0000gn/T//fm-agy-demo.hipuQY/demo/fake/fakebin/agy' --dangerously-skip-permissions --model 'gemini-3.6-flash' --effort 'high' -i "$('/Users/niels/.no-mistakes/worktrees/c025195bd40b/01KZRQKFJEJ7CTHXEFH2XRFB8D/bin/fm-operational-input.sh' encode launch-brief < '/var/folders/s4/7bvy9dmj1rv02rtk8w8kdl9h0000gn/T//fm-agy-demo.hipuQY/demo/home/data/agy-demo-e1-19785/brief.md')"

=== 5. agy's own trust store after spawn: worktree pre-trusted, foreign entries preserved ===
$ cat ~/.gemini/antigravity-cli/settings.json
{
  "trustedWorkspaces": [
    "/existing/workspace",
    "/var/folders/s4/7bvy9dmj1rv02rtk8w8kdl9h0000gn/T//fm-agy-demo.hipuQY/demo/wt"
  ],
  "userSettings": {
    "keep": "me"
  }
}

=== 6. per-task busy wiring agy loads from the trusted workspace: <worktree>/.agent/hooks.json ===
$ cat <worktree>/.agent/hooks.json
{
  "fm-busy-state": {
    "PreInvocation": [
      {
        "command": "'/Users/niels/.no-mistakes/worktrees/c025195bd40b/01KZRQKFJEJ7CTHXEFH2XRFB8D/bin/fm-busy-event.sh' apply '/private/var/folders/s4/7bvy9dmj1rv02rtk8w8kdl9h0000gn/T/fm-agy-demo.hipuQY/demo/home/state' 'agy-demo-e1-19785' busy --gen 'g1786463852.20005.14088' --source agy-hook --event pre-invocation >/dev/null 2>&1 || true; printf '{}'"
      }
    ],
    "Stop": [
      {
        "command": "touch '/private/var/folders/s4/7bvy9dmj1rv02rtk8w8kdl9h0000gn/T/fm-agy-demo.hipuQY/demo/home/state/agy-demo-e1-19785.turn-ended' 2>/dev/null; '/Users/niels/.no-mistakes/worktrees/c025195bd40b/01KZRQKFJEJ7CTHXEFH2XRFB8D/bin/fm-busy-event.sh' apply '/private/var/folders/s4/7bvy9dmj1rv02rtk8w8kdl9h0000gn/T/fm-agy-demo.hipuQY/demo/home/state' 'agy-demo-e1-19785' idle --gen 'g1786463852.20005.14088' --source agy-hook --event stop >/dev/null 2>&1 || true; printf '{}'"
      }
    ]
  }
}

=== 7. effort ceiling: --effort xhigh is omitted from the launch (agy rejects it), meta keeps the axis ===
$ fm-spawn agy-demo-e2-19785 <project> --harness agy --effort xhigh
warning: /var/folders/s4/7bvy9dmj1rv02rtk8w8kdl9h0000gn/T//fm-agy-demo.hipuQY/demo/home/data/agy-demo-e2-19785/brief.md records no delivery contract line (scaffolded before ship briefs recorded one); launching on the explicit --mode no-mistakes - confirm its definition of done matches
spawned agy-demo-e2-19785 harness=agy kind=ship mode=no-mistakes yolo=off window=firstmate:fm-agy-demo-e2-19785 worktree=/var/folders/s4/7bvy9dmj1rv02rtk8w8kdl9h0000gn/T//fm-agy-demo.hipuQY/demo/wt
exit=0
-- launch command (note: no --effort flag):
env -u CLAUDECODE -u PI_CODING_AGENT -u GROK_AGENT -u FM_PI_HARNESS '/var/folders/s4/7bvy9dmj1rv02rtk8w8kdl9h0000gn/T//fm-agy-demo.hipuQY/demo/fake/fakebin/agy' --dangerously-skip-permissions -i "$('/Users/niels/.no-mistakes/worktrees/c025195bd40b/01KZRQKFJEJ7CTHXEFH2XRFB8D/bin/fm-operational-input.sh' encode launch-brief < '/var/folders/s4/7bvy9dmj1rv02rtk8w8kdl9h0000gn/T//fm-agy-demo.hipuQY/demo/home/data/agy-demo-e2-19785/brief.md')"
-- recorded task meta effort axis:
effort=xhigh

=== 8. refusal: agy cannot serve as --secondmate ===
$ fm-spawn agy-demo-e3-19785 agy --secondmate
error: agy is a verified crewmate/scout adapter only and cannot run a secondmate; it has no primary supervision protocol. Select a harness verified for secondmates.
exit=1

=== 9. fm-teardown: the task's trust entry is retired, foreign settings survive ===
$ fm-teardown agy-demo-e1-19785 --force
/var/folders/s4/7bvy9dmj1rv02rtk8w8kdl9h0000gn/T/fm-agy-demo.hipuQY/demo/project: already current
teardown agy-demo-e1-19785 complete (window firstmate:fm-agy-demo-e1-19785, worktree /var/folders/s4/7bvy9dmj1rv02rtk8w8kdl9h0000gn/T//fm-agy-demo.hipuQY/demo/wt)
Backlog: agy-demo-e1-19785 just finished. Update data/backlog.md - move agy-demo-e1-19785 to Done, keep Done to the 10 most recent, then re-scan Queued and dispatch only work whose blockers are gone and date is due.
$ cat ~/.gemini/antigravity-cli/settings.json
{
  "trustedWorkspaces": [
    "/existing/workspace"
  ],
  "userSettings": {
    "keep": "me"
  }
}
Evidence: manual verification script that produced the transcript
#!/usr/bin/env bash
# Manual end-to-end evidence for the agy (Google Antigravity) crewmate adapter.
# Runs the real fm-spawn/fm-harness/fm-teardown CLIs against a sandboxed
# FM_HOME with a fake tmux pane (same shape the colocated tests use), and
# prints the operator-visible output plus the product state agy itself would
# consume: the launch command, the pre-trusted settings.json, and the per-task
# .agent/hooks.json.
set -u
WT_REPO="${1:?usage: agy-cli-demo.sh <firstmate-checkout>}"
cd "$WT_REPO" || exit 1
. "$WT_REPO/tests/lib.sh"

SPAWN="$ROOT/bin/fm-spawn.sh"
HARNESS="$ROOT/bin/fm-harness.sh"
TEARDOWN="$ROOT/bin/fm-teardown.sh"
TMP_ROOT=$(fm_test_tmproot fm-agy-demo)
JQ_BIN=$(command -v jq) || { echo "demo needs jq"; exit 1; }
BASE_PATH="$(dirname "$JQ_BIN"):/usr/bin:/bin:/usr/sbin:/sbin"

say() { printf '\n=== %s ===\n' "$*"; }
run() { printf '$ %s\n' "$*"; }

say "1. harness detection: ANTIGRAVITY_AGENT marker reports agy"
run "ANTIGRAVITY_AGENT=1 bin/fm-harness.sh"
env -u CLAUDECODE -u PI_CODING_AGENT -u GROK_AGENT ANTIGRAVITY_AGENT=1 "$HARNESS"; echo

say "2. precedence: a retained foreign marker (CLAUDECODE) outranks the agy marker"
run "CLAUDECODE=1 ANTIGRAVITY_AGENT=1 bin/fm-harness.sh"
env -u PI_CODING_AGENT -u GROK_AGENT CLAUDECODE=1 ANTIGRAVITY_AGENT=1 "$HARNESS"; echo

# --- sandboxed spawn fixture (fake tmux pane + stub agy binary) -------------
CASE_DIR="$TMP_ROOT/demo"
HOME_DIR="$CASE_DIR/home"
PROJ_DIR="$CASE_DIR/project"
WT_DIR="$CASE_DIR/wt"
FAKEBIN=$(fm_fakebin "$CASE_DIR/fake")
cat > "$FAKEBIN/tmux" <<'SH'
#!/usr/bin/env bash
set -u
case "$*" in
  *"#{pane_current_path}"*) printf '%s\n' "${FM_FAKE_PANE_PATH:-}"; exit 0 ;;
esac
case "${1:-}" in
  display-message) printf 'firstmate\n'; exit 0 ;;
  send-keys)
    prev=
    for arg in "$@"; do
      [ "$prev" = -l ] && { printf '%s\n' "$arg" >> "$FM_FAKE_LAUNCH_LOG"; break; }
      prev=$arg
    done
    exit 0 ;;
esac
exit 0
SH
chmod +x "$FAKEBIN/tmux"
fm_fake_exit0 "$FAKEBIN" treehouse gh-axi gh
fm_fake_exit0 "$FAKEBIN" agy
ln -s "$JQ_BIN" "$FAKEBIN/jq"

ID="agy-demo-e1-$$"
mkdir -p "$HOME_DIR/data/$ID" "$HOME_DIR/projects" "$HOME_DIR/state" "$HOME_DIR/config"
printf 'demo brief for agy\n' > "$HOME_DIR/data/$ID/brief.md"
fm_git_worktree "$PROJ_DIR" "$WT_DIR" wt-demo
touch "$HOME_DIR/state/.last-watcher-beat"
: > "$CASE_DIR/launch.log"

spawn() {
  local id=$1; shift
  HOME="$HOME_DIR" FM_ROOT_OVERRIDE='' FM_HOME="$HOME_DIR" \
    FM_STATE_OVERRIDE="$HOME_DIR/state" FM_DATA_OVERRIDE="$HOME_DIR/data" \
    FM_PROJECTS_OVERRIDE="$HOME_DIR/projects" FM_CONFIG_OVERRIDE="$HOME_DIR/config" \
    FM_SPAWN_NO_GUARD=1 FM_FAKE_PANE_PATH="$WT_DIR" TMUX="fake,1,0" \
    FM_FAKE_LAUNCH_LOG="$CASE_DIR/launch.log" \
    PATH="$FAKEBIN:$BASE_PATH" \
    "$SPAWN" "$id" "$PROJ_DIR" --harness agy "$@" 2>&1
}

SETTINGS="$HOME_DIR/.gemini/antigravity-cli/settings.json"
mkdir -p "$(dirname "$SETTINGS")"
printf '{"trustedWorkspaces":["/existing/workspace"],"userSettings":{"keep":"me"}}\n' > "$SETTINGS"

say "3. fm-spawn: dispatch a crewmate on the agy harness (operator-visible output)"
run "fm-spawn $ID <project> --harness agy --mode no-mistakes --yolo off --model gemini-3.6-flash --effort high"
spawn "$ID" --mode no-mistakes --yolo off --model gemini-3.6-flash --effort high
echo "exit=$?"

say "4. the exact launch command typed into the task pane"
cat "$CASE_DIR/launch.log"

say "5. agy's own trust store after spawn: worktree pre-trusted, foreign entries preserved"
run "cat ~/.gemini/antigravity-cli/settings.json"
"$JQ_BIN" . "$SETTINGS"

say "6. per-task busy wiring agy loads from the trusted workspace: <worktree>/.agent/hooks.json"
run "cat <worktree>/.agent/hooks.json"
"$JQ_BIN" . "$WT_DIR/.agent/hooks.json"

say "7. effort ceiling: --effort xhigh is omitted from the launch (agy rejects it), meta keeps the axis"
ID2="agy-demo-e2-$$"
mkdir -p "$HOME_DIR/data/$ID2"
printf 'demo brief\n' > "$HOME_DIR/data/$ID2/brief.md"
run "fm-spawn $ID2 <project> --harness agy --effort xhigh"
: > "$CASE_DIR/launch.log"
spawn "$ID2" --mode no-mistakes --yolo off --effort xhigh
echo "exit=$?"
echo "-- launch command (note: no --effort flag):"
cat "$CASE_DIR/launch.log"
echo "-- recorded task meta effort axis:"
grep '^effort=' "$HOME_DIR/state/$ID2.meta"

say "8. refusal: agy cannot serve as --secondmate"
ID3="agy-demo-e3-$$"
mkdir -p "$HOME_DIR/data/$ID3"
printf 'charter\n' > "$HOME_DIR/data/$ID3/brief.md"
run "fm-spawn $ID3 agy --secondmate"
( cd "$CASE_DIR" && HOME="$HOME_DIR" FM_ROOT_OVERRIDE='' FM_HOME="$HOME_DIR" \
  FM_STATE_OVERRIDE="$HOME_DIR/state" FM_DATA_OVERRIDE="$HOME_DIR/data" \
  FM_PROJECTS_OVERRIDE="$HOME_DIR/projects" FM_CONFIG_OVERRIDE="$HOME_DIR/config" \
  FM_SPAWN_NO_GUARD=1 TMUX="fake,1,0" PATH="$FAKEBIN:$BASE_PATH" \
  "$SPAWN" "$ID3" agy --secondmate 2>&1 )
echo "exit=$?"

say "9. fm-teardown: the task's trust entry is retired, foreign settings survive"
run "fm-teardown $ID --force"
HOME="$HOME_DIR" FM_ROOT_OVERRIDE="$ROOT" FM_HOME="$HOME_DIR" \
  FM_STATE_OVERRIDE="$HOME_DIR/state" FM_DATA_OVERRIDE="$HOME_DIR/data" \
  FM_PROJECTS_OVERRIDE="$HOME_DIR/projects" FM_CONFIG_OVERRIDE="$HOME_DIR/config" \
  FM_SPAWN_NO_GUARD=1 PATH="$FAKEBIN:$BASE_PATH" \
  "$TEARDOWN" "$ID" --force 2>&1 | tail -3
run "cat ~/.gemini/antigravity-cli/settings.json"
"$JQ_BIN" . "$SETTINGS"

rm -rf "/tmp/fm-$ID" "/tmp/fm-$ID2" "/tmp/fm-$ID3" "$TMP_ROOT"

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 2 infos
  • ⚠️ 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 &gt;-pair composer matrix rule
  • bin/fm-test-run.sh tests/fm-muse-harness.test.sh at target AND at base commit 76355e2 (temp git archive extraction) — 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 &lt;id&gt; &lt;proj&gt; --harness agy --model gemini-3.6-flash --effort high capturing the exact pane launch command, pre-trusted ~/.gemini/antigravity-cli/settings.json (foreign entries preserved), and generated &lt;worktree&gt;/.agent/hooks.json (exactly PreInvocation/Stop, printf &#39;{}&#39; terminators); --effort xhigh omitted from launch while meta retains effort=xhigh; loud --secondmate refusal (exit 1); fm-teardown --force retiring only the task's trust entry
  • Opt-in live drift guard tests/fm-agy-signals-live-e2e.test.sh deliberately 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.

⚠️ **Lint** - 1 warning
  • ⚠️ linter found issues (exit code 127)
✅ **Push** - passed

✅ No issues found.

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).
@devin-ai-integration

Copy link
Copy Markdown

Closed as superseded — this work already landed on main via #4200.

— Kun's Firstmate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant