fix(antigravity): bind native hook screen evidence to runtime terminal

This commit is contained in:
Neil
2026-09-20 02:48:37 -07:00
parent 634ca8fc49
commit c07f7d00b2
4 changed files with 29 additions and 7 deletions
@@ -124,3 +124,23 @@ describe('host-owned Antigravity screen permission', () => {
expect(baseline(server).observation).toEqual(waiting.observation)
})
})
it('accepts the runtime-attested binding absent from a native hook row', () => {
const server = new AgentHookServer()
server.ingestTerminalStatus({
paneKey: PANE,
payload: { state: 'working', agentType: 'antigravity', prompt: 'print marker' }
})
const row = baseline(server)
expect(row.terminalHandle).toBeUndefined()
expect(server.ingestAntigravityScreenPermission({ baseline: row, command: 'echo OK' })).toBe(
false
)
expect(
server.ingestAntigravityScreenPermission({
baseline: { ...row, terminalHandle: 'term-runtime' },
command: 'echo OK'
})
).toBe(true)
expect(baseline(server)).toMatchObject({ state: 'waiting', terminalHandle: 'term-runtime' })
})
@@ -24,7 +24,8 @@ export abstract class AgentHookServerIngestAntigravityScreen extends AgentHookSe
previous.connectionId ||
previous.payload.agentType !== 'antigravity' ||
!baseline.terminalHandle ||
previous.terminalHandle !== baseline.terminalHandle ||
(previous.terminalHandle !== undefined &&
previous.terminalHandle !== baseline.terminalHandle) ||
!expected ||
!current ||
current.authorityId !== expected.authorityId ||
@@ -62,7 +63,7 @@ export abstract class AgentHookServerIngestAntigravityScreen extends AgentHookSe
tabId: previous.tabId,
worktreeId: previous.worktreeId,
connectionId: previous.connectionId,
terminalHandle: previous.terminalHandle,
terminalHandle: baseline.terminalHandle,
providerSession: previous.providerSession,
payload: {
...previous.payload,
@@ -60,7 +60,6 @@ it('publishes the captured permission and cancellation to the canonical hook sto
}
wiring.statusStore.ingestTerminalStatus({
paneKey,
terminalHandle: handle,
payload: {
state: 'working',
agentType: 'antigravity',
@@ -23,11 +23,13 @@ export class OrcaRuntimeWithVisibleSnapshotPreview extends OrcaRuntimeWithCaptur
if (!pty?.connected || pty.connectionId || !pty.paneKey) {
return null
}
return (
this.getAgentProviderSessionRowsForPaneFn?.(pty.paneKey)?.find(
(row) => row.providerSessionOnly !== true && row.agentType === 'antigravity'
) ?? null
const terminalHandle = this.getAgentStatusTerminalHandleForPaneKey(pty.paneKey)
const row = this.getAgentProviderSessionRowsForPaneFn?.(pty.paneKey)?.find(
(candidate) =>
candidate.providerSessionOnly !== true && candidate.agentType === 'antigravity'
)
// Native hooks identify the pane; the runtime owns its live terminal binding.
return row && terminalHandle ? { ...row, terminalHandle } : null
},
readScreen: (ptyId) => this.readVisibleTerminalState(ptyId),
isCurrent: (ptyId, screen) =>