Repository navigation
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dcef547c5a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if [ -e "$TURNEND" ] \ | ||
| || { printf '%s\n' "$pane" | grep -Fq 'Read the brief at' \ | ||
| && printf '%s\n' "$pane" | grep -Fq 'esc to cancel'; }; then |
There was a problem hiding this comment.
Confirm completed Agy secondmate brief delivery
Captain, when --secondmate uses Agy, task-hook creation is skipped by the KIND != secondmate guard, so a fresh launch has no hook that can create $TURNEND. If the initial brief turn starts and finishes between the default 500 ms polls, esc to cancel has already disappeared and this loop times out even though the brief was delivered, causing fm-spawn.sh to report a false launch failure; recognize the completed idle transcript or provide an equivalent completion marker for secondmates.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in b139612 ("fix(agy): confirm secondmate brief delivery without a task-local hook"), part of the current head b8eeb99. agy_wait_for_delivery now also accepts a returned-to-idle composer as delivery proof once the transcript shows the brief pointer text, so a secondmate turn that starts and finishes between polls (no $TURNEND, no busy-footer sample) no longer reports a false delivery failure. Added a regression test for this exact scenario (test_agy_delivery_accepts_fast_completed_turn) and a before/after harness comparing the pre-fix and post-fix behavior on the same fast-completed pane, both in the PR.
|
Automated reminder: thanks for the PR! This branch currently has a merge conflict with the base branch. When you get a chance, please rebase onto (or merge) the latest base branch, resolve the conflict, and push. After that, checks will re-run and the PR will get looked at again. Noted for firstmate#1408 at |
b226fc3 to
b8eeb99
Compare
d80aed8 to
1e6a0ca
Compare
40d8703 to
ebd717b
Compare
7e80100 to
77c03e3
Compare
…arness misclassification
…er-continuity docs
Reorder the fixture-routing case in bin/fm-test-run.sh so the directory-scoped tests/fixtures/*/* pattern is checked before the broader tests/fixtures/* pattern, restoring both upstream's quota-skill mapping and Agy's mapping (SC2221/SC2222). Quote the empty FM_COMPOSER_HARNESS assignment in tests/fm-agy-harness.test.sh (SC1007). Parenthesize the case patterns in the same test's nested tmux() mock so Bash 3.2's command-substitution scanner, which treats a case pattern's bare closing paren as unbalanced, can parse the file.
Secondmate spawns skip task-local turn-end hook creation, so agy_wait_for_delivery's $TURNEND check never fires for that kind, and polling only the transient busy footer misses a brief that starts and finishes between two polls. Once the transcript shows the pointer text, accept either the busy footer or a returned-to-idle composer as delivery proof. Addresses PRRT_kwDOS4Me3c6Vfkn6 on PR 1408.
…ry contract Upstream now requires --mode/--yolo on every ship spawn (main's per-task delivery contract commit, landed after this branch's last rebase). The Agy test helper predated that and omitted both flags, so every spawn in this file failed before reaching Agy-specific behavior. Match the pattern already used by the Kimi and dispatch-profile suites.
…act in harness adapter skill
…structure The upstream composer refactor reads Orca through fm_backend_orca_capture, and spawn now refreshes a pooled worktree base before harness wiring, so the Orca stub targets the new capture seam and the occupied-hook-root case commits its roots as tracked project content that survives the refresh. The Agy proof's 'probe' local is renamed rule_probe: a known variable named probe makes ShellCheck read upstream's identity=probe-absent assignments in sourcing adapters as arithmetic (SC2100).
The live guard's brief turn now also runs bin/fm-harness.sh and captures ANTIGRAVITY_AGENT from inside the real Agy session, so the marker precedence in fm-harness.sh and the env -u ANTIGRAVITY_AGENT clearing at every other adapter's launch boundary rest on live evidence rather than a fake ancestor. The verification record gains that section and names which adapter facts have no live surface and stay portable-suite evidence, so a test report can tell live results from suite results honestly.
# Conflicts: # .agents/skills/afk/SKILL.md
Driving the seatbelt transport live against Anti-Gravity CLI 1.1.28 showed the
tracked primary registration could not work as written.
Agy reads a PreToolUse decision from the hook's stdout and treats any nonzero
exit as a failed hook rather than a decision, so the old wrapper's exit-2
propagation surfaced a deny as a raw stderr dump instead of a decision object.
Agy also reads a returned `{}` as a deny with an empty reason, so the old
wrapper's `{}` on allow would have blocked every run_command in an Agy primary.
The full rendering matrix, including exit status, is now in the verification
record.
- bin/fm-arm-pretool-check.sh, bin/fm-cd-pretool-check.sh: add --agy, which
prints the decision object on stdout and exits 0, following the existing
--cursor precedent for a harness that reads the returned object.
- .agents/hooks.json: select --agy, return nothing when a command is allowed,
and anchor every command on `pwd -P` with a hook-loaded-root check like
.codex/hooks.json instead of bare `../bin/` relative paths. Every path
returns one object or nothing and exits 0.
- tests/fm-agy-harness.test.sh: execute the tracked hook command strings for
allow, deny, hook-loaded-root anchoring, and the Stop fallback.
- tests/fm-arm-pretool-check.test.sh, tests/fm-cd-pretool-check.test.sh: the
agy matrix entry now drives --agy and asserts the exit-0 deny contract.
- tests/fm-agy-live-e2e.test.sh: drive silence, `{}`, a deny at exit 0, and a
deny at exit 2 against the real binary on every refresh. The interrupt check
now reads the Interrupted banner and the busy footer clearing as two
independent signals, because 1.1.28 renders that banner only sometimes when
it tracks the steered command as a background task.
- docs: record the 1.1.28 evidence and update the harness wiring rows.
Spawning an Agy worker failed outright about one launch in five, loudly: error: Agy brief pointer submission was not proven empty after Enter (unknown) Two independent live evidence passes on 2026-09-09 hit it, 1 abort in 7 spawns and then 2 hard failures in 11, the second capturing pane frames every 0.4s. Agy repaints an incomplete composer for one to two seconds after the workspace-trust dialog is accepted. agy_wait_for_ready released on the FIRST frame that classified as an empty composer, so a single good frame inside that repaint satisfied it; the pointer was then typed with no settle, and the post-Enter emptiness proof gave up after about 1.5 seconds. - bin/fm-spawn.sh: the empty-composer verdict must now hold across consecutive polls (FM_AGY_READY_STABLE_POLLS, default 2) and any non-empty frame resets the count; FM_AGY_SUBMIT_SETTLE defaults to 0.4 rather than 0; and FM_AGY_SUBMIT_RETRIES defaults to 6, widening the post-Enter proof from about 1.5s to about 3s. All three remain environment-overridable. - tests: the fixture renders a scriptable ready-frame sequence whose only isolated good frame sits inside the repaint, and records which frame the pointer was typed after. Two cases drive the real bin/fm-spawn.sh in both directions, so the guard cannot go vacuous. - docs/verification/agy-harness.md: the failure text, the counts, the diagnosis, and the three knobs before and after, plus an operator pointer for when the repaint window grows again. The record also stops claiming the primary-side seatbelts were driven inside a live Agy primary. They were not: three attempts stalled in Generating for three to five minutes without reaching a tool call, and a hookless control lab stalled identically, so the stall is the account or model rather than this change. The transport those hooks depend on was proven live four times inside the e2e guard, and that is what the record now says.
The README and the verification record said the PreToolUse decision transport was driven live against the real binary without saying it was driven from a WORKER session, which only the turn-end guard's compatibility limit spelled out. A reader could take that as a claim the primary-side seatbelts were exercised in a primary. They were not, and the record now says so in the same place it states what was proven.
Writing a live test for the watcher re-ring caught a defect the fixture could not: on Agy 1.1.28 the composer DROPS its `? for shortcuts` hint while it holds unsubmitted text, leaving only the right-aligned model label. fm_composer_separated_state required a hint-bearing footer, so a real pending composer classified `unknown`, and fm_task_inbox_ring defers only on an exact `pending`. The watcher would have typed its doorbell into a captain's half-typed line and submitted it. The portable fixture had encoded the hint-bearing shape as its pending case, so it agreed with the classifier and the gap stayed invisible until the real binary was driven with text in the box. - bin/fm-composer-lib.sh: accept the model-label footer row alongside the two hint rows. The function already returns early unless the caller declared the pane's harness is agy, so no other harness is reachable from this change. - tests/fm-agy-harness.test.sh: the pending fixture now carries the real shape, a second fixture keeps the hint-bearing variant, and an explicit case pins that an EMPTY composer still classifies empty. That inverse matters more than the fix: if empty ever read pending, every steer would defer forever and steering would die silently. - tests/fm-agy-live-e2e.test.sh: three stages added, all reusing the worker the guard already launches. The re-ring is driven in both directions against the real binary, declaring the harness the way bin/fm-watch.sh composes it rather than a value the test invented. Relaunch after a completed turn proves the previous wiring is retired, replacement wiring is armed with a rotated token and registry entry, the project root is untouched, and the relaunched agent is a live controllable worker. Both new stages run after the pre-existing ones so their timing is unchanged. The stage fails against the pre-fix classifier and passes after it, verified by reverting only the classifier line and re-running the guard against agy 1.1.28. Away-mode harness forwarding deliberately gains no live stage: its only harness-dependent input is bin/fm-harness.sh returning agy from inside a real tool call, already driven in the brief turn, and the forwarding decision on top of it is deterministic shell with no rendered surface. The verification record now states that, alongside the two failure-injection halves that stay portable by necessity. The general hazard underneath, that fm_task_inbox_ring types into any composer state it cannot identify, is filed as kunchenguid#4088 rather than changed here: it alters behavior for every harness, and it touches the same decision from the opposite side, so landing both together would make a later regression impossible to attribute.
Agy paints typed input several characters behind the keystrokes, so the composer already classifies pending at a partial draft seconds before the whole line is on screen. The re-ring stage rang as soon as the verdict flipped, then asserted the full draft was still intact, so it could fail on a pane the deferred re-ring had never touched. Wait for both the pending verdict and the fully rendered draft, and assert the render explicitly so the intact-draft check cannot go vacuous. The failure messages now carry the composer verdict and the pane tail. Diagnosed against a live Agy 1.1.28 worker during validation: the product behavior was correct in the failing run (the re-ring returned 1 and typed nothing); the assertion was racing Agy's own repaint.
Two facts cost hours to establish while validating this branch, and both were living only in a private note. The no-mistakes trust boundary covers the whole of `.no-mistakes.yaml`, not just its executable keys: every run's manifest records a trusted_config_sha equal to the default branch's tip. So no gate setting can be changed from the branch being validated, and a gate behavior that blocks a feature branch has to be fixed by landing a config commit on main first. The gate-defaults owner in docs/configuration.md already said this for commands.test; it now says it for the file. The Agy verification record gains the matching consequence: the three behaviors that stay portable are a floor rather than a backlog, driving gaps live on 2026-09-09 was still worth its cost, and it was never going to end the validation objection, because that objection attaches to whatever portable scenario remains.
The guard that pins the watcher leaving a raw-launched Agy pane alone mid-turn had a subshell function body, needed so sourcing bin/fm-watch.sh does not pollute the suite shell. `fail` is `exit 1`, which inside `( )` ends only the subshell, and the call site did not check its status, so the suite carried on and exited 0 no matter what the watcher did. The guard could pass but could never fail. Keep the subshell and check its status next to it, so the check cannot be lost the way a distant call-site check can. Proved both directions. With a deliberately failing assertion the old form printed `not ok` and still exited 0 with every test reported passing; the new form exits 1. Narrowing the busy classifier back to an exact `agy` match, the regression this guard exists to catch, now fails the suite, where before it reported green.
commented
Sep 28, 2026
|
Closed as superseded — this work already landed on main via #4200. — Kun's Firstmate |
What this adds
An opt-in
agyharness adapter (Antigravity CLI) with control-plane parity: spawn including trust-dialog handling and brief delivery, turn-end signalling through aStophook, steering, busy classification, composer state, interrupt, relaunch, exit, and a teardown that retires exactly what it armed.Agy's customization roots are borrowed rather than owned. A pre-existing project root is preserved, a project-authored
hooks.jsonis never replaced, only a root this adapter created is removed, and hook wiring is recorded before it is armed so an interrupted spawn cannot leave armed wiring behind with no retirement record.Why
agyis an opt-in addition: nothing changes for an existing harness unless it is selected. Changes to shared code are confined to giving the existing composer and busy classifiers an Agy branch, plus the hook scripts and tests this adapter needs.How it was verified
An opt-in live guard drives the real binary end to end on its own tmux socket: trust dialog, brief pointer delivery, hook arming in a borrowed root, harness detection from inside a live tool call, the
Stoppayload, a steering doorbell, all fourPreToolUsedecision renderings, busy footer classification, single-Escape interrupt, the re-ring deferring on a real pending composer and proceeding once it is cleared, relaunch,/exit, and teardown. All 17 stages passed. The binary self-updated from 1.1.28 to 1.2.0 during verification and the adapter passed unchanged on both.Portable regressions pin the same logic with no binary present, so CI enforces the classifiers wherever it runs tmux.
Limitations, stated plainly
The primary-side seatbelts are untested. The tracked
.agents/hooks.jsonseatbelts have not been driven inside a live Agy primary, and nothing here claims they have. Attempts stalled before ever reaching a tool call, and a hookless control on the same account stalled identically, so the stall is the account or the model rather than anything in this change. What is proven live is the transport those hooks depend on: the fourPreToolUserenderings were driven against the real binary from a worker session, which is what establishes that only silence allows and that a returned object blocks at either exit status. The wrapper between that transport and the seatbelt scripts is covered by the portable suite.Three behaviors stay portable-only and are not claimed as live. The two failure-injection halves need a write to fail at a chosen instant inside a real launch and a supervisor pane caught mid-tool-call, neither of which can be hit reliably against a live model turn. The away-mode forwarding path's only harness-dependent input is already proven live, so a live stage there would re-prove the same detection through a longer path.
The busy classifier matches the Agy family by prefix. Narrowing it to the exact name removes the only verdict that defers the doorbell on a raw-launched pane. The starvation tension that prefix match creates is filed as #4088 rather than resolved here.
Known scope limit, zellij. Agy is not wired for the zellij backend:
fm_backend_zellij_composer_stateis the one composer adapter that did not get the sharedfm_composer_separated_statebranch, so spawning--harness agythere fails at submission verification rather than being refused up front. The reason is the missing branch, not any capability zellij lacks: zellij declaresstyled=1withcursor=0and does expose an ANSI composer primitive, while orca and cmux declarestyled=0withcursor=0and were routed through the shared structure anyway. Wiring a fifth adapter was deliberately left out because zellij is experimental, has no real-backend CI lane, is never selected automatically and must be named explicitly, so this branch cannot prove it. The documentation that previously justified the omission by a capability zellij actually has is corrected here in all three places it appeared.