Skip to content
Closed
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
1769d84
feat: add terminal-backed Antigravity native Chat
nwparker Oct 2, 2026
025a88e
fix: preserve Antigravity turn and transcript authority
nwparker Oct 2, 2026
4721d33
test: capture real Antigravity 1.2.14 command approval
nwparker Oct 2, 2026
3f9536b
docs: state native Chat association and live approval limits
nwparker Oct 2, 2026
e3c4ff7
fix: retain Antigravity step order at timestamp ties
nwparker Oct 2, 2026
8ce5899
fix: settle acknowledged Antigravity Chat interruptions
nwparker Oct 2, 2026
09169ed
test: integrate captured Antigravity approvals with CI baselines
nwparker Oct 2, 2026
fea561e
Repair Antigravity Chat review findings
nwparker Oct 3, 2026
6057c2a
Refuse Antigravity file provenance after lost host contact
nwparker Oct 3, 2026
907b75f
Merge current main into Antigravity Chat repair
nwparker Oct 3, 2026
bebdb53
Read Antigravity permission screens through the ruled-screen reader
nwparker Oct 3, 2026
f514660
Merge pinned main bde1c098 into Antigravity native chat
nwparker Oct 3, 2026
c736851
Merge fixed main into Antigravity Chat
nwparker Oct 4, 2026
226488b
Supply the session prompt registry in child-work retention fixture
nwparker Oct 4, 2026
ed05fdb
fix: reconcile Antigravity first Chat sends with its transcript clock
nwparker Oct 4, 2026
2c64a32
Merge pinned main into the reviewed Antigravity Chat draft
nwparker Oct 4, 2026
0ac1783
test: narrow Antigravity screen callback access
nwparker Oct 4, 2026
b7d38d5
test: freeze native-build output oracle after producer exit
nwparker Oct 4, 2026
36304d5
fix: stop native reaping after compiler ownership ends
nwparker Oct 4, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 110 additions & 0 deletions docs/reference/antigravity-native-chat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# Antigravity terminal-backed Chat UI

Antigravity uses the existing experimental Chat UI over its terminal and saved
transcript. It is not a structured-session provider. The opt-in default-chat
setting applies when a real provider session is associated. New unassociated
Antigravity sessions start in Terminal and apply that preference when the execution
host supplies their CLI conversation ID. Resuming a known CLI conversation applies
the preference at launch. An explicit view choice or an unconfirmed restored row
is preserved; an IDE reference ID is not a CLI conversation ID.

## Transcript contract

The execution host reads
`.gemini/antigravity-cli/brain/<conversation-id>/.system_generated/logs/transcript.jsonl`.
A hook-reported transcript path takes precedence. Existing WSL exact-path and
host-isolation rules apply; id-only WSL reads derive the distro from the owning
hook server's canonical provider-session row and inspect only that guest.
Ambiguous or unavailable namespaces fail before reading a local file, including
provenance checks for SSH- or paired-owned IDs on the client. A missing guest transcript must not
fall back to a native host's same-named conversation. Direct SSH panes stay in the terminal:
that connection has no native-chat transcript transport, and its absolute file
path must never be opened on the client. Paired runtimes remain eligible because
their own host reads the transcript. Direct SSH chat support remains unfinished.

The sanitized fixture in `src/main/native-chat/__fixtures__/antigravity/` records
these observed shapes:

- User input is `USER_EXPLICIT/USER_INPUT` with a `USER_REQUEST` wrapper.
- Planner responses carry text, thinking, or tool calls. Tool arguments are in `args`.
- Tool output is a `MODEL` record with a tool-specific type such as `RUN_COMMAND`
or `VIEW_FILE`. It is not a `TOOL_RESULT` record.
- A planner step marked `DONE` can precede more tool work in the same user turn.
The decoder therefore emits no turn-completion verdict. The existing host-owned
hook/status system remains authoritative.

Full reads, incremental tails, and legacy journal imports reuse the same decoder.
Unknown record types are skipped. Tool failures retain a nonzero exit code or
`ERROR` status as an error result.

## Mixed versions

New hosts advertise `native-chat.antigravity.v1`. A new client's chat transport
checks the owning host before reading or subscribing to Antigravity. An older
host gets the existing update-runtime error; a failed capability probe gets the
existing read error. Neither becomes a perpetual first-transcript wait.
No stream opcode or message-block type was added.

## Approvals and terminal ownership

Captured command menus publish an Allow/Deny card through the hook server's
canonical row. Allow sends the recorded one-time `1` key; Deny sends Escape to
the same terminal through the existing input transport. The publisher refuses
stale revisions, replaced terminal generations, unconfirmed restored rows,
unreadable screens, and lost execution-host contact. A WSL relay row must match
an explicitly known PTY distro; an unknown/default distro is not proof of a match.

The current trusted-grid checks and 1.2.14 agent-state rules remain in force.
Only the captured working layout or an idle composer can clear this producer's
card; the idle composer must remain quiet for three seconds. Pending timers
recheck the live row and screen before publication and are cancelled on PTY exit.
Output during a screen read replaces the pending quiet timer; callbacks and reads
from a forgotten PTY incarnation cannot reschedule or publish for its replacement.
No removed readiness module or reader-side status store was restored.

## Verification limits on the current port (2026-10-02)

The native CLI observations below are the original author's evidence preserved
from `09169edd23e2a56ee66f4d3d7b07403f0b04c478`, including its attached proof. The
subsequent review repair replays those committed captures and checks the rebuilt
hidden UI with private CLI/status/transcript fixtures. That fixture proof is not
a new authenticated native run or a new verification of hook delivery or model
generation.

The focused suites cover decoder/full-read/tail parity, unknown records, durable
journal imports, WSL path isolation and stalled reads, captured Windows approvals,
canonical-row revision/incarnation fences, current 1.2.14 readiness/quiescence,
capability refusal and transient probe failure, stream cancellation/reconnect,
Terminal/Chat eligibility and default view. Mobile also checks capabilities before
subscription and history reads. No new wire opcode or structured provider was added.

In a hidden macOS app built from this worktree, with a brand-new profile and
`agentStatusHooksEnabled=false` verified through the live store, a real Chat
composer send reached installed agy 1.2.14 in the same terminal and its saved
transcript. The provider returned “Individual quota reached” on Gemini 3.8 Flash
with a reset about 120 hours away. To inspect the real transcript in Chat without
installing hooks, the actual session ID/path was manually bound after matching the
submitted marker in that file. This is real read/send/toggle evidence, not proof
of automatic hook delivery, successful generation, or live Allow/Deny actions.

A subsequent isolated, authenticated Claude Sonnet turn reached an actual
`cat proof.txt` command approval on macOS agy 1.2.14. Its sanitized authoritative
159×69 main-buffer grid is recorded with a provenance sidecar and passes the
existing hold rule. The canonical hook-server snapshot remained empty on that
main build, so automatic Chat association and live Chat Allow/Deny remain
unverified pending the separately owned POSIX hook transport fix. This turn
proves real generation and the current permission layout, not completed tool
execution or a Chat approval card.

The committed Windows approval recordings came from the scoped predecessor and
remain historical 1.2.7 evidence. Current Windows/WSL/Linux/paired execution and
mobile device UI were not available here. These limits must accompany a successor
PR; keep #20157 open while its Cursor portion is absent. Accounts and IDE history
continuation are separate follow-ups.

## Adoption

Scoped recovery of #21660 and #21776 credits the original #15773 work by
@haoliangli. WSL transcript and relay-approval support recovers #24141 by
@sojiro-o. No old development branch was merged wholesale, and predecessors must
remain open until the successor lands.
42 changes: 42 additions & 0 deletions docs/reference/antigravity-readiness-evidence.md
Original file line number Diff line number Diff line change
Expand Up @@ -330,3 +330,45 @@ The honest summary is that this is a screen-shaped problem being solved with lin
rule over the derived tail can be made much better than what ships today, but the durable fix is to
ask the terminal emulator what the bottom row of the screen actually is, rather than inferring it
from a byte stream that was written with cursor addressing. Attempt seven does that.

## Native Windows command approval — 1.2.7 (2026-09-20)

`antigravity-windows-command-approval.txt` records an actual authenticated tool
turn, stopped while the four-choice “Run this command?” dialog owns the screen.
`antigravity-windows-command-cancelled.txt` records another harmless command turn
and Escape dismissing that dialog back to the empty composer. Both used the
repository PTY recorder on native Windows at 120×40, with account information
hidden. The command executable's OS username is replaced with a same-length
placeholder in the transcript and sidecar. Both pass the transcript secret scan.

The approval screen ends with the navigation hint and `esc to cancel`; its four
choices distinguish it from ordinary working output. The runtime regression
previously timed out without a blocked reason. The approval publisher recognizes that captured menu; the current agent-state
rules hold readiness while it owns the screen. The cancelled capture reads as
an idle composer, held to the current three-second quiescence gate.

These are historical Windows recordings, not live proof of the current port.
Current macOS/Windows/WSL Allow/Deny flows and narrower widths still need live
verification. Do not infer permission from `PreToolUse`: agy can
execute an already-allowed tool without waiting for a user decision.

`antigravity-windows-command-allow-key.txt` additionally records the pending menu,
sending the single key `1` (no Enter), successful harmless command execution and
return to the empty composer. This verifies the existing Chat approval card's
one-time acceptance key on native Windows 1.2.7. The recorder metadata confirms
completion; the capture was transferred as raw UTF-8 bytes without newline
normalization and its username was replaced with a same-length placeholder.

## Native macOS command approval — 1.2.14 (2026-10-02)

`antigravity-macos-1-2-14-command-approval.txt` captures an actual authenticated
Claude Sonnet turn requesting `cat proof.txt` in a disposable folder. It is the
authoritative restored main PTY grid at 159×69, with ANSI retained and identifying
username, hostname and task-profile suffix scrubbed; the sidecar distinguishes
this grid snapshot from raw PTY event bytes. Existing replay tests recognize the
four-choice menu and return `hold`. No predicate was changed for this capture.

The owning hook-server row was absent during this run. This proves the current
CLI permission screen, not automatic Chat association, an actionable Chat card,
or successful Allow/Deny delivery. Those require live verification after the
separately owned POSIX hook transport successor lands.
62 changes: 62 additions & 0 deletions mobile/src/session/mobile-antigravity-chat-capability.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import { expect, it, vi } from 'vitest'
import {
requireMobileAntigravityChatCapability,
startMobileNativeChatAfterCapability
} from './mobile-antigravity-chat-capability'

const response = (capabilities: string[]) => ({
ok: true as const,
id: 'status',
result: { capabilities },
_meta: { runtimeId: 'host' }
})

it('refuses old hosts and keeps transient probe failures as read errors', async () => {
await expect(
requireMobileAntigravityChatCapability(
{ sendRequest: vi.fn(async () => response([])) },
'antigravity'
)
).rejects.toThrow('Update the connected')
await expect(
requireMobileAntigravityChatCapability(
{
sendRequest: vi.fn(async () => {
throw new Error('timeout')
})
},
'antigravity'
)
).rejects.toThrow('Unable to read')
})

it('does not open a cancelled subscription after a capability probe settles', async () => {
const pending = Promise.withResolvers<ReturnType<typeof response>>()
const start = vi.fn(() => () => {})
const onError = vi.fn()
const cancel = startMobileNativeChatAfterCapability(
{ sendRequest: () => pending.promise },
'antigravity',
start,
onError
)
cancel()
pending.resolve(response(['native-chat.antigravity.v1']))
await vi.waitFor(() => expect(pending.promise).resolves.toBeDefined())
expect(start).not.toHaveBeenCalled()
expect(onError).not.toHaveBeenCalled()
})

it('opens capable hosts and tears down their stream', async () => {
const stop = vi.fn()
const start = vi.fn(() => stop)
const cancel = startMobileNativeChatAfterCapability(
{ sendRequest: vi.fn(async () => response(['native-chat.antigravity.v1'])) },
'antigravity',
start,
vi.fn()
)
await vi.waitFor(() => expect(start).toHaveBeenCalledOnce())
cancel()
expect(stop).toHaveBeenCalledOnce()
})
58 changes: 58 additions & 0 deletions mobile/src/session/mobile-antigravity-chat-capability.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { ANTIGRAVITY_NATIVE_CHAT_RUNTIME_CAPABILITY } from '../../../src/shared/protocol-version'
import { hostStatusProbe } from '../transport/host-status-probe-operations'

const READ_ERROR = 'Unable to read Antigravity Chat from the connected host.'
const OLD_HOST = 'Update the connected Orca runtime to use Antigravity Chat.'

type Client = Parameters<typeof hostStatusProbe.request>[0]

export async function requireMobileAntigravityChatCapability(
client: Client,
agent: string
): Promise<void> {
if (agent !== 'antigravity') {
return
}
let supports: boolean
try {
const reply = hostStatusProbe.interpret(await hostStatusProbe.request(client))
if (!reply.accepted || !reply.value) {
throw new Error(READ_ERROR)
}
supports =
reply.value.capabilities?.includes(ANTIGRAVITY_NATIVE_CHAT_RUNTIME_CAPABILITY) === true
} catch {
throw new Error(READ_ERROR)
}
if (!supports) {
throw new Error(OLD_HOST)
}
}

export function startMobileNativeChatAfterCapability(
client: Client,
agent: string,
start: () => () => void,
onError: (message: string) => void
): () => void {
if (agent !== 'antigravity') {
return start()
}
let cancelled = false
let unsubscribe: (() => void) | undefined
void requireMobileAntigravityChatCapability(client, agent)
.then(() => {
if (!cancelled) {
unsubscribe = start()
}
})
.catch((error: unknown) => {
if (!cancelled) {
onError(error instanceof Error ? error.message : READ_ERROR)
}
})
return () => {
cancelled = true
unsubscribe?.()
}
}
Loading