Skip to content

fix(antigravity): preserve continuation context through slow startup - #21657

Merged
nwparker merged 2 commits into
nwparker/agy-onboarding-installfrom
nwparker/agy-continuation-readiness
Sep 21, 2026
Merged

nwparker merged 2 commits into
nwparker/agy-onboarding-installfrom
nwparker/agy-continuation-readiness

Conversation

@nwparker

@nwparker nwparker commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Latest verification — 2026-09-20: The actual Continue in New Session dialog now delivers context and completes a successful response on macOS. Native Windows exposed an additional 8-second PTY-binding deadline: observed binding took 8307 ms and context was lost. Follow-up #21770 fixes that deadline; repeating the actual Windows dialog with 8330 ms binding delivered context and completed successfully. Merge with #21770, not as the complete Windows fix alone. Local proof; Windows before/after. WSL/SSH continuation remains unverified. All checks at the unchanged PR head are green. Earlier screenshots and test notes below describe their original runs.

Files Added Deleted Net
Test 12 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​562 $\color{#cf222e}{\Huge{\mathbf{−}}}$​36 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​526
Prod 18 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​483 $\color{#cf222e}{\Huge{\mathbf{−}}}$​27 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​456

ELI5

A slow-starting Antigravity session could lose the context sent by Continue in New Session: Orca typed into the shell before the agent was ready. Orca now waits for the execution host to confirm Antigravity's empty input box before sending that context.

What Changed

Antigravity's generated-prompt delivery uses the existing host terminal.wait / tui-idle path, which checks the recorded composer screen. It resolves the exact pane, waits up to 60 seconds, and verifies that the same live, writable terminal still belongs to Antigravity before writing. A timeout, lost connection, replaced terminal, or different agent leaves the context unsent and uses the existing failure notice; process presence no longer bypasses readiness.

Both new-tab and explicit-PTY delivery use this path. Paired terminals route to their encoded owner, even when another host is selected. The additive terminal.antigravity-visible-readiness.v1 capability prevents an older host's weaker readiness result from authorizing a paste. Other agents retain their current delivery behavior.

Why

The renderer's old observer accepted a shell's bracketed-paste mode plus 1.5 seconds of quiet. A 12-second wrapper around the installed agy reproduced the bug: the context echoed before startup, then agy opened empty and saved no matching first turn.

The native --prompt-interactive flag works for ordinary initial prompts, but generated continuations can exceed Windows command-line limits. Reusing the host's existing screen classifier retains chunked delivery for large contexts without adding another terminal-screen heuristic or status cache.

Linked Issue

Addresses #18088. Related slow-readiness work: #16660. Stacked on #21656 and the earlier recorded-screen readiness fix #21613.

Visual Proof

Same installed agy 1.2.7 and a wrapper that waits 12 seconds before executing it. The generated continuation uses synthetic, harmless history. Gray blocks redact the shell prompt and private path; screenshots are cropped to the relevant terminal area.

Before: raw paste appears above the agent banner; agy opens with an empty composer and no matching saved first turn.

Before

After: agy receives the continuation as its first turn. The visible 401 is the existing authentication limitation, not a successful generation claim.

After

Testing

  • Hidden macOS Electron, rebuilt host, hooks disabled in the isolated profile. Invoked the real continuation launcher with synthetic source context; inspected the rendered terminal and actual agy transcript.
  • At 10.4 seconds before delayed startup, no prompt marker was written. After readiness, the 919-character prompt matched the saved first user turn by SHA-256.
  • A 36,868-character continuation also matched exactly, without transcript truncation. After adding final agent-identity verification, repeated the delayed launch with a 920-character prompt and another exact hash match.
  • Regression fails on parent code because paste and Enter are written before readiness. 107 focused tests pass, including delayed writes, refusal without process fallback, host ownership, old-host capability absence, disconnected/blocked/exited waits, pane replacement, and another agent taking over.
  • Full typecheck, changed-code quality, commit hooks, and Electron/Vite build pass. New delivery tests live in a separate file to respect the existing test file's line limit.
  • Test terminals closed; temporary command override restored. Original validation tabs preserved.

Successful model generation and actual macOS/Windows continuation dialog paths now pass at the stack head including #21770. Still unverified: WSL/SSH or paired-host execution, 60-second startup and narrow-terminal layouts. Remote/host-loss cases are unit tests. Older hosts intentionally require an upgrade for automatic Antigravity context delivery.

Review

  • Reuses execution-host readiness and published agent identity; no new status producer or screen matcher.
  • Agent skill upstream boundary: not applicable.

Checklist

  • Focused change with ELI5, mechanism, before/after, and rationale.
  • Before/after visual proof attached.
  • Self-reviewed for correctness, security, and performance.
  • Cross-platform, folder-workspace, SSH, and mixed-version behavior considered.
  • Relevant local checks passed; CI covers the broader suite and packaging.

@nwparker

Copy link
Copy Markdown
Contributor Author

Additional live UI verification on 32a37f02b4f, installed agy 1.2.7, hidden macOS renderer:

Clicked an existing harmless test conversation in Session History → Continue in New Session → Start New Session, with Antigravity and Focused handoff selected. No direct launcher invocation or mocked launch API in this run. The dialog closed, a fresh agy terminal opened, and its displayed handoff included the selected conversation and original transcript reference. The new conversation persisted a 1,379-character USER_INPUT record (SHA-256 905be01e9841b8c5e485b6437155f36a1752854302742ce5a0ea141e42054d33). This hash identifies the saved record; unlike the earlier delivery probes, this run did not independently hash the expected prompt before launch.

ELI5: the normal history dialog successfully passed the selected conversation into a new Antigravity session.

Generation still returned 401 ACCESS_TOKEN_TYPE_UNSUPPORTED. This verifies dialog-to-input delivery, not successful model output. This was Antigravity history → Antigravity on macOS, not the Claude pane entry point or Windows. The temporary test tab is closed; the original six runtime terminals remain.

Dialog (workspace path masked):

agy-continuation-dialog.png

Actual terminal result (gray blocks redact account, machine, paths, and error ID):

agy-dialog-result.png

@nwparker

Copy link
Copy Markdown
Contributor Author

Authenticated follow-up, 2026-09-20: clicked Continue in New Session from history, then Start New Session in the real dialog in a hidden macOS renderer. Installed agy 1.2.7 received the generated context, inspected the disposable folder, read its verification context, answered that the task was complete, and returned to an idle composer. This supersedes the earlier authentication and dialog-path limitations. Earlier delayed-start and large-prompt hash checks remain applicable; Windows/WSL live continuation checks are still pending.

Successful continuation and idle composer

@nwparker

Copy link
Copy Markdown
Contributor Author

Independent verification update:

  • Installed agy 1.2.7 returned the exact sentinel AGY_CONTINUATION_LIVE_OK.
  • Continuation/readiness renderer suites: 14 passed.
  • pnpm tc:web passed.
  • Changed-code quality passed with 0 new findings.
  • Existing CI run 35439958948 passed typecheck, static analysis, all 8 test shards, cross-version wire compatibility, and both packages.

Scoped verdict: Approve stacked with #21770 for the verified macOS and Windows continuation paths. WSL/SSH/paired-host execution and extreme startup/layout cases remain unverified.

@nwparker

Copy link
Copy Markdown
Contributor Author

Independent verification (2026-09-20):

  • Continuation/readiness suites: 34 passed, 10 skipped across renderer delivery, draft readiness, transcript fixtures, and runtime readiness specs.
  • pnpm tc:web passed.
  • pnpm run check:code-quality:changed origin/main passed with 0 new findings across 119 changed files.
  • Installed agy 1.2.7 authenticated exact sentinel returned AGY_CONTINUE_OK.
  • Full CI 35439958948, RPC verify 35439958909, and package jobs are green.

Verdict: approve with #21770 in stack order for macOS/Windows continuation readiness. WSL/SSH/paired-host continuation remains unverified. No merge performed.

* feat: render Antigravity terminal sessions in native chat

Co-authored-by: haoliangli <[email protected]>

* fix: keep direct SSH Antigravity chat on its execution host

---------

Co-authored-by: haoliangli <[email protected]>
@nwparker
nwparker marked this pull request as ready for review September 21, 2026 01:04
@nwparker
nwparker merged commit 7dd79a8 into nwparker/agy-onboarding-install Sep 21, 2026
0 of 5 checks passed

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

Direct-SSH Antigravity panes are routed to the local host for readiness because only remote: ids are recognized, so the new path waits out the full budget and then drops the context — and the process-presence fallback that previously covered SSH is removed. See the inline note.

Reviewed changes

  • Host-confirmed Antigravity readiness — waitForAntigravityDraftReady resolves the exact pane with terminal.resolvePane, waits on terminal.wait/tui-idle, then re-verifies the same live, writable pane via terminal.show (agentIdentity === 'antigravity' + stillOwnsPty), gated on the new terminal.antigravity-visible-readiness.v1 capability.
  • Delivery routing — both new-tab and explicit-PTY delivery route Antigravity through that path and remove the process-presence fallback; Antigravity gains a 60 s readiness budget in tui-agent-config.
  • Antigravity native-chat support — decoder, session-file resolution, transport capability guard, and supported-agent wiring (the stacked, separately merged #21660 commit that appears in this diff).

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

settings: Pick<GlobalSettings, 'activeRuntimeEnvironmentId'> | null | undefined
): Promise<boolean> {
const remotePty = parseRemoteRuntimePtyId(ptyId)
const target = remotePty?.environmentId

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Direct-SSH PTY ids look like ssh:<connection>@@<relayPtyId> and are not recognized by parseRemoteRuntimePtyId (which only matches remote:), so target falls through to the active runtime — normally local — and terminal.resolvePane/terminal.wait/terminal.show are issued against the wrong host for an SSH pane. With the process fallback removed in agent-paste-draft.ts:167, SSH Antigravity continuation now stalls for the full budget and silently drops the context, whereas the old waitForExpectedAgentOnPty route reached the SSH host through window.api.pty.inspectProcess.

Technical details
# Direct-SSH Antigravity readiness has no host route

## Affected sites
- `src/renderer/src/lib/antigravity-draft-readiness.ts:27-30` — target selection only understands `remote:` ids.
- `src/renderer/src/lib/agent-paste-draft.ts:167-171` — antigravity refuses instead of using the process fallback; that fallback was the only SSH-capable readiness route.

## Required outcome
- Direct-SSH Antigravity delivery either resolves the SSH execution host correctly, or is refused immediately (before the 60 s wait and before any local-host RPC), so no execution query is issued against the wrong host.

## Suggested approach (optional)
- Detect SSH ownership with `parseAppSshPtyId(ptyId)` (the same helper `isRemoteInspectionPtyId` uses in `runtime-terminal-inspection.ts:88`) and return `false` up front when there is no SSH-capable wait RPC; or keep a narrowly scoped SSH fallback rather than removing the fallback wholesale.

## Open questions for the human
- Is direct-SSH Antigravity continuation intended to work, or is refusing it acceptable? The PR body lists SSH as unverified, but the removed fallback did attempt delivery there.

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.

1 participant