Repository navigation
feat: add verified Antigravity CLI worker adapter - #4327
Adityarajkishan wants to merge 81 commits into
Conversation
…ead footer matchers
…ost composer selection
… failure evidence
|
Speaking as Kun's firstmate: first look on fork PR #4327 (Adityarajkishan). Head Attestation: MATCH (body Contract-class: opt-in — harness= VISION.md per-rule
Overlaps: open agy adapters #4200 (this pass), #4086 (CONFLICTING), #3858 (MERGEABLE/CLEAN; older sibling) — leave siblings; no competing port from triage. CI/NM: First-time fork tip runs approved this pass after diff review: CI Security FYI (tip only, not waiting-captain): launch uses |
|
Speaking as Kun's firstmate: closing as leftover after overlapping agy adapter #4200 landed (squash |
Intent
Add a verified Antigravity CLI (agy) harness adapter for crewmate and scout use only, so firstmate can dispatch and supervise agy workers: detect a running agy session through its measured ANTIGRAVITY_AGENT=1 child marker, launch with --prompt-interactive and --dangerously-skip-permissions, read busy state from agy's native Stop and tool-use hooks loaded from a firstmate-owned settings path (never the worktree's own config), recognise the composer including real unsent and multiline drafts so steering never merges with or overwrites a draft, keep unconfirmed interrupts as unknown rather than idle, retire every generated hook artifact on teardown and on fresh-spawn rollback without widening deletion for any other harness, refuse --secondmate exactly as muse and gemini do, and prove all harness-dependent behaviour with both a portable regression and an fm_live_gate live guard against the real binary, with dated measurements owned by docs/verification/agy.md. Antigravity's quota windows are unreadable by quota-axi, so an agy candidate in a dispatch profile must remain eligible with disclosed uncertainty and never fail as an unknown harness, without adding any quota model for it.
What Changed
agy) adapter for crewmate and scout workers, including marker-based detection, interactive launch flags, firstmate-owned hooks, draft-safe composer handling, conservative interrupts, and scoped teardown cleanup.Risk Assessment
Testing
The live AGY 1.2.2 composer, liveness/marker, and lifecycle surfaces passed. The portable regression scenarios remain untested under the live-validation contract.
Evidence: AGY lifecycle width 80
ok - agy (1.2.2): canonical spawn, hooks, doorbell, control/data interrupts, Stop, exit, and teardown passedEvidence: AGY composer matrix
ok - agy (1.2.2): real unsent draft stays pending with styled and cursorless signalsEvidence: AGY liveness and marker
ok - harness marker: agy 1.2.2 exports ANTIGRAVITY_AGENT=1 and detects as agy from a tool processEvidence: AGY lifecycle widths 120 and 220
Lifecycle also passed at widths 120 and 220.Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 4 issues found → auto-fixed (20) ✅
bin/fm-control.sh:502- When AGY has an unsent draft, the preflight returnsagy-preflight:pendinganddo_exitimmediately refuses at lines 502-507, without recording the draft, clearing the composer, reclassifying it, or sending/quit. This leaves the worker alive; implement the approved clear-and-note exit sequence while retaining refusal for unknown or uncleared states.bin/fm-composer-lib.sh:173- The final AGY composer check collapses repeated spaces and converts newlines to spaces before comparing. Thus distinct literal content such asfoo barversusfoo bar, or multiline text versus a space-separated draft, compares equal and can send Enter for content different from the requested text. Preserve significant whitespace in the verification contract.docs/verification/agy.md:275- The required criterion is to prove all harness-dependent behavior with portable regressions and passing live guards. The committed record still shows the composer guard exiting 1 at line 275, the doorbell guard exiting 1 at line 288, and the lifecycle guard failing at line 300; the portable command at line 118 pipes throughtail -1, masking the test process's exit status. Complete and record passing post-fix evidence, or explicitly authorize containment.docs/verification/agy.md:53- The current AGY 1.2.2 verification section repeats a version command whose recorded output is1.2.0, contradicting the section heading and current-version statement. Move this block into clearly labeled historical evidence or update it to the current measurement.🔧 Fix applied.
4 issues (2 errors, 2 warnings) still open:
bin/fm-composer-lib.sh:1433- AGY composer extraction collapses significant whitespace viaawk '{$1=$1; ...}'. A pending draft such asfoo baris logged asfoo barbefore C-u clears the original, losing user data and causing valid comparisons to mismatch. Preserve AGY content exactly, apart from wrapping normalization.docs/verification/agy.md:280- The required criterion is to prove all harness-dependent behavior with portable regressions and an fm_live_gate guard against the real binary. The committed AGY doorbell guard explicitly fails (acted=no acked=no) and the canonical lifecycle guard never launches because the Treehouse pool rejects stale origin metadata. These records do not establish the required current live proof.docs/verification/agy.md:305- The new C-u evidence is not reproducible from its recorded command: lines 305–308 only run tmux commands andfm_tmux_composer_state, which cannot emit the labeledversion=,before_clear=,clear_key=, andafter_clear=output shown below. Re-record this measurement with a self-contained command and exact output.bin/fm-pending-reply-lib.sh:796- Simplification:fm_pending_reply_backend_observationis explicitly a secondmate-only path, but AGY is explicitly refused for--secondmate. The new AGY-specific deep-capture branch is therefore outside the stated intent and its test adds an unneeded parallel rule; remove both rather than expanding secondmate behavior.🔧 Fix applied.
2 issues (1 error, 1 warning) still open:
docs/verification/agy.md:280- The intent requires live proof against the real binary, but the current 1.2.2 record still shows the AGY doorbell guard failing (acted=no acked=no) and the lifecycle guard failing before spawn; the composer matrix also exits 1 for recorded Claude/Codex failures. Replace these with current passing evidence or explicitly record the environment blocker.bin/backends/zellij.sh:560- The fixer broadened zellij's comparison normalization to every harness. A long unbroken non-AGY message wraps into rows that extraction joins with spaces, soafterno longer equals the unbroken expected text; submission reportssend-failedbefore Enter and leaves the typed text in the composer. Revert this prior-round broadening to the minimal AGY-only comparison change.🔧 Fix applied.
1 warning still open:
bin/fm-spawn.sh:1800- The raw-launch guard misses append assignments such asexport ANTIGRAVITY_AGENT+=1; the marker is then restored after the outer scrub and can misidentify an unverified child as AGY. Reject+=variants for the reserved-marker assignment forms.🔧 Fix applied.
1 error still open:
bin/fm-composer-lib.sh:1429- AGY submit verification treats visual line wrapping as a literal space.fm_composer_extract_selected_contentjoins every extracted composer row with a space, whilefm_backend_agy_composer_matchespreserves interior whitespace and compares exactly with the original text. On a narrow pane, long doorbells or steering commands therefore returnagy-draft-conflictbefore Enter and are deferred instead of delivered. Make comparison aware of renderer-inserted wrapping without collapsing intentional spaces in real multiline drafts.🔧 Fix applied.
2 issues (1 error, 1 warning) still open:
docs/verification/agy.md:294- The intent requires a live guard proving all harness-dependent behavior, including the inbox doorbell. WhenFM_AGY_LIFECYCLE_LIVE_E2E=1, the test skipscheck_harness_doorbell, and the canonical lifecycle contains no inbox record,fm_task_inbox_ring, acted-file, or handled-file assertion; therefore the documented pass does not prove AGY doorbell behavior. Add that operation/assertion or record a passing standalone AGY doorbell run.docs/verification/runtime-backends.md:1808- This maintainer summary says the current AGY doorbell and lifecycle guards remain unresolved, contradicting the current verification record's documented 1.2.2 lifecycle pass. Update it to reflect the lifecycle result and separately state that the standalone doorbell guard was not rerun.🔧 Fix applied.
2 issues (1 error, 1 warning) still open:
docs/verification/agy.md:272- The intent requires portable and live proof of all harness behavior. The record says the lifecycle output predates the new doorbell assertion and post-fix live runs were not executed, so AGY doorbell behavior lacks required live evidence. Re-run both documented widths or approve the missing proof.tests/fm-send-inbox-doorbell-live-e2e.test.sh:298-fm-send.shalready rings the inbox, then this guard rings the same record again. If the first ring acts and moves the record tohandled/, the second ring may fail while lines 299-310 still pass on the pre-existing acted/handled files. Ensure the assertion only observes effects from the explicit ring.🔧 Fix applied.
2 issues (1 error, 1 warning) still open:
docs/verification/agy.md:292- The required criterion is to “prove all harness-dependent behaviour with both a portable regression and an fm_live_gate live guard against the real binary, with dated measurements owned by docs/verification/agy.md.” The current record still contains a placeholder for the post-fix lifecycle runs and only documents pre-doorbell-assertion output, so the new exactly-one-doorbell and pending-composer exit behavior is not live-proven.bin/fm-composer-lib.sh:745- The AGY scanner accepts any two U+2500 boundary rows without requiring equal widths. A real screen containing a 72-column composer boundary followed by an unrelated 16-column rule can therefore be classified as a valid empty AGY composer, allowing input to be sent into an unproven region. Require the paired boundaries to have matching widths.🔧 Fix applied.
3 issues (1 error, 2 warnings) still open:
docs/verification/agy.md:292- The intent requires “prove all harness-dependent behaviour with both a portable regression and an fm_live_gate live guard against the real binary, with dated measurements owned by docs/verification/agy.md.” The current record says the post-fix AGY 1.2.2 run failed at the doorbell step, and lines 295-299 still contain placeholders; the only passing lifecycle output is explicitly pre-doorbell. This required acceptance proof is still missing.bin/fm-composer-lib.sh:1115-_fm_composer_agy_busy_scopeaccepts any two U+2500 rows without checking equal widths, unlike the main AGY composer scanner. A capture containing a 72-column composer boundary, its busy footer, and a later 16-column rule is treated as a valid pair; the busy footer is excluded from the returned scope, so tmux or Herdr rendered-state checks can report idle while AGY is busy. Require equal-width boundaries here as well and fail closed on mismatch.bin/fm-spawn.sh:1800- The raw-launch guard only rejectsANTIGRAVITY_AGENTassignments containing=, so a command such assh -c '. /operator/sets-marker; export ANTIGRAVITY_AGENT; exec custom-agent'is accepted. The outerenv -u ANTIGRAVITY_AGENTscrub is bypassed when the raw shell sources a value and then exports it, allowing the child to be detected as verified AGY. Reject the documented bareexport ANTIGRAVITY_AGENTform while continuing to allow marker-name arguments.🔧 Fix applied.
2 issues (1 error, 1 warning) still open:
docs/verification/agy.md:271- The authoritative intent requires proof of all harness-dependent behavior with both a portable regression and an fm_live_gate run against the real binary, with dated measurements in this document. The current record says the doorbell guard was not rerun, the lifecycle run predates the assertion, the post-fix live output is absent, and the latest narrow-pane run failed; the required current lifecycle/doorbell proof is therefore missing.bin/fm-composer-lib.sh:1487- AGY wrap comparison derives a terminal content width, but${#content}counts locale characters or bytes rather than terminal display cells. In a 72-column composer, a visually full row containing 66 ASCII characters plus one width-2 CJK character has length 67, while a following full 68-ASCII row has length 68; the first row is not recognized as full, so a space is inserted and an exact multiline draft is incorrectly returned asagy-draft-conflict. Compare display-cell widths when deciding whether rows were wrapped mid-token.🔧 Fix applied.
2 errors still open:
bin/fm-composer-lib.sh:1360- With no cursor,_fm_composer_select_agy_cursorlessignoresFM_COMPOSER_SCAN_AGY_AMBIGUOUS. A capture with three U+2500 boundary rows can select the first pair and classify an unproven composer as empty or pending, allowing a ring or steer to touch it. Reject ambiguous captures before selecting the AGY pair.docs/verification/agy.md:298- Required real-binary proof is still absent: the document records no post-fix lifecycle output and leaves the default-width and 80-column results as a placeholder at lines 298-302. Current 1.2.2 lifecycle evidence is therefore insufficient to prove the fixed AGY doorbell behavior.🔧 Fix applied.
2 issues (1 error, 1 warning) still open:
docs/verification/agy.md:298- The authoritative intent requires proof of all harness-dependent behavior with both a portable regression and an fm_live_gate live guard against the real binary, with dated measurements in docs/verification/agy.md. The document explicitly says no post-fix live output is recorded and leaves the 220/120/80 results as a placeholder; the recorded 220 and 80 results predate the boundary-filtering fix.bin/fm-teardown.sh:2941- Simplification: teardown adds a second implementation of the AGY ownership-proof and cleanup rule already implemented in bin/fm-spawn.sh. The intent requires teardown cleanup, but not parallel definitions; remove this duplicate component and retain one shared implementation so the safety invariant cannot drift.🔧 Fix applied.
2 issues (1 error, 1 warning) still open:
bin/fm-backend.sh:806- The intent requires “recognise the composer including real unsent and multiline drafts so steering never merges with or overwrites a draft.” The shared AGY preflight checks for an empty composer atbin/fm-backend.sh:806-812, but the tmux path then types atbin/fm-tmux-lib.sh:300and only afterward compares the composer at lines 301-308. If a human types a draft between those operations, firstmate's text is appended to that draft before the conflict is detected. Establish an atomic/exclusive pre-send invariant; the synchronization remedy needs explicit authorization.bin/fm-backend.sh:941- Simplification:fm_backend_agy_composer_matchesis newly introduced but has no call sites; all current callers usefm_backend_agy_composer_contentor inline comparisons. The intent requires composer protection, not this unused parallel helper. Remove the unrequired component.🔧 Fix applied.
1 error still open:
bin/backends/zellij.sh:548- The AGY Zellij submit path does not reuse the supported plain-screen fallback. Composer state falls back when ANSI capture is unavailable, but composer content always calls ANSI-only capture. On such a Zellij version, AGY preflight may accept an empty composer, then the send path fails before Enter, so steering and inbox delivery never submit. Reuse the plain fallback and preserve its styled capability flag.🔧 Fix applied.
2 issues (1 error, 1 warning) still open:
bin/fm-control.sh:335- A multiline AGY draft is appended directly to the line-oriented status log, so a draft such asfirst\nsecondcreates a valid note followed by an unstructuredsecondwake event. Serialize embedded newlines while preserving the draft text before appending.docs/verification/agy.md:297- The required criterion is to “prove all harness-dependent behaviour with both a portable regression and an fm_live_gate live guard against the real binary, with dated measurements owned by docs/verification/agy.md.” The recorded live evidence is explicitly from gate tip30f3d426, but the final target adds later cleanup-helper and Zellij fallback changes (7e10435,26ab875,d4f081c), so it does not prove the final implementation. Re-run or clearly qualify the evidence against the final tip.🔧 Fix applied.
1 error still open:
docs/verification/agy.md:394- The required criterion is to “prove all harness-dependent behaviour with both a portable regression and an fm_live_gate live guard against the real binary, with dated measurements owned by docs/verification/agy.md.” The document says its live evidence is from older tip30f3d426while the reviewed target is451cce13, and leavesfinal-tip live re-run: <pending>at this line. Add final-tip evidence or explicitly authorize accepting the older proof.🔧 Fix applied.
1 error still open:
docs/verification/agy.md:394- The target changes the lifecycle guard by adding a pre-doorbell completion wait and extending the acted/acknowledged timeout, but the recorded “final-tip” evidence is explicitly from gate tip 451cce1, not the reviewed target 13ad48d. Re-run the required live guards against the final target and update both verification documents, or explicitly authorize accepting the older evidence.🔧 Fix applied.
2 issues (1 error, 1 warning) still open:
docs/verification/agy.md:394- The authoritative intent requires proving all harness-dependent behavior with a portable regression and an fm_live_gate run against the real binary. The target changes the lifecycle guard ordering in tests/fm-send-inbox-doorbell-live-e2e.test.sh, but docs/verification/agy.md:394-412 explicitly records evidence from the pre-change tip and leaves the final-tip rerun pending. Re-run the lifecycle guard against this target and record its dated output, or explicitly authorize the older evidence.tests/fm-send-inbox-doorbell-live-e2e.test.sh:278- The reworked lifecycle guard initializes busy=0 and only sets it after observing the transient state=busy record. A valid fast READY response can trigger the Stop hook and replace the seeded busy record with state=idle before the first poll, leaving busy=0 forever and causing a false failure at the idle/empty check. Treat the fresh spawn seed as sufficient or accept the observed idle/empty state directly.🔧 Fix applied.
2 errors still open:
bin/fm-composer-lib.sh:1478- The AGY compare path drops empty composer rows at line 1452 and skips blank rows again at line 1478. A draft containingfirst, a blank line, andsecondis reduced to the same rows asfirst\nsecond, so the expected-match check succeeds and Enter can submit an altered multiline draft. Preserve empty row structure in AGY comparisons, including trailing blank rows.docs/verification/agy.md:412- The intent requires dated live proof against the real binary. The document states at line 412 that its evidence predates the lifecycle-guard ordering change in this target and that the final-tip rerun is pending, so the reviewed lifecycle guard has no recorded final-tip proof. Record the final-target live result or explicitly authorize accepting the older evidence.🔧 Fix applied.
5 issues (4 errors, 1 warning) still open:
docs/verification/agy.md:412- The required live-proof criterion is not met: docs/verification/agy.md:394-412 records evidence from gate tip 13ad48d before the lifecycle-guard changes and explicitly leaves the final-tip rerun pending. Record current-target passing evidence or authorize the older evidence.bin/fm-composer-lib.sh:1561- With harness=agy, a valid AGY pair whose cursor is outside the pair can fall through at line 1561 to generic boxed/other composer candidates. This can classify an unrelated composer as empty or pending, contrary to the exact AGY-only proof requirement. Return unknown whenever the cursor is outside the AGY pair.bin/fm-composer-lib.sh:748- The scanner resets its boundary count when it sees a wider rule, so a valid 72-row pair followed by a valid 80-row pair is reduced to the widest pair and accepted instead of becoming ambiguous. The required contract says exactly two measured boundary rows are valid and three-plus must be unknown; clarify or enforce that contract.bin/fm-backend.sh:806- The shared AGY preflight checks for empty input, then releases control before backend literal typing. If a human types between those operations, firstmate's text can be inserted into or appended to the draft; the later comparison only withholds Enter and cannot undo the merge. This contradicts the requirement that steering never merge with a draft, and fixing it requires authorizing input reservation/serialization.bin/fm-spawn.sh:956- When fresh AGY hook cleanup fails, theelifskips the independent backlog/busy rollback, leaving the provisional task metadata and busy generation behind. Always attempt both cleanup operations and combine their failure status.🔧 Fix applied.
✅ Re-checked - no issues remain.
tests/fm-send-inbox-doorbell-live-e2e.test.sh:342- The real AGY 1.2.2 canonical lifecycle guard fails reproducibly at widths 80 and 220 after the control interrupt because the composer does not return to a proven empty state within the guard’s bound; width 120 passes. This blocks demonstrating the required interrupt/composer safety contract across tested pane geometries.tests/fm-composer-matrix-live-e2e.test.sh:280- The aggregate composer guard also exited 1 because installed Claude and Codex sessions were blocked by unrelated trust/review dialogs; the AGY-specific composer cases passed.bin/fm-test-run.sh tests/fm-composer-lib.test.sh;bin/fm-test-run.sh tests/fm-send-inbox.test.shenv -u ANTIGRAVITY_AGENT FM_AGY_LIFECYCLE_LIVE_E2E=1 FM_AGY_LIFECYCLE_TMUX_WIDTH=120 bin/fm-test-run.sh tests/fm-send-inbox-doorbell-live-e2e.test.shbin/fm-test-run.sh tests/fm-control.test.shenv -u ANTIGRAVITY_AGENT FM_AGY_LIFECYCLE_LIVE_E2E=1 FM_AGY_LIFECYCLE_TMUX_WIDTH=80 bin/fm-test-run.sh tests/fm-send-inbox-doorbell-live-e2e.test.sh; same command at width 220, twicebin/fm-test-run.sh tests/fm-composer-lib.test.shbin/fm-test-run.sh tests/fm-backlog-atomicity.test.shbin/fm-test-run.sh tests/fm-spawn-dispatch-profile.test.shbin/fm-test-run.sh tests/fm-control.test.shbin/fm-test-run.sh tests/fm-teardown.test.shbin/fm-test-run.sh tests/fm-quota-choose.test.shbin/fm-test-run.sh tests/fm-busy-adapter-wiring.test.shbin/fm-test-run.sh tests/fm-send-inbox.test.shenv -u ANTIGRAVITY_AGENT FM_HARNESS_LIVENESS_DRIFT=1 FM_HARNESS_LIVENESS_DRIFT_AGY_MARKER=1 bin/fm-test-run.sh tests/fm-harness-liveness-drift-live-e2e.test.shenv -u ANTIGRAVITY_AGENT FM_COMPOSER_MATRIX_LIVE=1 bin/fm-test-run.sh tests/fm-composer-matrix-live-e2e.test.shenv -u ANTIGRAVITY_AGENT FM_SEND_INBOX_LIVE_E2E=1 FM_SEND_INBOX_LIVE_HARNESSES=agy FM_SEND_INBOX_LIVE_TIMEOUT=240 bin/fm-test-run.sh tests/fm-send-inbox-doorbell-live-e2e.test.shenv -u ANTIGRAVITY_AGENT FM_AGY_LIFECYCLE_LIVE_E2E=1 FM_AGY_LIFECYCLE_TMUX_WIDTH=120 bin/fm-test-run.sh tests/fm-send-inbox-doorbell-live-e2e.test.shenv -u ANTIGRAVITY_AGENT FM_AGY_LIFECYCLE_LIVE_E2E=1 FM_AGY_LIFECYCLE_TMUX_WIDTH=80 bin/fm-test-run.sh tests/fm-send-inbox-doorbell-live-e2e.test.shenv -u ANTIGRAVITY_AGENT FM_AGY_LIFECYCLE_LIVE_E2E=1 FM_AGY_LIFECYCLE_TMUX_WIDTH=220 bin/fm-test-run.sh tests/fm-send-inbox-doorbell-live-e2e.test.shtwicegit status --short --branch🔧 Fix applied.
1 warning still open:
bin/fm-test-run.sh --per-script-timeout-secs 180 tests/fm-composer-lib.test.sh tests/fm-busy-adapter-wiring.test.sh tests/fm-control.test.sh tests/fm-tmux-agent-liveness.test.sh tests/fm-quota-choose.test.sh tests/fm-send-inbox.test.sh tests/fm-teardown.test.shFM_COMPOSER_MATRIX_LIVE=1 bash tests/fm-composer-matrix-live-e2e.test.shFM_HARNESS_LIVENESS_DRIFT=1 FM_HARNESS_LIVENESS_DRIFT_AGY_MARKER=1 FM_LIVE=1 bash tests/fm-harness-liveness-drift-live-e2e.test.shFM_AGY_LIFECYCLE_LIVE_E2E=1 FM_AGY_LIFECYCLE_TMUX_WIDTH=80 bash tests/fm-send-inbox-doorbell-live-e2e.test.shFM_AGY_LIFECYCLE_LIVE_E2E=1 FM_AGY_LIFECYCLE_TMUX_WIDTH=120 bash tests/fm-send-inbox-doorbell-live-e2e.test.shFM_AGY_LIFECYCLE_LIVE_E2E=1 FM_AGY_LIFECYCLE_TMUX_WIDTH=220 bash tests/fm-send-inbox-doorbell-live-e2e.test.sh🔧 **Document** - 1 issue found → auto-fixed ✅
docs/verification/agy.md:413- Final-tip live evidence for the new post-doorbell idle-and-empty settle assertion is still unavailable; recorded AGY 1.2.2 runs predate this guard change.🔧 Fix applied.
✅ Re-checked - no issues remain.
🔧 **Lint** - 1 issue found → auto-fixed ✅
🔧 Fix applied.
✅ Re-checked - no issues remain.
✅ **Push** - passed
✅ No issues found.