Skip to content

fix(antigravity): make agy actually reach worker_done as a supervised worker - #1

Merged
nwparker merged 1 commit into
beattlekid:agy-supervised-workerfrom
LielinaH:agy-integration-fix
Sep 21, 2026
Merged

nwparker merged 1 commit into
beattlekid:agy-supervised-workerfrom
LielinaH:agy-integration-fix

Conversation

@LielinaH

Copy link
Copy Markdown

Builds on stablyai#21705 (this targets agy-supervised-worker directly, so it stays one PR upstream).

I tried to run orca orchestration worker-start --agent antigravity --worktree new-child against your branch and it still failed at agent_readiness. Three separate defects; each one alone is enough to stop every supervised agy worker.

1. Readiness never fires on a default agy launch

The composer check required the trimmed line to be exactly one character. agy 1.2.7 launches in accept-edits mode and paints it into the caret row:

> Accept-edits mode: file edits auto-approved (shift+tab to cycle)

Measured directly with a PTY capture of agy 1.2.7:

agentMode in ~/.gemini/antigravity-cli/settings.json composer row
unset >
accept-edits > Accept-edits mode: file edits auto-approved (shift+tab to cycle)

Widened to a bare > or > <name> mode:. Deliberately narrow: every agy dialog prefixes its highlighted row with > (> Yes, I trust this folder, > Gemini 3.8 Flash), so matching any > <text> would make menus read as ready. There is a regression test for exactly that.

2. No trust artifact for agy

Added markAntigravityWorkspaceTrusted, writing ~/.gemini/antigravity-cli/settings.json under trustedWorkspaces. Verified empirically against agy 1.2.7 — and note this is not ~/.gemini/trustedFolders.json, which belongs to the Gemini CLI and which agy does not consult.

Trust is exact-path and not inherited by subdirectories: C:\Users\<user> was already trusted, yet launching agy in a descendant still raised the prompt and appended the descendant separately. So every child worktree needs its own entry, which is what makes the per-worktree preflight necessary rather than merely convenient.

3. The orchestration path skipped the preset entirely

This is the one worth a close look, because it is invisible to unit tests.

Orca has two trust dispatch chains:

  • the renderer's preflightAgentTrust → IPC agentTrust:markTrusted
  • the main-process markLocalWorktreeTrusted in runtime-worktree-agent-startup.ts

orchestration worker-start only ever takes the second. It matched cursor / copilot / codex and fell straight through for antigravity, so adding preflightTrust: 'antigravity' clears the !preset guard and then does nothing. Renderer-side tests pass while every supervised worker still dies at agent_readiness.

I only found this from a live run; the unit suite was green the whole time it was broken.

Verification

Live, not just unit tests: the dispatch settles succeeded / stage=settled, worker_done arrives carrying the correct taskId and dispatchId, and the new worktree is appended to agy's settings with all sibling keys (agentMode, model, permissions, …) untouched.

62 tests pass across the five affected files; typecheck:node is clean. Each fix has a regression test — I verified they are real by reverting each fix individually and confirming exactly the expected test fails.

Known gap, left deliberately

remote-agent-trust-presets.ts has no antigravity branch. The SSH-side artifact path is unverified, so agy over SSH still stalls at agent_readiness. I recorded that as a comment there rather than guessing at a remote path I could not test.

One note for reviewers

Because turn start for agy rests solely on a hook row (agy emits no OSC title, and is absent from SYNTHETIC_AGENT_TITLE_AGENTS), a cold start currently exceeds the flat 30s AGENT_PROMPT_EFFECT_TIMEOUT_MS while agy is still on Signing in.... The dispatch reports outcome_unknown / turn_start_unobserved and then settles correctly once worker_done lands. Not fixed here — it needs a per-agent budget in resolveAgentPromptEffectTimeoutMs — but it is cosmetic-but-misleading rather than fatal, and worth knowing about.

Three defects each blocked `orchestration worker-start --agent antigravity
--worktree new-child` at the agent_readiness stage.

1. Readiness never fired. The composer check required the trimmed line to be
   exactly one character, but agy 1.2.7 launches in accept-edits mode and paints
   it into the caret row (`> Accept-edits mode: ...`). Widened narrowly to a bare
   `>` or `> <name> mode:`; matching any `> <text>` would make every menu dialog
   read as ready, since they all prefix their highlighted row the same way.

2. No trust artifact for agy. Added markAntigravityWorkspaceTrusted, writing
   ~/.gemini/antigravity-cli/settings.json under `trustedWorkspaces` — verified
   empirically against agy 1.2.7, and distinct from the Gemini CLI's
   trustedFolders.json, which agy does not consult. Trust is exact-path and not
   inherited by subdirectories, so each child worktree needs its own entry.

3. The orchestration path skipped the preset. Orca has two trust dispatch
   chains: the renderer's preflightAgentTrust and the main-process
   markLocalWorktreeTrusted. worker-start only takes the second, which matched
   cursor/copilot/codex and fell through for antigravity, so the trust write
   never happened while renderer-side tests passed.

Verified live end to end: the dispatch settles `succeeded` with worker_done
carrying the right task and dispatch ids, and the worktree is appended to agy's
settings with sibling keys untouched.

Known gap: remote-agent-trust-presets.ts has no antigravity branch. The SSH
artifact path is unverified, so agy over SSH still stalls at agent_readiness.
Recorded in a comment there rather than guessed at.
@nwparker
nwparker merged commit 028d982 into beattlekid:agy-supervised-worker Sep 21, 2026
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.

2 participants